Commit c742e365 authored by Stephen Boyd's avatar Stephen Boyd Committed by Stephen Boyd

clk: palmas: Migrate to clk_hw based OF and registration APIs

Now that we have clk_hw based provider APIs to register clks, we
can get rid of struct clk pointers while registering clks in
these drivers, allowing us to move closer to a clear split of
consumer and provider clk APIs.

Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: default avatarStephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 416886ad
...@@ -41,7 +41,6 @@ struct palmas_clk32k_desc { ...@@ -41,7 +41,6 @@ struct palmas_clk32k_desc {
struct palmas_clock_info { struct palmas_clock_info {
struct device *dev; struct device *dev;
struct clk *clk;
struct clk_hw hw; struct clk_hw hw;
struct palmas *palmas; struct palmas *palmas;
const struct palmas_clk32k_desc *clk_desc; const struct palmas_clk32k_desc *clk_desc;
...@@ -218,7 +217,7 @@ static int palmas_clks_init_configure(struct palmas_clock_info *cinfo) ...@@ -218,7 +217,7 @@ static int palmas_clks_init_configure(struct palmas_clock_info *cinfo)
} }
if (cinfo->ext_control_pin) { if (cinfo->ext_control_pin) {
ret = clk_prepare(cinfo->clk); ret = clk_prepare(cinfo->hw.clk);
if (ret < 0) { if (ret < 0) {
dev_err(cinfo->dev, "Clock prep failed, %d\n", ret); dev_err(cinfo->dev, "Clock prep failed, %d\n", ret);
return ret; return ret;
...@@ -242,7 +241,6 @@ static int palmas_clks_probe(struct platform_device *pdev) ...@@ -242,7 +241,6 @@ static int palmas_clks_probe(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
const struct palmas_clks_of_match_data *match_data; const struct palmas_clks_of_match_data *match_data;
struct palmas_clock_info *cinfo; struct palmas_clock_info *cinfo;
struct clk *clk;
int ret; int ret;
match_data = of_device_get_match_data(&pdev->dev); match_data = of_device_get_match_data(&pdev->dev);
...@@ -261,22 +259,20 @@ static int palmas_clks_probe(struct platform_device *pdev) ...@@ -261,22 +259,20 @@ static int palmas_clks_probe(struct platform_device *pdev)
cinfo->clk_desc = &match_data->desc; cinfo->clk_desc = &match_data->desc;
cinfo->hw.init = &match_data->init; cinfo->hw.init = &match_data->init;
clk = devm_clk_register(&pdev->dev, &cinfo->hw); ret = devm_clk_hw_register(&pdev->dev, &cinfo->hw);
if (IS_ERR(clk)) { if (ret) {
ret = PTR_ERR(clk);
dev_err(&pdev->dev, "Fail to register clock %s, %d\n", dev_err(&pdev->dev, "Fail to register clock %s, %d\n",
match_data->desc.clk_name, ret); match_data->desc.clk_name, ret);
return ret; return ret;
} }
cinfo->clk = clk;
ret = palmas_clks_init_configure(cinfo); ret = palmas_clks_init_configure(cinfo);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Clock config failed, %d\n", ret); dev_err(&pdev->dev, "Clock config failed, %d\n", ret);
return ret; return ret;
} }
ret = of_clk_add_provider(node, of_clk_src_simple_get, cinfo->clk); ret = of_clk_add_hw_provider(node, of_clk_hw_simple_get, &cinfo->hw);
if (ret < 0) if (ret < 0)
dev_err(&pdev->dev, "Fail to add clock driver, %d\n", ret); dev_err(&pdev->dev, "Fail to add clock driver, %d\n", ret);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment