All of lore.kernel.org
 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, vinod.koul@intel.com, broonie@kernel.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH 2/6] ASoC: Intel: bytcr_rt5651: filter codec name and fix variable declarations
Date: Thu,  5 Oct 2017 13:52:39 -0500	[thread overview]
Message-ID: <20171005185243.4174-3-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20171005185243.4174-1-pierre-louis.bossart@linux.intel.com>

Use same fix as other codecs to work around BIOS/ACPI issues

Also reorder variables in reverse x-mas tree as suggested by Andy

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index e41c7ea91bd9..1b97aa735747 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -32,6 +32,7 @@
 #include <sound/jack.h>
 #include "../../codecs/rt5651.h"
 #include "../atom/sst-atom-controls.h"
+#include "../common/sst-acpi.h"
 
 enum {
 	BYT_RT5651_DMIC_MAP,
@@ -244,11 +245,11 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
 
 static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 {
-	int ret;
 	struct snd_soc_card *card = runtime->card;
-	const struct snd_soc_dapm_route *custom_map;
 	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
+	const struct snd_soc_dapm_route *custom_map;
 	int num_routes;
+	int ret;
 
 	card->dapm.idle_bias_off = true;
 
@@ -443,10 +444,16 @@ static struct snd_soc_card byt_rt5651_card = {
 	.fully_routed = true,
 };
 
+static char byt_rt5651_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
-	int ret_val = 0;
 	struct byt_rt5651_private *priv;
+	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int ret_val = 0;
+	int dai_index;
+	int i;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_ATOMIC);
 	if (!priv)
@@ -454,6 +461,25 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 
 	/* register the soc card */
 	byt_rt5651_card.dev = &pdev->dev;
+	mach = byt_rt5651_card.dev->platform_data;
+
+	/* fix index of codec dai */
+	dai_index = MERR_DPCM_COMPR + 1;
+	for (i = 0; i < ARRAY_SIZE(byt_rt5651_dais); i++) {
+		if (!strcmp(byt_rt5651_dais[i].codec_name, "i2c-10EC5651:00")) {
+			dai_index = i;
+			break;
+		}
+	}
+
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name) {
+		snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
+			"%s%s", "i2c-", i2c_name);
+
+		byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
+	}
 
 	mach = byt_rt5651_card.dev->platform_data;
 	snd_soc_card_set_drvdata(&byt_rt5651_card, priv);
@@ -469,7 +495,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 
 	/* fixup codec name based on HID */
 	i2c_name = sst_acpi_find_name_from_hid(mach->id);
-	if (i2c_name != NULL) {
+	if (i2c_name) {
 		snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
 			"%s%s", "i2c-", i2c_name);
 
-- 
2.11.0

  parent reply	other threads:[~2017-10-05 18:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05 18:52 [PATCH 0/6] Baytrail-Cherrytrail updates Pierre-Louis Bossart
2017-10-05 18:52 ` [PATCH 1/6] ASoC: Intel: bytcr_rt5651: add MCLK support and fix quirks Pierre-Louis Bossart
2017-10-05 18:52 ` Pierre-Louis Bossart [this message]
2017-10-05 18:52 ` [PATCH 3/6] ASoC: Intel: bytcr_rt5640: cosmetic fixes Pierre-Louis Bossart
2017-10-18 11:31   ` Applied "ASoC: Intel: bytcr_rt5640: cosmetic fixes" to the asoc tree Mark Brown
2017-10-05 18:52 ` [PATCH 4/6] ASoC: Intel: cht_bsw_rt5645: cosmetic fixes Pierre-Louis Bossart
2017-10-18 11:31   ` Applied "ASoC: Intel: cht_bsw_rt5645: cosmetic fixes" to the asoc tree Mark Brown
2017-10-05 18:52 ` [PATCH 5/6] ASoC: Intel: bytcht_da7213: cosmetic fixes Pierre-Louis Bossart
2017-10-18 11:31   ` Applied "ASoC: Intel: bytcht_da7213: cosmetic fixes" to the asoc tree Mark Brown
2017-10-05 18:52 ` [PATCH 6/6] ASoC: Intel: boards: use strcmp with constant literals Pierre-Louis Bossart
2017-10-06  8:55   ` Takashi Iwai
2017-10-06 11:50     ` Andy Shevchenko
2017-10-06 14:28       ` Pierre-Louis Bossart
2017-10-06 15:24         ` Pierre-Louis Bossart
2017-10-06 15:48           ` Takashi Iwai
2017-10-09  9:34     ` Vinod Koul

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=20171005185243.4174-3-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.