All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clk: x86: add "mclk" alias for Baytrail/Cherrytrail
@ 2017-02-20 20:23 Pierre-Louis Bossart
  2017-03-20  1:47 ` [alsa-devel] " Pierre-Louis Bossart
  2017-04-19 16:53   ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2017-02-20 20:23 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd
  Cc: alsa-devel, Michael Turquette, Takashi Iwai, Mark Brown,
	Andy Shevchenko, Vinod Koul, Pierre-Louis Bossart

Due to timing requirements, TI and Conexant manage the audio
reference clock from their ASoC codec drivers using the "mclk"
string. This patch adds another lookup for the "pmc_plt_clk_3"
clock to avoid Intel-specific tests in those codec drivers and
use code as-is.

To avoid a leak, clk_add_alias() is not used in this patch.
Instead the lookup is created manually as part of the .probe()
step and dropped in the .remove() step.

"pmc_plt_clk_3" is used exclusively for audio on all known
Baytrail/CherryTrail designs and is e.g. routed on the MCLK
(pin 26) of the MinnowBoardMAX Turbot LSE connector.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c
index 2b60577..fafc991 100644
--- a/drivers/clk/x86/clk-pmc-atom.c
+++ b/drivers/clk/x86/clk-pmc-atom.c
@@ -54,6 +54,7 @@ struct clk_plt_data {
 	struct clk_plt_fixed **parents;
 	u8 nparents;
 	struct clk_plt *clks[PMC_CLK_NUM];
+	struct clk_lookup *mclk_lookup;
 };
 
 /* Return an index in parent table */
@@ -337,6 +338,11 @@ static int plt_clk_probe(struct platform_device *pdev)
 			goto err_unreg_clk_plt;
 		}
 	}
+	data->mclk_lookup = clkdev_hw_create(&data->clks[3]->hw, "mclk", NULL);
+	if (IS_ERR(data->mclk_lookup)) {
+		err = PTR_ERR(data->mclk_lookup);
+		goto err_unreg_clk_plt;
+	}
 
 	plt_clk_free_parent_names_loop(parent_names, data->nparents);
 
@@ -356,6 +362,7 @@ static int plt_clk_remove(struct platform_device *pdev)
 
 	data = platform_get_drvdata(pdev);
 
+	clkdev_drop(data->mclk_lookup);
 	plt_clk_unregister_loop(data, PMC_CLK_NUM);
 	plt_clk_unregister_parents(data);
 	return 0;
-- 
2.7.4

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

* Re: [alsa-devel] [PATCH v2] clk: x86: add "mclk" alias for Baytrail/Cherrytrail
  2017-02-20 20:23 [PATCH v2] clk: x86: add "mclk" alias for Baytrail/Cherrytrail Pierre-Louis Bossart
@ 2017-03-20  1:47 ` Pierre-Louis Bossart
  2017-04-19 16:53   ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2017-03-20  1:47 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd
  Cc: alsa-devel, Vinod Koul, Michael Turquette, Takashi Iwai,
	Mark Brown, Andy Shevchenko

On 2/20/17 2:23 PM, Pierre-Louis Bossart wrote:
> Due to timing requirements, TI and Conexant manage the audio
> reference clock from their ASoC codec drivers using the "mclk"
> string. This patch adds another lookup for the "pmc_plt_clk_3"
> clock to avoid Intel-specific tests in those codec drivers and
> use code as-is.
>
> To avoid a leak, clk_add_alias() is not used in this patch.
> Instead the lookup is created manually as part of the .probe()
> step and dropped in the .remove() step.
>
> "pmc_plt_clk_3" is used exclusively for audio on all known
> Baytrail/CherryTrail designs and is e.g. routed on the MCLK
> (pin 26) of the MinnowBoardMAX Turbot LSE connector.
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Was there any objection or feedback on this patch?
The functionality is needed for a couple of audio drivers from Conexant 
and Dialog initially written for ARM platforms.
Thanks
-Pierre


> ---
>  drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c
> index 2b60577..fafc991 100644
> --- a/drivers/clk/x86/clk-pmc-atom.c
> +++ b/drivers/clk/x86/clk-pmc-atom.c
> @@ -54,6 +54,7 @@ struct clk_plt_data {
>  	struct clk_plt_fixed **parents;
>  	u8 nparents;
>  	struct clk_plt *clks[PMC_CLK_NUM];
> +	struct clk_lookup *mclk_lookup;
>  };
>
>  /* Return an index in parent table */
> @@ -337,6 +338,11 @@ static int plt_clk_probe(struct platform_device *pdev)
>  			goto err_unreg_clk_plt;
>  		}
>  	}
> +	data->mclk_lookup = clkdev_hw_create(&data->clks[3]->hw, "mclk", NULL);
> +	if (IS_ERR(data->mclk_lookup)) {
> +		err = PTR_ERR(data->mclk_lookup);
> +		goto err_unreg_clk_plt;
> +	}
>
>  	plt_clk_free_parent_names_loop(parent_names, data->nparents);
>
> @@ -356,6 +362,7 @@ static int plt_clk_remove(struct platform_device *pdev)
>
>  	data = platform_get_drvdata(pdev);
>
> +	clkdev_drop(data->mclk_lookup);
>  	plt_clk_unregister_loop(data, PMC_CLK_NUM);
>  	plt_clk_unregister_parents(data);
>  	return 0;
>


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

* Re: [PATCH v2] clk: x86: add "mclk" alias for Baytrail/Cherrytrail
  2017-02-20 20:23 [PATCH v2] clk: x86: add "mclk" alias for Baytrail/Cherrytrail Pierre-Louis Bossart
@ 2017-04-19 16:53   ` Stephen Boyd
  2017-04-19 16:53   ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2017-04-19 16:53 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, Vinod Koul, Michael Turquette, x86, Takashi Iwai,
	platform-driver-x86, Mark Brown, Andy Shevchenko, linux-clk

On 02/20, Pierre-Louis Bossart wrote:
> Due to timing requirements, TI and Conexant manage the audio
> reference clock from their ASoC codec drivers using the "mclk"
> string. This patch adds another lookup for the "pmc_plt_clk_3"
> clock to avoid Intel-specific tests in those codec drivers and
> use code as-is.
> 
> To avoid a leak, clk_add_alias() is not used in this patch.
> Instead the lookup is created manually as part of the .probe()
> step and dropped in the .remove() step.
> 
> "pmc_plt_clk_3" is used exclusively for audio on all known
> Baytrail/CherryTrail designs and is e.g. routed on the MCLK
> (pin 26) of the MinnowBoardMAX Turbot LSE connector.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v2] clk: x86: add "mclk" alias for Baytrail/Cherrytrail
@ 2017-04-19 16:53   ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2017-04-19 16:53 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-clk, x86, platform-driver-x86, alsa-devel,
	Michael Turquette, Takashi Iwai, Mark Brown, Andy Shevchenko,
	Vinod Koul

On 02/20, Pierre-Louis Bossart wrote:
> Due to timing requirements, TI and Conexant manage the audio
> reference clock from their ASoC codec drivers using the "mclk"
> string. This patch adds another lookup for the "pmc_plt_clk_3"
> clock to avoid Intel-specific tests in those codec drivers and
> use code as-is.
> 
> To avoid a leak, clk_add_alias() is not used in this patch.
> Instead the lookup is created manually as part of the .probe()
> step and dropped in the .remove() step.
> 
> "pmc_plt_clk_3" is used exclusively for audio on all known
> Baytrail/CherryTrail designs and is e.g. routed on the MCLK
> (pin 26) of the MinnowBoardMAX Turbot LSE connector.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2017-04-19 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 20:23 [PATCH v2] clk: x86: add "mclk" alias for Baytrail/Cherrytrail Pierre-Louis Bossart
2017-03-20  1:47 ` [alsa-devel] " Pierre-Louis Bossart
2017-04-19 16:53 ` Stephen Boyd
2017-04-19 16:53   ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.