mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 12:11:59 +02:00
clk: qcom: Add API to query corner voltage on given clk frequency
Add new API for clients to query corner voltage required by a given frequency. Change-Id: Ic469c36e016899d882ca084f74e0d2cb2020476c Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
This commit is contained in:
parent
aff8123385
commit
7a79269412
|
|
@ -11,12 +11,14 @@
|
|||
#include <linux/clk-provider.h>
|
||||
#include <linux/reset-controller.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/clk/qcom.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "clk-rcg.h"
|
||||
#include "clk-regmap.h"
|
||||
#include "reset.h"
|
||||
#include "gdsc.h"
|
||||
#include "vdd-level.h"
|
||||
|
||||
struct qcom_cc {
|
||||
struct qcom_reset_controller reset;
|
||||
|
|
@ -357,4 +359,22 @@ void qcom_cc_sync_state(struct device *dev, const struct qcom_cc_desc *desc)
|
|||
}
|
||||
EXPORT_SYMBOL(qcom_cc_sync_state);
|
||||
|
||||
int qcom_clk_get_voltage(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
struct clk_regmap *rclk;
|
||||
struct clk_hw *hw = __clk_get_hw(clk);
|
||||
int vdd_level;
|
||||
|
||||
if (!clk_is_regmap_clk(hw))
|
||||
return -EINVAL;
|
||||
|
||||
rclk = to_clk_regmap(hw);
|
||||
vdd_level = clk_find_vdd_level(hw, &rclk->vdd_data, rate);
|
||||
if (vdd_level < 0)
|
||||
return vdd_level;
|
||||
|
||||
return rclk->vdd_data.vdd_class->vdd_uv[vdd_level];
|
||||
}
|
||||
EXPORT_SYMBOL(qcom_clk_get_voltage);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2019, The Linux Foundation. All rights reserved. */
|
||||
/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. */
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -147,6 +147,9 @@ int clk_find_vdd_level(struct clk_hw *hw,
|
|||
{
|
||||
int level;
|
||||
|
||||
if (!vdd_data->num_rate_max)
|
||||
return -ENODATA;
|
||||
|
||||
/*
|
||||
* For certain PLLs, due to the limitation in the bits allocated for
|
||||
* programming the fractional divider, the actual rate of the PLL will
|
||||
|
|
|
|||
13
include/linux/clk/qcom.h
Normal file
13
include/linux/clk/qcom.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2020 The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_CLK_QCOM_H_
|
||||
#define __LINUX_CLK_QCOM_H_
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
|
||||
int qcom_clk_get_voltage(struct clk *clk, unsigned long rate);
|
||||
|
||||
#endif /* __LINUX_CLK_QCOM_H_ */
|
||||
Loading…
Reference in New Issue
Block a user