mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 03:59:40 +02:00
clk: qcom: Add clk_get_vdd_corner api for multiple clk_vdd_class
Add clk_get_vdd_corner as some clocks have requirement to vote on multiple clk_vdd_class for clock operations. Change-Id: I03da2134f9a8439a734f7638b61479269a9cec89 Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
This commit is contained in:
parent
31a720c522
commit
c480ab75e3
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. */
|
||||
/* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -112,6 +112,28 @@ static int clk_unvote_vdd_class_level(struct clk_vdd_class *vdd_class, int level
|
|||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* clk_get_vdd_voltage - Return corner voltage for a vdd class
|
||||
* @vdd_data: vdd_class data for the clock
|
||||
* @level: voltage level
|
||||
*
|
||||
* Returns corner voltage on success, -EERROR otherwise.
|
||||
*/
|
||||
int clk_get_vdd_voltage(struct clk_vdd_class_data *vdd_data, int vdd_level)
|
||||
{
|
||||
int i, corner = -EINVAL;
|
||||
|
||||
for (i = 0; i < vdd_data->num_vdd_classes; i++)
|
||||
corner = max(corner, vdd_data->vdd_classes[i]->vdd_uv[vdd_level]);
|
||||
|
||||
if (vdd_data->vdd_class)
|
||||
corner = max(corner, vdd_data->vdd_class->vdd_uv[vdd_level]);
|
||||
|
||||
return corner;
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get_vdd_voltage);
|
||||
|
||||
/**
|
||||
* clk_vote_vdd_level - Add a vote for a given voltage level
|
||||
* @vdd_data: vdd_class data for the clock
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. */
|
||||
/* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */
|
||||
|
||||
#ifndef __QCOM_CLK_VDD_CLASS_H__
|
||||
#define __QCOM_CLK_VDD_CLASS_H__
|
||||
|
|
@ -74,6 +74,7 @@ int clk_find_vdd_level(struct clk_hw *hw, struct clk_vdd_class_data *vdd_data,
|
|||
unsigned long rate);
|
||||
int clk_vote_vdd_level(struct clk_vdd_class_data *vdd_class, int level);
|
||||
int clk_unvote_vdd_level(struct clk_vdd_class_data *vdd_class, int level);
|
||||
int clk_get_vdd_voltage(struct clk_vdd_class_data *vdd_data, int vdd_level);
|
||||
int clk_regulator_init(struct device *dev, const struct qcom_cc_desc *desc);
|
||||
int clk_vdd_proxy_vote(struct device *dev, const struct qcom_cc_desc *desc);
|
||||
int clk_vdd_proxy_unvote(struct device *dev, const struct qcom_cc_desc *desc);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user