alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: cht_bsw_nau8824: Move snd_soc_dai_set_tdm_slot call to cht_codec_fixup
@ 2021-01-07 11:53 Hans de Goede
  2021-01-11 18:09 ` Pierre-Louis Bossart
  2021-01-12 16:42 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2021-01-07 11:53 UTC (permalink / raw)
  To: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown
  Cc: Hans de Goede, alsa-devel

Move the snd_soc_dai_set_tdm_slot() call from cht_codec_init() to
cht_codec_fixup(). There are 2 reasons for doing this:

1. This aligns the cht_bsw_nau8824 with all the other BYT/CHT machine
drivers which also do this from their codec_fixup function.

2. When using the SOF driver, things like the TDM info is set from the
topology file. Moving the call to the codec_fixup function, which gets
skipped when using the SOF driver avoids the call interfering with the
settings when using the SOF driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/cht_bsw_nau8824.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sound/soc/intel/boards/cht_bsw_nau8824.c b/sound/soc/intel/boards/cht_bsw_nau8824.c
index fd5e25ca05f7..da5a5cbc8759 100644
--- a/sound/soc/intel/boards/cht_bsw_nau8824.c
+++ b/sound/soc/intel/boards/cht_bsw_nau8824.c
@@ -100,13 +100,6 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 	struct snd_soc_component *component = codec_dai->component;
 	int ret, jack_type;
 
-	/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
-	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xf, 0x1, 4, 24);
-	if (ret < 0) {
-		dev_err(runtime->dev, "can't set codec TDM slot %d\n", ret);
-		return ret;
-	}
-
 	/* NAU88L24 supports 4 butons headset detection
 	 * KEY_PLAYPAUSE
 	 * KEY_VOICECOMMAND
@@ -141,6 +134,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 		SNDRV_PCM_HW_PARAM_CHANNELS);
 	struct snd_mask *fmt =
 		hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
+	int ret;
 
 	/* The DSP will covert the FE rate to 48k, stereo, 24bits */
 	rate->min = rate->max = 48000;
@@ -150,6 +144,13 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	snd_mask_none(fmt);
 	params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
 
+	/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
+	ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0xf, 0x1, 4, 24);
+	if (ret < 0) {
+		dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
+		return ret;
+	}
+
 	return 0;
 }
 
-- 
2.28.0


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

* Re: [PATCH] ASoC: Intel: cht_bsw_nau8824: Move snd_soc_dai_set_tdm_slot call to cht_codec_fixup
  2021-01-07 11:53 [PATCH] ASoC: Intel: cht_bsw_nau8824: Move snd_soc_dai_set_tdm_slot call to cht_codec_fixup Hans de Goede
@ 2021-01-11 18:09 ` Pierre-Louis Bossart
  2021-01-12 16:42 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2021-01-11 18:09 UTC (permalink / raw)
  To: Hans de Goede, Cezary Rojewski, Liam Girdwood, Jie Yang, Mark Brown
  Cc: alsa-devel



On 1/7/21 5:53 AM, Hans de Goede wrote:
> Move the snd_soc_dai_set_tdm_slot() call from cht_codec_init() to
> cht_codec_fixup(). There are 2 reasons for doing this:
> 
> 1. This aligns the cht_bsw_nau8824 with all the other BYT/CHT machine
> drivers which also do this from their codec_fixup function.
> 
> 2. When using the SOF driver, things like the TDM info is set from the
> topology file. Moving the call to the codec_fixup function, which gets
> skipped when using the SOF driver avoids the call interfering with the
> settings when using the SOF driver.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Yep, this is a required change.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/intel/boards/cht_bsw_nau8824.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/cht_bsw_nau8824.c b/sound/soc/intel/boards/cht_bsw_nau8824.c
> index fd5e25ca05f7..da5a5cbc8759 100644
> --- a/sound/soc/intel/boards/cht_bsw_nau8824.c
> +++ b/sound/soc/intel/boards/cht_bsw_nau8824.c
> @@ -100,13 +100,6 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
>   	struct snd_soc_component *component = codec_dai->component;
>   	int ret, jack_type;
>   
> -	/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
> -	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xf, 0x1, 4, 24);
> -	if (ret < 0) {
> -		dev_err(runtime->dev, "can't set codec TDM slot %d\n", ret);
> -		return ret;
> -	}
> -
>   	/* NAU88L24 supports 4 butons headset detection
>   	 * KEY_PLAYPAUSE
>   	 * KEY_VOICECOMMAND
> @@ -141,6 +134,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
>   		SNDRV_PCM_HW_PARAM_CHANNELS);
>   	struct snd_mask *fmt =
>   		hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
> +	int ret;
>   
>   	/* The DSP will covert the FE rate to 48k, stereo, 24bits */
>   	rate->min = rate->max = 48000;
> @@ -150,6 +144,13 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
>   	snd_mask_none(fmt);
>   	params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
>   
> +	/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
> +	ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0xf, 0x1, 4, 24);
> +	if (ret < 0) {
> +		dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
> +		return ret;
> +	}
> +
>   	return 0;
>   }
>   
> 

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

* Re: [PATCH] ASoC: Intel: cht_bsw_nau8824: Move snd_soc_dai_set_tdm_slot call to cht_codec_fixup
  2021-01-07 11:53 [PATCH] ASoC: Intel: cht_bsw_nau8824: Move snd_soc_dai_set_tdm_slot call to cht_codec_fixup Hans de Goede
  2021-01-11 18:09 ` Pierre-Louis Bossart
@ 2021-01-12 16:42 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-01-12 16:42 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Jie Yang, Liam Girdwood, Cezary Rojewski,
	Hans de Goede
  Cc: alsa-devel

On Thu, 7 Jan 2021 12:53:24 +0100, Hans de Goede wrote:
> Move the snd_soc_dai_set_tdm_slot() call from cht_codec_init() to
> cht_codec_fixup(). There are 2 reasons for doing this:
> 
> 1. This aligns the cht_bsw_nau8824 with all the other BYT/CHT machine
> drivers which also do this from their codec_fixup function.
> 
> 2. When using the SOF driver, things like the TDM info is set from the
> topology file. Moving the call to the codec_fixup function, which gets
> skipped when using the SOF driver avoids the call interfering with the
> settings when using the SOF driver.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: Intel: cht_bsw_nau8824: Move snd_soc_dai_set_tdm_slot call to cht_codec_fixup
      commit: 780b1a02c1795b58f217aabfd0688d616408bb89

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2021-01-12 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 11:53 [PATCH] ASoC: Intel: cht_bsw_nau8824: Move snd_soc_dai_set_tdm_slot call to cht_codec_fixup Hans de Goede
2021-01-11 18:09 ` Pierre-Louis Bossart
2021-01-12 16:42 ` Mark Brown

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