Skip to content

Commit 4cd7654

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: rt5645: Add a rt5645_components() helper
The rt5645 codec driver uses DMI quirks to configure the DMIC data-pins, which means that it knows which DMIC interface is used on a specific device. ATM we duplicate this DMI matching inside the UCM profiles to select the right DMIC interface. Add a rt5645_components() helper which the machine-driver can use to set the components string of the card so that UCM can get the info from the components string. This way we only need to add new DMI quirks in one place. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://msgid.link/r/20231126214024.300505-6-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent b4635b9 commit 4cd7654

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

sound/soc/codecs/rt5645.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3902,6 +3902,30 @@ static void rt5645_get_pdata(struct device *codec_dev, struct rt5645_platform_da
39023902
}
39033903
}
39043904

3905+
const char *rt5645_components(struct device *codec_dev)
3906+
{
3907+
struct rt5645_platform_data pdata = { };
3908+
static char buf[32];
3909+
const char *mic;
3910+
int spk = 2;
3911+
3912+
rt5645_get_pdata(codec_dev, &pdata);
3913+
3914+
if (pdata.dmic1_data_pin && pdata.dmic2_data_pin)
3915+
mic = "dmics12";
3916+
else if (pdata.dmic1_data_pin)
3917+
mic = "dmic1";
3918+
else if (pdata.dmic2_data_pin)
3919+
mic = "dmic2";
3920+
else
3921+
mic = "in2";
3922+
3923+
snprintf(buf, sizeof(buf), "cfg-spk:%d cfg-mic:%s", spk, mic);
3924+
3925+
return buf;
3926+
}
3927+
EXPORT_SYMBOL_GPL(rt5645_components);
3928+
39053929
static int rt5645_i2c_probe(struct i2c_client *i2c)
39063930
{
39073931
struct rt5645_priv *rt5645;

sound/soc/codecs/rt5645.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,4 +2201,7 @@ int rt5645_sel_asrc_clk_src(struct snd_soc_component *component,
22012201
int rt5645_set_jack_detect(struct snd_soc_component *component,
22022202
struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack,
22032203
struct snd_soc_jack *btn_jack);
2204+
2205+
const char *rt5645_components(struct device *codec_dev);
2206+
22042207
#endif /* __RT5645_H__ */

0 commit comments

Comments
 (0)