aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/seq/seq_clientmgr.c14
-rw-r--r--sound/core/seq/seq_fifo.c10
-rw-r--r--sound/core/seq/seq_lock.c9
-rw-r--r--sound/core/seq/seq_memory.c26
-rw-r--r--sound/core/seq/seq_memory.h1
-rw-r--r--sound/core/seq/seq_queue.c47
-rw-r--r--sound/core/seq/seq_queue.h2
-rw-r--r--sound/core/timer.c25
-rw-r--r--sound/firewire/lib.h2
-rw-r--r--sound/pci/ctxfi/cthw20k1.c19
-rw-r--r--sound/pci/ctxfi/cthw20k2.c19
-rw-r--r--sound/pci/hda/hda_codec.h2
-rw-r--r--sound/pci/hda/hda_controller.c8
-rw-r--r--sound/pci/hda/hda_generic.c1
-rw-r--r--sound/pci/hda/hda_intel.c17
-rw-r--r--sound/pci/hda/patch_realtek.c23
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/ppc/awacs.c1
-rw-r--r--sound/soc/atmel/atmel-classd.c2
-rw-r--r--sound/soc/codecs/nau8825.c3
-rw-r--r--sound/soc/codecs/nau8825.h3
-rw-r--r--sound/soc/codecs/tlv320aic3x.c13
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c3
-rw-r--r--sound/soc/soc-compress.c6
-rw-r--r--sound/soc/soc-core.c5
-rw-r--r--sound/soc/soc-pcm.c8
-rw-r--r--sound/usb/endpoint.c3
-rw-r--r--sound/usb/mixer.c2
-rw-r--r--sound/usb/mixer.h1
-rw-r--r--sound/usb/mixer_quirks.c6
-rw-r--r--sound/usb/quirks.c1
31 files changed, 192 insertions, 92 deletions
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 58e79e02f217..e326c1d80416 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1530,19 +1530,14 @@ static int snd_seq_ioctl_create_queue(struct snd_seq_client *client,
1530 void __user *arg) 1530 void __user *arg)
1531{ 1531{
1532 struct snd_seq_queue_info info; 1532 struct snd_seq_queue_info info;
1533 int result;
1534 struct snd_seq_queue *q; 1533 struct snd_seq_queue *q;
1535 1534
1536 if (copy_from_user(&info, arg, sizeof(info))) 1535 if (copy_from_user(&info, arg, sizeof(info)))
1537 return -EFAULT; 1536 return -EFAULT;
1538 1537
1539 result = snd_seq_queue_alloc(client->number, info.locked, info.flags); 1538 q = snd_seq_queue_alloc(client->number, info.locked, info.flags);
1540 if (result < 0) 1539 if (IS_ERR(q))
1541 return result; 1540 return PTR_ERR(q);
1542
1543 q = queueptr(result);
1544 if (q == NULL)
1545 return -EINVAL;
1546 1541
1547 info.queue = q->queue; 1542 info.queue = q->queue;
1548 info.locked = q->locked; 1543 info.locked = q->locked;
@@ -1552,7 +1547,7 @@ static int snd_seq_ioctl_create_queue(struct snd_seq_client *client,
1552 if (! info.name[0]) 1547 if (! info.name[0])
1553 snprintf(info.name, sizeof(info.name), "Queue-%d", q->queue); 1548 snprintf(info.name, sizeof(info.name), "Queue-%d", q->queue);
1554 strlcpy(q->name, info.name, sizeof(q->name)); 1549 strlcpy(q->name, info.name, sizeof(q->name));
1555 queuefree(q); 1550 snd_use_lock_free(&q->use_lock);
1556 1551
1557 if (copy_to_user(arg, &info, sizeof(info))) 1552 if (copy_to_user(arg, &info, sizeof(info)))
1558 return -EFAULT; 1553 return -EFAULT;
@@ -1921,6 +1916,7 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
1921 info.output_pool != client->pool->size)) { 1916 info.output_pool != client->pool->size)) {
1922 if (snd_seq_write_pool_allocated(client)) { 1917 if (snd_seq_write_pool_allocated(client)) {
1923 /* remove all existing cells */ 1918 /* remove all existing cells */
1919 snd_seq_pool_mark_closing(client->pool);
1924 snd_seq_queue_client_leave_cells(client->number); 1920 snd_seq_queue_client_leave_cells(client->number);
1925 snd_seq_pool_done(client->pool); 1921 snd_seq_pool_done(client->pool);
1926 } 1922 }
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
index 1d5acbe0c08b..3490d21ab9e7 100644
--- a/sound/core/seq/seq_fifo.c
+++ b/sound/core/seq/seq_fifo.c
@@ -70,6 +70,9 @@ void snd_seq_fifo_delete(struct snd_seq_fifo **fifo)
70 return; 70 return;
71 *fifo = NULL; 71 *fifo = NULL;
72 72
73 if (f->pool)
74 snd_seq_pool_mark_closing(f->pool);
75
73 snd_seq_fifo_clear(f); 76 snd_seq_fifo_clear(f);
74 77
75 /* wake up clients if any */ 78 /* wake up clients if any */
@@ -135,6 +138,7 @@ int snd_seq_fifo_event_in(struct snd_seq_fifo *f,
135 f->tail = cell; 138 f->tail = cell;
136 if (f->head == NULL) 139 if (f->head == NULL)
137 f->head = cell; 140 f->head = cell;
141 cell->next = NULL;
138 f->cells++; 142 f->cells++;
139 spin_unlock_irqrestore(&f->lock, flags); 143 spin_unlock_irqrestore(&f->lock, flags);
140 144
@@ -214,6 +218,8 @@ void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f,
214 spin_lock_irqsave(&f->lock, flags); 218 spin_lock_irqsave(&f->lock, flags);
215 cell->next = f->head; 219 cell->next = f->head;
216 f->head = cell; 220 f->head = cell;
221 if (!f->tail)
222 f->tail = cell;
217 f->cells++; 223 f->cells++;
218 spin_unlock_irqrestore(&f->lock, flags); 224 spin_unlock_irqrestore(&f->lock, flags);
219 } 225 }
@@ -259,6 +265,10 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize)
259 /* NOTE: overflow flag is not cleared */ 265 /* NOTE: overflow flag is not cleared */
260 spin_unlock_irqrestore(&f->lock, flags); 266 spin_unlock_irqrestore(&f->lock, flags);
261 267
268 /* close the old pool and wait until all users are gone */
269 snd_seq_pool_mark_closing(oldpool);
270 snd_use_lock_sync(&f->use_lock);
271
262 /* release cells in old pool */ 272 /* release cells in old pool */
263 for (cell = oldhead; cell; cell = next) { 273 for (cell = oldhead; cell; cell = next) {
264 next = cell->next; 274 next = cell->next;
diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c
index 3b693e924db7..12ba83367b1b 100644
--- a/sound/core/seq/seq_lock.c
+++ b/sound/core/seq/seq_lock.c
@@ -28,19 +28,16 @@
28/* wait until all locks are released */ 28/* wait until all locks are released */
29void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) 29void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
30{ 30{
31 int max_count = 5 * HZ; 31 int warn_count = 5 * HZ;
32 32
33 if (atomic_read(lockp) < 0) { 33 if (atomic_read(lockp) < 0) {
34 pr_warn("ALSA: seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line); 34 pr_warn("ALSA: seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line);
35 return; 35 return;
36 } 36 }
37 while (atomic_read(lockp) > 0) { 37 while (atomic_read(lockp) > 0) {
38 if (max_count == 0) { 38 if (warn_count-- == 0)
39 pr_warn("ALSA: seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); 39 pr_warn("ALSA: seq_lock: waiting [%d left] in %s:%d\n", atomic_read(lockp), file, line);
40 break;
41 }
42 schedule_timeout_uninterruptible(1); 40 schedule_timeout_uninterruptible(1);
43 max_count--;
44 } 41 }
45} 42}
46 43
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index c850345c43b5..5847c4475bf3 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -414,32 +414,33 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
414 return 0; 414 return 0;
415} 415}
416 416
417/* refuse the further insertion to the pool */
418void snd_seq_pool_mark_closing(struct snd_seq_pool *pool)
419{
420 unsigned long flags;
421
422 if (snd_BUG_ON(!pool))
423 return;
424 spin_lock_irqsave(&pool->lock, flags);
425 pool->closing = 1;
426 spin_unlock_irqrestore(&pool->lock, flags);
427}
428
417/* remove events */ 429/* remove events */
418int snd_seq_pool_done(struct snd_seq_pool *pool) 430int snd_seq_pool_done(struct snd_seq_pool *pool)
419{ 431{
420 unsigned long flags; 432 unsigned long flags;
421 struct snd_seq_event_cell *ptr; 433 struct snd_seq_event_cell *ptr;
422 int max_count = 5 * HZ;
423 434
424 if (snd_BUG_ON(!pool)) 435 if (snd_BUG_ON(!pool))
425 return -EINVAL; 436 return -EINVAL;
426 437
427 /* wait for closing all threads */ 438 /* wait for closing all threads */
428 spin_lock_irqsave(&pool->lock, flags);
429 pool->closing = 1;
430 spin_unlock_irqrestore(&pool->lock, flags);
431
432 if (waitqueue_active(&pool->output_sleep)) 439 if (waitqueue_active(&pool->output_sleep))
433 wake_up(&pool->output_sleep); 440 wake_up(&pool->output_sleep);
434 441
435 while (atomic_read(&pool->counter) > 0) { 442 while (atomic_read(&pool->counter) > 0)
436 if (max_count == 0) {
437 pr_warn("ALSA: snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));
438 break;
439 }
440 schedule_timeout_uninterruptible(1); 443 schedule_timeout_uninterruptible(1);
441 max_count--;
442 }
443 444
444 /* release all resources */ 445 /* release all resources */
445 spin_lock_irqsave(&pool->lock, flags); 446 spin_lock_irqsave(&pool->lock, flags);
@@ -491,6 +492,7 @@ int snd_seq_pool_delete(struct snd_seq_pool **ppool)
491 *ppool = NULL; 492 *ppool = NULL;
492 if (pool == NULL) 493 if (pool == NULL)
493 return 0; 494 return 0;
495 snd_seq_pool_mark_closing(pool);
494 snd_seq_pool_done(pool); 496 snd_seq_pool_done(pool);
495 kfree(pool); 497 kfree(pool);
496 return 0; 498 return 0;
diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h
index 4a2ec779b8a7..32f959c17786 100644
--- a/sound/core/seq/seq_memory.h
+++ b/sound/core/seq/seq_memory.h
@@ -84,6 +84,7 @@ static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
84int snd_seq_pool_init(struct snd_seq_pool *pool); 84int snd_seq_pool_init(struct snd_seq_pool *pool);
85 85
86/* done pool - free events */ 86/* done pool - free events */
87void snd_seq_pool_mark_closing(struct snd_seq_pool *pool);
87int snd_seq_pool_done(struct snd_seq_pool *pool); 88int snd_seq_pool_done(struct snd_seq_pool *pool);
88 89
89/* create pool */ 90/* create pool */
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 0bec02e89d51..79e0c5604ef8 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -181,23 +181,29 @@ void __exit snd_seq_queues_delete(void)
181 } 181 }
182} 182}
183 183
184static void queue_use(struct snd_seq_queue *queue, int client, int use);
185
184/* allocate a new queue - 186/* allocate a new queue -
185 * return queue index value or negative value for error 187 * return pointer to new queue or ERR_PTR(-errno) for error
188 * The new queue's use_lock is set to 1. It is the caller's responsibility to
189 * call snd_use_lock_free(&q->use_lock).
186 */ 190 */
187int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) 191struct snd_seq_queue *snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
188{ 192{
189 struct snd_seq_queue *q; 193 struct snd_seq_queue *q;
190 194
191 q = queue_new(client, locked); 195 q = queue_new(client, locked);
192 if (q == NULL) 196 if (q == NULL)
193 return -ENOMEM; 197 return ERR_PTR(-ENOMEM);
194 q->info_flags = info_flags; 198 q->info_flags = info_flags;
199 queue_use(q, client, 1);
200 snd_use_lock_use(&q->use_lock);
195 if (queue_list_add(q) < 0) { 201 if (queue_list_add(q) < 0) {
202 snd_use_lock_free(&q->use_lock);
196 queue_delete(q); 203 queue_delete(q);
197 return -ENOMEM; 204 return ERR_PTR(-ENOMEM);
198 } 205 }
199 snd_seq_queue_use(q->queue, client, 1); /* use this queue */ 206 return q;
200 return q->queue;
201} 207}
202 208
203/* delete a queue - queue must be owned by the client */ 209/* delete a queue - queue must be owned by the client */
@@ -502,19 +508,9 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client,
502 return result; 508 return result;
503} 509}
504 510
505 511/* use or unuse this queue */
506/* use or unuse this queue - 512static void queue_use(struct snd_seq_queue *queue, int client, int use)
507 * if it is the first client, starts the timer.
508 * if it is not longer used by any clients, stop the timer.
509 */
510int snd_seq_queue_use(int queueid, int client, int use)
511{ 513{
512 struct snd_seq_queue *queue;
513
514 queue = queueptr(queueid);
515 if (queue == NULL)
516 return -EINVAL;
517 mutex_lock(&queue->timer_mutex);
518 if (use) { 514 if (use) {
519 if (!test_and_set_bit(client, queue->clients_bitmap)) 515 if (!test_and_set_bit(client, queue->clients_bitmap))
520 queue->clients++; 516 queue->clients++;
@@ -529,6 +525,21 @@ int snd_seq_queue_use(int queueid, int client, int use)
529 } else { 525 } else {
530 snd_seq_timer_close(queue); 526 snd_seq_timer_close(queue);
531 } 527 }
528}
529
530/* use or unuse this queue -
531 * if it is the first client, starts the timer.
532 * if it is not longer used by any clients, stop the timer.
533 */
534int snd_seq_queue_use(int queueid, int client, int use)
535{
536 struct snd_seq_queue *queue;
537
538 queue = queueptr(queueid);
539 if (queue == NULL)
540 return -EINVAL;
541 mutex_lock(&queue->timer_mutex);
542 queue_use(queue, client, use);
532 mutex_unlock(&queue->timer_mutex); 543 mutex_unlock(&queue->timer_mutex);
533 queuefree(queue); 544 queuefree(queue);
534 return 0; 545 return 0;
diff --git a/sound/core/seq/seq_queue.h b/sound/core/seq/seq_queue.h
index 30c8111477f6..719093489a2c 100644
--- a/sound/core/seq/seq_queue.h
+++ b/sound/core/seq/seq_queue.h
@@ -71,7 +71,7 @@ void snd_seq_queues_delete(void);
71 71
72 72
73/* create new queue (constructor) */ 73/* create new queue (constructor) */
74int snd_seq_queue_alloc(int client, int locked, unsigned int flags); 74struct snd_seq_queue *snd_seq_queue_alloc(int client, int locked, unsigned int flags);
75 75
76/* delete queue (destructor) */ 76/* delete queue (destructor) */
77int snd_seq_queue_delete(int client, int queueid); 77int snd_seq_queue_delete(int client, int queueid);
diff --git a/sound/core/timer.c b/sound/core/timer.c
index ae4ea2e2e7fe..48eaccba82a3 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -1621,6 +1621,7 @@ static int snd_timer_user_tselect(struct file *file,
1621 if (err < 0) 1621 if (err < 0)
1622 goto __err; 1622 goto __err;
1623 1623
1624 tu->qhead = tu->qtail = tu->qused = 0;
1624 kfree(tu->queue); 1625 kfree(tu->queue);
1625 tu->queue = NULL; 1626 tu->queue = NULL;
1626 kfree(tu->tqueue); 1627 kfree(tu->tqueue);
@@ -1700,9 +1701,21 @@ static int snd_timer_user_params(struct file *file,
1700 return -EBADFD; 1701 return -EBADFD;
1701 if (copy_from_user(&params, _params, sizeof(params))) 1702 if (copy_from_user(&params, _params, sizeof(params)))
1702 return -EFAULT; 1703 return -EFAULT;
1703 if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE) && params.ticks < 1) { 1704 if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE)) {
1704 err = -EINVAL; 1705 u64 resolution;
1705 goto _end; 1706
1707 if (params.ticks < 1) {
1708 err = -EINVAL;
1709 goto _end;
1710 }
1711
1712 /* Don't allow resolution less than 1ms */
1713 resolution = snd_timer_resolution(tu->timeri);
1714 resolution *= params.ticks;
1715 if (resolution < 1000000) {
1716 err = -EINVAL;
1717 goto _end;
1718 }
1706 } 1719 }
1707 if (params.queue_size > 0 && 1720 if (params.queue_size > 0 &&
1708 (params.queue_size < 32 || params.queue_size > 1024)) { 1721 (params.queue_size < 32 || params.queue_size > 1024)) {
@@ -1946,6 +1959,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1946 1959
1947 tu = file->private_data; 1960 tu = file->private_data;
1948 unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read); 1961 unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read);
1962 mutex_lock(&tu->ioctl_lock);
1949 spin_lock_irq(&tu->qlock); 1963 spin_lock_irq(&tu->qlock);
1950 while ((long)count - result >= unit) { 1964 while ((long)count - result >= unit) {
1951 while (!tu->qused) { 1965 while (!tu->qused) {
@@ -1961,7 +1975,9 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1961 add_wait_queue(&tu->qchange_sleep, &wait); 1975 add_wait_queue(&tu->qchange_sleep, &wait);
1962 1976
1963 spin_unlock_irq(&tu->qlock); 1977 spin_unlock_irq(&tu->qlock);
1978 mutex_unlock(&tu->ioctl_lock);
1964 schedule(); 1979 schedule();
1980 mutex_lock(&tu->ioctl_lock);
1965 spin_lock_irq(&tu->qlock); 1981 spin_lock_irq(&tu->qlock);
1966 1982
1967 remove_wait_queue(&tu->qchange_sleep, &wait); 1983 remove_wait_queue(&tu->qchange_sleep, &wait);
@@ -1981,7 +1997,6 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1981 tu->qused--; 1997 tu->qused--;
1982 spin_unlock_irq(&tu->qlock); 1998 spin_unlock_irq(&tu->qlock);
1983 1999
1984 mutex_lock(&tu->ioctl_lock);
1985 if (tu->tread) { 2000 if (tu->tread) {
1986 if (copy_to_user(buffer, &tu->tqueue[qhead], 2001 if (copy_to_user(buffer, &tu->tqueue[qhead],
1987 sizeof(struct snd_timer_tread))) 2002 sizeof(struct snd_timer_tread)))
@@ -1991,7 +2006,6 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
1991 sizeof(struct snd_timer_read))) 2006 sizeof(struct snd_timer_read)))
1992 err = -EFAULT; 2007 err = -EFAULT;
1993 } 2008 }
1994 mutex_unlock(&tu->ioctl_lock);
1995 2009
1996 spin_lock_irq(&tu->qlock); 2010 spin_lock_irq(&tu->qlock);
1997 if (err < 0) 2011 if (err < 0)
@@ -2001,6 +2015,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
2001 } 2015 }
2002 _error: 2016 _error:
2003 spin_unlock_irq(&tu->qlock); 2017 spin_unlock_irq(&tu->qlock);
2018 mutex_unlock(&tu->ioctl_lock);
2004 return result > 0 ? result : err; 2019 return result > 0 ? result : err;
2005} 2020}
2006 2021
diff --git a/sound/firewire/lib.h b/sound/firewire/lib.h
index f3f6f84c48d6..bb5f8cdea3e2 100644
--- a/sound/firewire/lib.h
+++ b/sound/firewire/lib.h
@@ -42,7 +42,7 @@ struct snd_fw_async_midi_port {
42 42
43 struct snd_rawmidi_substream *substream; 43 struct snd_rawmidi_substream *substream;
44 snd_fw_async_midi_port_fill fill; 44 snd_fw_async_midi_port_fill fill;
45 unsigned int consume_bytes; 45 int consume_bytes;
46}; 46};
47 47
48int snd_fw_async_midi_port_init(struct snd_fw_async_midi_port *port, 48int snd_fw_async_midi_port_init(struct snd_fw_async_midi_port *port,
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
index 9667cbfb0ca2..79edd88d5cd0 100644
--- a/sound/pci/ctxfi/cthw20k1.c
+++ b/sound/pci/ctxfi/cthw20k1.c
@@ -27,12 +27,6 @@
27#include "cthw20k1.h" 27#include "cthw20k1.h"
28#include "ct20k1reg.h" 28#include "ct20k1reg.h"
29 29
30#if BITS_PER_LONG == 32
31#define CT_XFI_DMA_MASK DMA_BIT_MASK(32) /* 32 bit PTE */
32#else
33#define CT_XFI_DMA_MASK DMA_BIT_MASK(64) /* 64 bit PTE */
34#endif
35
36struct hw20k1 { 30struct hw20k1 {
37 struct hw hw; 31 struct hw hw;
38 spinlock_t reg_20k1_lock; 32 spinlock_t reg_20k1_lock;
@@ -1904,19 +1898,18 @@ static int hw_card_start(struct hw *hw)
1904{ 1898{
1905 int err; 1899 int err;
1906 struct pci_dev *pci = hw->pci; 1900 struct pci_dev *pci = hw->pci;
1901 const unsigned int dma_bits = BITS_PER_LONG;
1907 1902
1908 err = pci_enable_device(pci); 1903 err = pci_enable_device(pci);
1909 if (err < 0) 1904 if (err < 0)
1910 return err; 1905 return err;
1911 1906
1912 /* Set DMA transfer mask */ 1907 /* Set DMA transfer mask */
1913 if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || 1908 if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
1914 dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { 1909 dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
1915 dev_err(hw->card->dev, 1910 } else {
1916 "architecture does not support PCI busmaster DMA with mask 0x%llx\n", 1911 dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
1917 CT_XFI_DMA_MASK); 1912 dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32));
1918 err = -ENXIO;
1919 goto error1;
1920 } 1913 }
1921 1914
1922 if (!hw->io_base) { 1915 if (!hw->io_base) {
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index 9dc2950e1ab7..d86678c2a957 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -26,12 +26,6 @@
26#include "cthw20k2.h" 26#include "cthw20k2.h"
27#include "ct20k2reg.h" 27#include "ct20k2reg.h"
28 28
29#if BITS_PER_LONG == 32
30#define CT_XFI_DMA_MASK DMA_BIT_MASK(32) /* 32 bit PTE */
31#else
32#define CT_XFI_DMA_MASK DMA_BIT_MASK(64) /* 64 bit PTE */
33#endif
34
35struct hw20k2 { 29struct hw20k2 {
36 struct hw hw; 30 struct hw hw;
37 /* for i2c */ 31 /* for i2c */
@@ -2029,19 +2023,18 @@ static int hw_card_start(struct hw *hw)
2029 int err = 0; 2023 int err = 0;
2030 struct pci_dev *pci = hw->pci; 2024 struct pci_dev *pci = hw->pci;
2031 unsigned int gctl; 2025 unsigned int gctl;
2026 const unsigned int dma_bits = BITS_PER_LONG;
2032 2027
2033 err = pci_enable_device(pci); 2028 err = pci_enable_device(pci);
2034 if (err < 0) 2029 if (err < 0)
2035 return err; 2030 return err;
2036 2031
2037 /* Set DMA transfer mask */ 2032 /* Set DMA transfer mask */
2038 if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || 2033 if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
2039 dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { 2034 dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
2040 dev_err(hw->card->dev, 2035 } else {
2041 "architecture does not support PCI busmaster DMA with mask 0x%llx\n", 2036 dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
2042 CT_XFI_DMA_MASK); 2037 dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32));
2043 err = -ENXIO;
2044 goto error1;
2045 } 2038 }
2046 2039
2047 if (!hw->io_base) { 2040 if (!hw->io_base) {
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 373fcad840ea..776dffa88aee 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -294,6 +294,8 @@ struct hda_codec {
294 294
295#define list_for_each_codec(c, bus) \ 295#define list_for_each_codec(c, bus) \
296 list_for_each_entry(c, &(bus)->core.codec_list, core.list) 296 list_for_each_entry(c, &(bus)->core.codec_list, core.list)
297#define list_for_each_codec_safe(c, n, bus) \
298 list_for_each_entry_safe(c, n, &(bus)->core.codec_list, core.list)
297 299
298/* snd_hda_codec_read/write optional flags */ 300/* snd_hda_codec_read/write optional flags */
299#define HDA_RW_NO_RESPONSE_FALLBACK (1 << 0) 301#define HDA_RW_NO_RESPONSE_FALLBACK (1 << 0)
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 5baf8b56b6e7..9c6e10fb479f 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1128,8 +1128,12 @@ EXPORT_SYMBOL_GPL(azx_probe_codecs);
1128/* configure each codec instance */ 1128/* configure each codec instance */
1129int azx_codec_configure(struct azx *chip) 1129int azx_codec_configure(struct azx *chip)
1130{ 1130{
1131 struct hda_codec *codec; 1131 struct hda_codec *codec, *next;
1132 list_for_each_codec(codec, &chip->bus) { 1132
1133 /* use _safe version here since snd_hda_codec_configure() deregisters
1134 * the device upon error and deletes itself from the bus list.
1135 */
1136 list_for_each_codec_safe(codec, next, &chip->bus) {
1133 snd_hda_codec_configure(codec); 1137 snd_hda_codec_configure(codec);
1134 } 1138 }
1135 return 0; 1139 return 0;
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index dc2fa576d60d..689df78f640a 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -3190,6 +3190,7 @@ static int check_dyn_adc_switch(struct hda_codec *codec)
3190 spec->input_paths[i][nums]); 3190 spec->input_paths[i][nums]);
3191 spec->input_paths[i][nums] = 3191 spec->input_paths[i][nums] =
3192 spec->input_paths[i][n]; 3192 spec->input_paths[i][n];
3193 spec->input_paths[i][n] = 0;
3193 } 3194 }
3194 } 3195 }
3195 nums++; 3196 nums++;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index ad4a1e9a3ae1..e6de496bffbe 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2166,7 +2166,20 @@ static void azx_remove(struct pci_dev *pci)
2166 /* cancel the pending probing work */ 2166 /* cancel the pending probing work */
2167 chip = card->private_data; 2167 chip = card->private_data;
2168 hda = container_of(chip, struct hda_intel, chip); 2168 hda = container_of(chip, struct hda_intel, chip);
2169 /* FIXME: below is an ugly workaround.
2170 * Both device_release_driver() and driver_probe_device()
2171 * take *both* the device's and its parent's lock before
2172 * calling the remove() and probe() callbacks. The codec
2173 * probe takes the locks of both the codec itself and its
2174 * parent, i.e. the PCI controller dev. Meanwhile, when
2175 * the PCI controller is unbound, it takes its lock, too
2176 * ==> ouch, a deadlock!
2177 * As a workaround, we unlock temporarily here the controller
2178 * device during cancel_work_sync() call.
2179 */
2180 device_unlock(&pci->dev);
2169 cancel_work_sync(&hda->probe_work); 2181 cancel_work_sync(&hda->probe_work);
2182 device_lock(&pci->dev);
2170 2183
2171 snd_card_free(card); 2184 snd_card_free(card);
2172 } 2185 }
@@ -2208,9 +2221,9 @@ static const struct pci_device_id azx_ids[] = {
2208 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2221 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
2209 /* Lewisburg */ 2222 /* Lewisburg */
2210 { PCI_DEVICE(0x8086, 0xa1f0), 2223 { PCI_DEVICE(0x8086, 0xa1f0),
2211 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2224 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
2212 { PCI_DEVICE(0x8086, 0xa270), 2225 { PCI_DEVICE(0x8086, 0xa270),
2213 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2226 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
2214 /* Lynx Point-LP */ 2227 /* Lynx Point-LP */
2215 { PCI_DEVICE(0x8086, 0x9c20), 2228 { PCI_DEVICE(0x8086, 0x9c20),
2216 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2229 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 00c50d58f108..5cab24f52825 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2233,6 +2233,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2233 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), 2233 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2234 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), 2234 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2235 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), 2235 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2236 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2236 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), 2237 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2237 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), 2238 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2238 2239
@@ -4831,6 +4832,7 @@ enum {
4831 ALC292_FIXUP_DISABLE_AAMIX, 4832 ALC292_FIXUP_DISABLE_AAMIX,
4832 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, 4833 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
4833 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, 4834 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
4835 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
4834 ALC275_FIXUP_DELL_XPS, 4836 ALC275_FIXUP_DELL_XPS,
4835 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, 4837 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
4836 ALC293_FIXUP_LENOVO_SPK_NOISE, 4838 ALC293_FIXUP_LENOVO_SPK_NOISE,
@@ -5429,6 +5431,15 @@ static const struct hda_fixup alc269_fixups[] = {
5429 .chained = true, 5431 .chained = true,
5430 .chain_id = ALC269_FIXUP_HEADSET_MODE 5432 .chain_id = ALC269_FIXUP_HEADSET_MODE
5431 }, 5433 },
5434 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
5435 .type = HDA_FIXUP_PINS,
5436 .v.pins = (const struct hda_pintbl[]) {
5437 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5438 { }
5439 },
5440 .chained = true,
5441 .chain_id = ALC269_FIXUP_HEADSET_MODE
5442 },
5432 [ALC275_FIXUP_DELL_XPS] = { 5443 [ALC275_FIXUP_DELL_XPS] = {
5433 .type = HDA_FIXUP_VERBS, 5444 .type = HDA_FIXUP_VERBS,
5434 .v.verbs = (const struct hda_verb[]) { 5445 .v.verbs = (const struct hda_verb[]) {
@@ -5501,7 +5512,7 @@ static const struct hda_fixup alc269_fixups[] = {
5501 .type = HDA_FIXUP_FUNC, 5512 .type = HDA_FIXUP_FUNC,
5502 .v.func = alc298_fixup_speaker_volume, 5513 .v.func = alc298_fixup_speaker_volume,
5503 .chained = true, 5514 .chained = true,
5504 .chain_id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, 5515 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5505 }, 5516 },
5506 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { 5517 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
5507 .type = HDA_FIXUP_PINS, 5518 .type = HDA_FIXUP_PINS,
@@ -5560,6 +5571,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5560 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), 5571 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
5561 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), 5572 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5562 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), 5573 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
5574 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5563 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5575 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5564 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5576 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5565 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), 5577 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -5674,6 +5686,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5674 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460), 5686 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
5675 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 5687 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5676 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 5688 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5689 SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5677 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), 5690 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
5678 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), 5691 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
5679 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), 5692 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
@@ -6038,6 +6051,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
6038 ALC295_STANDARD_PINS, 6051 ALC295_STANDARD_PINS,
6039 {0x17, 0x21014040}, 6052 {0x17, 0x21014040},
6040 {0x18, 0x21a19050}), 6053 {0x18, 0x21a19050}),
6054 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6055 ALC295_STANDARD_PINS),
6041 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, 6056 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6042 ALC298_STANDARD_PINS, 6057 ALC298_STANDARD_PINS,
6043 {0x17, 0x90170110}), 6058 {0x17, 0x90170110}),
@@ -6047,6 +6062,12 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
6047 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, 6062 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6048 ALC298_STANDARD_PINS, 6063 ALC298_STANDARD_PINS,
6049 {0x17, 0x90170150}), 6064 {0x17, 0x90170150}),
6065 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
6066 {0x12, 0xb7a60140},
6067 {0x13, 0xb7a60150},
6068 {0x17, 0x90170110},
6069 {0x1a, 0x03011020},
6070 {0x21, 0x03211030}),
6050 {} 6071 {}
6051}; 6072};
6052 6073
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 37b70f8e878f..0abab7926dca 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1537,6 +1537,8 @@ static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
1537 "Dell Inspiron 1501", STAC_9200_DELL_M26), 1537 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1538 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, 1538 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1539 "unknown Dell", STAC_9200_DELL_M26), 1539 "unknown Dell", STAC_9200_DELL_M26),
1540 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0201,
1541 "Dell Latitude D430", STAC_9200_DELL_M22),
1540 /* Panasonic */ 1542 /* Panasonic */
1541 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), 1543 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1542 /* Gateway machines needs EAPD to be set on resume */ 1544 /* Gateway machines needs EAPD to be set on resume */
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 09da7b52bc2e..1468e4b7bf93 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -991,6 +991,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
991 if (err < 0) 991 if (err < 0)
992 return err; 992 return err;
993 } 993 }
994 master_vol = NULL;
994 if (pm7500) 995 if (pm7500)
995 err = build_mixers(chip, 996 err = build_mixers(chip,
996 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500), 997 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500),
diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index 8276675730ef..78a985629607 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -343,7 +343,7 @@ static int atmel_classd_codec_dai_digital_mute(struct snd_soc_dai *codec_dai,
343} 343}
344 344
345#define CLASSD_ACLK_RATE_11M2896_MPY_8 (112896 * 100 * 8) 345#define CLASSD_ACLK_RATE_11M2896_MPY_8 (112896 * 100 * 8)
346#define CLASSD_ACLK_RATE_12M288_MPY_8 (12228 * 1000 * 8) 346#define CLASSD_ACLK_RATE_12M288_MPY_8 (12288 * 1000 * 8)
347 347
348static struct { 348static struct {
349 int rate; 349 int rate;
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index c1b87c5800b1..b3fddba4c084 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -936,7 +936,8 @@ static void nau8825_fll_apply(struct nau8825 *nau8825,
936 NAU8825_FLL_INTEGER_MASK, fll_param->fll_int); 936 NAU8825_FLL_INTEGER_MASK, fll_param->fll_int);
937 /* FLL pre-scaler */ 937 /* FLL pre-scaler */
938 regmap_update_bits(nau8825->regmap, NAU8825_REG_FLL4, 938 regmap_update_bits(nau8825->regmap, NAU8825_REG_FLL4,
939 NAU8825_FLL_REF_DIV_MASK, fll_param->clk_ref_div); 939 NAU8825_FLL_REF_DIV_MASK,
940 fll_param->clk_ref_div << NAU8825_FLL_REF_DIV_SFT);
940 /* select divided VCO input */ 941 /* select divided VCO input */
941 regmap_update_bits(nau8825->regmap, NAU8825_REG_FLL5, 942 regmap_update_bits(nau8825->regmap, NAU8825_REG_FLL5,
942 NAU8825_FLL_FILTER_SW_MASK, 0x0000); 943 NAU8825_FLL_FILTER_SW_MASK, 0x0000);
diff --git a/sound/soc/codecs/nau8825.h b/sound/soc/codecs/nau8825.h
index dff8edb83bfd..a0b220726a63 100644
--- a/sound/soc/codecs/nau8825.h
+++ b/sound/soc/codecs/nau8825.h
@@ -114,7 +114,8 @@
114#define NAU8825_FLL_INTEGER_MASK (0x3ff << 0) 114#define NAU8825_FLL_INTEGER_MASK (0x3ff << 0)
115 115
116/* FLL4 (0x07) */ 116/* FLL4 (0x07) */
117#define NAU8825_FLL_REF_DIV_MASK (0x3 << 10) 117#define NAU8825_FLL_REF_DIV_SFT 10
118#define NAU8825_FLL_REF_DIV_MASK (0x3 << NAU8825_FLL_REF_DIV_SFT)
118 119
119/* FLL5 (0x08) */ 120/* FLL5 (0x08) */
120#define NAU8825_FLL_FILTER_SW_MASK (0x1 << 14) 121#define NAU8825_FLL_FILTER_SW_MASK (0x1 << 14)
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index a564759845f9..5a3f544bb3a8 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -126,6 +126,16 @@ static const struct reg_default aic3x_reg[] = {
126 { 108, 0x00 }, { 109, 0x00 }, 126 { 108, 0x00 }, { 109, 0x00 },
127}; 127};
128 128
129static bool aic3x_volatile_reg(struct device *dev, unsigned int reg)
130{
131 switch (reg) {
132 case AIC3X_RESET:
133 return true;
134 default:
135 return false;
136 }
137}
138
129static const struct regmap_config aic3x_regmap = { 139static const struct regmap_config aic3x_regmap = {
130 .reg_bits = 8, 140 .reg_bits = 8,
131 .val_bits = 8, 141 .val_bits = 8,
@@ -133,6 +143,9 @@ static const struct regmap_config aic3x_regmap = {
133 .max_register = DAC_ICC_ADJ, 143 .max_register = DAC_ICC_ADJ,
134 .reg_defaults = aic3x_reg, 144 .reg_defaults = aic3x_reg,
135 .num_reg_defaults = ARRAY_SIZE(aic3x_reg), 145 .num_reg_defaults = ARRAY_SIZE(aic3x_reg),
146
147 .volatile_reg = aic3x_volatile_reg,
148
136 .cache_type = REGCACHE_RBTREE, 149 .cache_type = REGCACHE_RBTREE,
137}; 150};
138 151
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 7a5c9a36c1db..daba8c56b43b 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -139,7 +139,7 @@ static struct snd_soc_dai_link byt_dailink[] = {
139 .codec_dai_name = "snd-soc-dummy-dai", 139 .codec_dai_name = "snd-soc-dummy-dai",
140 .codec_name = "snd-soc-dummy", 140 .codec_name = "snd-soc-dummy",
141 .platform_name = "sst-mfld-platform", 141 .platform_name = "sst-mfld-platform",
142 .ignore_suspend = 1, 142 .nonatomic = true,
143 .dynamic = 1, 143 .dynamic = 1,
144 .dpcm_playback = 1, 144 .dpcm_playback = 1,
145 .dpcm_capture = 1, 145 .dpcm_capture = 1,
@@ -166,6 +166,7 @@ static struct snd_soc_dai_link byt_dailink[] = {
166 | SND_SOC_DAIFMT_CBS_CFS, 166 | SND_SOC_DAIFMT_CBS_CFS,
167 .be_hw_params_fixup = byt_codec_fixup, 167 .be_hw_params_fixup = byt_codec_fixup,
168 .ignore_suspend = 1, 168 .ignore_suspend = 1,
169 .nonatomic = true,
169 .dpcm_playback = 1, 170 .dpcm_playback = 1,
170 .dpcm_capture = 1, 171 .dpcm_capture = 1,
171 .ops = &byt_be_ssp2_ops, 172 .ops = &byt_be_ssp2_ops,
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index bb82bb966000..c1addf49c4f2 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -68,7 +68,8 @@ out:
68static int soc_compr_open_fe(struct snd_compr_stream *cstream) 68static int soc_compr_open_fe(struct snd_compr_stream *cstream)
69{ 69{
70 struct snd_soc_pcm_runtime *fe = cstream->private_data; 70 struct snd_soc_pcm_runtime *fe = cstream->private_data;
71 struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream; 71 struct snd_pcm_substream *fe_substream =
72 fe->pcm->streams[cstream->direction].substream;
72 struct snd_soc_platform *platform = fe->platform; 73 struct snd_soc_platform *platform = fe->platform;
73 struct snd_soc_dpcm *dpcm; 74 struct snd_soc_dpcm *dpcm;
74 struct snd_soc_dapm_widget_list *list; 75 struct snd_soc_dapm_widget_list *list;
@@ -412,7 +413,8 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
412 struct snd_compr_params *params) 413 struct snd_compr_params *params)
413{ 414{
414 struct snd_soc_pcm_runtime *fe = cstream->private_data; 415 struct snd_soc_pcm_runtime *fe = cstream->private_data;
415 struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream; 416 struct snd_pcm_substream *fe_substream =
417 fe->pcm->streams[cstream->direction].substream;
416 struct snd_soc_platform *platform = fe->platform; 418 struct snd_soc_platform *platform = fe->platform;
417 int ret = 0, stream; 419 int ret = 0, stream;
418 420
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 06a91d88689a..0124eedcaaa3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1793,6 +1793,9 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
1793 for (i = 0; i < card->num_aux_devs; i++) 1793 for (i = 0; i < card->num_aux_devs; i++)
1794 soc_remove_aux_dev(card, i); 1794 soc_remove_aux_dev(card, i);
1795 1795
1796 /* free the ALSA card at first; this syncs with pending operations */
1797 snd_card_free(card->snd_card);
1798
1796 /* remove and free each DAI */ 1799 /* remove and free each DAI */
1797 soc_remove_dai_links(card); 1800 soc_remove_dai_links(card);
1798 1801
@@ -1804,9 +1807,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
1804 1807
1805 snd_soc_dapm_free(&card->dapm); 1808 snd_soc_dapm_free(&card->dapm);
1806 1809
1807 snd_card_free(card->snd_card);
1808 return 0; 1810 return 0;
1809
1810} 1811}
1811 1812
1812/* removes a socdev */ 1813/* removes a socdev */
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 65b936e251ea..977066ba1769 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -181,6 +181,10 @@ int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
181 dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", 181 dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n",
182 be->dai_link->name, event, dir); 182 be->dai_link->name, event, dir);
183 183
184 if ((event == SND_SOC_DAPM_STREAM_STOP) &&
185 (be->dpcm[dir].users >= 1))
186 continue;
187
184 snd_soc_dapm_stream_event(be, dir, event); 188 snd_soc_dapm_stream_event(be, dir, event);
185 } 189 }
186 190
@@ -2073,9 +2077,11 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
2073 break; 2077 break;
2074 case SNDRV_PCM_TRIGGER_STOP: 2078 case SNDRV_PCM_TRIGGER_STOP:
2075 case SNDRV_PCM_TRIGGER_SUSPEND: 2079 case SNDRV_PCM_TRIGGER_SUSPEND:
2076 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
2077 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; 2080 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP;
2078 break; 2081 break;
2082 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
2083 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED;
2084 break;
2079 } 2085 }
2080 2086
2081out: 2087out:
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index be1f511e4f54..ae2981460cd8 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -384,6 +384,9 @@ static void snd_complete_urb(struct urb *urb)
384 if (unlikely(atomic_read(&ep->chip->shutdown))) 384 if (unlikely(atomic_read(&ep->chip->shutdown)))
385 goto exit_clear; 385 goto exit_clear;
386 386
387 if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
388 goto exit_clear;
389
387 if (usb_pipeout(ep->pipe)) { 390 if (usb_pipeout(ep->pipe)) {
388 retire_outbound_urb(ep, ctx); 391 retire_outbound_urb(ep, ctx);
389 /* can be stopped during retire callback */ 392 /* can be stopped during retire callback */
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 499b03c8281d..696de5ac69be 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -541,6 +541,8 @@ int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
541 541
542 if (size < sizeof(scale)) 542 if (size < sizeof(scale))
543 return -ENOMEM; 543 return -ENOMEM;
544 if (cval->min_mute)
545 scale[0] = SNDRV_CTL_TLVT_DB_MINMAX_MUTE;
544 scale[2] = cval->dBmin; 546 scale[2] = cval->dBmin;
545 scale[3] = cval->dBmax; 547 scale[3] = cval->dBmax;
546 if (copy_to_user(_tlv, scale, sizeof(scale))) 548 if (copy_to_user(_tlv, scale, sizeof(scale)))
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 3417ef347e40..2b4b067646ab 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -64,6 +64,7 @@ struct usb_mixer_elem_info {
64 int cached; 64 int cached;
65 int cache_val[MAX_CHANNELS]; 65 int cache_val[MAX_CHANNELS];
66 u8 initialized; 66 u8 initialized;
67 u8 min_mute;
67 void *private_data; 68 void *private_data;
68}; 69};
69 70
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 04991b009132..5d2fc5f58bfe 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1873,6 +1873,12 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
1873 if (unitid == 7 && cval->control == UAC_FU_VOLUME) 1873 if (unitid == 7 && cval->control == UAC_FU_VOLUME)
1874 snd_dragonfly_quirk_db_scale(mixer, cval, kctl); 1874 snd_dragonfly_quirk_db_scale(mixer, cval, kctl);
1875 break; 1875 break;
1876 /* lowest playback value is muted on C-Media devices */
1877 case USB_ID(0x0d8c, 0x000c):
1878 case USB_ID(0x0d8c, 0x0014):
1879 if (strstr(kctl->id.name, "Playback"))
1880 cval->min_mute = 1;
1881 break;
1876 } 1882 }
1877} 1883}
1878 1884
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 29f38e2b4ca9..1cc20d138dae 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1143,6 +1143,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
1143 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ 1143 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */
1144 case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ 1144 case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */
1145 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ 1145 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */
1146 case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */
1146 case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ 1147 case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */
1147 case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */ 1148 case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */
1148 case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */ 1149 case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */