aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-02-12 12:42:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-02-12 12:42:05 -0500
commit0df34ad9b703222ead899465b054070758b317f1 (patch)
tree0a46cb63a914b14b1472cca6bef7eb9406a8d44f
parent14379cdc763dee2b92276ee15e9c1644df1f017a (diff)
parent86c2ee16704522a546c0ee1e8238096e3c391468 (diff)
Merge tag 'sound-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "In this rc, we've got more volume than previous rc, unsurprisingly; the majority of updates in ASoC are about Intel drivers, and another major changes are the continued plumbing of ALSA timer bugs revealed by syzkaller fuzzer. Hopefully both settle down now. Other than that, HD-audio received a couple of code fixes as well as the usual quirks, and various small fixes are found for FireWire devices, ASoC codecs and drivers" * tag 'sound-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (50 commits) ASoC: arizona: fref must be limited in pseudo-fractional mode ASoC: sigmadsp: Fix missleading return value ALSA: timer: Fix race at concurrent reads ALSA: firewire-digi00x: Drop bogus const type qualifier on dot_scrt() ALSA: hda - Fix bad dereference of jack object ALSA: timer: Fix race between stop and interrupt ALSA: timer: Fix wrong instance passed to slave callbacks ASoC: Intel: Add module tags for common match module ASoC: Intel: Load the atom DPCM driver only ASoC: Intel: Create independent acpi match module ASoC: Intel: Revert "ASoC: Intel: fix ACPI probe regression with Atom DPCM driver" ALSA: dummy: Implement timer backend switching more safely ALSA: hda - Fix speaker output from VAIO AiO machines Revert "ALSA: hda - Fix noise on Gigabyte Z170X mobo" ALSA: firewire-tascam: remove needless member for control and status message ALSA: firewire-tascam: remove a flag for controller ALSA: firewire-tascam: add support for FW-1804 ALSA: firewire-tascam: fix NULL pointer dereference when model identification fails ALSA: hda - Fix static checker warning in patch_hdmi.c ASoC: Intel: Skylake: Remove autosuspend delay ...
-rw-r--r--Documentation/devicetree/bindings/sound/fsl-asoc-card.txt2
-rw-r--r--sound/core/timer.c40
-rw-r--r--sound/drivers/dummy.c37
-rw-r--r--sound/firewire/digi00x/amdtp-dot.c2
-rw-r--r--sound/firewire/tascam/tascam-transaction.c6
-rw-r--r--sound/firewire/tascam/tascam.c12
-rw-r--r--sound/firewire/tascam/tascam.h4
-rw-r--r--sound/pci/hda/hda_generic.c4
-rw-r--r--sound/pci/hda/hda_jack.c2
-rw-r--r--sound/pci/hda/hda_jack.h2
-rw-r--r--sound/pci/hda/patch_ca0132.c5
-rw-r--r--sound/pci/hda/patch_hdmi.c5
-rw-r--r--sound/pci/hda/patch_realtek.c11
-rw-r--r--sound/pci/hda/patch_sigmatel.c6
-rw-r--r--sound/soc/amd/acp-pcm-dma.c1
-rw-r--r--sound/soc/codecs/arizona.c43
-rw-r--r--sound/soc/codecs/rt286.c26
-rw-r--r--sound/soc/codecs/rt5645.c2
-rw-r--r--sound/soc/codecs/rt5659.c31
-rw-r--r--sound/soc/codecs/rt5659.h1
-rw-r--r--sound/soc/codecs/sigmadsp-i2c.c5
-rw-r--r--sound/soc/codecs/wm5110.c1
-rw-r--r--sound/soc/codecs/wm8960.c40
-rw-r--r--sound/soc/dwc/designware_i2s.c5
-rw-r--r--sound/soc/fsl/fsl_ssi.c42
-rw-r--r--sound/soc/fsl/imx-spdif.c2
-rw-r--r--sound/soc/generic/simple-card.c2
-rw-r--r--sound/soc/intel/Kconfig13
-rw-r--r--sound/soc/intel/atom/sst-mfld-platform-pcm.c1
-rw-r--r--sound/soc/intel/boards/skl_rt286.c5
-rw-r--r--sound/soc/intel/common/Makefile9
-rw-r--r--sound/soc/intel/common/sst-acpi.c4
-rw-r--r--sound/soc/intel/common/sst-match-acpi.c3
-rw-r--r--sound/soc/intel/skylake/skl-messages.c6
-rw-r--r--sound/soc/intel/skylake/skl-pcm.c1
-rw-r--r--sound/soc/intel/skylake/skl-topology.c75
-rw-r--r--sound/soc/intel/skylake/skl.c2
-rw-r--r--sound/soc/mediatek/Kconfig4
-rw-r--r--sound/soc/mxs/mxs-saif.c13
-rw-r--r--sound/soc/qcom/lpass-platform.c15
-rw-r--r--sound/soc/soc-dapm.c8
-rw-r--r--sound/soc/soc-pcm.c3
42 files changed, 292 insertions, 209 deletions
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
index ce55c0a6f757..4da41bf1888e 100644
--- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
+++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
@@ -30,6 +30,8 @@ The compatible list for this generic sound card currently:
30 "fsl,imx-audio-sgtl5000" 30 "fsl,imx-audio-sgtl5000"
31 (compatible with Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt) 31 (compatible with Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt)
32 32
33 "fsl,imx-audio-wm8960"
34
33Required properties: 35Required properties:
34 36
35 - compatible : Contains one of entries in the compatible list. 37 - compatible : Contains one of entries in the compatible list.
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 9b513a05765a..dca817fc7894 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -422,7 +422,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
422 spin_lock_irqsave(&timer->lock, flags); 422 spin_lock_irqsave(&timer->lock, flags);
423 list_for_each_entry(ts, &ti->slave_active_head, active_list) 423 list_for_each_entry(ts, &ti->slave_active_head, active_list)
424 if (ts->ccallback) 424 if (ts->ccallback)
425 ts->ccallback(ti, event + 100, &tstamp, resolution); 425 ts->ccallback(ts, event + 100, &tstamp, resolution);
426 spin_unlock_irqrestore(&timer->lock, flags); 426 spin_unlock_irqrestore(&timer->lock, flags);
427} 427}
428 428
@@ -518,9 +518,13 @@ static int _snd_timer_stop(struct snd_timer_instance *timeri, int event)
518 spin_unlock_irqrestore(&slave_active_lock, flags); 518 spin_unlock_irqrestore(&slave_active_lock, flags);
519 return -EBUSY; 519 return -EBUSY;
520 } 520 }
521 if (timeri->timer)
522 spin_lock(&timeri->timer->lock);
521 timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; 523 timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
522 list_del_init(&timeri->ack_list); 524 list_del_init(&timeri->ack_list);
523 list_del_init(&timeri->active_list); 525 list_del_init(&timeri->active_list);
526 if (timeri->timer)
527 spin_unlock(&timeri->timer->lock);
524 spin_unlock_irqrestore(&slave_active_lock, flags); 528 spin_unlock_irqrestore(&slave_active_lock, flags);
525 goto __end; 529 goto __end;
526 } 530 }
@@ -1929,6 +1933,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1929{ 1933{
1930 struct snd_timer_user *tu; 1934 struct snd_timer_user *tu;
1931 long result = 0, unit; 1935 long result = 0, unit;
1936 int qhead;
1932 int err = 0; 1937 int err = 0;
1933 1938
1934 tu = file->private_data; 1939 tu = file->private_data;
@@ -1940,7 +1945,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1940 1945
1941 if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) { 1946 if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) {
1942 err = -EAGAIN; 1947 err = -EAGAIN;
1943 break; 1948 goto _error;
1944 } 1949 }
1945 1950
1946 set_current_state(TASK_INTERRUPTIBLE); 1951 set_current_state(TASK_INTERRUPTIBLE);
@@ -1955,42 +1960,37 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1955 1960
1956 if (tu->disconnected) { 1961 if (tu->disconnected) {
1957 err = -ENODEV; 1962 err = -ENODEV;
1958 break; 1963 goto _error;
1959 } 1964 }
1960 if (signal_pending(current)) { 1965 if (signal_pending(current)) {
1961 err = -ERESTARTSYS; 1966 err = -ERESTARTSYS;
1962 break; 1967 goto _error;
1963 } 1968 }
1964 } 1969 }
1965 1970
1971 qhead = tu->qhead++;
1972 tu->qhead %= tu->queue_size;
1966 spin_unlock_irq(&tu->qlock); 1973 spin_unlock_irq(&tu->qlock);
1967 if (err < 0)
1968 goto _error;
1969 1974
1970 if (tu->tread) { 1975 if (tu->tread) {
1971 if (copy_to_user(buffer, &tu->tqueue[tu->qhead++], 1976 if (copy_to_user(buffer, &tu->tqueue[qhead],
1972 sizeof(struct snd_timer_tread))) { 1977 sizeof(struct snd_timer_tread)))
1973 err = -EFAULT; 1978 err = -EFAULT;
1974 goto _error;
1975 }
1976 } else { 1979 } else {
1977 if (copy_to_user(buffer, &tu->queue[tu->qhead++], 1980 if (copy_to_user(buffer, &tu->queue[qhead],
1978 sizeof(struct snd_timer_read))) { 1981 sizeof(struct snd_timer_read)))
1979 err = -EFAULT; 1982 err = -EFAULT;
1980 goto _error;
1981 }
1982 } 1983 }
1983 1984
1984 tu->qhead %= tu->queue_size;
1985
1986 result += unit;
1987 buffer += unit;
1988
1989 spin_lock_irq(&tu->qlock); 1985 spin_lock_irq(&tu->qlock);
1990 tu->qused--; 1986 tu->qused--;
1987 if (err < 0)
1988 goto _error;
1989 result += unit;
1990 buffer += unit;
1991 } 1991 }
1992 spin_unlock_irq(&tu->qlock);
1993 _error: 1992 _error:
1993 spin_unlock_irq(&tu->qlock);
1994 return result > 0 ? result : err; 1994 return result > 0 ? result : err;
1995} 1995}
1996 1996
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index bde33308f0d6..c0f8f613f1f1 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -87,7 +87,7 @@ MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-128) for dummy driver.");
87module_param(fake_buffer, bool, 0444); 87module_param(fake_buffer, bool, 0444);
88MODULE_PARM_DESC(fake_buffer, "Fake buffer allocations."); 88MODULE_PARM_DESC(fake_buffer, "Fake buffer allocations.");
89#ifdef CONFIG_HIGH_RES_TIMERS 89#ifdef CONFIG_HIGH_RES_TIMERS
90module_param(hrtimer, bool, 0444); 90module_param(hrtimer, bool, 0644);
91MODULE_PARM_DESC(hrtimer, "Use hrtimer as the timer source."); 91MODULE_PARM_DESC(hrtimer, "Use hrtimer as the timer source.");
92#endif 92#endif
93 93
@@ -109,6 +109,9 @@ struct dummy_timer_ops {
109 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *); 109 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *);
110}; 110};
111 111
112#define get_dummy_ops(substream) \
113 (*(const struct dummy_timer_ops **)(substream)->runtime->private_data)
114
112struct dummy_model { 115struct dummy_model {
113 const char *name; 116 const char *name;
114 int (*playback_constraints)(struct snd_pcm_runtime *runtime); 117 int (*playback_constraints)(struct snd_pcm_runtime *runtime);
@@ -137,7 +140,6 @@ struct snd_dummy {
137 int iobox; 140 int iobox;
138 struct snd_kcontrol *cd_volume_ctl; 141 struct snd_kcontrol *cd_volume_ctl;
139 struct snd_kcontrol *cd_switch_ctl; 142 struct snd_kcontrol *cd_switch_ctl;
140 const struct dummy_timer_ops *timer_ops;
141}; 143};
142 144
143/* 145/*
@@ -231,6 +233,8 @@ static struct dummy_model *dummy_models[] = {
231 */ 233 */
232 234
233struct dummy_systimer_pcm { 235struct dummy_systimer_pcm {
236 /* ops must be the first item */
237 const struct dummy_timer_ops *timer_ops;
234 spinlock_t lock; 238 spinlock_t lock;
235 struct timer_list timer; 239 struct timer_list timer;
236 unsigned long base_time; 240 unsigned long base_time;
@@ -366,6 +370,8 @@ static const struct dummy_timer_ops dummy_systimer_ops = {
366 */ 370 */
367 371
368struct dummy_hrtimer_pcm { 372struct dummy_hrtimer_pcm {
373 /* ops must be the first item */
374 const struct dummy_timer_ops *timer_ops;
369 ktime_t base_time; 375 ktime_t base_time;
370 ktime_t period_time; 376 ktime_t period_time;
371 atomic_t running; 377 atomic_t running;
@@ -492,31 +498,25 @@ static const struct dummy_timer_ops dummy_hrtimer_ops = {
492 498
493static int dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd) 499static int dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
494{ 500{
495 struct snd_dummy *dummy = snd_pcm_substream_chip(substream);
496
497 switch (cmd) { 501 switch (cmd) {
498 case SNDRV_PCM_TRIGGER_START: 502 case SNDRV_PCM_TRIGGER_START:
499 case SNDRV_PCM_TRIGGER_RESUME: 503 case SNDRV_PCM_TRIGGER_RESUME:
500 return dummy->timer_ops->start(substream); 504 return get_dummy_ops(substream)->start(substream);
501 case SNDRV_PCM_TRIGGER_STOP: 505 case SNDRV_PCM_TRIGGER_STOP:
502 case SNDRV_PCM_TRIGGER_SUSPEND: 506 case SNDRV_PCM_TRIGGER_SUSPEND:
503 return dummy->timer_ops->stop(substream); 507 return get_dummy_ops(substream)->stop(substream);
504 } 508 }
505 return -EINVAL; 509 return -EINVAL;
506} 510}
507 511
508static int dummy_pcm_prepare(struct snd_pcm_substream *substream) 512static int dummy_pcm_prepare(struct snd_pcm_substream *substream)
509{ 513{
510 struct snd_dummy *dummy = snd_pcm_substream_chip(substream); 514 return get_dummy_ops(substream)->prepare(substream);
511
512 return dummy->timer_ops->prepare(substream);
513} 515}
514 516
515static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream) 517static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream)
516{ 518{
517 struct snd_dummy *dummy = snd_pcm_substream_chip(substream); 519 return get_dummy_ops(substream)->pointer(substream);
518
519 return dummy->timer_ops->pointer(substream);
520} 520}
521 521
522static struct snd_pcm_hardware dummy_pcm_hardware = { 522static struct snd_pcm_hardware dummy_pcm_hardware = {
@@ -562,17 +562,19 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream)
562 struct snd_dummy *dummy = snd_pcm_substream_chip(substream); 562 struct snd_dummy *dummy = snd_pcm_substream_chip(substream);
563 struct dummy_model *model = dummy->model; 563 struct dummy_model *model = dummy->model;
564 struct snd_pcm_runtime *runtime = substream->runtime; 564 struct snd_pcm_runtime *runtime = substream->runtime;
565 const struct dummy_timer_ops *ops;
565 int err; 566 int err;
566 567
567 dummy->timer_ops = &dummy_systimer_ops; 568 ops = &dummy_systimer_ops;
568#ifdef CONFIG_HIGH_RES_TIMERS 569#ifdef CONFIG_HIGH_RES_TIMERS
569 if (hrtimer) 570 if (hrtimer)
570 dummy->timer_ops = &dummy_hrtimer_ops; 571 ops = &dummy_hrtimer_ops;
571#endif 572#endif
572 573
573 err = dummy->timer_ops->create(substream); 574 err = ops->create(substream);
574 if (err < 0) 575 if (err < 0)
575 return err; 576 return err;
577 get_dummy_ops(substream) = ops;
576 578
577 runtime->hw = dummy->pcm_hw; 579 runtime->hw = dummy->pcm_hw;
578 if (substream->pcm->device & 1) { 580 if (substream->pcm->device & 1) {
@@ -594,7 +596,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream)
594 err = model->capture_constraints(substream->runtime); 596 err = model->capture_constraints(substream->runtime);
595 } 597 }
596 if (err < 0) { 598 if (err < 0) {
597 dummy->timer_ops->free(substream); 599 get_dummy_ops(substream)->free(substream);
598 return err; 600 return err;
599 } 601 }
600 return 0; 602 return 0;
@@ -602,8 +604,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream)
602 604
603static int dummy_pcm_close(struct snd_pcm_substream *substream) 605static int dummy_pcm_close(struct snd_pcm_substream *substream)
604{ 606{
605 struct snd_dummy *dummy = snd_pcm_substream_chip(substream); 607 get_dummy_ops(substream)->free(substream);
606 dummy->timer_ops->free(substream);
607 return 0; 608 return 0;
608} 609}
609 610
diff --git a/sound/firewire/digi00x/amdtp-dot.c b/sound/firewire/digi00x/amdtp-dot.c
index b02a5e8cad44..0ac92aba5bc1 100644
--- a/sound/firewire/digi00x/amdtp-dot.c
+++ b/sound/firewire/digi00x/amdtp-dot.c
@@ -63,7 +63,7 @@ struct amdtp_dot {
63#define BYTE_PER_SAMPLE (4) 63#define BYTE_PER_SAMPLE (4)
64#define MAGIC_DOT_BYTE (2) 64#define MAGIC_DOT_BYTE (2)
65#define MAGIC_BYTE_OFF(x) (((x) * BYTE_PER_SAMPLE) + MAGIC_DOT_BYTE) 65#define MAGIC_BYTE_OFF(x) (((x) * BYTE_PER_SAMPLE) + MAGIC_DOT_BYTE)
66static const u8 dot_scrt(const u8 idx, const unsigned int off) 66static u8 dot_scrt(const u8 idx, const unsigned int off)
67{ 67{
68 /* 68 /*
69 * the length of the added pattern only depends on the lower nibble 69 * the length of the added pattern only depends on the lower nibble
diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c
index 904ce0329fa1..040a96d1ba8e 100644
--- a/sound/firewire/tascam/tascam-transaction.c
+++ b/sound/firewire/tascam/tascam-transaction.c
@@ -230,6 +230,7 @@ int snd_tscm_transaction_register(struct snd_tscm *tscm)
230 return err; 230 return err;
231error: 231error:
232 fw_core_remove_address_handler(&tscm->async_handler); 232 fw_core_remove_address_handler(&tscm->async_handler);
233 tscm->async_handler.callback_data = NULL;
233 return err; 234 return err;
234} 235}
235 236
@@ -276,6 +277,9 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm)
276 __be32 reg; 277 __be32 reg;
277 unsigned int i; 278 unsigned int i;
278 279
280 if (tscm->async_handler.callback_data == NULL)
281 return;
282
279 /* Turn off FireWire LED. */ 283 /* Turn off FireWire LED. */
280 reg = cpu_to_be32(0x0000008e); 284 reg = cpu_to_be32(0x0000008e);
281 snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST, 285 snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST,
@@ -297,6 +301,8 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm)
297 &reg, sizeof(reg), 0); 301 &reg, sizeof(reg), 0);
298 302
299 fw_core_remove_address_handler(&tscm->async_handler); 303 fw_core_remove_address_handler(&tscm->async_handler);
304 tscm->async_handler.callback_data = NULL;
305
300 for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++) 306 for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++)
301 snd_fw_async_midi_port_destroy(&tscm->out_ports[i]); 307 snd_fw_async_midi_port_destroy(&tscm->out_ports[i]);
302} 308}
diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
index ee0bc1839508..e281c338e562 100644
--- a/sound/firewire/tascam/tascam.c
+++ b/sound/firewire/tascam/tascam.c
@@ -21,7 +21,6 @@ static struct snd_tscm_spec model_specs[] = {
21 .pcm_playback_analog_channels = 8, 21 .pcm_playback_analog_channels = 8,
22 .midi_capture_ports = 4, 22 .midi_capture_ports = 4,
23 .midi_playback_ports = 4, 23 .midi_playback_ports = 4,
24 .is_controller = true,
25 }, 24 },
26 { 25 {
27 .name = "FW-1082", 26 .name = "FW-1082",
@@ -31,9 +30,16 @@ static struct snd_tscm_spec model_specs[] = {
31 .pcm_playback_analog_channels = 2, 30 .pcm_playback_analog_channels = 2,
32 .midi_capture_ports = 2, 31 .midi_capture_ports = 2,
33 .midi_playback_ports = 2, 32 .midi_playback_ports = 2,
34 .is_controller = true,
35 }, 33 },
36 /* FW-1804 may be supported. */ 34 {
35 .name = "FW-1804",
36 .has_adat = true,
37 .has_spdif = true,
38 .pcm_capture_analog_channels = 8,
39 .pcm_playback_analog_channels = 2,
40 .midi_capture_ports = 2,
41 .midi_playback_ports = 4,
42 },
37}; 43};
38 44
39static int identify_model(struct snd_tscm *tscm) 45static int identify_model(struct snd_tscm *tscm)
diff --git a/sound/firewire/tascam/tascam.h b/sound/firewire/tascam/tascam.h
index 2d028d2bd3bd..30ab77e924f7 100644
--- a/sound/firewire/tascam/tascam.h
+++ b/sound/firewire/tascam/tascam.h
@@ -39,7 +39,6 @@ struct snd_tscm_spec {
39 unsigned int pcm_playback_analog_channels; 39 unsigned int pcm_playback_analog_channels;
40 unsigned int midi_capture_ports; 40 unsigned int midi_capture_ports;
41 unsigned int midi_playback_ports; 41 unsigned int midi_playback_ports;
42 bool is_controller;
43}; 42};
44 43
45#define TSCM_MIDI_IN_PORT_MAX 4 44#define TSCM_MIDI_IN_PORT_MAX 4
@@ -72,9 +71,6 @@ struct snd_tscm {
72 struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX]; 71 struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX];
73 u8 running_status[TSCM_MIDI_OUT_PORT_MAX]; 72 u8 running_status[TSCM_MIDI_OUT_PORT_MAX];
74 bool on_sysex[TSCM_MIDI_OUT_PORT_MAX]; 73 bool on_sysex[TSCM_MIDI_OUT_PORT_MAX];
75
76 /* For control messages. */
77 struct snd_firewire_tascam_status *status;
78}; 74};
79 75
80#define TSCM_ADDR_BASE 0xffff00000000ull 76#define TSCM_ADDR_BASE 0xffff00000000ull
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 30c8efe0f80a..7ca5b89f088a 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -4028,9 +4028,9 @@ static void pin_power_callback(struct hda_codec *codec,
4028 struct hda_jack_callback *jack, 4028 struct hda_jack_callback *jack,
4029 bool on) 4029 bool on)
4030{ 4030{
4031 if (jack && jack->tbl->nid) 4031 if (jack && jack->nid)
4032 sync_power_state_change(codec, 4032 sync_power_state_change(codec,
4033 set_pin_power_jack(codec, jack->tbl->nid, on)); 4033 set_pin_power_jack(codec, jack->nid, on));
4034} 4034}
4035 4035
4036/* callback only doing power up -- called at first */ 4036/* callback only doing power up -- called at first */
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
index c945e257d368..a33234e04d4f 100644
--- a/sound/pci/hda/hda_jack.c
+++ b/sound/pci/hda/hda_jack.c
@@ -259,7 +259,7 @@ snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
259 if (!callback) 259 if (!callback)
260 return ERR_PTR(-ENOMEM); 260 return ERR_PTR(-ENOMEM);
261 callback->func = func; 261 callback->func = func;
262 callback->tbl = jack; 262 callback->nid = jack->nid;
263 callback->next = jack->callback; 263 callback->next = jack->callback;
264 jack->callback = callback; 264 jack->callback = callback;
265 } 265 }
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
index 858708a044f5..e9814c0168ea 100644
--- a/sound/pci/hda/hda_jack.h
+++ b/sound/pci/hda/hda_jack.h
@@ -21,7 +21,7 @@ struct hda_jack_callback;
21typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callback *); 21typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callback *);
22 22
23struct hda_jack_callback { 23struct hda_jack_callback {
24 struct hda_jack_tbl *tbl; 24 hda_nid_t nid;
25 hda_jack_callback_fn func; 25 hda_jack_callback_fn func;
26 unsigned int private_data; /* arbitrary data */ 26 unsigned int private_data; /* arbitrary data */
27 struct hda_jack_callback *next; 27 struct hda_jack_callback *next;
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 4ef2259f88ca..9ceb2bc36e68 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -4427,13 +4427,16 @@ static void ca0132_process_dsp_response(struct hda_codec *codec,
4427static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) 4427static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb)
4428{ 4428{
4429 struct ca0132_spec *spec = codec->spec; 4429 struct ca0132_spec *spec = codec->spec;
4430 struct hda_jack_tbl *tbl;
4430 4431
4431 /* Delay enabling the HP amp, to let the mic-detection 4432 /* Delay enabling the HP amp, to let the mic-detection
4432 * state machine run. 4433 * state machine run.
4433 */ 4434 */
4434 cancel_delayed_work_sync(&spec->unsol_hp_work); 4435 cancel_delayed_work_sync(&spec->unsol_hp_work);
4435 schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); 4436 schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500));
4436 cb->tbl->block_report = 1; 4437 tbl = snd_hda_jack_tbl_get(codec, cb->nid);
4438 if (tbl)
4439 tbl->block_report = 1;
4437} 4440}
4438 4441
4439static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb) 4442static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 1f52b55d77c9..8ee78dbd4c60 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -448,7 +448,8 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
448 eld = &per_pin->sink_eld; 448 eld = &per_pin->sink_eld;
449 449
450 mutex_lock(&per_pin->lock); 450 mutex_lock(&per_pin->lock);
451 if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data)) { 451 if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) ||
452 eld->eld_size > ELD_MAX_SIZE) {
452 mutex_unlock(&per_pin->lock); 453 mutex_unlock(&per_pin->lock);
453 snd_BUG(); 454 snd_BUG();
454 return -EINVAL; 455 return -EINVAL;
@@ -1193,7 +1194,7 @@ static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid)
1193static void jack_callback(struct hda_codec *codec, 1194static void jack_callback(struct hda_codec *codec,
1194 struct hda_jack_callback *jack) 1195 struct hda_jack_callback *jack)
1195{ 1196{
1196 check_presence_and_report(codec, jack->tbl->nid); 1197 check_presence_and_report(codec, jack->nid);
1197} 1198}
1198 1199
1199static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) 1200static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 21992fb7035d..efd4980cffb8 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -282,7 +282,7 @@ static void alc_update_knob_master(struct hda_codec *codec,
282 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 282 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
283 if (!uctl) 283 if (!uctl)
284 return; 284 return;
285 val = snd_hda_codec_read(codec, jack->tbl->nid, 0, 285 val = snd_hda_codec_read(codec, jack->nid, 0,
286 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); 286 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
287 val &= HDA_AMP_VOLMASK; 287 val &= HDA_AMP_VOLMASK;
288 uctl->value.integer.value[0] = val; 288 uctl->value.integer.value[0] = val;
@@ -1787,7 +1787,6 @@ enum {
1787 ALC882_FIXUP_NO_PRIMARY_HP, 1787 ALC882_FIXUP_NO_PRIMARY_HP,
1788 ALC887_FIXUP_ASUS_BASS, 1788 ALC887_FIXUP_ASUS_BASS,
1789 ALC887_FIXUP_BASS_CHMAP, 1789 ALC887_FIXUP_BASS_CHMAP,
1790 ALC882_FIXUP_DISABLE_AAMIX,
1791}; 1790};
1792 1791
1793static void alc889_fixup_coef(struct hda_codec *codec, 1792static void alc889_fixup_coef(struct hda_codec *codec,
@@ -1949,8 +1948,6 @@ static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1949 1948
1950static void alc_fixup_bass_chmap(struct hda_codec *codec, 1949static void alc_fixup_bass_chmap(struct hda_codec *codec,
1951 const struct hda_fixup *fix, int action); 1950 const struct hda_fixup *fix, int action);
1952static void alc_fixup_disable_aamix(struct hda_codec *codec,
1953 const struct hda_fixup *fix, int action);
1954 1951
1955static const struct hda_fixup alc882_fixups[] = { 1952static const struct hda_fixup alc882_fixups[] = {
1956 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 1953 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
@@ -2188,10 +2185,6 @@ static const struct hda_fixup alc882_fixups[] = {
2188 .type = HDA_FIXUP_FUNC, 2185 .type = HDA_FIXUP_FUNC,
2189 .v.func = alc_fixup_bass_chmap, 2186 .v.func = alc_fixup_bass_chmap,
2190 }, 2187 },
2191 [ALC882_FIXUP_DISABLE_AAMIX] = {
2192 .type = HDA_FIXUP_FUNC,
2193 .v.func = alc_fixup_disable_aamix,
2194 },
2195}; 2188};
2196 2189
2197static const struct snd_pci_quirk alc882_fixup_tbl[] = { 2190static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2230,6 +2223,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2230 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), 2223 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2231 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), 2224 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2232 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), 2225 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2226 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2233 2227
2234 /* All Apple entries are in codec SSIDs */ 2228 /* All Apple entries are in codec SSIDs */
2235 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), 2229 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
@@ -2259,7 +2253,6 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2259 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), 2253 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2260 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), 2254 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2261 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), 2255 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2262 SND_PCI_QUIRK(0x1458, 0xa182, "Gigabyte Z170X-UD3", ALC882_FIXUP_DISABLE_AAMIX),
2263 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), 2256 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2264 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), 2257 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2265 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), 2258 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 2c7c5eb8b1e9..37b70f8e878f 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -493,9 +493,9 @@ static void jack_update_power(struct hda_codec *codec,
493 if (!spec->num_pwrs) 493 if (!spec->num_pwrs)
494 return; 494 return;
495 495
496 if (jack && jack->tbl->nid) { 496 if (jack && jack->nid) {
497 stac_toggle_power_map(codec, jack->tbl->nid, 497 stac_toggle_power_map(codec, jack->nid,
498 snd_hda_jack_detect(codec, jack->tbl->nid), 498 snd_hda_jack_detect(codec, jack->nid),
499 true); 499 true);
500 return; 500 return;
501 } 501 }
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index 3191e0a7d273..d1fb035f44db 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -635,6 +635,7 @@ static int acp_dma_open(struct snd_pcm_substream *substream)
635 SNDRV_PCM_HW_PARAM_PERIODS); 635 SNDRV_PCM_HW_PARAM_PERIODS);
636 if (ret < 0) { 636 if (ret < 0) {
637 dev_err(prtd->platform->dev, "set integer constraint failed\n"); 637 dev_err(prtd->platform->dev, "set integer constraint failed\n");
638 kfree(adata);
638 return ret; 639 return ret;
639 } 640 }
640 641
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 33143fe1de0b..91785318b283 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1929,6 +1929,25 @@ static struct {
1929 { 1000000, 13500000, 0, 1 }, 1929 { 1000000, 13500000, 0, 1 },
1930}; 1930};
1931 1931
1932static const unsigned int pseudo_fref_max[ARIZONA_FLL_MAX_FRATIO] = {
1933 13500000,
1934 6144000,
1935 6144000,
1936 3072000,
1937 3072000,
1938 2822400,
1939 2822400,
1940 1536000,
1941 1536000,
1942 1536000,
1943 1536000,
1944 1536000,
1945 1536000,
1946 1536000,
1947 1536000,
1948 768000,
1949};
1950
1932static struct { 1951static struct {
1933 unsigned int min; 1952 unsigned int min;
1934 unsigned int max; 1953 unsigned int max;
@@ -2042,16 +2061,32 @@ static int arizona_calc_fratio(struct arizona_fll *fll,
2042 /* Adjust FRATIO/refdiv to avoid integer mode if possible */ 2061 /* Adjust FRATIO/refdiv to avoid integer mode if possible */
2043 refdiv = cfg->refdiv; 2062 refdiv = cfg->refdiv;
2044 2063
2064 arizona_fll_dbg(fll, "pseudo: initial ratio=%u fref=%u refdiv=%u\n",
2065 init_ratio, Fref, refdiv);
2066
2045 while (div <= ARIZONA_FLL_MAX_REFDIV) { 2067 while (div <= ARIZONA_FLL_MAX_REFDIV) {
2046 for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO; 2068 for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO;
2047 ratio++) { 2069 ratio++) {
2048 if ((ARIZONA_FLL_VCO_CORNER / 2) / 2070 if ((ARIZONA_FLL_VCO_CORNER / 2) /
2049 (fll->vco_mult * ratio) < Fref) 2071 (fll->vco_mult * ratio) < Fref) {
2072 arizona_fll_dbg(fll, "pseudo: hit VCO corner\n");
2050 break; 2073 break;
2074 }
2075
2076 if (Fref > pseudo_fref_max[ratio - 1]) {
2077 arizona_fll_dbg(fll,
2078 "pseudo: exceeded max fref(%u) for ratio=%u\n",
2079 pseudo_fref_max[ratio - 1],
2080 ratio);
2081 break;
2082 }
2051 2083
2052 if (target % (ratio * Fref)) { 2084 if (target % (ratio * Fref)) {
2053 cfg->refdiv = refdiv; 2085 cfg->refdiv = refdiv;
2054 cfg->fratio = ratio - 1; 2086 cfg->fratio = ratio - 1;
2087 arizona_fll_dbg(fll,
2088 "pseudo: found fref=%u refdiv=%d(%d) ratio=%d\n",
2089 Fref, refdiv, div, ratio);
2055 return ratio; 2090 return ratio;
2056 } 2091 }
2057 } 2092 }
@@ -2060,6 +2095,9 @@ static int arizona_calc_fratio(struct arizona_fll *fll,
2060 if (target % (ratio * Fref)) { 2095 if (target % (ratio * Fref)) {
2061 cfg->refdiv = refdiv; 2096 cfg->refdiv = refdiv;
2062 cfg->fratio = ratio - 1; 2097 cfg->fratio = ratio - 1;
2098 arizona_fll_dbg(fll,
2099 "pseudo: found fref=%u refdiv=%d(%d) ratio=%d\n",
2100 Fref, refdiv, div, ratio);
2063 return ratio; 2101 return ratio;
2064 } 2102 }
2065 } 2103 }
@@ -2068,6 +2106,9 @@ static int arizona_calc_fratio(struct arizona_fll *fll,
2068 Fref /= 2; 2106 Fref /= 2;
2069 refdiv++; 2107 refdiv++;
2070 init_ratio = arizona_find_fratio(Fref, NULL); 2108 init_ratio = arizona_find_fratio(Fref, NULL);
2109 arizona_fll_dbg(fll,
2110 "pseudo: change fref=%u refdiv=%d(%d) ratio=%u\n",
2111 Fref, refdiv, div, init_ratio);
2071 } 2112 }
2072 2113
2073 arizona_fll_warn(fll, "Falling back to integer mode operation\n"); 2114 arizona_fll_warn(fll, "Falling back to integer mode operation\n");
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index bc08f0c5a5f6..1bd31644a782 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -266,6 +266,8 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic)
266 } else { 266 } else {
267 *mic = false; 267 *mic = false;
268 regmap_write(rt286->regmap, RT286_SET_MIC1, 0x20); 268 regmap_write(rt286->regmap, RT286_SET_MIC1, 0x20);
269 regmap_update_bits(rt286->regmap,
270 RT286_CBJ_CTRL1, 0x0400, 0x0000);
269 } 271 }
270 } else { 272 } else {
271 regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); 273 regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf);
@@ -470,24 +472,6 @@ static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w,
470 return 0; 472 return 0;
471} 473}
472 474
473static int rt286_vref_event(struct snd_soc_dapm_widget *w,
474 struct snd_kcontrol *kcontrol, int event)
475{
476 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
477
478 switch (event) {
479 case SND_SOC_DAPM_PRE_PMU:
480 snd_soc_update_bits(codec,
481 RT286_CBJ_CTRL1, 0x0400, 0x0000);
482 mdelay(50);
483 break;
484 default:
485 return 0;
486 }
487
488 return 0;
489}
490
491static int rt286_ldo2_event(struct snd_soc_dapm_widget *w, 475static int rt286_ldo2_event(struct snd_soc_dapm_widget *w,
492 struct snd_kcontrol *kcontrol, int event) 476 struct snd_kcontrol *kcontrol, int event)
493{ 477{
@@ -536,7 +520,7 @@ static const struct snd_soc_dapm_widget rt286_dapm_widgets[] = {
536 SND_SOC_DAPM_SUPPLY_S("HV", 1, RT286_POWER_CTRL1, 520 SND_SOC_DAPM_SUPPLY_S("HV", 1, RT286_POWER_CTRL1,
537 12, 1, NULL, 0), 521 12, 1, NULL, 0),
538 SND_SOC_DAPM_SUPPLY("VREF", RT286_POWER_CTRL1, 522 SND_SOC_DAPM_SUPPLY("VREF", RT286_POWER_CTRL1,
539 0, 1, rt286_vref_event, SND_SOC_DAPM_PRE_PMU), 523 0, 1, NULL, 0),
540 SND_SOC_DAPM_SUPPLY_S("LDO1", 1, RT286_POWER_CTRL2, 524 SND_SOC_DAPM_SUPPLY_S("LDO1", 1, RT286_POWER_CTRL2,
541 2, 0, NULL, 0), 525 2, 0, NULL, 0),
542 SND_SOC_DAPM_SUPPLY_S("LDO2", 2, RT286_POWER_CTRL1, 526 SND_SOC_DAPM_SUPPLY_S("LDO2", 2, RT286_POWER_CTRL1,
@@ -911,8 +895,6 @@ static int rt286_set_bias_level(struct snd_soc_codec *codec,
911 case SND_SOC_BIAS_ON: 895 case SND_SOC_BIAS_ON:
912 mdelay(10); 896 mdelay(10);
913 snd_soc_update_bits(codec, 897 snd_soc_update_bits(codec,
914 RT286_CBJ_CTRL1, 0x0400, 0x0400);
915 snd_soc_update_bits(codec,
916 RT286_DC_GAIN, 0x200, 0x0); 898 RT286_DC_GAIN, 0x200, 0x0);
917 899
918 break; 900 break;
@@ -920,8 +902,6 @@ static int rt286_set_bias_level(struct snd_soc_codec *codec,
920 case SND_SOC_BIAS_STANDBY: 902 case SND_SOC_BIAS_STANDBY:
921 snd_soc_write(codec, 903 snd_soc_write(codec,
922 RT286_SET_AUDIO_POWER, AC_PWRST_D3); 904 RT286_SET_AUDIO_POWER, AC_PWRST_D3);
923 snd_soc_update_bits(codec,
924 RT286_CBJ_CTRL1, 0x0400, 0x0000);
925 break; 905 break;
926 906
927 default: 907 default:
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index c61d38b585fb..93e8c9017633 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -776,7 +776,7 @@ static const struct snd_kcontrol_new rt5645_snd_controls[] = {
776 776
777 /* IN1/IN2 Control */ 777 /* IN1/IN2 Control */
778 SOC_SINGLE_TLV("IN1 Boost", RT5645_IN1_CTRL1, 778 SOC_SINGLE_TLV("IN1 Boost", RT5645_IN1_CTRL1,
779 RT5645_BST_SFT1, 8, 0, bst_tlv), 779 RT5645_BST_SFT1, 12, 0, bst_tlv),
780 SOC_SINGLE_TLV("IN2 Boost", RT5645_IN2_CTRL, 780 SOC_SINGLE_TLV("IN2 Boost", RT5645_IN2_CTRL,
781 RT5645_BST_SFT2, 8, 0, bst_tlv), 781 RT5645_BST_SFT2, 8, 0, bst_tlv),
782 782
diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c
index 820d8fa62b5e..fb8ea05c0de1 100644
--- a/sound/soc/codecs/rt5659.c
+++ b/sound/soc/codecs/rt5659.c
@@ -3985,7 +3985,6 @@ static int rt5659_i2c_probe(struct i2c_client *i2c,
3985 if (rt5659 == NULL) 3985 if (rt5659 == NULL)
3986 return -ENOMEM; 3986 return -ENOMEM;
3987 3987
3988 rt5659->i2c = i2c;
3989 i2c_set_clientdata(i2c, rt5659); 3988 i2c_set_clientdata(i2c, rt5659);
3990 3989
3991 if (pdata) 3990 if (pdata)
@@ -4157,24 +4156,17 @@ static int rt5659_i2c_probe(struct i2c_client *i2c,
4157 4156
4158 INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work); 4157 INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work);
4159 4158
4160 if (rt5659->i2c->irq) { 4159 if (i2c->irq) {
4161 ret = request_threaded_irq(rt5659->i2c->irq, NULL, rt5659_irq, 4160 ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
4162 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING 4161 rt5659_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
4163 | IRQF_ONESHOT, "rt5659", rt5659); 4162 | IRQF_ONESHOT, "rt5659", rt5659);
4164 if (ret) 4163 if (ret)
4165 dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret); 4164 dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret);
4166 4165
4167 } 4166 }
4168 4167
4169 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, 4168 return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659,
4170 rt5659_dai, ARRAY_SIZE(rt5659_dai)); 4169 rt5659_dai, ARRAY_SIZE(rt5659_dai));
4171
4172 if (ret) {
4173 if (rt5659->i2c->irq)
4174 free_irq(rt5659->i2c->irq, rt5659);
4175 }
4176
4177 return 0;
4178} 4170}
4179 4171
4180static int rt5659_i2c_remove(struct i2c_client *i2c) 4172static int rt5659_i2c_remove(struct i2c_client *i2c)
@@ -4191,24 +4183,29 @@ void rt5659_i2c_shutdown(struct i2c_client *client)
4191 regmap_write(rt5659->regmap, RT5659_RESET, 0); 4183 regmap_write(rt5659->regmap, RT5659_RESET, 0);
4192} 4184}
4193 4185
4186#ifdef CONFIG_OF
4194static const struct of_device_id rt5659_of_match[] = { 4187static const struct of_device_id rt5659_of_match[] = {
4195 { .compatible = "realtek,rt5658", }, 4188 { .compatible = "realtek,rt5658", },
4196 { .compatible = "realtek,rt5659", }, 4189 { .compatible = "realtek,rt5659", },
4197 {}, 4190 { },
4198}; 4191};
4192MODULE_DEVICE_TABLE(of, rt5659_of_match);
4193#endif
4199 4194
4195#ifdef CONFIG_ACPI
4200static struct acpi_device_id rt5659_acpi_match[] = { 4196static struct acpi_device_id rt5659_acpi_match[] = {
4201 { "10EC5658", 0}, 4197 { "10EC5658", 0, },
4202 { "10EC5659", 0}, 4198 { "10EC5659", 0, },
4203 { }, 4199 { },
4204}; 4200};
4205MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match); 4201MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match);
4202#endif
4206 4203
4207struct i2c_driver rt5659_i2c_driver = { 4204struct i2c_driver rt5659_i2c_driver = {
4208 .driver = { 4205 .driver = {
4209 .name = "rt5659", 4206 .name = "rt5659",
4210 .owner = THIS_MODULE, 4207 .owner = THIS_MODULE,
4211 .of_match_table = rt5659_of_match, 4208 .of_match_table = of_match_ptr(rt5659_of_match),
4212 .acpi_match_table = ACPI_PTR(rt5659_acpi_match), 4209 .acpi_match_table = ACPI_PTR(rt5659_acpi_match),
4213 }, 4210 },
4214 .probe = rt5659_i2c_probe, 4211 .probe = rt5659_i2c_probe,
diff --git a/sound/soc/codecs/rt5659.h b/sound/soc/codecs/rt5659.h
index 8f07ee903eaa..d31c9e5bcec8 100644
--- a/sound/soc/codecs/rt5659.h
+++ b/sound/soc/codecs/rt5659.h
@@ -1792,7 +1792,6 @@ struct rt5659_priv {
1792 struct snd_soc_codec *codec; 1792 struct snd_soc_codec *codec;
1793 struct rt5659_platform_data pdata; 1793 struct rt5659_platform_data pdata;
1794 struct regmap *regmap; 1794 struct regmap *regmap;
1795 struct i2c_client *i2c;
1796 struct gpio_desc *gpiod_ldo1_en; 1795 struct gpio_desc *gpiod_ldo1_en;
1797 struct gpio_desc *gpiod_reset; 1796 struct gpio_desc *gpiod_reset;
1798 struct snd_soc_jack *hs_jack; 1797 struct snd_soc_jack *hs_jack;
diff --git a/sound/soc/codecs/sigmadsp-i2c.c b/sound/soc/codecs/sigmadsp-i2c.c
index 21ca3a5e9f66..d374c18d4db7 100644
--- a/sound/soc/codecs/sigmadsp-i2c.c
+++ b/sound/soc/codecs/sigmadsp-i2c.c
@@ -31,7 +31,10 @@ static int sigmadsp_write_i2c(void *control_data,
31 31
32 kfree(buf); 32 kfree(buf);
33 33
34 return ret; 34 if (ret < 0)
35 return ret;
36
37 return 0;
35} 38}
36 39
37static int sigmadsp_read_i2c(void *control_data, 40static int sigmadsp_read_i2c(void *control_data,
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index 6088d30962a9..97c0f1e23886 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -2382,6 +2382,7 @@ error:
2382 2382
2383static int wm5110_remove(struct platform_device *pdev) 2383static int wm5110_remove(struct platform_device *pdev)
2384{ 2384{
2385 snd_soc_unregister_platform(&pdev->dev);
2385 snd_soc_unregister_codec(&pdev->dev); 2386 snd_soc_unregister_codec(&pdev->dev);
2386 pm_runtime_disable(&pdev->dev); 2387 pm_runtime_disable(&pdev->dev);
2387 2388
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index ff237726775a..d7f444f87460 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -240,13 +240,13 @@ SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL,
240SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL, 240SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL,
241 7, 1, 1), 241 7, 1, 1),
242 242
243SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume", 243SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT3 Volume",
244 WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv), 244 WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv),
245SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT2 Volume", 245SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT2 Volume",
246 WM8960_INBMIX1, 1, 7, 0, lineinboost_tlv), 246 WM8960_INBMIX1, 1, 7, 0, lineinboost_tlv),
247SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT3 Volume", 247SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume",
248 WM8960_INBMIX2, 4, 7, 0, lineinboost_tlv), 248 WM8960_INBMIX2, 4, 7, 0, lineinboost_tlv),
249SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT2 Volume", 249SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT2 Volume",
250 WM8960_INBMIX2, 1, 7, 0, lineinboost_tlv), 250 WM8960_INBMIX2, 1, 7, 0, lineinboost_tlv),
251SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT1 Volume", 251SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT1 Volume",
252 WM8960_RINPATH, 4, 3, 0, micboost_tlv), 252 WM8960_RINPATH, 4, 3, 0, micboost_tlv),
@@ -643,29 +643,31 @@ static int wm8960_configure_clocking(struct snd_soc_codec *codec)
643 return -EINVAL; 643 return -EINVAL;
644 } 644 }
645 645
646 /* check if the sysclk frequency is available. */ 646 if (wm8960->clk_id != WM8960_SYSCLK_PLL) {
647 for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { 647 /* check if the sysclk frequency is available. */
648 if (sysclk_divs[i] == -1) 648 for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) {
649 continue; 649 if (sysclk_divs[i] == -1)
650 sysclk = freq_out / sysclk_divs[i]; 650 continue;
651 for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { 651 sysclk = freq_out / sysclk_divs[i];
652 if (sysclk == dac_divs[j] * lrclk) { 652 for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) {
653 if (sysclk != dac_divs[j] * lrclk)
654 continue;
653 for (k = 0; k < ARRAY_SIZE(bclk_divs); ++k) 655 for (k = 0; k < ARRAY_SIZE(bclk_divs); ++k)
654 if (sysclk == bclk * bclk_divs[k] / 10) 656 if (sysclk == bclk * bclk_divs[k] / 10)
655 break; 657 break;
656 if (k != ARRAY_SIZE(bclk_divs)) 658 if (k != ARRAY_SIZE(bclk_divs))
657 break; 659 break;
658 } 660 }
661 if (j != ARRAY_SIZE(dac_divs))
662 break;
659 } 663 }
660 if (j != ARRAY_SIZE(dac_divs))
661 break;
662 }
663 664
664 if (i != ARRAY_SIZE(sysclk_divs)) { 665 if (i != ARRAY_SIZE(sysclk_divs)) {
665 goto configure_clock; 666 goto configure_clock;
666 } else if (wm8960->clk_id != WM8960_SYSCLK_AUTO) { 667 } else if (wm8960->clk_id != WM8960_SYSCLK_AUTO) {
667 dev_err(codec->dev, "failed to configure clock\n"); 668 dev_err(codec->dev, "failed to configure clock\n");
668 return -EINVAL; 669 return -EINVAL;
670 }
669 } 671 }
670 /* get a available pll out frequency and set pll */ 672 /* get a available pll out frequency and set pll */
671 for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { 673 for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) {
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index ce664c239be3..bff258d7bcea 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -645,6 +645,8 @@ static int dw_i2s_probe(struct platform_device *pdev)
645 645
646 dev->dev = &pdev->dev; 646 dev->dev = &pdev->dev;
647 647
648 dev->i2s_reg_comp1 = I2S_COMP_PARAM_1;
649 dev->i2s_reg_comp2 = I2S_COMP_PARAM_2;
648 if (pdata) { 650 if (pdata) {
649 dev->capability = pdata->cap; 651 dev->capability = pdata->cap;
650 clk_id = NULL; 652 clk_id = NULL;
@@ -652,9 +654,6 @@ static int dw_i2s_probe(struct platform_device *pdev)
652 if (dev->quirks & DW_I2S_QUIRK_COMP_REG_OFFSET) { 654 if (dev->quirks & DW_I2S_QUIRK_COMP_REG_OFFSET) {
653 dev->i2s_reg_comp1 = pdata->i2s_reg_comp1; 655 dev->i2s_reg_comp1 = pdata->i2s_reg_comp1;
654 dev->i2s_reg_comp2 = pdata->i2s_reg_comp2; 656 dev->i2s_reg_comp2 = pdata->i2s_reg_comp2;
655 } else {
656 dev->i2s_reg_comp1 = I2S_COMP_PARAM_1;
657 dev->i2s_reg_comp2 = I2S_COMP_PARAM_2;
658 } 657 }
659 ret = dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata); 658 ret = dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata);
660 } else { 659 } else {
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 40dfd8a36484..ed8de1035cda 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -112,20 +112,6 @@ struct fsl_ssi_rxtx_reg_val {
112 struct fsl_ssi_reg_val tx; 112 struct fsl_ssi_reg_val tx;
113}; 113};
114 114
115static const struct reg_default fsl_ssi_reg_defaults[] = {
116 {CCSR_SSI_SCR, 0x00000000},
117 {CCSR_SSI_SIER, 0x00003003},
118 {CCSR_SSI_STCR, 0x00000200},
119 {CCSR_SSI_SRCR, 0x00000200},
120 {CCSR_SSI_STCCR, 0x00040000},
121 {CCSR_SSI_SRCCR, 0x00040000},
122 {CCSR_SSI_SACNT, 0x00000000},
123 {CCSR_SSI_STMSK, 0x00000000},
124 {CCSR_SSI_SRMSK, 0x00000000},
125 {CCSR_SSI_SACCEN, 0x00000000},
126 {CCSR_SSI_SACCDIS, 0x00000000},
127};
128
129static bool fsl_ssi_readable_reg(struct device *dev, unsigned int reg) 115static bool fsl_ssi_readable_reg(struct device *dev, unsigned int reg)
130{ 116{
131 switch (reg) { 117 switch (reg) {
@@ -190,8 +176,7 @@ static const struct regmap_config fsl_ssi_regconfig = {
190 .val_bits = 32, 176 .val_bits = 32,
191 .reg_stride = 4, 177 .reg_stride = 4,
192 .val_format_endian = REGMAP_ENDIAN_NATIVE, 178 .val_format_endian = REGMAP_ENDIAN_NATIVE,
193 .reg_defaults = fsl_ssi_reg_defaults, 179 .num_reg_defaults_raw = CCSR_SSI_SACCDIS / sizeof(uint32_t) + 1,
194 .num_reg_defaults = ARRAY_SIZE(fsl_ssi_reg_defaults),
195 .readable_reg = fsl_ssi_readable_reg, 180 .readable_reg = fsl_ssi_readable_reg,
196 .volatile_reg = fsl_ssi_volatile_reg, 181 .volatile_reg = fsl_ssi_volatile_reg,
197 .precious_reg = fsl_ssi_precious_reg, 182 .precious_reg = fsl_ssi_precious_reg,
@@ -201,6 +186,7 @@ static const struct regmap_config fsl_ssi_regconfig = {
201 186
202struct fsl_ssi_soc_data { 187struct fsl_ssi_soc_data {
203 bool imx; 188 bool imx;
189 bool imx21regs; /* imx21-class SSI - no SACC{ST,EN,DIS} regs */
204 bool offline_config; 190 bool offline_config;
205 u32 sisr_write_mask; 191 u32 sisr_write_mask;
206}; 192};
@@ -303,6 +289,7 @@ static struct fsl_ssi_soc_data fsl_ssi_mpc8610 = {
303 289
304static struct fsl_ssi_soc_data fsl_ssi_imx21 = { 290static struct fsl_ssi_soc_data fsl_ssi_imx21 = {
305 .imx = true, 291 .imx = true,
292 .imx21regs = true,
306 .offline_config = true, 293 .offline_config = true,
307 .sisr_write_mask = 0, 294 .sisr_write_mask = 0,
308}; 295};
@@ -586,8 +573,12 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi_private *ssi_private)
586 */ 573 */
587 regmap_write(regs, CCSR_SSI_SACNT, 574 regmap_write(regs, CCSR_SSI_SACNT,
588 CCSR_SSI_SACNT_AC97EN | CCSR_SSI_SACNT_FV); 575 CCSR_SSI_SACNT_AC97EN | CCSR_SSI_SACNT_FV);
589 regmap_write(regs, CCSR_SSI_SACCDIS, 0xff); 576
590 regmap_write(regs, CCSR_SSI_SACCEN, 0x300); 577 /* no SACC{ST,EN,DIS} regs on imx21-class SSI */
578 if (!ssi_private->soc->imx21regs) {
579 regmap_write(regs, CCSR_SSI_SACCDIS, 0xff);
580 regmap_write(regs, CCSR_SSI_SACCEN, 0x300);
581 }
591 582
592 /* 583 /*
593 * Enable SSI, Transmit and Receive. AC97 has to communicate with the 584 * Enable SSI, Transmit and Receive. AC97 has to communicate with the
@@ -1397,6 +1388,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
1397 struct resource *res; 1388 struct resource *res;
1398 void __iomem *iomem; 1389 void __iomem *iomem;
1399 char name[64]; 1390 char name[64];
1391 struct regmap_config regconfig = fsl_ssi_regconfig;
1400 1392
1401 of_id = of_match_device(fsl_ssi_ids, &pdev->dev); 1393 of_id = of_match_device(fsl_ssi_ids, &pdev->dev);
1402 if (!of_id || !of_id->data) 1394 if (!of_id || !of_id->data)
@@ -1444,15 +1436,25 @@ static int fsl_ssi_probe(struct platform_device *pdev)
1444 return PTR_ERR(iomem); 1436 return PTR_ERR(iomem);
1445 ssi_private->ssi_phys = res->start; 1437 ssi_private->ssi_phys = res->start;
1446 1438
1439 if (ssi_private->soc->imx21regs) {
1440 /*
1441 * According to datasheet imx21-class SSI
1442 * don't have SACC{ST,EN,DIS} regs.
1443 */
1444 regconfig.max_register = CCSR_SSI_SRMSK;
1445 regconfig.num_reg_defaults_raw =
1446 CCSR_SSI_SRMSK / sizeof(uint32_t) + 1;
1447 }
1448
1447 ret = of_property_match_string(np, "clock-names", "ipg"); 1449 ret = of_property_match_string(np, "clock-names", "ipg");
1448 if (ret < 0) { 1450 if (ret < 0) {
1449 ssi_private->has_ipg_clk_name = false; 1451 ssi_private->has_ipg_clk_name = false;
1450 ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem, 1452 ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
1451 &fsl_ssi_regconfig); 1453 &regconfig);
1452 } else { 1454 } else {
1453 ssi_private->has_ipg_clk_name = true; 1455 ssi_private->has_ipg_clk_name = true;
1454 ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev, 1456 ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev,
1455 "ipg", iomem, &fsl_ssi_regconfig); 1457 "ipg", iomem, &regconfig);
1456 } 1458 }
1457 if (IS_ERR(ssi_private->regs)) { 1459 if (IS_ERR(ssi_private->regs)) {
1458 dev_err(&pdev->dev, "Failed to init register map\n"); 1460 dev_err(&pdev->dev, "Failed to init register map\n");
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c
index a407e833c612..fb896b2c9ba3 100644
--- a/sound/soc/fsl/imx-spdif.c
+++ b/sound/soc/fsl/imx-spdif.c
@@ -72,8 +72,6 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
72 goto end; 72 goto end;
73 } 73 }
74 74
75 platform_set_drvdata(pdev, data);
76
77end: 75end:
78 of_node_put(spdif_np); 76 of_node_put(spdif_np);
79 77
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 1ded8811598e..2389ab47e25f 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -99,7 +99,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
99 if (ret && ret != -ENOTSUPP) 99 if (ret && ret != -ENOTSUPP)
100 goto err; 100 goto err;
101 } 101 }
102 102 return 0;
103err: 103err:
104 return ret; 104 return ret;
105} 105}
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index 803f95e40679..7d7c872c280d 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -30,11 +30,15 @@ config SND_SST_IPC_ACPI
30config SND_SOC_INTEL_SST 30config SND_SOC_INTEL_SST
31 tristate 31 tristate
32 select SND_SOC_INTEL_SST_ACPI if ACPI 32 select SND_SOC_INTEL_SST_ACPI if ACPI
33 select SND_SOC_INTEL_SST_MATCH if ACPI
33 depends on (X86 || COMPILE_TEST) 34 depends on (X86 || COMPILE_TEST)
34 35
35config SND_SOC_INTEL_SST_ACPI 36config SND_SOC_INTEL_SST_ACPI
36 tristate 37 tristate
37 38
39config SND_SOC_INTEL_SST_MATCH
40 tristate
41
38config SND_SOC_INTEL_HASWELL 42config SND_SOC_INTEL_HASWELL
39 tristate 43 tristate
40 44
@@ -57,7 +61,7 @@ config SND_SOC_INTEL_HASWELL_MACH
57config SND_SOC_INTEL_BYT_RT5640_MACH 61config SND_SOC_INTEL_BYT_RT5640_MACH
58 tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec" 62 tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec"
59 depends on X86_INTEL_LPSS && I2C 63 depends on X86_INTEL_LPSS && I2C
60 depends on DW_DMAC_CORE=y && (SND_SOC_INTEL_BYTCR_RT5640_MACH = n) 64 depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
61 select SND_SOC_INTEL_SST 65 select SND_SOC_INTEL_SST
62 select SND_SOC_INTEL_BAYTRAIL 66 select SND_SOC_INTEL_BAYTRAIL
63 select SND_SOC_RT5640 67 select SND_SOC_RT5640
@@ -69,7 +73,7 @@ config SND_SOC_INTEL_BYT_RT5640_MACH
69config SND_SOC_INTEL_BYT_MAX98090_MACH 73config SND_SOC_INTEL_BYT_MAX98090_MACH
70 tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec" 74 tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec"
71 depends on X86_INTEL_LPSS && I2C 75 depends on X86_INTEL_LPSS && I2C
72 depends on DW_DMAC_CORE=y 76 depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
73 select SND_SOC_INTEL_SST 77 select SND_SOC_INTEL_SST
74 select SND_SOC_INTEL_BAYTRAIL 78 select SND_SOC_INTEL_BAYTRAIL
75 select SND_SOC_MAX98090 79 select SND_SOC_MAX98090
@@ -97,6 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
97 select SND_SOC_RT5640 101 select SND_SOC_RT5640
98 select SND_SST_MFLD_PLATFORM 102 select SND_SST_MFLD_PLATFORM
99 select SND_SST_IPC_ACPI 103 select SND_SST_IPC_ACPI
104 select SND_SOC_INTEL_SST_MATCH if ACPI
100 help 105 help
101 This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR 106 This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
102 platforms with RT5640 audio codec. 107 platforms with RT5640 audio codec.
@@ -109,6 +114,7 @@ config SND_SOC_INTEL_BYTCR_RT5651_MACH
109 select SND_SOC_RT5651 114 select SND_SOC_RT5651
110 select SND_SST_MFLD_PLATFORM 115 select SND_SST_MFLD_PLATFORM
111 select SND_SST_IPC_ACPI 116 select SND_SST_IPC_ACPI
117 select SND_SOC_INTEL_SST_MATCH if ACPI
112 help 118 help
113 This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR 119 This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
114 platforms with RT5651 audio codec. 120 platforms with RT5651 audio codec.
@@ -121,6 +127,7 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
121 select SND_SOC_RT5670 127 select SND_SOC_RT5670
122 select SND_SST_MFLD_PLATFORM 128 select SND_SST_MFLD_PLATFORM
123 select SND_SST_IPC_ACPI 129 select SND_SST_IPC_ACPI
130 select SND_SOC_INTEL_SST_MATCH if ACPI
124 help 131 help
125 This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell 132 This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
126 platforms with RT5672 audio codec. 133 platforms with RT5672 audio codec.
@@ -133,6 +140,7 @@ config SND_SOC_INTEL_CHT_BSW_RT5645_MACH
133 select SND_SOC_RT5645 140 select SND_SOC_RT5645
134 select SND_SST_MFLD_PLATFORM 141 select SND_SST_MFLD_PLATFORM
135 select SND_SST_IPC_ACPI 142 select SND_SST_IPC_ACPI
143 select SND_SOC_INTEL_SST_MATCH if ACPI
136 help 144 help
137 This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell 145 This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
138 platforms with RT5645/5650 audio codec. 146 platforms with RT5645/5650 audio codec.
@@ -145,6 +153,7 @@ config SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH
145 select SND_SOC_TS3A227E 153 select SND_SOC_TS3A227E
146 select SND_SST_MFLD_PLATFORM 154 select SND_SST_MFLD_PLATFORM
147 select SND_SST_IPC_ACPI 155 select SND_SST_IPC_ACPI
156 select SND_SOC_INTEL_SST_MATCH if ACPI
148 help 157 help
149 This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell 158 This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
150 platforms with MAX98090 audio codec it also can support TI jack chip as aux device. 159 platforms with MAX98090 audio codec it also can support TI jack chip as aux device.
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index 55c33dc76ce4..52ed434cbca6 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -528,6 +528,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
528 .ops = &sst_compr_dai_ops, 528 .ops = &sst_compr_dai_ops,
529 .playback = { 529 .playback = {
530 .stream_name = "Compress Playback", 530 .stream_name = "Compress Playback",
531 .channels_min = 1,
531 }, 532 },
532}, 533},
533/* BE CPU Dais */ 534/* BE CPU Dais */
diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c
index 7396ddb427d8..2cbcbe412661 100644
--- a/sound/soc/intel/boards/skl_rt286.c
+++ b/sound/soc/intel/boards/skl_rt286.c
@@ -212,7 +212,10 @@ static int skylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
212{ 212{
213 struct snd_interval *channels = hw_param_interval(params, 213 struct snd_interval *channels = hw_param_interval(params,
214 SNDRV_PCM_HW_PARAM_CHANNELS); 214 SNDRV_PCM_HW_PARAM_CHANNELS);
215 channels->min = channels->max = 4; 215 if (params_channels(params) == 2)
216 channels->min = channels->max = 2;
217 else
218 channels->min = channels->max = 4;
216 219
217 return 0; 220 return 0;
218} 221}
diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile
index 668fdeee195e..fbbb25c2ceed 100644
--- a/sound/soc/intel/common/Makefile
+++ b/sound/soc/intel/common/Makefile
@@ -1,13 +1,10 @@
1snd-soc-sst-dsp-objs := sst-dsp.o 1snd-soc-sst-dsp-objs := sst-dsp.o
2ifneq ($(CONFIG_SND_SST_IPC_ACPI),) 2snd-soc-sst-acpi-objs := sst-acpi.o
3snd-soc-sst-acpi-objs := sst-match-acpi.o 3snd-soc-sst-match-objs := sst-match-acpi.o
4else
5snd-soc-sst-acpi-objs := sst-acpi.o sst-match-acpi.o
6endif
7
8snd-soc-sst-ipc-objs := sst-ipc.o 4snd-soc-sst-ipc-objs := sst-ipc.o
9 5
10snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o 6snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o
11 7
12obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o 8obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
13obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o 9obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o
10obj-$(CONFIG_SND_SOC_INTEL_SST_MATCH) += snd-soc-sst-match.o
diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
index 7a85c576dad3..2c5eda14d510 100644
--- a/sound/soc/intel/common/sst-acpi.c
+++ b/sound/soc/intel/common/sst-acpi.c
@@ -215,6 +215,7 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = {
215 .dma_size = SST_LPT_DSP_DMA_SIZE, 215 .dma_size = SST_LPT_DSP_DMA_SIZE,
216}; 216};
217 217
218#if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
218static struct sst_acpi_mach baytrail_machines[] = { 219static struct sst_acpi_mach baytrail_machines[] = {
219 { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, 220 { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL },
220 { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, 221 { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL },
@@ -231,11 +232,14 @@ static struct sst_acpi_desc sst_acpi_baytrail_desc = {
231 .sst_id = SST_DEV_ID_BYT, 232 .sst_id = SST_DEV_ID_BYT,
232 .resindex_dma_base = -1, 233 .resindex_dma_base = -1,
233}; 234};
235#endif
234 236
235static const struct acpi_device_id sst_acpi_match[] = { 237static const struct acpi_device_id sst_acpi_match[] = {
236 { "INT33C8", (unsigned long)&sst_acpi_haswell_desc }, 238 { "INT33C8", (unsigned long)&sst_acpi_haswell_desc },
237 { "INT3438", (unsigned long)&sst_acpi_broadwell_desc }, 239 { "INT3438", (unsigned long)&sst_acpi_broadwell_desc },
240#if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
238 { "80860F28", (unsigned long)&sst_acpi_baytrail_desc }, 241 { "80860F28", (unsigned long)&sst_acpi_baytrail_desc },
242#endif
239 { } 243 { }
240}; 244};
241MODULE_DEVICE_TABLE(acpi, sst_acpi_match); 245MODULE_DEVICE_TABLE(acpi, sst_acpi_match);
diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c
index dd077e116d25..3b4539d21492 100644
--- a/sound/soc/intel/common/sst-match-acpi.c
+++ b/sound/soc/intel/common/sst-match-acpi.c
@@ -41,3 +41,6 @@ struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
41 return NULL; 41 return NULL;
42} 42}
43EXPORT_SYMBOL_GPL(sst_acpi_find_machine); 43EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
44
45MODULE_LICENSE("GPL v2");
46MODULE_DESCRIPTION("Intel Common ACPI Match module");
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index de6dac496a0d..4629372d7c8e 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -688,14 +688,14 @@ int skl_unbind_modules(struct skl_sst *ctx,
688 /* get src queue index */ 688 /* get src queue index */
689 src_index = skl_get_queue_index(src_mcfg->m_out_pin, dst_id, out_max); 689 src_index = skl_get_queue_index(src_mcfg->m_out_pin, dst_id, out_max);
690 if (src_index < 0) 690 if (src_index < 0)
691 return -EINVAL; 691 return 0;
692 692
693 msg.src_queue = src_index; 693 msg.src_queue = src_index;
694 694
695 /* get dst queue index */ 695 /* get dst queue index */
696 dst_index = skl_get_queue_index(dst_mcfg->m_in_pin, src_id, in_max); 696 dst_index = skl_get_queue_index(dst_mcfg->m_in_pin, src_id, in_max);
697 if (dst_index < 0) 697 if (dst_index < 0)
698 return -EINVAL; 698 return 0;
699 699
700 msg.dst_queue = dst_index; 700 msg.dst_queue = dst_index;
701 701
@@ -747,7 +747,7 @@ int skl_bind_modules(struct skl_sst *ctx,
747 747
748 skl_dump_bind_info(ctx, src_mcfg, dst_mcfg); 748 skl_dump_bind_info(ctx, src_mcfg, dst_mcfg);
749 749
750 if (src_mcfg->m_state < SKL_MODULE_INIT_DONE && 750 if (src_mcfg->m_state < SKL_MODULE_INIT_DONE ||
751 dst_mcfg->m_state < SKL_MODULE_INIT_DONE) 751 dst_mcfg->m_state < SKL_MODULE_INIT_DONE)
752 return 0; 752 return 0;
753 753
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index f3553258091a..b6e6b61d10ec 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -863,6 +863,7 @@ static int skl_get_delay_from_lpib(struct hdac_ext_bus *ebus,
863 else 863 else
864 delay += hstream->bufsize; 864 delay += hstream->bufsize;
865 } 865 }
866 delay = (hstream->bufsize == delay) ? 0 : delay;
866 867
867 if (delay >= hstream->period_bytes) { 868 if (delay >= hstream->period_bytes) {
868 dev_info(bus->dev, 869 dev_info(bus->dev,
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 4624556f486d..a294fee431f0 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -54,12 +54,9 @@ static int is_skl_dsp_widget_type(struct snd_soc_dapm_widget *w)
54 54
55/* 55/*
56 * Each pipelines needs memory to be allocated. Check if we have free memory 56 * Each pipelines needs memory to be allocated. Check if we have free memory
57 * from available pool. Then only add this to pool 57 * from available pool.
58 * This is freed when pipe is deleted
59 * Note: DSP does actual memory management we only keep track for complete
60 * pool
61 */ 58 */
62static bool skl_tplg_alloc_pipe_mem(struct skl *skl, 59static bool skl_is_pipe_mem_avail(struct skl *skl,
63 struct skl_module_cfg *mconfig) 60 struct skl_module_cfg *mconfig)
64{ 61{
65 struct skl_sst *ctx = skl->skl_sst; 62 struct skl_sst *ctx = skl->skl_sst;
@@ -74,10 +71,20 @@ static bool skl_tplg_alloc_pipe_mem(struct skl *skl,
74 "exceeds ppl memory available %d mem %d\n", 71 "exceeds ppl memory available %d mem %d\n",
75 skl->resource.max_mem, skl->resource.mem); 72 skl->resource.max_mem, skl->resource.mem);
76 return false; 73 return false;
74 } else {
75 return true;
77 } 76 }
77}
78 78
79/*
80 * Add the mem to the mem pool. This is freed when pipe is deleted.
81 * Note: DSP does actual memory management we only keep track for complete
82 * pool
83 */
84static void skl_tplg_alloc_pipe_mem(struct skl *skl,
85 struct skl_module_cfg *mconfig)
86{
79 skl->resource.mem += mconfig->pipe->memory_pages; 87 skl->resource.mem += mconfig->pipe->memory_pages;
80 return true;
81} 88}
82 89
83/* 90/*
@@ -85,10 +92,10 @@ static bool skl_tplg_alloc_pipe_mem(struct skl *skl,
85 * quantified in MCPS (Million Clocks Per Second) required for module/pipe 92 * quantified in MCPS (Million Clocks Per Second) required for module/pipe
86 * 93 *
87 * Each pipelines needs mcps to be allocated. Check if we have mcps for this 94 * Each pipelines needs mcps to be allocated. Check if we have mcps for this
88 * pipe. This adds the mcps to driver counter 95 * pipe.
89 * This is removed on pipeline delete
90 */ 96 */
91static bool skl_tplg_alloc_pipe_mcps(struct skl *skl, 97
98static bool skl_is_pipe_mcps_avail(struct skl *skl,
92 struct skl_module_cfg *mconfig) 99 struct skl_module_cfg *mconfig)
93{ 100{
94 struct skl_sst *ctx = skl->skl_sst; 101 struct skl_sst *ctx = skl->skl_sst;
@@ -98,13 +105,18 @@ static bool skl_tplg_alloc_pipe_mcps(struct skl *skl,
98 "%s: module_id %d instance %d\n", __func__, 105 "%s: module_id %d instance %d\n", __func__,
99 mconfig->id.module_id, mconfig->id.instance_id); 106 mconfig->id.module_id, mconfig->id.instance_id);
100 dev_err(ctx->dev, 107 dev_err(ctx->dev,
101 "exceeds ppl memory available %d > mem %d\n", 108 "exceeds ppl mcps available %d > mem %d\n",
102 skl->resource.max_mcps, skl->resource.mcps); 109 skl->resource.max_mcps, skl->resource.mcps);
103 return false; 110 return false;
111 } else {
112 return true;
104 } 113 }
114}
105 115
116static void skl_tplg_alloc_pipe_mcps(struct skl *skl,
117 struct skl_module_cfg *mconfig)
118{
106 skl->resource.mcps += mconfig->mcps; 119 skl->resource.mcps += mconfig->mcps;
107 return true;
108} 120}
109 121
110/* 122/*
@@ -411,7 +423,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
411 mconfig = w->priv; 423 mconfig = w->priv;
412 424
413 /* check resource available */ 425 /* check resource available */
414 if (!skl_tplg_alloc_pipe_mcps(skl, mconfig)) 426 if (!skl_is_pipe_mcps_avail(skl, mconfig))
415 return -ENOMEM; 427 return -ENOMEM;
416 428
417 if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) { 429 if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) {
@@ -435,6 +447,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
435 ret = skl_tplg_set_module_params(w, ctx); 447 ret = skl_tplg_set_module_params(w, ctx);
436 if (ret < 0) 448 if (ret < 0)
437 return ret; 449 return ret;
450 skl_tplg_alloc_pipe_mcps(skl, mconfig);
438 } 451 }
439 452
440 return 0; 453 return 0;
@@ -477,10 +490,10 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
477 struct skl_sst *ctx = skl->skl_sst; 490 struct skl_sst *ctx = skl->skl_sst;
478 491
479 /* check resource available */ 492 /* check resource available */
480 if (!skl_tplg_alloc_pipe_mcps(skl, mconfig)) 493 if (!skl_is_pipe_mcps_avail(skl, mconfig))
481 return -EBUSY; 494 return -EBUSY;
482 495
483 if (!skl_tplg_alloc_pipe_mem(skl, mconfig)) 496 if (!skl_is_pipe_mem_avail(skl, mconfig))
484 return -ENOMEM; 497 return -ENOMEM;
485 498
486 /* 499 /*
@@ -526,11 +539,15 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
526 src_module = dst_module; 539 src_module = dst_module;
527 } 540 }
528 541
542 skl_tplg_alloc_pipe_mem(skl, mconfig);
543 skl_tplg_alloc_pipe_mcps(skl, mconfig);
544
529 return 0; 545 return 0;
530} 546}
531 547
532static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, 548static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w,
533 struct skl *skl, 549 struct skl *skl,
550 struct snd_soc_dapm_widget *src_w,
534 struct skl_module_cfg *src_mconfig) 551 struct skl_module_cfg *src_mconfig)
535{ 552{
536 struct snd_soc_dapm_path *p; 553 struct snd_soc_dapm_path *p;
@@ -547,6 +564,10 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w,
547 dev_dbg(ctx->dev, "%s: sink widget=%s\n", __func__, p->sink->name); 564 dev_dbg(ctx->dev, "%s: sink widget=%s\n", __func__, p->sink->name);
548 565
549 next_sink = p->sink; 566 next_sink = p->sink;
567
568 if (!is_skl_dsp_widget_type(p->sink))
569 return skl_tplg_bind_sinks(p->sink, skl, src_w, src_mconfig);
570
550 /* 571 /*
551 * here we will check widgets in sink pipelines, so that 572 * here we will check widgets in sink pipelines, so that
552 * can be any widgets type and we are only interested if 573 * can be any widgets type and we are only interested if
@@ -576,7 +597,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w,
576 } 597 }
577 598
578 if (!sink) 599 if (!sink)
579 return skl_tplg_bind_sinks(next_sink, skl, src_mconfig); 600 return skl_tplg_bind_sinks(next_sink, skl, src_w, src_mconfig);
580 601
581 return 0; 602 return 0;
582} 603}
@@ -605,7 +626,7 @@ static int skl_tplg_pga_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
605 * if sink is not started, start sink pipe first, then start 626 * if sink is not started, start sink pipe first, then start
606 * this pipe 627 * this pipe
607 */ 628 */
608 ret = skl_tplg_bind_sinks(w, skl, src_mconfig); 629 ret = skl_tplg_bind_sinks(w, skl, w, src_mconfig);
609 if (ret) 630 if (ret)
610 return ret; 631 return ret;
611 632
@@ -773,10 +794,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
773 continue; 794 continue;
774 } 795 }
775 796
776 ret = skl_unbind_modules(ctx, src_module, dst_module); 797 skl_unbind_modules(ctx, src_module, dst_module);
777 if (ret < 0)
778 return ret;
779
780 src_module = dst_module; 798 src_module = dst_module;
781 } 799 }
782 800
@@ -814,9 +832,6 @@ static int skl_tplg_pga_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
814 * This is a connecter and if path is found that means 832 * This is a connecter and if path is found that means
815 * unbind between source and sink has not happened yet 833 * unbind between source and sink has not happened yet
816 */ 834 */
817 ret = skl_stop_pipe(ctx, sink_mconfig->pipe);
818 if (ret < 0)
819 return ret;
820 ret = skl_unbind_modules(ctx, src_mconfig, 835 ret = skl_unbind_modules(ctx, src_mconfig,
821 sink_mconfig); 836 sink_mconfig);
822 } 837 }
@@ -842,6 +857,12 @@ static int skl_tplg_vmixer_event(struct snd_soc_dapm_widget *w,
842 case SND_SOC_DAPM_PRE_PMU: 857 case SND_SOC_DAPM_PRE_PMU:
843 return skl_tplg_mixer_dapm_pre_pmu_event(w, skl); 858 return skl_tplg_mixer_dapm_pre_pmu_event(w, skl);
844 859
860 case SND_SOC_DAPM_POST_PMU:
861 return skl_tplg_mixer_dapm_post_pmu_event(w, skl);
862
863 case SND_SOC_DAPM_PRE_PMD:
864 return skl_tplg_mixer_dapm_pre_pmd_event(w, skl);
865
845 case SND_SOC_DAPM_POST_PMD: 866 case SND_SOC_DAPM_POST_PMD:
846 return skl_tplg_mixer_dapm_post_pmd_event(w, skl); 867 return skl_tplg_mixer_dapm_post_pmd_event(w, skl);
847 } 868 }
@@ -916,6 +937,13 @@ static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol,
916 skl_get_module_params(skl->skl_sst, (u32 *)bc->params, 937 skl_get_module_params(skl->skl_sst, (u32 *)bc->params,
917 bc->max, bc->param_id, mconfig); 938 bc->max, bc->param_id, mconfig);
918 939
940 /* decrement size for TLV header */
941 size -= 2 * sizeof(u32);
942
943 /* check size as we don't want to send kernel data */
944 if (size > bc->max)
945 size = bc->max;
946
919 if (bc->params) { 947 if (bc->params) {
920 if (copy_to_user(data, &bc->param_id, sizeof(u32))) 948 if (copy_to_user(data, &bc->param_id, sizeof(u32)))
921 return -EFAULT; 949 return -EFAULT;
@@ -1510,6 +1538,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
1510 &skl_tplg_ops, fw, 0); 1538 &skl_tplg_ops, fw, 0);
1511 if (ret < 0) { 1539 if (ret < 0) {
1512 dev_err(bus->dev, "tplg component load failed%d\n", ret); 1540 dev_err(bus->dev, "tplg component load failed%d\n", ret);
1541 release_firmware(fw);
1513 return -EINVAL; 1542 return -EINVAL;
1514 } 1543 }
1515 1544
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 443a15de94b5..092705e73db4 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -614,8 +614,6 @@ static int skl_probe(struct pci_dev *pci,
614 goto out_unregister; 614 goto out_unregister;
615 615
616 /*configure PM */ 616 /*configure PM */
617 pm_runtime_set_autosuspend_delay(bus->dev, SKL_SUSPEND_DELAY);
618 pm_runtime_use_autosuspend(bus->dev);
619 pm_runtime_put_noidle(bus->dev); 617 pm_runtime_put_noidle(bus->dev);
620 pm_runtime_allow(bus->dev); 618 pm_runtime_allow(bus->dev);
621 619
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index 15c04e2eae34..976967675387 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -9,7 +9,7 @@ config SND_SOC_MEDIATEK
9 9
10config SND_SOC_MT8173_MAX98090 10config SND_SOC_MT8173_MAX98090
11 tristate "ASoC Audio driver for MT8173 with MAX98090 codec" 11 tristate "ASoC Audio driver for MT8173 with MAX98090 codec"
12 depends on SND_SOC_MEDIATEK 12 depends on SND_SOC_MEDIATEK && I2C
13 select SND_SOC_MAX98090 13 select SND_SOC_MAX98090
14 help 14 help
15 This adds ASoC driver for Mediatek MT8173 boards 15 This adds ASoC driver for Mediatek MT8173 boards
@@ -19,7 +19,7 @@ config SND_SOC_MT8173_MAX98090
19 19
20config SND_SOC_MT8173_RT5650_RT5676 20config SND_SOC_MT8173_RT5650_RT5676
21 tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs" 21 tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs"
22 depends on SND_SOC_MEDIATEK 22 depends on SND_SOC_MEDIATEK && I2C
23 select SND_SOC_RT5645 23 select SND_SOC_RT5645
24 select SND_SOC_RT5677 24 select SND_SOC_RT5677
25 help 25 help
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index c866ade28ad0..a6c7b8d87cd2 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -381,9 +381,19 @@ static int mxs_saif_startup(struct snd_pcm_substream *substream,
381 __raw_writel(BM_SAIF_CTRL_CLKGATE, 381 __raw_writel(BM_SAIF_CTRL_CLKGATE,
382 saif->base + SAIF_CTRL + MXS_CLR_ADDR); 382 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
383 383
384 clk_prepare(saif->clk);
385
384 return 0; 386 return 0;
385} 387}
386 388
389static void mxs_saif_shutdown(struct snd_pcm_substream *substream,
390 struct snd_soc_dai *cpu_dai)
391{
392 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
393
394 clk_unprepare(saif->clk);
395}
396
387/* 397/*
388 * Should only be called when port is inactive. 398 * Should only be called when port is inactive.
389 * although can be called multiple times by upper layers. 399 * although can be called multiple times by upper layers.
@@ -424,8 +434,6 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream,
424 return ret; 434 return ret;
425 } 435 }
426 436
427 /* prepare clk in hw_param, enable in trigger */
428 clk_prepare(saif->clk);
429 if (saif != master_saif) { 437 if (saif != master_saif) {
430 /* 438 /*
431 * Set an initial clock rate for the saif internal logic to work 439 * Set an initial clock rate for the saif internal logic to work
@@ -611,6 +619,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
611 619
612static const struct snd_soc_dai_ops mxs_saif_dai_ops = { 620static const struct snd_soc_dai_ops mxs_saif_dai_ops = {
613 .startup = mxs_saif_startup, 621 .startup = mxs_saif_startup,
622 .shutdown = mxs_saif_shutdown,
614 .trigger = mxs_saif_trigger, 623 .trigger = mxs_saif_trigger,
615 .prepare = mxs_saif_prepare, 624 .prepare = mxs_saif_prepare,
616 .hw_params = mxs_saif_hw_params, 625 .hw_params = mxs_saif_hw_params,
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 79688aa1941a..4aeb8e1a7160 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -440,18 +440,18 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data)
440} 440}
441 441
442static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream, 442static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream,
443 struct snd_soc_pcm_runtime *soc_runtime) 443 struct snd_soc_pcm_runtime *rt)
444{ 444{
445 struct snd_dma_buffer *buf = &substream->dma_buffer; 445 struct snd_dma_buffer *buf = &substream->dma_buffer;
446 size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; 446 size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
447 447
448 buf->dev.type = SNDRV_DMA_TYPE_DEV; 448 buf->dev.type = SNDRV_DMA_TYPE_DEV;
449 buf->dev.dev = soc_runtime->dev; 449 buf->dev.dev = rt->platform->dev;
450 buf->private_data = NULL; 450 buf->private_data = NULL;
451 buf->area = dma_alloc_coherent(soc_runtime->dev, size, &buf->addr, 451 buf->area = dma_alloc_coherent(rt->platform->dev, size, &buf->addr,
452 GFP_KERNEL); 452 GFP_KERNEL);
453 if (!buf->area) { 453 if (!buf->area) {
454 dev_err(soc_runtime->dev, "%s: Could not allocate DMA buffer\n", 454 dev_err(rt->platform->dev, "%s: Could not allocate DMA buffer\n",
455 __func__); 455 __func__);
456 return -ENOMEM; 456 return -ENOMEM;
457 } 457 }
@@ -461,12 +461,12 @@ static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream,
461} 461}
462 462
463static void lpass_platform_free_buffer(struct snd_pcm_substream *substream, 463static void lpass_platform_free_buffer(struct snd_pcm_substream *substream,
464 struct snd_soc_pcm_runtime *soc_runtime) 464 struct snd_soc_pcm_runtime *rt)
465{ 465{
466 struct snd_dma_buffer *buf = &substream->dma_buffer; 466 struct snd_dma_buffer *buf = &substream->dma_buffer;
467 467
468 if (buf->area) { 468 if (buf->area) {
469 dma_free_coherent(soc_runtime->dev, buf->bytes, buf->area, 469 dma_free_coherent(rt->dev, buf->bytes, buf->area,
470 buf->addr); 470 buf->addr);
471 } 471 }
472 buf->area = NULL; 472 buf->area = NULL;
@@ -499,9 +499,6 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
499 499
500 snd_soc_pcm_set_drvdata(soc_runtime, data); 500 snd_soc_pcm_set_drvdata(soc_runtime, data);
501 501
502 soc_runtime->dev->coherent_dma_mask = DMA_BIT_MASK(32);
503 soc_runtime->dev->dma_mask = &soc_runtime->dev->coherent_dma_mask;
504
505 ret = lpass_platform_alloc_buffer(substream, soc_runtime); 502 ret = lpass_platform_alloc_buffer(substream, soc_runtime);
506 if (ret) 503 if (ret)
507 return ret; 504 return ret;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 5a2812fa8946..0d3707987900 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -310,7 +310,7 @@ struct dapm_kcontrol_data {
310}; 310};
311 311
312static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, 312static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
313 struct snd_kcontrol *kcontrol) 313 struct snd_kcontrol *kcontrol, const char *ctrl_name)
314{ 314{
315 struct dapm_kcontrol_data *data; 315 struct dapm_kcontrol_data *data;
316 struct soc_mixer_control *mc; 316 struct soc_mixer_control *mc;
@@ -333,7 +333,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
333 if (mc->autodisable) { 333 if (mc->autodisable) {
334 struct snd_soc_dapm_widget template; 334 struct snd_soc_dapm_widget template;
335 335
336 name = kasprintf(GFP_KERNEL, "%s %s", kcontrol->id.name, 336 name = kasprintf(GFP_KERNEL, "%s %s", ctrl_name,
337 "Autodisable"); 337 "Autodisable");
338 if (!name) { 338 if (!name) {
339 ret = -ENOMEM; 339 ret = -ENOMEM;
@@ -371,7 +371,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
371 if (e->autodisable) { 371 if (e->autodisable) {
372 struct snd_soc_dapm_widget template; 372 struct snd_soc_dapm_widget template;
373 373
374 name = kasprintf(GFP_KERNEL, "%s %s", kcontrol->id.name, 374 name = kasprintf(GFP_KERNEL, "%s %s", ctrl_name,
375 "Autodisable"); 375 "Autodisable");
376 if (!name) { 376 if (!name) {
377 ret = -ENOMEM; 377 ret = -ENOMEM;
@@ -871,7 +871,7 @@ static int dapm_create_or_share_kcontrol(struct snd_soc_dapm_widget *w,
871 871
872 kcontrol->private_free = dapm_kcontrol_free; 872 kcontrol->private_free = dapm_kcontrol_free;
873 873
874 ret = dapm_kcontrol_data_alloc(w, kcontrol); 874 ret = dapm_kcontrol_data_alloc(w, kcontrol, name);
875 if (ret) { 875 if (ret) {
876 snd_ctl_free_one(kcontrol); 876 snd_ctl_free_one(kcontrol);
877 goto exit_free; 877 goto exit_free;
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index e898b427be7e..1af4f23697a7 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1810,7 +1810,8 @@ int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
1810 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && 1810 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
1811 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && 1811 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
1812 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && 1812 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) &&
1813 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) 1813 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
1814 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND))
1814 continue; 1815 continue;
1815 1816
1816 dev_dbg(be->dev, "ASoC: hw_free BE %s\n", 1817 dev_dbg(be->dev, "ASoC: hw_free BE %s\n",