Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f266d5b3 authored by David Collins's avatar David Collins
Browse files

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 760be658 ("clk: qcom: Make common clk_hw
registrations").

Change-Id: I1e0bdeecd2d4092bff3110168438211493f4feda
Signed-off-by: default avatarDavid Collins <collinsd@codeaurora.org>
parent dc97f082
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
// 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;