ASoC: Intel: kbl: Move codec sysclk config to codec_init function
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 ASoC: Intel: kbl: Move codec sysclk config to codec_init function
From: Mac Chiang <[email protected]>
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.
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(-)
sound/soc/intel/boards/kbl_da7219_max98357a.c +9 -8
@@ -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.
Signature · 1 line
2.7.4
Quoted 14 lines · On 5/29/18 2:43 AM, [email protected] wrote:
From: Mac Chiang <[email protected]>
On APL, commit
fd0f237572ad
("ASoC: Intel: bxt: Move codec sysclk config tocodec_initfunction") 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_clockevent 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.
Quoted 6 lines
The same fix is needed on KBL.
This patch rectifies this issue by moving the sysclk call to
codec_initfunction so it's only called once at initialisation.Signed-off-by Mac Chiang <[email protected]>
You need to CC: maintainers if you want this patch applied. Also the notes/changelog should go below the --- marker.
Quoted 7 lines
Notes(changelog):
v2:
- correct the MCLK to 24.576M
v3:
- described the comments clearly
---
notes go here.
Quoted 42 lines
sound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)sound/soc/intel/boards/kbl_da7219_max98357a.c +9
-8@@ -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.
PATCH v4 1/1 ASoC: Intel: kbl: Move codec sysclk config to codec_init function
In reply to [email protected]From: Mac Chiang <[email protected]>
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.
---
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(-)
sound/soc/intel/boards/kbl_da7219_max98357a.c +9 -8
@@ -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.
Signature · 1 line
2.7.4
Quoted 14 lines · On 05/31/2018 12:18 PM, [email protected] wrote:
From: Mac Chiang <[email protected]>
On APL, commit
fd0f237572ad
("ASoC: Intel: bxt: Move codec sysclk config tocodec_initfunction") 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_clockevent 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.
Quoted 6 lines
The same fix is needed on KBL.
This patch rectifies this issue by moving the sysclk call to
codec_initfunction so it's only called once at initialisation.Signed-off-by Mac Chiang <[email protected]>
Quoted 51 lines
---
Notes(changelog):
v2:
- correct the MCLK to 24.576M
v3:
- described the comments clearly
v4:
- move the notes at the endsound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)sound/soc/intel/boards/kbl_da7219_max98357a.c +9
-8@@ -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.
Quoted 14 lines · Mac Chiang
From: Mac Chiang <[email protected]>
On APL, commit
fd0f237572ad
("ASoC: Intel: bxt: Move codec sysclk config tocodec_initfunction") 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_clockevent 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.
Quoted 6 lines
The same fix is needed on KBL.
This patch rectifies this issue by moving the sysclk call to
codec_initfunction so it's only called once at initialisation.Signed-off-by Mac Chiang <[email protected]>
Quoted 56 lines
---
Notes(changelog):
v2:
- correct the MCLK to 24.576M
v3:
- described the comments clearly
v4:
- move the notes at the endsound/soc/intel/boards/kbl_da7219_max98357a.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)sound/soc/intel/boards/kbl_da7219_max98357a.c +0
-8@@ -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,sound/soc/intel/boards/kbl_da7219_max98357a.c +9
-0DA7219_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