Re: [PATCH 3/5] ASoC: rt5682: clock driver must use the clock provider API

2021-04-13 Thread Jerome Brunet


On Mon 12 Apr 2021 at 22:27, Stephen Boyd  wrote:

> Quoting Jerome Brunet (2021-04-10 04:13:54)
>> Clock drivers ops should not the clk API but the clock provider (clk_hw)
>> instead.
>> 
>> Signed-off-by: Jerome Brunet 
>> ---
>>  sound/soc/codecs/rt5682.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
>> index 0e2a10ed11da..2eee02ac8d49 100644
>> --- a/sound/soc/codecs/rt5682.c
>> +++ b/sound/soc/codecs/rt5682.c
>> @@ -2634,7 +2634,7 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, 
>> unsigned long rate,
>> container_of(hw, struct rt5682_priv,
>>  dai_clks_hw[RT5682_DAI_WCLK_IDX]);
>> struct snd_soc_component *component = rt5682->component;
>> -   struct clk *parent_clk;
>> +   struct clk_hw *parent_hw;
>> const char * const clk_name = clk_hw_get_name(hw);
>> int pre_div;
>> unsigned int clk_pll2_out;
>> @@ -2649,8 +2649,8 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, 
>> unsigned long rate,
>>  *
>>  * It will set the codec anyway by assuming mclk is 48MHz.
>>  */
>> -   parent_clk = clk_get_parent(hw->clk);
>> -   if (!parent_clk)
>> +   parent_hw = clk_hw_get_parent(hw);
>> +   if (!parent_hw)
>> dev_warn(component->dev,
>> "Parent mclk of wclk not acquired in driver. Please 
>> ensure mclk was provided as %d Hz.\n",
>> CLK_PLL2_FIN);
>
> Can this code be removed? I don't know why we care to check if the clk
> has a parent or not.

I'm focusing on removing "hw->clk" where they are - w/o changing too
much what the driver does. I don't have the HW nor the story behind it
and there is about 50 more drivers to be fixed ... thankfully, most are
in drivers/clk/ ;)

Here, at least the clock consummer API is not longer used within a clock
ops, which is not great considering the locking scheme (among other things)


Re: [PATCH 3/5] ASoC: rt5682: clock driver must use the clock provider API

2021-04-12 Thread Stephen Boyd
Quoting Jerome Brunet (2021-04-10 04:13:54)
> Clock drivers ops should not the clk API but the clock provider (clk_hw)
> instead.
> 
> Signed-off-by: Jerome Brunet 
> ---
>  sound/soc/codecs/rt5682.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
> index 0e2a10ed11da..2eee02ac8d49 100644
> --- a/sound/soc/codecs/rt5682.c
> +++ b/sound/soc/codecs/rt5682.c
> @@ -2634,7 +2634,7 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, 
> unsigned long rate,
> container_of(hw, struct rt5682_priv,
>  dai_clks_hw[RT5682_DAI_WCLK_IDX]);
> struct snd_soc_component *component = rt5682->component;
> -   struct clk *parent_clk;
> +   struct clk_hw *parent_hw;
> const char * const clk_name = clk_hw_get_name(hw);
> int pre_div;
> unsigned int clk_pll2_out;
> @@ -2649,8 +2649,8 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, 
> unsigned long rate,
>  *
>  * It will set the codec anyway by assuming mclk is 48MHz.
>  */
> -   parent_clk = clk_get_parent(hw->clk);
> -   if (!parent_clk)
> +   parent_hw = clk_hw_get_parent(hw);
> +   if (!parent_hw)
> dev_warn(component->dev,
> "Parent mclk of wclk not acquired in driver. Please 
> ensure mclk was provided as %d Hz.\n",
> CLK_PLL2_FIN);

Can this code be removed? I don't know why we care to check if the clk
has a parent or not.


[PATCH 3/5] ASoC: rt5682: clock driver must use the clock provider API

2021-04-10 Thread Jerome Brunet
Clock drivers ops should not the clk API but the clock provider (clk_hw)
instead.

Signed-off-by: Jerome Brunet 
---
 sound/soc/codecs/rt5682.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index 0e2a10ed11da..2eee02ac8d49 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -2634,7 +2634,7 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, 
unsigned long rate,
container_of(hw, struct rt5682_priv,
 dai_clks_hw[RT5682_DAI_WCLK_IDX]);
struct snd_soc_component *component = rt5682->component;
-   struct clk *parent_clk;
+   struct clk_hw *parent_hw;
const char * const clk_name = clk_hw_get_name(hw);
int pre_div;
unsigned int clk_pll2_out;
@@ -2649,8 +2649,8 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, 
unsigned long rate,
 *
 * It will set the codec anyway by assuming mclk is 48MHz.
 */
-   parent_clk = clk_get_parent(hw->clk);
-   if (!parent_clk)
+   parent_hw = clk_hw_get_parent(hw);
+   if (!parent_hw)
dev_warn(component->dev,
"Parent mclk of wclk not acquired in driver. Please 
ensure mclk was provided as %d Hz.\n",
CLK_PLL2_FIN);
-- 
2.30.2