Commit 6395a621 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: mediatek: mt8192: apply some cleanup" from Tzung-Bi Shih <tzungbi@google.com>:

The 1st and 2nd patch refactor to use asoc_substream_to_rtd().

The 3rd patch simplifies ops of Capture1 DAI link.

Changes from v2[1]:
- Fix typo in 3rd patch's title, s/simply/simplify/.

Changes from v1[2]:
- Separated from v1.

[1]: https://patchwork.kernel.org/project/alsa-devel/list/?series=420919
[2]: https://patchwork.kernel.org/project/alsa-devel/list/?series=419769

Tzung-Bi Shih (3):
  ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd()
  ASoC: mediatek: mt8192: use asoc_substream_to_rtd()
  ASoC: mediatek: mt8192-mt6359: simplify ops for Capture1 DAI link

 sound/soc/mediatek/mt8192/mt8192-afe-pcm.c    |  4 ++--
 .../mt8192/mt8192-mt6359-rt1015-rt5682.c      | 24 ++++++++-----------
 2 files changed, 12 insertions(+), 16 deletions(-)

--
2.30.0.365.g02bc693789-goog
parents 0dd4d3e8 4cceb42f
...@@ -42,7 +42,7 @@ static const struct snd_pcm_hardware mt8192_afe_hardware = { ...@@ -42,7 +42,7 @@ static const struct snd_pcm_hardware mt8192_afe_hardware = {
static int mt8192_memif_fs(struct snd_pcm_substream *substream, static int mt8192_memif_fs(struct snd_pcm_substream *substream,
unsigned int rate) 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 = struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); 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, ...@@ -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) 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 = struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
......
...@@ -39,7 +39,7 @@ struct mt8192_mt6359_priv { ...@@ -39,7 +39,7 @@ struct mt8192_mt6359_priv {
static int mt8192_rt1015_i2s_hw_params(struct snd_pcm_substream *substream, static int mt8192_rt1015_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) 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_card *card = rtd->card;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
...@@ -74,7 +74,7 @@ static int mt8192_rt1015_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -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, static int mt8192_rt5682_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) 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_card *card = rtd->card;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
...@@ -360,14 +360,8 @@ static int mt8192_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -360,14 +360,8 @@ static int mt8192_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
} }
static int 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 = substream->private_data;
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[] = { static const unsigned int channels[] = {
1, 2, 4 1, 2, 4
}; };
...@@ -385,13 +379,15 @@ mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream) ...@@ -385,13 +379,15 @@ mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream)
.mask = 0, .mask = 0,
}; };
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int ret;
ret = snd_pcm_hw_constraint_list(runtime, 0, ret = snd_pcm_hw_constraint_list(runtime, 0,
SNDRV_PCM_HW_PARAM_CHANNELS, SNDRV_PCM_HW_PARAM_CHANNELS,
&constraints_channels); &constraints_channels);
if (ret < 0) { 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; return ret;
} }
...@@ -399,15 +395,15 @@ mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream) ...@@ -399,15 +395,15 @@ mt8192_mt6359_rt1015_rt5682_cap1_startup(struct snd_pcm_substream *substream)
SNDRV_PCM_HW_PARAM_RATE, SNDRV_PCM_HW_PARAM_RATE,
&constraints_rates); &constraints_rates);
if (ret < 0) { 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 ret;
} }
return 0; return 0;
} }
static const struct snd_soc_ops mt8192_mt6359_rt1015_rt5682_capture1_ops = { static const struct snd_soc_ops mt8192_mt6359_capture1_ops = {
.startup = mt8192_mt6359_rt1015_rt5682_cap1_startup, .startup = mt8192_mt6359_cap1_startup,
}; };
/* FE */ /* FE */
...@@ -720,7 +716,7 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = { ...@@ -720,7 +716,7 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = {
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ops = &mt8192_mt6359_rt1015_rt5682_capture1_ops, .ops = &mt8192_mt6359_capture1_ops,
SND_SOC_DAILINK_REG(capture1), SND_SOC_DAILINK_REG(capture1),
}, },
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment