aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-20 03:50:49 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-20 03:50:49 -0400
commitd82920849f305a83b893a90eca6391de411d77ef (patch)
tree6da6d697b1b4a34eb4237d05f3f0a8dd2f558bb9
parenteb9a29f9e585044ec71e82d815298ad7e4908858 (diff)
parent196f4eeeb78f53e0a598db8f9408b6f8b270c355 (diff)
Merge tag 'sound-4.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Takashi writes: "sound fixes for 4.19-rc5 here comes a collection of various fixes, mostly for stable-tree or regression fixes. Two relatively high LOCs are about the (rather simple) conversion of uapi integer types in topology API, and a regression fix about HDMI hotplug notification on AMD HD-audio. The rest are all small individual fixes like ASoC Intel Skylake race condition, minor uninitialized page leak in emu10k1 ioctl, Firewire audio error paths, and so on." * tag 'sound-4.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (33 commits) ALSA: fireworks: fix memory leak of response buffer at error path ALSA: oxfw: fix memory leak of discovered stream formats at error path ALSA: oxfw: fix memory leak for model-dependent data at error path ALSA: bebob: fix memory leak for M-Audio FW1814 and ProjectMix I/O at error path ALSA: hda - Enable runtime PM only for discrete GPU ALSA: oxfw: fix memory leak of private data ALSA: firewire-tascam: fix memory leak of private data ALSA: firewire-digi00x: fix memory leak of private data sound: don't call skl_init_chip() to reset intel skl soc sound: enable interrupt after dma buffer initialization Revert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation" ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO ASoC: cs4265: fix MMTLR Data switch control ASoC: AMD: Ensure reset bit is cleared before configuring ALSA: fireface: fix memory leak in ff400_switch_fetching_mode() ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping ASoC: rsnd: don't fallback to PIO mode when -EPROBE_DEFER ASoC: rsnd: adg: care clock-frequency size ASoC: uniphier: change status to orphan ASoC: rsnd: fixup not to call clk_get/set under non-atomic ...
-rw-r--r--MAINTAINERS3
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c2
-rw-r--r--include/linux/vga_switcheroo.h3
-rw-r--r--include/sound/hdaudio.h1
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--include/uapi/sound/skl-tplg-interface.h106
-rw-r--r--sound/firewire/bebob/bebob.c2
-rw-r--r--sound/firewire/bebob/bebob_maudio.c28
-rw-r--r--sound/firewire/digi00x/digi00x.c1
-rw-r--r--sound/firewire/fireface/ff-protocol-ff400.c9
-rw-r--r--sound/firewire/fireworks/fireworks.c2
-rw-r--r--sound/firewire/oxfw/oxfw.c10
-rw-r--r--sound/firewire/tascam/tascam.c1
-rw-r--r--sound/hda/hdac_controller.c15
-rw-r--r--sound/pci/emu10k1/emufx.c2
-rw-r--r--sound/pci/hda/hda_intel.c86
-rw-r--r--sound/pci/hda/hda_intel.h1
-rw-r--r--sound/soc/amd/acp-pcm-dma.c21
-rw-r--r--sound/soc/codecs/cs4265.c4
-rw-r--r--sound/soc/codecs/max98373.c3
-rw-r--r--sound/soc/codecs/rt5514.c8
-rw-r--r--sound/soc/codecs/rt5682.c8
-rw-r--r--sound/soc/codecs/sigmadsp.c3
-rw-r--r--sound/soc/codecs/tas6424.c12
-rw-r--r--sound/soc/codecs/wm8804-i2c.c15
-rw-r--r--sound/soc/codecs/wm9712.c2
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c26
-rw-r--r--sound/soc/intel/skylake/skl.c2
-rw-r--r--sound/soc/qcom/qdsp6/q6routing.c4
-rw-r--r--sound/soc/sh/rcar/adg.c5
-rw-r--r--sound/soc/sh/rcar/core.c21
-rw-r--r--sound/soc/sh/rcar/dma.c4
-rw-r--r--sound/soc/sh/rcar/rsnd.h7
-rw-r--r--sound/soc/sh/rcar/ssi.c16
-rw-r--r--sound/soc/soc-core.c4
-rw-r--r--sound/soc/soc-dapm.c4
36 files changed, 314 insertions, 128 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 4ece30f15777..e993064637ca 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13449,9 +13449,8 @@ F: drivers/i2c/busses/i2c-synquacer.c
13449F: Documentation/devicetree/bindings/i2c/i2c-synquacer.txt 13449F: Documentation/devicetree/bindings/i2c/i2c-synquacer.txt
13450 13450
13451SOCIONEXT UNIPHIER SOUND DRIVER 13451SOCIONEXT UNIPHIER SOUND DRIVER
13452M: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
13453L: alsa-devel@alsa-project.org (moderated for non-subscribers) 13452L: alsa-devel@alsa-project.org (moderated for non-subscribers)
13454S: Maintained 13453S: Orphan
13455F: sound/soc/uniphier/ 13454F: sound/soc/uniphier/
13456 13455
13457SOEKRIS NET48XX LED SUPPORT 13456SOEKRIS NET48XX LED SUPPORT
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index a96bf46bc483..cf2a18571d48 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -215,6 +215,8 @@ static void vga_switcheroo_enable(void)
215 return; 215 return;
216 216
217 client->id = ret | ID_BIT_AUDIO; 217 client->id = ret | ID_BIT_AUDIO;
218 if (client->ops->gpu_bound)
219 client->ops->gpu_bound(client->pdev, ret);
218 } 220 }
219 221
220 vga_switcheroo_debugfs_init(&vgasr_priv); 222 vga_switcheroo_debugfs_init(&vgasr_priv);
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index a34539b7f750..7e6ac0114d55 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -133,15 +133,18 @@ struct vga_switcheroo_handler {
133 * @can_switch: check if the device is in a position to switch now. 133 * @can_switch: check if the device is in a position to switch now.
134 * Mandatory. The client should return false if a user space process 134 * Mandatory. The client should return false if a user space process
135 * has one of its device files open 135 * has one of its device files open
136 * @gpu_bound: notify the client id to audio client when the GPU is bound.
136 * 137 *
137 * Client callbacks. A client can be either a GPU or an audio device on a GPU. 138 * Client callbacks. A client can be either a GPU or an audio device on a GPU.
138 * The @set_gpu_state and @can_switch methods are mandatory, @reprobe may be 139 * The @set_gpu_state and @can_switch methods are mandatory, @reprobe may be
139 * set to NULL. For audio clients, the @reprobe member is bogus. 140 * set to NULL. For audio clients, the @reprobe member is bogus.
141 * OTOH, @gpu_bound is only for audio clients, and not used for GPU clients.
140 */ 142 */
141struct vga_switcheroo_client_ops { 143struct vga_switcheroo_client_ops {
142 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state); 144 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
143 void (*reprobe)(struct pci_dev *dev); 145 void (*reprobe)(struct pci_dev *dev);
144 bool (*can_switch)(struct pci_dev *dev); 146 bool (*can_switch)(struct pci_dev *dev);
147 void (*gpu_bound)(struct pci_dev *dev, enum vga_switcheroo_client_id);
145}; 148};
146 149
147#if defined(CONFIG_VGA_SWITCHEROO) 150#if defined(CONFIG_VGA_SWITCHEROO)
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index 6f1e1f3b3063..cd1773d0e08f 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -412,6 +412,7 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus);
412void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus); 412void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus);
413void snd_hdac_bus_enter_link_reset(struct hdac_bus *bus); 413void snd_hdac_bus_enter_link_reset(struct hdac_bus *bus);
414void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus); 414void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus);
415int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset);
415 416
416void snd_hdac_bus_update_rirb(struct hdac_bus *bus); 417void snd_hdac_bus_update_rirb(struct hdac_bus *bus);
417int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status, 418int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index af9ef16cc34d..fdaaafdc7a00 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -407,6 +407,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
407int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); 407int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
408void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); 408void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
409int snd_soc_dapm_new_pcm(struct snd_soc_card *card, 409int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
410 struct snd_soc_pcm_runtime *rtd,
410 const struct snd_soc_pcm_stream *params, 411 const struct snd_soc_pcm_stream *params,
411 unsigned int num_params, 412 unsigned int num_params,
412 struct snd_soc_dapm_widget *source, 413 struct snd_soc_dapm_widget *source,
diff --git a/include/uapi/sound/skl-tplg-interface.h b/include/uapi/sound/skl-tplg-interface.h
index f58cafa42f18..f39352cef382 100644
--- a/include/uapi/sound/skl-tplg-interface.h
+++ b/include/uapi/sound/skl-tplg-interface.h
@@ -10,6 +10,8 @@
10#ifndef __HDA_TPLG_INTERFACE_H__ 10#ifndef __HDA_TPLG_INTERFACE_H__
11#define __HDA_TPLG_INTERFACE_H__ 11#define __HDA_TPLG_INTERFACE_H__
12 12
13#include <linux/types.h>
14
13/* 15/*
14 * Default types range from 0~12. type can range from 0 to 0xff 16 * Default types range from 0~12. type can range from 0 to 0xff
15 * SST types start at higher to avoid any overlapping in future 17 * SST types start at higher to avoid any overlapping in future
@@ -143,10 +145,10 @@ enum skl_module_param_type {
143}; 145};
144 146
145struct skl_dfw_algo_data { 147struct skl_dfw_algo_data {
146 u32 set_params:2; 148 __u32 set_params:2;
147 u32 rsvd:30; 149 __u32 rsvd:30;
148 u32 param_id; 150 __u32 param_id;
149 u32 max; 151 __u32 max;
150 char params[0]; 152 char params[0];
151} __packed; 153} __packed;
152 154
@@ -163,68 +165,68 @@ enum skl_tuple_type {
163/* v4 configuration data */ 165/* v4 configuration data */
164 166
165struct skl_dfw_v4_module_pin { 167struct skl_dfw_v4_module_pin {
166 u16 module_id; 168 __u16 module_id;
167 u16 instance_id; 169 __u16 instance_id;
168} __packed; 170} __packed;
169 171
170struct skl_dfw_v4_module_fmt { 172struct skl_dfw_v4_module_fmt {
171 u32 channels; 173 __u32 channels;
172 u32 freq; 174 __u32 freq;
173 u32 bit_depth; 175 __u32 bit_depth;
174 u32 valid_bit_depth; 176 __u32 valid_bit_depth;
175 u32 ch_cfg; 177 __u32 ch_cfg;
176 u32 interleaving_style; 178 __u32 interleaving_style;
177 u32 sample_type; 179 __u32 sample_type;
178 u32 ch_map; 180 __u32 ch_map;
179} __packed; 181} __packed;
180 182
181struct skl_dfw_v4_module_caps { 183struct skl_dfw_v4_module_caps {
182 u32 set_params:2; 184 __u32 set_params:2;
183 u32 rsvd:30; 185 __u32 rsvd:30;
184 u32 param_id; 186 __u32 param_id;
185 u32 caps_size; 187 __u32 caps_size;
186 u32 caps[HDA_SST_CFG_MAX]; 188 __u32 caps[HDA_SST_CFG_MAX];
187} __packed; 189} __packed;
188 190
189struct skl_dfw_v4_pipe { 191struct skl_dfw_v4_pipe {
190 u8 pipe_id; 192 __u8 pipe_id;
191 u8 pipe_priority; 193 __u8 pipe_priority;
192 u16 conn_type:4; 194 __u16 conn_type:4;
193 u16 rsvd:4; 195 __u16 rsvd:4;
194 u16 memory_pages:8; 196 __u16 memory_pages:8;
195} __packed; 197} __packed;
196 198
197struct skl_dfw_v4_module { 199struct skl_dfw_v4_module {
198 char uuid[SKL_UUID_STR_SZ]; 200 char uuid[SKL_UUID_STR_SZ];
199 201
200 u16 module_id; 202 __u16 module_id;
201 u16 instance_id; 203 __u16 instance_id;
202 u32 max_mcps; 204 __u32 max_mcps;
203 u32 mem_pages; 205 __u32 mem_pages;
204 u32 obs; 206 __u32 obs;
205 u32 ibs; 207 __u32 ibs;
206 u32 vbus_id; 208 __u32 vbus_id;
207 209
208 u32 max_in_queue:8; 210 __u32 max_in_queue:8;
209 u32 max_out_queue:8; 211 __u32 max_out_queue:8;
210 u32 time_slot:8; 212 __u32 time_slot:8;
211 u32 core_id:4; 213 __u32 core_id:4;
212 u32 rsvd1:4; 214 __u32 rsvd1:4;
213 215
214 u32 module_type:8; 216 __u32 module_type:8;
215 u32 conn_type:4; 217 __u32 conn_type:4;
216 u32 dev_type:4; 218 __u32 dev_type:4;
217 u32 hw_conn_type:4; 219 __u32 hw_conn_type:4;
218 u32 rsvd2:12; 220 __u32 rsvd2:12;
219 221
220 u32 params_fixup:8; 222 __u32 params_fixup:8;
221 u32 converter:8; 223 __u32 converter:8;
222 u32 input_pin_type:1; 224 __u32 input_pin_type:1;
223 u32 output_pin_type:1; 225 __u32 output_pin_type:1;
224 u32 is_dynamic_in_pin:1; 226 __u32 is_dynamic_in_pin:1;
225 u32 is_dynamic_out_pin:1; 227 __u32 is_dynamic_out_pin:1;
226 u32 is_loadable:1; 228 __u32 is_loadable:1;
227 u32 rsvd3:11; 229 __u32 rsvd3:11;
228 230
229 struct skl_dfw_v4_pipe pipe; 231 struct skl_dfw_v4_pipe pipe;
230 struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE]; 232 struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE];
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
index 730ea91d9be8..93676354f87f 100644
--- a/sound/firewire/bebob/bebob.c
+++ b/sound/firewire/bebob/bebob.c
@@ -263,6 +263,8 @@ do_registration(struct work_struct *work)
263error: 263error:
264 mutex_unlock(&devices_mutex); 264 mutex_unlock(&devices_mutex);
265 snd_bebob_stream_destroy_duplex(bebob); 265 snd_bebob_stream_destroy_duplex(bebob);
266 kfree(bebob->maudio_special_quirk);
267 bebob->maudio_special_quirk = NULL;
266 snd_card_free(bebob->card); 268 snd_card_free(bebob->card);
267 dev_info(&bebob->unit->device, 269 dev_info(&bebob->unit->device,
268 "Sound card registration failed: %d\n", err); 270 "Sound card registration failed: %d\n", err);
diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
index bd55620c6a47..c266997ad299 100644
--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -96,17 +96,13 @@ int snd_bebob_maudio_load_firmware(struct fw_unit *unit)
96 struct fw_device *device = fw_parent_device(unit); 96 struct fw_device *device = fw_parent_device(unit);
97 int err, rcode; 97 int err, rcode;
98 u64 date; 98 u64 date;
99 __le32 cues[3] = { 99 __le32 *cues;
100 cpu_to_le32(MAUDIO_BOOTLOADER_CUE1),
101 cpu_to_le32(MAUDIO_BOOTLOADER_CUE2),
102 cpu_to_le32(MAUDIO_BOOTLOADER_CUE3)
103 };
104 100
105 /* check date of software used to build */ 101 /* check date of software used to build */
106 err = snd_bebob_read_block(unit, INFO_OFFSET_SW_DATE, 102 err = snd_bebob_read_block(unit, INFO_OFFSET_SW_DATE,
107 &date, sizeof(u64)); 103 &date, sizeof(u64));
108 if (err < 0) 104 if (err < 0)
109 goto end; 105 return err;
110 /* 106 /*
111 * firmware version 5058 or later has date later than "20070401", but 107 * firmware version 5058 or later has date later than "20070401", but
112 * 'date' is not null-terminated. 108 * 'date' is not null-terminated.
@@ -114,20 +110,28 @@ int snd_bebob_maudio_load_firmware(struct fw_unit *unit)
114 if (date < 0x3230303730343031LL) { 110 if (date < 0x3230303730343031LL) {
115 dev_err(&unit->device, 111 dev_err(&unit->device,
116 "Use firmware version 5058 or later\n"); 112 "Use firmware version 5058 or later\n");
117 err = -ENOSYS; 113 return -ENXIO;
118 goto end;
119 } 114 }
120 115
116 cues = kmalloc_array(3, sizeof(*cues), GFP_KERNEL);
117 if (!cues)
118 return -ENOMEM;
119
120 cues[0] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE1);
121 cues[1] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE2);
122 cues[2] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE3);
123
121 rcode = fw_run_transaction(device->card, TCODE_WRITE_BLOCK_REQUEST, 124 rcode = fw_run_transaction(device->card, TCODE_WRITE_BLOCK_REQUEST,
122 device->node_id, device->generation, 125 device->node_id, device->generation,
123 device->max_speed, BEBOB_ADDR_REG_REQ, 126 device->max_speed, BEBOB_ADDR_REG_REQ,
124 cues, sizeof(cues)); 127 cues, 3 * sizeof(*cues));
128 kfree(cues);
125 if (rcode != RCODE_COMPLETE) { 129 if (rcode != RCODE_COMPLETE) {
126 dev_err(&unit->device, 130 dev_err(&unit->device,
127 "Failed to send a cue to load firmware\n"); 131 "Failed to send a cue to load firmware\n");
128 err = -EIO; 132 err = -EIO;
129 } 133 }
130end: 134
131 return err; 135 return err;
132} 136}
133 137
@@ -290,10 +294,6 @@ snd_bebob_maudio_special_discover(struct snd_bebob *bebob, bool is1814)
290 bebob->midi_output_ports = 2; 294 bebob->midi_output_ports = 2;
291 } 295 }
292end: 296end:
293 if (err < 0) {
294 kfree(params);
295 bebob->maudio_special_quirk = NULL;
296 }
297 mutex_unlock(&bebob->mutex); 297 mutex_unlock(&bebob->mutex);
298 return err; 298 return err;
299} 299}
diff --git a/sound/firewire/digi00x/digi00x.c b/sound/firewire/digi00x/digi00x.c
index 1f5e1d23f31a..ef689997d6a5 100644
--- a/sound/firewire/digi00x/digi00x.c
+++ b/sound/firewire/digi00x/digi00x.c
@@ -49,6 +49,7 @@ static void dg00x_free(struct snd_dg00x *dg00x)
49 fw_unit_put(dg00x->unit); 49 fw_unit_put(dg00x->unit);
50 50
51 mutex_destroy(&dg00x->mutex); 51 mutex_destroy(&dg00x->mutex);
52 kfree(dg00x);
52} 53}
53 54
54static void dg00x_card_free(struct snd_card *card) 55static void dg00x_card_free(struct snd_card *card)
diff --git a/sound/firewire/fireface/ff-protocol-ff400.c b/sound/firewire/fireface/ff-protocol-ff400.c
index ad7a0a32557d..64c3cb0fb926 100644
--- a/sound/firewire/fireface/ff-protocol-ff400.c
+++ b/sound/firewire/fireface/ff-protocol-ff400.c
@@ -146,6 +146,7 @@ static int ff400_switch_fetching_mode(struct snd_ff *ff, bool enable)
146{ 146{
147 __le32 *reg; 147 __le32 *reg;
148 int i; 148 int i;
149 int err;
149 150
150 reg = kcalloc(18, sizeof(__le32), GFP_KERNEL); 151 reg = kcalloc(18, sizeof(__le32), GFP_KERNEL);
151 if (reg == NULL) 152 if (reg == NULL)
@@ -163,9 +164,11 @@ static int ff400_switch_fetching_mode(struct snd_ff *ff, bool enable)
163 reg[i] = cpu_to_le32(0x00000001); 164 reg[i] = cpu_to_le32(0x00000001);
164 } 165 }
165 166
166 return snd_fw_transaction(ff->unit, TCODE_WRITE_BLOCK_REQUEST, 167 err = snd_fw_transaction(ff->unit, TCODE_WRITE_BLOCK_REQUEST,
167 FF400_FETCH_PCM_FRAMES, reg, 168 FF400_FETCH_PCM_FRAMES, reg,
168 sizeof(__le32) * 18, 0); 169 sizeof(__le32) * 18, 0);
170 kfree(reg);
171 return err;
169} 172}
170 173
171static void ff400_dump_sync_status(struct snd_ff *ff, 174static void ff400_dump_sync_status(struct snd_ff *ff,
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c
index 71a0613d3da0..f2d073365cf6 100644
--- a/sound/firewire/fireworks/fireworks.c
+++ b/sound/firewire/fireworks/fireworks.c
@@ -301,6 +301,8 @@ error:
301 snd_efw_transaction_remove_instance(efw); 301 snd_efw_transaction_remove_instance(efw);
302 snd_efw_stream_destroy_duplex(efw); 302 snd_efw_stream_destroy_duplex(efw);
303 snd_card_free(efw->card); 303 snd_card_free(efw->card);
304 kfree(efw->resp_buf);
305 efw->resp_buf = NULL;
304 dev_info(&efw->unit->device, 306 dev_info(&efw->unit->device,
305 "Sound card registration failed: %d\n", err); 307 "Sound card registration failed: %d\n", err);
306} 308}
diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
index 1e5b2c802635..2ea8be6c8584 100644
--- a/sound/firewire/oxfw/oxfw.c
+++ b/sound/firewire/oxfw/oxfw.c
@@ -130,6 +130,7 @@ static void oxfw_free(struct snd_oxfw *oxfw)
130 130
131 kfree(oxfw->spec); 131 kfree(oxfw->spec);
132 mutex_destroy(&oxfw->mutex); 132 mutex_destroy(&oxfw->mutex);
133 kfree(oxfw);
133} 134}
134 135
135/* 136/*
@@ -207,6 +208,7 @@ static int detect_quirks(struct snd_oxfw *oxfw)
207static void do_registration(struct work_struct *work) 208static void do_registration(struct work_struct *work)
208{ 209{
209 struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work); 210 struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work);
211 int i;
210 int err; 212 int err;
211 213
212 if (oxfw->registered) 214 if (oxfw->registered)
@@ -269,7 +271,15 @@ error:
269 snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); 271 snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
270 if (oxfw->has_output) 272 if (oxfw->has_output)
271 snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); 273 snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
274 for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; ++i) {
275 kfree(oxfw->tx_stream_formats[i]);
276 oxfw->tx_stream_formats[i] = NULL;
277 kfree(oxfw->rx_stream_formats[i]);
278 oxfw->rx_stream_formats[i] = NULL;
279 }
272 snd_card_free(oxfw->card); 280 snd_card_free(oxfw->card);
281 kfree(oxfw->spec);
282 oxfw->spec = NULL;
273 dev_info(&oxfw->unit->device, 283 dev_info(&oxfw->unit->device,
274 "Sound card registration failed: %d\n", err); 284 "Sound card registration failed: %d\n", err);
275} 285}
diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
index 44ad41fb7374..d3fdc463a884 100644
--- a/sound/firewire/tascam/tascam.c
+++ b/sound/firewire/tascam/tascam.c
@@ -93,6 +93,7 @@ static void tscm_free(struct snd_tscm *tscm)
93 fw_unit_put(tscm->unit); 93 fw_unit_put(tscm->unit);
94 94
95 mutex_destroy(&tscm->mutex); 95 mutex_destroy(&tscm->mutex);
96 kfree(tscm);
96} 97}
97 98
98static void tscm_card_free(struct snd_card *card) 99static void tscm_card_free(struct snd_card *card)
diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index 560ec0986e1a..74244d8e2909 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus)
40 */ 40 */
41void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) 41void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus)
42{ 42{
43 WARN_ON_ONCE(!bus->rb.area);
44
43 spin_lock_irq(&bus->reg_lock); 45 spin_lock_irq(&bus->reg_lock);
44 /* CORB set up */ 46 /* CORB set up */
45 bus->corb.addr = bus->rb.addr; 47 bus->corb.addr = bus->rb.addr;
@@ -383,7 +385,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus)
383EXPORT_SYMBOL_GPL(snd_hdac_bus_exit_link_reset); 385EXPORT_SYMBOL_GPL(snd_hdac_bus_exit_link_reset);
384 386
385/* reset codec link */ 387/* reset codec link */
386static int azx_reset(struct hdac_bus *bus, bool full_reset) 388int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset)
387{ 389{
388 if (!full_reset) 390 if (!full_reset)
389 goto skip_reset; 391 goto skip_reset;
@@ -408,7 +410,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)
408 skip_reset: 410 skip_reset:
409 /* check to see if controller is ready */ 411 /* check to see if controller is ready */
410 if (!snd_hdac_chip_readb(bus, GCTL)) { 412 if (!snd_hdac_chip_readb(bus, GCTL)) {
411 dev_dbg(bus->dev, "azx_reset: controller not ready!\n"); 413 dev_dbg(bus->dev, "controller not ready!\n");
412 return -EBUSY; 414 return -EBUSY;
413 } 415 }
414 416
@@ -423,6 +425,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)
423 425
424 return 0; 426 return 0;
425} 427}
428EXPORT_SYMBOL_GPL(snd_hdac_bus_reset_link);
426 429
427/* enable interrupts */ 430/* enable interrupts */
428static void azx_int_enable(struct hdac_bus *bus) 431static void azx_int_enable(struct hdac_bus *bus)
@@ -477,15 +480,17 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)
477 return false; 480 return false;
478 481
479 /* reset controller */ 482 /* reset controller */
480 azx_reset(bus, full_reset); 483 snd_hdac_bus_reset_link(bus, full_reset);
481 484
482 /* initialize interrupts */ 485 /* clear interrupts */
483 azx_int_clear(bus); 486 azx_int_clear(bus);
484 azx_int_enable(bus);
485 487
486 /* initialize the codec command I/O */ 488 /* initialize the codec command I/O */
487 snd_hdac_bus_init_cmd_io(bus); 489 snd_hdac_bus_init_cmd_io(bus);
488 490
491 /* enable interrupts after CORB/RIRB buffers are initialized above */
492 azx_int_enable(bus);
493
489 /* program the position buffer */ 494 /* program the position buffer */
490 if (bus->use_posbuf && bus->posbuf.addr) { 495 if (bus->use_posbuf && bus->posbuf.addr) {
491 snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr); 496 snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr);
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 90713741c2dc..6ebe817801ea 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -2540,7 +2540,7 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un
2540 emu->support_tlv = 1; 2540 emu->support_tlv = 1;
2541 return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp); 2541 return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp);
2542 case SNDRV_EMU10K1_IOCTL_INFO: 2542 case SNDRV_EMU10K1_IOCTL_INFO:
2543 info = kmalloc(sizeof(*info), GFP_KERNEL); 2543 info = kzalloc(sizeof(*info), GFP_KERNEL);
2544 if (!info) 2544 if (!info)
2545 return -ENOMEM; 2545 return -ENOMEM;
2546 snd_emu10k1_fx8010_info(emu, info); 2546 snd_emu10k1_fx8010_info(emu, info);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1b2ce304152a..aa4c672dbaf7 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -365,8 +365,10 @@ enum {
365 */ 365 */
366#ifdef SUPPORT_VGA_SWITCHEROO 366#ifdef SUPPORT_VGA_SWITCHEROO
367#define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) 367#define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo)
368#define needs_eld_notify_link(chip) ((chip)->need_eld_notify_link)
368#else 369#else
369#define use_vga_switcheroo(chip) 0 370#define use_vga_switcheroo(chip) 0
371#define needs_eld_notify_link(chip) false
370#endif 372#endif
371 373
372#define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \ 374#define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \
@@ -453,6 +455,7 @@ static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,
453#endif 455#endif
454 456
455static int azx_acquire_irq(struct azx *chip, int do_disconnect); 457static int azx_acquire_irq(struct azx *chip, int do_disconnect);
458static void set_default_power_save(struct azx *chip);
456 459
457/* 460/*
458 * initialize the PCI registers 461 * initialize the PCI registers
@@ -1201,6 +1204,10 @@ static int azx_runtime_idle(struct device *dev)
1201 azx_bus(chip)->codec_powered || !chip->running) 1204 azx_bus(chip)->codec_powered || !chip->running)
1202 return -EBUSY; 1205 return -EBUSY;
1203 1206
1207 /* ELD notification gets broken when HD-audio bus is off */
1208 if (needs_eld_notify_link(hda))
1209 return -EBUSY;
1210
1204 return 0; 1211 return 0;
1205} 1212}
1206 1213
@@ -1298,6 +1305,36 @@ static bool azx_vs_can_switch(struct pci_dev *pci)
1298 return true; 1305 return true;
1299} 1306}
1300 1307
1308/*
1309 * The discrete GPU cannot power down unless the HDA controller runtime
1310 * suspends, so activate runtime PM on codecs even if power_save == 0.
1311 */
1312static void setup_vga_switcheroo_runtime_pm(struct azx *chip)
1313{
1314 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
1315 struct hda_codec *codec;
1316
1317 if (hda->use_vga_switcheroo && !hda->need_eld_notify_link) {
1318 list_for_each_codec(codec, &chip->bus)
1319 codec->auto_runtime_pm = 1;
1320 /* reset the power save setup */
1321 if (chip->running)
1322 set_default_power_save(chip);
1323 }
1324}
1325
1326static void azx_vs_gpu_bound(struct pci_dev *pci,
1327 enum vga_switcheroo_client_id client_id)
1328{
1329 struct snd_card *card = pci_get_drvdata(pci);
1330 struct azx *chip = card->private_data;
1331 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
1332
1333 if (client_id == VGA_SWITCHEROO_DIS)
1334 hda->need_eld_notify_link = 0;
1335 setup_vga_switcheroo_runtime_pm(chip);
1336}
1337
1301static void init_vga_switcheroo(struct azx *chip) 1338static void init_vga_switcheroo(struct azx *chip)
1302{ 1339{
1303 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 1340 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
@@ -1306,6 +1343,7 @@ static void init_vga_switcheroo(struct azx *chip)
1306 dev_info(chip->card->dev, 1343 dev_info(chip->card->dev,
1307 "Handle vga_switcheroo audio client\n"); 1344 "Handle vga_switcheroo audio client\n");
1308 hda->use_vga_switcheroo = 1; 1345 hda->use_vga_switcheroo = 1;
1346 hda->need_eld_notify_link = 1; /* cleared in gpu_bound op */
1309 chip->driver_caps |= AZX_DCAPS_PM_RUNTIME; 1347 chip->driver_caps |= AZX_DCAPS_PM_RUNTIME;
1310 pci_dev_put(p); 1348 pci_dev_put(p);
1311 } 1349 }
@@ -1314,6 +1352,7 @@ static void init_vga_switcheroo(struct azx *chip)
1314static const struct vga_switcheroo_client_ops azx_vs_ops = { 1352static const struct vga_switcheroo_client_ops azx_vs_ops = {
1315 .set_gpu_state = azx_vs_set_state, 1353 .set_gpu_state = azx_vs_set_state,
1316 .can_switch = azx_vs_can_switch, 1354 .can_switch = azx_vs_can_switch,
1355 .gpu_bound = azx_vs_gpu_bound,
1317}; 1356};
1318 1357
1319static int register_vga_switcheroo(struct azx *chip) 1358static int register_vga_switcheroo(struct azx *chip)
@@ -1339,6 +1378,7 @@ static int register_vga_switcheroo(struct azx *chip)
1339#define init_vga_switcheroo(chip) /* NOP */ 1378#define init_vga_switcheroo(chip) /* NOP */
1340#define register_vga_switcheroo(chip) 0 1379#define register_vga_switcheroo(chip) 0
1341#define check_hdmi_disabled(pci) false 1380#define check_hdmi_disabled(pci) false
1381#define setup_vga_switcheroo_runtime_pm(chip) /* NOP */
1342#endif /* SUPPORT_VGA_SWITCHER */ 1382#endif /* SUPPORT_VGA_SWITCHER */
1343 1383
1344/* 1384/*
@@ -1352,6 +1392,7 @@ static int azx_free(struct azx *chip)
1352 1392
1353 if (azx_has_pm_runtime(chip) && chip->running) 1393 if (azx_has_pm_runtime(chip) && chip->running)
1354 pm_runtime_get_noresume(&pci->dev); 1394 pm_runtime_get_noresume(&pci->dev);
1395 chip->running = 0;
1355 1396
1356 azx_del_card_list(chip); 1397 azx_del_card_list(chip);
1357 1398
@@ -2230,6 +2271,25 @@ static struct snd_pci_quirk power_save_blacklist[] = {
2230}; 2271};
2231#endif /* CONFIG_PM */ 2272#endif /* CONFIG_PM */
2232 2273
2274static void set_default_power_save(struct azx *chip)
2275{
2276 int val = power_save;
2277
2278#ifdef CONFIG_PM
2279 if (pm_blacklist) {
2280 const struct snd_pci_quirk *q;
2281
2282 q = snd_pci_quirk_lookup(chip->pci, power_save_blacklist);
2283 if (q && val) {
2284 dev_info(chip->card->dev, "device %04x:%04x is on the power_save blacklist, forcing power_save to 0\n",
2285 q->subvendor, q->subdevice);
2286 val = 0;
2287 }
2288 }
2289#endif /* CONFIG_PM */
2290 snd_hda_set_power_save(&chip->bus, val * 1000);
2291}
2292
2233/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ 2293/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
2234static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { 2294static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
2235 [AZX_DRIVER_NVIDIA] = 8, 2295 [AZX_DRIVER_NVIDIA] = 8,
@@ -2241,9 +2301,7 @@ static int azx_probe_continue(struct azx *chip)
2241 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 2301 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
2242 struct hdac_bus *bus = azx_bus(chip); 2302 struct hdac_bus *bus = azx_bus(chip);
2243 struct pci_dev *pci = chip->pci; 2303 struct pci_dev *pci = chip->pci;
2244 struct hda_codec *codec;
2245 int dev = chip->dev_index; 2304 int dev = chip->dev_index;
2246 int val;
2247 int err; 2305 int err;
2248 2306
2249 hda->probe_continued = 1; 2307 hda->probe_continued = 1;
@@ -2322,31 +2380,13 @@ static int azx_probe_continue(struct azx *chip)
2322 if (err < 0) 2380 if (err < 0)
2323 goto out_free; 2381 goto out_free;
2324 2382
2383 setup_vga_switcheroo_runtime_pm(chip);
2384
2325 chip->running = 1; 2385 chip->running = 1;
2326 azx_add_card_list(chip); 2386 azx_add_card_list(chip);
2327 2387
2328 val = power_save; 2388 set_default_power_save(chip);
2329#ifdef CONFIG_PM
2330 if (pm_blacklist) {
2331 const struct snd_pci_quirk *q;
2332
2333 q = snd_pci_quirk_lookup(chip->pci, power_save_blacklist);
2334 if (q && val) {
2335 dev_info(chip->card->dev, "device %04x:%04x is on the power_save blacklist, forcing power_save to 0\n",
2336 q->subvendor, q->subdevice);
2337 val = 0;
2338 }
2339 }
2340#endif /* CONFIG_PM */
2341 /*
2342 * The discrete GPU cannot power down unless the HDA controller runtime
2343 * suspends, so activate runtime PM on codecs even if power_save == 0.
2344 */
2345 if (use_vga_switcheroo(hda))
2346 list_for_each_codec(codec, &chip->bus)
2347 codec->auto_runtime_pm = 1;
2348 2389
2349 snd_hda_set_power_save(&chip->bus, val * 1000);
2350 if (azx_has_pm_runtime(chip)) 2390 if (azx_has_pm_runtime(chip))
2351 pm_runtime_put_autosuspend(&pci->dev); 2391 pm_runtime_put_autosuspend(&pci->dev);
2352 2392
diff --git a/sound/pci/hda/hda_intel.h b/sound/pci/hda/hda_intel.h
index e3a3d318d2e5..f59719e06b91 100644
--- a/sound/pci/hda/hda_intel.h
+++ b/sound/pci/hda/hda_intel.h
@@ -37,6 +37,7 @@ struct hda_intel {
37 37
38 /* vga_switcheroo setup */ 38 /* vga_switcheroo setup */
39 unsigned int use_vga_switcheroo:1; 39 unsigned int use_vga_switcheroo:1;
40 unsigned int need_eld_notify_link:1;
40 unsigned int vga_switcheroo_registered:1; 41 unsigned int vga_switcheroo_registered:1;
41 unsigned int init_failed:1; /* delayed init failed */ 42 unsigned int init_failed:1; /* delayed init failed */
42 43
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index e359938e3d7e..77b265bd0505 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/iopoll.h>
19#include <linux/sizes.h> 20#include <linux/sizes.h>
20#include <linux/pm_runtime.h> 21#include <linux/pm_runtime.h>
21 22
@@ -184,6 +185,24 @@ static void config_dma_descriptor_in_sram(void __iomem *acp_mmio,
184 acp_reg_write(descr_info->xfer_val, acp_mmio, mmACP_SRBM_Targ_Idx_Data); 185 acp_reg_write(descr_info->xfer_val, acp_mmio, mmACP_SRBM_Targ_Idx_Data);
185} 186}
186 187
188static void pre_config_reset(void __iomem *acp_mmio, u16 ch_num)
189{
190 u32 dma_ctrl;
191 int ret;
192
193 /* clear the reset bit */
194 dma_ctrl = acp_reg_read(acp_mmio, mmACP_DMA_CNTL_0 + ch_num);
195 dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK;
196 acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num);
197 /* check the reset bit before programming configuration registers */
198 ret = readl_poll_timeout(acp_mmio + ((mmACP_DMA_CNTL_0 + ch_num) * 4),
199 dma_ctrl,
200 !(dma_ctrl & ACP_DMA_CNTL_0__DMAChRst_MASK),
201 100, ACP_DMA_RESET_TIME);
202 if (ret < 0)
203 pr_err("Failed to clear reset of channel : %d\n", ch_num);
204}
205
187/* 206/*
188 * Initialize the DMA descriptor information for transfer between 207 * Initialize the DMA descriptor information for transfer between
189 * system memory <-> ACP SRAM 208 * system memory <-> ACP SRAM
@@ -236,6 +255,7 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio,
236 config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, 255 config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx,
237 &dmadscr[i]); 256 &dmadscr[i]);
238 } 257 }
258 pre_config_reset(acp_mmio, ch);
239 config_acp_dma_channel(acp_mmio, ch, 259 config_acp_dma_channel(acp_mmio, ch,
240 dma_dscr_idx - 1, 260 dma_dscr_idx - 1,
241 NUM_DSCRS_PER_CHANNEL, 261 NUM_DSCRS_PER_CHANNEL,
@@ -275,6 +295,7 @@ static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size,
275 config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, 295 config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx,
276 &dmadscr[i]); 296 &dmadscr[i]);
277 } 297 }
298 pre_config_reset(acp_mmio, ch);
278 /* Configure the DMA channel with the above descriptore */ 299 /* Configure the DMA channel with the above descriptore */
279 config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, 300 config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1,
280 NUM_DSCRS_PER_CHANNEL, 301 NUM_DSCRS_PER_CHANNEL,
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
index 275677de669f..407554175282 100644
--- a/sound/soc/codecs/cs4265.c
+++ b/sound/soc/codecs/cs4265.c
@@ -157,8 +157,8 @@ static const struct snd_kcontrol_new cs4265_snd_controls[] = {
157 SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2, 157 SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2,
158 3, 1, 0), 158 3, 1, 0),
159 SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum), 159 SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum),
160 SOC_SINGLE("MMTLR Data Switch", 0, 160 SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2,
161 1, 1, 0), 161 0, 1, 0),
162 SOC_ENUM("Mono Channel Select", spdif_mono_select_enum), 162 SOC_ENUM("Mono Channel Select", spdif_mono_select_enum),
163 SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24), 163 SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24),
164}; 164};
diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c
index 92b7125ea169..1093f766d0d2 100644
--- a/sound/soc/codecs/max98373.c
+++ b/sound/soc/codecs/max98373.c
@@ -520,6 +520,7 @@ static bool max98373_volatile_reg(struct device *dev, unsigned int reg)
520{ 520{
521 switch (reg) { 521 switch (reg) {
522 case MAX98373_R2000_SW_RESET ... MAX98373_R2009_INT_FLAG3: 522 case MAX98373_R2000_SW_RESET ... MAX98373_R2009_INT_FLAG3:
523 case MAX98373_R203E_AMP_PATH_GAIN:
523 case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK: 524 case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK:
524 case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK: 525 case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK:
525 case MAX98373_R20B6_BDE_CUR_STATE_READBACK: 526 case MAX98373_R20B6_BDE_CUR_STATE_READBACK:
@@ -729,6 +730,7 @@ static int max98373_probe(struct snd_soc_component *component)
729 /* Software Reset */ 730 /* Software Reset */
730 regmap_write(max98373->regmap, 731 regmap_write(max98373->regmap,
731 MAX98373_R2000_SW_RESET, MAX98373_SOFT_RESET); 732 MAX98373_R2000_SW_RESET, MAX98373_SOFT_RESET);
733 usleep_range(10000, 11000);
732 734
733 /* IV default slot configuration */ 735 /* IV default slot configuration */
734 regmap_write(max98373->regmap, 736 regmap_write(max98373->regmap,
@@ -817,6 +819,7 @@ static int max98373_resume(struct device *dev)
817 819
818 regmap_write(max98373->regmap, 820 regmap_write(max98373->regmap,
819 MAX98373_R2000_SW_RESET, MAX98373_SOFT_RESET); 821 MAX98373_R2000_SW_RESET, MAX98373_SOFT_RESET);
822 usleep_range(10000, 11000);
820 regcache_cache_only(max98373->regmap, false); 823 regcache_cache_only(max98373->regmap, false);
821 regcache_sync(max98373->regmap); 824 regcache_sync(max98373->regmap);
822 return 0; 825 return 0;
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
index dca82dd6e3bf..32fe76c3134a 100644
--- a/sound/soc/codecs/rt5514.c
+++ b/sound/soc/codecs/rt5514.c
@@ -64,8 +64,8 @@ static const struct reg_sequence rt5514_patch[] = {
64 {RT5514_ANA_CTRL_LDO10, 0x00028604}, 64 {RT5514_ANA_CTRL_LDO10, 0x00028604},
65 {RT5514_ANA_CTRL_ADCFED, 0x00000800}, 65 {RT5514_ANA_CTRL_ADCFED, 0x00000800},
66 {RT5514_ASRC_IN_CTRL1, 0x00000003}, 66 {RT5514_ASRC_IN_CTRL1, 0x00000003},
67 {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, 67 {RT5514_DOWNFILTER0_CTRL3, 0x10000342},
68 {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, 68 {RT5514_DOWNFILTER1_CTRL3, 0x10000342},
69}; 69};
70 70
71static const struct reg_default rt5514_reg[] = { 71static const struct reg_default rt5514_reg[] = {
@@ -92,10 +92,10 @@ static const struct reg_default rt5514_reg[] = {
92 {RT5514_ASRC_IN_CTRL1, 0x00000003}, 92 {RT5514_ASRC_IN_CTRL1, 0x00000003},
93 {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, 93 {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f},
94 {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, 94 {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f},
95 {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, 95 {RT5514_DOWNFILTER0_CTRL3, 0x10000342},
96 {RT5514_DOWNFILTER1_CTRL1, 0x00020c2f}, 96 {RT5514_DOWNFILTER1_CTRL1, 0x00020c2f},
97 {RT5514_DOWNFILTER1_CTRL2, 0x00020c2f}, 97 {RT5514_DOWNFILTER1_CTRL2, 0x00020c2f},
98 {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, 98 {RT5514_DOWNFILTER1_CTRL3, 0x10000342},
99 {RT5514_ANA_CTRL_LDO10, 0x00028604}, 99 {RT5514_ANA_CTRL_LDO10, 0x00028604},
100 {RT5514_ANA_CTRL_LDO18_16, 0x02000345}, 100 {RT5514_ANA_CTRL_LDO18_16, 0x02000345},
101 {RT5514_ANA_CTRL_ADC12, 0x0000a2a8}, 101 {RT5514_ANA_CTRL_ADC12, 0x0000a2a8},
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index 640d400ca013..afe7d5b19313 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -750,8 +750,8 @@ static bool rt5682_readable_register(struct device *dev, unsigned int reg)
750} 750}
751 751
752static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -2250, 150, 0); 752static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -2250, 150, 0);
753static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); 753static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6525, 75, 0);
754static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); 754static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1725, 75, 0);
755static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); 755static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
756 756
757/* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ 757/* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
@@ -1114,7 +1114,7 @@ static const struct snd_kcontrol_new rt5682_snd_controls[] = {
1114 1114
1115 /* DAC Digital Volume */ 1115 /* DAC Digital Volume */
1116 SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5682_DAC1_DIG_VOL, 1116 SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5682_DAC1_DIG_VOL,
1117 RT5682_L_VOL_SFT, RT5682_R_VOL_SFT, 175, 0, dac_vol_tlv), 1117 RT5682_L_VOL_SFT + 1, RT5682_R_VOL_SFT + 1, 86, 0, dac_vol_tlv),
1118 1118
1119 /* IN Boost Volume */ 1119 /* IN Boost Volume */
1120 SOC_SINGLE_TLV("CBJ Boost Volume", RT5682_CBJ_BST_CTRL, 1120 SOC_SINGLE_TLV("CBJ Boost Volume", RT5682_CBJ_BST_CTRL,
@@ -1124,7 +1124,7 @@ static const struct snd_kcontrol_new rt5682_snd_controls[] = {
1124 SOC_DOUBLE("STO1 ADC Capture Switch", RT5682_STO1_ADC_DIG_VOL, 1124 SOC_DOUBLE("STO1 ADC Capture Switch", RT5682_STO1_ADC_DIG_VOL,
1125 RT5682_L_MUTE_SFT, RT5682_R_MUTE_SFT, 1, 1), 1125 RT5682_L_MUTE_SFT, RT5682_R_MUTE_SFT, 1, 1),
1126 SOC_DOUBLE_TLV("STO1 ADC Capture Volume", RT5682_STO1_ADC_DIG_VOL, 1126 SOC_DOUBLE_TLV("STO1 ADC Capture Volume", RT5682_STO1_ADC_DIG_VOL,
1127 RT5682_L_VOL_SFT, RT5682_R_VOL_SFT, 127, 0, adc_vol_tlv), 1127 RT5682_L_VOL_SFT + 1, RT5682_R_VOL_SFT + 1, 63, 0, adc_vol_tlv),
1128 1128
1129 /* ADC Boost Volume Control */ 1129 /* ADC Boost Volume Control */
1130 SOC_DOUBLE_TLV("STO1 ADC Boost Gain Volume", RT5682_STO1_ADC_BOOST, 1130 SOC_DOUBLE_TLV("STO1 ADC Boost Gain Volume", RT5682_STO1_ADC_BOOST,
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index d53680ac78e4..6df158669420 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -117,8 +117,7 @@ static int sigmadsp_ctrl_write(struct sigmadsp *sigmadsp,
117 struct sigmadsp_control *ctrl, void *data) 117 struct sigmadsp_control *ctrl, void *data)
118{ 118{
119 /* safeload loads up to 20 bytes in a atomic operation */ 119 /* safeload loads up to 20 bytes in a atomic operation */
120 if (ctrl->num_bytes > 4 && ctrl->num_bytes <= 20 && sigmadsp->ops && 120 if (ctrl->num_bytes <= 20 && sigmadsp->ops && sigmadsp->ops->safeload)
121 sigmadsp->ops->safeload)
122 return sigmadsp->ops->safeload(sigmadsp, ctrl->addr, data, 121 return sigmadsp->ops->safeload(sigmadsp, ctrl->addr, data,
123 ctrl->num_bytes); 122 ctrl->num_bytes);
124 else 123 else
diff --git a/sound/soc/codecs/tas6424.c b/sound/soc/codecs/tas6424.c
index 14999b999fd3..0d6145549a98 100644
--- a/sound/soc/codecs/tas6424.c
+++ b/sound/soc/codecs/tas6424.c
@@ -424,8 +424,10 @@ static void tas6424_fault_check_work(struct work_struct *work)
424 TAS6424_FAULT_PVDD_UV | 424 TAS6424_FAULT_PVDD_UV |
425 TAS6424_FAULT_VBAT_UV; 425 TAS6424_FAULT_VBAT_UV;
426 426
427 if (reg) 427 if (!reg) {
428 tas6424->last_fault1 = reg;
428 goto check_global_fault2_reg; 429 goto check_global_fault2_reg;
430 }
429 431
430 /* 432 /*
431 * Only flag errors once for a given occurrence. This is needed as 433 * Only flag errors once for a given occurrence. This is needed as
@@ -461,8 +463,10 @@ check_global_fault2_reg:
461 TAS6424_FAULT_OTSD_CH3 | 463 TAS6424_FAULT_OTSD_CH3 |
462 TAS6424_FAULT_OTSD_CH4; 464 TAS6424_FAULT_OTSD_CH4;
463 465
464 if (!reg) 466 if (!reg) {
467 tas6424->last_fault2 = reg;
465 goto check_warn_reg; 468 goto check_warn_reg;
469 }
466 470
467 if ((reg & TAS6424_FAULT_OTSD) && !(tas6424->last_fault2 & TAS6424_FAULT_OTSD)) 471 if ((reg & TAS6424_FAULT_OTSD) && !(tas6424->last_fault2 & TAS6424_FAULT_OTSD))
468 dev_crit(dev, "experienced a global overtemp shutdown\n"); 472 dev_crit(dev, "experienced a global overtemp shutdown\n");
@@ -497,8 +501,10 @@ check_warn_reg:
497 TAS6424_WARN_VDD_OTW_CH3 | 501 TAS6424_WARN_VDD_OTW_CH3 |
498 TAS6424_WARN_VDD_OTW_CH4; 502 TAS6424_WARN_VDD_OTW_CH4;
499 503
500 if (!reg) 504 if (!reg) {
505 tas6424->last_warn = reg;
501 goto out; 506 goto out;
507 }
502 508
503 if ((reg & TAS6424_WARN_VDD_UV) && !(tas6424->last_warn & TAS6424_WARN_VDD_UV)) 509 if ((reg & TAS6424_WARN_VDD_UV) && !(tas6424->last_warn & TAS6424_WARN_VDD_UV))
504 dev_warn(dev, "experienced a VDD under voltage condition\n"); 510 dev_warn(dev, "experienced a VDD under voltage condition\n");
diff --git a/sound/soc/codecs/wm8804-i2c.c b/sound/soc/codecs/wm8804-i2c.c
index f27464c2c5ba..79541960f45d 100644
--- a/sound/soc/codecs/wm8804-i2c.c
+++ b/sound/soc/codecs/wm8804-i2c.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/acpi.h>
16 17
17#include "wm8804.h" 18#include "wm8804.h"
18 19
@@ -40,17 +41,29 @@ static const struct i2c_device_id wm8804_i2c_id[] = {
40}; 41};
41MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id); 42MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id);
42 43
44#if defined(CONFIG_OF)
43static const struct of_device_id wm8804_of_match[] = { 45static const struct of_device_id wm8804_of_match[] = {
44 { .compatible = "wlf,wm8804", }, 46 { .compatible = "wlf,wm8804", },
45 { } 47 { }
46}; 48};
47MODULE_DEVICE_TABLE(of, wm8804_of_match); 49MODULE_DEVICE_TABLE(of, wm8804_of_match);
50#endif
51
52#ifdef CONFIG_ACPI
53static const struct acpi_device_id wm8804_acpi_match[] = {
54 { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */
55 { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */
56 { },
57};
58MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match);
59#endif
48 60
49static struct i2c_driver wm8804_i2c_driver = { 61static struct i2c_driver wm8804_i2c_driver = {
50 .driver = { 62 .driver = {
51 .name = "wm8804", 63 .name = "wm8804",
52 .pm = &wm8804_pm, 64 .pm = &wm8804_pm,
53 .of_match_table = wm8804_of_match, 65 .of_match_table = of_match_ptr(wm8804_of_match),
66 .acpi_match_table = ACPI_PTR(wm8804_acpi_match),
54 }, 67 },
55 .probe = wm8804_i2c_probe, 68 .probe = wm8804_i2c_probe,
56 .remove = wm8804_i2c_remove, 69 .remove = wm8804_i2c_remove,
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 953d94d50586..ade34c26ad2f 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -719,7 +719,7 @@ static int wm9712_probe(struct platform_device *pdev)
719 719
720static struct platform_driver wm9712_component_driver = { 720static struct platform_driver wm9712_component_driver = {
721 .driver = { 721 .driver = {
722 .name = "wm9712-component", 722 .name = "wm9712-codec",
723 }, 723 },
724 724
725 .probe = wm9712_probe, 725 .probe = wm9712_probe,
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index d32844f94d74..b6dc524830b2 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -575,6 +575,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
575 BYT_RT5640_MONO_SPEAKER | 575 BYT_RT5640_MONO_SPEAKER |
576 BYT_RT5640_MCLK_EN), 576 BYT_RT5640_MCLK_EN),
577 }, 577 },
578 { /* Linx Linx7 tablet */
579 .matches = {
580 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LINX"),
581 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LINX7"),
582 },
583 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
584 BYT_RT5640_MONO_SPEAKER |
585 BYT_RT5640_JD_NOT_INV |
586 BYT_RT5640_SSP0_AIF1 |
587 BYT_RT5640_MCLK_EN),
588 },
578 { /* MSI S100 tablet */ 589 { /* MSI S100 tablet */
579 .matches = { 590 .matches = {
580 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."), 591 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
@@ -602,6 +613,21 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
602 BYT_RT5640_SSP0_AIF1 | 613 BYT_RT5640_SSP0_AIF1 |
603 BYT_RT5640_MCLK_EN), 614 BYT_RT5640_MCLK_EN),
604 }, 615 },
616 { /* Onda v975w */
617 .matches = {
618 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
619 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
620 /* The above are too generic, also match BIOS info */
621 DMI_EXACT_MATCH(DMI_BIOS_VERSION, "5.6.5"),
622 DMI_EXACT_MATCH(DMI_BIOS_DATE, "07/25/2014"),
623 },
624 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
625 BYT_RT5640_JD_SRC_JD2_IN4N |
626 BYT_RT5640_OVCD_TH_2000UA |
627 BYT_RT5640_OVCD_SF_0P75 |
628 BYT_RT5640_DIFF_MIC |
629 BYT_RT5640_MCLK_EN),
630 },
605 { /* Pipo W4 */ 631 { /* Pipo W4 */
606 .matches = { 632 .matches = {
607 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 633 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index dce649485649..1d17be0f78a0 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -834,7 +834,7 @@ static int skl_first_init(struct hdac_bus *bus)
834 return -ENXIO; 834 return -ENXIO;
835 } 835 }
836 836
837 skl_init_chip(bus, true); 837 snd_hdac_bus_reset_link(bus, true);
838 838
839 snd_hdac_bus_parse_capabilities(bus); 839 snd_hdac_bus_parse_capabilities(bus);
840 840
diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index dc94c5c53788..c6b51571be94 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -960,8 +960,10 @@ static int msm_routing_probe(struct snd_soc_component *c)
960{ 960{
961 int i; 961 int i;
962 962
963 for (i = 0; i < MAX_SESSIONS; i++) 963 for (i = 0; i < MAX_SESSIONS; i++) {
964 routing_data->sessions[i].port_id = -1; 964 routing_data->sessions[i].port_id = -1;
965 routing_data->sessions[i].fedai_id = -1;
966 }
965 967
966 return 0; 968 return 0;
967} 969}
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 3a3064dda57f..051f96405346 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -462,6 +462,11 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
462 goto rsnd_adg_get_clkout_end; 462 goto rsnd_adg_get_clkout_end;
463 463
464 req_size = prop->length / sizeof(u32); 464 req_size = prop->length / sizeof(u32);
465 if (req_size > REQ_SIZE) {
466 dev_err(dev,
467 "too many clock-frequency, use top %d\n", REQ_SIZE);
468 req_size = REQ_SIZE;
469 }
465 470
466 of_property_read_u32_array(np, "clock-frequency", req_rate, req_size); 471 of_property_read_u32_array(np, "clock-frequency", req_rate, req_size);
467 req_48kHz_rate = 0; 472 req_48kHz_rate = 0;
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index f8425d8b44d2..d23c2bbff0cf 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -478,7 +478,7 @@ static int rsnd_status_update(u32 *status,
478 (func_call && (mod)->ops->fn) ? #fn : ""); \ 478 (func_call && (mod)->ops->fn) ? #fn : ""); \
479 if (func_call && (mod)->ops->fn) \ 479 if (func_call && (mod)->ops->fn) \
480 tmp = (mod)->ops->fn(mod, io, param); \ 480 tmp = (mod)->ops->fn(mod, io, param); \
481 if (tmp) \ 481 if (tmp && (tmp != -EPROBE_DEFER)) \
482 dev_err(dev, "%s[%d] : %s error %d\n", \ 482 dev_err(dev, "%s[%d] : %s error %d\n", \
483 rsnd_mod_name(mod), rsnd_mod_id(mod), \ 483 rsnd_mod_name(mod), rsnd_mod_id(mod), \
484 #fn, tmp); \ 484 #fn, tmp); \
@@ -958,12 +958,23 @@ static void rsnd_soc_dai_shutdown(struct snd_pcm_substream *substream,
958 rsnd_dai_stream_quit(io); 958 rsnd_dai_stream_quit(io);
959} 959}
960 960
961static int rsnd_soc_dai_prepare(struct snd_pcm_substream *substream,
962 struct snd_soc_dai *dai)
963{
964 struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
965 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
966 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
967
968 return rsnd_dai_call(prepare, io, priv);
969}
970
961static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { 971static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
962 .startup = rsnd_soc_dai_startup, 972 .startup = rsnd_soc_dai_startup,
963 .shutdown = rsnd_soc_dai_shutdown, 973 .shutdown = rsnd_soc_dai_shutdown,
964 .trigger = rsnd_soc_dai_trigger, 974 .trigger = rsnd_soc_dai_trigger,
965 .set_fmt = rsnd_soc_dai_set_fmt, 975 .set_fmt = rsnd_soc_dai_set_fmt,
966 .set_tdm_slot = rsnd_soc_set_dai_tdm_slot, 976 .set_tdm_slot = rsnd_soc_set_dai_tdm_slot,
977 .prepare = rsnd_soc_dai_prepare,
967}; 978};
968 979
969void rsnd_parse_connect_common(struct rsnd_dai *rdai, 980void rsnd_parse_connect_common(struct rsnd_dai *rdai,
@@ -1550,6 +1561,14 @@ exit_snd_probe:
1550 rsnd_dai_call(remove, &rdai->capture, priv); 1561 rsnd_dai_call(remove, &rdai->capture, priv);
1551 } 1562 }
1552 1563
1564 /*
1565 * adg is very special mod which can't use rsnd_dai_call(remove),
1566 * and it registers ADG clock on probe.
1567 * It should be unregister if probe failed.
1568 * Mainly it is assuming -EPROBE_DEFER case
1569 */
1570 rsnd_adg_remove(priv);
1571
1553 return ret; 1572 return ret;
1554} 1573}
1555 1574
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index fe63ef8600d0..d65ea7bc4dac 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -241,6 +241,10 @@ static int rsnd_dmaen_attach(struct rsnd_dai_stream *io,
241 /* try to get DMAEngine channel */ 241 /* try to get DMAEngine channel */
242 chan = rsnd_dmaen_request_channel(io, mod_from, mod_to); 242 chan = rsnd_dmaen_request_channel(io, mod_from, mod_to);
243 if (IS_ERR_OR_NULL(chan)) { 243 if (IS_ERR_OR_NULL(chan)) {
244 /* Let's follow when -EPROBE_DEFER case */
245 if (PTR_ERR(chan) == -EPROBE_DEFER)
246 return PTR_ERR(chan);
247
244 /* 248 /*
245 * DMA failed. try to PIO mode 249 * DMA failed. try to PIO mode
246 * see 250 * see
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 96d93330b1e1..8f7a0abfa751 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -280,6 +280,9 @@ struct rsnd_mod_ops {
280 int (*nolock_stop)(struct rsnd_mod *mod, 280 int (*nolock_stop)(struct rsnd_mod *mod,
281 struct rsnd_dai_stream *io, 281 struct rsnd_dai_stream *io,
282 struct rsnd_priv *priv); 282 struct rsnd_priv *priv);
283 int (*prepare)(struct rsnd_mod *mod,
284 struct rsnd_dai_stream *io,
285 struct rsnd_priv *priv);
283}; 286};
284 287
285struct rsnd_dai_stream; 288struct rsnd_dai_stream;
@@ -309,6 +312,7 @@ struct rsnd_mod {
309 * H 0: fallback 312 * H 0: fallback
310 * H 0: hw_params 313 * H 0: hw_params
311 * H 0: pointer 314 * H 0: pointer
315 * H 0: prepare
312 */ 316 */
313#define __rsnd_mod_shift_nolock_start 0 317#define __rsnd_mod_shift_nolock_start 0
314#define __rsnd_mod_shift_nolock_stop 0 318#define __rsnd_mod_shift_nolock_stop 0
@@ -323,6 +327,7 @@ struct rsnd_mod {
323#define __rsnd_mod_shift_fallback 28 /* always called */ 327#define __rsnd_mod_shift_fallback 28 /* always called */
324#define __rsnd_mod_shift_hw_params 28 /* always called */ 328#define __rsnd_mod_shift_hw_params 28 /* always called */
325#define __rsnd_mod_shift_pointer 28 /* always called */ 329#define __rsnd_mod_shift_pointer 28 /* always called */
330#define __rsnd_mod_shift_prepare 28 /* always called */
326 331
327#define __rsnd_mod_add_probe 0 332#define __rsnd_mod_add_probe 0
328#define __rsnd_mod_add_remove 0 333#define __rsnd_mod_add_remove 0
@@ -337,6 +342,7 @@ struct rsnd_mod {
337#define __rsnd_mod_add_fallback 0 342#define __rsnd_mod_add_fallback 0
338#define __rsnd_mod_add_hw_params 0 343#define __rsnd_mod_add_hw_params 0
339#define __rsnd_mod_add_pointer 0 344#define __rsnd_mod_add_pointer 0
345#define __rsnd_mod_add_prepare 0
340 346
341#define __rsnd_mod_call_probe 0 347#define __rsnd_mod_call_probe 0
342#define __rsnd_mod_call_remove 0 348#define __rsnd_mod_call_remove 0
@@ -351,6 +357,7 @@ struct rsnd_mod {
351#define __rsnd_mod_call_pointer 0 357#define __rsnd_mod_call_pointer 0
352#define __rsnd_mod_call_nolock_start 0 358#define __rsnd_mod_call_nolock_start 0
353#define __rsnd_mod_call_nolock_stop 1 359#define __rsnd_mod_call_nolock_stop 1
360#define __rsnd_mod_call_prepare 0
354 361
355#define rsnd_mod_to_priv(mod) ((mod)->priv) 362#define rsnd_mod_to_priv(mod) ((mod)->priv)
356#define rsnd_mod_name(mod) ((mod)->ops->name) 363#define rsnd_mod_name(mod) ((mod)->ops->name)
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 8304e4ec9242..3f880ec66459 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -283,7 +283,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
283 if (rsnd_ssi_is_multi_slave(mod, io)) 283 if (rsnd_ssi_is_multi_slave(mod, io))
284 return 0; 284 return 0;
285 285
286 if (ssi->usrcnt > 1) { 286 if (ssi->rate) {
287 if (ssi->rate != rate) { 287 if (ssi->rate != rate) {
288 dev_err(dev, "SSI parent/child should use same rate\n"); 288 dev_err(dev, "SSI parent/child should use same rate\n");
289 return -EINVAL; 289 return -EINVAL;
@@ -434,7 +434,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
434 struct rsnd_priv *priv) 434 struct rsnd_priv *priv)
435{ 435{
436 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); 436 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
437 int ret;
438 437
439 if (!rsnd_ssi_is_run_mods(mod, io)) 438 if (!rsnd_ssi_is_run_mods(mod, io))
440 return 0; 439 return 0;
@@ -443,10 +442,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
443 442
444 rsnd_mod_power_on(mod); 443 rsnd_mod_power_on(mod);
445 444
446 ret = rsnd_ssi_master_clk_start(mod, io);
447 if (ret < 0)
448 return ret;
449
450 rsnd_ssi_config_init(mod, io); 445 rsnd_ssi_config_init(mod, io);
451 446
452 rsnd_ssi_register_setup(mod); 447 rsnd_ssi_register_setup(mod);
@@ -852,6 +847,13 @@ static int rsnd_ssi_pio_pointer(struct rsnd_mod *mod,
852 return 0; 847 return 0;
853} 848}
854 849
850static int rsnd_ssi_prepare(struct rsnd_mod *mod,
851 struct rsnd_dai_stream *io,
852 struct rsnd_priv *priv)
853{
854 return rsnd_ssi_master_clk_start(mod, io);
855}
856
855static struct rsnd_mod_ops rsnd_ssi_pio_ops = { 857static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
856 .name = SSI_NAME, 858 .name = SSI_NAME,
857 .probe = rsnd_ssi_common_probe, 859 .probe = rsnd_ssi_common_probe,
@@ -864,6 +866,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
864 .pointer = rsnd_ssi_pio_pointer, 866 .pointer = rsnd_ssi_pio_pointer,
865 .pcm_new = rsnd_ssi_pcm_new, 867 .pcm_new = rsnd_ssi_pcm_new,
866 .hw_params = rsnd_ssi_hw_params, 868 .hw_params = rsnd_ssi_hw_params,
869 .prepare = rsnd_ssi_prepare,
867}; 870};
868 871
869static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, 872static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
@@ -940,6 +943,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
940 .pcm_new = rsnd_ssi_pcm_new, 943 .pcm_new = rsnd_ssi_pcm_new,
941 .fallback = rsnd_ssi_fallback, 944 .fallback = rsnd_ssi_fallback,
942 .hw_params = rsnd_ssi_hw_params, 945 .hw_params = rsnd_ssi_hw_params,
946 .prepare = rsnd_ssi_prepare,
943}; 947};
944 948
945int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod) 949int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9cfe10d8040c..473eefe8658e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1447,7 +1447,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
1447 sink = codec_dai->playback_widget; 1447 sink = codec_dai->playback_widget;
1448 source = cpu_dai->capture_widget; 1448 source = cpu_dai->capture_widget;
1449 if (sink && source) { 1449 if (sink && source) {
1450 ret = snd_soc_dapm_new_pcm(card, dai_link->params, 1450 ret = snd_soc_dapm_new_pcm(card, rtd, dai_link->params,
1451 dai_link->num_params, 1451 dai_link->num_params,
1452 source, sink); 1452 source, sink);
1453 if (ret != 0) { 1453 if (ret != 0) {
@@ -1460,7 +1460,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
1460 sink = cpu_dai->playback_widget; 1460 sink = cpu_dai->playback_widget;
1461 source = codec_dai->capture_widget; 1461 source = codec_dai->capture_widget;
1462 if (sink && source) { 1462 if (sink && source) {
1463 ret = snd_soc_dapm_new_pcm(card, dai_link->params, 1463 ret = snd_soc_dapm_new_pcm(card, rtd, dai_link->params,
1464 dai_link->num_params, 1464 dai_link->num_params,
1465 source, sink); 1465 source, sink);
1466 if (ret != 0) { 1466 if (ret != 0) {
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7e96793050c9..461d951917c0 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3652,6 +3652,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3652{ 3652{
3653 struct snd_soc_dapm_path *source_p, *sink_p; 3653 struct snd_soc_dapm_path *source_p, *sink_p;
3654 struct snd_soc_dai *source, *sink; 3654 struct snd_soc_dai *source, *sink;
3655 struct snd_soc_pcm_runtime *rtd = w->priv;
3655 const struct snd_soc_pcm_stream *config = w->params + w->params_select; 3656 const struct snd_soc_pcm_stream *config = w->params + w->params_select;
3656 struct snd_pcm_substream substream; 3657 struct snd_pcm_substream substream;
3657 struct snd_pcm_hw_params *params = NULL; 3658 struct snd_pcm_hw_params *params = NULL;
@@ -3711,6 +3712,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3711 goto out; 3712 goto out;
3712 } 3713 }
3713 substream.runtime = runtime; 3714 substream.runtime = runtime;
3715 substream.private_data = rtd;
3714 3716
3715 switch (event) { 3717 switch (event) {
3716 case SND_SOC_DAPM_PRE_PMU: 3718 case SND_SOC_DAPM_PRE_PMU:
@@ -3895,6 +3897,7 @@ outfree_w_param:
3895} 3897}
3896 3898
3897int snd_soc_dapm_new_pcm(struct snd_soc_card *card, 3899int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
3900 struct snd_soc_pcm_runtime *rtd,
3898 const struct snd_soc_pcm_stream *params, 3901 const struct snd_soc_pcm_stream *params,
3899 unsigned int num_params, 3902 unsigned int num_params,
3900 struct snd_soc_dapm_widget *source, 3903 struct snd_soc_dapm_widget *source,
@@ -3963,6 +3966,7 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
3963 3966
3964 w->params = params; 3967 w->params = params;
3965 w->num_params = num_params; 3968 w->num_params = num_params;
3969 w->priv = rtd;
3966 3970
3967 ret = snd_soc_dapm_add_path(&card->dapm, source, w, NULL, NULL); 3971 ret = snd_soc_dapm_add_path(&card->dapm, source, w, NULL, NULL);
3968 if (ret) 3972 if (ret)