alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [PATCH 5/6] ASoC: Intel: bytcr_rt5640: use HID translation util
Date: Thu,  3 Mar 2016 21:36:38 -0600	[thread overview]
Message-ID: <1457062599-10032-7-git-send-email-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <1457062599-10032-1-git-send-email-pierre-louis.bossart@linux.intel.com>

Remove hard-coded generation of codec name, use translation routine
to avoid issues with codec name not matching what the ACPI subsystem
registered

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/bytcr_rt5640.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index a06cd1f..032a2e7 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -340,15 +340,31 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
 	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int i;
+	int dai_index;
 
 	/* register the soc card */
 	byt_rt5640_card.dev = &pdev->dev;
 	mach = byt_rt5640_card.dev->platform_data;
 
+	/* fix index of codec dai */
+	dai_index = MERR_DPCM_COMPR + 1;
+	for (i = 0; i < ARRAY_SIZE(byt_rt5640_dais); i++) {
+		if (!strcmp(byt_rt5640_dais[i].codec_name, "i2c-10EC5640:00")) {
+			dai_index = i;
+			break;
+		}
+	}
+
 	/* fixup codec name based on HID */
-	snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
-		 "%s%s%s", "i2c-", mach->id, ":00");
-	byt_rt5640_dais[MERR_DPCM_COMPR+1].codec_name = byt_rt5640_codec_name;
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
+			"%s%s", "i2c-", i2c_name);
+
+		byt_rt5640_dais[dai_index].codec_name = byt_rt5640_codec_name;
+	}
 
 	/* check quirks before creating card */
 	dmi_check_system(byt_rt5640_quirk_table);
-- 
1.9.1

  parent reply	other threads:[~2016-03-04  3:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  3:36 [PATCH 0/6] Support for CherryTrail devices Pierre-Louis Bossart
2016-03-04  3:36 ` [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module Pierre-Louis Bossart
2016-03-05  4:03   ` Mark Brown
2016-03-07 17:49     ` Pierre-Louis Bossart
2016-03-09  2:43       ` Mark Brown
2016-03-09 17:06         ` Pierre-Louis Bossart
2016-03-09 17:19           ` Takashi Iwai
2016-03-10  5:45             ` Mark Brown
2016-03-04  3:36 ` [PATCH 2/6] ASoC: Intel: common: filter ACPI devices with _STA return value Pierre-Louis Bossart
2016-03-05 12:25   ` Applied "ASoC: Intel: common: filter ACPI devices with _STA return value" to the asoc tree Mark Brown
2016-03-04  3:36 ` [PATCH 2/6] ASoC: Intel: filter ACPI devices based on _STA return value Pierre-Louis Bossart
2016-03-04  3:36 ` [PATCH 3/6] ASoC: Intel: common: add translation from HID to codec-name Pierre-Louis Bossart
2016-03-05 12:25   ` Applied "ASoC: Intel: common: add translation from HID to codec-name" to the asoc tree Mark Brown
2016-03-04  3:36 ` [PATCH 4/6] ASoC: Intel: bytcr_rt5640: change quirk position Pierre-Louis Bossart
2016-03-05 12:25   ` Applied "ASoC: Intel: bytcr_rt5640: change quirk position" to the asoc tree Mark Brown
2016-03-04  3:36 ` Pierre-Louis Bossart [this message]
2016-03-05 12:25   ` Applied "ASoC: Intel: bytcr_rt5640: use HID translation util" " Mark Brown
2016-03-04  3:36 ` [PATCH 6/6] ASoC: Intel: Atom: add support for CHT w/ RT5640 Pierre-Louis Bossart
2016-03-05 12:24   ` Applied "ASoC: Intel: Atom: add support for CHT w/ RT5640" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457062599-10032-7-git-send-email-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).