Unverified Commit 46466ab6 authored by Hans de Goede's avatar Hans de Goede Committed by Mark Brown
Browse files

ASoC: Intel: bytcr_rt5640: Add new BYT_RT5640_NO_INTERNAL_MIC_MAP input-mapping



Some devices, like mini PCs/media/top-set boxes do not have an internal
microphone at all, an example of the is the Mele PCG03 Mini PC.

Add a new BYT_RT5640_NO_INTERNAL_MIC_MAP input-mapping for this,
which does not add any internal-mic routes and modifies the components
and the (optional) long_name strings to reflect this.

Cc: Rasmus Porsager <rasmus@beat.dk>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210109210119.159032-3-hdegoede@redhat.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1851ccf9
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ enum {
	BYT_RT5640_DMIC2_MAP,
	BYT_RT5640_IN1_MAP,
	BYT_RT5640_IN3_MAP,
	BYT_RT5640_NO_INTERNAL_MIC_MAP,
};

enum {
@@ -117,6 +118,9 @@ static void log_quirks(struct device *dev)
	case BYT_RT5640_IN3_MAP:
		dev_info(dev, "quirk IN3_MAP enabled\n");
		break;
	case BYT_RT5640_NO_INTERNAL_MIC_MAP:
		dev_info(dev, "quirk NO_INTERNAL_MIC_MAP enabled\n");
		break;
	default:
		dev_err(dev, "quirk map 0x%x is not supported, microphone input will not work\n", map);
		break;
@@ -876,8 +880,8 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
	struct snd_soc_card *card = runtime->card;
	struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
	struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component;
	const struct snd_soc_dapm_route *custom_map;
	int num_routes;
	const struct snd_soc_dapm_route *custom_map = NULL;
	int num_routes = 0;
	int ret;

	card->dapm.idle_bias_off = true;
@@ -912,13 +916,14 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
		custom_map = byt_rt5640_intmic_in3_map;
		num_routes = ARRAY_SIZE(byt_rt5640_intmic_in3_map);
		break;
	case BYT_RT5640_DMIC1_MAP:
		custom_map = byt_rt5640_intmic_dmic1_map;
		num_routes = ARRAY_SIZE(byt_rt5640_intmic_dmic1_map);
		break;
	case BYT_RT5640_DMIC2_MAP:
		custom_map = byt_rt5640_intmic_dmic2_map;
		num_routes = ARRAY_SIZE(byt_rt5640_intmic_dmic2_map);
		break;
	default:
		custom_map = byt_rt5640_intmic_dmic1_map;
		num_routes = ARRAY_SIZE(byt_rt5640_intmic_dmic1_map);
	}

	ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
@@ -1190,7 +1195,7 @@ struct acpi_chan_package { /* ACPICA seems to require 64 bit integers */
static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3" };
	static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3", "none" };
	__maybe_unused const char *spk_type;
	const struct dmi_system_id *dmi_id;
	struct byt_rt5640_private *priv;