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

Unverified Commit 3c22a73f authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown
Browse files

ASoC: Intel: bytcht_es8316: fix HID handling

Same problem as with previous machine drivers, the codec dai
uses a hard-coded name of "i2c-ESSX8316:00" but ACPI provides
"i2c-ESSX8316:01" in some systems.

Fix by overriding the hard-coded value with the codec name derived
from the HID information

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189261


Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-By: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2ebec60b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ config SND_SOC_INTEL_BYT_CHT_DA7213_MACH
config SND_SOC_INTEL_BYT_CHT_ES8316_MACH
	tristate "Baytrail & Cherrytrail with ES8316 codec"
	depends on X86_INTEL_LPSS && I2C && ACPI
	select SND_SOC_ACPI
	select SND_SOC_ES8316
	help
	  This adds support for ASoC machine driver for Intel(R) Baytrail &
+25 −1
Original line number Diff line number Diff line
@@ -232,15 +232,39 @@ static struct snd_soc_card byt_cht_es8316_card = {
	.fully_routed = true,
};

static char codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */

static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
{
	int ret = 0;
	struct byt_cht_es8316_private *priv;
	struct snd_soc_acpi_mach *mach;
	const char *i2c_name = NULL;
	int dai_index = 0;
	int i;
	int ret = 0;

	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_ATOMIC);
	if (!priv)
		return -ENOMEM;

	mach = (&pdev->dev)->platform_data;
	/* fix index of codec dai */
	for (i = 0; i < ARRAY_SIZE(byt_cht_es8316_dais); i++) {
		if (!strcmp(byt_cht_es8316_dais[i].codec_name,
			    "i2c-ESSX8316:00")) {
			dai_index = i;
			break;
		}
	}

	/* fixup codec name based on HID */
	i2c_name = snd_soc_acpi_find_name_from_hid(mach->id);
	if (i2c_name) {
		snprintf(codec_name, sizeof(codec_name),
			"%s%s", "i2c-", i2c_name);
		byt_cht_es8316_dais[dai_index].codec_name = codec_name;
	}

	/* register the soc card */
	byt_cht_es8316_card.dev = &pdev->dev;
	snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);