diff options
author | Hans de Goede <hdegoede@redhat.com> | 2021-08-02 16:24:58 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-08-02 15:47:44 +0100 |
commit | 810711407467667761f7fd6aa1b8884203ecbeca (patch) | |
tree | d56fec2334dcba997fd5d33be56aa5b86ebd5c5a /sound/soc/intel | |
parent | dd3e2025100c08d1fabd116bf5b6646f1589a95e (diff) | |
download | linux-stable-810711407467667761f7fd6aa1b8884203ecbeca.tar.gz linux-stable-810711407467667761f7fd6aa1b8884203ecbeca.tar.bz2 linux-stable-810711407467667761f7fd6aa1b8884203ecbeca.zip |
ASoC: Intel: bytcr_rt5640: Add a byt_rt5640_get_codec_dai() helper
Add a byt_rt5640_get_codec_dai() helper, which gets the codec_dai
from a dapm_context.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210802142501.991985-4-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r-- | sound/soc/intel/boards/bytcr_rt5640.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index e8a8f6b5ef96..70faba13450c 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -227,6 +227,20 @@ static int byt_rt5640_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai, #define BYT_CODEC_DAI1 "rt5640-aif1" #define BYT_CODEC_DAI2 "rt5640-aif2" +static struct snd_soc_dai *byt_rt5640_get_codec_dai(struct snd_soc_dapm_context *dapm) +{ + struct snd_soc_card *card = dapm->card; + struct snd_soc_dai *codec_dai; + + codec_dai = snd_soc_card_get_codec_dai(card, BYT_CODEC_DAI1); + if (!codec_dai) + codec_dai = snd_soc_card_get_codec_dai(card, BYT_CODEC_DAI2); + if (!codec_dai) + dev_err(card->dev, "Error codec dai not found\n"); + + return codec_dai; +} + static int platform_clock_control(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { @@ -236,15 +250,9 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card); int ret; - codec_dai = snd_soc_card_get_codec_dai(card, BYT_CODEC_DAI1); + codec_dai = byt_rt5640_get_codec_dai(dapm); if (!codec_dai) - codec_dai = snd_soc_card_get_codec_dai(card, BYT_CODEC_DAI2); - - if (!codec_dai) { - dev_err(card->dev, - "Codec dai not found; Unable to set platform clock\n"); return -EIO; - } if (SND_SOC_DAPM_EVENT_ON(event)) { if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) { |