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

Commit f6719420 authored by Tianyi Gou's avatar Tianyi Gou
Browse files

qcom: clock: Allow enable always on clocks that are not rate settable



Some clocks do not support set rate (e.g. gate clocks, bus
interface clocks) but might still need to be kept always on.
Therefore, make the initial configuration rate optional when
enable the always on clocks.

Also, the requirement that a clock need to be set rate before
enabled can be captured with warning from the clk_prepare_enable
call. And corresponding clients can fix any misuse in their code.

Change-Id: I54cc1e708f940ae14ec3cadd853671a9b1344d98
Signed-off-by: default avatarTianyi Gou <tgou@codeaurora.org>
parent db33b46d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -147,7 +147,6 @@ General Optional Properties available to any Clock Subnode

- qcom,always-on:	Boolean.
			Enable a clock at boot, and leave it on all the time.
			Requires qcom,config-rate to be set.

mmssnoc_axi: mmssnoc_axi {
	qcom,clk-flags = <0x1000>;
+1 −1
Original line number Diff line number Diff line
@@ -777,7 +777,7 @@ static int __handoff_clk(struct clk *clk)
	if (clk->init_rate && clk_set_rate(clk, clk->init_rate))
		pr_err("failed to set an init rate of %lu on %s\n",
			clk->init_rate, clk->dbg_name);
	if (clk->always_on && clk->init_rate && clk_prepare_enable(clk))
	if (clk->always_on && clk_prepare_enable(clk))
		pr_err("failed to enable always-on clock %s\n",
			clk->dbg_name);

+4 −3
Original line number Diff line number Diff line
@@ -371,8 +371,11 @@ static int generic_clk_parse_init_config(struct device *dev, struct clk *c,
{
	int rc;
	u32 temp;
	char *name = "qcom,config-rate";
	char *name = "qcom,always-on";

	c->always_on = of_property_read_bool(np, name);

	name = "qcom,config-rate";
	/* This property is optional */
	if (!of_find_property(np, name, NULL))
		return 0;
@@ -384,8 +387,6 @@ static int generic_clk_parse_init_config(struct device *dev, struct clk *c,
	}
	c->init_rate = temp;

	name = "qcom,always-on";
	c->always_on = of_property_read_bool(np, name);
	return rc;
}