linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API
@ 2022-09-14 14:47 Christian Marangi
  2022-09-14 14:47 ` [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API Christian Marangi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christian Marangi @ 2022-09-14 14:47 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Konrad Dybcio, Michael Turquette,
	Stephen Boyd, linux-arm-msm, linux-clk, linux-kernel
  Cc: Christian Marangi

Introduce (devm_)hw_register_mux_parent_data_table new API. We have
basic support for clk_register_mux using parent_data but we lack any API
to provide a custom parent_map. Add these 2 new API to correctly handle
these special configuration instead of using the generic
__(devm_)clk_hw_register_mux API.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
v2:
- Rebase on top of linux-next/master

 include/linux/clk-provider.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 1615010aa0ec..65b70f0d62c5 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -974,6 +974,13 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name,
 	__clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, NULL, \
 			      (parent_data), (flags), (reg), (shift),	      \
 			      BIT((width)) - 1, (clk_mux_flags), NULL, (lock))
+#define clk_hw_register_mux_parent_data_table(dev, name, parent_data,	      \
+					      num_parents, flags, reg, shift, \
+					      width, clk_mux_flags, table,    \
+					      lock)			      \
+	__clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, NULL, \
+			      (parent_data), (flags), (reg), (shift),	      \
+			      BIT((width)) - 1, (clk_mux_flags), table, (lock))
 #define devm_clk_hw_register_mux(dev, name, parent_names, num_parents, flags, reg, \
 			    shift, width, clk_mux_flags, lock)		      \
 	__devm_clk_hw_register_mux((dev), NULL, (name), (num_parents),	      \
@@ -987,6 +994,13 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name,
 				   (parent_hws), NULL, (flags), (reg),        \
 				   (shift), BIT((width)) - 1,		      \
 				   (clk_mux_flags), NULL, (lock))
+#define devm_clk_hw_register_mux_parent_data_table(dev, name, parent_data,    \
+					      num_parents, flags, reg, shift, \
+					      width, clk_mux_flags, table,    \
+					      lock)			      \
+	__devm_clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL,  \
+			      NULL, (parent_data), (flags), (reg), (shift),   \
+			      BIT((width)) - 1, (clk_mux_flags), table, (lock))
 
 int clk_mux_val_to_index(struct clk_hw *hw, const u32 *table, unsigned int flags,
 			 unsigned int val);
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API
  2022-09-14 14:47 [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Christian Marangi
@ 2022-09-14 14:47 ` Christian Marangi
  2022-09-30 19:39   ` Dmitry Baryshkov
  2022-10-04  3:51   ` Stephen Boyd
  2022-09-30 19:19 ` [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Stephen Boyd
  2022-10-04  3:51 ` Stephen Boyd
  2 siblings, 2 replies; 6+ messages in thread
From: Christian Marangi @ 2022-09-14 14:47 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Konrad Dybcio, Michael Turquette,
	Stephen Boyd, linux-arm-msm, linux-clk, linux-kernel
  Cc: Christian Marangi

Convert the driver to parent data API. From the Documentation pll8_vote
and pxo should be declared in the DTS so fw_name can be used instead of
parent_names. .name is changed to the legacy pxo_board following how
it's declared in other drivers.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
v2:
- Change .name from pxo to pxo_board following other driver

 drivers/clk/qcom/kpss-xcc.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c
index 88d4b33ac0cc..b1b370274ec4 100644
--- a/drivers/clk/qcom/kpss-xcc.c
+++ b/drivers/clk/qcom/kpss-xcc.c
@@ -12,9 +12,9 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 
-static const char *aux_parents[] = {
-	"pll8_vote",
-	"pxo",
+static const struct clk_parent_data aux_parents[] = {
+	{ .fw_name = "pll8_vote", .name = "pll8_vote" },
+	{ .fw_name = "pxo", .name = "pxo_board" },
 };
 
 static const u32 aux_parent_map[] = {
@@ -32,8 +32,8 @@ MODULE_DEVICE_TABLE(of, kpss_xcc_match_table);
 static int kpss_xcc_driver_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *id;
-	struct clk *clk;
 	void __iomem *base;
+	struct clk_hw *hw;
 	const char *name;
 
 	id = of_match_device(kpss_xcc_match_table, &pdev->dev);
@@ -55,24 +55,16 @@ static int kpss_xcc_driver_probe(struct platform_device *pdev)
 		base += 0x28;
 	}
 
-	clk = clk_register_mux_table(&pdev->dev, name, aux_parents,
-				     ARRAY_SIZE(aux_parents), 0, base, 0, 0x3,
-				     0, aux_parent_map, NULL);
+	hw = devm_clk_hw_register_mux_parent_data_table(&pdev->dev, name, aux_parents,
+							ARRAY_SIZE(aux_parents), 0,
+							base, 0, 0x3,
+							0, aux_parent_map, NULL);
 
-	platform_set_drvdata(pdev, clk);
-
-	return PTR_ERR_OR_ZERO(clk);
-}
-
-static int kpss_xcc_driver_remove(struct platform_device *pdev)
-{
-	clk_unregister_mux(platform_get_drvdata(pdev));
-	return 0;
+	return PTR_ERR_OR_ZERO(hw);
 }
 
 static struct platform_driver kpss_xcc_driver = {
 	.probe = kpss_xcc_driver_probe,
-	.remove = kpss_xcc_driver_remove,
 	.driver = {
 		.name = "kpss-xcc",
 		.of_match_table = kpss_xcc_match_table,
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API
  2022-09-14 14:47 [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Christian Marangi
  2022-09-14 14:47 ` [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API Christian Marangi
@ 2022-09-30 19:19 ` Stephen Boyd
  2022-10-04  3:51 ` Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2022-09-30 19:19 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Christian Marangi, Konrad Dybcio,
	Michael Turquette, linux-arm-msm, linux-clk, linux-kernel
  Cc: Christian Marangi

Quoting Christian Marangi (2022-09-14 07:47:42)
> Introduce (devm_)hw_register_mux_parent_data_table new API. We have
> basic support for clk_register_mux using parent_data but we lack any API
> to provide a custom parent_map. Add these 2 new API to correctly handle
> these special configuration instead of using the generic
> __(devm_)clk_hw_register_mux API.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---

Acked-by: Stephen Boyd <sboyd@kernel.org>

or I'll pick it up after Bjorn sends qcom PR.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API
  2022-09-14 14:47 ` [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API Christian Marangi
@ 2022-09-30 19:39   ` Dmitry Baryshkov
  2022-10-04  3:51   ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2022-09-30 19:39 UTC (permalink / raw)
  To: Christian Marangi, Bjorn Andersson, Andy Gross, Konrad Dybcio,
	Michael Turquette, Stephen Boyd, linux-arm-msm, linux-clk,
	linux-kernel

On 14/09/2022 17:47, Christian Marangi wrote:
> Convert the driver to parent data API. From the Documentation pll8_vote
> and pxo should be declared in the DTS so fw_name can be used instead of
> parent_names. .name is changed to the legacy pxo_board following how
> it's declared in other drivers.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> ---
> v2:
> - Change .name from pxo to pxo_board following other driver
> 
>   drivers/clk/qcom/kpss-xcc.c | 26 +++++++++-----------------
>   1 file changed, 9 insertions(+), 17 deletions(-)

-- 
With best wishes
Dmitry


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API
  2022-09-14 14:47 [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Christian Marangi
  2022-09-14 14:47 ` [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API Christian Marangi
  2022-09-30 19:19 ` [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Stephen Boyd
@ 2022-10-04  3:51 ` Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2022-10-04  3:51 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Christian Marangi, Konrad Dybcio,
	Michael Turquette, linux-arm-msm, linux-clk, linux-kernel
  Cc: Christian Marangi

Quoting Christian Marangi (2022-09-14 07:47:42)
> Introduce (devm_)hw_register_mux_parent_data_table new API. We have
> basic support for clk_register_mux using parent_data but we lack any API
> to provide a custom parent_map. Add these 2 new API to correctly handle
> these special configuration instead of using the generic
> __(devm_)clk_hw_register_mux API.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API
  2022-09-14 14:47 ` [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API Christian Marangi
  2022-09-30 19:39   ` Dmitry Baryshkov
@ 2022-10-04  3:51   ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2022-10-04  3:51 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Christian Marangi, Konrad Dybcio,
	Michael Turquette, linux-arm-msm, linux-clk, linux-kernel
  Cc: Christian Marangi

Quoting Christian Marangi (2022-09-14 07:47:43)
> Convert the driver to parent data API. From the Documentation pll8_vote
> and pxo should be declared in the DTS so fw_name can be used instead of
> parent_names. .name is changed to the legacy pxo_board following how
> it's declared in other drivers.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-04  3:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 14:47 [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Christian Marangi
2022-09-14 14:47 ` [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API Christian Marangi
2022-09-30 19:39   ` Dmitry Baryshkov
2022-10-04  3:51   ` Stephen Boyd
2022-09-30 19:19 ` [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Stephen Boyd
2022-10-04  3:51 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).