mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
clk: qcom: common: add device tree consumer support for clk_hws
Add support for device tree consumers to utilize clocks which
are registered via clk_hws in struct qcom_cc_desc.
This modification is effectively
commit 84196373f39d ("clk: qcom: Support to add hardware clocks
to of_clk_hw_provider")
reconciled with with
commit 760be6586f ("clk: qcom: Make common clk_hw
registrations").
Change-Id: I1e0bdeecd2d4092bff3110168438211493f4feda
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
parent
dc97f0827d
commit
f266d5b355
1 changed files with 12 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2014, 2017-2019, The Linux Foundation.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/export.h>
|
||||
|
|
@ -21,6 +22,8 @@ struct qcom_cc {
|
|||
struct qcom_reset_controller reset;
|
||||
struct clk_regmap **rclks;
|
||||
size_t num_rclks;
|
||||
struct clk_hw **clk_hws;
|
||||
size_t num_clk_hws;
|
||||
};
|
||||
|
||||
const
|
||||
|
|
@ -213,6 +216,9 @@ static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec,
|
|||
struct qcom_cc *cc = data;
|
||||
unsigned int idx = clkspec->args[0];
|
||||
|
||||
if (idx < cc->num_clk_hws && cc->clk_hws[idx])
|
||||
return cc->clk_hws[idx];
|
||||
|
||||
if (idx >= cc->num_rclks) {
|
||||
pr_err("%s: invalid index %u\n", __func__, idx);
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
|
@ -268,10 +274,15 @@ int qcom_cc_really_probe(struct platform_device *pdev,
|
|||
|
||||
cc->rclks = rclks;
|
||||
cc->num_rclks = num_clks;
|
||||
cc->clk_hws = clk_hws;
|
||||
cc->num_clk_hws = num_clk_hws;
|
||||
|
||||
qcom_cc_drop_protected(dev, cc);
|
||||
|
||||
for (i = 0; i < num_clk_hws; i++) {
|
||||
if (!clk_hws[i])
|
||||
continue;
|
||||
|
||||
ret = devm_clk_hw_register(dev, clk_hws[i]);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue