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

Commit 1b0e7121 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "clk: qcom: Support to add hardware clocks to of_clk_hw_provider"

parents b365d04c 3b2486c7
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2017-2018, The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -28,7 +28,9 @@
struct qcom_cc {
	struct qcom_reset_controller reset;
	struct clk_regmap **rclks;
	struct clk_hw **hwclks;
	size_t num_rclks;
	size_t num_hwclks;
};

const
@@ -205,11 +207,14 @@ 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_rclks) {
		pr_err("%s: invalid index %u\n", __func__, idx);
	if (idx >= cc->num_rclks + cc->num_hwclks) {
		pr_err("invalid index %u\n", idx);
		return ERR_PTR(-EINVAL);
	}

	if (idx < cc->num_hwclks && cc->hwclks[idx])
		return cc->hwclks[idx];

	return cc->rclks[idx] ? &cc->rclks[idx]->hw : ERR_PTR(-ENOENT);
}

@@ -222,7 +227,9 @@ int qcom_cc_really_probe(struct platform_device *pdev,
	struct qcom_cc *cc;
	struct gdsc_desc *scd;
	size_t num_clks = desc->num_clks;
	size_t num_hwclks = desc->num_hwclks;
	struct clk_regmap **rclks = desc->clks;
	struct clk_hw **hwclks = desc->hwclks;

	cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL);
	if (!cc)
@@ -230,6 +237,17 @@ int qcom_cc_really_probe(struct platform_device *pdev,

	cc->rclks = rclks;
	cc->num_rclks = num_clks;
	cc->hwclks = hwclks;
	cc->num_hwclks = num_hwclks;

	for (i = 0; i < num_hwclks; i++) {
		if (!hwclks[i])
			continue;

		ret = devm_clk_hw_register(dev, hwclks[i]);
		if (ret)
			return ret;
	}

	for (i = 0; i < num_clks; i++) {
		if (!rclks[i])
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014, 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014, 2017-2018, The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -36,7 +36,9 @@ struct parent_map;
struct qcom_cc_desc {
	const struct regmap_config *config;
	struct clk_regmap **clks;
	struct clk_hw **hwclks;
	size_t num_clks;
	size_t num_hwclks;
	const struct qcom_reset_map *resets;
	size_t num_resets;
	struct gdsc **gdscs;