* [PATCH v6] ASoC: max98090: remove 24-bit format support if RJ is 0
@ 2019-06-18 2:24 Yu-Hsuan Hsu
2019-07-02 13:55 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Yu-Hsuan Hsu @ 2019-06-18 2:24 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, S24_LE is
not supported when TDM is 0 and it is not in the right justified mode.
We should remove 24-bit format in that situation to avoid triggering
error.
Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
---
Changed the order of the conditional.
Remove the snd_pcm_hw_constraint_msbits function.
Use removing 24 bits format instead of fixing at 16 bits format.
sound/soc/codecs/max98090.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 7619ea31ab50..9fbb4c31bcf1 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -1909,6 +1909,24 @@ 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;
+
+ /*
+ * When TDM = 0, 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 &&
+ !max98090->tdm_slots)
+ substream->runtime->hw.formats &= ~SNDRV_PCM_FMTBIT_S24_LE;
+
+ 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 +2334,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.410.gd8fdbe21b5-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v6] ASoC: max98090: remove 24-bit format support if RJ is 0
2019-06-18 2:24 [PATCH v6] ASoC: max98090: remove 24-bit format support if RJ is 0 Yu-Hsuan Hsu
@ 2019-07-02 13:55 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2019-07-02 13:55 UTC (permalink / raw)
To: Yu-Hsuan Hsu
Cc: linux-kernel, Jaroslav Kysela, Takashi Iwai, Jon Hunter,
Pierre-Louis Bossart, alsa-devel, Liam Girdwood, dgreid,
cychiang
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
On Tue, Jun 18, 2019 at 10:24:11AM +0800, Yu-Hsuan Hsu wrote:
> + /*
> + * When TDM = 0, 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 &&
> + !max98090->tdm_slots)
> + substream->runtime->hw.formats &= ~SNDRV_PCM_FMTBIT_S24_LE;
Why do this and not add a constraint (which doesn't modify any
constant data structures)?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-02 13:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 2:24 [PATCH v6] ASoC: max98090: remove 24-bit format support if RJ is 0 Yu-Hsuan Hsu
2019-07-02 13:55 ` 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).