All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] ASoC: max98090: remove 24-bit format support if RJ is 0
@ 2019-06-04 10:49 Yu-Hsuan Hsu
  2019-06-04 14:48 ` [alsa-devel] " Pierre-Louis Bossart
  2019-06-04 14:58   ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Yu-Hsuan Hsu @ 2019-06-04 10:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jaroslav Kysela, Takashi Iwai, Jon Hunter, Yu-Hsuan Hsu,
	Pierre-Louis Bossart, alsa-devel, Liam Girdwood, Mark Brown,
	dgreid, cychiang

The supported formats are S16_LE and S24_LE now. However, by datasheet
of max98090, S24_LE is only supported when it is in the right justified
mode. We should remove 24-bit format if it is not in that mode to avoid
triggering error.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
---
 Remove Change-Id.

 sound/soc/codecs/max98090.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 7619ea31ab50..ada8c25e643d 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -1909,6 +1909,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090,
 	return 0;
 }
 
+static int max98090_dai_startup(struct snd_pcm_substream *substream,
+				struct snd_soc_dai *dai)
+{
+	struct snd_soc_component *component = dai->component;
+	struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
+	unsigned int fmt = max98090->dai_fmt;
+
+	/* Remove 24-bit format support if it is not in right justified mode. */
+	if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
+		substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+		snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16);
+	}
+	return 0;
+}
+
 static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
 				   struct snd_pcm_hw_params *params,
 				   struct snd_soc_dai *dai)
@@ -2316,6 +2331,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
 #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct snd_soc_dai_ops max98090_dai_ops = {
+	.startup = max98090_dai_startup,
 	.set_sysclk = max98090_dai_set_sysclk,
 	.set_fmt = max98090_dai_set_fmt,
 	.set_tdm_slot = max98090_set_tdm_slot,
-- 
2.22.0.rc1.311.g5d7573a151-goog


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

* Re: [alsa-devel] [PATCH v4] ASoC: max98090: remove 24-bit format support if RJ is 0
  2019-06-04 10:49 [PATCH v4] ASoC: max98090: remove 24-bit format support if RJ is 0 Yu-Hsuan Hsu
@ 2019-06-04 14:48 ` Pierre-Louis Bossart
  2019-06-05 23:09   ` Yu-hsuan Hsu
  2019-06-04 14:58   ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Pierre-Louis Bossart @ 2019-06-04 14:48 UTC (permalink / raw)
  To: Yu-Hsuan Hsu, linux-kernel
  Cc: alsa-devel, Liam Girdwood, Takashi Iwai, Jon Hunter, Mark Brown,
	dgreid, cychiang

On 6/4/19 5:49 AM, Yu-Hsuan Hsu wrote:
> The supported formats are S16_LE and S24_LE now. However, by datasheet
> of max98090, S24_LE is only supported when it is in the right justified
> mode. We should remove 24-bit format if it is not in that mode to avoid
> triggering error.
> 
> Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
> ---
>   Remove Change-Id.
> 
>   sound/soc/codecs/max98090.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
> index 7619ea31ab50..ada8c25e643d 100644
> --- a/sound/soc/codecs/max98090.c
> +++ b/sound/soc/codecs/max98090.c
> @@ -1909,6 +1909,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090,
>   	return 0;
>   }
>   
> +static int max98090_dai_startup(struct snd_pcm_substream *substream,
> +				struct snd_soc_dai *dai)
> +{
> +	struct snd_soc_component *component = dai->component;
> +	struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
> +	unsigned int fmt = max98090->dai_fmt;
> +
> +	/* Remove 24-bit format support if it is not in right justified mode. */
> +	if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
> +		substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
> +		snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16);
> +	}
> +	return 0;
> +}

The data sheet is ambiguous, it states that 24-bit data is supported in 
RJ mode when TDM is 0. It doesn't say TDM can only support 16 bits.

That said, it's not clear to me if TDM is supported or not in this 
driver, there are multiple references to tdm_slots but DSP_A and DSP_B 
are not supported.

> +
>   static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
>   				   struct snd_pcm_hw_params *params,
>   				   struct snd_soc_dai *dai)
> @@ -2316,6 +2331,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
>   #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
>   
>   static const struct snd_soc_dai_ops max98090_dai_ops = {
> +	.startup = max98090_dai_startup,
>   	.set_sysclk = max98090_dai_set_sysclk,
>   	.set_fmt = max98090_dai_set_fmt,
>   	.set_tdm_slot = max98090_set_tdm_slot,
> 


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

* Applied "ASoC: max98090: remove 24-bit format support if RJ is 0" to the asoc tree
  2019-06-04 10:49 [PATCH v4] ASoC: max98090: remove 24-bit format support if RJ is 0 Yu-Hsuan Hsu
@ 2019-06-04 14:58   ` Mark Brown
  2019-06-04 14:58   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-06-04 14:58 UTC (permalink / raw)
  To: Yu-Hsuan Hsu
  Cc: alsa-devel, cychiang, dgreid, Jaroslav Kysela, Jon Hunter,
	Liam Girdwood, linux-kernel, Mark Brown, Pierre-Louis Bossart,
	Takashi Iwai

The patch

   ASoC: max98090: remove 24-bit format support if RJ is 0

has been applied to the asoc tree at

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

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

From 5628c8979642a076f91ee86c3bae5ad251639af0 Mon Sep 17 00:00:00 2001
From: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Date: Tue, 4 Jun 2019 18:49:09 +0800
Subject: [PATCH] ASoC: max98090: remove 24-bit format support if RJ is 0

The supported formats are S16_LE and S24_LE now. However, by datasheet
of max98090, S24_LE is only supported when it is in the right justified
mode. We should remove 24-bit format if it is not in that mode to avoid
triggering error.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/max98090.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 7619ea31ab50..ada8c25e643d 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -1909,6 +1909,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090,
 	return 0;
 }
 
+static int max98090_dai_startup(struct snd_pcm_substream *substream,
+				struct snd_soc_dai *dai)
+{
+	struct snd_soc_component *component = dai->component;
+	struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
+	unsigned int fmt = max98090->dai_fmt;
+
+	/* Remove 24-bit format support if it is not in right justified mode. */
+	if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
+		substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+		snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16);
+	}
+	return 0;
+}
+
 static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
 				   struct snd_pcm_hw_params *params,
 				   struct snd_soc_dai *dai)
@@ -2316,6 +2331,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
 #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct snd_soc_dai_ops max98090_dai_ops = {
+	.startup = max98090_dai_startup,
 	.set_sysclk = max98090_dai_set_sysclk,
 	.set_fmt = max98090_dai_set_fmt,
 	.set_tdm_slot = max98090_set_tdm_slot,
-- 
2.20.1


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

* Applied "ASoC: max98090: remove 24-bit format support if RJ is 0" to the asoc tree
@ 2019-06-04 14:58   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-06-04 14:58 UTC (permalink / raw)
  To: Yu-Hsuan Hsu
  Cc: alsa-devel, cychiang, dgreid, Jaroslav Kysela, Jon Hunter,
	Liam Girdwood, linux-kernel, Mark Brown, Pierre-Louis Bossart,
	Takashi Iwai

The patch

   ASoC: max98090: remove 24-bit format support if RJ is 0

has been applied to the asoc tree at

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

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

>From 5628c8979642a076f91ee86c3bae5ad251639af0 Mon Sep 17 00:00:00 2001
From: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Date: Tue, 4 Jun 2019 18:49:09 +0800
Subject: [PATCH] ASoC: max98090: remove 24-bit format support if RJ is 0

The supported formats are S16_LE and S24_LE now. However, by datasheet
of max98090, S24_LE is only supported when it is in the right justified
mode. We should remove 24-bit format if it is not in that mode to avoid
triggering error.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/max98090.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 7619ea31ab50..ada8c25e643d 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -1909,6 +1909,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090,
 	return 0;
 }
 
+static int max98090_dai_startup(struct snd_pcm_substream *substream,
+				struct snd_soc_dai *dai)
+{
+	struct snd_soc_component *component = dai->component;
+	struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
+	unsigned int fmt = max98090->dai_fmt;
+
+	/* Remove 24-bit format support if it is not in right justified mode. */
+	if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
+		substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+		snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16);
+	}
+	return 0;
+}
+
 static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
 				   struct snd_pcm_hw_params *params,
 				   struct snd_soc_dai *dai)
@@ -2316,6 +2331,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
 #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct snd_soc_dai_ops max98090_dai_ops = {
+	.startup = max98090_dai_startup,
 	.set_sysclk = max98090_dai_set_sysclk,
 	.set_fmt = max98090_dai_set_fmt,
 	.set_tdm_slot = max98090_set_tdm_slot,
-- 
2.20.1

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

* Re: [PATCH v4] ASoC: max98090: remove 24-bit format support if RJ is 0
  2019-06-04 14:48 ` [alsa-devel] " Pierre-Louis Bossart
@ 2019-06-05 23:09   ` Yu-hsuan Hsu
  0 siblings, 0 replies; 5+ messages in thread
From: Yu-hsuan Hsu @ 2019-06-05 23:09 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, Takashi Iwai, Liam Girdwood,
	Jon Hunter, Mark Brown, dgreid, Yu-Hsuan Hsu, cychiang

Thanks!
How about adding a new condition to check whether tdm_slots is 0?
If true, we can remove 24 bit format. Is it acceptable?

On Tue, Jun 4, 2019 at 10:48 PM Pierre-Louis Bossart <
pierre-louis.bossart@linux.intel.com> wrote:

> On 6/4/19 5:49 AM, Yu-Hsuan Hsu wrote:
> > The supported formats are S16_LE and S24_LE now. However, by datasheet
> > of max98090, S24_LE is only supported when it is in the right justified
> > mode. We should remove 24-bit format if it is not in that mode to avoid
> > triggering error.
> >
> > Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
> > ---
> >   Remove Change-Id.
> >
> >   sound/soc/codecs/max98090.c | 16 ++++++++++++++++
> >   1 file changed, 16 insertions(+)
> >
> > diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
> > index 7619ea31ab50..ada8c25e643d 100644
> > --- a/sound/soc/codecs/max98090.c
> > +++ b/sound/soc/codecs/max98090.c
> > @@ -1909,6 +1909,21 @@ static int max98090_configure_dmic(struct
> max98090_priv *max98090,
> >       return 0;
> >   }
> >
> > +static int max98090_dai_startup(struct snd_pcm_substream *substream,
> > +                             struct snd_soc_dai *dai)
> > +{
> > +     struct snd_soc_component *component = dai->component;
> > +     struct max98090_priv *max98090 =
> snd_soc_component_get_drvdata(component);
> > +     unsigned int fmt = max98090->dai_fmt;
> > +
> > +     /* Remove 24-bit format support if it is not in right justified
> mode. */
> > +     if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
> > +             substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
> > +             snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16,
> 16);
> > +     }
> > +     return 0;
> > +}
>
> The data sheet is ambiguous, it states that 24-bit data is supported in
> RJ mode when TDM is 0. It doesn't say TDM can only support 16 bits.
>
> That said, it's not clear to me if TDM is supported or not in this
> driver, there are multiple references to tdm_slots but DSP_A and DSP_B
> are not supported.
>
> > +
> >   static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
> >                                  struct snd_pcm_hw_params *params,
> >                                  struct snd_soc_dai *dai)
> > @@ -2316,6 +2331,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
> >   #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |
> SNDRV_PCM_FMTBIT_S24_LE)
> >
> >   static const struct snd_soc_dai_ops max98090_dai_ops = {
> > +     .startup = max98090_dai_startup,
> >       .set_sysclk = max98090_dai_set_sysclk,
> >       .set_fmt = max98090_dai_set_fmt,
> >       .set_tdm_slot = max98090_set_tdm_slot,
> >
>
>

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

end of thread, other threads:[~2019-06-05 23:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 10:49 [PATCH v4] ASoC: max98090: remove 24-bit format support if RJ is 0 Yu-Hsuan Hsu
2019-06-04 14:48 ` [alsa-devel] " Pierre-Louis Bossart
2019-06-05 23:09   ` Yu-hsuan Hsu
2019-06-04 14:58 ` Applied "ASoC: max98090: remove 24-bit format support if RJ is 0" to the asoc tree Mark Brown
2019-06-04 14:58   ` Mark Brown

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.