lkml.org 
[lkml]   [2019]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v3 7/7] clk: qcom: apcs-msm8916: use clk_parent_data to specify the parent
From
Date
Quoting Niklas Cassel (2019-11-25 05:59:09)
> diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c
> index 46061b3d230e..bb91644edc00 100644
> --- a/drivers/clk/qcom/apcs-msm8916.c
> +++ b/drivers/clk/qcom/apcs-msm8916.c
> @@ -51,6 +51,19 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
> struct clk_init_data init = { };
> int ret = -ENODEV;
>
> + /*
> + * This driver is defined by the devicetree binding
> + * Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt,
> + * however, this driver is registered as a platform device by
> + * qcom-apcs-ipc-mailbox.c. Because of this, when this driver
> + * uses dev_get_regmap() and devm_clk_get(), it has to send the parent
> + * device as argument.
> + * When registering with the clock framework, we cannot use this trick,
> + * since the clock framework always looks at dev->of_node when it tries
> + * to find parent clock names using clk_parent_data.
> + */
> + dev->of_node = parent->of_node;

This is odd. The clks could be registered with of_clk_hw_register() but
then we lose the device provider information. Maybe we should search up
one level to the parent node and if that has a DT node but the
clk controller device doesn't we should use that instead?

----8<-----
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index b68e200829f2..c8745c415c04 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3669,7 +3669,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
if (dev && pm_runtime_enabled(dev))
core->rpm_enabled = true;
core->dev = dev;
- core->of_node = np;
+ core->of_node = np ? : dev_of_node(dev->parent);
if (dev && dev->driver)
core->owner = dev->driver->owner;
core->hw = hw;
\
 
 \ /
  Last update: 2019-12-19 07:24    [W:0.135 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site