* [PATCH 0/4] ASoC: mediatek: mt8192-mt6359: fix I2S corrupted for RT5682
@ 2021-01-22 10:07 Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 1/4] ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd() Tzung-Bi Shih
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Tzung-Bi Shih @ 2021-01-22 10:07 UTC (permalink / raw)
To: broonie; +Cc: tzungbi, alsa-devel
The series fixes the I2S corrupted when mt8192-mt6359 is playing and
capturing via RT5682 in different formats.
The 1st and 2nd patch refactor to use asoc_substream_to_rtd(). Just
realized there is such a helper for the purpose.
The 3rd patch simplies ops of Capture1 DAI link.
The 4th patch adds format constriants to the I2S to make sure the
settings are symmetric.
Tzung-Bi Shih (4):
ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd()
ASoC: mediatek: mt8192: use asoc_substream_to_rtd()
ASoC: mediatek: mt8192-mt6359: simply ops for Capture1 DAI link
ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 4 +-
.../mt8192/mt8192-mt6359-rt1015-rt5682.c | 73 +++++++++++++++----
2 files changed, 61 insertions(+), 16 deletions(-)
--
2.30.0.280.ga3ce27912f-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd()
2021-01-22 10:07 [PATCH 0/4] ASoC: mediatek: mt8192-mt6359: fix I2S corrupted for RT5682 Tzung-Bi Shih
@ 2021-01-22 10:07 ` Tzung-Bi Shih
2021-01-22 14:00 ` Mark Brown
2021-01-22 10:07 ` [PATCH 2/4] ASoC: mediatek: mt8192: " Tzung-Bi Shih
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Tzung-Bi Shih @ 2021-01-22 10:07 UTC (permalink / raw)
To: broonie; +Cc: tzungbi, alsa-devel
Uses asoc_substream_to_rtd() helper.
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
index cc0fc72305d2..f5c1c10408c9 100644
--- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
+++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
@@ -39,7 +39,7 @@ struct mt8192_mt6359_priv {
static int mt8192_rt1015_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_card *card = rtd->card;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai;
@@ -74,7 +74,7 @@ static int mt8192_rt1015_i2s_hw_params(struct snd_pcm_substream *substream,
static int mt8192_rt5682_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_card *card = rtd->card;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
@@ -362,7 +362,7 @@ static int mt8192_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
static int
mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
--
2.30.0.280.ga3ce27912f-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] ASoC: mediatek: mt8192: use asoc_substream_to_rtd()
2021-01-22 10:07 [PATCH 0/4] ASoC: mediatek: mt8192-mt6359: fix I2S corrupted for RT5682 Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 1/4] ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd() Tzung-Bi Shih
@ 2021-01-22 10:07 ` Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 3/4] ASoC: mediatek: mt8192-mt6359: simply ops for Capture1 DAI link Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 4/4] ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682 Tzung-Bi Shih
3 siblings, 0 replies; 6+ messages in thread
From: Tzung-Bi Shih @ 2021-01-22 10:07 UTC (permalink / raw)
To: broonie; +Cc: tzungbi, alsa-devel
Uses asoc_substream_to_rtd() helper.
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
index e7fec2d75e3d..7a1724f5ff4c 100644
--- a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
+++ b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
@@ -42,7 +42,7 @@ static const struct snd_pcm_hardware mt8192_afe_hardware = {
static int mt8192_memif_fs(struct snd_pcm_substream *substream,
unsigned int rate)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
@@ -59,7 +59,7 @@ static int mt8192_get_dai_fs(struct mtk_base_afe *afe,
static int mt8192_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
--
2.30.0.280.ga3ce27912f-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] ASoC: mediatek: mt8192-mt6359: simply ops for Capture1 DAI link
2021-01-22 10:07 [PATCH 0/4] ASoC: mediatek: mt8192-mt6359: fix I2S corrupted for RT5682 Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 1/4] ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd() Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 2/4] ASoC: mediatek: mt8192: " Tzung-Bi Shih
@ 2021-01-22 10:07 ` Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 4/4] ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682 Tzung-Bi Shih
3 siblings, 0 replies; 6+ messages in thread
From: Tzung-Bi Shih @ 2021-01-22 10:07 UTC (permalink / raw)
To: broonie; +Cc: tzungbi, alsa-devel
1. Uses rtd->dev to get the device.
2. Generalizes the variable name.
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
.../mt8192/mt8192-mt6359-rt1015-rt5682.c | 20 ++++++++-----------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
index f5c1c10408c9..f4b09672af8f 100644
--- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
+++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
@@ -360,14 +360,8 @@ static int mt8192_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
}
static int
-mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream)
+mt8192_mt6359_cap1_startup(struct snd_pcm_substream *substream)
{
- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
- struct snd_soc_component *component =
- snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
- struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
- int ret;
-
static const unsigned int channels[] = {
1, 2, 4
};
@@ -385,13 +379,15 @@ mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream)
.mask = 0,
};
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
+ int ret;
ret = snd_pcm_hw_constraint_list(runtime, 0,
SNDRV_PCM_HW_PARAM_CHANNELS,
&constraints_channels);
if (ret < 0) {
- dev_err(afe->dev, "hw_constraint_list channels failed\n");
+ dev_err(rtd->dev, "hw_constraint_list channels failed\n");
return ret;
}
@@ -399,15 +395,15 @@ mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream)
SNDRV_PCM_HW_PARAM_RATE,
&constraints_rates);
if (ret < 0) {
- dev_err(afe->dev, "hw_constraint_list rate failed\n");
+ dev_err(rtd->dev, "hw_constraint_list rate failed\n");
return ret;
}
return 0;
}
-static const struct snd_soc_ops mt8192_mt6359_rt1015_rt5682_capture1_ops = {
- .startup = mt8192_mt6359_rt1015_rt5682_cap1_startup,
+static const struct snd_soc_ops mt8192_mt6359_capture1_ops = {
+ .startup = mt8192_mt6359_cap1_startup,
};
/* FE */
@@ -720,7 +716,7 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = {
SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1,
.dpcm_capture = 1,
- .ops = &mt8192_mt6359_rt1015_rt5682_capture1_ops,
+ .ops = &mt8192_mt6359_capture1_ops,
SND_SOC_DAILINK_REG(capture1),
},
{
--
2.30.0.280.ga3ce27912f-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682
2021-01-22 10:07 [PATCH 0/4] ASoC: mediatek: mt8192-mt6359: fix I2S corrupted for RT5682 Tzung-Bi Shih
` (2 preceding siblings ...)
2021-01-22 10:07 ` [PATCH 3/4] ASoC: mediatek: mt8192-mt6359: simply ops for Capture1 DAI link Tzung-Bi Shih
@ 2021-01-22 10:07 ` Tzung-Bi Shih
3 siblings, 0 replies; 6+ messages in thread
From: Tzung-Bi Shih @ 2021-01-22 10:07 UTC (permalink / raw)
To: broonie; +Cc: tzungbi, alsa-devel
There is only 1 set of I2S in between MT8192 and RT5682. Adds format
constraints to the corresponding DAI links to make sure the settings
are symmetric.
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
.../mt8192/mt8192-mt6359-rt1015-rt5682.c | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
index f4b09672af8f..a606133951b7 100644
--- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
+++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
@@ -406,6 +406,53 @@ static const struct snd_soc_ops mt8192_mt6359_capture1_ops = {
.startup = mt8192_mt6359_cap1_startup,
};
+static int
+mt8192_mt6359_rt5682_startup(struct snd_pcm_substream *substream)
+{
+ static const unsigned int channels[] = {
+ 1, 2
+ };
+ static const struct snd_pcm_hw_constraint_list constraints_channels = {
+ .count = ARRAY_SIZE(channels),
+ .list = channels,
+ .mask = 0,
+ };
+ static const unsigned int rates[] = {
+ 48000
+ };
+ static const struct snd_pcm_hw_constraint_list constraints_rates = {
+ .count = ARRAY_SIZE(rates),
+ .list = rates,
+ .mask = 0,
+ };
+
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ int ret;
+
+ ret = snd_pcm_hw_constraint_list(runtime, 0,
+ SNDRV_PCM_HW_PARAM_CHANNELS,
+ &constraints_channels);
+ if (ret < 0) {
+ dev_err(rtd->dev, "hw_constraint_list channels failed\n");
+ return ret;
+ }
+
+ ret = snd_pcm_hw_constraint_list(runtime, 0,
+ SNDRV_PCM_HW_PARAM_RATE,
+ &constraints_rates);
+ if (ret < 0) {
+ dev_err(rtd->dev, "hw_constraint_list rate failed\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static const struct snd_soc_ops mt8192_mt6359_rt5682_ops = {
+ .startup = mt8192_mt6359_rt5682_startup,
+};
+
/* FE */
SND_SOC_DAILINK_DEFS(playback1,
DAILINK_COMP_ARRAY(COMP_CPU("DL1")),
@@ -653,6 +700,7 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = {
SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1,
.dpcm_playback = 1,
+ .ops = &mt8192_mt6359_rt5682_ops,
SND_SOC_DAILINK_REG(playback3),
},
{
@@ -726,6 +774,7 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = {
SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1,
.dpcm_capture = 1,
+ .ops = &mt8192_mt6359_rt5682_ops,
SND_SOC_DAILINK_REG(capture2),
},
{
--
2.30.0.280.ga3ce27912f-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd()
2021-01-22 10:07 ` [PATCH 1/4] ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd() Tzung-Bi Shih
@ 2021-01-22 14:00 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-01-22 14:00 UTC (permalink / raw)
To: Tzung-Bi Shih; +Cc: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 242 bytes --]
On Fri, Jan 22, 2021 at 06:07:39PM +0800, Tzung-Bi Shih wrote:
> Uses asoc_substream_to_rtd() helper.
Any fixes in a series should go before cleanup patches like this, it
avoids any dependencies which might stop the fix being sent as a fix.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-22 14:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 10:07 [PATCH 0/4] ASoC: mediatek: mt8192-mt6359: fix I2S corrupted for RT5682 Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 1/4] ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd() Tzung-Bi Shih
2021-01-22 14:00 ` Mark Brown
2021-01-22 10:07 ` [PATCH 2/4] ASoC: mediatek: mt8192: " Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 3/4] ASoC: mediatek: mt8192-mt6359: simply ops for Capture1 DAI link Tzung-Bi Shih
2021-01-22 10:07 ` [PATCH 4/4] ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682 Tzung-Bi Shih
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.