alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [PATCH v3] ASoC: Intel: kbl: Move codec sysclk config to codec_init function
       [not found] <1527234447-13mail-mac.chiang@intel.com>
@ 2018-05-29  7:43 ` mac.chiang
  2018-05-29 13:54   ` Pierre-Louis Bossart
  2018-05-31 17:18   ` [PATCH] [PATCH v4] " mac.chiang
  0 siblings, 2 replies; 5+ messages in thread
From: mac.chiang @ 2018-05-29  7:43 UTC (permalink / raw)
  To: alsa-devel

From: Mac Chiang <mac.chiang@intel.com>

On APL, commit fd0f237572ad
("ASoC: Intel: bxt: Move codec sysclk config to codec_init function")
fixed an issue related to jack detection.

The MCLK for DA7219 does not change in this platform, but is
currently being configured everytime as part of the platform_clock
event handler for DAPM. The upshot of this is that we have
unnecessary calls to this function, and it also means that if
a stream hasn't yet been started, DA7219 driver does not have the
correct MCLK rates programmed and so the HP detection feature does
not operate as expected.

The same fix is needed on KBL.

This patch rectifies this issue by moving the sysclk call to
codec_init function so it's only called once at initialisation.

Signed-off-by: Mac Chiang <mac.chiang@intel.com>

Notes(changelog):
  v2:
    - correct the MCLK to 24.576M
  v3:
    - described the comments clearly
---
 sound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c
index c332a32..ad3029d 100644
--- a/sound/soc/intel/boards/kbl_da7219_max98357a.c
+++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c
@@ -66,14 +66,6 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 		return -EIO;
 	}
 
-	/* Configure sysclk for codec */
-	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
-				     SND_SOC_CLOCK_IN);
-	if (ret) {
-		dev_err(card->dev, "can't set codec sysclk configuration\n");
-		return ret;
-	}
-
 	if (SND_SOC_DAPM_EVENT_OFF(event)) {
 		ret = snd_soc_dai_set_pll(codec_dai, 0,
 				     DA7219_SYSCLK_MCLK, 0, 0);
@@ -170,9 +162,18 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_component *component = rtd->codec_dai->component;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
 	struct snd_soc_jack *jack;
 	int ret;
 
+	/* Configure sysclk for codec */
+	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
+						SND_SOC_CLOCK_IN);
+	if (ret) {
+		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
+		return ret;
+	}
+
 	/*
 	 * Headset buttons map to the google Reference headset.
 	 * These can be configured by userspace.
-- 
2.7.4

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

* Re: [PATCH] [PATCH v3] ASoC: Intel: kbl: Move codec sysclk config to codec_init function
  2018-05-29  7:43 ` [PATCH] [PATCH v3] ASoC: Intel: kbl: Move codec sysclk config to codec_init function mac.chiang
@ 2018-05-29 13:54   ` Pierre-Louis Bossart
  2018-05-31 17:18   ` [PATCH] [PATCH v4] " mac.chiang
  1 sibling, 0 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2018-05-29 13:54 UTC (permalink / raw)
  To: mac.chiang, alsa-devel

On 5/29/18 2:43 AM, mac.chiang@intel.com wrote:
> From: Mac Chiang <mac.chiang@intel.com>
> 
> On APL, commit fd0f237572ad
> ("ASoC: Intel: bxt: Move codec sysclk config to codec_init function")
> fixed an issue related to jack detection.
> 
> The MCLK for DA7219 does not change in this platform, but is
> currently being configured everytime as part of the platform_clock
> event handler for DAPM. The upshot of this is that we have
> unnecessary calls to this function, and it also means that if
> a stream hasn't yet been started, DA7219 driver does not have the
> correct MCLK rates programmed and so the HP detection feature does
> not operate as expected.
> 
> The same fix is needed on KBL.
> 
> This patch rectifies this issue by moving the sysclk call to
> codec_init function so it's only called once at initialisation.
> 
> Signed-off-by: Mac Chiang <mac.chiang@intel.com>

You need to CC: maintainers if you want this patch applied. Also the 
notes/changelog should go below the --- marker.
> 
> Notes(changelog):
>    v2:
>      - correct the MCLK to 24.576M
>    v3:
>      - described the comments clearly
> ---

notes go here.

>   sound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c
> index c332a32..ad3029d 100644
> --- a/sound/soc/intel/boards/kbl_da7219_max98357a.c
> +++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c
> @@ -66,14 +66,6 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
>   		return -EIO;
>   	}
>   
> -	/* Configure sysclk for codec */
> -	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
> -				     SND_SOC_CLOCK_IN);
> -	if (ret) {
> -		dev_err(card->dev, "can't set codec sysclk configuration\n");
> -		return ret;
> -	}
> -
>   	if (SND_SOC_DAPM_EVENT_OFF(event)) {
>   		ret = snd_soc_dai_set_pll(codec_dai, 0,
>   				     DA7219_SYSCLK_MCLK, 0, 0);
> @@ -170,9 +162,18 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
>   {
>   	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
>   	struct snd_soc_component *component = rtd->codec_dai->component;
> +	struct snd_soc_dai *codec_dai = rtd->codec_dai;
>   	struct snd_soc_jack *jack;
>   	int ret;
>   
> +	/* Configure sysclk for codec */
> +	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
> +						SND_SOC_CLOCK_IN);
> +	if (ret) {
> +		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
> +		return ret;
> +	}
> +
>   	/*
>   	 * Headset buttons map to the google Reference headset.
>   	 * These can be configured by userspace.
> 

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

* [PATCH] [PATCH v4] ASoC: Intel: kbl: Move codec sysclk config to codec_init function
  2018-05-29  7:43 ` [PATCH] [PATCH v3] ASoC: Intel: kbl: Move codec sysclk config to codec_init function mac.chiang
  2018-05-29 13:54   ` Pierre-Louis Bossart
@ 2018-05-31 17:18   ` mac.chiang
  2018-05-31 21:16     ` Pierre-Louis Bossart
  2018-06-04 10:52     ` Adam Thomson
  1 sibling, 2 replies; 5+ messages in thread
From: mac.chiang @ 2018-05-31 17:18 UTC (permalink / raw)
  To: alsa-devel
  Cc: kuninori.morimoto.gx, tiwai, pierre-louis.bossart, mac.chiang,
	broonie, naveen.m, Adam.Thomson.Opensource, andriy.shevchenko

From: Mac Chiang <mac.chiang@intel.com>

On APL, commit fd0f237572ad
("ASoC: Intel: bxt: Move codec sysclk config to codec_init function")
fixed an issue related to jack detection.

The MCLK for DA7219 does not change in this platform, but is
currently being configured everytime as part of the platform_clock
event handler for DAPM. The upshot of this is that we have
unnecessary calls to this function, and it also means that if
a stream hasn't yet been started, DA7219 driver does not have the
correct MCLK rates programmed and so the HP detection feature does
not operate as expected.

The same fix is needed on KBL.

This patch rectifies this issue by moving the sysclk call to
codec_init function so it's only called once at initialisation.

Signed-off-by: Mac Chiang <mac.chiang@intel.com>

---
Notes(changelog):
  v2:
    - correct the MCLK to 24.576M
  v3:
    - described the comments clearly
  v4:
    - move the notes at the end

 sound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c
index c332a32..ad3029d 100644
--- a/sound/soc/intel/boards/kbl_da7219_max98357a.c
+++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c
@@ -66,14 +66,6 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 		return -EIO;
 	}
 
-	/* Configure sysclk for codec */
-	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
-				     SND_SOC_CLOCK_IN);
-	if (ret) {
-		dev_err(card->dev, "can't set codec sysclk configuration\n");
-		return ret;
-	}
-
 	if (SND_SOC_DAPM_EVENT_OFF(event)) {
 		ret = snd_soc_dai_set_pll(codec_dai, 0,
 				     DA7219_SYSCLK_MCLK, 0, 0);
@@ -170,9 +162,18 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_component *component = rtd->codec_dai->component;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
 	struct snd_soc_jack *jack;
 	int ret;
 
+	/* Configure sysclk for codec */
+	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
+						SND_SOC_CLOCK_IN);
+	if (ret) {
+		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
+		return ret;
+	}
+
 	/*
 	 * Headset buttons map to the google Reference headset.
 	 * These can be configured by userspace.
-- 
2.7.4

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

* Re: [PATCH] [PATCH v4] ASoC: Intel: kbl: Move codec sysclk config to codec_init function
  2018-05-31 17:18   ` [PATCH] [PATCH v4] " mac.chiang
@ 2018-05-31 21:16     ` Pierre-Louis Bossart
  2018-06-04 10:52     ` Adam Thomson
  1 sibling, 0 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2018-05-31 21:16 UTC (permalink / raw)
  To: mac.chiang, alsa-devel
  Cc: kuninori.morimoto.gx, tiwai, broonie, naveen.m,
	Adam.Thomson.Opensource, andriy.shevchenko



On 05/31/2018 12:18 PM, mac.chiang@intel.com wrote:
> From: Mac Chiang <mac.chiang@intel.com>
>
> On APL, commit fd0f237572ad
> ("ASoC: Intel: bxt: Move codec sysclk config to codec_init function")
> fixed an issue related to jack detection.
>
> The MCLK for DA7219 does not change in this platform, but is
> currently being configured everytime as part of the platform_clock
> event handler for DAPM. The upshot of this is that we have
> unnecessary calls to this function, and it also means that if
> a stream hasn't yet been started, DA7219 driver does not have the
> correct MCLK rates programmed and so the HP detection feature does
> not operate as expected.
>
> The same fix is needed on KBL.
>
> This patch rectifies this issue by moving the sysclk call to
> codec_init function so it's only called once at initialisation.
>
> Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>
> ---
> Notes(changelog):
>    v2:
>      - correct the MCLK to 24.576M
>    v3:
>      - described the comments clearly
>    v4:
>      - move the notes at the end
>
>   sound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c
> index c332a32..ad3029d 100644
> --- a/sound/soc/intel/boards/kbl_da7219_max98357a.c
> +++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c
> @@ -66,14 +66,6 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
>   		return -EIO;
>   	}
>   
> -	/* Configure sysclk for codec */
> -	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
> -				     SND_SOC_CLOCK_IN);
> -	if (ret) {
> -		dev_err(card->dev, "can't set codec sysclk configuration\n");
> -		return ret;
> -	}
> -
>   	if (SND_SOC_DAPM_EVENT_OFF(event)) {
>   		ret = snd_soc_dai_set_pll(codec_dai, 0,
>   				     DA7219_SYSCLK_MCLK, 0, 0);
> @@ -170,9 +162,18 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
>   {
>   	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
>   	struct snd_soc_component *component = rtd->codec_dai->component;
> +	struct snd_soc_dai *codec_dai = rtd->codec_dai;
>   	struct snd_soc_jack *jack;
>   	int ret;
>   
> +	/* Configure sysclk for codec */
> +	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
> +						SND_SOC_CLOCK_IN);
> +	if (ret) {
> +		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
> +		return ret;
> +	}
> +
>   	/*
>   	 * Headset buttons map to the google Reference headset.
>   	 * These can be configured by userspace.

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

* Re: [PATCH] [PATCH v4] ASoC: Intel: kbl: Move codec sysclk config to codec_init function
  2018-05-31 17:18   ` [PATCH] [PATCH v4] " mac.chiang
  2018-05-31 21:16     ` Pierre-Louis Bossart
@ 2018-06-04 10:52     ` Adam Thomson
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Thomson @ 2018-06-04 10:52 UTC (permalink / raw)
  To: mac.chiang@intel.com, alsa-devel@alsa-project.org
  Cc: kuninori.morimoto.gx@renesas.com, tiwai@suse.de,
	pierre-louis.bossart@linux.intel.com, broonie@kernel.org,
	naveen.m@intel.com, Adam Thomson,
	andriy.shevchenko@linux.intel.com

On 31 May 2018 18:19, Mac Chiang wrote:

> From: Mac Chiang <mac.chiang@intel.com>
> 
> On APL, commit fd0f237572ad
> ("ASoC: Intel: bxt: Move codec sysclk config to codec_init function")
> fixed an issue related to jack detection.
> 
> The MCLK for DA7219 does not change in this platform, but is
> currently being configured everytime as part of the platform_clock
> event handler for DAPM. The upshot of this is that we have
> unnecessary calls to this function, and it also means that if
> a stream hasn't yet been started, DA7219 driver does not have the
> correct MCLK rates programmed and so the HP detection feature does
> not operate as expected.
> 
> The same fix is needed on KBL.
> 
> This patch rectifies this issue by moving the sysclk call to
> codec_init function so it's only called once at initialisation.
> 
> Signed-off-by: Mac Chiang <mac.chiang@intel.com>

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> 
> ---
> Notes(changelog):
>   v2:
>     - correct the MCLK to 24.576M
>   v3:
>     - described the comments clearly
>   v4:
>     - move the notes at the end
> 
>  sound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c
> b/sound/soc/intel/boards/kbl_da7219_max98357a.c
> index c332a32..ad3029d 100644
> --- a/sound/soc/intel/boards/kbl_da7219_max98357a.c
> +++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c
> @@ -66,14 +66,6 @@ static int platform_clock_control(struct
> snd_soc_dapm_widget *w,
>  		return -EIO;
>  	}
> 
> -	/* Configure sysclk for codec */
> -	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
> -				     SND_SOC_CLOCK_IN);
> -	if (ret) {
> -		dev_err(card->dev, "can't set codec sysclk configuration\n");
> -		return ret;
> -	}
> -
>  	if (SND_SOC_DAPM_EVENT_OFF(event)) {
>  		ret = snd_soc_dai_set_pll(codec_dai, 0,
>  				     DA7219_SYSCLK_MCLK, 0, 0);
> @@ -170,9 +162,18 @@ static int kabylake_da7219_codec_init(struct
> snd_soc_pcm_runtime *rtd)
>  {
>  	struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
>  	struct snd_soc_component *component = rtd->codec_dai->component;
> +	struct snd_soc_dai *codec_dai = rtd->codec_dai;
>  	struct snd_soc_jack *jack;
>  	int ret;
> 
> +	/* Configure sysclk for codec */
> +	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 24576000,
> +						SND_SOC_CLOCK_IN);
> +	if (ret) {
> +		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
> +		return ret;
> +	}
> +
>  	/*
>  	 * Headset buttons map to the google Reference headset.
>  	 * These can be configured by userspace.
> --
> 2.7.4

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

end of thread, other threads:[~2018-06-04 10:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1527234447-13mail-mac.chiang@intel.com>
2018-05-29  7:43 ` [PATCH] [PATCH v3] ASoC: Intel: kbl: Move codec sysclk config to codec_init function mac.chiang
2018-05-29 13:54   ` Pierre-Louis Bossart
2018-05-31 17:18   ` [PATCH] [PATCH v4] " mac.chiang
2018-05-31 21:16     ` Pierre-Louis Bossart
2018-06-04 10:52     ` Adam Thomson

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).