aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/aoa/codecs/onyx.c75
-rw-r--r--sound/aoa/codecs/tas.c80
-rw-r--r--sound/core/compress_offload.c8
-rw-r--r--sound/i2c/other/tea575x-tuner.c21
-rw-r--r--sound/pci/es1968.c2
-rw-r--r--sound/pci/fm801.c4
-rw-r--r--sound/pci/hda/Kconfig13
-rw-r--r--sound/pci/hda/hda_auto_parser.c1
-rw-r--r--sound/pci/hda/hda_auto_parser.h10
-rw-r--r--sound/pci/hda/hda_codec.c50
-rw-r--r--sound/pci/hda/hda_codec.h2
-rw-r--r--sound/pci/hda/hda_intel.c19
-rw-r--r--sound/pci/hda/patch_conexant.c8
-rw-r--r--sound/pci/hda/patch_realtek.c53
-rw-r--r--sound/pci/hda/patch_sigmatel.c7
-rw-r--r--sound/pci/rme9652/hdspm.c7
-rw-r--r--sound/soc/codecs/tlv320aic3x.c4
-rw-r--r--sound/soc/codecs/tlv320aic3x.h1
-rw-r--r--sound/soc/codecs/wm2000.c59
-rw-r--r--sound/soc/codecs/wm2200.c1
-rw-r--r--sound/soc/codecs/wm8904.c26
-rw-r--r--sound/soc/codecs/wm8994.c108
-rw-r--r--sound/soc/codecs/wm8996.c8
-rw-r--r--sound/soc/fsl/imx-audmux.c8
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c1
-rw-r--r--sound/soc/fsl/imx-ssi.c6
-rw-r--r--sound/soc/pxa/pxa-ssp.c38
-rw-r--r--sound/soc/samsung/dma.c18
-rw-r--r--sound/soc/sh/fsi.c25
-rw-r--r--sound/soc/soc-dapm.c4
-rw-r--r--sound/soc/soc-pcm.c6
-rw-r--r--sound/soc/tegra/Kconfig10
-rw-r--r--sound/soc/tegra/tegra20_i2s.c4
-rw-r--r--sound/soc/tegra/tegra20_spdif.c4
-rw-r--r--sound/soc/tegra/tegra30_ahub.c9
-rw-r--r--sound/soc/tegra/tegra30_i2s.c4
-rw-r--r--sound/soc/tegra/tegra_asoc_utils.c12
-rw-r--r--sound/soc/tegra/tegra_wm8903.c13
-rw-r--r--sound/usb/6fire/firmware.c2
-rw-r--r--sound/usb/card.h1
-rw-r--r--sound/usb/endpoint.c73
-rw-r--r--sound/usb/mixer_maps.c8
-rw-r--r--sound/usb/pcm.c85
-rw-r--r--sound/usb/quirks-table.h30
-rw-r--r--sound/usb/stream.c7
45 files changed, 453 insertions, 482 deletions
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index 270790d384e2..4cedc6950d72 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -997,45 +997,10 @@ static void onyx_exit_codec(struct aoa_codec *codec)
997 onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx); 997 onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx);
998} 998}
999 999
1000static int onyx_create(struct i2c_adapter *adapter,
1001 struct device_node *node,
1002 int addr)
1003{
1004 struct i2c_board_info info;
1005 struct i2c_client *client;
1006
1007 memset(&info, 0, sizeof(struct i2c_board_info));
1008 strlcpy(info.type, "aoa_codec_onyx", I2C_NAME_SIZE);
1009 info.addr = addr;
1010 info.platform_data = node;
1011 client = i2c_new_device(adapter, &info);
1012 if (!client)
1013 return -ENODEV;
1014
1015 /*
1016 * We know the driver is already loaded, so the device should be
1017 * already bound. If not it means binding failed, which suggests
1018 * the device doesn't really exist and should be deleted.
1019 * Ideally this would be replaced by better checks _before_
1020 * instantiating the device.
1021 */
1022 if (!client->driver) {
1023 i2c_unregister_device(client);
1024 return -ENODEV;
1025 }
1026
1027 /*
1028 * Let i2c-core delete that device on driver removal.
1029 * This is safe because i2c-core holds the core_lock mutex for us.
1030 */
1031 list_add_tail(&client->detected, &client->driver->clients);
1032 return 0;
1033}
1034
1035static int onyx_i2c_probe(struct i2c_client *client, 1000static int onyx_i2c_probe(struct i2c_client *client,
1036 const struct i2c_device_id *id) 1001 const struct i2c_device_id *id)
1037{ 1002{
1038 struct device_node *node = client->dev.platform_data; 1003 struct device_node *node = client->dev.of_node;
1039 struct onyx *onyx; 1004 struct onyx *onyx;
1040 u8 dummy; 1005 u8 dummy;
1041 1006
@@ -1071,40 +1036,6 @@ static int onyx_i2c_probe(struct i2c_client *client,
1071 return -ENODEV; 1036 return -ENODEV;
1072} 1037}
1073 1038
1074static int onyx_i2c_attach(struct i2c_adapter *adapter)
1075{
1076 struct device_node *busnode, *dev = NULL;
1077 struct pmac_i2c_bus *bus;
1078
1079 bus = pmac_i2c_adapter_to_bus(adapter);
1080 if (bus == NULL)
1081 return -ENODEV;
1082 busnode = pmac_i2c_get_bus_node(bus);
1083
1084 while ((dev = of_get_next_child(busnode, dev)) != NULL) {
1085 if (of_device_is_compatible(dev, "pcm3052")) {
1086 const u32 *addr;
1087 printk(KERN_DEBUG PFX "found pcm3052\n");
1088 addr = of_get_property(dev, "reg", NULL);
1089 if (!addr)
1090 return -ENODEV;
1091 return onyx_create(adapter, dev, (*addr)>>1);
1092 }
1093 }
1094
1095 /* if that didn't work, try desperate mode for older
1096 * machines that have stuff missing from the device tree */
1097
1098 if (!of_device_is_compatible(busnode, "k2-i2c"))
1099 return -ENODEV;
1100
1101 printk(KERN_DEBUG PFX "found k2-i2c, checking if onyx chip is on it\n");
1102 /* probe both possible addresses for the onyx chip */
1103 if (onyx_create(adapter, NULL, 0x46) == 0)
1104 return 0;
1105 return onyx_create(adapter, NULL, 0x47);
1106}
1107
1108static int onyx_i2c_remove(struct i2c_client *client) 1039static int onyx_i2c_remove(struct i2c_client *client)
1109{ 1040{
1110 struct onyx *onyx = i2c_get_clientdata(client); 1041 struct onyx *onyx = i2c_get_clientdata(client);
@@ -1117,16 +1048,16 @@ static int onyx_i2c_remove(struct i2c_client *client)
1117} 1048}
1118 1049
1119static const struct i2c_device_id onyx_i2c_id[] = { 1050static const struct i2c_device_id onyx_i2c_id[] = {
1120 { "aoa_codec_onyx", 0 }, 1051 { "MAC,pcm3052", 0 },
1121 { } 1052 { }
1122}; 1053};
1054MODULE_DEVICE_TABLE(i2c,onyx_i2c_id);
1123 1055
1124static struct i2c_driver onyx_driver = { 1056static struct i2c_driver onyx_driver = {
1125 .driver = { 1057 .driver = {
1126 .name = "aoa_codec_onyx", 1058 .name = "aoa_codec_onyx",
1127 .owner = THIS_MODULE, 1059 .owner = THIS_MODULE,
1128 }, 1060 },
1129 .attach_adapter = onyx_i2c_attach,
1130 .probe = onyx_i2c_probe, 1061 .probe = onyx_i2c_probe,
1131 .remove = onyx_i2c_remove, 1062 .remove = onyx_i2c_remove,
1132 .id_table = onyx_i2c_id, 1063 .id_table = onyx_i2c_id,
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
index 8e63d1f35ce1..c491ae0f749c 100644
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -883,43 +883,10 @@ static void tas_exit_codec(struct aoa_codec *codec)
883} 883}
884 884
885 885
886static int tas_create(struct i2c_adapter *adapter,
887 struct device_node *node,
888 int addr)
889{
890 struct i2c_board_info info;
891 struct i2c_client *client;
892
893 memset(&info, 0, sizeof(struct i2c_board_info));
894 strlcpy(info.type, "aoa_codec_tas", I2C_NAME_SIZE);
895 info.addr = addr;
896 info.platform_data = node;
897
898 client = i2c_new_device(adapter, &info);
899 if (!client)
900 return -ENODEV;
901 /*
902 * We know the driver is already loaded, so the device should be
903 * already bound. If not it means binding failed, and then there
904 * is no point in keeping the device instantiated.
905 */
906 if (!client->driver) {
907 i2c_unregister_device(client);
908 return -ENODEV;
909 }
910
911 /*
912 * Let i2c-core delete that device on driver removal.
913 * This is safe because i2c-core holds the core_lock mutex for us.
914 */
915 list_add_tail(&client->detected, &client->driver->clients);
916 return 0;
917}
918
919static int tas_i2c_probe(struct i2c_client *client, 886static int tas_i2c_probe(struct i2c_client *client,
920 const struct i2c_device_id *id) 887 const struct i2c_device_id *id)
921{ 888{
922 struct device_node *node = client->dev.platform_data; 889 struct device_node *node = client->dev.of_node;
923 struct tas *tas; 890 struct tas *tas;
924 891
925 tas = kzalloc(sizeof(struct tas), GFP_KERNEL); 892 tas = kzalloc(sizeof(struct tas), GFP_KERNEL);
@@ -953,47 +920,6 @@ static int tas_i2c_probe(struct i2c_client *client,
953 return -EINVAL; 920 return -EINVAL;
954} 921}
955 922
956static int tas_i2c_attach(struct i2c_adapter *adapter)
957{
958 struct device_node *busnode, *dev = NULL;
959 struct pmac_i2c_bus *bus;
960
961 bus = pmac_i2c_adapter_to_bus(adapter);
962 if (bus == NULL)
963 return -ENODEV;
964 busnode = pmac_i2c_get_bus_node(bus);
965
966 while ((dev = of_get_next_child(busnode, dev)) != NULL) {
967 if (of_device_is_compatible(dev, "tas3004")) {
968 const u32 *addr;
969 printk(KERN_DEBUG PFX "found tas3004\n");
970 addr = of_get_property(dev, "reg", NULL);
971 if (!addr)
972 continue;
973 return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f);
974 }
975 /* older machines have no 'codec' node with a 'compatible'
976 * property that says 'tas3004', they just have a 'deq'
977 * node without any such property... */
978 if (strcmp(dev->name, "deq") == 0) {
979 const u32 *_addr;
980 u32 addr;
981 printk(KERN_DEBUG PFX "found 'deq' node\n");
982 _addr = of_get_property(dev, "i2c-address", NULL);
983 if (!_addr)
984 continue;
985 addr = ((*_addr) >> 1) & 0x7f;
986 /* now, if the address doesn't match any of the two
987 * that a tas3004 can have, we cannot handle this.
988 * I doubt it ever happens but hey. */
989 if (addr != 0x34 && addr != 0x35)
990 continue;
991 return tas_create(adapter, dev, addr);
992 }
993 }
994 return -ENODEV;
995}
996
997static int tas_i2c_remove(struct i2c_client *client) 923static int tas_i2c_remove(struct i2c_client *client)
998{ 924{
999 struct tas *tas = i2c_get_clientdata(client); 925 struct tas *tas = i2c_get_clientdata(client);
@@ -1011,16 +937,16 @@ static int tas_i2c_remove(struct i2c_client *client)
1011} 937}
1012 938
1013static const struct i2c_device_id tas_i2c_id[] = { 939static const struct i2c_device_id tas_i2c_id[] = {
1014 { "aoa_codec_tas", 0 }, 940 { "MAC,tas3004", 0 },
1015 { } 941 { }
1016}; 942};
943MODULE_DEVICE_TABLE(i2c,tas_i2c_id);
1017 944
1018static struct i2c_driver tas_driver = { 945static struct i2c_driver tas_driver = {
1019 .driver = { 946 .driver = {
1020 .name = "aoa_codec_tas", 947 .name = "aoa_codec_tas",
1021 .owner = THIS_MODULE, 948 .owner = THIS_MODULE,
1022 }, 949 },
1023 .attach_adapter = tas_i2c_attach,
1024 .probe = tas_i2c_probe, 950 .probe = tas_i2c_probe,
1025 .remove = tas_i2c_remove, 951 .remove = tas_i2c_remove,
1026 .id_table = tas_i2c_id, 952 .id_table = tas_i2c_id,
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index a68aed7fce02..ec2118d0e27a 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -502,10 +502,8 @@ static int snd_compr_pause(struct snd_compr_stream *stream)
502 if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) 502 if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING)
503 return -EPERM; 503 return -EPERM;
504 retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH); 504 retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH);
505 if (!retval) { 505 if (!retval)
506 stream->runtime->state = SNDRV_PCM_STATE_PAUSED; 506 stream->runtime->state = SNDRV_PCM_STATE_PAUSED;
507 wake_up(&stream->runtime->sleep);
508 }
509 return retval; 507 return retval;
510} 508}
511 509
@@ -544,6 +542,10 @@ static int snd_compr_stop(struct snd_compr_stream *stream)
544 if (!retval) { 542 if (!retval) {
545 stream->runtime->state = SNDRV_PCM_STATE_SETUP; 543 stream->runtime->state = SNDRV_PCM_STATE_SETUP;
546 wake_up(&stream->runtime->sleep); 544 wake_up(&stream->runtime->sleep);
545 stream->runtime->hw_pointer = 0;
546 stream->runtime->app_pointer = 0;
547 stream->runtime->total_bytes_available = 0;
548 stream->runtime->total_bytes_transferred = 0;
547 } 549 }
548 return retval; 550 return retval;
549} 551}
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index 582aace20ea3..7eca25fae413 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -37,8 +37,8 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); 37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39 39
40#define FREQ_LO (76U * 16000) 40#define FREQ_LO ((tea->tea5759 ? 760 : 875) * 1600U)
41#define FREQ_HI (108U * 16000) 41#define FREQ_HI ((tea->tea5759 ? 910 : 1080) * 1600U)
42 42
43/* 43/*
44 * definitions 44 * definitions
@@ -120,9 +120,9 @@ static u32 snd_tea575x_read(struct snd_tea575x *tea)
120 return data; 120 return data;
121} 121}
122 122
123static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) 123static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val)
124{ 124{
125 u32 freq = snd_tea575x_read(tea) & TEA575X_BIT_FREQ_MASK; 125 u32 freq = val & TEA575X_BIT_FREQ_MASK;
126 126
127 if (freq == 0) 127 if (freq == 0)
128 return freq; 128 return freq;
@@ -139,6 +139,11 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */ 139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */
140} 140}
141 141
142static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
143{
144 return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea));
145}
146
142static void snd_tea575x_set_freq(struct snd_tea575x *tea) 147static void snd_tea575x_set_freq(struct snd_tea575x *tea)
143{ 148{
144 u32 freq = tea->freq; 149 u32 freq = tea->freq;
@@ -156,6 +161,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
156 tea->val &= ~TEA575X_BIT_FREQ_MASK; 161 tea->val &= ~TEA575X_BIT_FREQ_MASK;
157 tea->val |= freq & TEA575X_BIT_FREQ_MASK; 162 tea->val |= freq & TEA575X_BIT_FREQ_MASK;
158 snd_tea575x_write(tea, tea->val); 163 snd_tea575x_write(tea, tea->val);
164 tea->freq = snd_tea575x_val_to_freq(tea, tea->val);
159} 165}
160 166
161/* 167/*
@@ -317,7 +323,6 @@ static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl)
317} 323}
318 324
319static const struct v4l2_file_operations tea575x_fops = { 325static const struct v4l2_file_operations tea575x_fops = {
320 .owner = THIS_MODULE,
321 .unlocked_ioctl = video_ioctl2, 326 .unlocked_ioctl = video_ioctl2,
322 .open = v4l2_fh_open, 327 .open = v4l2_fh_open,
323 .release = v4l2_fh_release, 328 .release = v4l2_fh_release,
@@ -337,7 +342,6 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
337}; 342};
338 343
339static const struct video_device tea575x_radio = { 344static const struct video_device tea575x_radio = {
340 .fops = &tea575x_fops,
341 .ioctl_ops = &tea575x_ioctl_ops, 345 .ioctl_ops = &tea575x_ioctl_ops,
342 .release = video_device_release_empty, 346 .release = video_device_release_empty,
343}; 347};
@@ -349,7 +353,7 @@ static const struct v4l2_ctrl_ops tea575x_ctrl_ops = {
349/* 353/*
350 * initialize all the tea575x chips 354 * initialize all the tea575x chips
351 */ 355 */
352int snd_tea575x_init(struct snd_tea575x *tea) 356int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner)
353{ 357{
354 int retval; 358 int retval;
355 359
@@ -374,6 +378,9 @@ int snd_tea575x_init(struct snd_tea575x *tea)
374 tea->vd.lock = &tea->mutex; 378 tea->vd.lock = &tea->mutex;
375 tea->vd.v4l2_dev = tea->v4l2_dev; 379 tea->vd.v4l2_dev = tea->v4l2_dev;
376 tea->vd.ctrl_handler = &tea->ctrl_handler; 380 tea->vd.ctrl_handler = &tea->ctrl_handler;
381 tea->fops = tea575x_fops;
382 tea->fops.owner = owner;
383 tea->vd.fops = &tea->fops;
377 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags); 384 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags);
378 /* disable hw_freq_seek if we can't use it */ 385 /* disable hw_freq_seek if we can't use it */
379 if (tea->cannot_read_data) 386 if (tea->cannot_read_data)
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 67f47d891959..52b5c0bf90c1 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2769,7 +2769,7 @@ static int __devinit snd_es1968_create(struct snd_card *card,
2769 chip->tea.ops = &snd_es1968_tea_ops; 2769 chip->tea.ops = &snd_es1968_tea_ops;
2770 strlcpy(chip->tea.card, "SF64-PCE2", sizeof(chip->tea.card)); 2770 strlcpy(chip->tea.card, "SF64-PCE2", sizeof(chip->tea.card));
2771 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); 2771 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci));
2772 if (!snd_tea575x_init(&chip->tea)) 2772 if (!snd_tea575x_init(&chip->tea, THIS_MODULE))
2773 printk(KERN_INFO "es1968: detected TEA575x radio\n"); 2773 printk(KERN_INFO "es1968: detected TEA575x radio\n");
2774#endif 2774#endif
2775 2775
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index f69662322750..b32e8024ea86 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1254,7 +1254,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1254 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); 1254 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci));
1255 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 && 1255 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 &&
1256 (tea575x_tuner & TUNER_TYPE_MASK) < 4) { 1256 (tea575x_tuner & TUNER_TYPE_MASK) < 4) {
1257 if (snd_tea575x_init(&chip->tea)) { 1257 if (snd_tea575x_init(&chip->tea, THIS_MODULE)) {
1258 snd_printk(KERN_ERR "TEA575x radio not found\n"); 1258 snd_printk(KERN_ERR "TEA575x radio not found\n");
1259 snd_fm801_free(chip); 1259 snd_fm801_free(chip);
1260 return -ENODEV; 1260 return -ENODEV;
@@ -1263,7 +1263,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1263 /* autodetect tuner connection */ 1263 /* autodetect tuner connection */
1264 for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) { 1264 for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) {
1265 chip->tea575x_tuner = tea575x_tuner; 1265 chip->tea575x_tuner = tea575x_tuner;
1266 if (!snd_tea575x_init(&chip->tea)) { 1266 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) {
1267 snd_printk(KERN_INFO "detected TEA575x radio type %s\n", 1267 snd_printk(KERN_INFO "detected TEA575x radio type %s\n",
1268 get_tea575x_gpio(chip)->name); 1268 get_tea575x_gpio(chip)->name);
1269 break; 1269 break;
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 163b6b5de3eb..d03079764189 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -97,19 +97,6 @@ config SND_HDA_CODEC_REALTEK
97 snd-hda-codec-realtek. 97 snd-hda-codec-realtek.
98 This module is automatically loaded at probing. 98 This module is automatically loaded at probing.
99 99
100config SND_HDA_ENABLE_REALTEK_QUIRKS
101 bool "Build static quirks for Realtek codecs"
102 depends on SND_HDA_CODEC_REALTEK
103 default y
104 help
105 Say Y here to build the static quirks codes for Realtek codecs.
106 If you need the "model" preset that the default BIOS auto-parser
107 can't handle, turn this option on.
108
109 If your device works with model=auto option, basically you don't
110 need the quirk code. By turning this off, you can reduce the
111 module size quite a lot.
112
113config SND_HDA_CODEC_ANALOG 100config SND_HDA_CODEC_ANALOG
114 bool "Build Analog Device HD-audio codec support" 101 bool "Build Analog Device HD-audio codec support"
115 default y 102 default y
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 6e9ef3e25093..f7520b9f909c 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -618,7 +618,6 @@ int snd_hda_gen_add_verbs(struct hda_gen_spec *spec,
618 const struct hda_verb *list) 618 const struct hda_verb *list)
619{ 619{
620 const struct hda_verb **v; 620 const struct hda_verb **v;
621 snd_array_init(&spec->verbs, sizeof(struct hda_verb *), 8);
622 v = snd_array_new(&spec->verbs); 621 v = snd_array_new(&spec->verbs);
623 if (!v) 622 if (!v)
624 return -ENOMEM; 623 return -ENOMEM;
diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h
index 2a7889dfbd1b..632ad0ad3007 100644
--- a/sound/pci/hda/hda_auto_parser.h
+++ b/sound/pci/hda/hda_auto_parser.h
@@ -157,4 +157,14 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
157 const struct snd_pci_quirk *quirk, 157 const struct snd_pci_quirk *quirk,
158 const struct hda_fixup *fixlist); 158 const struct hda_fixup *fixlist);
159 159
160static inline void snd_hda_gen_init(struct hda_gen_spec *spec)
161{
162 snd_array_init(&spec->verbs, sizeof(struct hda_verb *), 8);
163}
164
165static inline void snd_hda_gen_free(struct hda_gen_spec *spec)
166{
167 snd_array_free(&spec->verbs);
168}
169
160#endif /* __SOUND_HDA_AUTO_PARSER_H */ 170#endif /* __SOUND_HDA_AUTO_PARSER_H */
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 41ca803a1fff..51cb2a2e4fce 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1184,6 +1184,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
1184{ 1184{
1185 if (!codec) 1185 if (!codec)
1186 return; 1186 return;
1187 snd_hda_jack_tbl_clear(codec);
1187 restore_init_pincfgs(codec); 1188 restore_init_pincfgs(codec);
1188#ifdef CONFIG_SND_HDA_POWER_SAVE 1189#ifdef CONFIG_SND_HDA_POWER_SAVE
1189 cancel_delayed_work(&codec->power_work); 1190 cancel_delayed_work(&codec->power_work);
@@ -1192,6 +1193,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
1192 list_del(&codec->list); 1193 list_del(&codec->list);
1193 snd_array_free(&codec->mixers); 1194 snd_array_free(&codec->mixers);
1194 snd_array_free(&codec->nids); 1195 snd_array_free(&codec->nids);
1196 snd_array_free(&codec->cvt_setups);
1195 snd_array_free(&codec->conn_lists); 1197 snd_array_free(&codec->conn_lists);
1196 snd_array_free(&codec->spdif_out); 1198 snd_array_free(&codec->spdif_out);
1197 codec->bus->caddr_tbl[codec->addr] = NULL; 1199 codec->bus->caddr_tbl[codec->addr] = NULL;
@@ -2333,6 +2335,8 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2333 /* free only driver_pins so that init_pins + user_pins are restored */ 2335 /* free only driver_pins so that init_pins + user_pins are restored */
2334 snd_array_free(&codec->driver_pins); 2336 snd_array_free(&codec->driver_pins);
2335 restore_pincfgs(codec); 2337 restore_pincfgs(codec);
2338 snd_array_free(&codec->cvt_setups);
2339 snd_array_free(&codec->spdif_out);
2336 codec->num_pcms = 0; 2340 codec->num_pcms = 0;
2337 codec->pcm_info = NULL; 2341 codec->pcm_info = NULL;
2338 codec->preset = NULL; 2342 codec->preset = NULL;
@@ -4393,20 +4397,19 @@ void snd_hda_update_power_acct(struct hda_codec *codec)
4393 codec->power_jiffies += delta; 4397 codec->power_jiffies += delta;
4394} 4398}
4395 4399
4396/** 4400/* Transition to powered up, if wait_power_down then wait for a pending
4397 * snd_hda_power_up - Power-up the codec 4401 * transition to D3 to complete. A pending D3 transition is indicated
4398 * @codec: HD-audio codec 4402 * with power_transition == -1. */
4399 * 4403static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down)
4400 * Increment the power-up counter and power up the hardware really when
4401 * not turned on yet.
4402 */
4403void snd_hda_power_up(struct hda_codec *codec)
4404{ 4404{
4405 struct hda_bus *bus = codec->bus; 4405 struct hda_bus *bus = codec->bus;
4406 4406
4407 spin_lock(&codec->power_lock); 4407 spin_lock(&codec->power_lock);
4408 codec->power_count++; 4408 codec->power_count++;
4409 if (codec->power_on || codec->power_transition > 0) { 4409 /* Return if power_on or transitioning to power_on, unless currently
4410 * powering down. */
4411 if ((codec->power_on || codec->power_transition > 0) &&
4412 !(wait_power_down && codec->power_transition < 0)) {
4410 spin_unlock(&codec->power_lock); 4413 spin_unlock(&codec->power_lock);
4411 return; 4414 return;
4412 } 4415 }
@@ -4430,8 +4433,37 @@ void snd_hda_power_up(struct hda_codec *codec)
4430 codec->power_transition = 0; 4433 codec->power_transition = 0;
4431 spin_unlock(&codec->power_lock); 4434 spin_unlock(&codec->power_lock);
4432} 4435}
4436
4437/**
4438 * snd_hda_power_up - Power-up the codec
4439 * @codec: HD-audio codec
4440 *
4441 * Increment the power-up counter and power up the hardware really when
4442 * not turned on yet.
4443 */
4444void snd_hda_power_up(struct hda_codec *codec)
4445{
4446 __snd_hda_power_up(codec, false);
4447}
4433EXPORT_SYMBOL_HDA(snd_hda_power_up); 4448EXPORT_SYMBOL_HDA(snd_hda_power_up);
4434 4449
4450/**
4451 * snd_hda_power_up_d3wait - Power-up the codec after waiting for any pending
4452 * D3 transition to complete. This differs from snd_hda_power_up() when
4453 * power_transition == -1. snd_hda_power_up sees this case as a nop,
4454 * snd_hda_power_up_d3wait waits for the D3 transition to complete then powers
4455 * back up.
4456 * @codec: HD-audio codec
4457 *
4458 * Cancel any power down operation hapenning on the work queue, then power up.
4459 */
4460void snd_hda_power_up_d3wait(struct hda_codec *codec)
4461{
4462 /* This will cancel and wait for pending power_work to complete. */
4463 __snd_hda_power_up(codec, true);
4464}
4465EXPORT_SYMBOL_HDA(snd_hda_power_up_d3wait);
4466
4435#define power_save(codec) \ 4467#define power_save(codec) \
4436 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) 4468 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
4437 4469
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 4fc3960c8591..2fdaadbb4326 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -1056,10 +1056,12 @@ const char *snd_hda_get_jack_location(u32 cfg);
1056 */ 1056 */
1057#ifdef CONFIG_SND_HDA_POWER_SAVE 1057#ifdef CONFIG_SND_HDA_POWER_SAVE
1058void snd_hda_power_up(struct hda_codec *codec); 1058void snd_hda_power_up(struct hda_codec *codec);
1059void snd_hda_power_up_d3wait(struct hda_codec *codec);
1059void snd_hda_power_down(struct hda_codec *codec); 1060void snd_hda_power_down(struct hda_codec *codec);
1060void snd_hda_update_power_acct(struct hda_codec *codec); 1061void snd_hda_update_power_acct(struct hda_codec *codec);
1061#else 1062#else
1062static inline void snd_hda_power_up(struct hda_codec *codec) {} 1063static inline void snd_hda_power_up(struct hda_codec *codec) {}
1064static inline void snd_hda_power_up_d3wait(struct hda_codec *codec) {}
1063static inline void snd_hda_power_down(struct hda_codec *codec) {} 1065static inline void snd_hda_power_down(struct hda_codec *codec) {}
1064#endif 1066#endif
1065 1067
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 2b6392be451c..7757536b9d5f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1766,7 +1766,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1766 buff_step); 1766 buff_step);
1767 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1767 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1768 buff_step); 1768 buff_step);
1769 snd_hda_power_up(apcm->codec); 1769 snd_hda_power_up_d3wait(apcm->codec);
1770 err = hinfo->ops.open(hinfo, apcm->codec, substream); 1770 err = hinfo->ops.open(hinfo, apcm->codec, substream);
1771 if (err < 0) { 1771 if (err < 0) {
1772 azx_release_device(azx_dev); 1772 azx_release_device(azx_dev);
@@ -2484,9 +2484,9 @@ static void azx_notifier_unregister(struct azx *chip)
2484static int DELAYED_INIT_MARK azx_first_init(struct azx *chip); 2484static int DELAYED_INIT_MARK azx_first_init(struct azx *chip);
2485static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip); 2485static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip);
2486 2486
2487#ifdef SUPPORT_VGA_SWITCHEROO
2487static struct pci_dev __devinit *get_bound_vga(struct pci_dev *pci); 2488static struct pci_dev __devinit *get_bound_vga(struct pci_dev *pci);
2488 2489
2489#ifdef SUPPORT_VGA_SWITCHEROO
2490static void azx_vs_set_state(struct pci_dev *pci, 2490static void azx_vs_set_state(struct pci_dev *pci,
2491 enum vga_switcheroo_state state) 2491 enum vga_switcheroo_state state)
2492{ 2492{
@@ -2578,6 +2578,7 @@ static int __devinit register_vga_switcheroo(struct azx *chip)
2578#else 2578#else
2579#define init_vga_switcheroo(chip) /* NOP */ 2579#define init_vga_switcheroo(chip) /* NOP */
2580#define register_vga_switcheroo(chip) 0 2580#define register_vga_switcheroo(chip) 0
2581#define check_hdmi_disabled(pci) false
2581#endif /* SUPPORT_VGA_SWITCHER */ 2582#endif /* SUPPORT_VGA_SWITCHER */
2582 2583
2583/* 2584/*
@@ -2638,6 +2639,7 @@ static int azx_dev_free(struct snd_device *device)
2638 return azx_free(device->device_data); 2639 return azx_free(device->device_data);
2639} 2640}
2640 2641
2642#ifdef SUPPORT_VGA_SWITCHEROO
2641/* 2643/*
2642 * Check of disabled HDMI controller by vga-switcheroo 2644 * Check of disabled HDMI controller by vga-switcheroo
2643 */ 2645 */
@@ -2670,12 +2672,13 @@ static bool __devinit check_hdmi_disabled(struct pci_dev *pci)
2670 struct pci_dev *p = get_bound_vga(pci); 2672 struct pci_dev *p = get_bound_vga(pci);
2671 2673
2672 if (p) { 2674 if (p) {
2673 if (vga_default_device() && p != vga_default_device()) 2675 if (vga_switcheroo_get_client_state(p) == VGA_SWITCHEROO_OFF)
2674 vga_inactive = true; 2676 vga_inactive = true;
2675 pci_dev_put(p); 2677 pci_dev_put(p);
2676 } 2678 }
2677 return vga_inactive; 2679 return vga_inactive;
2678} 2680}
2681#endif /* SUPPORT_VGA_SWITCHEROO */
2679 2682
2680/* 2683/*
2681 * white/black-listing for position_fix 2684 * white/black-listing for position_fix
@@ -3351,6 +3354,11 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3351 { PCI_DEVICE(0x6549, 0x1200), 3354 { PCI_DEVICE(0x6549, 0x1200),
3352 .driver_data = AZX_DRIVER_TERA | AZX_DCAPS_NO_64BIT }, 3355 .driver_data = AZX_DRIVER_TERA | AZX_DCAPS_NO_64BIT },
3353 /* Creative X-Fi (CA0110-IBG) */ 3356 /* Creative X-Fi (CA0110-IBG) */
3357 /* CTHDA chips */
3358 { PCI_DEVICE(0x1102, 0x0010),
3359 .driver_data = AZX_DRIVER_CTHDA | AZX_DCAPS_PRESET_CTHDA },
3360 { PCI_DEVICE(0x1102, 0x0012),
3361 .driver_data = AZX_DRIVER_CTHDA | AZX_DCAPS_PRESET_CTHDA },
3354#if !defined(CONFIG_SND_CTXFI) && !defined(CONFIG_SND_CTXFI_MODULE) 3362#if !defined(CONFIG_SND_CTXFI) && !defined(CONFIG_SND_CTXFI_MODULE)
3355 /* the following entry conflicts with snd-ctxfi driver, 3363 /* the following entry conflicts with snd-ctxfi driver,
3356 * as ctxfi driver mutates from HD-audio to native mode with 3364 * as ctxfi driver mutates from HD-audio to native mode with
@@ -3367,11 +3375,6 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3367 .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND | 3375 .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND |
3368 AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB }, 3376 AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB },
3369#endif 3377#endif
3370 /* CTHDA chips */
3371 { PCI_DEVICE(0x1102, 0x0010),
3372 .driver_data = AZX_DRIVER_CTHDA | AZX_DCAPS_PRESET_CTHDA },
3373 { PCI_DEVICE(0x1102, 0x0012),
3374 .driver_data = AZX_DRIVER_CTHDA | AZX_DCAPS_PRESET_CTHDA },
3375 /* Vortex86MX */ 3378 /* Vortex86MX */
3376 { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, 3379 { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC },
3377 /* VMware HDAudio */ 3380 /* VMware HDAudio */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 3acb5824ad39..2bf99fc1cbf2 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -445,8 +445,10 @@ static int conexant_init(struct hda_codec *codec)
445 445
446static void conexant_free(struct hda_codec *codec) 446static void conexant_free(struct hda_codec *codec)
447{ 447{
448 struct conexant_spec *spec = codec->spec;
449 snd_hda_gen_free(&spec->gen);
448 snd_hda_detach_beep_device(codec); 450 snd_hda_detach_beep_device(codec);
449 kfree(codec->spec); 451 kfree(spec);
450} 452}
451 453
452static const struct snd_kcontrol_new cxt_capture_mixers[] = { 454static const struct snd_kcontrol_new cxt_capture_mixers[] = {
@@ -4061,7 +4063,7 @@ static void cx_auto_init_digital(struct hda_codec *codec)
4061static int cx_auto_init(struct hda_codec *codec) 4063static int cx_auto_init(struct hda_codec *codec)
4062{ 4064{
4063 struct conexant_spec *spec = codec->spec; 4065 struct conexant_spec *spec = codec->spec;
4064 /*snd_hda_sequence_write(codec, cx_auto_init_verbs);*/ 4066 snd_hda_gen_apply_verbs(codec);
4065 cx_auto_init_output(codec); 4067 cx_auto_init_output(codec);
4066 cx_auto_init_input(codec); 4068 cx_auto_init_input(codec);
4067 cx_auto_init_digital(codec); 4069 cx_auto_init_digital(codec);
@@ -4466,6 +4468,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
4466 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), 4468 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
4467 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 4469 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
4468 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 4470 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
4471 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
4469 {} 4472 {}
4470}; 4473};
4471 4474
@@ -4497,6 +4500,7 @@ static int patch_conexant_auto(struct hda_codec *codec)
4497 if (!spec) 4500 if (!spec)
4498 return -ENOMEM; 4501 return -ENOMEM;
4499 codec->spec = spec; 4502 codec->spec = spec;
4503 snd_hda_gen_init(&spec->gen);
4500 4504
4501 switch (codec->vendor_id) { 4505 switch (codec->vendor_id) {
4502 case 0x14f15045: 4506 case 0x14f15045:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 224410e8e9e7..aa4c25e0f327 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1896,6 +1896,7 @@ static int alc_init(struct hda_codec *codec)
1896 alc_fix_pll(codec); 1896 alc_fix_pll(codec);
1897 alc_auto_init_amp(codec, spec->init_amp); 1897 alc_auto_init_amp(codec, spec->init_amp);
1898 1898
1899 snd_hda_gen_apply_verbs(codec);
1899 alc_init_special_input_src(codec); 1900 alc_init_special_input_src(codec);
1900 alc_auto_init_std(codec); 1901 alc_auto_init_std(codec);
1901 1902
@@ -2288,6 +2289,7 @@ static void alc_free(struct hda_codec *codec)
2288 alc_shutup(codec); 2289 alc_shutup(codec);
2289 alc_free_kctls(codec); 2290 alc_free_kctls(codec);
2290 alc_free_bind_ctls(codec); 2291 alc_free_bind_ctls(codec);
2292 snd_hda_gen_free(&spec->gen);
2291 kfree(spec); 2293 kfree(spec);
2292 snd_hda_detach_beep_device(codec); 2294 snd_hda_detach_beep_device(codec);
2293} 2295}
@@ -4252,6 +4254,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
4252 return -ENOMEM; 4254 return -ENOMEM;
4253 codec->spec = spec; 4255 codec->spec = spec;
4254 spec->mixer_nid = mixer_nid; 4256 spec->mixer_nid = mixer_nid;
4257 snd_hda_gen_init(&spec->gen);
4255 4258
4256 err = alc_codec_rename_from_preset(codec); 4259 err = alc_codec_rename_from_preset(codec);
4257 if (err < 0) { 4260 if (err < 0) {
@@ -6439,6 +6442,7 @@ enum {
6439 ALC662_FIXUP_ASUS_MODE7, 6442 ALC662_FIXUP_ASUS_MODE7,
6440 ALC662_FIXUP_ASUS_MODE8, 6443 ALC662_FIXUP_ASUS_MODE8,
6441 ALC662_FIXUP_NO_JACK_DETECT, 6444 ALC662_FIXUP_NO_JACK_DETECT,
6445 ALC662_FIXUP_ZOTAC_Z68,
6442}; 6446};
6443 6447
6444static const struct alc_fixup alc662_fixups[] = { 6448static const struct alc_fixup alc662_fixups[] = {
@@ -6588,6 +6592,13 @@ static const struct alc_fixup alc662_fixups[] = {
6588 .type = ALC_FIXUP_FUNC, 6592 .type = ALC_FIXUP_FUNC,
6589 .v.func = alc_fixup_no_jack_detect, 6593 .v.func = alc_fixup_no_jack_detect,
6590 }, 6594 },
6595 [ALC662_FIXUP_ZOTAC_Z68] = {
6596 .type = ALC_FIXUP_PINS,
6597 .v.pins = (const struct alc_pincfg[]) {
6598 { 0x1b, 0x02214020 }, /* Front HP */
6599 { }
6600 }
6601 },
6591}; 6602};
6592 6603
6593static const struct snd_pci_quirk alc662_fixup_tbl[] = { 6604static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6601,6 +6612,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6601 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 6612 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
6602 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 6613 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6603 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 6614 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
6615 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
6604 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), 6616 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
6605 6617
6606#if 0 6618#if 0
@@ -6676,6 +6688,31 @@ static const struct alc_model_fixup alc662_fixup_models[] = {
6676 {} 6688 {}
6677}; 6689};
6678 6690
6691static void alc662_fill_coef(struct hda_codec *codec)
6692{
6693 int val, coef;
6694
6695 coef = alc_get_coef0(codec);
6696
6697 switch (codec->vendor_id) {
6698 case 0x10ec0662:
6699 if ((coef & 0x00f0) == 0x0030) {
6700 val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */
6701 alc_write_coef_idx(codec, 0x4, val & ~(1<<10));
6702 }
6703 break;
6704 case 0x10ec0272:
6705 case 0x10ec0273:
6706 case 0x10ec0663:
6707 case 0x10ec0665:
6708 case 0x10ec0670:
6709 case 0x10ec0671:
6710 case 0x10ec0672:
6711 val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */
6712 alc_write_coef_idx(codec, 0xd, val | (1<<14));
6713 break;
6714 }
6715}
6679 6716
6680/* 6717/*
6681 */ 6718 */
@@ -6695,12 +6732,8 @@ static int patch_alc662(struct hda_codec *codec)
6695 6732
6696 alc_fix_pll_init(codec, 0x20, 0x04, 15); 6733 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6697 6734
6698 if ((alc_get_coef0(codec) & (1 << 14)) && 6735 spec->init_hook = alc662_fill_coef;
6699 codec->bus->pci->subsystem_vendor == 0x1025 && 6736 alc662_fill_coef(codec);
6700 spec->cdefine.platform_type == 1) {
6701 if (alc_codec_rename(codec, "ALC272X") < 0)
6702 goto error;
6703 }
6704 6737
6705 alc_pick_fixup(codec, alc662_fixup_models, 6738 alc_pick_fixup(codec, alc662_fixup_models,
6706 alc662_fixup_tbl, alc662_fixups); 6739 alc662_fixup_tbl, alc662_fixups);
@@ -6708,6 +6741,13 @@ static int patch_alc662(struct hda_codec *codec)
6708 6741
6709 alc_auto_parse_customize_define(codec); 6742 alc_auto_parse_customize_define(codec);
6710 6743
6744 if ((alc_get_coef0(codec) & (1 << 14)) &&
6745 codec->bus->pci->subsystem_vendor == 0x1025 &&
6746 spec->cdefine.platform_type == 1) {
6747 if (alc_codec_rename(codec, "ALC272X") < 0)
6748 goto error;
6749 }
6750
6711 /* automatic parse from the BIOS config */ 6751 /* automatic parse from the BIOS config */
6712 err = alc662_parse_auto_config(codec); 6752 err = alc662_parse_auto_config(codec);
6713 if (err < 0) 6753 if (err < 0)
@@ -6790,6 +6830,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
6790 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, 6830 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
6791 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, 6831 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
6792 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, 6832 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
6833 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
6793 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 6834 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
6794 .patch = patch_alc861 }, 6835 .patch = patch_alc861 },
6795 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 6836 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7db8228f1b88..07675282015a 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4367,7 +4367,7 @@ static int stac92xx_init(struct hda_codec *codec)
4367 AC_PINCTL_IN_EN); 4367 AC_PINCTL_IN_EN);
4368 for (i = 0; i < spec->num_pwrs; i++) { 4368 for (i = 0; i < spec->num_pwrs; i++) {
4369 hda_nid_t nid = spec->pwr_nids[i]; 4369 hda_nid_t nid = spec->pwr_nids[i];
4370 int pinctl, def_conf; 4370 unsigned int pinctl, def_conf;
4371 4371
4372 def_conf = snd_hda_codec_get_pincfg(codec, nid); 4372 def_conf = snd_hda_codec_get_pincfg(codec, nid);
4373 def_conf = get_defcfg_connect(def_conf); 4373 def_conf = get_defcfg_connect(def_conf);
@@ -4376,6 +4376,11 @@ static int stac92xx_init(struct hda_codec *codec)
4376 stac_toggle_power_map(codec, nid, 0); 4376 stac_toggle_power_map(codec, nid, 0);
4377 continue; 4377 continue;
4378 } 4378 }
4379 if (def_conf == AC_JACK_PORT_FIXED) {
4380 /* no need for jack detection for fixed pins */
4381 stac_toggle_power_map(codec, nid, 1);
4382 continue;
4383 }
4379 /* power on when no jack detection is available */ 4384 /* power on when no jack detection is available */
4380 /* or when the VREF is used for controlling LED */ 4385 /* or when the VREF is used for controlling LED */
4381 if (!spec->hp_detect || 4386 if (!spec->hp_detect ||
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 0a5027b94714..b8ac8710f47f 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -1988,6 +1988,13 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm)
1988 period = hdspm_read(hdspm, HDSPM_RD_PLL_FREQ); 1988 period = hdspm_read(hdspm, HDSPM_RD_PLL_FREQ);
1989 rate = hdspm_calc_dds_value(hdspm, period); 1989 rate = hdspm_calc_dds_value(hdspm, period);
1990 1990
1991 if (rate > 207000) {
1992 /* Unreasonable high sample rate as seen on PCI MADI cards.
1993 * Use the cached value instead.
1994 */
1995 rate = hdspm->system_sample_rate;
1996 }
1997
1991 return rate; 1998 return rate;
1992} 1999}
1993 2000
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 64d2a4fa34b2..e9b62b5ea637 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -935,9 +935,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
935 } 935 }
936 936
937found: 937found:
938 data = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 938 snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLLP_MASK, pll_p);
939 snd_soc_write(codec, AIC3X_PLL_PROGA_REG,
940 data | (pll_p << PLLP_SHIFT));
941 snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG, 939 snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG,
942 pll_r << PLLR_SHIFT); 940 pll_r << PLLR_SHIFT);
943 snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT); 941 snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT);
diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h
index 6f097fb60683..08c7f6685ff0 100644
--- a/sound/soc/codecs/tlv320aic3x.h
+++ b/sound/soc/codecs/tlv320aic3x.h
@@ -166,6 +166,7 @@
166 166
167/* PLL registers bitfields */ 167/* PLL registers bitfields */
168#define PLLP_SHIFT 0 168#define PLLP_SHIFT 0
169#define PLLP_MASK 7
169#define PLLQ_SHIFT 3 170#define PLLQ_SHIFT 3
170#define PLLR_SHIFT 0 171#define PLLR_SHIFT 0
171#define PLLJ_SHIFT 2 172#define PLLJ_SHIFT 2
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index a75c3766aede..0418fa11e6bd 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -99,8 +99,9 @@ static void wm2000_reset(struct wm2000_priv *wm2000)
99} 99}
100 100
101static int wm2000_poll_bit(struct i2c_client *i2c, 101static int wm2000_poll_bit(struct i2c_client *i2c,
102 unsigned int reg, u8 mask, int timeout) 102 unsigned int reg, u8 mask)
103{ 103{
104 int timeout = 4000;
104 int val; 105 int val;
105 106
106 val = wm2000_read(i2c, reg); 107 val = wm2000_read(i2c, reg);
@@ -119,7 +120,7 @@ static int wm2000_poll_bit(struct i2c_client *i2c,
119static int wm2000_power_up(struct i2c_client *i2c, int analogue) 120static int wm2000_power_up(struct i2c_client *i2c, int analogue)
120{ 121{
121 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 122 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
122 int ret, timeout; 123 int ret;
123 124
124 BUG_ON(wm2000->anc_mode != ANC_OFF); 125 BUG_ON(wm2000->anc_mode != ANC_OFF);
125 126
@@ -140,13 +141,13 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
140 141
141 /* Wait for ANC engine to become ready */ 142 /* Wait for ANC engine to become ready */
142 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, 143 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT,
143 WM2000_ANC_ENG_IDLE, 1)) { 144 WM2000_ANC_ENG_IDLE)) {
144 dev_err(&i2c->dev, "ANC engine failed to reset\n"); 145 dev_err(&i2c->dev, "ANC engine failed to reset\n");
145 return -ETIMEDOUT; 146 return -ETIMEDOUT;
146 } 147 }
147 148
148 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 149 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
149 WM2000_STATUS_BOOT_COMPLETE, 1)) { 150 WM2000_STATUS_BOOT_COMPLETE)) {
150 dev_err(&i2c->dev, "ANC engine failed to initialise\n"); 151 dev_err(&i2c->dev, "ANC engine failed to initialise\n");
151 return -ETIMEDOUT; 152 return -ETIMEDOUT;
152 } 153 }
@@ -173,16 +174,13 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
173 dev_dbg(&i2c->dev, "Download complete\n"); 174 dev_dbg(&i2c->dev, "Download complete\n");
174 175
175 if (analogue) { 176 if (analogue) {
176 timeout = 248; 177 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, 248 / 4);
177 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, timeout / 4);
178 178
179 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 179 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
180 WM2000_MODE_ANA_SEQ_INCLUDE | 180 WM2000_MODE_ANA_SEQ_INCLUDE |
181 WM2000_MODE_MOUSE_ENABLE | 181 WM2000_MODE_MOUSE_ENABLE |
182 WM2000_MODE_THERMAL_ENABLE); 182 WM2000_MODE_THERMAL_ENABLE);
183 } else { 183 } else {
184 timeout = 10;
185
186 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 184 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
187 WM2000_MODE_MOUSE_ENABLE | 185 WM2000_MODE_MOUSE_ENABLE |
188 WM2000_MODE_THERMAL_ENABLE); 186 WM2000_MODE_THERMAL_ENABLE);
@@ -201,9 +199,8 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
201 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR); 199 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR);
202 200
203 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 201 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
204 WM2000_STATUS_MOUSE_ACTIVE, timeout)) { 202 WM2000_STATUS_MOUSE_ACTIVE)) {
205 dev_err(&i2c->dev, "Timed out waiting for device after %dms\n", 203 dev_err(&i2c->dev, "Timed out waiting for device\n");
206 timeout * 10);
207 return -ETIMEDOUT; 204 return -ETIMEDOUT;
208 } 205 }
209 206
@@ -218,28 +215,25 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
218static int wm2000_power_down(struct i2c_client *i2c, int analogue) 215static int wm2000_power_down(struct i2c_client *i2c, int analogue)
219{ 216{
220 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 217 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
221 int timeout;
222 218
223 if (analogue) { 219 if (analogue) {
224 timeout = 248; 220 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4);
225 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, timeout / 4);
226 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 221 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
227 WM2000_MODE_ANA_SEQ_INCLUDE | 222 WM2000_MODE_ANA_SEQ_INCLUDE |
228 WM2000_MODE_POWER_DOWN); 223 WM2000_MODE_POWER_DOWN);
229 } else { 224 } else {
230 timeout = 10;
231 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 225 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
232 WM2000_MODE_POWER_DOWN); 226 WM2000_MODE_POWER_DOWN);
233 } 227 }
234 228
235 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 229 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
236 WM2000_STATUS_POWER_DOWN_COMPLETE, timeout)) { 230 WM2000_STATUS_POWER_DOWN_COMPLETE)) {
237 dev_err(&i2c->dev, "Timeout waiting for ANC power down\n"); 231 dev_err(&i2c->dev, "Timeout waiting for ANC power down\n");
238 return -ETIMEDOUT; 232 return -ETIMEDOUT;
239 } 233 }
240 234
241 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, 235 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT,
242 WM2000_ANC_ENG_IDLE, 1)) { 236 WM2000_ANC_ENG_IDLE)) {
243 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n"); 237 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n");
244 return -ETIMEDOUT; 238 return -ETIMEDOUT;
245 } 239 }
@@ -268,13 +262,13 @@ static int wm2000_enter_bypass(struct i2c_client *i2c, int analogue)
268 } 262 }
269 263
270 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 264 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
271 WM2000_STATUS_ANC_DISABLED, 10)) { 265 WM2000_STATUS_ANC_DISABLED)) {
272 dev_err(&i2c->dev, "Timeout waiting for ANC disable\n"); 266 dev_err(&i2c->dev, "Timeout waiting for ANC disable\n");
273 return -ETIMEDOUT; 267 return -ETIMEDOUT;
274 } 268 }
275 269
276 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, 270 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT,
277 WM2000_ANC_ENG_IDLE, 1)) { 271 WM2000_ANC_ENG_IDLE)) {
278 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n"); 272 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n");
279 return -ETIMEDOUT; 273 return -ETIMEDOUT;
280 } 274 }
@@ -311,7 +305,7 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue)
311 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR); 305 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR);
312 306
313 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 307 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
314 WM2000_STATUS_MOUSE_ACTIVE, 10)) { 308 WM2000_STATUS_MOUSE_ACTIVE)) {
315 dev_err(&i2c->dev, "Timed out waiting for MOUSE\n"); 309 dev_err(&i2c->dev, "Timed out waiting for MOUSE\n");
316 return -ETIMEDOUT; 310 return -ETIMEDOUT;
317 } 311 }
@@ -325,38 +319,32 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue)
325static int wm2000_enter_standby(struct i2c_client *i2c, int analogue) 319static int wm2000_enter_standby(struct i2c_client *i2c, int analogue)
326{ 320{
327 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 321 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
328 int timeout;
329 322
330 BUG_ON(wm2000->anc_mode != ANC_ACTIVE); 323 BUG_ON(wm2000->anc_mode != ANC_ACTIVE);
331 324
332 if (analogue) { 325 if (analogue) {
333 timeout = 248; 326 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4);
334 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, timeout / 4);
335 327
336 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 328 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
337 WM2000_MODE_ANA_SEQ_INCLUDE | 329 WM2000_MODE_ANA_SEQ_INCLUDE |
338 WM2000_MODE_THERMAL_ENABLE | 330 WM2000_MODE_THERMAL_ENABLE |
339 WM2000_MODE_STANDBY_ENTRY); 331 WM2000_MODE_STANDBY_ENTRY);
340 } else { 332 } else {
341 timeout = 10;
342
343 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 333 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
344 WM2000_MODE_THERMAL_ENABLE | 334 WM2000_MODE_THERMAL_ENABLE |
345 WM2000_MODE_STANDBY_ENTRY); 335 WM2000_MODE_STANDBY_ENTRY);
346 } 336 }
347 337
348 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 338 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
349 WM2000_STATUS_ANC_DISABLED, timeout)) { 339 WM2000_STATUS_ANC_DISABLED)) {
350 dev_err(&i2c->dev, 340 dev_err(&i2c->dev,
351 "Timed out waiting for ANC disable after 1ms\n"); 341 "Timed out waiting for ANC disable after 1ms\n");
352 return -ETIMEDOUT; 342 return -ETIMEDOUT;
353 } 343 }
354 344
355 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, WM2000_ANC_ENG_IDLE, 345 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, WM2000_ANC_ENG_IDLE)) {
356 1)) {
357 dev_err(&i2c->dev, 346 dev_err(&i2c->dev,
358 "Timed out waiting for standby after %dms\n", 347 "Timed out waiting for standby\n");
359 timeout * 10);
360 return -ETIMEDOUT; 348 return -ETIMEDOUT;
361 } 349 }
362 350
@@ -374,23 +362,19 @@ static int wm2000_enter_standby(struct i2c_client *i2c, int analogue)
374static int wm2000_exit_standby(struct i2c_client *i2c, int analogue) 362static int wm2000_exit_standby(struct i2c_client *i2c, int analogue)
375{ 363{
376 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 364 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
377 int timeout;
378 365
379 BUG_ON(wm2000->anc_mode != ANC_STANDBY); 366 BUG_ON(wm2000->anc_mode != ANC_STANDBY);
380 367
381 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); 368 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0);
382 369
383 if (analogue) { 370 if (analogue) {
384 timeout = 248; 371 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, 248 / 4);
385 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, timeout / 4);
386 372
387 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 373 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
388 WM2000_MODE_ANA_SEQ_INCLUDE | 374 WM2000_MODE_ANA_SEQ_INCLUDE |
389 WM2000_MODE_THERMAL_ENABLE | 375 WM2000_MODE_THERMAL_ENABLE |
390 WM2000_MODE_MOUSE_ENABLE); 376 WM2000_MODE_MOUSE_ENABLE);
391 } else { 377 } else {
392 timeout = 10;
393
394 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 378 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
395 WM2000_MODE_THERMAL_ENABLE | 379 WM2000_MODE_THERMAL_ENABLE |
396 WM2000_MODE_MOUSE_ENABLE); 380 WM2000_MODE_MOUSE_ENABLE);
@@ -400,9 +384,8 @@ static int wm2000_exit_standby(struct i2c_client *i2c, int analogue)
400 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR); 384 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR);
401 385
402 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 386 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
403 WM2000_STATUS_MOUSE_ACTIVE, timeout)) { 387 WM2000_STATUS_MOUSE_ACTIVE)) {
404 dev_err(&i2c->dev, "Timed out waiting for MOUSE after %dms\n", 388 dev_err(&i2c->dev, "Timed out waiting for MOUSE\n");
405 timeout * 10);
406 return -ETIMEDOUT; 389 return -ETIMEDOUT;
407 } 390 }
408 391
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index acbdc5fde923..32682c1b7cde 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1491,6 +1491,7 @@ static int wm2200_bclk_rates_dat[WM2200_NUM_BCLK_RATES] = {
1491 1491
1492static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = { 1492static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = {
1493 5644800, 1493 5644800,
1494 3763200,
1494 2882400, 1495 2882400,
1495 1881600, 1496 1881600,
1496 1411200, 1497 1411200,
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 65d525d74c54..812acd83fb48 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1863,6 +1863,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
1863 return ret; 1863 return ret;
1864 } 1864 }
1865 1865
1866 regcache_cache_only(wm8904->regmap, false);
1866 regcache_sync(wm8904->regmap); 1867 regcache_sync(wm8904->regmap);
1867 1868
1868 /* Enable bias */ 1869 /* Enable bias */
@@ -1899,14 +1900,8 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
1899 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, 1900 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0,
1900 WM8904_BIAS_ENA, 0); 1901 WM8904_BIAS_ENA, 0);
1901 1902
1902#ifdef CONFIG_REGULATOR 1903 regcache_cache_only(wm8904->regmap, true);
1903 /* Post 2.6.34 we will be able to get a callback when 1904 regcache_mark_dirty(wm8904->regmap);
1904 * the regulators are disabled which we can use but
1905 * for now just assume that the power will be cut if
1906 * the regulator API is in use.
1907 */
1908 codec->cache_sync = 1;
1909#endif
1910 1905
1911 regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), 1906 regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
1912 wm8904->supplies); 1907 wm8904->supplies);
@@ -2084,10 +2079,8 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2084{ 2079{
2085 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 2080 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2086 struct wm8904_pdata *pdata = wm8904->pdata; 2081 struct wm8904_pdata *pdata = wm8904->pdata;
2087 u16 *reg_cache = codec->reg_cache;
2088 int ret, i; 2082 int ret, i;
2089 2083
2090 codec->cache_sync = 1;
2091 codec->control_data = wm8904->regmap; 2084 codec->control_data = wm8904->regmap;
2092 2085
2093 switch (wm8904->devtype) { 2086 switch (wm8904->devtype) {
@@ -2150,6 +2143,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2150 goto err_enable; 2143 goto err_enable;
2151 } 2144 }
2152 2145
2146 regcache_cache_only(wm8904->regmap, true);
2153 /* Change some default settings - latch VU and enable ZC */ 2147 /* Change some default settings - latch VU and enable ZC */
2154 snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT, 2148 snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT,
2155 WM8904_ADC_VU, WM8904_ADC_VU); 2149 WM8904_ADC_VU, WM8904_ADC_VU);
@@ -2180,14 +2174,18 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2180 if (!pdata->gpio_cfg[i]) 2174 if (!pdata->gpio_cfg[i])
2181 continue; 2175 continue;
2182 2176
2183 reg_cache[WM8904_GPIO_CONTROL_1 + i] 2177 regmap_update_bits(wm8904->regmap,
2184 = pdata->gpio_cfg[i] & 0xffff; 2178 WM8904_GPIO_CONTROL_1 + i,
2179 0xffff,
2180 pdata->gpio_cfg[i]);
2185 } 2181 }
2186 2182
2187 /* Zero is the default value for these anyway */ 2183 /* Zero is the default value for these anyway */
2188 for (i = 0; i < WM8904_MIC_REGS; i++) 2184 for (i = 0; i < WM8904_MIC_REGS; i++)
2189 reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] 2185 regmap_update_bits(wm8904->regmap,
2190 = pdata->mic_cfg[i]; 2186 WM8904_MIC_BIAS_CONTROL_0 + i,
2187 0xffff,
2188 pdata->mic_cfg[i]);
2191 } 2189 }
2192 2190
2193 /* Set Class W by default - this will be managed by the Class 2191 /* Set Class W by default - this will be managed by the Class
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 993639d694ce..1436b6ce74d1 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -46,6 +46,39 @@
46#define WM8994_NUM_DRC 3 46#define WM8994_NUM_DRC 3
47#define WM8994_NUM_EQ 3 47#define WM8994_NUM_EQ 3
48 48
49static struct {
50 unsigned int reg;
51 unsigned int mask;
52} wm8994_vu_bits[] = {
53 { WM8994_LEFT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
54 { WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
55 { WM8994_LEFT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
56 { WM8994_RIGHT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
57 { WM8994_SPEAKER_VOLUME_LEFT, WM8994_SPKOUT_VU },
58 { WM8994_SPEAKER_VOLUME_RIGHT, WM8994_SPKOUT_VU },
59 { WM8994_LEFT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
60 { WM8994_RIGHT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
61 { WM8994_LEFT_OPGA_VOLUME, WM8994_MIXOUT_VU },
62 { WM8994_RIGHT_OPGA_VOLUME, WM8994_MIXOUT_VU },
63
64 { WM8994_AIF1_DAC1_LEFT_VOLUME, WM8994_AIF1DAC1_VU },
65 { WM8994_AIF1_DAC1_RIGHT_VOLUME, WM8994_AIF1DAC1_VU },
66 { WM8994_AIF1_DAC2_LEFT_VOLUME, WM8994_AIF1DAC2_VU },
67 { WM8994_AIF1_DAC2_RIGHT_VOLUME, WM8994_AIF1DAC2_VU },
68 { WM8994_AIF2_DAC_LEFT_VOLUME, WM8994_AIF2DAC_VU },
69 { WM8994_AIF2_DAC_RIGHT_VOLUME, WM8994_AIF2DAC_VU },
70 { WM8994_AIF1_ADC1_LEFT_VOLUME, WM8994_AIF1ADC1_VU },
71 { WM8994_AIF1_ADC1_RIGHT_VOLUME, WM8994_AIF1ADC1_VU },
72 { WM8994_AIF1_ADC2_LEFT_VOLUME, WM8994_AIF1ADC2_VU },
73 { WM8994_AIF1_ADC2_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
74 { WM8994_AIF2_ADC_LEFT_VOLUME, WM8994_AIF2ADC_VU },
75 { WM8994_AIF2_ADC_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
76 { WM8994_DAC1_LEFT_VOLUME, WM8994_DAC1_VU },
77 { WM8994_DAC1_RIGHT_VOLUME, WM8994_DAC1_VU },
78 { WM8994_DAC2_LEFT_VOLUME, WM8994_DAC2_VU },
79 { WM8994_DAC2_RIGHT_VOLUME, WM8994_DAC2_VU },
80};
81
49static int wm8994_drc_base[] = { 82static int wm8994_drc_base[] = {
50 WM8994_AIF1_DRC1_1, 83 WM8994_AIF1_DRC1_1,
51 WM8994_AIF1_DRC2_1, 84 WM8994_AIF1_DRC2_1,
@@ -694,9 +727,6 @@ static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode)
694 if (!wm8994->jackdet || !wm8994->jack_cb) 727 if (!wm8994->jackdet || !wm8994->jack_cb)
695 return; 728 return;
696 729
697 if (!wm8994->jackdet || !wm8994->jack_cb)
698 return;
699
700 if (wm8994->active_refcount) 730 if (wm8994->active_refcount)
701 mode = WM1811_JACKDET_MODE_AUDIO; 731 mode = WM1811_JACKDET_MODE_AUDIO;
702 732
@@ -989,6 +1019,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
989 struct snd_soc_codec *codec = w->codec; 1019 struct snd_soc_codec *codec = w->codec;
990 struct wm8994 *control = codec->control_data; 1020 struct wm8994 *control = codec->control_data;
991 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; 1021 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
1022 int i;
992 int dac; 1023 int dac;
993 int adc; 1024 int adc;
994 int val; 1025 int val;
@@ -1047,6 +1078,13 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1047 WM8994_AIF1DAC2L_ENA); 1078 WM8994_AIF1DAC2L_ENA);
1048 break; 1079 break;
1049 1080
1081 case SND_SOC_DAPM_POST_PMU:
1082 for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
1083 snd_soc_write(codec, wm8994_vu_bits[i].reg,
1084 snd_soc_read(codec,
1085 wm8994_vu_bits[i].reg));
1086 break;
1087
1050 case SND_SOC_DAPM_PRE_PMD: 1088 case SND_SOC_DAPM_PRE_PMD:
1051 case SND_SOC_DAPM_POST_PMD: 1089 case SND_SOC_DAPM_POST_PMD:
1052 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, 1090 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
@@ -1072,6 +1110,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1072 struct snd_kcontrol *kcontrol, int event) 1110 struct snd_kcontrol *kcontrol, int event)
1073{ 1111{
1074 struct snd_soc_codec *codec = w->codec; 1112 struct snd_soc_codec *codec = w->codec;
1113 int i;
1075 int dac; 1114 int dac;
1076 int adc; 1115 int adc;
1077 int val; 1116 int val;
@@ -1122,6 +1161,13 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1122 WM8994_AIF2DACR_ENA); 1161 WM8994_AIF2DACR_ENA);
1123 break; 1162 break;
1124 1163
1164 case SND_SOC_DAPM_POST_PMU:
1165 for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
1166 snd_soc_write(codec, wm8994_vu_bits[i].reg,
1167 snd_soc_read(codec,
1168 wm8994_vu_bits[i].reg));
1169 break;
1170
1125 case SND_SOC_DAPM_PRE_PMD: 1171 case SND_SOC_DAPM_PRE_PMD:
1126 case SND_SOC_DAPM_POST_PMD: 1172 case SND_SOC_DAPM_POST_PMD:
1127 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, 1173 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
@@ -1190,17 +1236,19 @@ static int late_enable_ev(struct snd_soc_dapm_widget *w,
1190 switch (event) { 1236 switch (event) {
1191 case SND_SOC_DAPM_PRE_PMU: 1237 case SND_SOC_DAPM_PRE_PMU:
1192 if (wm8994->aif1clk_enable) { 1238 if (wm8994->aif1clk_enable) {
1193 aif1clk_ev(w, kcontrol, event); 1239 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
1194 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1240 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1195 WM8994_AIF1CLK_ENA_MASK, 1241 WM8994_AIF1CLK_ENA_MASK,
1196 WM8994_AIF1CLK_ENA); 1242 WM8994_AIF1CLK_ENA);
1243 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
1197 wm8994->aif1clk_enable = 0; 1244 wm8994->aif1clk_enable = 0;
1198 } 1245 }
1199 if (wm8994->aif2clk_enable) { 1246 if (wm8994->aif2clk_enable) {
1200 aif2clk_ev(w, kcontrol, event); 1247 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
1201 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1248 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1202 WM8994_AIF2CLK_ENA_MASK, 1249 WM8994_AIF2CLK_ENA_MASK,
1203 WM8994_AIF2CLK_ENA); 1250 WM8994_AIF2CLK_ENA);
1251 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
1204 wm8994->aif2clk_enable = 0; 1252 wm8994->aif2clk_enable = 0;
1205 } 1253 }
1206 break; 1254 break;
@@ -1221,15 +1269,17 @@ static int late_disable_ev(struct snd_soc_dapm_widget *w,
1221 switch (event) { 1269 switch (event) {
1222 case SND_SOC_DAPM_POST_PMD: 1270 case SND_SOC_DAPM_POST_PMD:
1223 if (wm8994->aif1clk_disable) { 1271 if (wm8994->aif1clk_disable) {
1272 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
1224 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1273 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1225 WM8994_AIF1CLK_ENA_MASK, 0); 1274 WM8994_AIF1CLK_ENA_MASK, 0);
1226 aif1clk_ev(w, kcontrol, event); 1275 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
1227 wm8994->aif1clk_disable = 0; 1276 wm8994->aif1clk_disable = 0;
1228 } 1277 }
1229 if (wm8994->aif2clk_disable) { 1278 if (wm8994->aif2clk_disable) {
1279 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
1230 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1280 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1231 WM8994_AIF2CLK_ENA_MASK, 0); 1281 WM8994_AIF2CLK_ENA_MASK, 0);
1232 aif2clk_ev(w, kcontrol, event); 1282 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
1233 wm8994->aif2clk_disable = 0; 1283 wm8994->aif2clk_disable = 0;
1234 } 1284 }
1235 break; 1285 break;
@@ -1527,9 +1577,11 @@ SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev)
1527 1577
1528static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { 1578static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = {
1529SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev, 1579SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev,
1530 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), 1580 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1581 SND_SOC_DAPM_PRE_PMD),
1531SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev, 1582SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev,
1532 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), 1583 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1584 SND_SOC_DAPM_PRE_PMD),
1533SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0), 1585SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0),
1534SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0, 1586SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0,
1535 left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)), 1587 left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)),
@@ -3879,39 +3931,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3879 3931
3880 pm_runtime_put(codec->dev); 3932 pm_runtime_put(codec->dev);
3881 3933
3882 /* Latch volume updates (right only; we always do left then right). */ 3934 /* Latch volume update bits */
3883 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_LEFT_VOLUME, 3935 for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
3884 WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); 3936 snd_soc_update_bits(codec, wm8994_vu_bits[i].reg,
3885 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME, 3937 wm8994_vu_bits[i].mask,
3886 WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); 3938 wm8994_vu_bits[i].mask);
3887 snd_soc_update_bits(codec, WM8994_AIF1_DAC2_LEFT_VOLUME,
3888 WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
3889 snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME,
3890 WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
3891 snd_soc_update_bits(codec, WM8994_AIF2_DAC_LEFT_VOLUME,
3892 WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
3893 snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME,
3894 WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
3895 snd_soc_update_bits(codec, WM8994_AIF1_ADC1_LEFT_VOLUME,
3896 WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
3897 snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME,
3898 WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
3899 snd_soc_update_bits(codec, WM8994_AIF1_ADC2_LEFT_VOLUME,
3900 WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
3901 snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME,
3902 WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
3903 snd_soc_update_bits(codec, WM8994_AIF2_ADC_LEFT_VOLUME,
3904 WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
3905 snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME,
3906 WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
3907 snd_soc_update_bits(codec, WM8994_DAC1_LEFT_VOLUME,
3908 WM8994_DAC1_VU, WM8994_DAC1_VU);
3909 snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME,
3910 WM8994_DAC1_VU, WM8994_DAC1_VU);
3911 snd_soc_update_bits(codec, WM8994_DAC2_LEFT_VOLUME,
3912 WM8994_DAC2_VU, WM8994_DAC2_VU);
3913 snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME,
3914 WM8994_DAC2_VU, WM8994_DAC2_VU);
3915 3939
3916 /* Set the low bit of the 3D stereo depth so TLV matches */ 3940 /* Set the low bit of the 3D stereo depth so TLV matches */
3917 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2, 3941 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2,
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 8af422e38fd0..dc9b42b7fc4d 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2837,8 +2837,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2837 } 2837 }
2838 } 2838 }
2839 2839
2840 regcache_cache_only(codec->control_data, true);
2841
2842 /* Apply platform data settings */ 2840 /* Apply platform data settings */
2843 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL, 2841 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL,
2844 WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK, 2842 WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK,
@@ -3051,7 +3049,6 @@ static int wm8996_remove(struct snd_soc_codec *codec)
3051 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) 3049 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
3052 regulator_unregister_notifier(wm8996->supplies[i].consumer, 3050 regulator_unregister_notifier(wm8996->supplies[i].consumer,
3053 &wm8996->disable_nb[i]); 3051 &wm8996->disable_nb[i]);
3054 regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3055 3052
3056 return 0; 3053 return 0;
3057} 3054}
@@ -3206,14 +3203,15 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c,
3206 dev_info(&i2c->dev, "revision %c\n", 3203 dev_info(&i2c->dev, "revision %c\n",
3207 (reg & WM8996_CHIP_REV_MASK) + 'A'); 3204 (reg & WM8996_CHIP_REV_MASK) + 'A');
3208 3205
3209 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3210
3211 ret = wm8996_reset(wm8996); 3206 ret = wm8996_reset(wm8996);
3212 if (ret < 0) { 3207 if (ret < 0) {
3213 dev_err(&i2c->dev, "Failed to issue reset\n"); 3208 dev_err(&i2c->dev, "Failed to issue reset\n");
3214 goto err_regmap; 3209 goto err_regmap;
3215 } 3210 }
3216 3211
3212 regcache_cache_only(wm8996->regmap, true);
3213 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3214
3217 wm8996_init_gpio(wm8996); 3215 wm8996_init_gpio(wm8996);
3218 3216
3219 ret = snd_soc_register_codec(&i2c->dev, 3217 ret = snd_soc_register_codec(&i2c->dev,
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index f23700359c67..080327414c6b 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -26,6 +26,7 @@
26#include <linux/of_device.h> 26#include <linux/of_device.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/pinctrl/consumer.h>
29 30
30#include "imx-audmux.h" 31#include "imx-audmux.h"
31 32
@@ -249,6 +250,7 @@ EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port);
249static int __devinit imx_audmux_probe(struct platform_device *pdev) 250static int __devinit imx_audmux_probe(struct platform_device *pdev)
250{ 251{
251 struct resource *res; 252 struct resource *res;
253 struct pinctrl *pinctrl;
252 const struct of_device_id *of_id = 254 const struct of_device_id *of_id =
253 of_match_device(imx_audmux_dt_ids, &pdev->dev); 255 of_match_device(imx_audmux_dt_ids, &pdev->dev);
254 256
@@ -257,6 +259,12 @@ static int __devinit imx_audmux_probe(struct platform_device *pdev)
257 if (!audmux_base) 259 if (!audmux_base)
258 return -EADDRNOTAVAIL; 260 return -EADDRNOTAVAIL;
259 261
262 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
263 if (IS_ERR(pinctrl)) {
264 dev_err(&pdev->dev, "setup pinctrl failed!");
265 return PTR_ERR(pinctrl);
266 }
267
260 audmux_clk = clk_get(&pdev->dev, "audmux"); 268 audmux_clk = clk_get(&pdev->dev, "audmux");
261 if (IS_ERR(audmux_clk)) { 269 if (IS_ERR(audmux_clk)) {
262 dev_dbg(&pdev->dev, "cannot get clock: %ld\n", 270 dev_dbg(&pdev->dev, "cannot get clock: %ld\n",
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 456b7d723d66..ee27ba3933bd 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -29,6 +29,7 @@
29 29
30#include <asm/fiq.h> 30#include <asm/fiq.h>
31 31
32#include <mach/irqs.h>
32#include <mach/ssi.h> 33#include <mach/ssi.h>
33 34
34#include "imx-ssi.h" 35#include "imx-ssi.h"
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index cf3ed0362c9c..28dd76c7cb1c 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -543,7 +543,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
543 ret); 543 ret);
544 goto failed_clk; 544 goto failed_clk;
545 } 545 }
546 clk_enable(ssi->clk); 546 clk_prepare_enable(ssi->clk);
547 547
548 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 548 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
549 if (!res) { 549 if (!res) {
@@ -641,7 +641,7 @@ failed_ac97:
641failed_ioremap: 641failed_ioremap:
642 release_mem_region(res->start, resource_size(res)); 642 release_mem_region(res->start, resource_size(res));
643failed_get_resource: 643failed_get_resource:
644 clk_disable(ssi->clk); 644 clk_disable_unprepare(ssi->clk);
645 clk_put(ssi->clk); 645 clk_put(ssi->clk);
646failed_clk: 646failed_clk:
647 kfree(ssi); 647 kfree(ssi);
@@ -664,7 +664,7 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
664 664
665 iounmap(ssi->base); 665 iounmap(ssi->base);
666 release_mem_region(res->start, resource_size(res)); 666 release_mem_region(res->start, resource_size(res));
667 clk_disable(ssi->clk); 667 clk_disable_unprepare(ssi->clk);
668 clk_put(ssi->clk); 668 clk_put(ssi->clk);
669 kfree(ssi); 669 kfree(ssi);
670 670
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 1c2aa7fab3fd..4da5fc55c7ee 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -33,7 +33,6 @@
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/dma.h> 35#include <mach/dma.h>
36#include <mach/audio.h>
37 36
38#include "../../arm/pxa2xx-pcm.h" 37#include "../../arm/pxa2xx-pcm.h"
39#include "pxa-ssp.h" 38#include "pxa-ssp.h"
@@ -194,7 +193,7 @@ static void pxa_ssp_set_scr(struct ssp_device *ssp, u32 div)
194{ 193{
195 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0); 194 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
196 195
197 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) { 196 if (ssp->type == PXA25x_SSP) {
198 sscr0 &= ~0x0000ff00; 197 sscr0 &= ~0x0000ff00;
199 sscr0 |= ((div - 2)/2) << 8; /* 2..512 */ 198 sscr0 |= ((div - 2)/2) << 8; /* 2..512 */
200 } else { 199 } else {
@@ -212,7 +211,7 @@ static u32 pxa_ssp_get_scr(struct ssp_device *ssp)
212 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0); 211 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
213 u32 div; 212 u32 div;
214 213
215 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) 214 if (ssp->type == PXA25x_SSP)
216 div = ((sscr0 >> 8) & 0xff) * 2 + 2; 215 div = ((sscr0 >> 8) & 0xff) * 2 + 2;
217 else 216 else
218 div = ((sscr0 >> 8) & 0xfff) + 1; 217 div = ((sscr0 >> 8) & 0xfff) + 1;
@@ -242,7 +241,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
242 break; 241 break;
243 case PXA_SSP_CLK_PLL: 242 case PXA_SSP_CLK_PLL:
244 /* Internal PLL is fixed */ 243 /* Internal PLL is fixed */
245 if (cpu_is_pxa25x()) 244 if (ssp->type == PXA25x_SSP)
246 priv->sysclk = 1843200; 245 priv->sysclk = 1843200;
247 else 246 else
248 priv->sysclk = 13000000; 247 priv->sysclk = 13000000;
@@ -266,11 +265,11 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
266 265
267 /* The SSP clock must be disabled when changing SSP clock mode 266 /* The SSP clock must be disabled when changing SSP clock mode
268 * on PXA2xx. On PXA3xx it must be enabled when doing so. */ 267 * on PXA2xx. On PXA3xx it must be enabled when doing so. */
269 if (!cpu_is_pxa3xx()) 268 if (ssp->type != PXA3xx_SSP)
270 clk_disable(ssp->clk); 269 clk_disable(ssp->clk);
271 val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0; 270 val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0;
272 pxa_ssp_write_reg(ssp, SSCR0, val); 271 pxa_ssp_write_reg(ssp, SSCR0, val);
273 if (!cpu_is_pxa3xx()) 272 if (ssp->type != PXA3xx_SSP)
274 clk_enable(ssp->clk); 273 clk_enable(ssp->clk);
275 274
276 return 0; 275 return 0;
@@ -294,24 +293,20 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
294 case PXA_SSP_AUDIO_DIV_SCDB: 293 case PXA_SSP_AUDIO_DIV_SCDB:
295 val = pxa_ssp_read_reg(ssp, SSACD); 294 val = pxa_ssp_read_reg(ssp, SSACD);
296 val &= ~SSACD_SCDB; 295 val &= ~SSACD_SCDB;
297#if defined(CONFIG_PXA3xx) 296 if (ssp->type == PXA3xx_SSP)
298 if (cpu_is_pxa3xx())
299 val &= ~SSACD_SCDX8; 297 val &= ~SSACD_SCDX8;
300#endif
301 switch (div) { 298 switch (div) {
302 case PXA_SSP_CLK_SCDB_1: 299 case PXA_SSP_CLK_SCDB_1:
303 val |= SSACD_SCDB; 300 val |= SSACD_SCDB;
304 break; 301 break;
305 case PXA_SSP_CLK_SCDB_4: 302 case PXA_SSP_CLK_SCDB_4:
306 break; 303 break;
307#if defined(CONFIG_PXA3xx)
308 case PXA_SSP_CLK_SCDB_8: 304 case PXA_SSP_CLK_SCDB_8:
309 if (cpu_is_pxa3xx()) 305 if (ssp->type == PXA3xx_SSP)
310 val |= SSACD_SCDX8; 306 val |= SSACD_SCDX8;
311 else 307 else
312 return -EINVAL; 308 return -EINVAL;
313 break; 309 break;
314#endif
315 default: 310 default:
316 return -EINVAL; 311 return -EINVAL;
317 } 312 }
@@ -337,10 +332,8 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
337 struct ssp_device *ssp = priv->ssp; 332 struct ssp_device *ssp = priv->ssp;
338 u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70; 333 u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70;
339 334
340#if defined(CONFIG_PXA3xx) 335 if (ssp->type == PXA3xx_SSP)
341 if (cpu_is_pxa3xx())
342 pxa_ssp_write_reg(ssp, SSACDD, 0); 336 pxa_ssp_write_reg(ssp, SSACDD, 0);
343#endif
344 337
345 switch (freq_out) { 338 switch (freq_out) {
346 case 5622000: 339 case 5622000:
@@ -365,11 +358,10 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
365 break; 358 break;
366 359
367 default: 360 default:
368#ifdef CONFIG_PXA3xx
369 /* PXA3xx has a clock ditherer which can be used to generate 361 /* PXA3xx has a clock ditherer which can be used to generate
370 * a wider range of frequencies - calculate a value for it. 362 * a wider range of frequencies - calculate a value for it.
371 */ 363 */
372 if (cpu_is_pxa3xx()) { 364 if (ssp->type == PXA3xx_SSP) {
373 u32 val; 365 u32 val;
374 u64 tmp = 19968; 366 u64 tmp = 19968;
375 tmp *= 1000000; 367 tmp *= 1000000;
@@ -386,7 +378,6 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
386 val, freq_out); 378 val, freq_out);
387 break; 379 break;
388 } 380 }
389#endif
390 381
391 return -EINVAL; 382 return -EINVAL;
392 } 383 }
@@ -590,10 +581,8 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
590 /* bit size */ 581 /* bit size */
591 switch (params_format(params)) { 582 switch (params_format(params)) {
592 case SNDRV_PCM_FORMAT_S16_LE: 583 case SNDRV_PCM_FORMAT_S16_LE:
593#ifdef CONFIG_PXA3xx 584 if (ssp->type == PXA3xx_SSP)
594 if (cpu_is_pxa3xx())
595 sscr0 |= SSCR0_FPCKE; 585 sscr0 |= SSCR0_FPCKE;
596#endif
597 sscr0 |= SSCR0_DataSize(16); 586 sscr0 |= SSCR0_DataSize(16);
598 break; 587 break;
599 case SNDRV_PCM_FORMAT_S24_LE: 588 case SNDRV_PCM_FORMAT_S24_LE:
@@ -618,9 +607,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
618 * trying and failing a lot; some of the registers 607 * trying and failing a lot; some of the registers
619 * needed for that mode are only available on PXA3xx. 608 * needed for that mode are only available on PXA3xx.
620 */ 609 */
621 610 if (ssp->type != PXA3xx_SSP)
622#ifdef CONFIG_PXA3xx
623 if (!cpu_is_pxa3xx())
624 return -EINVAL; 611 return -EINVAL;
625 612
626 sspsp |= SSPSP_SFRMWDTH(width * 2); 613 sspsp |= SSPSP_SFRMWDTH(width * 2);
@@ -628,9 +615,6 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
628 sspsp |= SSPSP_EDMYSTOP(3); 615 sspsp |= SSPSP_EDMYSTOP(3);
629 sspsp |= SSPSP_DMYSTOP(3); 616 sspsp |= SSPSP_DMYSTOP(3);
630 sspsp |= SSPSP_DMYSTRT(1); 617 sspsp |= SSPSP_DMYSTRT(1);
631#else
632 return -EINVAL;
633#endif
634 } else { 618 } else {
635 /* The frame width is the width the LRCLK is 619 /* The frame width is the width the LRCLK is
636 * asserted for; the delay is expressed in 620 * asserted for; the delay is expressed in
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index ddc6cde14e2a..f3ebc38c10fe 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -74,7 +74,7 @@ static void dma_enqueue(struct snd_pcm_substream *substream)
74 struct runtime_data *prtd = substream->runtime->private_data; 74 struct runtime_data *prtd = substream->runtime->private_data;
75 dma_addr_t pos = prtd->dma_pos; 75 dma_addr_t pos = prtd->dma_pos;
76 unsigned int limit; 76 unsigned int limit;
77 struct samsung_dma_prep_info dma_info; 77 struct samsung_dma_prep dma_info;
78 78
79 pr_debug("Entered %s\n", __func__); 79 pr_debug("Entered %s\n", __func__);
80 80
@@ -146,7 +146,8 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
146 unsigned long totbytes = params_buffer_bytes(params); 146 unsigned long totbytes = params_buffer_bytes(params);
147 struct s3c_dma_params *dma = 147 struct s3c_dma_params *dma =
148 snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 148 snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
149 struct samsung_dma_info dma_info; 149 struct samsung_dma_req req;
150 struct samsung_dma_config config;
150 151
151 pr_debug("Entered %s\n", __func__); 152 pr_debug("Entered %s\n", __func__);
152 153
@@ -166,16 +167,17 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
166 167
167 prtd->params->ops = samsung_dma_get_ops(); 168 prtd->params->ops = samsung_dma_get_ops();
168 169
169 dma_info.cap = (samsung_dma_has_circular() ? 170 req.cap = (samsung_dma_has_circular() ?
170 DMA_CYCLIC : DMA_SLAVE); 171 DMA_CYCLIC : DMA_SLAVE);
171 dma_info.client = prtd->params->client; 172 req.client = prtd->params->client;
172 dma_info.direction = 173 config.direction =
173 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK 174 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
174 ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM); 175 ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
175 dma_info.width = prtd->params->dma_size; 176 config.width = prtd->params->dma_size;
176 dma_info.fifo = prtd->params->dma_addr; 177 config.fifo = prtd->params->dma_addr;
177 prtd->params->ch = prtd->params->ops->request( 178 prtd->params->ch = prtd->params->ops->request(
178 prtd->params->channel, &dma_info); 179 prtd->params->channel, &req);
180 prtd->params->ops->config(prtd->params->ch, &config);
179 } 181 }
180 182
181 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 183 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 7cee22515d9d..2ef98536f1da 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1052,6 +1052,13 @@ static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io)
1052 return 0; 1052 return 0;
1053} 1053}
1054 1054
1055static dma_addr_t fsi_dma_get_area(struct fsi_stream *io)
1056{
1057 struct snd_pcm_runtime *runtime = io->substream->runtime;
1058
1059 return io->dma + samples_to_bytes(runtime, io->buff_sample_pos);
1060}
1061
1055static void fsi_dma_complete(void *data) 1062static void fsi_dma_complete(void *data)
1056{ 1063{
1057 struct fsi_stream *io = (struct fsi_stream *)data; 1064 struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1061,7 +1068,7 @@ static void fsi_dma_complete(void *data)
1061 enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? 1068 enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
1062 DMA_TO_DEVICE : DMA_FROM_DEVICE; 1069 DMA_TO_DEVICE : DMA_FROM_DEVICE;
1063 1070
1064 dma_sync_single_for_cpu(dai->dev, io->dma, 1071 dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io),
1065 samples_to_bytes(runtime, io->period_samples), dir); 1072 samples_to_bytes(runtime, io->period_samples), dir);
1066 1073
1067 io->buff_sample_pos += io->period_samples; 1074 io->buff_sample_pos += io->period_samples;
@@ -1078,13 +1085,6 @@ static void fsi_dma_complete(void *data)
1078 snd_pcm_period_elapsed(io->substream); 1085 snd_pcm_period_elapsed(io->substream);
1079} 1086}
1080 1087
1081static dma_addr_t fsi_dma_get_area(struct fsi_stream *io)
1082{
1083 struct snd_pcm_runtime *runtime = io->substream->runtime;
1084
1085 return io->dma + samples_to_bytes(runtime, io->buff_sample_pos);
1086}
1087
1088static void fsi_dma_do_tasklet(unsigned long data) 1088static void fsi_dma_do_tasklet(unsigned long data)
1089{ 1089{
1090 struct fsi_stream *io = (struct fsi_stream *)data; 1090 struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1110,7 +1110,7 @@ static void fsi_dma_do_tasklet(unsigned long data)
1110 len = samples_to_bytes(runtime, io->period_samples); 1110 len = samples_to_bytes(runtime, io->period_samples);
1111 buf = fsi_dma_get_area(io); 1111 buf = fsi_dma_get_area(io);
1112 1112
1113 dma_sync_single_for_device(dai->dev, io->dma, len, dir); 1113 dma_sync_single_for_device(dai->dev, buf, len, dir);
1114 1114
1115 sg_init_table(&sg, 1); 1115 sg_init_table(&sg, 1);
1116 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)), 1116 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)),
@@ -1172,9 +1172,16 @@ static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
1172static void fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io, 1172static void fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
1173 int start) 1173 int start)
1174{ 1174{
1175 struct fsi_master *master = fsi_get_master(fsi);
1176 u32 clk = fsi_is_port_a(fsi) ? CRA : CRB;
1175 u32 enable = start ? DMA_ON : 0; 1177 u32 enable = start ? DMA_ON : 0;
1176 1178
1177 fsi_reg_mask_set(fsi, OUT_DMAC, DMA_ON, enable); 1179 fsi_reg_mask_set(fsi, OUT_DMAC, DMA_ON, enable);
1180
1181 dmaengine_terminate_all(io->chan);
1182
1183 if (fsi_is_clk_master(fsi))
1184 fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0);
1178} 1185}
1179 1186
1180static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io) 1187static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 90ee77d2409d..89eae93445cf 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -913,7 +913,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
913 /* do we need to add this widget to the list ? */ 913 /* do we need to add this widget to the list ? */
914 if (list) { 914 if (list) {
915 int err; 915 int err;
916 err = dapm_list_add_widget(list, path->sink); 916 err = dapm_list_add_widget(list, path->source);
917 if (err < 0) { 917 if (err < 0) {
918 dev_err(widget->dapm->dev, "could not add widget %s\n", 918 dev_err(widget->dapm->dev, "could not add widget %s\n",
919 widget->name); 919 widget->name);
@@ -954,7 +954,7 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
954 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 954 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
955 paths = is_connected_output_ep(dai->playback_widget, list); 955 paths = is_connected_output_ep(dai->playback_widget, list);
956 else 956 else
957 paths = is_connected_input_ep(dai->playback_widget, list); 957 paths = is_connected_input_ep(dai->capture_widget, list);
958 958
959 trace_snd_soc_dapm_connected(paths, stream); 959 trace_snd_soc_dapm_connected(paths, stream);
960 dapm_clear_walk(&card->dapm); 960 dapm_clear_walk(&card->dapm);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index bedd1717a373..48fd15b312c1 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -794,6 +794,9 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
794 for (i = 0; i < card->num_links; i++) { 794 for (i = 0; i < card->num_links; i++) {
795 be = &card->rtd[i]; 795 be = &card->rtd[i];
796 796
797 if (!be->dai_link->no_pcm)
798 continue;
799
797 if (be->cpu_dai->playback_widget == widget || 800 if (be->cpu_dai->playback_widget == widget ||
798 be->codec_dai->playback_widget == widget) 801 be->codec_dai->playback_widget == widget)
799 return be; 802 return be;
@@ -803,6 +806,9 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
803 for (i = 0; i < card->num_links; i++) { 806 for (i = 0; i < card->num_links; i++) {
804 be = &card->rtd[i]; 807 be = &card->rtd[i];
805 808
809 if (!be->dai_link->no_pcm)
810 continue;
811
806 if (be->cpu_dai->capture_widget == widget || 812 if (be->cpu_dai->capture_widget == widget ||
807 be->codec_dai->capture_widget == widget) 813 be->codec_dai->capture_widget == widget)
808 return be; 814 return be;
diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig
index c1c8e955f4d3..76dc230f2bb0 100644
--- a/sound/soc/tegra/Kconfig
+++ b/sound/soc/tegra/Kconfig
@@ -58,17 +58,9 @@ config SND_SOC_TEGRA_WM8753
58 Say Y or M here if you want to add support for SoC audio on Tegra 58 Say Y or M here if you want to add support for SoC audio on Tegra
59 boards using the WM8753 codec, such as Whistler. 59 boards using the WM8753 codec, such as Whistler.
60 60
61config MACH_HAS_SND_SOC_TEGRA_WM8903
62 bool
63 help
64 Machines that use the SND_SOC_TEGRA_WM8903 driver should select
65 this config option, in order to allow the user to enable
66 SND_SOC_TEGRA_WM8903.
67
68config SND_SOC_TEGRA_WM8903 61config SND_SOC_TEGRA_WM8903
69 tristate "SoC Audio support for Tegra boards using a WM8903 codec" 62 tristate "SoC Audio support for Tegra boards using a WM8903 codec"
70 depends on SND_SOC_TEGRA && I2C 63 depends on SND_SOC_TEGRA && I2C
71 depends on MACH_HAS_SND_SOC_TEGRA_WM8903
72 select SND_SOC_TEGRA20_I2S if ARCH_TEGRA_2x_SOC 64 select SND_SOC_TEGRA20_I2S if ARCH_TEGRA_2x_SOC
73 select SND_SOC_TEGRA30_I2S if ARCH_TEGRA_3x_SOC 65 select SND_SOC_TEGRA30_I2S if ARCH_TEGRA_3x_SOC
74 select SND_SOC_WM8903 66 select SND_SOC_WM8903
@@ -79,7 +71,7 @@ config SND_SOC_TEGRA_WM8903
79 71
80config SND_SOC_TEGRA_TRIMSLICE 72config SND_SOC_TEGRA_TRIMSLICE
81 tristate "SoC Audio support for TrimSlice board" 73 tristate "SoC Audio support for TrimSlice board"
82 depends on SND_SOC_TEGRA && MACH_TRIMSLICE && I2C 74 depends on SND_SOC_TEGRA && I2C
83 select SND_SOC_TEGRA20_I2S if ARCH_TEGRA_2x_SOC 75 select SND_SOC_TEGRA20_I2S if ARCH_TEGRA_2x_SOC
84 select SND_SOC_TLV320AIC23 76 select SND_SOC_TLV320AIC23
85 help 77 help
diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c
index 0c7af63d444b..1647dbfe74b5 100644
--- a/sound/soc/tegra/tegra20_i2s.c
+++ b/sound/soc/tegra/tegra20_i2s.c
@@ -62,7 +62,7 @@ static int tegra20_i2s_runtime_suspend(struct device *dev)
62{ 62{
63 struct tegra20_i2s *i2s = dev_get_drvdata(dev); 63 struct tegra20_i2s *i2s = dev_get_drvdata(dev);
64 64
65 clk_disable(i2s->clk_i2s); 65 clk_disable_unprepare(i2s->clk_i2s);
66 66
67 return 0; 67 return 0;
68} 68}
@@ -72,7 +72,7 @@ static int tegra20_i2s_runtime_resume(struct device *dev)
72 struct tegra20_i2s *i2s = dev_get_drvdata(dev); 72 struct tegra20_i2s *i2s = dev_get_drvdata(dev);
73 int ret; 73 int ret;
74 74
75 ret = clk_enable(i2s->clk_i2s); 75 ret = clk_prepare_enable(i2s->clk_i2s);
76 if (ret) { 76 if (ret) {
77 dev_err(dev, "clk_enable failed: %d\n", ret); 77 dev_err(dev, "clk_enable failed: %d\n", ret);
78 return ret; 78 return ret;
diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
index f9b57418bd08..2262e4fdec2a 100644
--- a/sound/soc/tegra/tegra20_spdif.c
+++ b/sound/soc/tegra/tegra20_spdif.c
@@ -54,7 +54,7 @@ static int tegra20_spdif_runtime_suspend(struct device *dev)
54{ 54{
55 struct tegra20_spdif *spdif = dev_get_drvdata(dev); 55 struct tegra20_spdif *spdif = dev_get_drvdata(dev);
56 56
57 clk_disable(spdif->clk_spdif_out); 57 clk_disable_unprepare(spdif->clk_spdif_out);
58 58
59 return 0; 59 return 0;
60} 60}
@@ -64,7 +64,7 @@ static int tegra20_spdif_runtime_resume(struct device *dev)
64 struct tegra20_spdif *spdif = dev_get_drvdata(dev); 64 struct tegra20_spdif *spdif = dev_get_drvdata(dev);
65 int ret; 65 int ret;
66 66
67 ret = clk_enable(spdif->clk_spdif_out); 67 ret = clk_prepare_enable(spdif->clk_spdif_out);
68 if (ret) { 68 if (ret) {
69 dev_err(dev, "clk_enable failed: %d\n", ret); 69 dev_err(dev, "clk_enable failed: %d\n", ret);
70 return ret; 70 return ret;
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 57cd419f743e..bf5610122c76 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -56,8 +56,8 @@ static int tegra30_ahub_runtime_suspend(struct device *dev)
56 regcache_cache_only(ahub->regmap_apbif, true); 56 regcache_cache_only(ahub->regmap_apbif, true);
57 regcache_cache_only(ahub->regmap_ahub, true); 57 regcache_cache_only(ahub->regmap_ahub, true);
58 58
59 clk_disable(ahub->clk_apbif); 59 clk_disable_unprepare(ahub->clk_apbif);
60 clk_disable(ahub->clk_d_audio); 60 clk_disable_unprepare(ahub->clk_d_audio);
61 61
62 return 0; 62 return 0;
63} 63}
@@ -77,12 +77,12 @@ static int tegra30_ahub_runtime_resume(struct device *dev)
77{ 77{
78 int ret; 78 int ret;
79 79
80 ret = clk_enable(ahub->clk_d_audio); 80 ret = clk_prepare_enable(ahub->clk_d_audio);
81 if (ret) { 81 if (ret) {
82 dev_err(dev, "clk_enable d_audio failed: %d\n", ret); 82 dev_err(dev, "clk_enable d_audio failed: %d\n", ret);
83 return ret; 83 return ret;
84 } 84 }
85 ret = clk_enable(ahub->clk_apbif); 85 ret = clk_prepare_enable(ahub->clk_apbif);
86 if (ret) { 86 if (ret) {
87 dev_err(dev, "clk_enable apbif failed: %d\n", ret); 87 dev_err(dev, "clk_enable apbif failed: %d\n", ret);
88 clk_disable(ahub->clk_d_audio); 88 clk_disable(ahub->clk_d_audio);
@@ -629,3 +629,4 @@ MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
629MODULE_DESCRIPTION("Tegra30 AHUB driver"); 629MODULE_DESCRIPTION("Tegra30 AHUB driver");
630MODULE_LICENSE("GPL v2"); 630MODULE_LICENSE("GPL v2");
631MODULE_ALIAS("platform:" DRV_NAME); 631MODULE_ALIAS("platform:" DRV_NAME);
632MODULE_DEVICE_TABLE(of, tegra30_ahub_of_match);
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index 8596032985dc..d308faaae148 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -62,7 +62,7 @@ static int tegra30_i2s_runtime_suspend(struct device *dev)
62 62
63 regcache_cache_only(i2s->regmap, true); 63 regcache_cache_only(i2s->regmap, true);
64 64
65 clk_disable(i2s->clk_i2s); 65 clk_disable_unprepare(i2s->clk_i2s);
66 66
67 return 0; 67 return 0;
68} 68}
@@ -72,7 +72,7 @@ static int tegra30_i2s_runtime_resume(struct device *dev)
72 struct tegra30_i2s *i2s = dev_get_drvdata(dev); 72 struct tegra30_i2s *i2s = dev_get_drvdata(dev);
73 int ret; 73 int ret;
74 74
75 ret = clk_enable(i2s->clk_i2s); 75 ret = clk_prepare_enable(i2s->clk_i2s);
76 if (ret) { 76 if (ret) {
77 dev_err(dev, "clk_enable failed: %d\n", ret); 77 dev_err(dev, "clk_enable failed: %d\n", ret);
78 return ret; 78 return ret;
diff --git a/sound/soc/tegra/tegra_asoc_utils.c b/sound/soc/tegra/tegra_asoc_utils.c
index 9515ce58ea02..6872c77a1196 100644
--- a/sound/soc/tegra/tegra_asoc_utils.c
+++ b/sound/soc/tegra/tegra_asoc_utils.c
@@ -69,9 +69,9 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
69 data->set_baseclock = 0; 69 data->set_baseclock = 0;
70 data->set_mclk = 0; 70 data->set_mclk = 0;
71 71
72 clk_disable(data->clk_cdev1); 72 clk_disable_unprepare(data->clk_cdev1);
73 clk_disable(data->clk_pll_a_out0); 73 clk_disable_unprepare(data->clk_pll_a_out0);
74 clk_disable(data->clk_pll_a); 74 clk_disable_unprepare(data->clk_pll_a);
75 75
76 err = clk_set_rate(data->clk_pll_a, new_baseclock); 76 err = clk_set_rate(data->clk_pll_a, new_baseclock);
77 if (err) { 77 if (err) {
@@ -87,19 +87,19 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
87 87
88 /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */ 88 /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */
89 89
90 err = clk_enable(data->clk_pll_a); 90 err = clk_prepare_enable(data->clk_pll_a);
91 if (err) { 91 if (err) {
92 dev_err(data->dev, "Can't enable pll_a: %d\n", err); 92 dev_err(data->dev, "Can't enable pll_a: %d\n", err);
93 return err; 93 return err;
94 } 94 }
95 95
96 err = clk_enable(data->clk_pll_a_out0); 96 err = clk_prepare_enable(data->clk_pll_a_out0);
97 if (err) { 97 if (err) {
98 dev_err(data->dev, "Can't enable pll_a_out0: %d\n", err); 98 dev_err(data->dev, "Can't enable pll_a_out0: %d\n", err);
99 return err; 99 return err;
100 } 100 }
101 101
102 err = clk_enable(data->clk_cdev1); 102 err = clk_prepare_enable(data->clk_cdev1);
103 if (err) { 103 if (err) {
104 dev_err(data->dev, "Can't enable cdev1: %d\n", err); 104 dev_err(data->dev, "Can't enable cdev1: %d\n", err);
105 return err; 105 return err;
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index 0b0df49d9d33..3b6da91188a9 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -346,6 +346,17 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
346 return 0; 346 return 0;
347} 347}
348 348
349static int tegra_wm8903_remove(struct snd_soc_card *card)
350{
351 struct snd_soc_pcm_runtime *rtd = &(card->rtd[0]);
352 struct snd_soc_dai *codec_dai = rtd->codec_dai;
353 struct snd_soc_codec *codec = codec_dai->codec;
354
355 wm8903_mic_detect(codec, NULL, 0, 0);
356
357 return 0;
358}
359
349static struct snd_soc_dai_link tegra_wm8903_dai = { 360static struct snd_soc_dai_link tegra_wm8903_dai = {
350 .name = "WM8903", 361 .name = "WM8903",
351 .stream_name = "WM8903 PCM", 362 .stream_name = "WM8903 PCM",
@@ -363,6 +374,8 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = {
363 .dai_link = &tegra_wm8903_dai, 374 .dai_link = &tegra_wm8903_dai,
364 .num_links = 1, 375 .num_links = 1,
365 376
377 .remove = tegra_wm8903_remove,
378
366 .controls = tegra_wm8903_controls, 379 .controls = tegra_wm8903_controls,
367 .num_controls = ARRAY_SIZE(tegra_wm8903_controls), 380 .num_controls = ARRAY_SIZE(tegra_wm8903_controls),
368 .dapm_widgets = tegra_wm8903_dapm_widgets, 381 .dapm_widgets = tegra_wm8903_dapm_widgets,
diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
index 6f9715ab32fe..56ad923bf6b5 100644
--- a/sound/usb/6fire/firmware.c
+++ b/sound/usb/6fire/firmware.c
@@ -209,7 +209,7 @@ static int usb6fire_fw_ezusb_upload(
209 int ret; 209 int ret;
210 u8 data; 210 u8 data;
211 struct usb_device *device = interface_to_usbdev(intf); 211 struct usb_device *device = interface_to_usbdev(intf);
212 const struct firmware *fw = 0; 212 const struct firmware *fw = NULL;
213 struct ihex_record *rec = kmalloc(sizeof(struct ihex_record), 213 struct ihex_record *rec = kmalloc(sizeof(struct ihex_record),
214 GFP_KERNEL); 214 GFP_KERNEL);
215 215
diff --git a/sound/usb/card.h b/sound/usb/card.h
index 0d37238b8457..2b9fffff23b6 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -119,6 +119,7 @@ struct snd_usb_substream {
119 unsigned long unlink_mask; /* bitmask of unlinked urbs */ 119 unsigned long unlink_mask; /* bitmask of unlinked urbs */
120 120
121 /* data and sync endpoints for this stream */ 121 /* data and sync endpoints for this stream */
122 unsigned int ep_num; /* the endpoint number */
122 struct snd_usb_endpoint *data_endpoint; 123 struct snd_usb_endpoint *data_endpoint;
123 struct snd_usb_endpoint *sync_endpoint; 124 struct snd_usb_endpoint *sync_endpoint;
124 unsigned long flags; 125 unsigned long flags;
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index e6906901debb..0f647d22cb4a 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -414,7 +414,7 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
414{ 414{
415 struct list_head *p; 415 struct list_head *p;
416 struct snd_usb_endpoint *ep; 416 struct snd_usb_endpoint *ep;
417 int ret, is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK; 417 int is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;
418 418
419 mutex_lock(&chip->mutex); 419 mutex_lock(&chip->mutex);
420 420
@@ -434,16 +434,6 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
434 type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync", 434 type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync",
435 ep_num); 435 ep_num);
436 436
437 /* select the alt setting once so the endpoints become valid */
438 ret = usb_set_interface(chip->dev, alts->desc.bInterfaceNumber,
439 alts->desc.bAlternateSetting);
440 if (ret < 0) {
441 snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
442 __func__, ret);
443 ep = NULL;
444 goto __exit_unlock;
445 }
446
447 ep = kzalloc(sizeof(*ep), GFP_KERNEL); 437 ep = kzalloc(sizeof(*ep), GFP_KERNEL);
448 if (!ep) 438 if (!ep)
449 goto __exit_unlock; 439 goto __exit_unlock;
@@ -831,9 +821,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
831 if (++ep->use_count != 1) 821 if (++ep->use_count != 1)
832 return 0; 822 return 0;
833 823
834 if (snd_BUG_ON(!test_bit(EP_FLAG_ACTIVATED, &ep->flags)))
835 return -EINVAL;
836
837 /* just to be sure */ 824 /* just to be sure */
838 deactivate_urbs(ep, 0, 1); 825 deactivate_urbs(ep, 0, 1);
839 wait_clear_urbs(ep); 826 wait_clear_urbs(ep);
@@ -911,9 +898,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
911 if (snd_BUG_ON(ep->use_count == 0)) 898 if (snd_BUG_ON(ep->use_count == 0))
912 return; 899 return;
913 900
914 if (snd_BUG_ON(!test_bit(EP_FLAG_ACTIVATED, &ep->flags)))
915 return;
916
917 if (--ep->use_count == 0) { 901 if (--ep->use_count == 0) {
918 deactivate_urbs(ep, force, can_sleep); 902 deactivate_urbs(ep, force, can_sleep);
919 ep->data_subs = NULL; 903 ep->data_subs = NULL;
@@ -927,42 +911,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
927} 911}
928 912
929/** 913/**
930 * snd_usb_endpoint_activate: activate an snd_usb_endpoint
931 *
932 * @ep: the endpoint to activate
933 *
934 * If the endpoint is not currently in use, this functions will select the
935 * correct alternate interface setting for the interface of this endpoint.
936 *
937 * In case of any active users, this functions does nothing.
938 *
939 * Returns an error if usb_set_interface() failed, 0 in all other
940 * cases.
941 */
942int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep)
943{
944 if (ep->use_count != 0)
945 return 0;
946
947 if (!ep->chip->shutdown &&
948 !test_and_set_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
949 int ret;
950
951 ret = usb_set_interface(ep->chip->dev, ep->iface, ep->alt_idx);
952 if (ret < 0) {
953 snd_printk(KERN_ERR "%s() usb_set_interface() failed, ret = %d\n",
954 __func__, ret);
955 clear_bit(EP_FLAG_ACTIVATED, &ep->flags);
956 return ret;
957 }
958
959 return 0;
960 }
961
962 return -EBUSY;
963}
964
965/**
966 * snd_usb_endpoint_deactivate: deactivate an snd_usb_endpoint 914 * snd_usb_endpoint_deactivate: deactivate an snd_usb_endpoint
967 * 915 *
968 * @ep: the endpoint to deactivate 916 * @ep: the endpoint to deactivate
@@ -980,24 +928,15 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
980 if (!ep) 928 if (!ep)
981 return -EINVAL; 929 return -EINVAL;
982 930
931 deactivate_urbs(ep, 1, 1);
932 wait_clear_urbs(ep);
933
983 if (ep->use_count != 0) 934 if (ep->use_count != 0)
984 return 0; 935 return 0;
985 936
986 if (!ep->chip->shutdown && 937 clear_bit(EP_FLAG_ACTIVATED, &ep->flags);
987 test_and_clear_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
988 int ret;
989
990 ret = usb_set_interface(ep->chip->dev, ep->iface, 0);
991 if (ret < 0) {
992 snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
993 __func__, ret);
994 return ret;
995 }
996 938
997 return 0; 939 return 0;
998 }
999
1000 return -EBUSY;
1001} 940}
1002 941
1003/** 942/**
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
index 41daaa24c25f..e71fe55cebef 100644
--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -341,6 +341,14 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
341 .map = audigy2nx_map, 341 .map = audigy2nx_map,
342 .selector_map = audigy2nx_selectors, 342 .selector_map = audigy2nx_selectors,
343 }, 343 },
344 { /* Logitech, Inc. QuickCam Pro for Notebooks */
345 .id = USB_ID(0x046d, 0x0991),
346 .ignore_ctl_error = 1,
347 },
348 { /* Logitech, Inc. QuickCam E 3500 */
349 .id = USB_ID(0x046d, 0x09a4),
350 .ignore_ctl_error = 1,
351 },
344 { 352 {
345 /* Hercules DJ Console (Windows Edition) */ 353 /* Hercules DJ Console (Windows Edition) */
346 .id = USB_ID(0x06f8, 0xb000), 354 .id = USB_ID(0x06f8, 0xb000),
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 24839d932648..a1298f379428 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -261,19 +261,6 @@ static void stop_endpoints(struct snd_usb_substream *subs,
261 force, can_sleep, wait); 261 force, can_sleep, wait);
262} 262}
263 263
264static int activate_endpoints(struct snd_usb_substream *subs)
265{
266 if (subs->sync_endpoint) {
267 int ret;
268
269 ret = snd_usb_endpoint_activate(subs->sync_endpoint);
270 if (ret < 0)
271 return ret;
272 }
273
274 return snd_usb_endpoint_activate(subs->data_endpoint);
275}
276
277static int deactivate_endpoints(struct snd_usb_substream *subs) 264static int deactivate_endpoints(struct snd_usb_substream *subs)
278{ 265{
279 int reta, retb; 266 int reta, retb;
@@ -314,6 +301,33 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
314 if (fmt == subs->cur_audiofmt) 301 if (fmt == subs->cur_audiofmt)
315 return 0; 302 return 0;
316 303
304 /* close the old interface */
305 if (subs->interface >= 0 && subs->interface != fmt->iface) {
306 err = usb_set_interface(subs->dev, subs->interface, 0);
307 if (err < 0) {
308 snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed (%d)\n",
309 dev->devnum, fmt->iface, fmt->altsetting, err);
310 return -EIO;
311 }
312 subs->interface = -1;
313 subs->altset_idx = 0;
314 }
315
316 /* set interface */
317 if (subs->interface != fmt->iface ||
318 subs->altset_idx != fmt->altset_idx) {
319 err = usb_set_interface(dev, fmt->iface, fmt->altsetting);
320 if (err < 0) {
321 snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed (%d)\n",
322 dev->devnum, fmt->iface, fmt->altsetting, err);
323 return -EIO;
324 }
325 snd_printdd(KERN_INFO "setting usb interface %d:%d\n",
326 fmt->iface, fmt->altsetting);
327 subs->interface = fmt->iface;
328 subs->altset_idx = fmt->altset_idx;
329 }
330
317 subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip, 331 subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip,
318 alts, fmt->endpoint, subs->direction, 332 alts, fmt->endpoint, subs->direction,
319 SND_USB_ENDPOINT_TYPE_DATA); 333 SND_USB_ENDPOINT_TYPE_DATA);
@@ -354,17 +368,21 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
354 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 368 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
355 get_endpoint(alts, 1)->bSynchAddress != 0 && 369 get_endpoint(alts, 1)->bSynchAddress != 0 &&
356 !implicit_fb)) { 370 !implicit_fb)) {
357 snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n", 371 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n",
358 dev->devnum, fmt->iface, fmt->altsetting); 372 dev->devnum, fmt->iface, fmt->altsetting,
373 get_endpoint(alts, 1)->bmAttributes,
374 get_endpoint(alts, 1)->bLength,
375 get_endpoint(alts, 1)->bSynchAddress);
359 return -EINVAL; 376 return -EINVAL;
360 } 377 }
361 ep = get_endpoint(alts, 1)->bEndpointAddress; 378 ep = get_endpoint(alts, 1)->bEndpointAddress;
362 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 379 if (!implicit_fb &&
380 get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
363 (( is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || 381 (( is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
364 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)) || 382 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
365 ( is_playback && !implicit_fb))) { 383 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n",
366 snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n", 384 dev->devnum, fmt->iface, fmt->altsetting,
367 dev->devnum, fmt->iface, fmt->altsetting); 385 is_playback, ep, get_endpoint(alts, 0)->bSynchAddress);
368 return -EINVAL; 386 return -EINVAL;
369 } 387 }
370 388
@@ -383,7 +401,7 @@ add_sync_ep:
383 subs->data_endpoint->sync_master = subs->sync_endpoint; 401 subs->data_endpoint->sync_master = subs->sync_endpoint;
384 } 402 }
385 403
386 if ((err = snd_usb_init_pitch(subs->stream->chip, subs->interface, alts, fmt)) < 0) 404 if ((err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt)) < 0)
387 return err; 405 return err;
388 406
389 subs->cur_audiofmt = fmt; 407 subs->cur_audiofmt = fmt;
@@ -446,7 +464,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
446 struct usb_interface *iface; 464 struct usb_interface *iface;
447 iface = usb_ifnum_to_if(subs->dev, fmt->iface); 465 iface = usb_ifnum_to_if(subs->dev, fmt->iface);
448 alts = &iface->altsetting[fmt->altset_idx]; 466 alts = &iface->altsetting[fmt->altset_idx];
449 ret = snd_usb_init_sample_rate(subs->stream->chip, subs->interface, alts, fmt, rate); 467 ret = snd_usb_init_sample_rate(subs->stream->chip, fmt->iface, alts, fmt, rate);
450 if (ret < 0) 468 if (ret < 0)
451 return ret; 469 return ret;
452 subs->cur_rate = rate; 470 subs->cur_rate = rate;
@@ -456,12 +474,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
456 mutex_lock(&subs->stream->chip->shutdown_mutex); 474 mutex_lock(&subs->stream->chip->shutdown_mutex);
457 /* format changed */ 475 /* format changed */
458 stop_endpoints(subs, 0, 0, 0); 476 stop_endpoints(subs, 0, 0, 0);
459 deactivate_endpoints(subs);
460
461 ret = activate_endpoints(subs);
462 if (ret < 0)
463 goto unlock;
464
465 ret = snd_usb_endpoint_set_params(subs->data_endpoint, hw_params, fmt, 477 ret = snd_usb_endpoint_set_params(subs->data_endpoint, hw_params, fmt,
466 subs->sync_endpoint); 478 subs->sync_endpoint);
467 if (ret < 0) 479 if (ret < 0)
@@ -496,6 +508,7 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
496 subs->period_bytes = 0; 508 subs->period_bytes = 0;
497 mutex_lock(&subs->stream->chip->shutdown_mutex); 509 mutex_lock(&subs->stream->chip->shutdown_mutex);
498 stop_endpoints(subs, 0, 1, 1); 510 stop_endpoints(subs, 0, 1, 1);
511 deactivate_endpoints(subs);
499 mutex_unlock(&subs->stream->chip->shutdown_mutex); 512 mutex_unlock(&subs->stream->chip->shutdown_mutex);
500 return snd_pcm_lib_free_vmalloc_buffer(substream); 513 return snd_pcm_lib_free_vmalloc_buffer(substream);
501} 514}
@@ -788,6 +801,9 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime,
788 int count = 0, needs_knot = 0; 801 int count = 0, needs_knot = 0;
789 int err; 802 int err;
790 803
804 kfree(subs->rate_list.list);
805 subs->rate_list.list = NULL;
806
791 list_for_each_entry(fp, &subs->fmt_list, list) { 807 list_for_each_entry(fp, &subs->fmt_list, list) {
792 if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) 808 if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)
793 return 0; 809 return 0;
@@ -931,16 +947,20 @@ static int snd_usb_pcm_open(struct snd_pcm_substream *substream, int direction)
931 947
932static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction) 948static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
933{ 949{
934 int ret;
935 struct snd_usb_stream *as = snd_pcm_substream_chip(substream); 950 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
936 struct snd_usb_substream *subs = &as->substream[direction]; 951 struct snd_usb_substream *subs = &as->substream[direction];
937 952
938 stop_endpoints(subs, 0, 0, 0); 953 stop_endpoints(subs, 0, 0, 0);
939 ret = deactivate_endpoints(subs); 954
955 if (!as->chip->shutdown && subs->interface >= 0) {
956 usb_set_interface(subs->dev, subs->interface, 0);
957 subs->interface = -1;
958 }
959
940 subs->pcm_substream = NULL; 960 subs->pcm_substream = NULL;
941 snd_usb_autosuspend(subs->stream->chip); 961 snd_usb_autosuspend(subs->stream->chip);
942 962
943 return ret; 963 return 0;
944} 964}
945 965
946/* Since a URB can handle only a single linear buffer, we must use double 966/* Since a URB can handle only a single linear buffer, we must use double
@@ -1144,7 +1164,8 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea
1144 return -EINVAL; 1164 return -EINVAL;
1145} 1165}
1146 1166
1147int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream, int cmd) 1167static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream,
1168 int cmd)
1148{ 1169{
1149 int err; 1170 int err;
1150 struct snd_usb_substream *subs = substream->runtime->private_data; 1171 struct snd_usb_substream *subs = substream->runtime->private_data;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index d89ab4c7d44b..79780fa57a43 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -1831,6 +1831,36 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1831 } 1831 }
1832 } 1832 }
1833}, 1833},
1834{
1835 USB_DEVICE(0x0582, 0x014d),
1836 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1837 /* .vendor_name = "BOSS", */
1838 /* .product_name = "GT-100", */
1839 .ifnum = QUIRK_ANY_INTERFACE,
1840 .type = QUIRK_COMPOSITE,
1841 .data = (const struct snd_usb_audio_quirk[]) {
1842 {
1843 .ifnum = 1,
1844 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1845 },
1846 {
1847 .ifnum = 2,
1848 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1849 },
1850 {
1851 .ifnum = 3,
1852 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1853 .data = & (const struct snd_usb_midi_endpoint_info) {
1854 .out_cables = 0x0001,
1855 .in_cables = 0x0001
1856 }
1857 },
1858 {
1859 .ifnum = -1
1860 }
1861 }
1862 }
1863},
1834 1864
1835/* Guillemot devices */ 1865/* Guillemot devices */
1836{ 1866{
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 6b7d7a2b7baa..083ed81160e5 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -97,6 +97,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
97 subs->formats |= fp->formats; 97 subs->formats |= fp->formats;
98 subs->num_formats++; 98 subs->num_formats++;
99 subs->fmt_type = fp->fmt_type; 99 subs->fmt_type = fp->fmt_type;
100 subs->ep_num = fp->endpoint;
100} 101}
101 102
102/* 103/*
@@ -119,9 +120,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
119 if (as->fmt_type != fp->fmt_type) 120 if (as->fmt_type != fp->fmt_type)
120 continue; 121 continue;
121 subs = &as->substream[stream]; 122 subs = &as->substream[stream];
122 if (!subs->data_endpoint) 123 if (subs->ep_num == fp->endpoint) {
123 continue;
124 if (subs->data_endpoint->ep_num == fp->endpoint) {
125 list_add_tail(&fp->list, &subs->fmt_list); 124 list_add_tail(&fp->list, &subs->fmt_list);
126 subs->num_formats++; 125 subs->num_formats++;
127 subs->formats |= fp->formats; 126 subs->formats |= fp->formats;
@@ -134,7 +133,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
134 if (as->fmt_type != fp->fmt_type) 133 if (as->fmt_type != fp->fmt_type)
135 continue; 134 continue;
136 subs = &as->substream[stream]; 135 subs = &as->substream[stream];
137 if (subs->data_endpoint) 136 if (subs->ep_num)
138 continue; 137 continue;
139 err = snd_pcm_new_stream(as->pcm, stream, 1); 138 err = snd_pcm_new_stream(as->pcm, stream, 1);
140 if (err < 0) 139 if (err < 0)