aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-11-25 09:40:18 -0500
committerMark Brown <broonie@kernel.org>2016-11-30 13:00:59 -0500
commitfee3244cd1f5af813a24537950e211eee4f33297 (patch)
tree9840bc9573bb463cebdb92e2a3a6efbaa95bf4b9
parent786e1c37194e8e822eb72a0aed5fa850e07071a0 (diff)
ASoC: cht_bsw_rt5672: Use HID translation unit
Instead of hard-coded "i2c-10EC5670:00", use the translation helper to avoid the mismatch between i2c-codec and ACPI strings just like what we've done for bytcr_rt5640. This gives more robust binding on funky devices like Dell Wyse 3040. Signed-off-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5672.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index df9d254baa18..fe607d8701a0 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -25,12 +25,14 @@
25#include <sound/jack.h> 25#include <sound/jack.h>
26#include "../../codecs/rt5670.h" 26#include "../../codecs/rt5670.h"
27#include "../atom/sst-atom-controls.h" 27#include "../atom/sst-atom-controls.h"
28#include "../common/sst-acpi.h"
28 29
29/* The platform clock #3 outputs 19.2Mhz clock to codec as I2S MCLK */ 30/* The platform clock #3 outputs 19.2Mhz clock to codec as I2S MCLK */
30#define CHT_PLAT_CLK_3_HZ 19200000 31#define CHT_PLAT_CLK_3_HZ 19200000
31#define CHT_CODEC_DAI "rt5670-aif1" 32#define CHT_CODEC_DAI "rt5670-aif1"
32 33
33static struct snd_soc_jack cht_bsw_headset; 34static struct snd_soc_jack cht_bsw_headset;
35static char cht_bsw_codec_name[16];
34 36
35/* Headset jack detection DAPM pins */ 37/* Headset jack detection DAPM pins */
36static struct snd_soc_jack_pin cht_bsw_headset_pins[] = { 38static struct snd_soc_jack_pin cht_bsw_headset_pins[] = {
@@ -295,7 +297,7 @@ static int cht_suspend_pre(struct snd_soc_card *card)
295 struct snd_soc_codec *codec; 297 struct snd_soc_codec *codec;
296 298
297 list_for_each_entry(codec, &card->codec_dev_list, card_list) { 299 list_for_each_entry(codec, &card->codec_dev_list, card_list) {
298 if (!strcmp(codec->component.name, "i2c-10EC5670:00")) { 300 if (!strcmp(codec->component.name, cht_bsw_codec_name)) {
299 dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n"); 301 dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n");
300 rt5670_jack_suspend(codec); 302 rt5670_jack_suspend(codec);
301 break; 303 break;
@@ -309,7 +311,7 @@ static int cht_resume_post(struct snd_soc_card *card)
309 struct snd_soc_codec *codec; 311 struct snd_soc_codec *codec;
310 312
311 list_for_each_entry(codec, &card->codec_dev_list, card_list) { 313 list_for_each_entry(codec, &card->codec_dev_list, card_list) {
312 if (!strcmp(codec->component.name, "i2c-10EC5670:00")) { 314 if (!strcmp(codec->component.name, cht_bsw_codec_name)) {
313 dev_dbg(codec->dev, "enabling jack detect for resume.\n"); 315 dev_dbg(codec->dev, "enabling jack detect for resume.\n");
314 rt5670_jack_resume(codec); 316 rt5670_jack_resume(codec);
315 break; 317 break;
@@ -335,9 +337,33 @@ static struct snd_soc_card snd_soc_card_cht = {
335 .resume_post = cht_resume_post, 337 .resume_post = cht_resume_post,
336}; 338};
337 339
340#define RT5672_I2C_DEFAULT "i2c-10EC5670:00"
341
338static int snd_cht_mc_probe(struct platform_device *pdev) 342static int snd_cht_mc_probe(struct platform_device *pdev)
339{ 343{
340 int ret_val = 0; 344 int ret_val = 0;
345 struct sst_acpi_mach *mach = pdev->dev.platform_data;
346 const char *i2c_name;
347 int i;
348
349 strcpy(cht_bsw_codec_name, RT5672_I2C_DEFAULT);
350
351 /* fixup codec name based on HID */
352 if (mach) {
353 i2c_name = sst_acpi_find_name_from_hid(mach->id);
354 if (i2c_name) {
355 snprintf(cht_bsw_codec_name, sizeof(cht_bsw_codec_name),
356 "i2c-%s", i2c_name);
357 for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
358 if (!strcmp(cht_dailink[i].codec_name,
359 RT5672_I2C_DEFAULT)) {
360 cht_dailink[i].codec_name =
361 cht_bsw_codec_name;
362 break;
363 }
364 }
365 }
366 }
341 367
342 /* register the soc card */ 368 /* register the soc card */
343 snd_soc_card_cht.dev = &pdev->dev; 369 snd_soc_card_cht.dev = &pdev->dev;