summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-01-19 07:57:33 -0500
committerTakashi Iwai <tiwai@suse.de>2018-01-19 07:57:33 -0500
commitc86d95cb6b7ecda7b7d56e40c24b7d8b9bf9159a (patch)
tree3d868496a15be09dfb3a471e7b9dce24c0216d89 /sound
parent388fdb8f882af67ff8394d9420c1e0e42ba35619 (diff)
parent8f05b9c65d817dd288da5f1c6ecc134b66f8a190 (diff)
Merge tag 'asoc-v4.16-3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v4.16 Some final updates for the merge window, this brings in some improvements to the ACPI GPIO handling for Intel and a bunch of fixes.
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/au1x/ac97c.c6
-rw-r--r--sound/soc/bcm/bcm2835-i2s.c20
-rw-r--r--sound/soc/codecs/cs42l73.c2
-rw-r--r--sound/soc/codecs/cx20442.c26
-rw-r--r--sound/soc/codecs/sgtl5000.c5
-rw-r--r--sound/soc/codecs/tlv320dac33.c15
-rw-r--r--sound/soc/codecs/uda1380.c2
-rw-r--r--sound/soc/intel/Kconfig1
-rw-r--r--sound/soc/intel/boards/Kconfig1
-rw-r--r--sound/soc/intel/boards/bytcht_da7213.c4
-rw-r--r--sound/soc/intel/boards/bytcht_es8316.c26
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c4
-rw-r--r--sound/soc/intel/boards/bytcr_rt5651.c4
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5645.c6
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5672.c4
-rw-r--r--sound/soc/intel/skylake/skl-topology.c1
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c25
-rw-r--r--sound/soc/soc-acpi.c33
-rw-r--r--sound/soc/soc-core.c112
-rw-r--r--sound/soc/soc-io.c6
20 files changed, 160 insertions, 143 deletions
diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index 29a97d52e8ad..66d6c52e7761 100644
--- a/sound/soc/au1x/ac97c.c
+++ b/sound/soc/au1x/ac97c.c
@@ -91,8 +91,8 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
91 do { 91 do {
92 mutex_lock(&ctx->lock); 92 mutex_lock(&ctx->lock);
93 93
94 tmo = 5; 94 tmo = 6;
95 while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--) 95 while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
96 udelay(21); /* wait an ac97 frame time */ 96 udelay(21); /* wait an ac97 frame time */
97 if (!tmo) { 97 if (!tmo) {
98 pr_debug("ac97rd timeout #1\n"); 98 pr_debug("ac97rd timeout #1\n");
@@ -105,7 +105,7 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
105 * poll, Forrest, poll... 105 * poll, Forrest, poll...
106 */ 106 */
107 tmo = 0x10000; 107 tmo = 0x10000;
108 while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--) 108 while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
109 asm volatile ("nop"); 109 asm volatile ("nop");
110 data = RD(ctx, AC97_CMDRESP); 110 data = RD(ctx, AC97_CMDRESP);
111 111
diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index 2e449d7173fc..d5f73a8ab893 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -130,6 +130,7 @@ struct bcm2835_i2s_dev {
130 struct regmap *i2s_regmap; 130 struct regmap *i2s_regmap;
131 struct clk *clk; 131 struct clk *clk;
132 bool clk_prepared; 132 bool clk_prepared;
133 int clk_rate;
133}; 134};
134 135
135static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev) 136static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev)
@@ -419,10 +420,19 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
419 } 420 }
420 421
421 /* Clock should only be set up here if CPU is clock master */ 422 /* Clock should only be set up here if CPU is clock master */
422 if (bit_clock_master) { 423 if (bit_clock_master &&
423 ret = clk_set_rate(dev->clk, bclk_rate); 424 (!dev->clk_prepared || dev->clk_rate != bclk_rate)) {
424 if (ret) 425 if (dev->clk_prepared)
425 return ret; 426 bcm2835_i2s_stop_clock(dev);
427
428 if (dev->clk_rate != bclk_rate) {
429 ret = clk_set_rate(dev->clk, bclk_rate);
430 if (ret)
431 return ret;
432 dev->clk_rate = bclk_rate;
433 }
434
435 bcm2835_i2s_start_clock(dev);
426 } 436 }
427 437
428 /* Setup the frame format */ 438 /* Setup the frame format */
@@ -618,8 +628,6 @@ static int bcm2835_i2s_prepare(struct snd_pcm_substream *substream,
618 struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); 628 struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
619 uint32_t cs_reg; 629 uint32_t cs_reg;
620 630
621 bcm2835_i2s_start_clock(dev);
622
623 /* 631 /*
624 * Clear both FIFOs if the one that should be started 632 * Clear both FIFOs if the one that should be started
625 * is not empty at the moment. This should only happen 633 * is not empty at the moment. This should only happen
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index dde37e569ade..aebaa97490b6 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -1355,7 +1355,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
1355 ret = regmap_read(cs42l73->regmap, CS42L73_REVID, &reg); 1355 ret = regmap_read(cs42l73->regmap, CS42L73_REVID, &reg);
1356 if (ret < 0) { 1356 if (ret < 0) {
1357 dev_err(&i2c_client->dev, "Get Revision ID failed\n"); 1357 dev_err(&i2c_client->dev, "Get Revision ID failed\n");
1358 return ret;; 1358 return ret;
1359 } 1359 }
1360 1360
1361 dev_info(&i2c_client->dev, 1361 dev_info(&i2c_client->dev,
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index 6b6f8e44369b..95bb10ba80dc 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -28,6 +28,7 @@
28struct cx20442_priv { 28struct cx20442_priv {
29 struct tty_struct *tty; 29 struct tty_struct *tty;
30 struct regulator *por; 30 struct regulator *por;
31 u8 reg_cache;
31}; 32};
32 33
33#define CX20442_PM 0x0 34#define CX20442_PM 0x0
@@ -88,6 +89,17 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = {
88 {"ADC", NULL, "Input Mixer"}, 89 {"ADC", NULL, "Input Mixer"},
89}; 90};
90 91
92static unsigned int cx20442_read_reg_cache(struct snd_soc_codec *codec,
93 unsigned int reg)
94{
95 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
96
97 if (reg >= 1)
98 return -EINVAL;
99
100 return cx20442->reg_cache;
101}
102
91enum v253_vls { 103enum v253_vls {
92 V253_VLS_NONE = 0, 104 V253_VLS_NONE = 0,
93 V253_VLS_T, 105 V253_VLS_T,
@@ -112,8 +124,6 @@ enum v253_vls {
112 V253_VLS_TEST, 124 V253_VLS_TEST,
113}; 125};
114 126
115#if 0
116/* FIXME : these function will be re-used */
117static int cx20442_pm_to_v253_vls(u8 value) 127static int cx20442_pm_to_v253_vls(u8 value)
118{ 128{
119 switch (value & ~(1 << CX20442_AGC)) { 129 switch (value & ~(1 << CX20442_AGC)) {
@@ -147,11 +157,10 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
147 unsigned int value) 157 unsigned int value)
148{ 158{
149 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); 159 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
150 u8 *reg_cache = codec->reg_cache;
151 int vls, vsp, old, len; 160 int vls, vsp, old, len;
152 char buf[18]; 161 char buf[18];
153 162
154 if (reg >= codec->driver->reg_cache_size) 163 if (reg >= 1)
155 return -EINVAL; 164 return -EINVAL;
156 165
157 /* tty and write pointers required for talking to the modem 166 /* tty and write pointers required for talking to the modem
@@ -159,8 +168,8 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
159 if (!cx20442->tty || !cx20442->tty->ops->write) 168 if (!cx20442->tty || !cx20442->tty->ops->write)
160 return -EIO; 169 return -EIO;
161 170
162 old = reg_cache[reg]; 171 old = cx20442->reg_cache;
163 reg_cache[reg] = value; 172 cx20442->reg_cache = value;
164 173
165 vls = cx20442_pm_to_v253_vls(value); 174 vls = cx20442_pm_to_v253_vls(value);
166 if (vls < 0) 175 if (vls < 0)
@@ -190,7 +199,6 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
190 199
191 return 0; 200 return 0;
192} 201}
193#endif
194 202
195/* 203/*
196 * Line discpline related code 204 * Line discpline related code
@@ -384,12 +392,12 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
384 return 0; 392 return 0;
385} 393}
386 394
387static const u8 cx20442_reg;
388
389static const struct snd_soc_codec_driver cx20442_codec_dev = { 395static const struct snd_soc_codec_driver cx20442_codec_dev = {
390 .probe = cx20442_codec_probe, 396 .probe = cx20442_codec_probe,
391 .remove = cx20442_codec_remove, 397 .remove = cx20442_codec_remove,
392 .set_bias_level = cx20442_set_bias_level, 398 .set_bias_level = cx20442_set_bias_level,
399 .read = cx20442_read_reg_cache,
400 .write = cx20442_write,
393 401
394 .component_driver = { 402 .component_driver = {
395 .dapm_widgets = cx20442_dapm_widgets, 403 .dapm_widgets = cx20442_dapm_widgets,
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index f2bb4feba3b6..633cdcfc933d 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1332,10 +1332,13 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1332 sgtl5000->mclk = devm_clk_get(&client->dev, NULL); 1332 sgtl5000->mclk = devm_clk_get(&client->dev, NULL);
1333 if (IS_ERR(sgtl5000->mclk)) { 1333 if (IS_ERR(sgtl5000->mclk)) {
1334 ret = PTR_ERR(sgtl5000->mclk); 1334 ret = PTR_ERR(sgtl5000->mclk);
1335 dev_err(&client->dev, "Failed to get mclock: %d\n", ret);
1336 /* Defer the probe to see if the clk will be provided later */ 1335 /* Defer the probe to see if the clk will be provided later */
1337 if (ret == -ENOENT) 1336 if (ret == -ENOENT)
1338 ret = -EPROBE_DEFER; 1337 ret = -EPROBE_DEFER;
1338
1339 if (ret != -EPROBE_DEFER)
1340 dev_err(&client->dev, "Failed to get mclock: %d\n",
1341 ret);
1339 goto disable_regs; 1342 goto disable_regs;
1340 } 1343 }
1341 1344
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 675f5b1b90a6..8c71d2f876ff 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -246,6 +246,19 @@ static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
246 return ret; 246 return ret;
247} 247}
248 248
249static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
250 unsigned int value)
251{
252 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
253 int ret;
254
255 mutex_lock(&dac33->mutex);
256 ret = dac33_write(codec, reg, value);
257 mutex_unlock(&dac33->mutex);
258
259 return ret;
260}
261
249#define DAC33_I2C_ADDR_AUTOINC 0x80 262#define DAC33_I2C_ADDR_AUTOINC 0x80
250static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg, 263static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
251 unsigned int value) 264 unsigned int value)
@@ -1422,6 +1435,8 @@ static int dac33_soc_remove(struct snd_soc_codec *codec)
1422} 1435}
1423 1436
1424static const struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = { 1437static const struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = {
1438 .read = dac33_read_reg_cache,
1439 .write = dac33_write_locked,
1425 .set_bias_level = dac33_set_bias_level, 1440 .set_bias_level = dac33_set_bias_level,
1426 .idle_bias_off = true, 1441 .idle_bias_off = true,
1427 1442
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 46a495b4da8d..c73e6a192224 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -726,6 +726,8 @@ static int uda1380_probe(struct snd_soc_codec *codec)
726 726
727static const struct snd_soc_codec_driver soc_codec_dev_uda1380 = { 727static const struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
728 .probe = uda1380_probe, 728 .probe = uda1380_probe,
729 .read = uda1380_read_reg_cache,
730 .write = uda1380_write,
729 .set_bias_level = uda1380_set_bias_level, 731 .set_bias_level = uda1380_set_bias_level,
730 .suspend_bias_off = true, 732 .suspend_bias_off = true,
731 733
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index b0bd1938b71e..f2c9e8c5970a 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -77,7 +77,6 @@ config SND_SST_ATOM_HIFI2_PLATFORM_PCI
77 depends on X86 && PCI 77 depends on X86 && PCI
78 select SND_SST_IPC_PCI 78 select SND_SST_IPC_PCI
79 select SND_SOC_COMPRESS 79 select SND_SOC_COMPRESS
80 select SND_SOC_INTEL_COMMON
81 help 80 help
82 If you have a Intel Medfield or Merrifield/Edison platform, then 81 If you have a Intel Medfield or Merrifield/Edison platform, then
83 enable this option by saying Y or m. Distros will typically not 82 enable this option by saying Y or m. Distros will typically not
diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig
index de598dcbef30..d4e103615f51 100644
--- a/sound/soc/intel/boards/Kconfig
+++ b/sound/soc/intel/boards/Kconfig
@@ -139,6 +139,7 @@ config SND_SOC_INTEL_BYT_CHT_DA7213_MACH
139config SND_SOC_INTEL_BYT_CHT_ES8316_MACH 139config SND_SOC_INTEL_BYT_CHT_ES8316_MACH
140 tristate "Baytrail & Cherrytrail with ES8316 codec" 140 tristate "Baytrail & Cherrytrail with ES8316 codec"
141 depends on X86_INTEL_LPSS && I2C && ACPI 141 depends on X86_INTEL_LPSS && I2C && ACPI
142 select SND_SOC_ACPI
142 select SND_SOC_ES8316 143 select SND_SOC_ES8316
143 help 144 help
144 This adds support for ASoC machine driver for Intel(R) Baytrail & 145 This adds support for ASoC machine driver for Intel(R) Baytrail &
diff --git a/sound/soc/intel/boards/bytcht_da7213.c b/sound/soc/intel/boards/bytcht_da7213.c
index c4d82ad41bd7..2179dedb28ad 100644
--- a/sound/soc/intel/boards/bytcht_da7213.c
+++ b/sound/soc/intel/boards/bytcht_da7213.c
@@ -219,7 +219,7 @@ static struct snd_soc_card bytcht_da7213_card = {
219 .num_dapm_routes = ARRAY_SIZE(audio_map), 219 .num_dapm_routes = ARRAY_SIZE(audio_map),
220}; 220};
221 221
222static char codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ 222static char codec_name[SND_ACPI_I2C_ID_LEN];
223 223
224static int bytcht_da7213_probe(struct platform_device *pdev) 224static int bytcht_da7213_probe(struct platform_device *pdev)
225{ 225{
@@ -243,7 +243,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
243 } 243 }
244 244
245 /* fixup codec name based on HID */ 245 /* fixup codec name based on HID */
246 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 246 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
247 if (i2c_name) { 247 if (i2c_name) {
248 snprintf(codec_name, sizeof(codec_name), 248 snprintf(codec_name, sizeof(codec_name),
249 "%s%s", "i2c-", i2c_name); 249 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 8088396717e3..305e7f4fe55a 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -232,15 +232,39 @@ static struct snd_soc_card byt_cht_es8316_card = {
232 .fully_routed = true, 232 .fully_routed = true,
233}; 233};
234 234
235static char codec_name[SND_ACPI_I2C_ID_LEN];
236
235static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) 237static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
236{ 238{
237 int ret = 0;
238 struct byt_cht_es8316_private *priv; 239 struct byt_cht_es8316_private *priv;
240 struct snd_soc_acpi_mach *mach;
241 const char *i2c_name = NULL;
242 int dai_index = 0;
243 int i;
244 int ret = 0;
239 245
240 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_ATOMIC); 246 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_ATOMIC);
241 if (!priv) 247 if (!priv)
242 return -ENOMEM; 248 return -ENOMEM;
243 249
250 mach = (&pdev->dev)->platform_data;
251 /* fix index of codec dai */
252 for (i = 0; i < ARRAY_SIZE(byt_cht_es8316_dais); i++) {
253 if (!strcmp(byt_cht_es8316_dais[i].codec_name,
254 "i2c-ESSX8316:00")) {
255 dai_index = i;
256 break;
257 }
258 }
259
260 /* fixup codec name based on HID */
261 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
262 if (i2c_name) {
263 snprintf(codec_name, sizeof(codec_name),
264 "%s%s", "i2c-", i2c_name);
265 byt_cht_es8316_dais[dai_index].codec_name = codec_name;
266 }
267
244 /* register the soc card */ 268 /* register the soc card */
245 byt_cht_es8316_card.dev = &pdev->dev; 269 byt_cht_es8316_card.dev = &pdev->dev;
246 snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv); 270 snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index f2c0fc415e52..b6a1cfeec830 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -713,7 +713,7 @@ static struct snd_soc_card byt_rt5640_card = {
713 .fully_routed = true, 713 .fully_routed = true,
714}; 714};
715 715
716static char byt_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ 716static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN];
717static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */ 717static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */
718static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ 718static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */
719 719
@@ -762,7 +762,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
762 } 762 }
763 763
764 /* fixup codec name based on HID */ 764 /* fixup codec name based on HID */
765 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 765 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
766 if (i2c_name) { 766 if (i2c_name) {
767 snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name), 767 snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
768 "%s%s", "i2c-", i2c_name); 768 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 22c9cc5d135e..456526a93dd5 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -509,7 +509,7 @@ static struct snd_soc_card byt_rt5651_card = {
509 .fully_routed = true, 509 .fully_routed = true,
510}; 510};
511 511
512static char byt_rt5651_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ 512static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
513 513
514static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) 514static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
515{ 515{
@@ -539,7 +539,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
539 } 539 }
540 540
541 /* fixup codec name based on HID */ 541 /* fixup codec name based on HID */
542 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 542 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
543 if (i2c_name) { 543 if (i2c_name) {
544 snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name), 544 snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
545 "%s%s", "i2c-", i2c_name); 545 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index f898ee140cdc..31641aab62cd 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -49,7 +49,7 @@ struct cht_acpi_card {
49struct cht_mc_private { 49struct cht_mc_private {
50 struct snd_soc_jack jack; 50 struct snd_soc_jack jack;
51 struct cht_acpi_card *acpi_card; 51 struct cht_acpi_card *acpi_card;
52 char codec_name[16]; 52 char codec_name[SND_ACPI_I2C_ID_LEN];
53 struct clk *mclk; 53 struct clk *mclk;
54}; 54};
55 55
@@ -506,7 +506,7 @@ static struct cht_acpi_card snd_soc_cards[] = {
506 {"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650}, 506 {"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650},
507}; 507};
508 508
509static char cht_rt5645_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ 509static char cht_rt5645_codec_name[SND_ACPI_I2C_ID_LEN];
510static char cht_rt5645_codec_aif_name[12]; /* = "rt5645-aif[1|2]" */ 510static char cht_rt5645_codec_aif_name[12]; /* = "rt5645-aif[1|2]" */
511static char cht_rt5645_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ 511static char cht_rt5645_cpu_dai_name[10]; /* = "ssp[0|2]-port" */
512 512
@@ -573,7 +573,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
573 } 573 }
574 574
575 /* fixup codec name based on HID */ 575 /* fixup codec name based on HID */
576 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 576 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
577 if (i2c_name) { 577 if (i2c_name) {
578 snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name), 578 snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
579 "%s%s", "i2c-", i2c_name); 579 "%s%s", "i2c-", i2c_name);
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index f8f21eee9b2d..c14a52d2f714 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -35,7 +35,7 @@
35 35
36struct cht_mc_private { 36struct cht_mc_private {
37 struct snd_soc_jack headset; 37 struct snd_soc_jack headset;
38 char codec_name[16]; 38 char codec_name[SND_ACPI_I2C_ID_LEN];
39 struct clk *mclk; 39 struct clk *mclk;
40}; 40};
41 41
@@ -396,7 +396,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
396 396
397 /* fixup codec name based on HID */ 397 /* fixup codec name based on HID */
398 if (mach) { 398 if (mach) {
399 i2c_name = snd_soc_acpi_find_name_from_hid(mach->id); 399 i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
400 if (i2c_name) { 400 if (i2c_name) {
401 snprintf(drv->codec_name, sizeof(drv->codec_name), 401 snprintf(drv->codec_name, sizeof(drv->codec_name),
402 "i2c-%s", i2c_name); 402 "i2c-%s", i2c_name);
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 28bc16a8e09a..73af6e19ebbd 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -190,7 +190,6 @@ skl_tplg_free_pipe_mcps(struct skl *skl, struct skl_module_cfg *mconfig)
190 u8 res_idx = mconfig->res_idx; 190 u8 res_idx = mconfig->res_idx;
191 struct skl_module_res *res = &mconfig->module->resources[res_idx]; 191 struct skl_module_res *res = &mconfig->module->resources[res_idx];
192 192
193 res = &mconfig->module->resources[res_idx];
194 skl->resource.mcps -= res->cps; 193 skl->resource.mcps -= res->cps;
195} 194}
196 195
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c
index 2ed3240cc682..2b3f2408301a 100644
--- a/sound/soc/mxs/mxs-sgtl5000.c
+++ b/sound/soc/mxs/mxs-sgtl5000.c
@@ -93,6 +93,14 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
93 }, 93 },
94}; 94};
95 95
96static const struct snd_soc_dapm_widget mxs_sgtl5000_dapm_widgets[] = {
97 SND_SOC_DAPM_MIC("Mic Jack", NULL),
98 SND_SOC_DAPM_LINE("Line In Jack", NULL),
99 SND_SOC_DAPM_HP("Headphone Jack", NULL),
100 SND_SOC_DAPM_SPK("Line Out Jack", NULL),
101 SND_SOC_DAPM_SPK("Ext Spk", NULL),
102};
103
96static struct snd_soc_card mxs_sgtl5000 = { 104static struct snd_soc_card mxs_sgtl5000 = {
97 .name = "mxs_sgtl5000", 105 .name = "mxs_sgtl5000",
98 .owner = THIS_MODULE, 106 .owner = THIS_MODULE,
@@ -141,10 +149,23 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev)
141 149
142 card->dev = &pdev->dev; 150 card->dev = &pdev->dev;
143 151
152 if (of_find_property(np, "audio-routing", NULL)) {
153 card->dapm_widgets = mxs_sgtl5000_dapm_widgets;
154 card->num_dapm_widgets = ARRAY_SIZE(mxs_sgtl5000_dapm_widgets);
155
156 ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
157 if (ret) {
158 dev_err(&pdev->dev, "failed to parse audio-routing (%d)\n",
159 ret);
160 return ret;
161 }
162 }
163
144 ret = devm_snd_soc_register_card(&pdev->dev, card); 164 ret = devm_snd_soc_register_card(&pdev->dev, card);
145 if (ret) { 165 if (ret) {
146 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", 166 if (ret != -EPROBE_DEFER)
147 ret); 167 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
168 ret);
148 return ret; 169 return ret;
149 } 170 }
150 171
diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
index 7f43c9bf3d09..3d7e1ff79139 100644
--- a/sound/soc/soc-acpi.c
+++ b/sound/soc/soc-acpi.c
@@ -16,39 +16,6 @@
16 16
17#include <sound/soc-acpi.h> 17#include <sound/soc-acpi.h>
18 18
19static acpi_status snd_soc_acpi_find_name(acpi_handle handle, u32 level,
20 void *context, void **ret)
21{
22 struct acpi_device *adev;
23 const char *name = NULL;
24
25 if (acpi_bus_get_device(handle, &adev))
26 return AE_OK;
27
28 if (adev->status.present && adev->status.functional) {
29 name = acpi_dev_name(adev);
30 *(const char **)ret = name;
31 return AE_CTRL_TERMINATE;
32 }
33
34 return AE_OK;
35}
36
37const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
38{
39 const char *name = NULL;
40 acpi_status status;
41
42 status = acpi_get_devices(hid, snd_soc_acpi_find_name, NULL,
43 (void **)&name);
44
45 if (ACPI_FAILURE(status) || name[0] == '\0')
46 return NULL;
47
48 return name;
49}
50EXPORT_SYMBOL_GPL(snd_soc_acpi_find_name_from_hid);
51
52struct snd_soc_acpi_mach * 19struct snd_soc_acpi_mach *
53snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines) 20snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
54{ 21{
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d1f7e639d5b1..e91879569a0f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -349,120 +349,84 @@ static void soc_init_codec_debugfs(struct snd_soc_component *component)
349 "ASoC: Failed to create codec register debugfs file\n"); 349 "ASoC: Failed to create codec register debugfs file\n");
350} 350}
351 351
352static ssize_t codec_list_read_file(struct file *file, char __user *user_buf, 352static int codec_list_seq_show(struct seq_file *m, void *v)
353 size_t count, loff_t *ppos)
354{ 353{
355 char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
356 ssize_t len, ret = 0;
357 struct snd_soc_codec *codec; 354 struct snd_soc_codec *codec;
358 355
359 if (!buf)
360 return -ENOMEM;
361
362 mutex_lock(&client_mutex); 356 mutex_lock(&client_mutex);
363 357
364 list_for_each_entry(codec, &codec_list, list) { 358 list_for_each_entry(codec, &codec_list, list)
365 len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", 359 seq_printf(m, "%s\n", codec->component.name);
366 codec->component.name);
367 if (len >= 0)
368 ret += len;
369 if (ret > PAGE_SIZE) {
370 ret = PAGE_SIZE;
371 break;
372 }
373 }
374 360
375 mutex_unlock(&client_mutex); 361 mutex_unlock(&client_mutex);
376 362
377 if (ret >= 0) 363 return 0;
378 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); 364}
379
380 kfree(buf);
381 365
382 return ret; 366static int codec_list_seq_open(struct inode *inode, struct file *file)
367{
368 return single_open(file, codec_list_seq_show, NULL);
383} 369}
384 370
385static const struct file_operations codec_list_fops = { 371static const struct file_operations codec_list_fops = {
386 .read = codec_list_read_file, 372 .open = codec_list_seq_open,
387 .llseek = default_llseek,/* read accesses f_pos */ 373 .read = seq_read,
374 .llseek = seq_lseek,
375 .release = single_release,
388}; 376};
389 377
390static ssize_t dai_list_read_file(struct file *file, char __user *user_buf, 378static int dai_list_seq_show(struct seq_file *m, void *v)
391 size_t count, loff_t *ppos)
392{ 379{
393 char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
394 ssize_t len, ret = 0;
395 struct snd_soc_component *component; 380 struct snd_soc_component *component;
396 struct snd_soc_dai *dai; 381 struct snd_soc_dai *dai;
397 382
398 if (!buf)
399 return -ENOMEM;
400
401 mutex_lock(&client_mutex); 383 mutex_lock(&client_mutex);
402 384
403 list_for_each_entry(component, &component_list, list) { 385 list_for_each_entry(component, &component_list, list)
404 list_for_each_entry(dai, &component->dai_list, list) { 386 list_for_each_entry(dai, &component->dai_list, list)
405 len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", 387 seq_printf(m, "%s\n", dai->name);
406 dai->name);
407 if (len >= 0)
408 ret += len;
409 if (ret > PAGE_SIZE) {
410 ret = PAGE_SIZE;
411 break;
412 }
413 }
414 }
415 388
416 mutex_unlock(&client_mutex); 389 mutex_unlock(&client_mutex);
417 390
418 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); 391 return 0;
419 392}
420 kfree(buf);
421 393
422 return ret; 394static int dai_list_seq_open(struct inode *inode, struct file *file)
395{
396 return single_open(file, dai_list_seq_show, NULL);
423} 397}
424 398
425static const struct file_operations dai_list_fops = { 399static const struct file_operations dai_list_fops = {
426 .read = dai_list_read_file, 400 .open = dai_list_seq_open,
427 .llseek = default_llseek,/* read accesses f_pos */ 401 .read = seq_read,
402 .llseek = seq_lseek,
403 .release = single_release,
428}; 404};
429 405
430static ssize_t platform_list_read_file(struct file *file, 406static int platform_list_seq_show(struct seq_file *m, void *v)
431 char __user *user_buf,
432 size_t count, loff_t *ppos)
433{ 407{
434 char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
435 ssize_t len, ret = 0;
436 struct snd_soc_platform *platform; 408 struct snd_soc_platform *platform;
437 409
438 if (!buf)
439 return -ENOMEM;
440
441 mutex_lock(&client_mutex); 410 mutex_lock(&client_mutex);
442 411
443 list_for_each_entry(platform, &platform_list, list) { 412 list_for_each_entry(platform, &platform_list, list)
444 len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", 413 seq_printf(m, "%s\n", platform->component.name);
445 platform->component.name);
446 if (len >= 0)
447 ret += len;
448 if (ret > PAGE_SIZE) {
449 ret = PAGE_SIZE;
450 break;
451 }
452 }
453 414
454 mutex_unlock(&client_mutex); 415 mutex_unlock(&client_mutex);
455 416
456 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); 417 return 0;
457 418}
458 kfree(buf);
459 419
460 return ret; 420static int platform_list_seq_open(struct inode *inode, struct file *file)
421{
422 return single_open(file, platform_list_seq_show, NULL);
461} 423}
462 424
463static const struct file_operations platform_list_fops = { 425static const struct file_operations platform_list_fops = {
464 .read = platform_list_read_file, 426 .open = platform_list_seq_open,
465 .llseek = default_llseek,/* read accesses f_pos */ 427 .read = seq_read,
428 .llseek = seq_lseek,
429 .release = single_release,
466}; 430};
467 431
468static void soc_init_card_debugfs(struct snd_soc_card *card) 432static void soc_init_card_debugfs(struct snd_soc_card *card)
@@ -491,7 +455,6 @@ static void soc_cleanup_card_debugfs(struct snd_soc_card *card)
491 debugfs_remove_recursive(card->debugfs_card_root); 455 debugfs_remove_recursive(card->debugfs_card_root);
492} 456}
493 457
494
495static void snd_soc_debugfs_init(void) 458static void snd_soc_debugfs_init(void)
496{ 459{
497 snd_soc_debugfs_root = debugfs_create_dir("asoc", NULL); 460 snd_soc_debugfs_root = debugfs_create_dir("asoc", NULL);
@@ -598,6 +561,7 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
598 561
599 return NULL; 562 return NULL;
600} 563}
564EXPORT_SYMBOL_GPL(snd_soc_rtdcom_lookup);
601 565
602struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, 566struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
603 const char *dai_link, int stream) 567 const char *dai_link, int stream)
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index 20340ade20a7..2bc1c4c17896 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -34,6 +34,10 @@ int snd_soc_component_read(struct snd_soc_component *component,
34 ret = regmap_read(component->regmap, reg, val); 34 ret = regmap_read(component->regmap, reg, val);
35 else if (component->read) 35 else if (component->read)
36 ret = component->read(component, reg, val); 36 ret = component->read(component, reg, val);
37 else if (component->driver->read) {
38 *val = component->driver->read(component, reg);
39 ret = 0;
40 }
37 else 41 else
38 ret = -EIO; 42 ret = -EIO;
39 43
@@ -70,6 +74,8 @@ int snd_soc_component_write(struct snd_soc_component *component,
70 return regmap_write(component->regmap, reg, val); 74 return regmap_write(component->regmap, reg, val);
71 else if (component->write) 75 else if (component->write)
72 return component->write(component, reg, val); 76 return component->write(component, reg, val);
77 else if (component->driver->write)
78 return component->driver->write(component, reg, val);
73 else 79 else
74 return -EIO; 80 return -EIO;
75} 81}