diff mbox series

[v6,05/18] clk: qcom: kpss-xcc: convert to parent data API

Message ID 20220321231548.14276-6-ansuelsmth@gmail.com
State Superseded
Headers show
Series Modernize rest of the krait drivers | expand

Commit Message

Christian Marangi March 21, 2022, 11:15 p.m. UTC
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 still used to save regression on old definition.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 drivers/clk/qcom/kpss-xcc.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

Comments

Stephen Boyd March 25, 2022, 1:06 a.m. UTC | #1
Quoting Ansuel Smith (2022-03-21 16:15:35)
> 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 still used to save regression on old definition.
> 
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---
>  drivers/clk/qcom/kpss-xcc.c | 25 ++++++++-----------------
>  1 file changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c
> index 4fec1f9142b8..347f70e9f5fe 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[] = {
> +       { .name = "pll8_vote", .fw_name = "pll8_vote" },
> +       { .name = "pxo", .fw_name = "pxo" },
>  };
>  
>  static unsigned int 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,15 @@ 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(&pdev->dev, NULL, name, ARRAY_SIZE(aux_parents),

Does something in devm_clk_hw_register_mux() not work here? Do we need a
devm_clk_hw_register_mux_parent_data()? If so, please add it.

> +                                       NULL, NULL, aux_parents, 0, base, 0, 0x3,
> +                                       0, aux_parent_map, NULL);
>
Christian Marangi March 25, 2022, 1:10 a.m. UTC | #2
On Thu, Mar 24, 2022 at 06:06:50PM -0700, Stephen Boyd wrote:
> Quoting Ansuel Smith (2022-03-21 16:15:35)
> > 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 still used to save regression on old definition.
> > 
> > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> > ---
> >  drivers/clk/qcom/kpss-xcc.c | 25 ++++++++-----------------
> >  1 file changed, 8 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c
> > index 4fec1f9142b8..347f70e9f5fe 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[] = {
> > +       { .name = "pll8_vote", .fw_name = "pll8_vote" },
> > +       { .name = "pxo", .fw_name = "pxo" },
> >  };
> >  
> >  static unsigned int 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,15 @@ 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(&pdev->dev, NULL, name, ARRAY_SIZE(aux_parents),
> 
> Does something in devm_clk_hw_register_mux() not work here? Do we need a
> devm_clk_hw_register_mux_parent_data()? If so, please add it.
>

Main reason I can't use devm_clk_hw_register_mux is the fact I can't
provide a parent_map. Will add an additional macro. OK.

> > +                                       NULL, NULL, aux_parents, 0, base, 0, 0x3,
> > +                                       0, aux_parent_map, NULL);
> >
Dmitry Baryshkov April 13, 2022, 7:38 p.m. UTC | #3
On 22/03/2022 02:15, Ansuel Smith 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 still used to save regression on old definition.
> 
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---
>   drivers/clk/qcom/kpss-xcc.c | 25 ++++++++-----------------
>   1 file changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c
> index 4fec1f9142b8..347f70e9f5fe 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[] = {
> +	{ .name = "pll8_vote", .fw_name = "pll8_vote" },

I'd just use "pll" here for the .fw_name.

> +	{ .name = "pxo", .fw_name = "pxo" },
>   };
>   
>   static unsigned int 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,15 @@ 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(&pdev->dev, NULL, name, ARRAY_SIZE(aux_parents),
> +					NULL, NULL, 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,
diff mbox series

Patch

diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c
index 4fec1f9142b8..347f70e9f5fe 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[] = {
+	{ .name = "pll8_vote", .fw_name = "pll8_vote" },
+	{ .name = "pxo", .fw_name = "pxo" },
 };
 
 static unsigned int 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,15 @@  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(&pdev->dev, NULL, name, ARRAY_SIZE(aux_parents),
+					NULL, NULL, 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,