summaryrefslogtreecommitdiff
path: root/sound/soc/intel/avs/boards/rt5682.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-12-06 13:13:26 +0300
committerTakashi Iwai <tiwai@suse.de>2022-12-06 13:13:26 +0300
commit8ec2d95f50c06f5cf2a2b94bcdf47f494f91ad55 (patch)
tree2d6c60670a5a1575780b080e00ca2b26d62f5403 /sound/soc/intel/avs/boards/rt5682.c
parentcf2ea3c86ad90d63d1c572b43e1ca9276b0357ad (diff)
parent9472382db38452df15f9f2f74b1dff34848e56b2 (diff)
downloadlinux-8ec2d95f50c06f5cf2a2b94bcdf47f494f91ad55.tar.xz
Merge tag 'asoc-v6.2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v6.2 This is a fairly sedate release for the core code, but there's been a lot of driver work especially around the x86 platforms and device tree updates: - More cleanups of the DAPM code from Morimoto-san. - Factoring out of mapping hw_params onto SoundWire configuration by Charles Keepax. - The ever ongoing overhauls of the Intel DSP code continue, including support for loading libraries and probes with IPC4 on SOF. - Support for more sample formats on JZ4740. - Lots of device tree conversions and fixups. - Support for Allwinner D1, a range of AMD and Intel systems, Mediatek systems with multiple DMICs, Nuvoton NAU8318, NXP fsl_rpmsg and i.MX93, Qualcomm AudioReach Enable, MFC and SAL, RealTek RT1318 and Rockchip RK3588 There's more cross tree updates than usual, though all fairly minor: - Some OMAP board file updates that were depedencies for removing their providers in ASoC, as part of a wider effort removing the support for the relevant OMAP platforms. - A new I2C API required for updates to the new I2C probe API. - A DRM update making use of a new API for fixing the capabilities advertised via hdmi-codec. Since this is being sent early I might send some more stuff if you've not yet sent your pull request and there's more come in.
Diffstat (limited to 'sound/soc/intel/avs/boards/rt5682.c')
-rw-r--r--sound/soc/intel/avs/boards/rt5682.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c
index 01f9b9f0c12b..473e9fe5d0bf 100644
--- a/sound/soc/intel/avs/boards/rt5682.c
+++ b/sound/soc/intel/avs/boards/rt5682.c
@@ -26,6 +26,7 @@
#define AVS_RT5682_SSP_CODEC_MASK (GENMASK(2, 0))
#define AVS_RT5682_MCLK_EN BIT(3)
#define AVS_RT5682_MCLK_24MHZ BIT(4)
+#define AVS_RT5682_CODEC_DAI_NAME "rt5682-aif1"
/* Default: MCLK on, MCLK 19.2M, SSP0 */
static unsigned long avs_rt5682_quirk = AVS_RT5682_MCLK_EN | AVS_RT5682_SSP_CODEC(0);
@@ -119,6 +120,11 @@ static int avs_rt5682_codec_init(struct snd_soc_pcm_runtime *runtime)
return 0;
};
+static void avs_rt5682_codec_exit(struct snd_soc_pcm_runtime *rtd)
+{
+ snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL);
+}
+
static int
avs_rt5682_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params)
{
@@ -184,7 +190,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port);
dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5682:00");
- dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "rt5682-aif1");
+ dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, AVS_RT5682_CODEC_DAI_NAME);
if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name)
return -ENOMEM;
@@ -194,6 +200,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
dl->num_platforms = 1;
dl->id = 0;
dl->init = avs_rt5682_codec_init;
+ dl->exit = avs_rt5682_codec_exit;
dl->ops = &avs_rt5682_ops;
dl->nonatomic = 1;
dl->no_pcm = 1;
@@ -237,30 +244,19 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port,
return 0;
}
-static int avs_card_set_jack(struct snd_soc_card *card, struct snd_soc_jack *jack)
-{
- struct snd_soc_component *component;
-
- for_each_card_components(card, component)
- snd_soc_component_set_jack(component, jack, NULL);
- return 0;
-}
-
-static int avs_card_remove(struct snd_soc_card *card)
-{
- return avs_card_set_jack(card, NULL);
-}
-
static int avs_card_suspend_pre(struct snd_soc_card *card)
{
- return avs_card_set_jack(card, NULL);
+ struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, AVS_RT5682_CODEC_DAI_NAME);
+
+ return snd_soc_component_set_jack(codec_dai->component, NULL, NULL);
}
static int avs_card_resume_post(struct snd_soc_card *card)
{
+ struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, AVS_RT5682_CODEC_DAI_NAME);
struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card);
- return avs_card_set_jack(card, jack);
+ return snd_soc_component_set_jack(codec_dai->component, jack, NULL);
}
static int avs_rt5682_probe(struct platform_device *pdev)
@@ -304,7 +300,6 @@ static int avs_rt5682_probe(struct platform_device *pdev)
card->name = "avs_rt5682";
card->dev = dev;
card->owner = THIS_MODULE;
- card->remove = avs_card_remove;
card->suspend_pre = avs_card_suspend_pre;
card->resume_post = avs_card_resume_post;
card->dai_link = dai_link;