aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_native.c2
-rw-r--r--sound/firewire/amdtp.c5
-rw-r--r--sound/firewire/amdtp.h2
-rw-r--r--sound/firewire/fireworks/fireworks.c8
-rw-r--r--sound/firewire/fireworks/fireworks.h1
-rw-r--r--sound/firewire/fireworks/fireworks_stream.c9
-rw-r--r--sound/hda/ext/hdac_ext_controller.c6
-rw-r--r--sound/hda/ext/hdac_ext_stream.c2
-rw-r--r--sound/hda/hdac_i915.c5
-rw-r--r--sound/pci/hda/hda_intel.c32
-rw-r--r--sound/pci/hda/patch_cirrus.c4
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c80
-rw-r--r--sound/pci/hda/patch_sigmatel.c3
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c2
-rw-r--r--sound/soc/codecs/cs4265.c10
-rw-r--r--sound/soc/codecs/pcm1681.c2
-rw-r--r--sound/soc/codecs/rt5645.c5
-rw-r--r--sound/soc/codecs/rt5645.h4
-rw-r--r--sound/soc/codecs/sgtl5000.h2
-rw-r--r--sound/soc/codecs/ssm4567.c8
-rw-r--r--sound/soc/fsl/fsl_ssi.c2
-rw-r--r--sound/soc/intel/Makefile2
-rw-r--r--sound/soc/intel/atom/sst/sst_drv_interface.c14
-rw-r--r--sound/soc/intel/baytrail/sst-baytrail-ipc.c2
-rw-r--r--sound/soc/intel/boards/cht_bsw_max98090_ti.c4
-rw-r--r--sound/soc/intel/haswell/sst-haswell-ipc.c2
-rw-r--r--sound/soc/mediatek/mt8173-max98090.c17
-rw-r--r--sound/soc/mediatek/mt8173-rt5650-rt5676.c19
-rw-r--r--sound/soc/mediatek/mtk-afe-pcm.c2
-rw-r--r--sound/soc/soc-core.c1
-rw-r--r--sound/soc/soc-dapm.c35
-rw-r--r--sound/soc/soc-topology.c62
-rw-r--r--sound/soc/zte/zx296702-i2s.c4
-rw-r--r--sound/soc/zte/zx296702-spdif.c4
-rw-r--r--sound/sparc/amd7930.c1
-rw-r--r--sound/usb/mixer_maps.c24
37 files changed, 282 insertions, 107 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index d126c03361ae..75888dd38a7f 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -85,7 +85,7 @@ static DECLARE_RWSEM(snd_pcm_link_rwsem);
85void snd_pcm_stream_lock(struct snd_pcm_substream *substream) 85void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
86{ 86{
87 if (substream->pcm->nonatomic) { 87 if (substream->pcm->nonatomic) {
88 down_read(&snd_pcm_link_rwsem); 88 down_read_nested(&snd_pcm_link_rwsem, SINGLE_DEPTH_NESTING);
89 mutex_lock(&substream->self_group.mutex); 89 mutex_lock(&substream->self_group.mutex);
90 } else { 90 } else {
91 read_lock(&snd_pcm_link_rwlock); 91 read_lock(&snd_pcm_link_rwlock);
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c
index 7bb988fa6b6d..2a153d260836 100644
--- a/sound/firewire/amdtp.c
+++ b/sound/firewire/amdtp.c
@@ -740,8 +740,9 @@ static int handle_in_packet(struct amdtp_stream *s,
740 s->data_block_counter != UINT_MAX) 740 s->data_block_counter != UINT_MAX)
741 data_block_counter = s->data_block_counter; 741 data_block_counter = s->data_block_counter;
742 742
743 if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && data_block_counter == 0) || 743 if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) &&
744 (s->data_block_counter == UINT_MAX)) { 744 data_block_counter == s->tx_first_dbc) ||
745 s->data_block_counter == UINT_MAX) {
745 lost = false; 746 lost = false;
746 } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) { 747 } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
747 lost = data_block_counter != s->data_block_counter; 748 lost = data_block_counter != s->data_block_counter;
diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h
index 26b909329e54..b2cf9e75693b 100644
--- a/sound/firewire/amdtp.h
+++ b/sound/firewire/amdtp.h
@@ -157,6 +157,8 @@ struct amdtp_stream {
157 157
158 /* quirk: fixed interval of dbc between previos/current packets. */ 158 /* quirk: fixed interval of dbc between previos/current packets. */
159 unsigned int tx_dbc_interval; 159 unsigned int tx_dbc_interval;
160 /* quirk: indicate the value of dbc field in a first packet. */
161 unsigned int tx_first_dbc;
160 162
161 bool callbacked; 163 bool callbacked;
162 wait_queue_head_t callback_wait; 164 wait_queue_head_t callback_wait;
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c
index 2682e7e3e5c9..c94a432f7cc6 100644
--- a/sound/firewire/fireworks/fireworks.c
+++ b/sound/firewire/fireworks/fireworks.c
@@ -248,8 +248,16 @@ efw_probe(struct fw_unit *unit,
248 err = get_hardware_info(efw); 248 err = get_hardware_info(efw);
249 if (err < 0) 249 if (err < 0)
250 goto error; 250 goto error;
251 /* AudioFire8 (since 2009) and AudioFirePre8 */
251 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9) 252 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9)
252 efw->is_af9 = true; 253 efw->is_af9 = true;
254 /* These models uses the same firmware. */
255 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2 ||
256 entry->model_id == MODEL_ECHO_AUDIOFIRE_4 ||
257 entry->model_id == MODEL_ECHO_AUDIOFIRE_9 ||
258 entry->model_id == MODEL_GIBSON_RIP ||
259 entry->model_id == MODEL_GIBSON_GOLDTOP)
260 efw->is_fireworks3 = true;
253 261
254 snd_efw_proc_init(efw); 262 snd_efw_proc_init(efw);
255 263
diff --git a/sound/firewire/fireworks/fireworks.h b/sound/firewire/fireworks/fireworks.h
index 4f0201a95222..084d414b228c 100644
--- a/sound/firewire/fireworks/fireworks.h
+++ b/sound/firewire/fireworks/fireworks.h
@@ -71,6 +71,7 @@ struct snd_efw {
71 71
72 /* for quirks */ 72 /* for quirks */
73 bool is_af9; 73 bool is_af9;
74 bool is_fireworks3;
74 u32 firmware_version; 75 u32 firmware_version;
75 76
76 unsigned int midi_in_ports; 77 unsigned int midi_in_ports;
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c
index c55db1bddc80..7e353f1f7bff 100644
--- a/sound/firewire/fireworks/fireworks_stream.c
+++ b/sound/firewire/fireworks/fireworks_stream.c
@@ -172,6 +172,15 @@ int snd_efw_stream_init_duplex(struct snd_efw *efw)
172 efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT; 172 efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT;
173 /* Fireworks reset dbc at bus reset. */ 173 /* Fireworks reset dbc at bus reset. */
174 efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK; 174 efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK;
175 /*
176 * But Recent firmwares starts packets with non-zero dbc.
177 * Driver version 5.7.6 installs firmware version 5.7.3.
178 */
179 if (efw->is_fireworks3 &&
180 (efw->firmware_version == 0x5070000 ||
181 efw->firmware_version == 0x5070300 ||
182 efw->firmware_version == 0x5080000))
183 efw->tx_stream.tx_first_dbc = 0x02;
175 /* AudioFire9 always reports wrong dbs. */ 184 /* AudioFire9 always reports wrong dbs. */
176 if (efw->is_af9) 185 if (efw->is_af9)
177 efw->tx_stream.flags |= CIP_WRONG_DBS; 186 efw->tx_stream.flags |= CIP_WRONG_DBS;
diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c
index b2da19b60f4e..358f16195483 100644
--- a/sound/hda/ext/hdac_ext_controller.c
+++ b/sound/hda/ext/hdac_ext_controller.c
@@ -44,16 +44,10 @@ int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *ebus)
44 44
45 offset = snd_hdac_chip_readl(bus, LLCH); 45 offset = snd_hdac_chip_readl(bus, LLCH);
46 46
47 if (offset < 0)
48 return -EIO;
49
50 /* Lets walk the linked capabilities list */ 47 /* Lets walk the linked capabilities list */
51 do { 48 do {
52 cur_cap = _snd_hdac_chip_read(l, bus, offset); 49 cur_cap = _snd_hdac_chip_read(l, bus, offset);
53 50
54 if (cur_cap < 0)
55 return -EIO;
56
57 dev_dbg(bus->dev, "Capability version: 0x%x\n", 51 dev_dbg(bus->dev, "Capability version: 0x%x\n",
58 ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF)); 52 ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));
59 53
diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
index f8ffbdbb450d..3de47dd1a76d 100644
--- a/sound/hda/ext/hdac_ext_stream.c
+++ b/sound/hda/ext/hdac_ext_stream.c
@@ -299,7 +299,7 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
299 if (stream->direction != substream->stream) 299 if (stream->direction != substream->stream)
300 continue; 300 continue;
301 301
302 if (stream->opened) { 302 if (!stream->opened) {
303 if (!hstream->decoupled) 303 if (!hstream->decoupled)
304 snd_hdac_ext_stream_decouple(ebus, hstream, true); 304 snd_hdac_ext_stream_decouple(ebus, hstream, true);
305 res = hstream; 305 res = hstream;
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 442500e06b7c..5676b849379d 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -56,8 +56,11 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable)
56 enable ? "enable" : "disable"); 56 enable ? "enable" : "disable");
57 57
58 if (enable) { 58 if (enable) {
59 if (!bus->i915_power_refcount++) 59 if (!bus->i915_power_refcount++) {
60 acomp->ops->get_power(acomp->dev); 60 acomp->ops->get_power(acomp->dev);
61 snd_hdac_set_codec_wakeup(bus, true);
62 snd_hdac_set_codec_wakeup(bus, false);
63 }
61 } else { 64 } else {
62 WARN_ON(!bus->i915_power_refcount); 65 WARN_ON(!bus->i915_power_refcount);
63 if (!--bus->i915_power_refcount) 66 if (!--bus->i915_power_refcount)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 745535d1840a..c38c68f57938 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -867,7 +867,7 @@ static int azx_suspend(struct device *dev)
867 867
868 chip = card->private_data; 868 chip = card->private_data;
869 hda = container_of(chip, struct hda_intel, chip); 869 hda = container_of(chip, struct hda_intel, chip);
870 if (chip->disabled || hda->init_failed) 870 if (chip->disabled || hda->init_failed || !chip->running)
871 return 0; 871 return 0;
872 872
873 bus = azx_bus(chip); 873 bus = azx_bus(chip);
@@ -902,7 +902,7 @@ static int azx_resume(struct device *dev)
902 902
903 chip = card->private_data; 903 chip = card->private_data;
904 hda = container_of(chip, struct hda_intel, chip); 904 hda = container_of(chip, struct hda_intel, chip);
905 if (chip->disabled || hda->init_failed) 905 if (chip->disabled || hda->init_failed || !chip->running)
906 return 0; 906 return 0;
907 907
908 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL 908 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL
@@ -979,14 +979,16 @@ static int azx_runtime_resume(struct device *dev)
979 if (!azx_has_pm_runtime(chip)) 979 if (!azx_has_pm_runtime(chip))
980 return 0; 980 return 0;
981 981
982 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL 982 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
983 && hda->need_i915_power) { 983 bus = azx_bus(chip);
984 bus = azx_bus(chip); 984 if (hda->need_i915_power) {
985 snd_hdac_display_power(bus, true); 985 snd_hdac_display_power(bus, true);
986 haswell_set_bclk(hda); 986 haswell_set_bclk(hda);
987 /* toggle codec wakeup bit for STATESTS read */ 987 } else {
988 snd_hdac_set_codec_wakeup(bus, true); 988 /* toggle codec wakeup bit for STATESTS read */
989 snd_hdac_set_codec_wakeup(bus, false); 989 snd_hdac_set_codec_wakeup(bus, true);
990 snd_hdac_set_codec_wakeup(bus, false);
991 }
990 } 992 }
991 993
992 /* Read STATESTS before controller reset */ 994 /* Read STATESTS before controller reset */
@@ -1025,7 +1027,7 @@ static int azx_runtime_idle(struct device *dev)
1025 return 0; 1027 return 0;
1026 1028
1027 if (!power_save_controller || !azx_has_pm_runtime(chip) || 1029 if (!power_save_controller || !azx_has_pm_runtime(chip) ||
1028 azx_bus(chip)->codec_powered) 1030 azx_bus(chip)->codec_powered || !chip->running)
1029 return -EBUSY; 1031 return -EBUSY;
1030 1032
1031 return 0; 1033 return 0;
@@ -2182,6 +2184,8 @@ static const struct pci_device_id azx_ids[] = {
2182 /* ATI HDMI */ 2184 /* ATI HDMI */
2183 { PCI_DEVICE(0x1002, 0x1308), 2185 { PCI_DEVICE(0x1002, 0x1308),
2184 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, 2186 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2187 { PCI_DEVICE(0x1002, 0x157a),
2188 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2185 { PCI_DEVICE(0x1002, 0x793b), 2189 { PCI_DEVICE(0x1002, 0x793b),
2186 .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, 2190 .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI },
2187 { PCI_DEVICE(0x1002, 0x7919), 2191 { PCI_DEVICE(0x1002, 0x7919),
@@ -2236,8 +2240,14 @@ static const struct pci_device_id azx_ids[] = {
2236 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, 2240 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2237 { PCI_DEVICE(0x1002, 0xaab0), 2241 { PCI_DEVICE(0x1002, 0xaab0),
2238 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, 2242 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2243 { PCI_DEVICE(0x1002, 0xaac0),
2244 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2239 { PCI_DEVICE(0x1002, 0xaac8), 2245 { PCI_DEVICE(0x1002, 0xaac8),
2240 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, 2246 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2247 { PCI_DEVICE(0x1002, 0xaad8),
2248 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2249 { PCI_DEVICE(0x1002, 0xaae8),
2250 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
2241 /* VIA VT8251/VT8237A */ 2251 /* VIA VT8251/VT8237A */
2242 { PCI_DEVICE(0x1106, 0x3288), 2252 { PCI_DEVICE(0x1106, 0x3288),
2243 .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, 2253 .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA },
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 25ccf781fbe7..584a0343ab0c 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -999,9 +999,7 @@ static void cs4210_spdif_automute(struct hda_codec *codec,
999 999
1000 spec->spdif_present = spdif_present; 1000 spec->spdif_present = spdif_present;
1001 /* SPDIF TX on/off */ 1001 /* SPDIF TX on/off */
1002 if (spdif_present) 1002 snd_hda_set_pin_ctl(codec, spdif_pin, spdif_present ? PIN_OUT : 0);
1003 snd_hda_set_pin_ctl(codec, spdif_pin,
1004 spdif_present ? PIN_OUT : 0);
1005 1003
1006 cs_automute(codec); 1004 cs_automute(codec);
1007} 1005}
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 95158914cc6c..a97db5fc8a15 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -3512,6 +3512,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = {
3512{ .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, 3512{ .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi },
3513{ .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, 3513{ .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi },
3514{ .id = 0x10de0072, .name = "GPU 72 HDMI/DP", .patch = patch_nvhdmi }, 3514{ .id = 0x10de0072, .name = "GPU 72 HDMI/DP", .patch = patch_nvhdmi },
3515{ .id = 0x10de007d, .name = "GPU 7d HDMI/DP", .patch = patch_nvhdmi },
3515{ .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, 3516{ .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch },
3516{ .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, 3517{ .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi },
3517{ .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, 3518{ .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi },
@@ -3576,6 +3577,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0067");
3576MODULE_ALIAS("snd-hda-codec-id:10de0070"); 3577MODULE_ALIAS("snd-hda-codec-id:10de0070");
3577MODULE_ALIAS("snd-hda-codec-id:10de0071"); 3578MODULE_ALIAS("snd-hda-codec-id:10de0071");
3578MODULE_ALIAS("snd-hda-codec-id:10de0072"); 3579MODULE_ALIAS("snd-hda-codec-id:10de0072");
3580MODULE_ALIAS("snd-hda-codec-id:10de007d");
3579MODULE_ALIAS("snd-hda-codec-id:10de8001"); 3581MODULE_ALIAS("snd-hda-codec-id:10de8001");
3580MODULE_ALIAS("snd-hda-codec-id:11069f80"); 3582MODULE_ALIAS("snd-hda-codec-id:11069f80");
3581MODULE_ALIAS("snd-hda-codec-id:11069f81"); 3583MODULE_ALIAS("snd-hda-codec-id:11069f81");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d35cf506a7db..0b9847affbec 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2222,7 +2222,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2222 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), 2222 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2223 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), 2223 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2224 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), 2224 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2225 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), 2225 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2226 2226
2227 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), 2227 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2228 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), 2228 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
@@ -5061,7 +5061,7 @@ static const struct hda_fixup alc269_fixups[] = {
5061 { 0x14, 0x90170110 }, 5061 { 0x14, 0x90170110 },
5062 { 0x17, 0x40000008 }, 5062 { 0x17, 0x40000008 },
5063 { 0x18, 0x411111f0 }, 5063 { 0x18, 0x411111f0 },
5064 { 0x19, 0x411111f0 }, 5064 { 0x19, 0x01a1913c },
5065 { 0x1a, 0x411111f0 }, 5065 { 0x1a, 0x411111f0 },
5066 { 0x1b, 0x411111f0 }, 5066 { 0x1b, 0x411111f0 },
5067 { 0x1d, 0x40f89b2d }, 5067 { 0x1d, 0x40f89b2d },
@@ -5185,9 +5185,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5185 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5185 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5186 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5186 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5187 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13), 5187 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
5188 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
5188 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 5189 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
5189 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5190 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5190 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5191 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5192 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
5191 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5193 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5192 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5194 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5193 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), 5195 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -5398,8 +5400,6 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
5398 {0x19, 0x411111f0}, \ 5400 {0x19, 0x411111f0}, \
5399 {0x1a, 0x411111f0}, \ 5401 {0x1a, 0x411111f0}, \
5400 {0x1b, 0x411111f0}, \ 5402 {0x1b, 0x411111f0}, \
5401 {0x1d, 0x40700001}, \
5402 {0x1e, 0x411111f0}, \
5403 {0x21, 0x02211020} 5403 {0x21, 0x02211020}
5404 5404
5405#define ALC282_STANDARD_PINS \ 5405#define ALC282_STANDARD_PINS \
@@ -5430,8 +5430,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
5430 {0x15, 0x0221401f}, \ 5430 {0x15, 0x0221401f}, \
5431 {0x1a, 0x411111f0}, \ 5431 {0x1a, 0x411111f0}, \
5432 {0x1b, 0x411111f0}, \ 5432 {0x1b, 0x411111f0}, \
5433 {0x1d, 0x40700001}, \ 5433 {0x1d, 0x40700001}
5434 {0x1e, 0x411111f0}
5435 5434
5436#define ALC298_STANDARD_PINS \ 5435#define ALC298_STANDARD_PINS \
5437 {0x18, 0x411111f0}, \ 5436 {0x18, 0x411111f0}, \
@@ -5463,6 +5462,39 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5463 {0x1d, 0x40700001}, 5462 {0x1d, 0x40700001},
5464 {0x21, 0x02211030}), 5463 {0x21, 0x02211030}),
5465 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 5464 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5465 {0x12, 0x40000000},
5466 {0x14, 0x90170130},
5467 {0x17, 0x411111f0},
5468 {0x18, 0x411111f0},
5469 {0x19, 0x411111f0},
5470 {0x1a, 0x411111f0},
5471 {0x1b, 0x01014020},
5472 {0x1d, 0x4054c029},
5473 {0x1e, 0x411111f0},
5474 {0x21, 0x0221103f}),
5475 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5476 {0x12, 0x40000000},
5477 {0x14, 0x90170150},
5478 {0x17, 0x411111f0},
5479 {0x18, 0x411111f0},
5480 {0x19, 0x411111f0},
5481 {0x1a, 0x411111f0},
5482 {0x1b, 0x02011020},
5483 {0x1d, 0x4054c029},
5484 {0x1e, 0x411111f0},
5485 {0x21, 0x0221105f}),
5486 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5487 {0x12, 0x40000000},
5488 {0x14, 0x90170110},
5489 {0x17, 0x411111f0},
5490 {0x18, 0x411111f0},
5491 {0x19, 0x411111f0},
5492 {0x1a, 0x411111f0},
5493 {0x1b, 0x01014020},
5494 {0x1d, 0x4054c029},
5495 {0x1e, 0x411111f0},
5496 {0x21, 0x0221101f}),
5497 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5466 {0x12, 0x90a60160}, 5498 {0x12, 0x90a60160},
5467 {0x14, 0x90170120}, 5499 {0x14, 0x90170120},
5468 {0x17, 0x90170140}, 5500 {0x17, 0x90170140},
@@ -5524,10 +5556,19 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5524 {0x21, 0x02211030}), 5556 {0x21, 0x02211030}),
5525 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 5557 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5526 ALC256_STANDARD_PINS, 5558 ALC256_STANDARD_PINS,
5527 {0x13, 0x40000000}), 5559 {0x13, 0x40000000},
5560 {0x1d, 0x40700001},
5561 {0x1e, 0x411111f0}),
5562 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5563 ALC256_STANDARD_PINS,
5564 {0x13, 0x411111f0},
5565 {0x1d, 0x40700001},
5566 {0x1e, 0x411111f0}),
5528 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 5567 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5529 ALC256_STANDARD_PINS, 5568 ALC256_STANDARD_PINS,
5530 {0x13, 0x411111f0}), 5569 {0x13, 0x411111f0},
5570 {0x1d, 0x4077992d},
5571 {0x1e, 0x411111ff}),
5531 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, 5572 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
5532 {0x12, 0x90a60130}, 5573 {0x12, 0x90a60130},
5533 {0x13, 0x40000000}, 5574 {0x13, 0x40000000},
@@ -5690,35 +5731,48 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5690 {0x13, 0x411111f0}, 5731 {0x13, 0x411111f0},
5691 {0x16, 0x01014020}, 5732 {0x16, 0x01014020},
5692 {0x18, 0x411111f0}, 5733 {0x18, 0x411111f0},
5693 {0x19, 0x01a19030}), 5734 {0x19, 0x01a19030},
5735 {0x1e, 0x411111f0}),
5694 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, 5736 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5695 ALC292_STANDARD_PINS, 5737 ALC292_STANDARD_PINS,
5696 {0x12, 0x90a60140}, 5738 {0x12, 0x90a60140},
5697 {0x13, 0x411111f0}, 5739 {0x13, 0x411111f0},
5698 {0x16, 0x01014020}, 5740 {0x16, 0x01014020},
5699 {0x18, 0x02a19031}, 5741 {0x18, 0x02a19031},
5700 {0x19, 0x01a1903e}), 5742 {0x19, 0x01a1903e},
5743 {0x1e, 0x411111f0}),
5701 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, 5744 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5702 ALC292_STANDARD_PINS, 5745 ALC292_STANDARD_PINS,
5703 {0x12, 0x90a60140}, 5746 {0x12, 0x90a60140},
5704 {0x13, 0x411111f0}, 5747 {0x13, 0x411111f0},
5705 {0x16, 0x411111f0}, 5748 {0x16, 0x411111f0},
5706 {0x18, 0x411111f0}, 5749 {0x18, 0x411111f0},
5707 {0x19, 0x411111f0}), 5750 {0x19, 0x411111f0},
5751 {0x1e, 0x411111f0}),
5708 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, 5752 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5709 ALC292_STANDARD_PINS, 5753 ALC292_STANDARD_PINS,
5710 {0x12, 0x40000000}, 5754 {0x12, 0x40000000},
5711 {0x13, 0x90a60140}, 5755 {0x13, 0x90a60140},
5712 {0x16, 0x21014020}, 5756 {0x16, 0x21014020},
5713 {0x18, 0x411111f0}, 5757 {0x18, 0x411111f0},
5714 {0x19, 0x21a19030}), 5758 {0x19, 0x21a19030},
5759 {0x1e, 0x411111f0}),
5715 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, 5760 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5716 ALC292_STANDARD_PINS, 5761 ALC292_STANDARD_PINS,
5717 {0x12, 0x40000000}, 5762 {0x12, 0x40000000},
5718 {0x13, 0x90a60140}, 5763 {0x13, 0x90a60140},
5719 {0x16, 0x411111f0}, 5764 {0x16, 0x411111f0},
5720 {0x18, 0x411111f0}, 5765 {0x18, 0x411111f0},
5721 {0x19, 0x411111f0}), 5766 {0x19, 0x411111f0},
5767 {0x1e, 0x411111f0}),
5768 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5769 ALC292_STANDARD_PINS,
5770 {0x12, 0x40000000},
5771 {0x13, 0x90a60140},
5772 {0x16, 0x21014020},
5773 {0x18, 0x411111f0},
5774 {0x19, 0x21a19030},
5775 {0x1e, 0x411111ff}),
5722 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, 5776 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
5723 ALC298_STANDARD_PINS, 5777 ALC298_STANDARD_PINS,
5724 {0x12, 0x90a60130}, 5778 {0x12, 0x90a60130},
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index dcc7fe91244c..9d947aef2c8b 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2920,7 +2920,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
2920 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a, 2920 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
2921 "HP Mini", STAC_92HD83XXX_HP_LED), 2921 "HP Mini", STAC_92HD83XXX_HP_LED),
2922 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP), 2922 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
2923 SND_PCI_QUIRK(PCI_VENDOR_ID_TOSHIBA, 0xfa91, 2923 /* match both for 0xfa91 and 0xfa93 */
2924 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_TOSHIBA, 0xfffd, 0xfa91,
2924 "Toshiba Satellite S50D", STAC_92HD83XXX_GPIO10_EAPD), 2925 "Toshiba Satellite S50D", STAC_92HD83XXX_GPIO10_EAPD),
2925 {} /* terminator */ 2926 {} /* terminator */
2926}; 2927};
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 6492bca8c70f..4ca12665ff73 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -88,7 +88,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl,
88 int changed; 88 int changed;
89 89
90 mutex_lock(&chip->mutex); 90 mutex_lock(&chip->mutex);
91 changed = !value->value.integer.value[0] != chip->dac_mute; 91 changed = (!value->value.integer.value[0]) != chip->dac_mute;
92 if (changed) { 92 if (changed) {
93 chip->dac_mute = !value->value.integer.value[0]; 93 chip->dac_mute = !value->value.integer.value[0];
94 chip->model.update_dac_mute(chip); 94 chip->model.update_dac_mute(chip);
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
index d7ec4756e45b..8e36198474d9 100644
--- a/sound/soc/codecs/cs4265.c
+++ b/sound/soc/codecs/cs4265.c
@@ -457,14 +457,14 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
457 case SND_SOC_DAIFMT_RIGHT_J: 457 case SND_SOC_DAIFMT_RIGHT_J:
458 if (params_width(params) == 16) { 458 if (params_width(params) == 16) {
459 snd_soc_update_bits(codec, CS4265_DAC_CTL, 459 snd_soc_update_bits(codec, CS4265_DAC_CTL,
460 CS4265_DAC_CTL_DIF, (1 << 5)); 460 CS4265_DAC_CTL_DIF, (2 << 4));
461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
462 CS4265_SPDIF_CTL2_DIF, (1 << 7)); 462 CS4265_SPDIF_CTL2_DIF, (2 << 6));
463 } else { 463 } else {
464 snd_soc_update_bits(codec, CS4265_DAC_CTL, 464 snd_soc_update_bits(codec, CS4265_DAC_CTL,
465 CS4265_DAC_CTL_DIF, (3 << 5)); 465 CS4265_DAC_CTL_DIF, (3 << 4));
466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
467 CS4265_SPDIF_CTL2_DIF, (1 << 7)); 467 CS4265_SPDIF_CTL2_DIF, (3 << 6));
468 } 468 }
469 break; 469 break;
470 case SND_SOC_DAIFMT_LEFT_J: 470 case SND_SOC_DAIFMT_LEFT_J:
@@ -473,7 +473,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
473 snd_soc_update_bits(codec, CS4265_ADC_CTL, 473 snd_soc_update_bits(codec, CS4265_ADC_CTL,
474 CS4265_ADC_DIF, 0); 474 CS4265_ADC_DIF, 0);
475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
476 CS4265_SPDIF_CTL2_DIF, (1 << 6)); 476 CS4265_SPDIF_CTL2_DIF, 0);
477 477
478 break; 478 break;
479 default: 479 default:
diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index 477e13d30971..e7ba557979cb 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -102,7 +102,7 @@ static int pcm1681_set_deemph(struct snd_soc_codec *codec)
102 102
103 if (val != -1) { 103 if (val != -1) {
104 regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL, 104 regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,
105 PCM1681_DEEMPH_RATE_MASK, val); 105 PCM1681_DEEMPH_RATE_MASK, val << 3);
106 enable = 1; 106 enable = 1;
107 } else 107 } else
108 enable = 0; 108 enable = 0;
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 9ce311e088fc..961bd7e5877e 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -2943,6 +2943,9 @@ static int rt5645_irq_detection(struct rt5645_priv *rt5645)
2943{ 2943{
2944 int val, btn_type, gpio_state = 0, report = 0; 2944 int val, btn_type, gpio_state = 0, report = 0;
2945 2945
2946 if (!rt5645->codec)
2947 return -EINVAL;
2948
2946 switch (rt5645->pdata.jd_mode) { 2949 switch (rt5645->pdata.jd_mode) {
2947 case 0: /* Not using rt5645 JD */ 2950 case 0: /* Not using rt5645 JD */
2948 if (rt5645->gpiod_hp_det) { 2951 if (rt5645->gpiod_hp_det) {
@@ -3338,6 +3341,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
3338 break; 3341 break;
3339 3342
3340 case RT5645_DMIC_DATA_GPIO5: 3343 case RT5645_DMIC_DATA_GPIO5:
3344 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
3345 RT5645_I2S2_DAC_PIN_MASK, RT5645_I2S2_DAC_PIN_GPIO);
3341 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, 3346 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1,
3342 RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5); 3347 RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5);
3343 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, 3348 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index 0353a6a273ab..278bb9f464c4 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -1693,6 +1693,10 @@
1693#define RT5645_GP6_PIN_SFT 6 1693#define RT5645_GP6_PIN_SFT 6
1694#define RT5645_GP6_PIN_GPIO6 (0x0 << 6) 1694#define RT5645_GP6_PIN_GPIO6 (0x0 << 6)
1695#define RT5645_GP6_PIN_DMIC2_SDA (0x1 << 6) 1695#define RT5645_GP6_PIN_DMIC2_SDA (0x1 << 6)
1696#define RT5645_I2S2_DAC_PIN_MASK (0x1 << 4)
1697#define RT5645_I2S2_DAC_PIN_SFT 4
1698#define RT5645_I2S2_DAC_PIN_I2S (0x0 << 4)
1699#define RT5645_I2S2_DAC_PIN_GPIO (0x1 << 4)
1696#define RT5645_GP8_PIN_MASK (0x1 << 3) 1700#define RT5645_GP8_PIN_MASK (0x1 << 3)
1697#define RT5645_GP8_PIN_SFT 3 1701#define RT5645_GP8_PIN_SFT 3
1698#define RT5645_GP8_PIN_GPIO8 (0x0 << 3) 1702#define RT5645_GP8_PIN_GPIO8 (0x0 << 3)
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
index bd7a344bf8c5..1c317de26176 100644
--- a/sound/soc/codecs/sgtl5000.h
+++ b/sound/soc/codecs/sgtl5000.h
@@ -275,7 +275,7 @@
275#define SGTL5000_BIAS_CTRL_MASK 0x000e 275#define SGTL5000_BIAS_CTRL_MASK 0x000e
276#define SGTL5000_BIAS_CTRL_SHIFT 1 276#define SGTL5000_BIAS_CTRL_SHIFT 1
277#define SGTL5000_BIAS_CTRL_WIDTH 3 277#define SGTL5000_BIAS_CTRL_WIDTH 3
278#define SGTL5000_SMALL_POP 0 278#define SGTL5000_SMALL_POP 1
279 279
280/* 280/*
281 * SGTL5000_CHIP_MIC_CTRL 281 * SGTL5000_CHIP_MIC_CTRL
diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c
index 938d2cb6d78b..84a4f5ad8064 100644
--- a/sound/soc/codecs/ssm4567.c
+++ b/sound/soc/codecs/ssm4567.c
@@ -315,7 +315,13 @@ static int ssm4567_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
315 if (invert_fclk) 315 if (invert_fclk)
316 ctrl1 |= SSM4567_SAI_CTRL_1_FSYNC; 316 ctrl1 |= SSM4567_SAI_CTRL_1_FSYNC;
317 317
318 return regmap_write(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1, ctrl1); 318 return regmap_update_bits(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1,
319 SSM4567_SAI_CTRL_1_BCLK |
320 SSM4567_SAI_CTRL_1_FSYNC |
321 SSM4567_SAI_CTRL_1_LJ |
322 SSM4567_SAI_CTRL_1_TDM |
323 SSM4567_SAI_CTRL_1_PDM,
324 ctrl1);
319} 325}
320 326
321static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable) 327static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index c7647e066cfd..c0b940e2019f 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -633,7 +633,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
633 sub *= 100000; 633 sub *= 100000;
634 do_div(sub, freq); 634 do_div(sub, freq);
635 635
636 if (sub < savesub) { 636 if (sub < savesub && !(i == 0 && psr == 0 && div2 == 0)) {
637 baudrate = tmprate; 637 baudrate = tmprate;
638 savesub = sub; 638 savesub = sub;
639 pm = i; 639 pm = i;
diff --git a/sound/soc/intel/Makefile b/sound/soc/intel/Makefile
index 3853ec2ddbc7..6de5d5cd3280 100644
--- a/sound/soc/intel/Makefile
+++ b/sound/soc/intel/Makefile
@@ -7,4 +7,4 @@ obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += baytrail/
7obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += atom/ 7obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += atom/
8 8
9# Machine support 9# Machine support
10obj-$(CONFIG_SND_SOC_INTEL_SST) += boards/ 10obj-$(CONFIG_SND_SOC) += boards/
diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index 620da1d1b9e3..0e0e4d9c021f 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -42,6 +42,11 @@
42#define MIN_FRAGMENT_SIZE (50 * 1024) 42#define MIN_FRAGMENT_SIZE (50 * 1024)
43#define MAX_FRAGMENT_SIZE (1024 * 1024) 43#define MAX_FRAGMENT_SIZE (1024 * 1024)
44#define SST_GET_BYTES_PER_SAMPLE(pcm_wd_sz) (((pcm_wd_sz + 15) >> 4) << 1) 44#define SST_GET_BYTES_PER_SAMPLE(pcm_wd_sz) (((pcm_wd_sz + 15) >> 4) << 1)
45#ifdef CONFIG_PM
46#define GET_USAGE_COUNT(dev) (atomic_read(&dev->power.usage_count))
47#else
48#define GET_USAGE_COUNT(dev) 1
49#endif
45 50
46int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id) 51int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
47{ 52{
@@ -141,15 +146,9 @@ static int sst_power_control(struct device *dev, bool state)
141 int ret = 0; 146 int ret = 0;
142 int usage_count = 0; 147 int usage_count = 0;
143 148
144#ifdef CONFIG_PM
145 usage_count = atomic_read(&dev->power.usage_count);
146#else
147 usage_count = 1;
148#endif
149
150 if (state == true) { 149 if (state == true) {
151 ret = pm_runtime_get_sync(dev); 150 ret = pm_runtime_get_sync(dev);
152 151 usage_count = GET_USAGE_COUNT(dev);
153 dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count); 152 dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
154 if (ret < 0) { 153 if (ret < 0) {
155 dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret); 154 dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
@@ -164,6 +163,7 @@ static int sst_power_control(struct device *dev, bool state)
164 } 163 }
165 } 164 }
166 } else { 165 } else {
166 usage_count = GET_USAGE_COUNT(dev);
167 dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count); 167 dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
168 return sst_pm_runtime_put(ctx); 168 return sst_pm_runtime_put(ctx);
169 } 169 }
diff --git a/sound/soc/intel/baytrail/sst-baytrail-ipc.c b/sound/soc/intel/baytrail/sst-baytrail-ipc.c
index 4c01bb43928d..5bbaa667bec1 100644
--- a/sound/soc/intel/baytrail/sst-baytrail-ipc.c
+++ b/sound/soc/intel/baytrail/sst-baytrail-ipc.c
@@ -701,6 +701,8 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
701 if (byt == NULL) 701 if (byt == NULL)
702 return -ENOMEM; 702 return -ENOMEM;
703 703
704 byt->dev = dev;
705
704 ipc = &byt->ipc; 706 ipc = &byt->ipc;
705 ipc->dev = dev; 707 ipc->dev = dev;
706 ipc->ops.tx_msg = byt_tx_msg; 708 ipc->ops.tx_msg = byt_tx_msg;
diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index d604ee80eda4..70f832114a5a 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -69,12 +69,12 @@ static const struct snd_soc_dapm_route cht_audio_map[] = {
69 {"Headphone", NULL, "HPR"}, 69 {"Headphone", NULL, "HPR"},
70 {"Ext Spk", NULL, "SPKL"}, 70 {"Ext Spk", NULL, "SPKL"},
71 {"Ext Spk", NULL, "SPKR"}, 71 {"Ext Spk", NULL, "SPKR"},
72 {"AIF1 Playback", NULL, "ssp2 Tx"}, 72 {"HiFi Playback", NULL, "ssp2 Tx"},
73 {"ssp2 Tx", NULL, "codec_out0"}, 73 {"ssp2 Tx", NULL, "codec_out0"},
74 {"ssp2 Tx", NULL, "codec_out1"}, 74 {"ssp2 Tx", NULL, "codec_out1"},
75 {"codec_in0", NULL, "ssp2 Rx" }, 75 {"codec_in0", NULL, "ssp2 Rx" },
76 {"codec_in1", NULL, "ssp2 Rx" }, 76 {"codec_in1", NULL, "ssp2 Rx" },
77 {"ssp2 Rx", NULL, "AIF1 Capture"}, 77 {"ssp2 Rx", NULL, "HiFi Capture"},
78}; 78};
79 79
80static const struct snd_kcontrol_new cht_mc_controls[] = { 80static const struct snd_kcontrol_new cht_mc_controls[] = {
diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c b/sound/soc/intel/haswell/sst-haswell-ipc.c
index f95f271aab0c..f6efa9d4acad 100644
--- a/sound/soc/intel/haswell/sst-haswell-ipc.c
+++ b/sound/soc/intel/haswell/sst-haswell-ipc.c
@@ -2119,6 +2119,8 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata)
2119 if (hsw == NULL) 2119 if (hsw == NULL)
2120 return -ENOMEM; 2120 return -ENOMEM;
2121 2121
2122 hsw->dev = dev;
2123
2122 ipc = &hsw->ipc; 2124 ipc = &hsw->ipc;
2123 ipc->dev = dev; 2125 ipc->dev = dev;
2124 ipc->ops.tx_msg = hsw_tx_msg; 2126 ipc->ops.tx_msg = hsw_tx_msg;
diff --git a/sound/soc/mediatek/mt8173-max98090.c b/sound/soc/mediatek/mt8173-max98090.c
index 4d44b5803e55..2d2536af141f 100644
--- a/sound/soc/mediatek/mt8173-max98090.c
+++ b/sound/soc/mediatek/mt8173-max98090.c
@@ -103,7 +103,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
103 .name = "MAX98090 Playback", 103 .name = "MAX98090 Playback",
104 .stream_name = "MAX98090 Playback", 104 .stream_name = "MAX98090 Playback",
105 .cpu_dai_name = "DL1", 105 .cpu_dai_name = "DL1",
106 .platform_name = "11220000.mt8173-afe-pcm",
107 .codec_name = "snd-soc-dummy", 106 .codec_name = "snd-soc-dummy",
108 .codec_dai_name = "snd-soc-dummy-dai", 107 .codec_dai_name = "snd-soc-dummy-dai",
109 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 108 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -114,7 +113,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
114 .name = "MAX98090 Capture", 113 .name = "MAX98090 Capture",
115 .stream_name = "MAX98090 Capture", 114 .stream_name = "MAX98090 Capture",
116 .cpu_dai_name = "VUL", 115 .cpu_dai_name = "VUL",
117 .platform_name = "11220000.mt8173-afe-pcm",
118 .codec_name = "snd-soc-dummy", 116 .codec_name = "snd-soc-dummy",
119 .codec_dai_name = "snd-soc-dummy-dai", 117 .codec_dai_name = "snd-soc-dummy-dai",
120 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 118 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -125,7 +123,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
125 { 123 {
126 .name = "Codec", 124 .name = "Codec",
127 .cpu_dai_name = "I2S", 125 .cpu_dai_name = "I2S",
128 .platform_name = "11220000.mt8173-afe-pcm",
129 .no_pcm = 1, 126 .no_pcm = 1,
130 .codec_dai_name = "HiFi", 127 .codec_dai_name = "HiFi",
131 .init = mt8173_max98090_init, 128 .init = mt8173_max98090_init,
@@ -152,9 +149,21 @@ static struct snd_soc_card mt8173_max98090_card = {
152static int mt8173_max98090_dev_probe(struct platform_device *pdev) 149static int mt8173_max98090_dev_probe(struct platform_device *pdev)
153{ 150{
154 struct snd_soc_card *card = &mt8173_max98090_card; 151 struct snd_soc_card *card = &mt8173_max98090_card;
155 struct device_node *codec_node; 152 struct device_node *codec_node, *platform_node;
156 int ret, i; 153 int ret, i;
157 154
155 platform_node = of_parse_phandle(pdev->dev.of_node,
156 "mediatek,platform", 0);
157 if (!platform_node) {
158 dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
159 return -EINVAL;
160 }
161 for (i = 0; i < card->num_links; i++) {
162 if (mt8173_max98090_dais[i].platform_name)
163 continue;
164 mt8173_max98090_dais[i].platform_of_node = platform_node;
165 }
166
158 codec_node = of_parse_phandle(pdev->dev.of_node, 167 codec_node = of_parse_phandle(pdev->dev.of_node,
159 "mediatek,audio-codec", 0); 168 "mediatek,audio-codec", 0);
160 if (!codec_node) { 169 if (!codec_node) {
diff --git a/sound/soc/mediatek/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173-rt5650-rt5676.c
index 094055323059..6f52eca05e26 100644
--- a/sound/soc/mediatek/mt8173-rt5650-rt5676.c
+++ b/sound/soc/mediatek/mt8173-rt5650-rt5676.c
@@ -138,7 +138,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
138 .name = "rt5650_rt5676 Playback", 138 .name = "rt5650_rt5676 Playback",
139 .stream_name = "rt5650_rt5676 Playback", 139 .stream_name = "rt5650_rt5676 Playback",
140 .cpu_dai_name = "DL1", 140 .cpu_dai_name = "DL1",
141 .platform_name = "11220000.mt8173-afe-pcm",
142 .codec_name = "snd-soc-dummy", 141 .codec_name = "snd-soc-dummy",
143 .codec_dai_name = "snd-soc-dummy-dai", 142 .codec_dai_name = "snd-soc-dummy-dai",
144 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 143 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -149,7 +148,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
149 .name = "rt5650_rt5676 Capture", 148 .name = "rt5650_rt5676 Capture",
150 .stream_name = "rt5650_rt5676 Capture", 149 .stream_name = "rt5650_rt5676 Capture",
151 .cpu_dai_name = "VUL", 150 .cpu_dai_name = "VUL",
152 .platform_name = "11220000.mt8173-afe-pcm",
153 .codec_name = "snd-soc-dummy", 151 .codec_name = "snd-soc-dummy",
154 .codec_dai_name = "snd-soc-dummy-dai", 152 .codec_dai_name = "snd-soc-dummy-dai",
155 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 153 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -161,7 +159,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
161 { 159 {
162 .name = "Codec", 160 .name = "Codec",
163 .cpu_dai_name = "I2S", 161 .cpu_dai_name = "I2S",
164 .platform_name = "11220000.mt8173-afe-pcm",
165 .no_pcm = 1, 162 .no_pcm = 1,
166 .codecs = mt8173_rt5650_rt5676_codecs, 163 .codecs = mt8173_rt5650_rt5676_codecs,
167 .num_codecs = 2, 164 .num_codecs = 2,
@@ -209,7 +206,21 @@ static struct snd_soc_card mt8173_rt5650_rt5676_card = {
209static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) 206static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)
210{ 207{
211 struct snd_soc_card *card = &mt8173_rt5650_rt5676_card; 208 struct snd_soc_card *card = &mt8173_rt5650_rt5676_card;
212 int ret; 209 struct device_node *platform_node;
210 int i, ret;
211
212 platform_node = of_parse_phandle(pdev->dev.of_node,
213 "mediatek,platform", 0);
214 if (!platform_node) {
215 dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
216 return -EINVAL;
217 }
218
219 for (i = 0; i < card->num_links; i++) {
220 if (mt8173_rt5650_rt5676_dais[i].platform_name)
221 continue;
222 mt8173_rt5650_rt5676_dais[i].platform_of_node = platform_node;
223 }
213 224
214 mt8173_rt5650_rt5676_codecs[0].of_node = 225 mt8173_rt5650_rt5676_codecs[0].of_node =
215 of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0); 226 of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0);
diff --git a/sound/soc/mediatek/mtk-afe-pcm.c b/sound/soc/mediatek/mtk-afe-pcm.c
index cc228db5fb76..9863da73dfe0 100644
--- a/sound/soc/mediatek/mtk-afe-pcm.c
+++ b/sound/soc/mediatek/mtk-afe-pcm.c
@@ -1199,6 +1199,8 @@ err_pm_disable:
1199static int mtk_afe_pcm_dev_remove(struct platform_device *pdev) 1199static int mtk_afe_pcm_dev_remove(struct platform_device *pdev)
1200{ 1200{
1201 pm_runtime_disable(&pdev->dev); 1201 pm_runtime_disable(&pdev->dev);
1202 if (!pm_runtime_status_suspended(&pdev->dev))
1203 mtk_afe_runtime_suspend(&pdev->dev);
1202 snd_soc_unregister_component(&pdev->dev); 1204 snd_soc_unregister_component(&pdev->dev);
1203 snd_soc_unregister_platform(&pdev->dev); 1205 snd_soc_unregister_platform(&pdev->dev);
1204 return 0; 1206 return 0;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3a4a5c0e3f97..0e1e69c7abd5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1716,6 +1716,7 @@ card_probe_error:
1716 if (card->remove) 1716 if (card->remove)
1717 card->remove(card); 1717 card->remove(card);
1718 1718
1719 snd_soc_dapm_free(&card->dapm);
1719 soc_cleanup_card_debugfs(card); 1720 soc_cleanup_card_debugfs(card);
1720 snd_card_free(card->snd_card); 1721 snd_card_free(card->snd_card);
1721 1722
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index aa327c92480c..e0de8072c514 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -358,9 +358,10 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
358 data->widget = 358 data->widget =
359 snd_soc_dapm_new_control_unlocked(widget->dapm, 359 snd_soc_dapm_new_control_unlocked(widget->dapm,
360 &template); 360 &template);
361 kfree(name);
361 if (!data->widget) { 362 if (!data->widget) {
362 ret = -ENOMEM; 363 ret = -ENOMEM;
363 goto err_name; 364 goto err_data;
364 } 365 }
365 } 366 }
366 break; 367 break;
@@ -389,11 +390,12 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
389 390
390 data->value = template.on_val; 391 data->value = template.on_val;
391 392
392 data->widget = snd_soc_dapm_new_control(widget->dapm, 393 data->widget = snd_soc_dapm_new_control_unlocked(
393 &template); 394 widget->dapm, &template);
395 kfree(name);
394 if (!data->widget) { 396 if (!data->widget) {
395 ret = -ENOMEM; 397 ret = -ENOMEM;
396 goto err_name; 398 goto err_data;
397 } 399 }
398 400
399 snd_soc_dapm_add_path(widget->dapm, data->widget, 401 snd_soc_dapm_add_path(widget->dapm, data->widget,
@@ -408,8 +410,6 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
408 410
409 return 0; 411 return 0;
410 412
411err_name:
412 kfree(name);
413err_data: 413err_data:
414 kfree(data); 414 kfree(data);
415 return ret; 415 return ret;
@@ -418,8 +418,6 @@ err_data:
418static void dapm_kcontrol_free(struct snd_kcontrol *kctl) 418static void dapm_kcontrol_free(struct snd_kcontrol *kctl)
419{ 419{
420 struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl); 420 struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl);
421 if (data->widget)
422 kfree(data->widget->name);
423 kfree(data->wlist); 421 kfree(data->wlist);
424 kfree(data); 422 kfree(data);
425} 423}
@@ -1952,6 +1950,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1952 size_t count, loff_t *ppos) 1950 size_t count, loff_t *ppos)
1953{ 1951{
1954 struct snd_soc_dapm_widget *w = file->private_data; 1952 struct snd_soc_dapm_widget *w = file->private_data;
1953 struct snd_soc_card *card = w->dapm->card;
1955 char *buf; 1954 char *buf;
1956 int in, out; 1955 int in, out;
1957 ssize_t ret; 1956 ssize_t ret;
@@ -1961,6 +1960,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1961 if (!buf) 1960 if (!buf)
1962 return -ENOMEM; 1961 return -ENOMEM;
1963 1962
1963 mutex_lock(&card->dapm_mutex);
1964
1964 /* Supply widgets are not handled by is_connected_{input,output}_ep() */ 1965 /* Supply widgets are not handled by is_connected_{input,output}_ep() */
1965 if (w->is_supply) { 1966 if (w->is_supply) {
1966 in = 0; 1967 in = 0;
@@ -2007,6 +2008,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
2007 p->sink->name); 2008 p->sink->name);
2008 } 2009 }
2009 2010
2011 mutex_unlock(&card->dapm_mutex);
2012
2010 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); 2013 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
2011 2014
2012 kfree(buf); 2015 kfree(buf);
@@ -2281,11 +2284,15 @@ static ssize_t dapm_widget_show(struct device *dev,
2281 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); 2284 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
2282 int i, count = 0; 2285 int i, count = 0;
2283 2286
2287 mutex_lock(&rtd->card->dapm_mutex);
2288
2284 for (i = 0; i < rtd->num_codecs; i++) { 2289 for (i = 0; i < rtd->num_codecs; i++) {
2285 struct snd_soc_codec *codec = rtd->codec_dais[i]->codec; 2290 struct snd_soc_codec *codec = rtd->codec_dais[i]->codec;
2286 count += dapm_widget_show_codec(codec, buf + count); 2291 count += dapm_widget_show_codec(codec, buf + count);
2287 } 2292 }
2288 2293
2294 mutex_unlock(&rtd->card->dapm_mutex);
2295
2289 return count; 2296 return count;
2290} 2297}
2291 2298
@@ -3334,16 +3341,10 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
3334 } 3341 }
3335 3342
3336 prefix = soc_dapm_prefix(dapm); 3343 prefix = soc_dapm_prefix(dapm);
3337 if (prefix) { 3344 if (prefix)
3338 w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); 3345 w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name);
3339 if (widget->sname) 3346 else
3340 w->sname = kasprintf(GFP_KERNEL, "%s %s", prefix,
3341 widget->sname);
3342 } else {
3343 w->name = kasprintf(GFP_KERNEL, "%s", widget->name); 3347 w->name = kasprintf(GFP_KERNEL, "%s", widget->name);
3344 if (widget->sname)
3345 w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname);
3346 }
3347 if (w->name == NULL) { 3348 if (w->name == NULL) {
3348 kfree(w); 3349 kfree(w);
3349 return NULL; 3350 return NULL;
@@ -3792,7 +3793,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
3792 break; 3793 break;
3793 } 3794 }
3794 3795
3795 if (!w->sname || !strstr(w->sname, dai_w->name)) 3796 if (!w->sname || !strstr(w->sname, dai_w->sname))
3796 continue; 3797 continue;
3797 3798
3798 if (dai_w->id == snd_soc_dapm_dai_in) { 3799 if (dai_w->id == snd_soc_dapm_dai_in) {
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index d0960683c409..31068b8f3db0 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -33,6 +33,7 @@
33#include <sound/soc.h> 33#include <sound/soc.h>
34#include <sound/soc-dapm.h> 34#include <sound/soc-dapm.h>
35#include <sound/soc-topology.h> 35#include <sound/soc-topology.h>
36#include <sound/tlv.h>
36 37
37/* 38/*
38 * We make several passes over the data (since it wont necessarily be ordered) 39 * We make several passes over the data (since it wont necessarily be ordered)
@@ -144,7 +145,7 @@ static const struct snd_soc_tplg_kcontrol_ops io_ops[] = {
144 {SND_SOC_TPLG_CTL_STROBE, snd_soc_get_strobe, 145 {SND_SOC_TPLG_CTL_STROBE, snd_soc_get_strobe,
145 snd_soc_put_strobe, NULL}, 146 snd_soc_put_strobe, NULL},
146 {SND_SOC_TPLG_DAPM_CTL_VOLSW, snd_soc_dapm_get_volsw, 147 {SND_SOC_TPLG_DAPM_CTL_VOLSW, snd_soc_dapm_get_volsw,
147 snd_soc_dapm_put_volsw, NULL}, 148 snd_soc_dapm_put_volsw, snd_soc_info_volsw},
148 {SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE, snd_soc_dapm_get_enum_double, 149 {SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE, snd_soc_dapm_get_enum_double,
149 snd_soc_dapm_put_enum_double, snd_soc_info_enum_double}, 150 snd_soc_dapm_put_enum_double, snd_soc_info_enum_double},
150 {SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT, snd_soc_dapm_get_enum_double, 151 {SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT, snd_soc_dapm_get_enum_double,
@@ -534,7 +535,7 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
534 k->put = bops[i].put; 535 k->put = bops[i].put;
535 if (k->get == NULL && bops[i].id == hdr->ops.get) 536 if (k->get == NULL && bops[i].id == hdr->ops.get)
536 k->get = bops[i].get; 537 k->get = bops[i].get;
537 if (k->info == NULL && ops[i].id == hdr->ops.info) 538 if (k->info == NULL && bops[i].id == hdr->ops.info)
538 k->info = bops[i].info; 539 k->info = bops[i].info;
539 } 540 }
540 541
@@ -579,29 +580,51 @@ static int soc_tplg_init_kcontrol(struct soc_tplg *tplg,
579 return 0; 580 return 0;
580} 581}
581 582
583
584static int soc_tplg_create_tlv_db_scale(struct soc_tplg *tplg,
585 struct snd_kcontrol_new *kc, struct snd_soc_tplg_tlv_dbscale *scale)
586{
587 unsigned int item_len = 2 * sizeof(unsigned int);
588 unsigned int *p;
589
590 p = kzalloc(item_len + 2 * sizeof(unsigned int), GFP_KERNEL);
591 if (!p)
592 return -ENOMEM;
593
594 p[0] = SNDRV_CTL_TLVT_DB_SCALE;
595 p[1] = item_len;
596 p[2] = scale->min;
597 p[3] = (scale->step & TLV_DB_SCALE_MASK)
598 | (scale->mute ? TLV_DB_SCALE_MUTE : 0);
599
600 kc->tlv.p = (void *)p;
601 return 0;
602}
603
582static int soc_tplg_create_tlv(struct soc_tplg *tplg, 604static int soc_tplg_create_tlv(struct soc_tplg *tplg,
583 struct snd_kcontrol_new *kc, u32 tlv_size) 605 struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_hdr *tc)
584{ 606{
585 struct snd_soc_tplg_ctl_tlv *tplg_tlv; 607 struct snd_soc_tplg_ctl_tlv *tplg_tlv;
586 struct snd_ctl_tlv *tlv;
587 608
588 if (tlv_size == 0) 609 if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE))
589 return 0; 610 return 0;
590 611
591 tplg_tlv = (struct snd_soc_tplg_ctl_tlv *) tplg->pos; 612 if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
592 tplg->pos += tlv_size; 613 kc->tlv.c = snd_soc_bytes_tlv_callback;
593 614 } else {
594 tlv = kzalloc(sizeof(*tlv) + tlv_size, GFP_KERNEL); 615 tplg_tlv = &tc->tlv;
595 if (tlv == NULL) 616 switch (tplg_tlv->type) {
596 return -ENOMEM; 617 case SNDRV_CTL_TLVT_DB_SCALE:
597 618 return soc_tplg_create_tlv_db_scale(tplg, kc,
598 dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n", 619 &tplg_tlv->scale);
599 tplg_tlv->numid, tplg_tlv->size);
600 620
601 tlv->numid = tplg_tlv->numid; 621 /* TODO: add support for other TLV types */
602 tlv->length = tplg_tlv->size; 622 default:
603 memcpy(tlv->tlv, tplg_tlv + 1, tplg_tlv->size); 623 dev_dbg(tplg->dev, "Unsupported TLV type %d\n",
604 kc->tlv.p = (void *)tlv; 624 tplg_tlv->type);
625 return -EINVAL;
626 }
627 }
605 628
606 return 0; 629 return 0;
607} 630}
@@ -773,7 +796,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count,
773 } 796 }
774 797
775 /* create any TLV data */ 798 /* create any TLV data */
776 soc_tplg_create_tlv(tplg, &kc, mc->hdr.tlv_size); 799 soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
777 800
778 /* register control here */ 801 /* register control here */
779 err = soc_tplg_add_kcontrol(tplg, &kc, 802 err = soc_tplg_add_kcontrol(tplg, &kc,
@@ -1351,6 +1374,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
1351 template.reg = w->reg; 1374 template.reg = w->reg;
1352 template.shift = w->shift; 1375 template.shift = w->shift;
1353 template.mask = w->mask; 1376 template.mask = w->mask;
1377 template.subseq = w->subseq;
1354 template.on_val = w->invert ? 0 : 1; 1378 template.on_val = w->invert ? 0 : 1;
1355 template.off_val = w->invert ? 1 : 0; 1379 template.off_val = w->invert ? 1 : 0;
1356 template.ignore_suspend = w->ignore_suspend; 1380 template.ignore_suspend = w->ignore_suspend;
diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c
index 98d96e1b17e0..1930c42e1f55 100644
--- a/sound/soc/zte/zx296702-i2s.c
+++ b/sound/soc/zte/zx296702-i2s.c
@@ -393,9 +393,9 @@ static int zx_i2s_probe(struct platform_device *pdev)
393 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 393 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
394 zx_i2s->mapbase = res->start; 394 zx_i2s->mapbase = res->start;
395 zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res); 395 zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res);
396 if (!zx_i2s->reg_base) { 396 if (IS_ERR(zx_i2s->reg_base)) {
397 dev_err(&pdev->dev, "ioremap failed!\n"); 397 dev_err(&pdev->dev, "ioremap failed!\n");
398 return -EIO; 398 return PTR_ERR(zx_i2s->reg_base);
399 } 399 }
400 400
401 writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL); 401 writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);
diff --git a/sound/soc/zte/zx296702-spdif.c b/sound/soc/zte/zx296702-spdif.c
index 11a0e46a1156..26265ce4caca 100644
--- a/sound/soc/zte/zx296702-spdif.c
+++ b/sound/soc/zte/zx296702-spdif.c
@@ -322,9 +322,9 @@ static int zx_spdif_probe(struct platform_device *pdev)
322 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 322 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
323 zx_spdif->mapbase = res->start; 323 zx_spdif->mapbase = res->start;
324 zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res); 324 zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res);
325 if (!zx_spdif->reg_base) { 325 if (IS_ERR(zx_spdif->reg_base)) {
326 dev_err(&pdev->dev, "ioremap failed!\n"); 326 dev_err(&pdev->dev, "ioremap failed!\n");
327 return -EIO; 327 return PTR_ERR(zx_spdif->reg_base);
328 } 328 }
329 329
330 zx_spdif_dev_init(zx_spdif->reg_base); 330 zx_spdif_dev_init(zx_spdif->reg_base);
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 1b1a89e80d13..784ceb85b2d9 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -956,6 +956,7 @@ static int snd_amd7930_create(struct snd_card *card,
956 if (!amd->regs) { 956 if (!amd->regs) {
957 snd_printk(KERN_ERR 957 snd_printk(KERN_ERR
958 "amd7930-%d: Unable to map chip registers.\n", dev); 958 "amd7930-%d: Unable to map chip registers.\n", dev);
959 kfree(amd);
959 return -EIO; 960 return -EIO;
960 } 961 }
961 962
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
index e5000da9e9d7..6a803eff87f7 100644
--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -341,6 +341,20 @@ static const struct usbmix_name_map scms_usb3318_map[] = {
341 { 0 } 341 { 0 }
342}; 342};
343 343
344/* Bose companion 5, the dB conversion factor is 16 instead of 256 */
345static struct usbmix_dB_map bose_companion5_dB = {-5006, -6};
346static struct usbmix_name_map bose_companion5_map[] = {
347 { 3, NULL, .dB = &bose_companion5_dB },
348 { 0 } /* terminator */
349};
350
351/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */
352static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000};
353static struct usbmix_name_map dragonfly_1_2_map[] = {
354 { 7, NULL, .dB = &dragonfly_1_2_dB },
355 { 0 } /* terminator */
356};
357
344/* 358/*
345 * Control map entries 359 * Control map entries
346 */ 360 */
@@ -451,6 +465,16 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
451 .id = USB_ID(0x25c4, 0x0003), 465 .id = USB_ID(0x25c4, 0x0003),
452 .map = scms_usb3318_map, 466 .map = scms_usb3318_map,
453 }, 467 },
468 {
469 /* Bose Companion 5 */
470 .id = USB_ID(0x05a7, 0x1020),
471 .map = bose_companion5_map,
472 },
473 {
474 /* Dragonfly DAC 1.2 */
475 .id = USB_ID(0x21b4, 0x0081),
476 .map = dragonfly_1_2_map,
477 },
454 { 0 } /* terminator */ 478 { 0 } /* terminator */
455}; 479};
456 480