Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5f0ab05 authored by Jarkko Nikula's avatar Jarkko Nikula Committed by Mark Brown
Browse files

ASoC: Intel: byt-rt5640: Enable DMIC interface for default DAPM route



It turned out DMIC interface wasn't enabled/disabled runtime for active
DMIC route in the rt5640 codec driver anymore after commit
71d97a79 ("ASoC: rt5640: Use the platform data for DMIC settings").

Since DMIC interface must be enabled explicitly either by passing platform
data to rt5640 codec driver or by calling new rt5640_dmic_enable() this
patch adds a DMI quirk flag that is used to conditionally enable DMIC
interface during sound card init time.

Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1400760c
Loading
Loading
Loading
Loading
+13 −3
Original line number Original line Diff line number Diff line
@@ -59,7 +59,11 @@ enum {
	BYT_RT5640_IN1_MAP,
	BYT_RT5640_IN1_MAP,
};
};


static unsigned long byt_rt5640_custom_map = BYT_RT5640_DMIC1_MAP;
#define BYT_RT5640_MAP(quirk)	((quirk) & 0xff)
#define BYT_RT5640_DMIC_EN	BIT(16)

static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP |
					BYT_RT5640_DMIC_EN;


static const struct snd_kcontrol_new byt_rt5640_controls[] = {
static const struct snd_kcontrol_new byt_rt5640_controls[] = {
	SOC_DAPM_PIN_SWITCH("Headphone"),
	SOC_DAPM_PIN_SWITCH("Headphone"),
@@ -94,7 +98,7 @@ static int byt_rt5640_hw_params(struct snd_pcm_substream *substream,


static int byt_rt5640_quirk_cb(const struct dmi_system_id *id)
static int byt_rt5640_quirk_cb(const struct dmi_system_id *id)
{
{
	byt_rt5640_custom_map = (unsigned long)id->driver_data;
	byt_rt5640_quirk = (unsigned long)id->driver_data;
	return 1;
	return 1;
}
}


@@ -129,7 +133,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
	}
	}


	dmi_check_system(byt_rt5640_quirk_table);
	dmi_check_system(byt_rt5640_quirk_table);
	switch (byt_rt5640_custom_map) {
	switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
	case BYT_RT5640_IN1_MAP:
	case BYT_RT5640_IN1_MAP:
		custom_map = byt_rt5640_intmic_in1_map;
		custom_map = byt_rt5640_intmic_in1_map;
		num_routes = ARRAY_SIZE(byt_rt5640_intmic_in1_map);
		num_routes = ARRAY_SIZE(byt_rt5640_intmic_in1_map);
@@ -143,6 +147,12 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
	if (ret)
	if (ret)
		return ret;
		return ret;


	if (byt_rt5640_quirk & BYT_RT5640_DMIC_EN) {
		ret = rt5640_dmic_enable(codec, 0, 0);
		if (ret)
			return ret;
	}

	snd_soc_dapm_ignore_suspend(dapm, "HPOL");
	snd_soc_dapm_ignore_suspend(dapm, "HPOL");
	snd_soc_dapm_ignore_suspend(dapm, "HPOR");
	snd_soc_dapm_ignore_suspend(dapm, "HPOR");