ASoC: mediatek: mt8192-mt6359: simplify ops for Capture1 DAI link
1. Uses rtd->dev to get the device. 2. Generalizes the variable name. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20210203032201.2882158-4-tzungbi@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0840706d6c
commit
4cceb42f4f
@ -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 = 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[] = {
|
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)
|
|||||||
.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)
|
|||||||
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[] = {
|
|||||||
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),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user