aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/aoa/core/gpio-pmf.c9
-rw-r--r--sound/aoa/fabrics/layout.c2
-rw-r--r--sound/aoa/soundbus/core.c8
-rw-r--r--sound/aoa/soundbus/i2sbus/control.c2
-rw-r--r--sound/aoa/soundbus/i2sbus/core.c8
-rw-r--r--sound/aoa/soundbus/sysfs.c4
-rw-r--r--sound/core/pcm_lib.c13
-rw-r--r--sound/core/pcm_native.c39
-rw-r--r--sound/mips/au1x00.c1
-rw-r--r--sound/oss/dmasound/dmasound_atari.c5
-rw-r--r--sound/pci/asihpi/hpi.h8
-rw-r--r--sound/pci/asihpi/hpi6000.c6
-rw-r--r--sound/pci/asihpi/hpi6205.c21
-rw-r--r--sound/pci/asihpi/hpi_internal.h5
-rw-r--r--sound/pci/asihpi/hpicmn.c38
-rw-r--r--sound/pci/asihpi/hpifunc.c17
-rw-r--r--sound/pci/asihpi/hpios.c23
-rw-r--r--sound/pci/asihpi/hpios.h9
-rw-r--r--sound/pci/aw2/aw2-alsa.c11
-rw-r--r--sound/pci/emu10k1/emufx.c36
-rw-r--r--sound/pci/hda/hda_intel.c11
-rw-r--r--sound/pci/hda/patch_conexant.c2
-rw-r--r--sound/pci/hda/patch_realtek.c84
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/soc/codecs/wm8350.c4
-rw-r--r--sound/soc/codecs/wm8400.c18
-rw-r--r--sound/soc/codecs/wm8990.c18
-rw-r--r--sound/soc/fsl/mpc5200_dma.c6
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c2
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c4
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c10
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c7
-rw-r--r--sound/soc/sh/siu.h3
-rw-r--r--sound/soc/sh/siu_dai.c2
-rw-r--r--sound/soc/sh/siu_pcm.c9
-rw-r--r--sound/soc/txx9/txx9aclc.c7
-rw-r--r--sound/sparc/amd7930.c7
-rw-r--r--sound/sparc/cs4231.c13
-rw-r--r--sound/sparc/dbri.c9
-rw-r--r--sound/usb/caiaq/control.c36
-rw-r--r--sound/usb/caiaq/device.c8
-rw-r--r--sound/usb/caiaq/input.c2
-rw-r--r--sound/usb/endpoint.c64
-rw-r--r--sound/usb/format.c24
-rw-r--r--sound/usb/format.h7
-rw-r--r--sound/usb/midi.c110
-rw-r--r--sound/usb/midi.h2
-rw-r--r--sound/usb/mixer.c2
-rw-r--r--sound/usb/pcm.c37
-rw-r--r--sound/usb/quirks-table.h11
-rw-r--r--sound/usb/quirks.c1
-rw-r--r--sound/usb/usbaudio.h1
52 files changed, 458 insertions, 330 deletions
diff --git a/sound/aoa/core/gpio-pmf.c b/sound/aoa/core/gpio-pmf.c
index 6776d1c12b63..7e267c9379bc 100644
--- a/sound/aoa/core/gpio-pmf.c
+++ b/sound/aoa/core/gpio-pmf.c
@@ -116,12 +116,9 @@ static void pmf_gpio_exit(struct gpio_runtime *rt)
116 mutex_destroy(&rt->line_in_notify.mutex); 116 mutex_destroy(&rt->line_in_notify.mutex);
117 mutex_destroy(&rt->line_out_notify.mutex); 117 mutex_destroy(&rt->line_out_notify.mutex);
118 118
119 if (rt->headphone_notify.gpio_private) 119 kfree(rt->headphone_notify.gpio_private);
120 kfree(rt->headphone_notify.gpio_private); 120 kfree(rt->line_in_notify.gpio_private);
121 if (rt->line_in_notify.gpio_private) 121 kfree(rt->line_out_notify.gpio_private);
122 kfree(rt->line_in_notify.gpio_private);
123 if (rt->line_out_notify.gpio_private)
124 kfree(rt->line_out_notify.gpio_private);
125} 122}
126 123
127static void pmf_handle_notify_irq(void *data) 124static void pmf_handle_notify_irq(void *data)
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index 1cd9b301df03..3fd1a7e24928 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -992,7 +992,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
992 return -ENODEV; 992 return -ENODEV;
993 993
994 /* by breaking out we keep a reference */ 994 /* by breaking out we keep a reference */
995 while ((sound = of_get_next_child(sdev->ofdev.node, sound))) { 995 while ((sound = of_get_next_child(sdev->ofdev.dev.of_node, sound))) {
996 if (sound->type && strcasecmp(sound->type, "soundchip") == 0) 996 if (sound->type && strcasecmp(sound->type, "soundchip") == 0)
997 break; 997 break;
998 } 998 }
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c
index fa8ab2815a98..99ca7120e269 100644
--- a/sound/aoa/soundbus/core.c
+++ b/sound/aoa/soundbus/core.c
@@ -74,11 +74,11 @@ static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env)
74 of = &soundbus_dev->ofdev; 74 of = &soundbus_dev->ofdev;
75 75
76 /* stuff we want to pass to /sbin/hotplug */ 76 /* stuff we want to pass to /sbin/hotplug */
77 retval = add_uevent_var(env, "OF_NAME=%s", of->node->name); 77 retval = add_uevent_var(env, "OF_NAME=%s", of->dev.of_node->name);
78 if (retval) 78 if (retval)
79 return retval; 79 return retval;
80 80
81 retval = add_uevent_var(env, "OF_TYPE=%s", of->node->type); 81 retval = add_uevent_var(env, "OF_TYPE=%s", of->dev.of_node->type);
82 if (retval) 82 if (retval)
83 return retval; 83 return retval;
84 84
@@ -86,7 +86,7 @@ static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env)
86 * it's not really legal to split it out with commas. We split it 86 * it's not really legal to split it out with commas. We split it
87 * up using a number of environment variables instead. */ 87 * up using a number of environment variables instead. */
88 88
89 compat = of_get_property(of->node, "compatible", &cplen); 89 compat = of_get_property(of->dev.of_node, "compatible", &cplen);
90 while (compat && cplen > 0) { 90 while (compat && cplen > 0) {
91 int tmp = env->buflen; 91 int tmp = env->buflen;
92 retval = add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat); 92 retval = add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat);
@@ -169,7 +169,7 @@ int soundbus_add_one(struct soundbus_dev *dev)
169 169
170 /* sanity checks */ 170 /* sanity checks */
171 if (!dev->attach_codec || 171 if (!dev->attach_codec ||
172 !dev->ofdev.node || 172 !dev->ofdev.dev.of_node ||
173 dev->pcmname || 173 dev->pcmname ||
174 dev->pcmid != -1) { 174 dev->pcmid != -1) {
175 printk(KERN_ERR "soundbus: adding device failed sanity check!\n"); 175 printk(KERN_ERR "soundbus: adding device failed sanity check!\n");
diff --git a/sound/aoa/soundbus/i2sbus/control.c b/sound/aoa/soundbus/i2sbus/control.c
index 47f854c2001f..4dc9b49c02cf 100644
--- a/sound/aoa/soundbus/i2sbus/control.c
+++ b/sound/aoa/soundbus/i2sbus/control.c
@@ -42,7 +42,7 @@ int i2sbus_control_add_dev(struct i2sbus_control *c,
42{ 42{
43 struct device_node *np; 43 struct device_node *np;
44 44
45 np = i2sdev->sound.ofdev.node; 45 np = i2sdev->sound.ofdev.dev.of_node;
46 i2sdev->enable = pmf_find_function(np, "enable"); 46 i2sdev->enable = pmf_find_function(np, "enable");
47 i2sdev->cell_enable = pmf_find_function(np, "cell-enable"); 47 i2sdev->cell_enable = pmf_find_function(np, "cell-enable");
48 i2sdev->clock_enable = pmf_find_function(np, "clock-enable"); 48 i2sdev->clock_enable = pmf_find_function(np, "clock-enable");
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index 9d6f3b176ed1..678933721735 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -221,9 +221,9 @@ static int i2sbus_add_dev(struct macio_dev *macio,
221 221
222 mutex_init(&dev->lock); 222 mutex_init(&dev->lock);
223 spin_lock_init(&dev->low_lock); 223 spin_lock_init(&dev->low_lock);
224 dev->sound.ofdev.node = np; 224 dev->sound.ofdev.archdata.dma_mask = macio->ofdev.archdata.dma_mask;
225 dev->sound.ofdev.dma_mask = macio->ofdev.dma_mask; 225 dev->sound.ofdev.dev.of_node = np;
226 dev->sound.ofdev.dev.dma_mask = &dev->sound.ofdev.dma_mask; 226 dev->sound.ofdev.dev.dma_mask = &dev->sound.ofdev.archdata.dma_mask;
227 dev->sound.ofdev.dev.parent = &macio->ofdev.dev; 227 dev->sound.ofdev.dev.parent = &macio->ofdev.dev;
228 dev->sound.ofdev.dev.release = i2sbus_release_dev; 228 dev->sound.ofdev.dev.release = i2sbus_release_dev;
229 dev->sound.attach_codec = i2sbus_attach_codec; 229 dev->sound.attach_codec = i2sbus_attach_codec;
@@ -346,7 +346,7 @@ static int i2sbus_probe(struct macio_dev* dev, const struct of_device_id *match)
346 return -ENODEV; 346 return -ENODEV;
347 } 347 }
348 348
349 while ((np = of_get_next_child(dev->ofdev.node, np))) { 349 while ((np = of_get_next_child(dev->ofdev.dev.of_node, np))) {
350 if (of_device_is_compatible(np, "i2sbus") || 350 if (of_device_is_compatible(np, "i2sbus") ||
351 of_device_is_compatible(np, "i2s-modem")) { 351 of_device_is_compatible(np, "i2s-modem")) {
352 got += i2sbus_add_dev(dev, control, np); 352 got += i2sbus_add_dev(dev, control, np);
diff --git a/sound/aoa/soundbus/sysfs.c b/sound/aoa/soundbus/sysfs.c
index f580942b5c09..6496e754f00a 100644
--- a/sound/aoa/soundbus/sysfs.c
+++ b/sound/aoa/soundbus/sysfs.c
@@ -9,7 +9,7 @@ field##_show (struct device *dev, struct device_attribute *attr, \
9 char *buf) \ 9 char *buf) \
10{ \ 10{ \
11 struct soundbus_dev *mdev = to_soundbus_device (dev); \ 11 struct soundbus_dev *mdev = to_soundbus_device (dev); \
12 return sprintf (buf, format_string, mdev->ofdev.node->field); \ 12 return sprintf (buf, format_string, mdev->ofdev.dev.of_node->field); \
13} 13}
14 14
15static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 15static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
@@ -25,7 +25,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
25 length = strlen(buf); 25 length = strlen(buf);
26 } else { 26 } else {
27 length = sprintf(buf, "of:N%sT%s\n", 27 length = sprintf(buf, "of:N%sT%s\n",
28 of->node->name, of->node->type); 28 of->dev.of_node->name, of->dev.of_node->type);
29 } 29 }
30 30
31 return length; 31 return length;
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index a2ff86189d2a..e9d98be190c5 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -345,7 +345,9 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
345 new_hw_ptr = hw_base + pos; 345 new_hw_ptr = hw_base + pos;
346 } 346 }
347 __delta: 347 __delta:
348 delta = (new_hw_ptr - old_hw_ptr) % runtime->boundary; 348 delta = new_hw_ptr - old_hw_ptr;
349 if (delta < 0)
350 delta += runtime->boundary;
349 if (xrun_debug(substream, in_interrupt ? 351 if (xrun_debug(substream, in_interrupt ?
350 XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) { 352 XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
351 char name[16]; 353 char name[16];
@@ -439,8 +441,13 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
439 snd_pcm_playback_silence(substream, new_hw_ptr); 441 snd_pcm_playback_silence(substream, new_hw_ptr);
440 442
441 if (in_interrupt) { 443 if (in_interrupt) {
442 runtime->hw_ptr_interrupt = new_hw_ptr - 444 delta = new_hw_ptr - runtime->hw_ptr_interrupt;
443 (new_hw_ptr % runtime->period_size); 445 if (delta < 0)
446 delta += runtime->boundary;
447 delta -= (snd_pcm_uframes_t)delta % runtime->period_size;
448 runtime->hw_ptr_interrupt += delta;
449 if (runtime->hw_ptr_interrupt >= runtime->boundary)
450 runtime->hw_ptr_interrupt -= runtime->boundary;
444 } 451 }
445 runtime->hw_ptr_base = hw_base; 452 runtime->hw_ptr_base = hw_base;
446 runtime->status->hw_ptr = new_hw_ptr; 453 runtime->status->hw_ptr = new_hw_ptr;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 644c2bb17b86..303ac04ff6e4 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -27,7 +27,6 @@
27#include <linux/pm_qos_params.h> 27#include <linux/pm_qos_params.h>
28#include <linux/uio.h> 28#include <linux/uio.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/math64.h>
31#include <sound/core.h> 30#include <sound/core.h>
32#include <sound/control.h> 31#include <sound/control.h>
33#include <sound/info.h> 32#include <sound/info.h>
@@ -370,38 +369,6 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
370 return usecs; 369 return usecs;
371} 370}
372 371
373static int calc_boundary(struct snd_pcm_runtime *runtime)
374{
375 u_int64_t boundary;
376
377 boundary = (u_int64_t)runtime->buffer_size *
378 (u_int64_t)runtime->period_size;
379#if BITS_PER_LONG < 64
380 /* try to find lowest common multiple for buffer and period */
381 if (boundary > LONG_MAX - runtime->buffer_size) {
382 u_int32_t remainder = -1;
383 u_int32_t divident = runtime->buffer_size;
384 u_int32_t divisor = runtime->period_size;
385 while (remainder) {
386 remainder = divident % divisor;
387 if (remainder) {
388 divident = divisor;
389 divisor = remainder;
390 }
391 }
392 boundary = div_u64(boundary, divisor);
393 if (boundary > LONG_MAX - runtime->buffer_size)
394 return -ERANGE;
395 }
396#endif
397 if (boundary == 0)
398 return -ERANGE;
399 runtime->boundary = boundary;
400 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
401 runtime->boundary *= 2;
402 return 0;
403}
404
405static int snd_pcm_hw_params(struct snd_pcm_substream *substream, 372static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
406 struct snd_pcm_hw_params *params) 373 struct snd_pcm_hw_params *params)
407{ 374{
@@ -477,9 +444,9 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
477 runtime->stop_threshold = runtime->buffer_size; 444 runtime->stop_threshold = runtime->buffer_size;
478 runtime->silence_threshold = 0; 445 runtime->silence_threshold = 0;
479 runtime->silence_size = 0; 446 runtime->silence_size = 0;
480 err = calc_boundary(runtime); 447 runtime->boundary = runtime->buffer_size;
481 if (err < 0) 448 while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
482 goto _error; 449 runtime->boundary *= 2;
483 450
484 snd_pcm_timer_resolution_change(substream); 451 snd_pcm_timer_resolution_change(substream);
485 runtime->status->state = SNDRV_PCM_STATE_SETUP; 452 runtime->status->state = SNDRV_PCM_STATE_SETUP;
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index 3e763d6a5d67..446cf9748664 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -516,6 +516,7 @@ get the interrupt driven case to work efficiently */
516 break; 516 break;
517 if (i == 0x5000) { 517 if (i == 0x5000) {
518 printk(KERN_ERR "au1000 AC97: AC97 command read timeout\n"); 518 printk(KERN_ERR "au1000 AC97: AC97 command read timeout\n");
519 spin_unlock(&au1000->ac97_lock);
519 return 0; 520 return 0;
520 } 521 }
521 522
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c
index 1f4774123064..13c214466d3b 100644
--- a/sound/oss/dmasound/dmasound_atari.c
+++ b/sound/oss/dmasound/dmasound_atari.c
@@ -1277,7 +1277,7 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy)
1277 * (almost) like on the TT. 1277 * (almost) like on the TT.
1278 */ 1278 */
1279 write_sq_ignore_int = 0; 1279 write_sq_ignore_int = 0;
1280 return IRQ_HANDLED; 1280 goto out;
1281 } 1281 }
1282 1282
1283 if (!write_sq.active) { 1283 if (!write_sq.active) {
@@ -1285,7 +1285,7 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy)
1285 * the sq variables, so better don't do anything here. 1285 * the sq variables, so better don't do anything here.
1286 */ 1286 */
1287 WAKE_UP(write_sq.sync_queue); 1287 WAKE_UP(write_sq.sync_queue);
1288 return IRQ_HANDLED; 1288 goto out;
1289 } 1289 }
1290 1290
1291 /* Probably ;) one frame is finished. Well, in fact it may be that a 1291 /* Probably ;) one frame is finished. Well, in fact it may be that a
@@ -1322,6 +1322,7 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy)
1322 /* We are not playing after AtaPlay(), so there 1322 /* We are not playing after AtaPlay(), so there
1323 is nothing to play any more. Wake up a process 1323 is nothing to play any more. Wake up a process
1324 waiting for audio output to drain. */ 1324 waiting for audio output to drain. */
1325out:
1325 spin_unlock(&dmasound.lock); 1326 spin_unlock(&dmasound.lock);
1326 return IRQ_HANDLED; 1327 return IRQ_HANDLED;
1327} 1328}
diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h
index 99400de6c075..0173bbe62b67 100644
--- a/sound/pci/asihpi/hpi.h
+++ b/sound/pci/asihpi/hpi.h
@@ -50,7 +50,7 @@ i.e 3.05.02 is a development version
50#define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) 50#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))
51 51
52/* Use single digits for versions less that 10 to avoid octal. */ 52/* Use single digits for versions less that 10 to avoid octal. */
53#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 18) 53#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 25)
54 54
55/* Library version as documented in hpi-api-versions.txt */ 55/* Library version as documented in hpi-api-versions.txt */
56#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) 56#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0)
@@ -1632,6 +1632,12 @@ u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys,
1632u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, 1632u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys,
1633 u32 h_control, u32 *pquality); 1633 u32 h_control, u32 *pquality);
1634 1634
1635u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
1636 u32 h_control, u32 *pblend);
1637
1638u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
1639 u32 h_control, const u32 blend);
1640
1635/****************************/ 1641/****************************/
1636/* PADs control */ 1642/* PADs control */
1637/****************************/ 1643/****************************/
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c
index 839ecb2e4b64..12dab5e4892c 100644
--- a/sound/pci/asihpi/hpi6000.c
+++ b/sound/pci/asihpi/hpi6000.c
@@ -691,9 +691,6 @@ static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao,
691 case 0x6200: 691 case 0x6200:
692 boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200); 692 boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200);
693 break; 693 break;
694 case 0x8800:
695 boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x8800);
696 break;
697 default: 694 default:
698 return HPI6000_ERROR_UNHANDLED_SUBSYS_ID; 695 return HPI6000_ERROR_UNHANDLED_SUBSYS_ID;
699 } 696 }
@@ -1775,7 +1772,6 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
1775 u16 error = 0; 1772 u16 error = 0;
1776 u16 dsp_index = 0; 1773 u16 dsp_index = 0;
1777 u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp; 1774 u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp;
1778 hpios_dsplock_lock(pao);
1779 1775
1780 if (num_dsp < 2) 1776 if (num_dsp < 2)
1781 dsp_index = 0; 1777 dsp_index = 0;
@@ -1796,6 +1792,8 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
1796 } 1792 }
1797 } 1793 }
1798 } 1794 }
1795
1796 hpios_dsplock_lock(pao);
1799 error = hpi6000_message_response_sequence(pao, dsp_index, phm, phr); 1797 error = hpi6000_message_response_sequence(pao, dsp_index, phm, phr);
1800 1798
1801 /* maybe an error response */ 1799 /* maybe an error response */
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index 5e88c1fc2b9e..e89991ea3543 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -966,23 +966,16 @@ static void outstream_write(struct hpi_adapter_obj *pao,
966 status = &interface->outstream_host_buffer_status[phm->obj_index]; 966 status = &interface->outstream_host_buffer_status[phm->obj_index];
967 967
968 if (phw->flag_outstream_just_reset[phm->obj_index]) { 968 if (phw->flag_outstream_just_reset[phm->obj_index]) {
969 /* Format can only change after reset. Must tell DSP. */
970 u16 function = phm->function;
971 phw->flag_outstream_just_reset[phm->obj_index] = 0;
972 phm->function = HPI_OSTREAM_SET_FORMAT;
973 hw_message(pao, phm, phr); /* send the format to the DSP */
974 phm->function = function;
975 if (phr->error)
976 return;
977 }
978#if 1
979 if (phw->flag_outstream_just_reset[phm->obj_index]) {
980 /* First OutStremWrite() call following reset will write data to the 969 /* First OutStremWrite() call following reset will write data to the
981 adapter's buffers, reducing delay before stream can start 970 adapter's buffers, reducing delay before stream can start. The DSP
971 takes care of setting the stream data format using format information
972 embedded in phm.
982 */ 973 */
983 int partial_write = 0; 974 int partial_write = 0;
984 unsigned int original_size = 0; 975 unsigned int original_size = 0;
985 976
977 phw->flag_outstream_just_reset[phm->obj_index] = 0;
978
986 /* Send the first buffer to the DSP the old way. */ 979 /* Send the first buffer to the DSP the old way. */
987 /* Limit size of first transfer - */ 980 /* Limit size of first transfer - */
988 /* expect that this will not usually be triggered. */ 981 /* expect that this will not usually be triggered. */
@@ -1012,7 +1005,6 @@ static void outstream_write(struct hpi_adapter_obj *pao,
1012 original_size - HPI6205_SIZEOF_DATA; 1005 original_size - HPI6205_SIZEOF_DATA;
1013 phm->u.d.u.data.pb_data += HPI6205_SIZEOF_DATA; 1006 phm->u.d.u.data.pb_data += HPI6205_SIZEOF_DATA;
1014 } 1007 }
1015#endif
1016 1008
1017 space_available = outstream_get_space_available(status); 1009 space_available = outstream_get_space_available(status);
1018 if (space_available < (long)phm->u.d.u.data.data_size) { 1010 if (space_available < (long)phm->u.d.u.data.data_size) {
@@ -1369,6 +1361,9 @@ static u16 adapter_boot_load_dsp(struct hpi_adapter_obj *pao,
1369 case HPI_ADAPTER_FAMILY_ASI(0x6500): 1361 case HPI_ADAPTER_FAMILY_ASI(0x6500):
1370 firmware_id = HPI_ADAPTER_FAMILY_ASI(0x6600); 1362 firmware_id = HPI_ADAPTER_FAMILY_ASI(0x6600);
1371 break; 1363 break;
1364 case HPI_ADAPTER_FAMILY_ASI(0x8800):
1365 firmware_id = HPI_ADAPTER_FAMILY_ASI(0x8900);
1366 break;
1372 } 1367 }
1373 boot_code_id[1] = firmware_id; 1368 boot_code_id[1] = firmware_id;
1374 1369
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index f1cd6f1a0d44..fdd0ce02aa68 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -232,6 +232,8 @@ enum HPI_BUSES {
232#define HPI_TUNER_HDRADIO_SDK_VERSION HPI_CTL_ATTR(TUNER, 13) 232#define HPI_TUNER_HDRADIO_SDK_VERSION HPI_CTL_ATTR(TUNER, 13)
233/** HD Radio DSP firmware version. */ 233/** HD Radio DSP firmware version. */
234#define HPI_TUNER_HDRADIO_DSP_VERSION HPI_CTL_ATTR(TUNER, 14) 234#define HPI_TUNER_HDRADIO_DSP_VERSION HPI_CTL_ATTR(TUNER, 14)
235/** HD Radio signal blend (force analog, or automatic). */
236#define HPI_TUNER_HDRADIO_BLEND HPI_CTL_ATTR(TUNER, 15)
235 237
236/** \} */ 238/** \} */
237 239
@@ -478,8 +480,10 @@ Threshold is a -ve number in units of dB/100,
478 480
479/** First 2 hex digits define the adapter family */ 481/** First 2 hex digits define the adapter family */
480#define HPI_ADAPTER_FAMILY_MASK 0xff00 482#define HPI_ADAPTER_FAMILY_MASK 0xff00
483#define HPI_MODULE_FAMILY_MASK 0xfff0
481 484
482#define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK) 485#define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK)
486#define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK)
483#define HPI_ADAPTER_ASI(f) (f) 487#define HPI_ADAPTER_ASI(f) (f)
484 488
485/******************************************* message types */ 489/******************************************* message types */
@@ -970,6 +974,7 @@ struct hpi_control_union_msg {
970 u32 mode; 974 u32 mode;
971 u32 value; 975 u32 value;
972 } mode; 976 } mode;
977 u32 blend;
973 } tuner; 978 } tuner;
974 } u; 979 } u;
975}; 980};
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index 565102cae4f8..fcd64539d9ef 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -347,20 +347,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
347 found = 0; 347 found = 0;
348 break; 348 break;
349 case HPI_CONTROL_TUNER: 349 case HPI_CONTROL_TUNER:
350 { 350 if (phm->u.c.attribute == HPI_TUNER_FREQ)
351 struct hpi_control_cache_single *pCT = 351 phr->u.c.param1 = pC->u.t.freq_ink_hz;
352 (struct hpi_control_cache_single *)pI; 352 else if (phm->u.c.attribute == HPI_TUNER_BAND)
353 if (phm->u.c.attribute == HPI_TUNER_FREQ) 353 phr->u.c.param1 = pC->u.t.band;
354 phr->u.c.param1 = pCT->u.t.freq_ink_hz; 354 else if ((phm->u.c.attribute == HPI_TUNER_LEVEL)
355 else if (phm->u.c.attribute == HPI_TUNER_BAND) 355 && (phm->u.c.param1 == HPI_TUNER_LEVEL_AVERAGE))
356 phr->u.c.param1 = pCT->u.t.band; 356 phr->u.c.param1 = pC->u.t.level;
357 else if ((phm->u.c.attribute == HPI_TUNER_LEVEL) 357 else
358 && (phm->u.c.param1 == 358 found = 0;
359 HPI_TUNER_LEVEL_AVERAGE))
360 phr->u.c.param1 = pCT->u.t.level;
361 else
362 found = 0;
363 }
364 break; 359 break;
365 case HPI_CONTROL_AESEBU_RECEIVER: 360 case HPI_CONTROL_AESEBU_RECEIVER:
366 if (phm->u.c.attribute == HPI_AESEBURX_ERRORSTATUS) 361 if (phm->u.c.attribute == HPI_AESEBURX_ERRORSTATUS)
@@ -503,6 +498,9 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
503 struct hpi_control_cache_single *pC; 498 struct hpi_control_cache_single *pC;
504 struct hpi_control_cache_info *pI; 499 struct hpi_control_cache_info *pI;
505 500
501 if (phr->error)
502 return;
503
506 if (!find_control(phm, p_cache, &pI, &control_index)) 504 if (!find_control(phm, p_cache, &pI, &control_index))
507 return; 505 return;
508 506
@@ -520,8 +518,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
520 break; 518 break;
521 case HPI_CONTROL_MULTIPLEXER: 519 case HPI_CONTROL_MULTIPLEXER:
522 /* mux does not return its setting on Set command. */ 520 /* mux does not return its setting on Set command. */
523 if (phr->error)
524 return;
525 if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) { 521 if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) {
526 pC->u.x.source_node_type = (u16)phm->u.c.param1; 522 pC->u.x.source_node_type = (u16)phm->u.c.param1;
527 pC->u.x.source_node_index = (u16)phm->u.c.param2; 523 pC->u.x.source_node_index = (u16)phm->u.c.param2;
@@ -529,8 +525,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
529 break; 525 break;
530 case HPI_CONTROL_CHANNEL_MODE: 526 case HPI_CONTROL_CHANNEL_MODE:
531 /* mode does not return its setting on Set command. */ 527 /* mode does not return its setting on Set command. */
532 if (phr->error)
533 return;
534 if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE) 528 if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE)
535 pC->u.m.mode = (u16)phm->u.c.param1; 529 pC->u.m.mode = (u16)phm->u.c.param1;
536 break; 530 break;
@@ -545,20 +539,14 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
545 pC->u.phantom_power.state = (u16)phm->u.c.param1; 539 pC->u.phantom_power.state = (u16)phm->u.c.param1;
546 break; 540 break;
547 case HPI_CONTROL_AESEBU_TRANSMITTER: 541 case HPI_CONTROL_AESEBU_TRANSMITTER:
548 if (phr->error)
549 return;
550 if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT) 542 if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT)
551 pC->u.aes3tx.format = phm->u.c.param1; 543 pC->u.aes3tx.format = phm->u.c.param1;
552 break; 544 break;
553 case HPI_CONTROL_AESEBU_RECEIVER: 545 case HPI_CONTROL_AESEBU_RECEIVER:
554 if (phr->error)
555 return;
556 if (phm->u.c.attribute == HPI_AESEBURX_FORMAT) 546 if (phm->u.c.attribute == HPI_AESEBURX_FORMAT)
557 pC->u.aes3rx.source = phm->u.c.param1; 547 pC->u.aes3rx.source = phm->u.c.param1;
558 break; 548 break;
559 case HPI_CONTROL_SAMPLECLOCK: 549 case HPI_CONTROL_SAMPLECLOCK:
560 if (phr->error)
561 return;
562 if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE) 550 if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE)
563 pC->u.clk.source = (u16)phm->u.c.param1; 551 pC->u.clk.source = (u16)phm->u.c.param1;
564 else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX) 552 else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX)
@@ -590,7 +578,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32
590 578
591void hpi_free_control_cache(struct hpi_control_cache *p_cache) 579void hpi_free_control_cache(struct hpi_control_cache *p_cache)
592{ 580{
593 if ((p_cache->init) && (p_cache->p_info)) { 581 if (p_cache->init) {
594 kfree(p_cache->p_info); 582 kfree(p_cache->p_info);
595 p_cache->p_info = NULL; 583 p_cache->p_info = NULL;
596 p_cache->init = 0; 584 p_cache->init = 0;
diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c
index eda26b312324..298eef3e20e9 100644
--- a/sound/pci/asihpi/hpifunc.c
+++ b/sound/pci/asihpi/hpifunc.c
@@ -2946,6 +2946,20 @@ u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys,
2946 HPI_TUNER_HDRADIO_SIGNAL_QUALITY, 0, 0, pquality, NULL); 2946 HPI_TUNER_HDRADIO_SIGNAL_QUALITY, 0, 0, pquality, NULL);
2947} 2947}
2948 2948
2949u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
2950 u32 h_control, u32 *pblend)
2951{
2952 return hpi_control_param_get(ph_subsys, h_control,
2953 HPI_TUNER_HDRADIO_BLEND, 0, 0, pblend, NULL);
2954}
2955
2956u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
2957 u32 h_control, const u32 blend)
2958{
2959 return hpi_control_param_set(ph_subsys, h_control,
2960 HPI_TUNER_HDRADIO_BLEND, blend, 0);
2961}
2962
2949u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, 2963u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control,
2950 char *p_data) 2964 char *p_data)
2951{ 2965{
@@ -3266,8 +3280,7 @@ u16 hpi_entity_find_next(struct hpi_entity *container_entity,
3266 3280
3267void hpi_entity_free(struct hpi_entity *entity) 3281void hpi_entity_free(struct hpi_entity *entity)
3268{ 3282{
3269 if (entity != NULL) 3283 kfree(entity);
3270 kfree(entity);
3271} 3284}
3272 3285
3273static u16 hpi_entity_alloc_and_copy(struct hpi_entity *src, 3286static u16 hpi_entity_alloc_and_copy(struct hpi_entity *src,
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index de615cfdb950..742ee12a9e17 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -89,26 +89,3 @@ u16 hpios_locked_mem_free(struct consistent_dma_area *p_mem_area)
89void hpios_locked_mem_free_all(void) 89void hpios_locked_mem_free_all(void)
90{ 90{
91} 91}
92
93void __iomem *hpios_map_io(struct pci_dev *pci_dev, int idx,
94 unsigned int length)
95{
96 HPI_DEBUG_LOG(DEBUG, "mapping %d %s %08llx-%08llx %04llx len 0x%x\n",
97 idx, pci_dev->resource[idx].name,
98 (unsigned long long)pci_resource_start(pci_dev, idx),
99 (unsigned long long)pci_resource_end(pci_dev, idx),
100 (unsigned long long)pci_resource_flags(pci_dev, idx), length);
101
102 if (!(pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM)) {
103 HPI_DEBUG_LOG(ERROR, "not an io memory resource\n");
104 return NULL;
105 }
106
107 if (length > pci_resource_len(pci_dev, idx)) {
108 HPI_DEBUG_LOG(ERROR, "resource too small for requested %d \n",
109 length);
110 return NULL;
111 }
112
113 return ioremap(pci_resource_start(pci_dev, idx), length);
114}
diff --git a/sound/pci/asihpi/hpios.h b/sound/pci/asihpi/hpios.h
index a62c3f1e5f09..370f39b43f85 100644
--- a/sound/pci/asihpi/hpios.h
+++ b/sound/pci/asihpi/hpios.h
@@ -166,13 +166,4 @@ struct hpi_adapter {
166 void __iomem *ap_remapped_mem_base[HPI_MAX_ADAPTER_MEM_SPACES]; 166 void __iomem *ap_remapped_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
167}; 167};
168 168
169static inline void hpios_unmap_io(void __iomem *addr,
170 unsigned long size)
171{
172 iounmap(addr);
173}
174
175void __iomem *hpios_map_io(struct pci_dev *pci_dev, int idx,
176 unsigned int length);
177
178#endif 169#endif
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 67921f93a41e..c15002242d98 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -26,7 +26,7 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <asm/io.h> 29#include <linux/io.h>
30#include <sound/core.h> 30#include <sound/core.h>
31#include <sound/initval.h> 31#include <sound/initval.h>
32#include <sound/pcm.h> 32#include <sound/pcm.h>
@@ -44,9 +44,6 @@ MODULE_LICENSE("GPL");
44/********************************* 44/*********************************
45 * DEFINES 45 * DEFINES
46 ********************************/ 46 ********************************/
47#define PCI_VENDOR_ID_SAA7146 0x1131
48#define PCI_DEVICE_ID_SAA7146 0x7146
49
50#define CTL_ROUTE_ANALOG 0 47#define CTL_ROUTE_ANALOG 0
51#define CTL_ROUTE_DIGITAL 1 48#define CTL_ROUTE_DIGITAL 1
52 49
@@ -165,7 +162,7 @@ module_param_array(enable, bool, NULL, 0444);
165MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard."); 162MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard.");
166 163
167static DEFINE_PCI_DEVICE_TABLE(snd_aw2_ids) = { 164static DEFINE_PCI_DEVICE_TABLE(snd_aw2_ids) = {
168 {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0, 165 {PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, 0, 0,
169 0, 0, 0}, 166 0, 0, 0},
170 {0} 167 {0}
171}; 168};
@@ -419,7 +416,7 @@ static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream)
419{ 416{
420 struct snd_pcm_runtime *runtime = substream->runtime; 417 struct snd_pcm_runtime *runtime = substream->runtime;
421 418
422 snd_printdd(KERN_DEBUG "aw2: Playback_open \n"); 419 snd_printdd(KERN_DEBUG "aw2: Playback_open\n");
423 runtime->hw = snd_aw2_playback_hw; 420 runtime->hw = snd_aw2_playback_hw;
424 return 0; 421 return 0;
425} 422}
@@ -435,7 +432,7 @@ static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream)
435{ 432{
436 struct snd_pcm_runtime *runtime = substream->runtime; 433 struct snd_pcm_runtime *runtime = substream->runtime;
437 434
438 snd_printdd(KERN_DEBUG "aw2: Capture_open \n"); 435 snd_printdd(KERN_DEBUG "aw2: Capture_open\n");
439 runtime->hw = snd_aw2_capture_hw; 436 runtime->hw = snd_aw2_capture_hw;
440 return 0; 437 return 0;
441} 438}
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 4b302d86f5f2..7a9401462c1c 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -35,6 +35,7 @@
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/mutex.h> 37#include <linux/mutex.h>
38#include <linux/moduleparam.h>
38 39
39#include <sound/core.h> 40#include <sound/core.h>
40#include <sound/tlv.h> 41#include <sound/tlv.h>
@@ -50,6 +51,10 @@
50#define EMU10K1_CENTER_LFE_FROM_FRONT 51#define EMU10K1_CENTER_LFE_FROM_FRONT
51#endif 52#endif
52 53
54static bool high_res_gpr_volume;
55module_param(high_res_gpr_volume, bool, 0444);
56MODULE_PARM_DESC(high_res_gpr_volume, "GPR mixer controls use 31-bit range.");
57
53/* 58/*
54 * Tables 59 * Tables
55 */ 60 */
@@ -296,6 +301,7 @@ static const u32 db_table[101] = {
296 301
297/* EMU10k1/EMU10k2 DSP control db gain */ 302/* EMU10k1/EMU10k2 DSP control db gain */
298static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1); 303static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1);
304static const DECLARE_TLV_DB_LINEAR(snd_emu10k1_db_linear, TLV_DB_GAIN_MUTE, 0);
299 305
300static const u32 onoff_table[2] = { 306static const u32 onoff_table[2] = {
301 0x00000000, 0x00000001 307 0x00000000, 0x00000001
@@ -1072,10 +1078,17 @@ snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1072 strcpy(ctl->id.name, name); 1078 strcpy(ctl->id.name, name);
1073 ctl->vcount = ctl->count = 1; 1079 ctl->vcount = ctl->count = 1;
1074 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; 1080 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
1075 ctl->min = 0; 1081 if (high_res_gpr_volume) {
1076 ctl->max = 100; 1082 ctl->min = 0;
1077 ctl->tlv = snd_emu10k1_db_scale1; 1083 ctl->max = 0x7fffffff;
1078 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; 1084 ctl->tlv = snd_emu10k1_db_linear;
1085 ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
1086 } else {
1087 ctl->min = 0;
1088 ctl->max = 100;
1089 ctl->tlv = snd_emu10k1_db_scale1;
1090 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
1091 }
1079} 1092}
1080 1093
1081static void __devinit 1094static void __devinit
@@ -1087,10 +1100,17 @@ snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1087 ctl->vcount = ctl->count = 2; 1100 ctl->vcount = ctl->count = 2;
1088 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; 1101 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
1089 ctl->gpr[1] = gpr + 1; ctl->value[1] = defval; 1102 ctl->gpr[1] = gpr + 1; ctl->value[1] = defval;
1090 ctl->min = 0; 1103 if (high_res_gpr_volume) {
1091 ctl->max = 100; 1104 ctl->min = 0;
1092 ctl->tlv = snd_emu10k1_db_scale1; 1105 ctl->max = 0x7fffffff;
1093 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; 1106 ctl->tlv = snd_emu10k1_db_linear;
1107 ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
1108 } else {
1109 ctl->min = 0;
1110 ctl->max = 100;
1111 ctl->tlv = snd_emu10k1_db_scale1;
1112 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
1113 }
1094} 1114}
1095 1115
1096static void __devinit 1116static void __devinit
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 170610e1d7da..dc79564fea30 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1097,6 +1097,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id)
1097 struct azx *chip = dev_id; 1097 struct azx *chip = dev_id;
1098 struct azx_dev *azx_dev; 1098 struct azx_dev *azx_dev;
1099 u32 status; 1099 u32 status;
1100 u8 sd_status;
1100 int i, ok; 1101 int i, ok;
1101 1102
1102 spin_lock(&chip->reg_lock); 1103 spin_lock(&chip->reg_lock);
@@ -1110,8 +1111,10 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id)
1110 for (i = 0; i < chip->num_streams; i++) { 1111 for (i = 0; i < chip->num_streams; i++) {
1111 azx_dev = &chip->azx_dev[i]; 1112 azx_dev = &chip->azx_dev[i];
1112 if (status & azx_dev->sd_int_sta_mask) { 1113 if (status & azx_dev->sd_int_sta_mask) {
1114 sd_status = azx_sd_readb(azx_dev, SD_STS);
1113 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 1115 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
1114 if (!azx_dev->substream || !azx_dev->running) 1116 if (!azx_dev->substream || !azx_dev->running ||
1117 !(sd_status & SD_INT_COMPLETE))
1115 continue; 1118 continue;
1116 /* check whether this IRQ is really acceptable */ 1119 /* check whether this IRQ is really acceptable */
1117 ok = azx_position_ok(chip, azx_dev); 1120 ok = azx_position_ok(chip, azx_dev);
@@ -2279,12 +2282,16 @@ static int azx_dev_free(struct snd_device *device)
2279 * white/black-listing for position_fix 2282 * white/black-listing for position_fix
2280 */ 2283 */
2281static struct snd_pci_quirk position_fix_list[] __devinitdata = { 2284static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2285 SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB),
2282 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), 2286 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
2283 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), 2287 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
2284 SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), 2288 SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
2285 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), 2289 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
2286 SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
2287 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 2290 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
2291 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
2292 SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
2293 SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB),
2294 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
2288 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), 2295 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
2289 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), 2296 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
2290 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB), 2297 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB),
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index e863649d31f5..2bf2cb5da956 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -2975,6 +2975,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
2975 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), 2975 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
2976 SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), 2976 SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
2977 SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), 2977 SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD),
2978 SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD),
2979 SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD),
2978 SND_PCI_QUIRK(0x17aa, 0x3a0d, "ideapad", CXT5066_IDEAPAD), 2980 SND_PCI_QUIRK(0x17aa, 0x3a0d, "ideapad", CXT5066_IDEAPAD),
2979 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), 2981 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
2980 {} 2982 {}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 53538b0f9991..17d4548cc353 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7025,6 +7025,14 @@ static struct hda_input_mux alc889A_mb31_capture_source = {
7025 }, 7025 },
7026}; 7026};
7027 7027
7028static struct hda_input_mux alc889A_imac91_capture_source = {
7029 .num_items = 2,
7030 .items = {
7031 { "Mic", 0x01 },
7032 { "Line", 0x2 }, /* Not sure! */
7033 },
7034};
7035
7028/* 7036/*
7029 * 2ch mode 7037 * 2ch mode
7030 */ 7038 */
@@ -7486,15 +7494,8 @@ static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7486}; 7494};
7487 7495
7488static struct snd_kcontrol_new alc885_imac91_mixer[] = { 7496static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7489 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 7497 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7490 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), 7498 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7491 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7492 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7494 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7496 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7498 { } /* end */ 7499 { } /* end */
7499}; 7500};
7500 7501
@@ -7995,61 +7996,56 @@ static struct hda_verb alc885_mbp3_init_verbs[] = {
7995 7996
7996/* iMac 9,1 */ 7997/* iMac 9,1 */
7997static struct hda_verb alc885_imac91_init_verbs[] = { 7998static struct hda_verb alc885_imac91_init_verbs[] = {
7998 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ 7999 /* Internal Speaker Pin (0x0c) */
7999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 8000 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 8002 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8002 /* Rear mixer */ 8003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 8004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8005 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 8006 /* HP Pin: Rear */
8006 /* HP Pin: output 0 (0x0c) */
8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 8009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8010 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 8010 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8011 /* Internal Speakers: output 0 (0x0d) */ 8011 /* Line in Rear */
8012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 8012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 8013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8014 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8015 /* Mic (rear) pin: input vref at 80% */
8016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8018 /* Front Mic pin: input vref at 80% */ 8014 /* Front Mic pin: input vref at 80% */
8019 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 8015 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8020 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 8016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8021 /* Line In pin: use output 1 when in LineOut mode */ 8017 /* Rear mixer */
8022 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 8018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8023 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 8019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8024 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, 8020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8025 8021 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8026 /* FIXME: use matrix-type input source selection */ 8022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8027 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 8023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8028 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 8024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8025 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 8027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 8028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8033 /* Input mixer2 */ 8030 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 8032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8036 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 8033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8037 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8038 /* Input mixer3 */ 8035 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 8037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 8038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8043 /* ADC1: mute amp left and right */ 8040 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8045 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 8042 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8046 /* ADC2: mute amp left and right */ 8043 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 8045 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8049 /* ADC3: mute amp left and right */ 8046 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8051 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 8048 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8052
8053 { } 8049 { }
8054}; 8050};
8055 8051
@@ -8118,7 +8114,7 @@ static void alc885_imac91_setup(struct hda_codec *codec)
8118 struct alc_spec *spec = codec->spec; 8114 struct alc_spec *spec = codec->spec;
8119 8115
8120 spec->autocfg.hp_pins[0] = 0x14; 8116 spec->autocfg.hp_pins[0] = 0x14;
8121 spec->autocfg.speaker_pins[0] = 0x15; 8117 spec->autocfg.speaker_pins[0] = 0x18;
8122 spec->autocfg.speaker_pins[1] = 0x1a; 8118 spec->autocfg.speaker_pins[1] = 0x1a;
8123} 8119}
8124 8120
@@ -9627,14 +9623,14 @@ static struct alc_config_preset alc882_presets[] = {
9627 .init_hook = alc885_imac24_init_hook, 9623 .init_hook = alc885_imac24_init_hook,
9628 }, 9624 },
9629 [ALC885_IMAC91] = { 9625 [ALC885_IMAC91] = {
9630 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, 9626 .mixers = {alc885_imac91_mixer},
9631 .init_verbs = { alc885_imac91_init_verbs, 9627 .init_verbs = { alc885_imac91_init_verbs,
9632 alc880_gpio1_init_verbs }, 9628 alc880_gpio1_init_verbs },
9633 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 9629 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9634 .dac_nids = alc882_dac_nids, 9630 .dac_nids = alc882_dac_nids,
9635 .channel_mode = alc885_mbp_4ch_modes, 9631 .channel_mode = alc885_mba21_ch_modes,
9636 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), 9632 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9637 .input_mux = &alc882_capture_source, 9633 .input_mux = &alc889A_imac91_capture_source,
9638 .dig_out_nid = ALC882_DIGOUT_NID, 9634 .dig_out_nid = ALC882_DIGOUT_NID,
9639 .dig_in_nid = ALC882_DIGIN_NID, 9635 .dig_in_nid = ALC882_DIGIN_NID,
9640 .unsol_event = alc_automute_amp_unsol_event, 9636 .unsol_event = alc_automute_amp_unsol_event,
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a0e06d82da1f..f1e7babd6920 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2078,12 +2078,12 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2078 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, 2078 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
2079 "Intel D965", STAC_D965_3ST), 2079 "Intel D965", STAC_D965_3ST),
2080 /* Dell 3 stack systems */ 2080 /* Dell 3 stack systems */
2081 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
2082 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), 2081 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
2083 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), 2082 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
2084 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), 2083 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
2085 /* Dell 3 stack systems with verb table in BIOS */ 2084 /* Dell 3 stack systems with verb table in BIOS */
2086 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), 2085 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
2086 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
2087 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), 2087 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
2088 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), 2088 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
2089 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS), 2089 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 8ae20208e7be..0221ca79b3ae 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -426,8 +426,8 @@ static const struct soc_enum wm8350_enum[] = {
426 SOC_ENUM_SINGLE(WM8350_INPUT_MIXER_VOLUME, 15, 2, wm8350_lr), 426 SOC_ENUM_SINGLE(WM8350_INPUT_MIXER_VOLUME, 15, 2, wm8350_lr),
427}; 427};
428 428
429static DECLARE_TLV_DB_LINEAR(pre_amp_tlv, -1200, 3525); 429static DECLARE_TLV_DB_SCALE(pre_amp_tlv, -1200, 3525, 0);
430static DECLARE_TLV_DB_LINEAR(out_pga_tlv, -5700, 600); 430static DECLARE_TLV_DB_SCALE(out_pga_tlv, -5700, 600, 0);
431static DECLARE_TLV_DB_SCALE(dac_pcm_tlv, -7163, 36, 1); 431static DECLARE_TLV_DB_SCALE(dac_pcm_tlv, -7163, 36, 1);
432static DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -12700, 50, 1); 432static DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -12700, 50, 1);
433static DECLARE_TLV_DB_SCALE(out_mix_tlv, -1500, 300, 1); 433static DECLARE_TLV_DB_SCALE(out_mix_tlv, -1500, 300, 1);
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 7f5d080536a0..8f294066b0ed 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -107,21 +107,21 @@ static void wm8400_codec_reset(struct snd_soc_codec *codec)
107 wm8400_reset_codec_reg_cache(wm8400->wm8400); 107 wm8400_reset_codec_reg_cache(wm8400->wm8400);
108} 108}
109 109
110static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -1500, 600); 110static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0);
111 111
112static const DECLARE_TLV_DB_LINEAR(in_pga_tlv, -1650, 3000); 112static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0);
113 113
114static const DECLARE_TLV_DB_LINEAR(out_mix_tlv, -2100, 0); 114static const DECLARE_TLV_DB_SCALE(out_mix_tlv, -2100, 0, 0);
115 115
116static const DECLARE_TLV_DB_LINEAR(out_pga_tlv, -7300, 600); 116static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0);
117 117
118static const DECLARE_TLV_DB_LINEAR(out_omix_tlv, -600, 0); 118static const DECLARE_TLV_DB_SCALE(out_omix_tlv, -600, 0, 0);
119 119
120static const DECLARE_TLV_DB_LINEAR(out_dac_tlv, -7163, 0); 120static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0);
121 121
122static const DECLARE_TLV_DB_LINEAR(in_adc_tlv, -7163, 1763); 122static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0);
123 123
124static const DECLARE_TLV_DB_LINEAR(out_sidetone_tlv, -3600, 0); 124static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
125 125
126static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, 126static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
127 struct snd_ctl_elem_value *ucontrol) 127 struct snd_ctl_elem_value *ucontrol)
@@ -440,7 +440,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
440/* INMIX dB values */ 440/* INMIX dB values */
441static const unsigned int in_mix_tlv[] = { 441static const unsigned int in_mix_tlv[] = {
442 TLV_DB_RANGE_HEAD(1), 442 TLV_DB_RANGE_HEAD(1),
443 0,7, TLV_DB_LINEAR_ITEM(-1200, 600), 443 0,7, TLV_DB_SCALE_ITEM(-1200, 600, 0),
444}; 444};
445 445
446/* Left In PGA Connections */ 446/* Left In PGA Connections */
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index 7b536d923ea9..c018772cc430 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -111,21 +111,21 @@ static const u16 wm8990_reg[] = {
111 111
112#define wm8990_reset(c) snd_soc_write(c, WM8990_RESET, 0) 112#define wm8990_reset(c) snd_soc_write(c, WM8990_RESET, 0)
113 113
114static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -1500, 600); 114static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0);
115 115
116static const DECLARE_TLV_DB_LINEAR(in_pga_tlv, -1650, 3000); 116static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0);
117 117
118static const DECLARE_TLV_DB_LINEAR(out_mix_tlv, 0, -2100); 118static const DECLARE_TLV_DB_SCALE(out_mix_tlv, 0, -2100, 0);
119 119
120static const DECLARE_TLV_DB_LINEAR(out_pga_tlv, -7300, 600); 120static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0);
121 121
122static const DECLARE_TLV_DB_LINEAR(out_omix_tlv, -600, 0); 122static const DECLARE_TLV_DB_SCALE(out_omix_tlv, -600, 0, 0);
123 123
124static const DECLARE_TLV_DB_LINEAR(out_dac_tlv, -7163, 0); 124static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0);
125 125
126static const DECLARE_TLV_DB_LINEAR(in_adc_tlv, -7163, 1763); 126static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0);
127 127
128static const DECLARE_TLV_DB_LINEAR(out_sidetone_tlv, -3600, 0); 128static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
129 129
130static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, 130static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
131 struct snd_ctl_elem_value *ucontrol) 131 struct snd_ctl_elem_value *ucontrol)
@@ -451,7 +451,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
451/* INMIX dB values */ 451/* INMIX dB values */
452static const unsigned int in_mix_tlv[] = { 452static const unsigned int in_mix_tlv[] = {
453 TLV_DB_RANGE_HEAD(1), 453 TLV_DB_RANGE_HEAD(1),
454 0, 7, TLV_DB_LINEAR_ITEM(-1200, 600), 454 0, 7, TLV_DB_SCALE_ITEM(-1200, 600, 0),
455}; 455};
456 456
457/* Left In PGA Connections */ 457/* Left In PGA Connections */
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index d639e55c5124..1d4e7164e80a 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -380,8 +380,8 @@ int mpc5200_audio_dma_create(struct of_device *op)
380 int ret; 380 int ret;
381 381
382 /* Fetch the registers and IRQ of the PSC */ 382 /* Fetch the registers and IRQ of the PSC */
383 irq = irq_of_parse_and_map(op->node, 0); 383 irq = irq_of_parse_and_map(op->dev.of_node, 0);
384 if (of_address_to_resource(op->node, 0, &res)) { 384 if (of_address_to_resource(op->dev.of_node, 0, &res)) {
385 dev_err(&op->dev, "Missing reg property\n"); 385 dev_err(&op->dev, "Missing reg property\n");
386 return -ENODEV; 386 return -ENODEV;
387 } 387 }
@@ -399,7 +399,7 @@ int mpc5200_audio_dma_create(struct of_device *op)
399 } 399 }
400 400
401 /* Get the PSC ID */ 401 /* Get the PSC ID */
402 prop = of_get_property(op->node, "cell-index", &size); 402 prop = of_get_property(op->dev.of_node, "cell-index", &size);
403 if (!prop || size < sizeof *prop) { 403 if (!prop || size < sizeof *prop) {
404 ret = -ENODEV; 404 ret = -ENODEV;
405 goto out_free; 405 goto out_free;
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 3dbc7f7cd7b9..e2ee220bfb7e 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -317,12 +317,12 @@ static struct of_device_id psc_ac97_match[] __devinitdata = {
317MODULE_DEVICE_TABLE(of, psc_ac97_match); 317MODULE_DEVICE_TABLE(of, psc_ac97_match);
318 318
319static struct of_platform_driver psc_ac97_driver = { 319static struct of_platform_driver psc_ac97_driver = {
320 .match_table = psc_ac97_match,
321 .probe = psc_ac97_of_probe, 320 .probe = psc_ac97_of_probe,
322 .remove = __devexit_p(psc_ac97_of_remove), 321 .remove = __devexit_p(psc_ac97_of_remove),
323 .driver = { 322 .driver = {
324 .name = "mpc5200-psc-ac97", 323 .name = "mpc5200-psc-ac97",
325 .owner = THIS_MODULE, 324 .owner = THIS_MODULE,
325 .of_match_table = psc_ac97_match,
326 }, 326 },
327}; 327};
328 328
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index ce8de90fb94a..4f455bd6851f 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -181,7 +181,7 @@ static int __devinit psc_i2s_of_probe(struct of_device *op,
181 181
182 /* Check for the codec handle. If it is not present then we 182 /* Check for the codec handle. If it is not present then we
183 * are done */ 183 * are done */
184 if (!of_get_property(op->node, "codec-handle", NULL)) 184 if (!of_get_property(op->dev.of_node, "codec-handle", NULL))
185 return 0; 185 return 0;
186 186
187 /* Due to errata in the dma mode; need to line up enabling 187 /* Due to errata in the dma mode; need to line up enabling
@@ -220,12 +220,12 @@ static struct of_device_id psc_i2s_match[] __devinitdata = {
220MODULE_DEVICE_TABLE(of, psc_i2s_match); 220MODULE_DEVICE_TABLE(of, psc_i2s_match);
221 221
222static struct of_platform_driver psc_i2s_driver = { 222static struct of_platform_driver psc_i2s_driver = {
223 .match_table = psc_i2s_match,
224 .probe = psc_i2s_of_probe, 223 .probe = psc_i2s_of_probe,
225 .remove = __devexit_p(psc_i2s_of_remove), 224 .remove = __devexit_p(psc_i2s_of_remove),
226 .driver = { 225 .driver = {
227 .name = "mpc5200-psc-i2s", 226 .name = "mpc5200-psc-i2s",
228 .owner = THIS_MODULE, 227 .owner = THIS_MODULE,
228 .of_match_table = psc_i2s_match,
229 }, 229 },
230}; 230};
231 231
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 83de1c81c8c4..6a2764ee8203 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -203,7 +203,7 @@ static struct snd_soc_ops mpc8610_hpcd_ops = {
203static int mpc8610_hpcd_probe(struct of_device *ofdev, 203static int mpc8610_hpcd_probe(struct of_device *ofdev,
204 const struct of_device_id *match) 204 const struct of_device_id *match)
205{ 205{
206 struct device_node *np = ofdev->node; 206 struct device_node *np = ofdev->dev.of_node;
207 struct device_node *codec_np = NULL; 207 struct device_node *codec_np = NULL;
208 struct device_node *guts_np = NULL; 208 struct device_node *guts_np = NULL;
209 struct device_node *dma_np = NULL; 209 struct device_node *dma_np = NULL;
@@ -580,9 +580,11 @@ static struct of_device_id mpc8610_hpcd_match[] = {
580MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match); 580MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match);
581 581
582static struct of_platform_driver mpc8610_hpcd_of_driver = { 582static struct of_platform_driver mpc8610_hpcd_of_driver = {
583 .owner = THIS_MODULE, 583 .driver = {
584 .name = "mpc8610_hpcd", 584 .name = "mpc8610_hpcd",
585 .match_table = mpc8610_hpcd_match, 585 .owner = THIS_MODULE,
586 .of_match_table = mpc8610_hpcd_match,
587 },
586 .probe = mpc8610_hpcd_probe, 588 .probe = mpc8610_hpcd_probe,
587 .remove = mpc8610_hpcd_remove, 589 .remove = mpc8610_hpcd_remove,
588}; 590};
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index 2b31ac673ea4..05f19c9284f4 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -73,7 +73,8 @@ static void snd_imx_dma_err_callback(int channel, void *data, int err)
73{ 73{
74 struct snd_pcm_substream *substream = data; 74 struct snd_pcm_substream *substream = data;
75 struct snd_soc_pcm_runtime *rtd = substream->private_data; 75 struct snd_soc_pcm_runtime *rtd = substream->private_data;
76 struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; 76 struct imx_pcm_dma_params *dma_params =
77 snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream);
77 struct snd_pcm_runtime *runtime = substream->runtime; 78 struct snd_pcm_runtime *runtime = substream->runtime;
78 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 79 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
79 int ret; 80 int ret;
@@ -102,7 +103,7 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream)
102 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 103 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
103 int ret; 104 int ret;
104 105
105 dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream); 106 dma_params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream);
106 107
107 iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); 108 iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH);
108 if (iprtd->dma < 0) { 109 if (iprtd->dma < 0) {
@@ -212,7 +213,7 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
212 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 213 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
213 int err; 214 int err;
214 215
215 dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream); 216 dma_params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream);
216 217
217 iprtd->substream = substream; 218 iprtd->substream = substream;
218 iprtd->buf = (unsigned int *)substream->dma_buffer.area; 219 iprtd->buf = (unsigned int *)substream->dma_buffer.area;
diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h
index c0bfab8fed3d..492b1cae24cc 100644
--- a/sound/soc/sh/siu.h
+++ b/sound/soc/sh/siu.h
@@ -71,8 +71,7 @@ struct siu_firmware {
71#include <linux/dmaengine.h> 71#include <linux/dmaengine.h>
72#include <linux/interrupt.h> 72#include <linux/interrupt.h>
73#include <linux/io.h> 73#include <linux/io.h>
74 74#include <linux/sh_dma.h>
75#include <asm/dmaengine.h>
76 75
77#include <sound/core.h> 76#include <sound/core.h>
78#include <sound/pcm.h> 77#include <sound/pcm.h>
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c
index d86ee1bfc03a..eeed5edd722b 100644
--- a/sound/soc/sh/siu_dai.c
+++ b/sound/soc/sh/siu_dai.c
@@ -588,6 +588,8 @@ static int siu_dai_prepare(struct snd_pcm_substream *substream,
588 ret = siu_dai_spbstart(port_info); 588 ret = siu_dai_spbstart(port_info);
589 if (ret < 0) 589 if (ret < 0)
590 goto fail; 590 goto fail;
591 } else {
592 ret = 0;
591 } 593 }
592 594
593 port_info->play_cap |= self; 595 port_info->play_cap |= self;
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c
index 8f85719212f9..36170be15aa7 100644
--- a/sound/soc/sh/siu_pcm.c
+++ b/sound/soc/sh/siu_pcm.c
@@ -31,7 +31,6 @@
31#include <sound/pcm_params.h> 31#include <sound/pcm_params.h>
32#include <sound/soc-dai.h> 32#include <sound/soc-dai.h>
33 33
34#include <asm/dmaengine.h>
35#include <asm/siu.h> 34#include <asm/siu.h>
36 35
37#include "siu.h" 36#include "siu.h"
@@ -358,13 +357,13 @@ static int siu_pcm_open(struct snd_pcm_substream *ss)
358 if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) { 357 if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) {
359 siu_stream = &port_info->playback; 358 siu_stream = &port_info->playback;
360 param = &siu_stream->param; 359 param = &siu_stream->param;
361 param->slave_id = port ? SHDMA_SLAVE_SIUB_TX : 360 param->slave_id = port ? pdata->dma_slave_tx_b :
362 SHDMA_SLAVE_SIUA_TX; 361 pdata->dma_slave_tx_a;
363 } else { 362 } else {
364 siu_stream = &port_info->capture; 363 siu_stream = &port_info->capture;
365 param = &siu_stream->param; 364 param = &siu_stream->param;
366 param->slave_id = port ? SHDMA_SLAVE_SIUB_RX : 365 param->slave_id = port ? pdata->dma_slave_rx_b :
367 SHDMA_SLAVE_SIUA_RX; 366 pdata->dma_slave_rx_a;
368 } 367 }
369 368
370 param->dma_dev = pdata->dma_dev; 369 param->dma_dev = pdata->dma_dev;
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c
index 49cc7ea9a518..0e3452303ea6 100644
--- a/sound/soc/txx9/txx9aclc.c
+++ b/sound/soc/txx9/txx9aclc.c
@@ -160,7 +160,7 @@ static void txx9aclc_dma_tasklet(unsigned long data)
160 void __iomem *base = drvdata->base; 160 void __iomem *base = drvdata->base;
161 161
162 spin_unlock_irqrestore(&dmadata->dma_lock, flags); 162 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
163 chan->device->device_terminate_all(chan); 163 chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
164 /* first time */ 164 /* first time */
165 for (i = 0; i < NR_DMA_CHAIN; i++) { 165 for (i = 0; i < NR_DMA_CHAIN; i++) {
166 desc = txx9aclc_dma_submit(dmadata, 166 desc = txx9aclc_dma_submit(dmadata,
@@ -268,7 +268,7 @@ static int txx9aclc_pcm_close(struct snd_pcm_substream *substream)
268 struct dma_chan *chan = dmadata->dma_chan; 268 struct dma_chan *chan = dmadata->dma_chan;
269 269
270 dmadata->frag_count = -1; 270 dmadata->frag_count = -1;
271 chan->device->device_terminate_all(chan); 271 chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
272 return 0; 272 return 0;
273} 273}
274 274
@@ -397,7 +397,8 @@ static int txx9aclc_pcm_remove(struct platform_device *pdev)
397 struct dma_chan *chan = dmadata->dma_chan; 397 struct dma_chan *chan = dmadata->dma_chan;
398 if (chan) { 398 if (chan) {
399 dmadata->frag_count = -1; 399 dmadata->frag_count = -1;
400 chan->device->device_terminate_all(chan); 400 chan->device->device_control(chan,
401 DMA_TERMINATE_ALL, 0);
401 dma_release_channel(chan); 402 dma_release_channel(chan);
402 } 403 }
403 dev->dmadata[i].dma_chan = NULL; 404 dev->dmadata[i].dma_chan = NULL;
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 574af56ba8a6..71221fd20944 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -1065,8 +1065,11 @@ static const struct of_device_id amd7930_match[] = {
1065}; 1065};
1066 1066
1067static struct of_platform_driver amd7930_sbus_driver = { 1067static struct of_platform_driver amd7930_sbus_driver = {
1068 .name = "audio", 1068 .driver = {
1069 .match_table = amd7930_match, 1069 .name = "audio",
1070 .owner = THIS_MODULE,
1071 .of_match_table = amd7930_match,
1072 },
1070 .probe = amd7930_sbus_probe, 1073 .probe = amd7930_sbus_probe,
1071}; 1074};
1072 1075
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 7dcc06512e86..fb4c6f2f29e5 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -2075,12 +2075,12 @@ static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_dev
2075static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match) 2075static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match)
2076{ 2076{
2077#ifdef EBUS_SUPPORT 2077#ifdef EBUS_SUPPORT
2078 if (!strcmp(op->node->parent->name, "ebus")) 2078 if (!strcmp(op->dev.of_node->parent->name, "ebus"))
2079 return cs4231_ebus_probe(op, match); 2079 return cs4231_ebus_probe(op, match);
2080#endif 2080#endif
2081#ifdef SBUS_SUPPORT 2081#ifdef SBUS_SUPPORT
2082 if (!strcmp(op->node->parent->name, "sbus") || 2082 if (!strcmp(op->dev.of_node->parent->name, "sbus") ||
2083 !strcmp(op->node->parent->name, "sbi")) 2083 !strcmp(op->dev.of_node->parent->name, "sbi"))
2084 return cs4231_sbus_probe(op, match); 2084 return cs4231_sbus_probe(op, match);
2085#endif 2085#endif
2086 return -ENODEV; 2086 return -ENODEV;
@@ -2109,8 +2109,11 @@ static const struct of_device_id cs4231_match[] = {
2109MODULE_DEVICE_TABLE(of, cs4231_match); 2109MODULE_DEVICE_TABLE(of, cs4231_match);
2110 2110
2111static struct of_platform_driver cs4231_driver = { 2111static struct of_platform_driver cs4231_driver = {
2112 .name = "audio", 2112 .driver = {
2113 .match_table = cs4231_match, 2113 .name = "audio",
2114 .owner = THIS_MODULE,
2115 .of_match_table = cs4231_match,
2116 },
2114 .probe = cs4231_probe, 2117 .probe = cs4231_probe,
2115 .remove = __devexit_p(cs4231_remove), 2118 .remove = __devexit_p(cs4231_remove),
2116}; 2119};
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 2eab6ce48852..1557bf132e73 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2651,7 +2651,7 @@ static int __devinit dbri_probe(struct of_device *op, const struct of_device_id
2651 2651
2652 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", 2652 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
2653 dev, dbri->regs, 2653 dev, dbri->regs,
2654 dbri->irq, op->node->name[9], dbri->mm.version); 2654 dbri->irq, op->dev.of_node->name[9], dbri->mm.version);
2655 dev++; 2655 dev++;
2656 2656
2657 return 0; 2657 return 0;
@@ -2687,8 +2687,11 @@ static const struct of_device_id dbri_match[] = {
2687MODULE_DEVICE_TABLE(of, dbri_match); 2687MODULE_DEVICE_TABLE(of, dbri_match);
2688 2688
2689static struct of_platform_driver dbri_sbus_driver = { 2689static struct of_platform_driver dbri_sbus_driver = {
2690 .name = "dbri", 2690 .driver = {
2691 .match_table = dbri_match, 2691 .name = "dbri",
2692 .owner = THIS_MODULE,
2693 .of_match_table = dbri_match,
2694 },
2692 .probe = dbri_probe, 2695 .probe = dbri_probe,
2693 .remove = __devexit_p(dbri_remove), 2696 .remove = __devexit_p(dbri_remove),
2694}; 2697};
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c
index 36ed703a7416..91c804cd2782 100644
--- a/sound/usb/caiaq/control.c
+++ b/sound/usb/caiaq/control.c
@@ -42,21 +42,12 @@ static int control_info(struct snd_kcontrol *kcontrol,
42 42
43 switch (dev->chip.usb_id) { 43 switch (dev->chip.usb_id) {
44 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): 44 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
45 if (pos == 0) {
46 /* current input mode of A8DJ */
47 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
48 uinfo->value.integer.min = 0;
49 uinfo->value.integer.max = 2;
50 return 0;
51 }
52 break;
53
54 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): 45 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
55 if (pos == 0) { 46 if (pos == 0) {
56 /* current input mode of A4DJ */ 47 /* current input mode of A8DJ and A4DJ */
57 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 48 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
58 uinfo->value.integer.min = 0; 49 uinfo->value.integer.min = 0;
59 uinfo->value.integer.max = 1; 50 uinfo->value.integer.max = 2;
60 return 0; 51 return 0;
61 } 52 }
62 break; 53 break;
@@ -86,14 +77,6 @@ static int control_get(struct snd_kcontrol *kcontrol,
86 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); 77 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
87 int pos = kcontrol->private_value; 78 int pos = kcontrol->private_value;
88 79
89 if (dev->chip.usb_id ==
90 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) {
91 /* A4DJ has only one control */
92 /* do not expose hardware input mode 0 */
93 ucontrol->value.integer.value[0] = dev->control_state[0] - 1;
94 return 0;
95 }
96
97 if (pos & CNT_INTVAL) 80 if (pos & CNT_INTVAL)
98 ucontrol->value.integer.value[0] 81 ucontrol->value.integer.value[0]
99 = dev->control_state[pos & ~CNT_INTVAL]; 82 = dev->control_state[pos & ~CNT_INTVAL];
@@ -112,20 +95,9 @@ static int control_put(struct snd_kcontrol *kcontrol,
112 int pos = kcontrol->private_value; 95 int pos = kcontrol->private_value;
113 unsigned char cmd = EP1_CMD_WRITE_IO; 96 unsigned char cmd = EP1_CMD_WRITE_IO;
114 97
115 switch (dev->chip.usb_id) { 98 if (dev->chip.usb_id ==
116 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): { 99 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1))
117 /* A4DJ has only one control */
118 /* do not expose hardware input mode 0 */
119 dev->control_state[0] = ucontrol->value.integer.value[0] + 1;
120 snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
121 dev->control_state, sizeof(dev->control_state));
122 return 1;
123 }
124
125 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1):
126 cmd = EP1_CMD_DIMM_LEDS; 100 cmd = EP1_CMD_DIMM_LEDS;
127 break;
128 }
129 101
130 if (pos & CNT_INTVAL) { 102 if (pos & CNT_INTVAL) {
131 dev->control_state[pos & ~CNT_INTVAL] 103 dev->control_state[pos & ~CNT_INTVAL]
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index 805271827675..cdfb856bddd2 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -36,7 +36,7 @@
36#include "input.h" 36#include "input.h"
37 37
38MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); 38MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
39MODULE_DESCRIPTION("caiaq USB audio, version 1.3.20"); 39MODULE_DESCRIPTION("caiaq USB audio, version 1.3.21");
40MODULE_LICENSE("GPL"); 40MODULE_LICENSE("GPL");
41MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," 41MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
42 "{Native Instruments, RigKontrol3}," 42 "{Native Instruments, RigKontrol3},"
@@ -320,12 +320,6 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
320 } 320 }
321 321
322 break; 322 break;
323 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
324 /* Audio 4 DJ - default input mode to phono */
325 dev->control_state[0] = 2;
326 snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
327 dev->control_state, 1);
328 break;
329 } 323 }
330 324
331 if (dev->spec.num_analog_audio_out + 325 if (dev->spec.num_analog_audio_out +
diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c
index 8bbfbfd4c658..dcb620796d9e 100644
--- a/sound/usb/caiaq/input.c
+++ b/sound/usb/caiaq/input.c
@@ -171,7 +171,7 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev,
171 input_report_abs(input_dev, ABS_HAT0Y, (buf[4] << 8) | buf[5]); 171 input_report_abs(input_dev, ABS_HAT0Y, (buf[4] << 8) | buf[5]);
172 input_report_abs(input_dev, ABS_HAT1X, (buf[12] << 8) | buf[13]); 172 input_report_abs(input_dev, ABS_HAT1X, (buf[12] << 8) | buf[13]);
173 input_report_abs(input_dev, ABS_HAT1Y, (buf[2] << 8) | buf[3]); 173 input_report_abs(input_dev, ABS_HAT1Y, (buf[2] << 8) | buf[3]);
174 input_report_abs(input_dev, ABS_HAT2X, (buf[15] << 8) | buf[15]); 174 input_report_abs(input_dev, ABS_HAT2X, (buf[14] << 8) | buf[15]);
175 input_report_abs(input_dev, ABS_HAT2Y, (buf[0] << 8) | buf[1]); 175 input_report_abs(input_dev, ABS_HAT2Y, (buf[0] << 8) | buf[1]);
176 input_report_abs(input_dev, ABS_HAT3X, (buf[10] << 8) | buf[11]); 176 input_report_abs(input_dev, ABS_HAT3X, (buf[10] << 8) | buf[11]);
177 input_report_abs(input_dev, ABS_HAT3Y, (buf[6] << 8) | buf[7]); 177 input_report_abs(input_dev, ABS_HAT3Y, (buf[6] << 8) | buf[7]);
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index ef07a6d0dd5f..28ee1ce3971a 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -149,6 +149,47 @@ int snd_usb_add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct au
149 return 0; 149 return 0;
150} 150}
151 151
152static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
153 struct usb_host_interface *alts,
154 int protocol, int iface_no)
155{
156 /* parsed with a v1 header here. that's ok as we only look at the
157 * header first which is the same for both versions */
158 struct uac_iso_endpoint_descriptor *csep;
159 struct usb_interface_descriptor *altsd = get_iface_desc(alts);
160 int attributes = 0;
161
162 csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT);
163
164 /* Creamware Noah has this descriptor after the 2nd endpoint */
165 if (!csep && altsd->bNumEndpoints >= 2)
166 csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT);
167
168 if (!csep || csep->bLength < 7 ||
169 csep->bDescriptorSubtype != UAC_EP_GENERAL) {
170 snd_printk(KERN_WARNING "%d:%u:%d : no or invalid"
171 " class specific endpoint descriptor\n",
172 chip->dev->devnum, iface_no,
173 altsd->bAlternateSetting);
174 return 0;
175 }
176
177 if (protocol == UAC_VERSION_1) {
178 attributes = csep->bmAttributes;
179 } else {
180 struct uac2_iso_endpoint_descriptor *csep2 =
181 (struct uac2_iso_endpoint_descriptor *) csep;
182
183 attributes = csep->bmAttributes & UAC_EP_CS_ATTR_FILL_MAX;
184
185 /* emulate the endpoint attributes of a v1 device */
186 if (csep2->bmControls & UAC2_CONTROL_PITCH)
187 attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL;
188 }
189
190 return attributes;
191}
192
152int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) 193int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
153{ 194{
154 struct usb_device *dev; 195 struct usb_device *dev;
@@ -158,8 +199,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
158 int i, altno, err, stream; 199 int i, altno, err, stream;
159 int format = 0, num_channels = 0; 200 int format = 0, num_channels = 0;
160 struct audioformat *fp = NULL; 201 struct audioformat *fp = NULL;
161 unsigned char *fmt, *csep;
162 int num, protocol; 202 int num, protocol;
203 struct uac_format_type_i_continuous_descriptor *fmt;
163 204
164 dev = chip->dev; 205 dev = chip->dev;
165 206
@@ -256,8 +297,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
256 dev->devnum, iface_no, altno); 297 dev->devnum, iface_no, altno);
257 continue; 298 continue;
258 } 299 }
259 if (((protocol == UAC_VERSION_1) && (fmt[0] < 8)) || 300 if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) ||
260 ((protocol == UAC_VERSION_2) && (fmt[0] != 6))) { 301 ((protocol == UAC_VERSION_2) && (fmt->bLength != 6))) {
261 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 302 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n",
262 dev->devnum, iface_no, altno); 303 dev->devnum, iface_no, altno);
263 continue; 304 continue;
@@ -268,7 +309,9 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
268 * with the previous one, except for a larger packet size, but 309 * with the previous one, except for a larger packet size, but
269 * is actually a mislabeled two-channel setting; ignore it. 310 * is actually a mislabeled two-channel setting; ignore it.
270 */ 311 */
271 if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 && 312 if (fmt->bNrChannels == 1 &&
313 fmt->bSubframeSize == 2 &&
314 altno == 2 && num == 3 &&
272 fp && fp->altsetting == 1 && fp->channels == 1 && 315 fp && fp->altsetting == 1 && fp->channels == 1 &&
273 fp->formats == SNDRV_PCM_FMTBIT_S16_LE && 316 fp->formats == SNDRV_PCM_FMTBIT_S16_LE &&
274 protocol == UAC_VERSION_1 && 317 protocol == UAC_VERSION_1 &&
@@ -276,17 +319,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
276 fp->maxpacksize * 2) 319 fp->maxpacksize * 2)
277 continue; 320 continue;
278 321
279 csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT);
280 /* Creamware Noah has this descriptor after the 2nd endpoint */
281 if (!csep && altsd->bNumEndpoints >= 2)
282 csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT);
283 if (!csep || csep[0] < 7 || csep[2] != UAC_EP_GENERAL) {
284 snd_printk(KERN_WARNING "%d:%u:%d : no or invalid"
285 " class specific endpoint descriptor\n",
286 dev->devnum, iface_no, altno);
287 csep = NULL;
288 }
289
290 fp = kzalloc(sizeof(*fp), GFP_KERNEL); 322 fp = kzalloc(sizeof(*fp), GFP_KERNEL);
291 if (! fp) { 323 if (! fp) {
292 snd_printk(KERN_ERR "cannot malloc\n"); 324 snd_printk(KERN_ERR "cannot malloc\n");
@@ -305,7 +337,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
305 if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) 337 if (snd_usb_get_speed(dev) == USB_SPEED_HIGH)
306 fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) 338 fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1)
307 * (fp->maxpacksize & 0x7ff); 339 * (fp->maxpacksize & 0x7ff);
308 fp->attributes = csep ? csep[3] : 0; 340 fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no);
309 341
310 /* some quirks for attributes here */ 342 /* some quirks for attributes here */
311 343
diff --git a/sound/usb/format.c b/sound/usb/format.c
index b87cf87c4e7b..fe29d61de19b 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -278,12 +278,11 @@ err:
278 * parse the format type I and III descriptors 278 * parse the format type I and III descriptors
279 */ 279 */
280static int parse_audio_format_i(struct snd_usb_audio *chip, 280static int parse_audio_format_i(struct snd_usb_audio *chip,
281 struct audioformat *fp, 281 struct audioformat *fp, int format,
282 int format, void *_fmt, 282 struct uac_format_type_i_continuous_descriptor *fmt,
283 struct usb_host_interface *iface) 283 struct usb_host_interface *iface)
284{ 284{
285 struct usb_interface_descriptor *altsd = get_iface_desc(iface); 285 struct usb_interface_descriptor *altsd = get_iface_desc(iface);
286 struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
287 int protocol = altsd->bInterfaceProtocol; 286 int protocol = altsd->bInterfaceProtocol;
288 int pcm_format, ret; 287 int pcm_format, ret;
289 288
@@ -320,7 +319,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
320 switch (protocol) { 319 switch (protocol) {
321 case UAC_VERSION_1: 320 case UAC_VERSION_1:
322 fp->channels = fmt->bNrChannels; 321 fp->channels = fmt->bNrChannels;
323 ret = parse_audio_format_rates_v1(chip, fp, _fmt, 7); 322 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7);
324 break; 323 break;
325 case UAC_VERSION_2: 324 case UAC_VERSION_2:
326 /* fp->channels is already set in this case */ 325 /* fp->channels is already set in this case */
@@ -392,12 +391,12 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
392} 391}
393 392
394int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, 393int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp,
395 int format, unsigned char *fmt, int stream, 394 int format, struct uac_format_type_i_continuous_descriptor *fmt,
396 struct usb_host_interface *iface) 395 int stream, struct usb_host_interface *iface)
397{ 396{
398 int err; 397 int err;
399 398
400 switch (fmt[3]) { 399 switch (fmt->bFormatType) {
401 case UAC_FORMAT_TYPE_I: 400 case UAC_FORMAT_TYPE_I:
402 case UAC_FORMAT_TYPE_III: 401 case UAC_FORMAT_TYPE_III:
403 err = parse_audio_format_i(chip, fp, format, fmt, iface); 402 err = parse_audio_format_i(chip, fp, format, fmt, iface);
@@ -407,10 +406,11 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *f
407 break; 406 break;
408 default: 407 default:
409 snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", 408 snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n",
410 chip->dev->devnum, fp->iface, fp->altsetting, fmt[3]); 409 chip->dev->devnum, fp->iface, fp->altsetting,
411 return -1; 410 fmt->bFormatType);
411 return -ENOTSUPP;
412 } 412 }
413 fp->fmt_type = fmt[3]; 413 fp->fmt_type = fmt->bFormatType;
414 if (err < 0) 414 if (err < 0)
415 return err; 415 return err;
416#if 1 416#if 1
@@ -421,10 +421,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *f
421 if (chip->usb_id == USB_ID(0x041e, 0x3000) || 421 if (chip->usb_id == USB_ID(0x041e, 0x3000) ||
422 chip->usb_id == USB_ID(0x041e, 0x3020) || 422 chip->usb_id == USB_ID(0x041e, 0x3020) ||
423 chip->usb_id == USB_ID(0x041e, 0x3061)) { 423 chip->usb_id == USB_ID(0x041e, 0x3061)) {
424 if (fmt[3] == UAC_FORMAT_TYPE_I && 424 if (fmt->bFormatType == UAC_FORMAT_TYPE_I &&
425 fp->rates != SNDRV_PCM_RATE_48000 && 425 fp->rates != SNDRV_PCM_RATE_48000 &&
426 fp->rates != SNDRV_PCM_RATE_96000) 426 fp->rates != SNDRV_PCM_RATE_96000)
427 return -1; 427 return -ENOTSUPP;
428 } 428 }
429#endif 429#endif
430 return 0; 430 return 0;
diff --git a/sound/usb/format.h b/sound/usb/format.h
index 8298c4e8ddfa..387924f0af85 100644
--- a/sound/usb/format.h
+++ b/sound/usb/format.h
@@ -1,8 +1,9 @@
1#ifndef __USBAUDIO_FORMAT_H 1#ifndef __USBAUDIO_FORMAT_H
2#define __USBAUDIO_FORMAT_H 2#define __USBAUDIO_FORMAT_H
3 3
4int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, 4int snd_usb_parse_audio_format(struct snd_usb_audio *chip,
5 int format, unsigned char *fmt, int stream, 5 struct audioformat *fp, int format,
6 struct usb_host_interface *iface); 6 struct uac_format_type_i_continuous_descriptor *fmt,
7 int stream, struct usb_host_interface *iface);
7 8
8#endif /* __USBAUDIO_FORMAT_H */ 9#endif /* __USBAUDIO_FORMAT_H */
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 8b1e4b124a9f..46785643c66d 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -645,6 +645,105 @@ static struct usb_protocol_ops snd_usbmidi_cme_ops = {
645}; 645};
646 646
647/* 647/*
648 * AKAI MPD16 protocol:
649 *
650 * For control port (endpoint 1):
651 * ==============================
652 * One or more chunks consisting of first byte of (0x10 | msg_len) and then a
653 * SysEx message (msg_len=9 bytes long).
654 *
655 * For data port (endpoint 2):
656 * ===========================
657 * One or more chunks consisting of first byte of (0x20 | msg_len) and then a
658 * MIDI message (msg_len bytes long)
659 *
660 * Messages sent: Active Sense, Note On, Poly Pressure, Control Change.
661 */
662static void snd_usbmidi_akai_input(struct snd_usb_midi_in_endpoint *ep,
663 uint8_t *buffer, int buffer_length)
664{
665 unsigned int pos = 0;
666 unsigned int len = (unsigned int)buffer_length;
667 while (pos < len) {
668 unsigned int port = (buffer[pos] >> 4) - 1;
669 unsigned int msg_len = buffer[pos] & 0x0f;
670 pos++;
671 if (pos + msg_len <= len && port < 2)
672 snd_usbmidi_input_data(ep, 0, &buffer[pos], msg_len);
673 pos += msg_len;
674 }
675}
676
677#define MAX_AKAI_SYSEX_LEN 9
678
679static void snd_usbmidi_akai_output(struct snd_usb_midi_out_endpoint *ep,
680 struct urb *urb)
681{
682 uint8_t *msg;
683 int pos, end, count, buf_end;
684 uint8_t tmp[MAX_AKAI_SYSEX_LEN];
685 struct snd_rawmidi_substream *substream = ep->ports[0].substream;
686
687 if (!ep->ports[0].active)
688 return;
689
690 msg = urb->transfer_buffer + urb->transfer_buffer_length;
691 buf_end = ep->max_transfer - MAX_AKAI_SYSEX_LEN - 1;
692
693 /* only try adding more data when there's space for at least 1 SysEx */
694 while (urb->transfer_buffer_length < buf_end) {
695 count = snd_rawmidi_transmit_peek(substream,
696 tmp, MAX_AKAI_SYSEX_LEN);
697 if (!count) {
698 ep->ports[0].active = 0;
699 return;
700 }
701 /* try to skip non-SysEx data */
702 for (pos = 0; pos < count && tmp[pos] != 0xF0; pos++)
703 ;
704
705 if (pos > 0) {
706 snd_rawmidi_transmit_ack(substream, pos);
707 continue;
708 }
709
710 /* look for the start or end marker */
711 for (end = 1; end < count && tmp[end] < 0xF0; end++)
712 ;
713
714 /* next SysEx started before the end of current one */
715 if (end < count && tmp[end] == 0xF0) {
716 /* it's incomplete - drop it */
717 snd_rawmidi_transmit_ack(substream, end);
718 continue;
719 }
720 /* SysEx complete */
721 if (end < count && tmp[end] == 0xF7) {
722 /* queue it, ack it, and get the next one */
723 count = end + 1;
724 msg[0] = 0x10 | count;
725 memcpy(&msg[1], tmp, count);
726 snd_rawmidi_transmit_ack(substream, count);
727 urb->transfer_buffer_length += count + 1;
728 msg += count + 1;
729 continue;
730 }
731 /* less than 9 bytes and no end byte - wait for more */
732 if (count < MAX_AKAI_SYSEX_LEN) {
733 ep->ports[0].active = 0;
734 return;
735 }
736 /* 9 bytes and no end marker in sight - malformed, skip it */
737 snd_rawmidi_transmit_ack(substream, count);
738 }
739}
740
741static struct usb_protocol_ops snd_usbmidi_akai_ops = {
742 .input = snd_usbmidi_akai_input,
743 .output = snd_usbmidi_akai_output,
744};
745
746/*
648 * Novation USB MIDI protocol: number of data bytes is in the first byte 747 * Novation USB MIDI protocol: number of data bytes is in the first byte
649 * (when receiving) (+1!) or in the second byte (when sending); data begins 748 * (when receiving) (+1!) or in the second byte (when sending); data begins
650 * at the third byte. 749 * at the third byte.
@@ -1434,6 +1533,11 @@ static struct port_info {
1434 EXTERNAL_PORT(0x086a, 0x0001, 8, "%s Broadcast"), 1533 EXTERNAL_PORT(0x086a, 0x0001, 8, "%s Broadcast"),
1435 EXTERNAL_PORT(0x086a, 0x0002, 8, "%s Broadcast"), 1534 EXTERNAL_PORT(0x086a, 0x0002, 8, "%s Broadcast"),
1436 EXTERNAL_PORT(0x086a, 0x0003, 4, "%s Broadcast"), 1535 EXTERNAL_PORT(0x086a, 0x0003, 4, "%s Broadcast"),
1536 /* Akai MPD16 */
1537 CONTROL_PORT(0x09e8, 0x0062, 0, "%s Control"),
1538 PORT_INFO(0x09e8, 0x0062, 1, "%s MIDI", 0,
1539 SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
1540 SNDRV_SEQ_PORT_TYPE_HARDWARE),
1437 /* Access Music Virus TI */ 1541 /* Access Music Virus TI */
1438 EXTERNAL_PORT(0x133e, 0x0815, 0, "%s MIDI"), 1542 EXTERNAL_PORT(0x133e, 0x0815, 0, "%s MIDI"),
1439 PORT_INFO(0x133e, 0x0815, 1, "%s Synth", 0, 1543 PORT_INFO(0x133e, 0x0815, 1, "%s Synth", 0,
@@ -2035,6 +2139,12 @@ int snd_usbmidi_create(struct snd_card *card,
2035 umidi->usb_protocol_ops = &snd_usbmidi_cme_ops; 2139 umidi->usb_protocol_ops = &snd_usbmidi_cme_ops;
2036 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 2140 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2037 break; 2141 break;
2142 case QUIRK_MIDI_AKAI:
2143 umidi->usb_protocol_ops = &snd_usbmidi_akai_ops;
2144 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2145 /* endpoint 1 is input-only */
2146 endpoints[1].out_cables = 0;
2147 break;
2038 default: 2148 default:
2039 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 2149 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
2040 err = -ENXIO; 2150 err = -ENXIO;
diff --git a/sound/usb/midi.h b/sound/usb/midi.h
index 2089ec987c66..2fca80b744c0 100644
--- a/sound/usb/midi.h
+++ b/sound/usb/midi.h
@@ -37,6 +37,8 @@ struct snd_usb_midi_endpoint_info {
37 37
38/* for QUIRK_MIDI_CME, data is NULL */ 38/* for QUIRK_MIDI_CME, data is NULL */
39 39
40/* for QUIRK_MIDI_AKAI, data is NULL */
41
40int snd_usbmidi_create(struct snd_card *card, 42int snd_usbmidi_create(struct snd_card *card,
41 struct usb_interface *iface, 43 struct usb_interface *iface,
42 struct list_head *midi_list, 44 struct list_head *midi_list,
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 97dd17655104..03ce971e0027 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1126,7 +1126,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1126 } else { 1126 } else {
1127 struct uac2_feature_unit_descriptor *ftr = _ftr; 1127 struct uac2_feature_unit_descriptor *ftr = _ftr;
1128 csize = 4; 1128 csize = 4;
1129 channels = (hdr->bLength - 6) / 4; 1129 channels = (hdr->bLength - 6) / 4 - 1;
1130 bmaControls = ftr->bmaControls; 1130 bmaControls = ftr->bmaControls;
1131 } 1131 }
1132 1132
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 2bf0d77d1768..056587de7be4 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -120,10 +120,6 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface,
120 120
121 ep = get_endpoint(alts, 0)->bEndpointAddress; 121 ep = get_endpoint(alts, 0)->bEndpointAddress;
122 122
123 /* if endpoint doesn't have pitch control, bail out */
124 if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL))
125 return 0;
126
127 data[0] = 1; 123 data[0] = 1;
128 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, 124 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
129 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 125 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
@@ -137,8 +133,32 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface,
137 return 0; 133 return 0;
138} 134}
139 135
136static int init_pitch_v2(struct snd_usb_audio *chip, int iface,
137 struct usb_host_interface *alts,
138 struct audioformat *fmt)
139{
140 struct usb_device *dev = chip->dev;
141 unsigned char data[1];
142 unsigned int ep;
143 int err;
144
145 ep = get_endpoint(alts, 0)->bEndpointAddress;
146
147 data[0] = 1;
148 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
149 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
150 UAC2_EP_CS_PITCH << 8, 0,
151 data, sizeof(data), 1000)) < 0) {
152 snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH (v2)\n",
153 dev->devnum, iface, fmt->altsetting);
154 return err;
155 }
156
157 return 0;
158}
159
140/* 160/*
141 * initialize the picth control and sample rate 161 * initialize the pitch control and sample rate
142 */ 162 */
143int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, 163int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
144 struct usb_host_interface *alts, 164 struct usb_host_interface *alts,
@@ -146,13 +166,16 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
146{ 166{
147 struct usb_interface_descriptor *altsd = get_iface_desc(alts); 167 struct usb_interface_descriptor *altsd = get_iface_desc(alts);
148 168
169 /* if endpoint doesn't have pitch control, bail out */
170 if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL))
171 return 0;
172
149 switch (altsd->bInterfaceProtocol) { 173 switch (altsd->bInterfaceProtocol) {
150 case UAC_VERSION_1: 174 case UAC_VERSION_1:
151 return init_pitch_v1(chip, iface, alts, fmt); 175 return init_pitch_v1(chip, iface, alts, fmt);
152 176
153 case UAC_VERSION_2: 177 case UAC_VERSION_2:
154 /* not implemented yet */ 178 return init_pitch_v2(chip, iface, alts, fmt);
155 return 0;
156 } 179 }
157 180
158 return -EINVAL; 181 return -EINVAL;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 91ddef31bcbd..f8797f61a24b 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -1973,6 +1973,17 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1973 } 1973 }
1974}, 1974},
1975 1975
1976/* AKAI devices */
1977{
1978 USB_DEVICE(0x09e8, 0x0062),
1979 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1980 .vendor_name = "AKAI",
1981 .product_name = "MPD16",
1982 .ifnum = 0,
1983 .type = QUIRK_MIDI_AKAI,
1984 }
1985},
1986
1976/* TerraTec devices */ 1987/* TerraTec devices */
1977{ 1988{
1978 USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), 1989 USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012),
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 136e5b4cf6de..b45e54c09ba2 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -289,6 +289,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
289 [QUIRK_MIDI_FASTLANE] = create_any_midi_quirk, 289 [QUIRK_MIDI_FASTLANE] = create_any_midi_quirk,
290 [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, 290 [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk,
291 [QUIRK_MIDI_CME] = create_any_midi_quirk, 291 [QUIRK_MIDI_CME] = create_any_midi_quirk,
292 [QUIRK_MIDI_AKAI] = create_any_midi_quirk,
292 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, 293 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
293 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, 294 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
294 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, 295 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index d679e72a3e5c..06ebf24d3a4d 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -74,6 +74,7 @@ enum quirk_type {
74 QUIRK_MIDI_FASTLANE, 74 QUIRK_MIDI_FASTLANE,
75 QUIRK_MIDI_EMAGIC, 75 QUIRK_MIDI_EMAGIC,
76 QUIRK_MIDI_CME, 76 QUIRK_MIDI_CME,
77 QUIRK_MIDI_AKAI,
77 QUIRK_MIDI_US122L, 78 QUIRK_MIDI_US122L,
78 QUIRK_AUDIO_STANDARD_INTERFACE, 79 QUIRK_AUDIO_STANDARD_INTERFACE,
79 QUIRK_AUDIO_FIXED_ENDPOINT, 80 QUIRK_AUDIO_FIXED_ENDPOINT,