diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-11-01 05:11:07 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-01 05:11:07 -0500 |
commit | e87a3dd33eab30b4db539500064a9584867e4f2c (patch) | |
tree | 2f7ad16e46ae30518ff63bb5391b63f7f7cc74dd /sound | |
parent | b14f5de731ae657d498d18d713c6431bfbeefb4b (diff) | |
parent | 3d00941371a765779c4e3509214c7e5793cce1fe (diff) |
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'sound')
63 files changed, 888 insertions, 573 deletions
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index f0ebc971c686..1dd66ddffcaf 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c | |||
@@ -897,6 +897,15 @@ static int tas_create(struct i2c_adapter *adapter, | |||
897 | client = i2c_new_device(adapter, &info); | 897 | client = i2c_new_device(adapter, &info); |
898 | if (!client) | 898 | if (!client) |
899 | return -ENODEV; | 899 | return -ENODEV; |
900 | /* | ||
901 | * We know the driver is already loaded, so the device should be | ||
902 | * already bound. If not it means binding failed, and then there | ||
903 | * is no point in keeping the device instantiated. | ||
904 | */ | ||
905 | if (!client->driver) { | ||
906 | i2c_unregister_device(client); | ||
907 | return -ENODEV; | ||
908 | } | ||
900 | 909 | ||
901 | /* | 910 | /* |
902 | * Let i2c-core delete that device on driver removal. | 911 | * Let i2c-core delete that device on driver removal. |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index dc78272fc39f..1f0f8213e2d5 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -937,6 +937,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
937 | struct snd_ac97 *ac97; | 937 | struct snd_ac97 *ac97; |
938 | int ret; | 938 | int ret; |
939 | 939 | ||
940 | writel(0, aaci->base + AC97_POWERDOWN); | ||
940 | /* | 941 | /* |
941 | * Assert AACIRESET for 2us | 942 | * Assert AACIRESET for 2us |
942 | */ | 943 | */ |
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 4e34d19ddbc0..b4b48afb6de6 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -137,9 +137,9 @@ static int pxa2xx_ac97_do_resume(struct snd_card *card) | |||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) | 140 | static int pxa2xx_ac97_suspend(struct device *dev) |
141 | { | 141 | { |
142 | struct snd_card *card = platform_get_drvdata(dev); | 142 | struct snd_card *card = dev_get_drvdata(dev); |
143 | int ret = 0; | 143 | int ret = 0; |
144 | 144 | ||
145 | if (card) | 145 | if (card) |
@@ -148,9 +148,9 @@ static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) | |||
148 | return ret; | 148 | return ret; |
149 | } | 149 | } |
150 | 150 | ||
151 | static int pxa2xx_ac97_resume(struct platform_device *dev) | 151 | static int pxa2xx_ac97_resume(struct device *dev) |
152 | { | 152 | { |
153 | struct snd_card *card = platform_get_drvdata(dev); | 153 | struct snd_card *card = dev_get_drvdata(dev); |
154 | int ret = 0; | 154 | int ret = 0; |
155 | 155 | ||
156 | if (card) | 156 | if (card) |
@@ -159,9 +159,10 @@ static int pxa2xx_ac97_resume(struct platform_device *dev) | |||
159 | return ret; | 159 | return ret; |
160 | } | 160 | } |
161 | 161 | ||
162 | #else | 162 | static struct dev_pm_ops pxa2xx_ac97_pm_ops = { |
163 | #define pxa2xx_ac97_suspend NULL | 163 | .suspend = pxa2xx_ac97_suspend, |
164 | #define pxa2xx_ac97_resume NULL | 164 | .resume = pxa2xx_ac97_resume, |
165 | }; | ||
165 | #endif | 166 | #endif |
166 | 167 | ||
167 | static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) | 168 | static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) |
@@ -241,11 +242,12 @@ static int __devexit pxa2xx_ac97_remove(struct platform_device *dev) | |||
241 | static struct platform_driver pxa2xx_ac97_driver = { | 242 | static struct platform_driver pxa2xx_ac97_driver = { |
242 | .probe = pxa2xx_ac97_probe, | 243 | .probe = pxa2xx_ac97_probe, |
243 | .remove = __devexit_p(pxa2xx_ac97_remove), | 244 | .remove = __devexit_p(pxa2xx_ac97_remove), |
244 | .suspend = pxa2xx_ac97_suspend, | ||
245 | .resume = pxa2xx_ac97_resume, | ||
246 | .driver = { | 245 | .driver = { |
247 | .name = "pxa2xx-ac97", | 246 | .name = "pxa2xx-ac97", |
248 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
248 | #ifdef CONFIG_PM | ||
249 | .pm = &pxa2xx_ac97_pm_ops, | ||
250 | #endif | ||
249 | }, | 251 | }, |
250 | }; | 252 | }; |
251 | 253 | ||
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 0c1440121c22..c69c60b2a48a 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -953,11 +953,12 @@ static int snd_pcm_dev_register(struct snd_device *device) | |||
953 | struct snd_pcm_substream *substream; | 953 | struct snd_pcm_substream *substream; |
954 | struct snd_pcm_notify *notify; | 954 | struct snd_pcm_notify *notify; |
955 | char str[16]; | 955 | char str[16]; |
956 | struct snd_pcm *pcm = device->device_data; | 956 | struct snd_pcm *pcm; |
957 | struct device *dev; | 957 | struct device *dev; |
958 | 958 | ||
959 | if (snd_BUG_ON(!pcm || !device)) | 959 | if (snd_BUG_ON(!device || !device->device_data)) |
960 | return -ENXIO; | 960 | return -ENXIO; |
961 | pcm = device->device_data; | ||
961 | mutex_lock(®ister_mutex); | 962 | mutex_lock(®ister_mutex); |
962 | err = snd_pcm_add(pcm); | 963 | err = snd_pcm_add(pcm); |
963 | if (err) { | 964 | if (err) { |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 59e5fbe6af51..ab73edf2c89a 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1387,11 +1387,6 @@ static struct action_ops snd_pcm_action_drain_init = { | |||
1387 | .post_action = snd_pcm_post_drain_init | 1387 | .post_action = snd_pcm_post_drain_init |
1388 | }; | 1388 | }; |
1389 | 1389 | ||
1390 | struct drain_rec { | ||
1391 | struct snd_pcm_substream *substream; | ||
1392 | wait_queue_t wait; | ||
1393 | }; | ||
1394 | |||
1395 | static int snd_pcm_drop(struct snd_pcm_substream *substream); | 1390 | static int snd_pcm_drop(struct snd_pcm_substream *substream); |
1396 | 1391 | ||
1397 | /* | 1392 | /* |
@@ -1407,10 +1402,9 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1407 | struct snd_card *card; | 1402 | struct snd_card *card; |
1408 | struct snd_pcm_runtime *runtime; | 1403 | struct snd_pcm_runtime *runtime; |
1409 | struct snd_pcm_substream *s; | 1404 | struct snd_pcm_substream *s; |
1405 | wait_queue_t wait; | ||
1410 | int result = 0; | 1406 | int result = 0; |
1411 | int i, num_drecs; | ||
1412 | int nonblock = 0; | 1407 | int nonblock = 0; |
1413 | struct drain_rec *drec, drec_tmp, *d; | ||
1414 | 1408 | ||
1415 | card = substream->pcm->card; | 1409 | card = substream->pcm->card; |
1416 | runtime = substream->runtime; | 1410 | runtime = substream->runtime; |
@@ -1433,38 +1427,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1433 | } else if (substream->f_flags & O_NONBLOCK) | 1427 | } else if (substream->f_flags & O_NONBLOCK) |
1434 | nonblock = 1; | 1428 | nonblock = 1; |
1435 | 1429 | ||
1436 | if (nonblock) | ||
1437 | goto lock; /* no need to allocate waitqueues */ | ||
1438 | |||
1439 | /* allocate temporary record for drain sync */ | ||
1440 | down_read(&snd_pcm_link_rwsem); | 1430 | down_read(&snd_pcm_link_rwsem); |
1441 | if (snd_pcm_stream_linked(substream)) { | ||
1442 | drec = kmalloc(substream->group->count * sizeof(*drec), GFP_KERNEL); | ||
1443 | if (! drec) { | ||
1444 | up_read(&snd_pcm_link_rwsem); | ||
1445 | snd_power_unlock(card); | ||
1446 | return -ENOMEM; | ||
1447 | } | ||
1448 | } else | ||
1449 | drec = &drec_tmp; | ||
1450 | |||
1451 | /* count only playback streams */ | ||
1452 | num_drecs = 0; | ||
1453 | snd_pcm_group_for_each_entry(s, substream) { | ||
1454 | runtime = s->runtime; | ||
1455 | if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
1456 | d = &drec[num_drecs++]; | ||
1457 | d->substream = s; | ||
1458 | init_waitqueue_entry(&d->wait, current); | ||
1459 | add_wait_queue(&runtime->sleep, &d->wait); | ||
1460 | } | ||
1461 | } | ||
1462 | up_read(&snd_pcm_link_rwsem); | ||
1463 | |||
1464 | lock: | ||
1465 | snd_pcm_stream_lock_irq(substream); | 1431 | snd_pcm_stream_lock_irq(substream); |
1466 | /* resume pause */ | 1432 | /* resume pause */ |
1467 | if (substream->runtime->status->state == SNDRV_PCM_STATE_PAUSED) | 1433 | if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) |
1468 | snd_pcm_pause(substream, 0); | 1434 | snd_pcm_pause(substream, 0); |
1469 | 1435 | ||
1470 | /* pre-start/stop - all running streams are changed to DRAINING state */ | 1436 | /* pre-start/stop - all running streams are changed to DRAINING state */ |
@@ -1479,25 +1445,35 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1479 | 1445 | ||
1480 | for (;;) { | 1446 | for (;;) { |
1481 | long tout; | 1447 | long tout; |
1448 | struct snd_pcm_runtime *to_check; | ||
1482 | if (signal_pending(current)) { | 1449 | if (signal_pending(current)) { |
1483 | result = -ERESTARTSYS; | 1450 | result = -ERESTARTSYS; |
1484 | break; | 1451 | break; |
1485 | } | 1452 | } |
1486 | /* all finished? */ | 1453 | /* find a substream to drain */ |
1487 | for (i = 0; i < num_drecs; i++) { | 1454 | to_check = NULL; |
1488 | runtime = drec[i].substream->runtime; | 1455 | snd_pcm_group_for_each_entry(s, substream) { |
1489 | if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) | 1456 | if (s->stream != SNDRV_PCM_STREAM_PLAYBACK) |
1457 | continue; | ||
1458 | runtime = s->runtime; | ||
1459 | if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { | ||
1460 | to_check = runtime; | ||
1490 | break; | 1461 | break; |
1462 | } | ||
1491 | } | 1463 | } |
1492 | if (i == num_drecs) | 1464 | if (!to_check) |
1493 | break; /* yes, all drained */ | 1465 | break; /* all drained */ |
1494 | 1466 | init_waitqueue_entry(&wait, current); | |
1467 | add_wait_queue(&to_check->sleep, &wait); | ||
1495 | set_current_state(TASK_INTERRUPTIBLE); | 1468 | set_current_state(TASK_INTERRUPTIBLE); |
1496 | snd_pcm_stream_unlock_irq(substream); | 1469 | snd_pcm_stream_unlock_irq(substream); |
1470 | up_read(&snd_pcm_link_rwsem); | ||
1497 | snd_power_unlock(card); | 1471 | snd_power_unlock(card); |
1498 | tout = schedule_timeout(10 * HZ); | 1472 | tout = schedule_timeout(10 * HZ); |
1499 | snd_power_lock(card); | 1473 | snd_power_lock(card); |
1474 | down_read(&snd_pcm_link_rwsem); | ||
1500 | snd_pcm_stream_lock_irq(substream); | 1475 | snd_pcm_stream_lock_irq(substream); |
1476 | remove_wait_queue(&to_check->sleep, &wait); | ||
1501 | if (tout == 0) { | 1477 | if (tout == 0) { |
1502 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) | 1478 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) |
1503 | result = -ESTRPIPE; | 1479 | result = -ESTRPIPE; |
@@ -1512,16 +1488,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1512 | 1488 | ||
1513 | unlock: | 1489 | unlock: |
1514 | snd_pcm_stream_unlock_irq(substream); | 1490 | snd_pcm_stream_unlock_irq(substream); |
1515 | 1491 | up_read(&snd_pcm_link_rwsem); | |
1516 | if (!nonblock) { | ||
1517 | for (i = 0; i < num_drecs; i++) { | ||
1518 | d = &drec[i]; | ||
1519 | runtime = d->substream->runtime; | ||
1520 | remove_wait_queue(&runtime->sleep, &d->wait); | ||
1521 | } | ||
1522 | if (drec != &drec_tmp) | ||
1523 | kfree(drec); | ||
1524 | } | ||
1525 | snd_power_unlock(card); | 1492 | snd_power_unlock(card); |
1526 | 1493 | ||
1527 | return result; | 1494 | return result; |
@@ -3018,7 +2985,7 @@ static int snd_pcm_mmap_status_fault(struct vm_area_struct *area, | |||
3018 | return 0; | 2985 | return 0; |
3019 | } | 2986 | } |
3020 | 2987 | ||
3021 | static struct vm_operations_struct snd_pcm_vm_ops_status = | 2988 | static const struct vm_operations_struct snd_pcm_vm_ops_status = |
3022 | { | 2989 | { |
3023 | .fault = snd_pcm_mmap_status_fault, | 2990 | .fault = snd_pcm_mmap_status_fault, |
3024 | }; | 2991 | }; |
@@ -3057,7 +3024,7 @@ static int snd_pcm_mmap_control_fault(struct vm_area_struct *area, | |||
3057 | return 0; | 3024 | return 0; |
3058 | } | 3025 | } |
3059 | 3026 | ||
3060 | static struct vm_operations_struct snd_pcm_vm_ops_control = | 3027 | static const struct vm_operations_struct snd_pcm_vm_ops_control = |
3061 | { | 3028 | { |
3062 | .fault = snd_pcm_mmap_control_fault, | 3029 | .fault = snd_pcm_mmap_control_fault, |
3063 | }; | 3030 | }; |
@@ -3127,7 +3094,7 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area, | |||
3127 | return 0; | 3094 | return 0; |
3128 | } | 3095 | } |
3129 | 3096 | ||
3130 | static struct vm_operations_struct snd_pcm_vm_ops_data = | 3097 | static const struct vm_operations_struct snd_pcm_vm_ops_data = |
3131 | { | 3098 | { |
3132 | .open = snd_pcm_mmap_data_open, | 3099 | .open = snd_pcm_mmap_data_open, |
3133 | .close = snd_pcm_mmap_data_close, | 3100 | .close = snd_pcm_mmap_data_close, |
@@ -3151,7 +3118,7 @@ static int snd_pcm_default_mmap(struct snd_pcm_substream *substream, | |||
3151 | * mmap the DMA buffer on I/O memory area | 3118 | * mmap the DMA buffer on I/O memory area |
3152 | */ | 3119 | */ |
3153 | #if SNDRV_PCM_INFO_MMAP_IOMEM | 3120 | #if SNDRV_PCM_INFO_MMAP_IOMEM |
3154 | static struct vm_operations_struct snd_pcm_vm_ops_data_mmio = | 3121 | static const struct vm_operations_struct snd_pcm_vm_ops_data_mmio = |
3155 | { | 3122 | { |
3156 | .open = snd_pcm_mmap_data_open, | 3123 | .open = snd_pcm_mmap_data_open, |
3157 | .close = snd_pcm_mmap_data_close, | 3124 | .close = snd_pcm_mmap_data_close, |
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 6ba066c41d2e..146ef00f94a3 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -808,8 +808,6 @@ static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy) | |||
808 | unsigned int idx; | 808 | unsigned int idx; |
809 | int err; | 809 | int err; |
810 | 810 | ||
811 | if (snd_BUG_ON(!dummy)) | ||
812 | return -EINVAL; | ||
813 | spin_lock_init(&dummy->mixer_lock); | 811 | spin_lock_init(&dummy->mixer_lock); |
814 | strcpy(card->mixername, "Dummy Mixer"); | 812 | strcpy(card->mixername, "Dummy Mixer"); |
815 | 813 | ||
diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 6e7d09ae0e82..7d722a025d0d 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c | |||
@@ -29,6 +29,8 @@ extern char snd_opl3_regmap[MAX_OPL2_VOICES][4]; | |||
29 | 29 | ||
30 | extern int use_internal_drums; | 30 | extern int use_internal_drums; |
31 | 31 | ||
32 | static void snd_opl3_note_off_unsafe(void *p, int note, int vel, | ||
33 | struct snd_midi_channel *chan); | ||
32 | /* | 34 | /* |
33 | * The next table looks magical, but it certainly is not. Its values have | 35 | * The next table looks magical, but it certainly is not. Its values have |
34 | * been calculated as table[i]=8*log(i/64)/log(2) with an obvious exception | 36 | * been calculated as table[i]=8*log(i/64)/log(2) with an obvious exception |
@@ -242,16 +244,20 @@ void snd_opl3_timer_func(unsigned long data) | |||
242 | int again = 0; | 244 | int again = 0; |
243 | int i; | 245 | int i; |
244 | 246 | ||
245 | spin_lock_irqsave(&opl3->sys_timer_lock, flags); | 247 | spin_lock_irqsave(&opl3->voice_lock, flags); |
246 | for (i = 0; i < opl3->max_voices; i++) { | 248 | for (i = 0; i < opl3->max_voices; i++) { |
247 | struct snd_opl3_voice *vp = &opl3->voices[i]; | 249 | struct snd_opl3_voice *vp = &opl3->voices[i]; |
248 | if (vp->state > 0 && vp->note_off_check) { | 250 | if (vp->state > 0 && vp->note_off_check) { |
249 | if (vp->note_off == jiffies) | 251 | if (vp->note_off == jiffies) |
250 | snd_opl3_note_off(opl3, vp->note, 0, vp->chan); | 252 | snd_opl3_note_off_unsafe(opl3, vp->note, 0, |
253 | vp->chan); | ||
251 | else | 254 | else |
252 | again++; | 255 | again++; |
253 | } | 256 | } |
254 | } | 257 | } |
258 | spin_unlock_irqrestore(&opl3->voice_lock, flags); | ||
259 | |||
260 | spin_lock_irqsave(&opl3->sys_timer_lock, flags); | ||
255 | if (again) { | 261 | if (again) { |
256 | opl3->tlist.expires = jiffies + 1; /* invoke again */ | 262 | opl3->tlist.expires = jiffies + 1; /* invoke again */ |
257 | add_timer(&opl3->tlist); | 263 | add_timer(&opl3->tlist); |
@@ -658,15 +664,14 @@ static void snd_opl3_kill_voice(struct snd_opl3 *opl3, int voice) | |||
658 | /* | 664 | /* |
659 | * Release a note in response to a midi note off. | 665 | * Release a note in response to a midi note off. |
660 | */ | 666 | */ |
661 | void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan) | 667 | static void snd_opl3_note_off_unsafe(void *p, int note, int vel, |
668 | struct snd_midi_channel *chan) | ||
662 | { | 669 | { |
663 | struct snd_opl3 *opl3; | 670 | struct snd_opl3 *opl3; |
664 | 671 | ||
665 | int voice; | 672 | int voice; |
666 | struct snd_opl3_voice *vp; | 673 | struct snd_opl3_voice *vp; |
667 | 674 | ||
668 | unsigned long flags; | ||
669 | |||
670 | opl3 = p; | 675 | opl3 = p; |
671 | 676 | ||
672 | #ifdef DEBUG_MIDI | 677 | #ifdef DEBUG_MIDI |
@@ -674,12 +679,9 @@ void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan | |||
674 | chan->number, chan->midi_program, note); | 679 | chan->number, chan->midi_program, note); |
675 | #endif | 680 | #endif |
676 | 681 | ||
677 | spin_lock_irqsave(&opl3->voice_lock, flags); | ||
678 | |||
679 | if (opl3->synth_mode == SNDRV_OPL3_MODE_SEQ) { | 682 | if (opl3->synth_mode == SNDRV_OPL3_MODE_SEQ) { |
680 | if (chan->drum_channel && use_internal_drums) { | 683 | if (chan->drum_channel && use_internal_drums) { |
681 | snd_opl3_drum_switch(opl3, note, vel, 0, chan); | 684 | snd_opl3_drum_switch(opl3, note, vel, 0, chan); |
682 | spin_unlock_irqrestore(&opl3->voice_lock, flags); | ||
683 | return; | 685 | return; |
684 | } | 686 | } |
685 | /* this loop will hopefully kill all extra voices, because | 687 | /* this loop will hopefully kill all extra voices, because |
@@ -697,6 +699,16 @@ void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan | |||
697 | snd_opl3_kill_voice(opl3, voice); | 699 | snd_opl3_kill_voice(opl3, voice); |
698 | } | 700 | } |
699 | } | 701 | } |
702 | } | ||
703 | |||
704 | void snd_opl3_note_off(void *p, int note, int vel, | ||
705 | struct snd_midi_channel *chan) | ||
706 | { | ||
707 | struct snd_opl3 *opl3 = p; | ||
708 | unsigned long flags; | ||
709 | |||
710 | spin_lock_irqsave(&opl3->voice_lock, flags); | ||
711 | snd_opl3_note_off_unsafe(p, note, vel, chan); | ||
700 | spin_unlock_irqrestore(&opl3->voice_lock, flags); | 712 | spin_unlock_irqrestore(&opl3->voice_lock, flags); |
701 | } | 713 | } |
702 | 714 | ||
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c index 84cc2658c05b..e1145ac6e908 100644 --- a/sound/drivers/pcsp/pcsp_lib.c +++ b/sound/drivers/pcsp/pcsp_lib.c | |||
@@ -39,25 +39,20 @@ static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed, 0); | |||
39 | /* write the port and returns the next expire time in ns; | 39 | /* write the port and returns the next expire time in ns; |
40 | * called at the trigger-start and in hrtimer callback | 40 | * called at the trigger-start and in hrtimer callback |
41 | */ | 41 | */ |
42 | static unsigned long pcsp_timer_update(struct hrtimer *handle) | 42 | static u64 pcsp_timer_update(struct snd_pcsp *chip) |
43 | { | 43 | { |
44 | unsigned char timer_cnt, val; | 44 | unsigned char timer_cnt, val; |
45 | u64 ns; | 45 | u64 ns; |
46 | struct snd_pcm_substream *substream; | 46 | struct snd_pcm_substream *substream; |
47 | struct snd_pcm_runtime *runtime; | 47 | struct snd_pcm_runtime *runtime; |
48 | struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); | ||
49 | unsigned long flags; | 48 | unsigned long flags; |
50 | 49 | ||
51 | if (chip->thalf) { | 50 | if (chip->thalf) { |
52 | outb(chip->val61, 0x61); | 51 | outb(chip->val61, 0x61); |
53 | chip->thalf = 0; | 52 | chip->thalf = 0; |
54 | if (!atomic_read(&chip->timer_active)) | ||
55 | return 0; | ||
56 | return chip->ns_rem; | 53 | return chip->ns_rem; |
57 | } | 54 | } |
58 | 55 | ||
59 | if (!atomic_read(&chip->timer_active)) | ||
60 | return 0; | ||
61 | substream = chip->playback_substream; | 56 | substream = chip->playback_substream; |
62 | if (!substream) | 57 | if (!substream) |
63 | return 0; | 58 | return 0; |
@@ -88,24 +83,17 @@ static unsigned long pcsp_timer_update(struct hrtimer *handle) | |||
88 | return ns; | 83 | return ns; |
89 | } | 84 | } |
90 | 85 | ||
91 | enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | 86 | static void pcsp_pointer_update(struct snd_pcsp *chip) |
92 | { | 87 | { |
93 | struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); | ||
94 | struct snd_pcm_substream *substream; | 88 | struct snd_pcm_substream *substream; |
95 | int periods_elapsed, pointer_update; | ||
96 | size_t period_bytes, buffer_bytes; | 89 | size_t period_bytes, buffer_bytes; |
97 | unsigned long ns; | 90 | int periods_elapsed; |
98 | unsigned long flags; | 91 | unsigned long flags; |
99 | 92 | ||
100 | pointer_update = !chip->thalf; | ||
101 | ns = pcsp_timer_update(handle); | ||
102 | if (!ns) | ||
103 | return HRTIMER_NORESTART; | ||
104 | |||
105 | /* update the playback position */ | 93 | /* update the playback position */ |
106 | substream = chip->playback_substream; | 94 | substream = chip->playback_substream; |
107 | if (!substream) | 95 | if (!substream) |
108 | return HRTIMER_NORESTART; | 96 | return; |
109 | 97 | ||
110 | period_bytes = snd_pcm_lib_period_bytes(substream); | 98 | period_bytes = snd_pcm_lib_period_bytes(substream); |
111 | buffer_bytes = snd_pcm_lib_buffer_bytes(substream); | 99 | buffer_bytes = snd_pcm_lib_buffer_bytes(substream); |
@@ -134,6 +122,26 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
134 | 122 | ||
135 | if (periods_elapsed) | 123 | if (periods_elapsed) |
136 | tasklet_schedule(&pcsp_pcm_tasklet); | 124 | tasklet_schedule(&pcsp_pcm_tasklet); |
125 | } | ||
126 | |||
127 | enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | ||
128 | { | ||
129 | struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); | ||
130 | int pointer_update; | ||
131 | u64 ns; | ||
132 | |||
133 | if (!atomic_read(&chip->timer_active) || !chip->playback_substream) | ||
134 | return HRTIMER_NORESTART; | ||
135 | |||
136 | pointer_update = !chip->thalf; | ||
137 | ns = pcsp_timer_update(chip); | ||
138 | if (!ns) { | ||
139 | printk(KERN_WARNING "PCSP: unexpected stop\n"); | ||
140 | return HRTIMER_NORESTART; | ||
141 | } | ||
142 | |||
143 | if (pointer_update) | ||
144 | pcsp_pointer_update(chip); | ||
137 | 145 | ||
138 | hrtimer_forward(handle, hrtimer_get_expires(handle), ns_to_ktime(ns)); | 146 | hrtimer_forward(handle, hrtimer_get_expires(handle), ns_to_ktime(ns)); |
139 | 147 | ||
@@ -142,8 +150,6 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
142 | 150 | ||
143 | static int pcsp_start_playing(struct snd_pcsp *chip) | 151 | static int pcsp_start_playing(struct snd_pcsp *chip) |
144 | { | 152 | { |
145 | unsigned long ns; | ||
146 | |||
147 | #if PCSP_DEBUG | 153 | #if PCSP_DEBUG |
148 | printk(KERN_INFO "PCSP: start_playing called\n"); | 154 | printk(KERN_INFO "PCSP: start_playing called\n"); |
149 | #endif | 155 | #endif |
@@ -159,11 +165,7 @@ static int pcsp_start_playing(struct snd_pcsp *chip) | |||
159 | atomic_set(&chip->timer_active, 1); | 165 | atomic_set(&chip->timer_active, 1); |
160 | chip->thalf = 0; | 166 | chip->thalf = 0; |
161 | 167 | ||
162 | ns = pcsp_timer_update(&pcsp_chip.timer); | 168 | hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL); |
163 | if (!ns) | ||
164 | return -EIO; | ||
165 | |||
166 | hrtimer_start(&pcsp_chip.timer, ktime_set(0, ns), HRTIMER_MODE_REL); | ||
167 | return 0; | 169 | return 0; |
168 | } | 170 | } |
169 | 171 | ||
@@ -232,21 +234,22 @@ static int snd_pcsp_playback_hw_free(struct snd_pcm_substream *substream) | |||
232 | static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream) | 234 | static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream) |
233 | { | 235 | { |
234 | struct snd_pcsp *chip = snd_pcm_substream_chip(substream); | 236 | struct snd_pcsp *chip = snd_pcm_substream_chip(substream); |
237 | pcsp_sync_stop(chip); | ||
238 | chip->playback_ptr = 0; | ||
239 | chip->period_ptr = 0; | ||
240 | chip->fmt_size = | ||
241 | snd_pcm_format_physical_width(substream->runtime->format) >> 3; | ||
242 | chip->is_signed = snd_pcm_format_signed(substream->runtime->format); | ||
235 | #if PCSP_DEBUG | 243 | #if PCSP_DEBUG |
236 | printk(KERN_INFO "PCSP: prepare called, " | 244 | printk(KERN_INFO "PCSP: prepare called, " |
237 | "size=%zi psize=%zi f=%zi f1=%i\n", | 245 | "size=%zi psize=%zi f=%zi f1=%i fsize=%i\n", |
238 | snd_pcm_lib_buffer_bytes(substream), | 246 | snd_pcm_lib_buffer_bytes(substream), |
239 | snd_pcm_lib_period_bytes(substream), | 247 | snd_pcm_lib_period_bytes(substream), |
240 | snd_pcm_lib_buffer_bytes(substream) / | 248 | snd_pcm_lib_buffer_bytes(substream) / |
241 | snd_pcm_lib_period_bytes(substream), | 249 | snd_pcm_lib_period_bytes(substream), |
242 | substream->runtime->periods); | 250 | substream->runtime->periods, |
251 | chip->fmt_size); | ||
243 | #endif | 252 | #endif |
244 | pcsp_sync_stop(chip); | ||
245 | chip->playback_ptr = 0; | ||
246 | chip->period_ptr = 0; | ||
247 | chip->fmt_size = | ||
248 | snd_pcm_format_physical_width(substream->runtime->format) >> 3; | ||
249 | chip->is_signed = snd_pcm_format_signed(substream->runtime->format); | ||
250 | return 0; | 253 | return 0; |
251 | } | 254 | } |
252 | 255 | ||
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c index 199b03377142..903bc846763f 100644 --- a/sound/drivers/pcsp/pcsp_mixer.c +++ b/sound/drivers/pcsp/pcsp_mixer.c | |||
@@ -72,7 +72,7 @@ static int pcsp_treble_put(struct snd_kcontrol *kcontrol, | |||
72 | if (treble != chip->treble) { | 72 | if (treble != chip->treble) { |
73 | chip->treble = treble; | 73 | chip->treble = treble; |
74 | #if PCSP_DEBUG | 74 | #if PCSP_DEBUG |
75 | printk(KERN_INFO "PCSP: rate set to %i\n", PCSP_RATE()); | 75 | printk(KERN_INFO "PCSP: rate set to %li\n", PCSP_RATE()); |
76 | #endif | 76 | #endif |
77 | changed = 1; | 77 | changed = 1; |
78 | } | 78 | } |
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c index c52691c2fc46..9a88cdfd952a 100644 --- a/sound/mips/hal2.c +++ b/sound/mips/hal2.c | |||
@@ -915,7 +915,7 @@ static int __devinit hal2_probe(struct platform_device *pdev) | |||
915 | return 0; | 915 | return 0; |
916 | } | 916 | } |
917 | 917 | ||
918 | static int __exit hal2_remove(struct platform_device *pdev) | 918 | static int __devexit hal2_remove(struct platform_device *pdev) |
919 | { | 919 | { |
920 | struct snd_card *card = platform_get_drvdata(pdev); | 920 | struct snd_card *card = platform_get_drvdata(pdev); |
921 | 921 | ||
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index e497525bc11b..8691f4cf6191 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c | |||
@@ -973,7 +973,7 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev) | |||
973 | return 0; | 973 | return 0; |
974 | } | 974 | } |
975 | 975 | ||
976 | static int __exit snd_sgio2audio_remove(struct platform_device *pdev) | 976 | static int __devexit snd_sgio2audio_remove(struct platform_device *pdev) |
977 | { | 977 | { |
978 | struct snd_card *card = platform_get_drvdata(pdev); | 978 | struct snd_card *card = platform_get_drvdata(pdev); |
979 | 979 | ||
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 1edab7b4ea83..3136c88eacdf 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -110,9 +110,6 @@ static void start_adc(struct cs4297a_state *s); | |||
110 | // rather than 64k as some of the games work more responsively. | 110 | // rather than 64k as some of the games work more responsively. |
111 | // log base 2( buff sz = 32k). | 111 | // log base 2( buff sz = 32k). |
112 | 112 | ||
113 | //static unsigned long defaultorder = 3; | ||
114 | //MODULE_PARM(defaultorder, "i"); | ||
115 | |||
116 | // | 113 | // |
117 | // Turn on/off debugging compilation by commenting out "#define CSDEBUG" | 114 | // Turn on/off debugging compilation by commenting out "#define CSDEBUG" |
118 | // | 115 | // |
diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c index 107534477a2f..8db6aefe15e4 100644 --- a/sound/oss/sys_timer.c +++ b/sound/oss/sys_timer.c | |||
@@ -100,9 +100,6 @@ def_tmr_open(int dev, int mode) | |||
100 | curr_tempo = 60; | 100 | curr_tempo = 60; |
101 | curr_timebase = 100; | 101 | curr_timebase = 100; |
102 | opened = 1; | 102 | opened = 1; |
103 | |||
104 | ; | ||
105 | |||
106 | { | 103 | { |
107 | def_tmr.expires = (1) + jiffies; | 104 | def_tmr.expires = (1) + jiffies; |
108 | add_timer(&def_tmr); | 105 | add_timer(&def_tmr); |
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index e924492df21d..f47f9e226b08 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c | |||
@@ -624,6 +624,9 @@ snd_harmony_pcm_init(struct snd_harmony *h) | |||
624 | struct snd_pcm *pcm; | 624 | struct snd_pcm *pcm; |
625 | int err; | 625 | int err; |
626 | 626 | ||
627 | if (snd_BUG_ON(!h)) | ||
628 | return -EINVAL; | ||
629 | |||
627 | harmony_disable_interrupts(h); | 630 | harmony_disable_interrupts(h); |
628 | 631 | ||
629 | err = snd_pcm_new(h->card, "harmony", 0, 1, 1, &pcm); | 632 | err = snd_pcm_new(h->card, "harmony", 0, 1, 1, &pcm); |
@@ -865,11 +868,12 @@ snd_harmony_mixer_reset(struct snd_harmony *h) | |||
865 | static int __devinit | 868 | static int __devinit |
866 | snd_harmony_mixer_init(struct snd_harmony *h) | 869 | snd_harmony_mixer_init(struct snd_harmony *h) |
867 | { | 870 | { |
868 | struct snd_card *card = h->card; | 871 | struct snd_card *card; |
869 | int idx, err; | 872 | int idx, err; |
870 | 873 | ||
871 | if (snd_BUG_ON(!h)) | 874 | if (snd_BUG_ON(!h)) |
872 | return -EINVAL; | 875 | return -EINVAL; |
876 | card = h->card; | ||
873 | strcpy(card->mixername, "Harmony Gain control interface"); | 877 | strcpy(card->mixername, "Harmony Gain control interface"); |
874 | 878 | ||
875 | for (idx = 0; idx < HARMONY_CONTROLS; idx++) { | 879 | for (idx = 0; idx < HARMONY_CONTROLS; idx++) { |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index b458d208720b..aaf4da68969c 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -973,7 +973,7 @@ static void snd_ali_free_voice(struct snd_ali * codec, | |||
973 | void *private_data; | 973 | void *private_data; |
974 | 974 | ||
975 | snd_ali_printk("free_voice: channel=%d\n",pvoice->number); | 975 | snd_ali_printk("free_voice: channel=%d\n",pvoice->number); |
976 | if (pvoice == NULL || !pvoice->use) | 976 | if (!pvoice->use) |
977 | return; | 977 | return; |
978 | snd_ali_clear_voices(codec, pvoice->number, pvoice->number); | 978 | snd_ali_clear_voices(codec, pvoice->number, pvoice->number); |
979 | spin_lock_irq(&codec->voice_alloc); | 979 | spin_lock_irq(&codec->voice_alloc); |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 24585c6c6d01..4e2b925a94cc 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -808,6 +808,8 @@ static struct pci_device_id snd_bt87x_ids[] = { | |||
808 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, GENERIC), | 808 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, GENERIC), |
809 | /* Leadtek Winfast tv 2000xp delux */ | 809 | /* Leadtek Winfast tv 2000xp delux */ |
810 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x107d, 0x6606, GENERIC), | 810 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x107d, 0x6606, GENERIC), |
811 | /* Pinnacle PCTV */ | ||
812 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x11bd, 0x0012, GENERIC), | ||
811 | /* Voodoo TV 200 */ | 813 | /* Voodoo TV 200 */ |
812 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x121a, 0x3000, GENERIC), | 814 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x121a, 0x3000, GENERIC), |
813 | /* Askey Computer Corp. MagicTView'99 */ | 815 | /* Askey Computer Corp. MagicTView'99 */ |
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 6bfce99b42a2..cb65bd0dd35b 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -1037,7 +1037,7 @@ static int atc_line_front_unmute(struct ct_atc *atc, unsigned char state) | |||
1037 | 1037 | ||
1038 | static int atc_line_surround_unmute(struct ct_atc *atc, unsigned char state) | 1038 | static int atc_line_surround_unmute(struct ct_atc *atc, unsigned char state) |
1039 | { | 1039 | { |
1040 | return atc_daio_unmute(atc, state, LINEO4); | 1040 | return atc_daio_unmute(atc, state, LINEO2); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) | 1043 | static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) |
@@ -1047,7 +1047,7 @@ static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) | |||
1047 | 1047 | ||
1048 | static int atc_line_rear_unmute(struct ct_atc *atc, unsigned char state) | 1048 | static int atc_line_rear_unmute(struct ct_atc *atc, unsigned char state) |
1049 | { | 1049 | { |
1050 | return atc_daio_unmute(atc, state, LINEO2); | 1050 | return atc_daio_unmute(atc, state, LINEO4); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state) | 1053 | static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state) |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index da2065cd2c0d..1305f7ca02c3 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -950,7 +950,7 @@ static int __devinit snd_echo_new_pcm(struct echoaudio *chip) | |||
950 | Control interface | 950 | Control interface |
951 | ******************************************************************************/ | 951 | ******************************************************************************/ |
952 | 952 | ||
953 | #ifndef ECHOCARD_HAS_VMIXER | 953 | #if !defined(ECHOCARD_HAS_VMIXER) || defined(ECHOCARD_HAS_LINE_OUT_GAIN) |
954 | 954 | ||
955 | /******************* PCM output volume *******************/ | 955 | /******************* PCM output volume *******************/ |
956 | static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, | 956 | static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, |
@@ -1003,6 +1003,19 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol, | |||
1003 | return changed; | 1003 | return changed; |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | #ifdef ECHOCARD_HAS_LINE_OUT_GAIN | ||
1007 | /* On the Mia this one controls the line-out volume */ | ||
1008 | static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = { | ||
1009 | .name = "Line Playback Volume", | ||
1010 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1011 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | ||
1012 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | ||
1013 | .info = snd_echo_output_gain_info, | ||
1014 | .get = snd_echo_output_gain_get, | ||
1015 | .put = snd_echo_output_gain_put, | ||
1016 | .tlv = {.p = db_scale_output_gain}, | ||
1017 | }; | ||
1018 | #else | ||
1006 | static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { | 1019 | static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { |
1007 | .name = "PCM Playback Volume", | 1020 | .name = "PCM Playback Volume", |
1008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1021 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -1012,9 +1025,10 @@ static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { | |||
1012 | .put = snd_echo_output_gain_put, | 1025 | .put = snd_echo_output_gain_put, |
1013 | .tlv = {.p = db_scale_output_gain}, | 1026 | .tlv = {.p = db_scale_output_gain}, |
1014 | }; | 1027 | }; |
1015 | |||
1016 | #endif | 1028 | #endif |
1017 | 1029 | ||
1030 | #endif /* !ECHOCARD_HAS_VMIXER || ECHOCARD_HAS_LINE_OUT_GAIN */ | ||
1031 | |||
1018 | 1032 | ||
1019 | 1033 | ||
1020 | #ifdef ECHOCARD_HAS_INPUT_GAIN | 1034 | #ifdef ECHOCARD_HAS_INPUT_GAIN |
@@ -2030,10 +2044,18 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
2030 | snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); | 2044 | snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); |
2031 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) | 2045 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) |
2032 | goto ctl_error; | 2046 | goto ctl_error; |
2033 | #else | 2047 | #ifdef ECHOCARD_HAS_LINE_OUT_GAIN |
2034 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_pcm_output_gain, chip))) < 0) | 2048 | err = snd_ctl_add(chip->card, |
2049 | snd_ctl_new1(&snd_echo_line_output_gain, chip)); | ||
2050 | if (err < 0) | ||
2035 | goto ctl_error; | 2051 | goto ctl_error; |
2036 | #endif | 2052 | #endif |
2053 | #else /* ECHOCARD_HAS_VMIXER */ | ||
2054 | err = snd_ctl_add(chip->card, | ||
2055 | snd_ctl_new1(&snd_echo_pcm_output_gain, chip)); | ||
2056 | if (err < 0) | ||
2057 | goto ctl_error; | ||
2058 | #endif /* ECHOCARD_HAS_VMIXER */ | ||
2037 | 2059 | ||
2038 | #ifdef ECHOCARD_HAS_INPUT_GAIN | 2060 | #ifdef ECHOCARD_HAS_INPUT_GAIN |
2039 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip))) < 0) | 2061 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip))) < 0) |
diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c index f3b9b45c9c1b..f05c8c097aa8 100644 --- a/sound/pci/echoaudio/mia.c +++ b/sound/pci/echoaudio/mia.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #define ECHOCARD_HAS_ADAT FALSE | 29 | #define ECHOCARD_HAS_ADAT FALSE |
30 | #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 | 30 | #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 |
31 | #define ECHOCARD_HAS_MIDI | 31 | #define ECHOCARD_HAS_MIDI |
32 | #define ECHOCARD_HAS_LINE_OUT_GAIN | ||
32 | 33 | ||
33 | /* Pipe indexes */ | 34 | /* Pipe indexes */ |
34 | #define PX_ANALOG_OUT 0 /* 8 */ | 35 | #define PX_ANALOG_OUT 0 /* 8 */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 20a66f85f0a4..c9ad182e1b4b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2303,6 +2303,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) | |||
2303 | * white-list for enable_msi | 2303 | * white-list for enable_msi |
2304 | */ | 2304 | */ |
2305 | static struct snd_pci_quirk msi_white_list[] __devinitdata = { | 2305 | static struct snd_pci_quirk msi_white_list[] __devinitdata = { |
2306 | SND_PCI_QUIRK(0x103c, 0x30f7, "HP Pavilion dv4t-1300", 1), | ||
2306 | SND_PCI_QUIRK(0x103c, 0x3607, "HP Compa CQ40", 1), | 2307 | SND_PCI_QUIRK(0x103c, 0x3607, "HP Compa CQ40", 1), |
2307 | {} | 2308 | {} |
2308 | }; | 2309 | }; |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 215e72a87113..2d603f6aba63 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -4032,6 +4032,127 @@ static int ad1984a_thinkpad_init(struct hda_codec *codec) | |||
4032 | } | 4032 | } |
4033 | 4033 | ||
4034 | /* | 4034 | /* |
4035 | * HP Touchsmart | ||
4036 | * port-A (0x11) - front hp-out | ||
4037 | * port-B (0x14) - unused | ||
4038 | * port-C (0x15) - unused | ||
4039 | * port-D (0x12) - rear line out | ||
4040 | * port-E (0x1c) - front mic-in | ||
4041 | * port-F (0x16) - Internal speakers | ||
4042 | * digital-mic (0x17) - Internal mic | ||
4043 | */ | ||
4044 | |||
4045 | static struct hda_verb ad1984a_touchsmart_verbs[] = { | ||
4046 | /* DACs; unmute as default */ | ||
4047 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ | ||
4048 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ | ||
4049 | /* Port-A (HP) mixer - route only from analog mixer */ | ||
4050 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
4051 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
4052 | /* Port-A pin */ | ||
4053 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
4054 | /* Port-A (HP) pin - always unmuted */ | ||
4055 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
4056 | /* Port-E (int speaker) mixer - route only from analog mixer */ | ||
4057 | {0x25, AC_VERB_SET_AMP_GAIN_MUTE, 0x03}, | ||
4058 | /* Port-E pin */ | ||
4059 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
4060 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
4061 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
4062 | /* Port-F (int speaker) mixer - route only from analog mixer */ | ||
4063 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
4064 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
4065 | /* Port-F pin */ | ||
4066 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
4067 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
4068 | /* Analog mixer; mute as default */ | ||
4069 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
4070 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
4071 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
4072 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
4073 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
4074 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
4075 | /* Analog Mix output amp */ | ||
4076 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
4077 | /* capture sources */ | ||
4078 | /* {0x0c, AC_VERB_SET_CONNECT_SEL, 0x0}, */ /* set via unsol */ | ||
4079 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
4080 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
4081 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
4082 | /* unsolicited event for pin-sense */ | ||
4083 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, | ||
4084 | {0x1c, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, | ||
4085 | /* allow to touch GPIO1 (for mute control) */ | ||
4086 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | ||
4087 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | ||
4088 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, /* first muted */ | ||
4089 | /* internal mic - dmic */ | ||
4090 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
4091 | /* set magic COEFs for dmic */ | ||
4092 | {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7}, | ||
4093 | {0x01, AC_VERB_SET_PROC_COEF, 0x08}, | ||
4094 | { } /* end */ | ||
4095 | }; | ||
4096 | |||
4097 | static struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = { | ||
4098 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | ||
4099 | /* HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/ | ||
4100 | { | ||
4101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
4102 | .name = "Master Playback Switch", | ||
4103 | .info = snd_hda_mixer_amp_switch_info, | ||
4104 | .get = snd_hda_mixer_amp_switch_get, | ||
4105 | .put = ad1884a_mobile_master_sw_put, | ||
4106 | .private_value = HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
4107 | }, | ||
4108 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | ||
4109 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | ||
4110 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
4111 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | ||
4112 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), | ||
4113 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), | ||
4114 | { } /* end */ | ||
4115 | }; | ||
4116 | |||
4117 | /* switch to external mic if plugged */ | ||
4118 | static void ad1984a_touchsmart_automic(struct hda_codec *codec) | ||
4119 | { | ||
4120 | if (snd_hda_codec_read(codec, 0x1c, 0, | ||
4121 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000) { | ||
4122 | snd_hda_codec_write(codec, 0x0c, 0, | ||
4123 | AC_VERB_SET_CONNECT_SEL, 0x4); | ||
4124 | } else { | ||
4125 | snd_hda_codec_write(codec, 0x0c, 0, | ||
4126 | AC_VERB_SET_CONNECT_SEL, 0x5); | ||
4127 | } | ||
4128 | } | ||
4129 | |||
4130 | |||
4131 | /* unsolicited event for HP jack sensing */ | ||
4132 | static void ad1984a_touchsmart_unsol_event(struct hda_codec *codec, | ||
4133 | unsigned int res) | ||
4134 | { | ||
4135 | switch (res >> 26) { | ||
4136 | case AD1884A_HP_EVENT: | ||
4137 | ad1884a_hp_automute(codec); | ||
4138 | break; | ||
4139 | case AD1884A_MIC_EVENT: | ||
4140 | ad1984a_touchsmart_automic(codec); | ||
4141 | break; | ||
4142 | } | ||
4143 | } | ||
4144 | |||
4145 | /* initialize jack-sensing, too */ | ||
4146 | static int ad1984a_touchsmart_init(struct hda_codec *codec) | ||
4147 | { | ||
4148 | ad198x_init(codec); | ||
4149 | ad1884a_hp_automute(codec); | ||
4150 | ad1984a_touchsmart_automic(codec); | ||
4151 | return 0; | ||
4152 | } | ||
4153 | |||
4154 | |||
4155 | /* | ||
4035 | */ | 4156 | */ |
4036 | 4157 | ||
4037 | enum { | 4158 | enum { |
@@ -4039,6 +4160,7 @@ enum { | |||
4039 | AD1884A_LAPTOP, | 4160 | AD1884A_LAPTOP, |
4040 | AD1884A_MOBILE, | 4161 | AD1884A_MOBILE, |
4041 | AD1884A_THINKPAD, | 4162 | AD1884A_THINKPAD, |
4163 | AD1984A_TOUCHSMART, | ||
4042 | AD1884A_MODELS | 4164 | AD1884A_MODELS |
4043 | }; | 4165 | }; |
4044 | 4166 | ||
@@ -4047,6 +4169,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = { | |||
4047 | [AD1884A_LAPTOP] = "laptop", | 4169 | [AD1884A_LAPTOP] = "laptop", |
4048 | [AD1884A_MOBILE] = "mobile", | 4170 | [AD1884A_MOBILE] = "mobile", |
4049 | [AD1884A_THINKPAD] = "thinkpad", | 4171 | [AD1884A_THINKPAD] = "thinkpad", |
4172 | [AD1984A_TOUCHSMART] = "touchsmart", | ||
4050 | }; | 4173 | }; |
4051 | 4174 | ||
4052 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | 4175 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { |
@@ -4059,6 +4182,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | |||
4059 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), | 4182 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), |
4060 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x7010, "HP laptop", AD1884A_MOBILE), | 4183 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x7010, "HP laptop", AD1884A_MOBILE), |
4061 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | 4184 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), |
4185 | SND_PCI_QUIRK(0x103c, 0x2a82, "Touchsmart", AD1984A_TOUCHSMART), | ||
4062 | {} | 4186 | {} |
4063 | }; | 4187 | }; |
4064 | 4188 | ||
@@ -4142,6 +4266,21 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
4142 | codec->patch_ops.unsol_event = ad1984a_thinkpad_unsol_event; | 4266 | codec->patch_ops.unsol_event = ad1984a_thinkpad_unsol_event; |
4143 | codec->patch_ops.init = ad1984a_thinkpad_init; | 4267 | codec->patch_ops.init = ad1984a_thinkpad_init; |
4144 | break; | 4268 | break; |
4269 | case AD1984A_TOUCHSMART: | ||
4270 | spec->mixers[0] = ad1984a_touchsmart_mixers; | ||
4271 | spec->init_verbs[0] = ad1984a_touchsmart_verbs; | ||
4272 | spec->multiout.dig_out_nid = 0; | ||
4273 | codec->patch_ops.unsol_event = ad1984a_touchsmart_unsol_event; | ||
4274 | codec->patch_ops.init = ad1984a_touchsmart_init; | ||
4275 | /* set the upper-limit for mixer amp to 0dB for avoiding the | ||
4276 | * possible damage by overloading | ||
4277 | */ | ||
4278 | snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, | ||
4279 | (0x17 << AC_AMPCAP_OFFSET_SHIFT) | | ||
4280 | (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
4281 | (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
4282 | (1 << AC_AMPCAP_MUTE_SHIFT)); | ||
4283 | break; | ||
4145 | } | 4284 | } |
4146 | 4285 | ||
4147 | return 0; | 4286 | return 0; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 9d899eda44d7..3fbbc8c01e70 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -682,11 +682,13 @@ static struct hda_input_mux cxt5045_capture_source = { | |||
682 | }; | 682 | }; |
683 | 683 | ||
684 | static struct hda_input_mux cxt5045_capture_source_benq = { | 684 | static struct hda_input_mux cxt5045_capture_source_benq = { |
685 | .num_items = 3, | 685 | .num_items = 5, |
686 | .items = { | 686 | .items = { |
687 | { "IntMic", 0x1 }, | 687 | { "IntMic", 0x1 }, |
688 | { "ExtMic", 0x2 }, | 688 | { "ExtMic", 0x2 }, |
689 | { "LineIn", 0x3 }, | 689 | { "LineIn", 0x3 }, |
690 | { "CD", 0x4 }, | ||
691 | { "Mixer", 0x0 }, | ||
690 | } | 692 | } |
691 | }; | 693 | }; |
692 | 694 | ||
@@ -811,11 +813,19 @@ static struct snd_kcontrol_new cxt5045_mixers[] = { | |||
811 | }; | 813 | }; |
812 | 814 | ||
813 | static struct snd_kcontrol_new cxt5045_benq_mixers[] = { | 815 | static struct snd_kcontrol_new cxt5045_benq_mixers[] = { |
816 | HDA_CODEC_VOLUME("CD Capture Volume", 0x1a, 0x04, HDA_INPUT), | ||
817 | HDA_CODEC_MUTE("CD Capture Switch", 0x1a, 0x04, HDA_INPUT), | ||
818 | HDA_CODEC_VOLUME("CD Playback Volume", 0x17, 0x4, HDA_INPUT), | ||
819 | HDA_CODEC_MUTE("CD Playback Switch", 0x17, 0x4, HDA_INPUT), | ||
820 | |||
814 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1a, 0x03, HDA_INPUT), | 821 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1a, 0x03, HDA_INPUT), |
815 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1a, 0x03, HDA_INPUT), | 822 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1a, 0x03, HDA_INPUT), |
816 | HDA_CODEC_VOLUME("Line In Playback Volume", 0x17, 0x3, HDA_INPUT), | 823 | HDA_CODEC_VOLUME("Line In Playback Volume", 0x17, 0x3, HDA_INPUT), |
817 | HDA_CODEC_MUTE("Line In Playback Switch", 0x17, 0x3, HDA_INPUT), | 824 | HDA_CODEC_MUTE("Line In Playback Switch", 0x17, 0x3, HDA_INPUT), |
818 | 825 | ||
826 | HDA_CODEC_VOLUME("Mixer Capture Volume", 0x1a, 0x0, HDA_INPUT), | ||
827 | HDA_CODEC_MUTE("Mixer Capture Switch", 0x1a, 0x0, HDA_INPUT), | ||
828 | |||
819 | {} | 829 | {} |
820 | }; | 830 | }; |
821 | 831 | ||
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index c8435c9a97f9..9fb60276f5c9 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -29,6 +29,9 @@ | |||
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | 31 | ||
32 | /* define below to restrict the supported rates and formats */ | ||
33 | /* #define LIMITED_RATE_FMT_SUPPORT */ | ||
34 | |||
32 | struct nvhdmi_spec { | 35 | struct nvhdmi_spec { |
33 | struct hda_multi_out multiout; | 36 | struct hda_multi_out multiout; |
34 | 37 | ||
@@ -60,6 +63,22 @@ static struct hda_verb nvhdmi_basic_init[] = { | |||
60 | {} /* terminator */ | 63 | {} /* terminator */ |
61 | }; | 64 | }; |
62 | 65 | ||
66 | #ifdef LIMITED_RATE_FMT_SUPPORT | ||
67 | /* support only the safe format and rate */ | ||
68 | #define SUPPORTED_RATES SNDRV_PCM_RATE_48000 | ||
69 | #define SUPPORTED_MAXBPS 16 | ||
70 | #define SUPPORTED_FORMATS SNDRV_PCM_FMTBIT_S16_LE | ||
71 | #else | ||
72 | /* support all rates and formats */ | ||
73 | #define SUPPORTED_RATES \ | ||
74 | (SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ | ||
75 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\ | ||
76 | SNDRV_PCM_RATE_192000) | ||
77 | #define SUPPORTED_MAXBPS 24 | ||
78 | #define SUPPORTED_FORMATS \ | ||
79 | (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) | ||
80 | #endif | ||
81 | |||
63 | /* | 82 | /* |
64 | * Controls | 83 | * Controls |
65 | */ | 84 | */ |
@@ -258,9 +277,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch = { | |||
258 | .channels_min = 2, | 277 | .channels_min = 2, |
259 | .channels_max = 8, | 278 | .channels_max = 8, |
260 | .nid = Nv_Master_Convert_nid, | 279 | .nid = Nv_Master_Convert_nid, |
261 | .rates = SNDRV_PCM_RATE_48000, | 280 | .rates = SUPPORTED_RATES, |
262 | .maxbps = 16, | 281 | .maxbps = SUPPORTED_MAXBPS, |
263 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 282 | .formats = SUPPORTED_FORMATS, |
264 | .ops = { | 283 | .ops = { |
265 | .open = nvhdmi_dig_playback_pcm_open, | 284 | .open = nvhdmi_dig_playback_pcm_open, |
266 | .close = nvhdmi_dig_playback_pcm_close_8ch, | 285 | .close = nvhdmi_dig_playback_pcm_close_8ch, |
@@ -273,9 +292,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
273 | .channels_min = 2, | 292 | .channels_min = 2, |
274 | .channels_max = 2, | 293 | .channels_max = 2, |
275 | .nid = Nv_Master_Convert_nid, | 294 | .nid = Nv_Master_Convert_nid, |
276 | .rates = SNDRV_PCM_RATE_48000, | 295 | .rates = SUPPORTED_RATES, |
277 | .maxbps = 16, | 296 | .maxbps = SUPPORTED_MAXBPS, |
278 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 297 | .formats = SUPPORTED_FORMATS, |
279 | .ops = { | 298 | .ops = { |
280 | .open = nvhdmi_dig_playback_pcm_open, | 299 | .open = nvhdmi_dig_playback_pcm_open, |
281 | .close = nvhdmi_dig_playback_pcm_close_2ch, | 300 | .close = nvhdmi_dig_playback_pcm_close_2ch, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 129605819560..c08ca660daba 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -275,7 +275,7 @@ struct alc_spec { | |||
275 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | 275 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
276 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | 276 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
277 | 277 | ||
278 | const struct hda_verb *init_verbs[5]; /* initialization verbs | 278 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
279 | * don't forget NULL | 279 | * don't forget NULL |
280 | * termination! | 280 | * termination! |
281 | */ | 281 | */ |
@@ -1332,15 +1332,20 @@ do_sku: | |||
1332 | * when the external headphone out jack is plugged" | 1332 | * when the external headphone out jack is plugged" |
1333 | */ | 1333 | */ |
1334 | if (!spec->autocfg.hp_pins[0]) { | 1334 | if (!spec->autocfg.hp_pins[0]) { |
1335 | hda_nid_t nid; | ||
1335 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | 1336 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
1336 | if (tmp == 0) | 1337 | if (tmp == 0) |
1337 | spec->autocfg.hp_pins[0] = porta; | 1338 | nid = porta; |
1338 | else if (tmp == 1) | 1339 | else if (tmp == 1) |
1339 | spec->autocfg.hp_pins[0] = porte; | 1340 | nid = porte; |
1340 | else if (tmp == 2) | 1341 | else if (tmp == 2) |
1341 | spec->autocfg.hp_pins[0] = portd; | 1342 | nid = portd; |
1342 | else | 1343 | else |
1343 | return 1; | 1344 | return 1; |
1345 | for (i = 0; i < spec->autocfg.line_outs; i++) | ||
1346 | if (spec->autocfg.line_out_pins[i] == nid) | ||
1347 | return 1; | ||
1348 | spec->autocfg.hp_pins[0] = nid; | ||
1344 | } | 1349 | } |
1345 | 1350 | ||
1346 | alc_init_auto_hp(codec); | 1351 | alc_init_auto_hp(codec); |
@@ -1362,7 +1367,7 @@ static void alc_ssid_check(struct hda_codec *codec, | |||
1362 | } | 1367 | } |
1363 | 1368 | ||
1364 | /* | 1369 | /* |
1365 | * Fix-up pin default configurations | 1370 | * Fix-up pin default configurations and add default verbs |
1366 | */ | 1371 | */ |
1367 | 1372 | ||
1368 | struct alc_pincfg { | 1373 | struct alc_pincfg { |
@@ -1370,9 +1375,14 @@ struct alc_pincfg { | |||
1370 | u32 val; | 1375 | u32 val; |
1371 | }; | 1376 | }; |
1372 | 1377 | ||
1373 | static void alc_fix_pincfg(struct hda_codec *codec, | 1378 | struct alc_fixup { |
1379 | const struct alc_pincfg *pins; | ||
1380 | const struct hda_verb *verbs; | ||
1381 | }; | ||
1382 | |||
1383 | static void alc_pick_fixup(struct hda_codec *codec, | ||
1374 | const struct snd_pci_quirk *quirk, | 1384 | const struct snd_pci_quirk *quirk, |
1375 | const struct alc_pincfg **pinfix) | 1385 | const struct alc_fixup *fix) |
1376 | { | 1386 | { |
1377 | const struct alc_pincfg *cfg; | 1387 | const struct alc_pincfg *cfg; |
1378 | 1388 | ||
@@ -1380,9 +1390,14 @@ static void alc_fix_pincfg(struct hda_codec *codec, | |||
1380 | if (!quirk) | 1390 | if (!quirk) |
1381 | return; | 1391 | return; |
1382 | 1392 | ||
1383 | cfg = pinfix[quirk->value]; | 1393 | fix += quirk->value; |
1384 | for (; cfg->nid; cfg++) | 1394 | cfg = fix->pins; |
1385 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | 1395 | if (cfg) { |
1396 | for (; cfg->nid; cfg++) | ||
1397 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | ||
1398 | } | ||
1399 | if (fix->verbs) | ||
1400 | add_verb(codec->spec, fix->verbs); | ||
1386 | } | 1401 | } |
1387 | 1402 | ||
1388 | /* | 1403 | /* |
@@ -9593,11 +9608,13 @@ static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | |||
9593 | { } | 9608 | { } |
9594 | }; | 9609 | }; |
9595 | 9610 | ||
9596 | static const struct alc_pincfg *alc882_pin_fixes[] = { | 9611 | static const struct alc_fixup alc882_fixups[] = { |
9597 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | 9612 | [PINFIX_ABIT_AW9D_MAX] = { |
9613 | .pins = alc882_abit_aw9d_pinfix | ||
9614 | }, | ||
9598 | }; | 9615 | }; |
9599 | 9616 | ||
9600 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | 9617 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
9601 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | 9618 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
9602 | {} | 9619 | {} |
9603 | }; | 9620 | }; |
@@ -9869,7 +9886,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
9869 | board_config = ALC882_AUTO; | 9886 | board_config = ALC882_AUTO; |
9870 | } | 9887 | } |
9871 | 9888 | ||
9872 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); | 9889 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
9873 | 9890 | ||
9874 | if (board_config == ALC882_AUTO) { | 9891 | if (board_config == ALC882_AUTO) { |
9875 | /* automatic parse from the BIOS config */ | 9892 | /* automatic parse from the BIOS config */ |
@@ -12660,7 +12677,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
12660 | .init_hook = alc268_toshiba_automute, | 12677 | .init_hook = alc268_toshiba_automute, |
12661 | }, | 12678 | }, |
12662 | [ALC268_ACER] = { | 12679 | [ALC268_ACER] = { |
12663 | .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, | 12680 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
12664 | alc268_beep_mixer }, | 12681 | alc268_beep_mixer }, |
12665 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12682 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12666 | alc268_acer_verbs }, | 12683 | alc268_acer_verbs }, |
@@ -12842,12 +12859,15 @@ static int patch_alc268(struct hda_codec *codec) | |||
12842 | unsigned int wcap = get_wcaps(codec, 0x07); | 12859 | unsigned int wcap = get_wcaps(codec, 0x07); |
12843 | int i; | 12860 | int i; |
12844 | 12861 | ||
12862 | spec->capsrc_nids = alc268_capsrc_nids; | ||
12845 | /* get type */ | 12863 | /* get type */ |
12846 | wcap = get_wcaps_type(wcap); | 12864 | wcap = get_wcaps_type(wcap); |
12847 | if (spec->auto_mic || | 12865 | if (spec->auto_mic || |
12848 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | 12866 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
12849 | spec->adc_nids = alc268_adc_nids_alt; | 12867 | spec->adc_nids = alc268_adc_nids_alt; |
12850 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | 12868 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
12869 | if (spec->auto_mic) | ||
12870 | fixup_automic_adc(codec); | ||
12851 | if (spec->auto_mic || spec->input_mux->num_items == 1) | 12871 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
12852 | add_mixer(spec, alc268_capture_nosrc_mixer); | 12872 | add_mixer(spec, alc268_capture_nosrc_mixer); |
12853 | else | 12873 | else |
@@ -12857,7 +12877,6 @@ static int patch_alc268(struct hda_codec *codec) | |||
12857 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | 12877 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
12858 | add_mixer(spec, alc268_capture_mixer); | 12878 | add_mixer(spec, alc268_capture_mixer); |
12859 | } | 12879 | } |
12860 | spec->capsrc_nids = alc268_capsrc_nids; | ||
12861 | /* set default input source */ | 12880 | /* set default input source */ |
12862 | for (i = 0; i < spec->num_adc_nids; i++) | 12881 | for (i = 0; i < spec->num_adc_nids; i++) |
12863 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | 12882 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
@@ -14357,15 +14376,16 @@ static void alc861_auto_init_multi_out(struct hda_codec *codec) | |||
14357 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | 14376 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
14358 | { | 14377 | { |
14359 | struct alc_spec *spec = codec->spec; | 14378 | struct alc_spec *spec = codec->spec; |
14360 | hda_nid_t pin; | ||
14361 | 14379 | ||
14362 | pin = spec->autocfg.hp_pins[0]; | 14380 | if (spec->autocfg.hp_outs) |
14363 | if (pin) | 14381 | alc861_auto_set_output_and_unmute(codec, |
14364 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, | 14382 | spec->autocfg.hp_pins[0], |
14383 | PIN_HP, | ||
14365 | spec->multiout.hp_nid); | 14384 | spec->multiout.hp_nid); |
14366 | pin = spec->autocfg.speaker_pins[0]; | 14385 | if (spec->autocfg.speaker_outs) |
14367 | if (pin) | 14386 | alc861_auto_set_output_and_unmute(codec, |
14368 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, | 14387 | spec->autocfg.speaker_pins[0], |
14388 | PIN_OUT, | ||
14369 | spec->multiout.dac_nids[0]); | 14389 | spec->multiout.dac_nids[0]); |
14370 | } | 14390 | } |
14371 | 14391 | ||
@@ -15158,7 +15178,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |||
15158 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | 15178 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
15159 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | 15179 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
15160 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | 15180 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
15161 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), | 15181 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
15162 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), | 15182 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
15163 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), | 15183 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
15164 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | 15184 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
@@ -15551,6 +15571,29 @@ static void alc861vd_auto_init(struct hda_codec *codec) | |||
15551 | alc_inithook(codec); | 15571 | alc_inithook(codec); |
15552 | } | 15572 | } |
15553 | 15573 | ||
15574 | enum { | ||
15575 | ALC660VD_FIX_ASUS_GPIO1 | ||
15576 | }; | ||
15577 | |||
15578 | /* reset GPIO1 */ | ||
15579 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { | ||
15580 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | ||
15581 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
15582 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | ||
15583 | { } | ||
15584 | }; | ||
15585 | |||
15586 | static const struct alc_fixup alc861vd_fixups[] = { | ||
15587 | [ALC660VD_FIX_ASUS_GPIO1] = { | ||
15588 | .verbs = alc660vd_fix_asus_gpio1_verbs, | ||
15589 | }, | ||
15590 | }; | ||
15591 | |||
15592 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | ||
15593 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | ||
15594 | {} | ||
15595 | }; | ||
15596 | |||
15554 | static int patch_alc861vd(struct hda_codec *codec) | 15597 | static int patch_alc861vd(struct hda_codec *codec) |
15555 | { | 15598 | { |
15556 | struct alc_spec *spec; | 15599 | struct alc_spec *spec; |
@@ -15572,6 +15615,8 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15572 | board_config = ALC861VD_AUTO; | 15615 | board_config = ALC861VD_AUTO; |
15573 | } | 15616 | } |
15574 | 15617 | ||
15618 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); | ||
15619 | |||
15575 | if (board_config == ALC861VD_AUTO) { | 15620 | if (board_config == ALC861VD_AUTO) { |
15576 | /* automatic parse from the BIOS config */ | 15621 | /* automatic parse from the BIOS config */ |
15577 | err = alc861vd_parse_auto_config(codec); | 15622 | err = alc861vd_parse_auto_config(codec); |
@@ -16852,6 +16897,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
16852 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | 16897 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
16853 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | 16898 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
16854 | ALC662_3ST_6ch_DIG), | 16899 | ALC662_3ST_6ch_DIG), |
16900 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), | ||
16855 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | 16901 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
16856 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | 16902 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
16857 | ALC662_3ST_6ch_DIG), | 16903 | ALC662_3ST_6ch_DIG), |
@@ -17145,70 +17191,145 @@ static struct alc_config_preset alc662_presets[] = { | |||
17145 | * BIOS auto configuration | 17191 | * BIOS auto configuration |
17146 | */ | 17192 | */ |
17147 | 17193 | ||
17194 | /* convert from MIX nid to DAC */ | ||
17195 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | ||
17196 | { | ||
17197 | if (nid == 0x0f) | ||
17198 | return 0x02; | ||
17199 | else if (nid >= 0x0c && nid <= 0x0e) | ||
17200 | return nid - 0x0c + 0x02; | ||
17201 | else | ||
17202 | return 0; | ||
17203 | } | ||
17204 | |||
17205 | /* get MIX nid connected to the given pin targeted to DAC */ | ||
17206 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | ||
17207 | hda_nid_t dac) | ||
17208 | { | ||
17209 | hda_nid_t mix[4]; | ||
17210 | int i, num; | ||
17211 | |||
17212 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | ||
17213 | for (i = 0; i < num; i++) { | ||
17214 | if (alc662_mix_to_dac(mix[i]) == dac) | ||
17215 | return mix[i]; | ||
17216 | } | ||
17217 | return 0; | ||
17218 | } | ||
17219 | |||
17220 | /* look for an empty DAC slot */ | ||
17221 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | ||
17222 | { | ||
17223 | struct alc_spec *spec = codec->spec; | ||
17224 | hda_nid_t srcs[5]; | ||
17225 | int i, j, num; | ||
17226 | |||
17227 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | ||
17228 | if (num < 0) | ||
17229 | return 0; | ||
17230 | for (i = 0; i < num; i++) { | ||
17231 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | ||
17232 | if (!nid) | ||
17233 | continue; | ||
17234 | for (j = 0; j < spec->multiout.num_dacs; j++) | ||
17235 | if (spec->multiout.dac_nids[j] == nid) | ||
17236 | break; | ||
17237 | if (j >= spec->multiout.num_dacs) | ||
17238 | return nid; | ||
17239 | } | ||
17240 | return 0; | ||
17241 | } | ||
17242 | |||
17243 | /* fill in the dac_nids table from the parsed pin configuration */ | ||
17244 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | ||
17245 | const struct auto_pin_cfg *cfg) | ||
17246 | { | ||
17247 | struct alc_spec *spec = codec->spec; | ||
17248 | int i; | ||
17249 | hda_nid_t dac; | ||
17250 | |||
17251 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
17252 | for (i = 0; i < cfg->line_outs; i++) { | ||
17253 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | ||
17254 | if (!dac) | ||
17255 | continue; | ||
17256 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | ||
17257 | } | ||
17258 | return 0; | ||
17259 | } | ||
17260 | |||
17261 | static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, | ||
17262 | hda_nid_t nid, unsigned int chs) | ||
17263 | { | ||
17264 | char name[32]; | ||
17265 | sprintf(name, "%s Playback Volume", pfx); | ||
17266 | return add_control(spec, ALC_CTL_WIDGET_VOL, name, | ||
17267 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | ||
17268 | } | ||
17269 | |||
17270 | static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, | ||
17271 | hda_nid_t nid, unsigned int chs) | ||
17272 | { | ||
17273 | char name[32]; | ||
17274 | sprintf(name, "%s Playback Switch", pfx); | ||
17275 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
17276 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); | ||
17277 | } | ||
17278 | |||
17279 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | ||
17280 | alc662_add_vol_ctl(spec, pfx, nid, 3) | ||
17281 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | ||
17282 | alc662_add_sw_ctl(spec, pfx, nid, 3) | ||
17283 | |||
17148 | /* add playback controls from the parsed DAC table */ | 17284 | /* add playback controls from the parsed DAC table */ |
17149 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | 17285 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
17150 | const struct auto_pin_cfg *cfg) | 17286 | const struct auto_pin_cfg *cfg) |
17151 | { | 17287 | { |
17152 | char name[32]; | 17288 | struct alc_spec *spec = codec->spec; |
17153 | static const char *chname[4] = { | 17289 | static const char *chname[4] = { |
17154 | "Front", "Surround", NULL /*CLFE*/, "Side" | 17290 | "Front", "Surround", NULL /*CLFE*/, "Side" |
17155 | }; | 17291 | }; |
17156 | hda_nid_t nid; | 17292 | hda_nid_t nid, mix; |
17157 | int i, err; | 17293 | int i, err; |
17158 | 17294 | ||
17159 | for (i = 0; i < cfg->line_outs; i++) { | 17295 | for (i = 0; i < cfg->line_outs; i++) { |
17160 | if (!spec->multiout.dac_nids[i]) | 17296 | nid = spec->multiout.dac_nids[i]; |
17297 | if (!nid) | ||
17298 | continue; | ||
17299 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | ||
17300 | if (!mix) | ||
17161 | continue; | 17301 | continue; |
17162 | nid = alc880_idx_to_dac(i); | ||
17163 | if (i == 2) { | 17302 | if (i == 2) { |
17164 | /* Center/LFE */ | 17303 | /* Center/LFE */ |
17165 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | 17304 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
17166 | "Center Playback Volume", | ||
17167 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | ||
17168 | HDA_OUTPUT)); | ||
17169 | if (err < 0) | 17305 | if (err < 0) |
17170 | return err; | 17306 | return err; |
17171 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | 17307 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
17172 | "LFE Playback Volume", | ||
17173 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
17174 | HDA_OUTPUT)); | ||
17175 | if (err < 0) | 17308 | if (err < 0) |
17176 | return err; | 17309 | return err; |
17177 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 17310 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
17178 | "Center Playback Switch", | ||
17179 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, | ||
17180 | HDA_INPUT)); | ||
17181 | if (err < 0) | 17311 | if (err < 0) |
17182 | return err; | 17312 | return err; |
17183 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 17313 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
17184 | "LFE Playback Switch", | ||
17185 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | ||
17186 | HDA_INPUT)); | ||
17187 | if (err < 0) | 17314 | if (err < 0) |
17188 | return err; | 17315 | return err; |
17189 | } else { | 17316 | } else { |
17190 | const char *pfx; | 17317 | const char *pfx; |
17191 | if (cfg->line_outs == 1 && | 17318 | if (cfg->line_outs == 1 && |
17192 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | 17319 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
17193 | if (!cfg->hp_pins) | 17320 | if (cfg->hp_outs) |
17194 | pfx = "Speaker"; | 17321 | pfx = "Speaker"; |
17195 | else | 17322 | else |
17196 | pfx = "PCM"; | 17323 | pfx = "PCM"; |
17197 | } else | 17324 | } else |
17198 | pfx = chname[i]; | 17325 | pfx = chname[i]; |
17199 | sprintf(name, "%s Playback Volume", pfx); | 17326 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
17200 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | ||
17201 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
17202 | HDA_OUTPUT)); | ||
17203 | if (err < 0) | 17327 | if (err < 0) |
17204 | return err; | 17328 | return err; |
17205 | if (cfg->line_outs == 1 && | 17329 | if (cfg->line_outs == 1 && |
17206 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | 17330 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
17207 | pfx = "Speaker"; | 17331 | pfx = "Speaker"; |
17208 | sprintf(name, "%s Playback Switch", pfx); | 17332 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
17209 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
17210 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), | ||
17211 | 3, 0, HDA_INPUT)); | ||
17212 | if (err < 0) | 17333 | if (err < 0) |
17213 | return err; | 17334 | return err; |
17214 | } | 17335 | } |
@@ -17217,54 +17338,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
17217 | } | 17338 | } |
17218 | 17339 | ||
17219 | /* add playback controls for speaker and HP outputs */ | 17340 | /* add playback controls for speaker and HP outputs */ |
17220 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | 17341 | /* return DAC nid if any new DAC is assigned */ |
17342 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | ||
17221 | const char *pfx) | 17343 | const char *pfx) |
17222 | { | 17344 | { |
17223 | hda_nid_t nid; | 17345 | struct alc_spec *spec = codec->spec; |
17346 | hda_nid_t nid, mix; | ||
17224 | int err; | 17347 | int err; |
17225 | char name[32]; | ||
17226 | 17348 | ||
17227 | if (!pin) | 17349 | if (!pin) |
17228 | return 0; | 17350 | return 0; |
17229 | 17351 | nid = alc662_look_for_dac(codec, pin); | |
17230 | if (pin == 0x17) { | 17352 | if (!nid) { |
17231 | /* ALC663 has a mono output pin on 0x17 */ | 17353 | char name[32]; |
17354 | /* the corresponding DAC is already occupied */ | ||
17355 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | ||
17356 | return 0; /* no way */ | ||
17357 | /* create a switch only */ | ||
17232 | sprintf(name, "%s Playback Switch", pfx); | 17358 | sprintf(name, "%s Playback Switch", pfx); |
17233 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | 17359 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
17234 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); | 17360 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
17235 | return err; | ||
17236 | } | 17361 | } |
17237 | 17362 | ||
17238 | if (alc880_is_fixed_pin(pin)) { | 17363 | mix = alc662_dac_to_mix(codec, pin, nid); |
17239 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | 17364 | if (!mix) |
17240 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ | 17365 | return 0; |
17241 | /* specify the DAC as the extra output */ | 17366 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
17242 | if (!spec->multiout.hp_nid) | 17367 | if (err < 0) |
17243 | spec->multiout.hp_nid = nid; | 17368 | return err; |
17244 | else | 17369 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
17245 | spec->multiout.extra_out_nid[0] = nid; | 17370 | if (err < 0) |
17246 | /* control HP volume/switch on the output mixer amp */ | 17371 | return err; |
17247 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | 17372 | return nid; |
17248 | sprintf(name, "%s Playback Volume", pfx); | ||
17249 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | ||
17250 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
17251 | if (err < 0) | ||
17252 | return err; | ||
17253 | sprintf(name, "%s Playback Switch", pfx); | ||
17254 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | ||
17255 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | ||
17256 | if (err < 0) | ||
17257 | return err; | ||
17258 | } else if (alc880_is_multi_pin(pin)) { | ||
17259 | /* set manual connection */ | ||
17260 | /* we have only a switch on HP-out PIN */ | ||
17261 | sprintf(name, "%s Playback Switch", pfx); | ||
17262 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
17263 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | ||
17264 | if (err < 0) | ||
17265 | return err; | ||
17266 | } | ||
17267 | return 0; | ||
17268 | } | 17373 | } |
17269 | 17374 | ||
17270 | /* create playback/capture controls for input pins */ | 17375 | /* create playback/capture controls for input pins */ |
@@ -17273,30 +17378,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |||
17273 | 17378 | ||
17274 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | 17379 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
17275 | hda_nid_t nid, int pin_type, | 17380 | hda_nid_t nid, int pin_type, |
17276 | int dac_idx) | 17381 | hda_nid_t dac) |
17277 | { | 17382 | { |
17383 | int i, num; | ||
17384 | hda_nid_t srcs[4]; | ||
17385 | |||
17278 | alc_set_pin_output(codec, nid, pin_type); | 17386 | alc_set_pin_output(codec, nid, pin_type); |
17279 | /* need the manual connection? */ | 17387 | /* need the manual connection? */ |
17280 | if (alc880_is_multi_pin(nid)) { | 17388 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
17281 | struct alc_spec *spec = codec->spec; | 17389 | if (num <= 1) |
17282 | int idx = alc880_multi_pin_idx(nid); | 17390 | return; |
17283 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | 17391 | for (i = 0; i < num; i++) { |
17284 | AC_VERB_SET_CONNECT_SEL, | 17392 | if (alc662_mix_to_dac(srcs[i]) != dac) |
17285 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | 17393 | continue; |
17394 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | ||
17395 | return; | ||
17286 | } | 17396 | } |
17287 | } | 17397 | } |
17288 | 17398 | ||
17289 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | 17399 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
17290 | { | 17400 | { |
17291 | struct alc_spec *spec = codec->spec; | 17401 | struct alc_spec *spec = codec->spec; |
17402 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
17292 | int i; | 17403 | int i; |
17293 | 17404 | ||
17294 | for (i = 0; i <= HDA_SIDE; i++) { | 17405 | for (i = 0; i <= HDA_SIDE; i++) { |
17295 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | 17406 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
17296 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
17297 | if (nid) | 17407 | if (nid) |
17298 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, | 17408 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
17299 | i); | 17409 | spec->multiout.dac_nids[i]); |
17300 | } | 17410 | } |
17301 | } | 17411 | } |
17302 | 17412 | ||
@@ -17306,12 +17416,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec) | |||
17306 | hda_nid_t pin; | 17416 | hda_nid_t pin; |
17307 | 17417 | ||
17308 | pin = spec->autocfg.hp_pins[0]; | 17418 | pin = spec->autocfg.hp_pins[0]; |
17309 | if (pin) /* connect to front */ | 17419 | if (pin) |
17310 | /* use dac 0 */ | 17420 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
17311 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | 17421 | spec->multiout.hp_nid); |
17312 | pin = spec->autocfg.speaker_pins[0]; | 17422 | pin = spec->autocfg.speaker_pins[0]; |
17313 | if (pin) | 17423 | if (pin) |
17314 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 17424 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
17425 | spec->multiout.extra_out_nid[0]); | ||
17315 | } | 17426 | } |
17316 | 17427 | ||
17317 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | 17428 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
@@ -17349,21 +17460,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
17349 | if (!spec->autocfg.line_outs) | 17460 | if (!spec->autocfg.line_outs) |
17350 | return 0; /* can't find valid BIOS pin config */ | 17461 | return 0; /* can't find valid BIOS pin config */ |
17351 | 17462 | ||
17352 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | 17463 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
17353 | if (err < 0) | 17464 | if (err < 0) |
17354 | return err; | 17465 | return err; |
17355 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); | 17466 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
17356 | if (err < 0) | 17467 | if (err < 0) |
17357 | return err; | 17468 | return err; |
17358 | err = alc662_auto_create_extra_out(spec, | 17469 | err = alc662_auto_create_extra_out(codec, |
17359 | spec->autocfg.speaker_pins[0], | 17470 | spec->autocfg.speaker_pins[0], |
17360 | "Speaker"); | 17471 | "Speaker"); |
17361 | if (err < 0) | 17472 | if (err < 0) |
17362 | return err; | 17473 | return err; |
17363 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | 17474 | if (err) |
17475 | spec->multiout.extra_out_nid[0] = err; | ||
17476 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | ||
17364 | "Headphone"); | 17477 | "Headphone"); |
17365 | if (err < 0) | 17478 | if (err < 0) |
17366 | return err; | 17479 | return err; |
17480 | if (err) | ||
17481 | spec->multiout.hp_nid = err; | ||
17367 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); | 17482 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
17368 | if (err < 0) | 17483 | if (err < 0) |
17369 | return err; | 17484 | return err; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 826137ec3002..66c0876bf734 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -158,6 +158,7 @@ enum { | |||
158 | STAC_D965_5ST_NO_FP, | 158 | STAC_D965_5ST_NO_FP, |
159 | STAC_DELL_3ST, | 159 | STAC_DELL_3ST, |
160 | STAC_DELL_BIOS, | 160 | STAC_DELL_BIOS, |
161 | STAC_927X_VOLKNOB, | ||
161 | STAC_927X_MODELS | 162 | STAC_927X_MODELS |
162 | }; | 163 | }; |
163 | 164 | ||
@@ -182,8 +183,8 @@ struct sigmatel_jack { | |||
182 | 183 | ||
183 | struct sigmatel_mic_route { | 184 | struct sigmatel_mic_route { |
184 | hda_nid_t pin; | 185 | hda_nid_t pin; |
185 | unsigned char mux_idx; | 186 | signed char mux_idx; |
186 | unsigned char dmux_idx; | 187 | signed char dmux_idx; |
187 | }; | 188 | }; |
188 | 189 | ||
189 | struct sigmatel_spec { | 190 | struct sigmatel_spec { |
@@ -907,6 +908,16 @@ static struct hda_verb d965_core_init[] = { | |||
907 | {} | 908 | {} |
908 | }; | 909 | }; |
909 | 910 | ||
911 | static struct hda_verb dell_3st_core_init[] = { | ||
912 | /* don't set delta bit */ | ||
913 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, | ||
914 | /* unmute node 0x1b */ | ||
915 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
916 | /* select node 0x03 as DAC */ | ||
917 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
918 | {} | ||
919 | }; | ||
920 | |||
910 | static struct hda_verb stac927x_core_init[] = { | 921 | static struct hda_verb stac927x_core_init[] = { |
911 | /* set master volume and direct control */ | 922 | /* set master volume and direct control */ |
912 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 923 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
@@ -915,6 +926,14 @@ static struct hda_verb stac927x_core_init[] = { | |||
915 | {} | 926 | {} |
916 | }; | 927 | }; |
917 | 928 | ||
929 | static struct hda_verb stac927x_volknob_core_init[] = { | ||
930 | /* don't set delta bit */ | ||
931 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, | ||
932 | /* enable analog pc beep path */ | ||
933 | {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, | ||
934 | {} | ||
935 | }; | ||
936 | |||
918 | static struct hda_verb stac9205_core_init[] = { | 937 | static struct hda_verb stac9205_core_init[] = { |
919 | /* set master volume and direct control */ | 938 | /* set master volume and direct control */ |
920 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 939 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
@@ -1999,6 +2018,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { | |||
1999 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, | 2018 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, |
2000 | [STAC_DELL_3ST] = dell_3st_pin_configs, | 2019 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
2001 | [STAC_DELL_BIOS] = NULL, | 2020 | [STAC_DELL_BIOS] = NULL, |
2021 | [STAC_927X_VOLKNOB] = NULL, | ||
2002 | }; | 2022 | }; |
2003 | 2023 | ||
2004 | static const char *stac927x_models[STAC_927X_MODELS] = { | 2024 | static const char *stac927x_models[STAC_927X_MODELS] = { |
@@ -2010,6 +2030,7 @@ static const char *stac927x_models[STAC_927X_MODELS] = { | |||
2010 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", | 2030 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", |
2011 | [STAC_DELL_3ST] = "dell-3stack", | 2031 | [STAC_DELL_3ST] = "dell-3stack", |
2012 | [STAC_DELL_BIOS] = "dell-bios", | 2032 | [STAC_DELL_BIOS] = "dell-bios", |
2033 | [STAC_927X_VOLKNOB] = "volknob", | ||
2013 | }; | 2034 | }; |
2014 | 2035 | ||
2015 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { | 2036 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
@@ -2045,6 +2066,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { | |||
2045 | "Intel D965", STAC_D965_5ST), | 2066 | "Intel D965", STAC_D965_5ST), |
2046 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, | 2067 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, |
2047 | "Intel D965", STAC_D965_5ST), | 2068 | "Intel D965", STAC_D965_5ST), |
2069 | /* volume-knob fixes */ | ||
2070 | SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB), | ||
2048 | {} /* terminator */ | 2071 | {} /* terminator */ |
2049 | }; | 2072 | }; |
2050 | 2073 | ||
@@ -3469,18 +3492,26 @@ static int set_mic_route(struct hda_codec *codec, | |||
3469 | break; | 3492 | break; |
3470 | if (i <= AUTO_PIN_FRONT_MIC) { | 3493 | if (i <= AUTO_PIN_FRONT_MIC) { |
3471 | /* analog pin */ | 3494 | /* analog pin */ |
3472 | mic->dmux_idx = 0; | ||
3473 | i = get_connection_index(codec, spec->mux_nids[0], pin); | 3495 | i = get_connection_index(codec, spec->mux_nids[0], pin); |
3474 | if (i < 0) | 3496 | if (i < 0) |
3475 | return -1; | 3497 | return -1; |
3476 | mic->mux_idx = i; | 3498 | mic->mux_idx = i; |
3499 | mic->dmux_idx = -1; | ||
3500 | if (spec->dmux_nids) | ||
3501 | mic->dmux_idx = get_connection_index(codec, | ||
3502 | spec->dmux_nids[0], | ||
3503 | spec->mux_nids[0]); | ||
3477 | } else if (spec->dmux_nids) { | 3504 | } else if (spec->dmux_nids) { |
3478 | /* digital pin */ | 3505 | /* digital pin */ |
3479 | mic->mux_idx = 0; | ||
3480 | i = get_connection_index(codec, spec->dmux_nids[0], pin); | 3506 | i = get_connection_index(codec, spec->dmux_nids[0], pin); |
3481 | if (i < 0) | 3507 | if (i < 0) |
3482 | return -1; | 3508 | return -1; |
3483 | mic->dmux_idx = i; | 3509 | mic->dmux_idx = i; |
3510 | mic->mux_idx = -1; | ||
3511 | if (spec->mux_nids) | ||
3512 | mic->mux_idx = get_connection_index(codec, | ||
3513 | spec->mux_nids[0], | ||
3514 | spec->dmux_nids[0]); | ||
3484 | } | 3515 | } |
3485 | return 0; | 3516 | return 0; |
3486 | } | 3517 | } |
@@ -4557,11 +4588,11 @@ static void stac92xx_mic_detect(struct hda_codec *codec) | |||
4557 | mic = &spec->ext_mic; | 4588 | mic = &spec->ext_mic; |
4558 | else | 4589 | else |
4559 | mic = &spec->int_mic; | 4590 | mic = &spec->int_mic; |
4560 | if (mic->dmux_idx) | 4591 | if (mic->dmux_idx >= 0) |
4561 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, | 4592 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, |
4562 | AC_VERB_SET_CONNECT_SEL, | 4593 | AC_VERB_SET_CONNECT_SEL, |
4563 | mic->dmux_idx); | 4594 | mic->dmux_idx); |
4564 | else | 4595 | if (mic->mux_idx >= 0) |
4565 | snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, | 4596 | snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, |
4566 | AC_VERB_SET_CONNECT_SEL, | 4597 | AC_VERB_SET_CONNECT_SEL, |
4567 | mic->mux_idx); | 4598 | mic->mux_idx); |
@@ -5604,10 +5635,14 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5604 | spec->dmic_nids = stac927x_dmic_nids; | 5635 | spec->dmic_nids = stac927x_dmic_nids; |
5605 | spec->num_dmics = STAC927X_NUM_DMICS; | 5636 | spec->num_dmics = STAC927X_NUM_DMICS; |
5606 | 5637 | ||
5607 | spec->init = d965_core_init; | 5638 | spec->init = dell_3st_core_init; |
5608 | spec->dmux_nids = stac927x_dmux_nids; | 5639 | spec->dmux_nids = stac927x_dmux_nids; |
5609 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); | 5640 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
5610 | break; | 5641 | break; |
5642 | case STAC_927X_VOLKNOB: | ||
5643 | spec->num_dmics = 0; | ||
5644 | spec->init = stac927x_volknob_core_init; | ||
5645 | break; | ||
5611 | default: | 5646 | default: |
5612 | spec->num_dmics = 0; | 5647 | spec->num_dmics = 0; |
5613 | spec->init = stac927x_core_init; | 5648 | spec->init = stac927x_core_init; |
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c index 37564300b50d..6da21a2bcade 100644 --- a/sound/pci/ice1712/amp.c +++ b/sound/pci/ice1712/amp.c | |||
@@ -52,11 +52,13 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice) | |||
52 | 52 | ||
53 | /* only use basic functionality for now */ | 53 | /* only use basic functionality for now */ |
54 | 54 | ||
55 | ice->num_total_dacs = 2; /* only PSDOUT0 is connected */ | 55 | /* VT1616 6ch codec connected to PSDOUT0 using packed mode */ |
56 | ice->num_total_dacs = 6; | ||
56 | ice->num_total_adcs = 2; | 57 | ice->num_total_adcs = 2; |
57 | 58 | ||
58 | /* Chaintech AV-710 has another codecs, which need initialization */ | 59 | /* Chaintech AV-710 has another WM8728 codec connected to PSDOUT4 |
59 | /* initialize WM8728 codec */ | 60 | (shared with the SPDIF output). Mixer control for this codec |
61 | is not yet supported. */ | ||
60 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) { | 62 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) { |
61 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) | 63 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) |
62 | wm_put(ice, wm_inits[i], wm_inits[i+1]); | 64 | wm_put(ice, wm_inits[i], wm_inits[i+1]); |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index cecf1ffeeaaa..d74033a2cfbe 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -2259,7 +2259,7 @@ static int snd_ice1712_pro_peak_get(struct snd_kcontrol *kcontrol, | |||
2259 | } | 2259 | } |
2260 | 2260 | ||
2261 | static struct snd_kcontrol_new snd_ice1712_mixer_pro_peak __devinitdata = { | 2261 | static struct snd_kcontrol_new snd_ice1712_mixer_pro_peak __devinitdata = { |
2262 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2262 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
2263 | .name = "Multi Track Peak", | 2263 | .name = "Multi Track Peak", |
2264 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, | 2264 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, |
2265 | .info = snd_ice1712_pro_peak_info, | 2265 | .info = snd_ice1712_pro_peak_info, |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index af6e00148621..10fc92c05574 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -648,7 +648,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, | |||
648 | (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) { | 648 | (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) { |
649 | /* running? we cannot change the rate now... */ | 649 | /* running? we cannot change the rate now... */ |
650 | spin_unlock_irqrestore(&ice->reg_lock, flags); | 650 | spin_unlock_irqrestore(&ice->reg_lock, flags); |
651 | return -EBUSY; | 651 | return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY; |
652 | } | 652 | } |
653 | if (!force && is_pro_rate_locked(ice)) { | 653 | if (!force && is_pro_rate_locked(ice)) { |
654 | spin_unlock_irqrestore(&ice->reg_lock, flags); | 654 | spin_unlock_irqrestore(&ice->reg_lock, flags); |
@@ -1294,7 +1294,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) | |||
1294 | 1294 | ||
1295 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1295 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1296 | snd_dma_pci_data(ice->pci), | 1296 | snd_dma_pci_data(ice->pci), |
1297 | 64*1024, 64*1024); | 1297 | 256*1024, 256*1024); |
1298 | 1298 | ||
1299 | ice->pcm = pcm; | 1299 | ice->pcm = pcm; |
1300 | 1300 | ||
@@ -1408,7 +1408,7 @@ static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) | |||
1408 | 1408 | ||
1409 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1409 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1410 | snd_dma_pci_data(ice->pci), | 1410 | snd_dma_pci_data(ice->pci), |
1411 | 64*1024, 64*1024); | 1411 | 256*1024, 256*1024); |
1412 | 1412 | ||
1413 | ice->pcm_ds = pcm; | 1413 | ice->pcm_ds = pcm; |
1414 | 1414 | ||
@@ -2110,7 +2110,7 @@ static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol, | |||
2110 | } | 2110 | } |
2111 | 2111 | ||
2112 | static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = { | 2112 | static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = { |
2113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2113 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
2114 | .name = "Multi Track Peak", | 2114 | .name = "Multi Track Peak", |
2115 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, | 2115 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, |
2116 | .info = snd_vt1724_pro_peak_info, | 2116 | .info = snd_vt1724_pro_peak_info, |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 171ada535209..754867ed4785 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -1954,6 +1954,18 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1954 | .name = "Sony S1XP", | 1954 | .name = "Sony S1XP", |
1955 | .type = AC97_TUNE_INV_EAPD | 1955 | .type = AC97_TUNE_INV_EAPD |
1956 | }, | 1956 | }, |
1957 | { | ||
1958 | .subvendor = 0x104d, | ||
1959 | .subdevice = 0x81c0, | ||
1960 | .name = "Sony VAIO VGN-T350P", /*AD1981B*/ | ||
1961 | .type = AC97_TUNE_INV_EAPD | ||
1962 | }, | ||
1963 | { | ||
1964 | .subvendor = 0x104d, | ||
1965 | .subdevice = 0x81c5, | ||
1966 | .name = "Sony VAIO VGN-B1VP", /*AD1981B*/ | ||
1967 | .type = AC97_TUNE_INV_EAPD | ||
1968 | }, | ||
1957 | { | 1969 | { |
1958 | .subvendor = 0x1043, | 1970 | .subvendor = 0x1043, |
1959 | .subdevice = 0x80f3, | 1971 | .subdevice = 0x80f3, |
diff --git a/sound/pci/lx6464es/lx6464es.h b/sound/pci/lx6464es/lx6464es.h index 012c010c8c89..51afc048961d 100644 --- a/sound/pci/lx6464es/lx6464es.h +++ b/sound/pci/lx6464es/lx6464es.h | |||
@@ -86,7 +86,6 @@ struct lx6464es { | |||
86 | 86 | ||
87 | /* messaging */ | 87 | /* messaging */ |
88 | spinlock_t msg_lock; /* message spinlock */ | 88 | spinlock_t msg_lock; /* message spinlock */ |
89 | atomic_t send_message_locked; | ||
90 | struct lx_rmh rmh; | 89 | struct lx_rmh rmh; |
91 | 90 | ||
92 | /* configuration */ | 91 | /* configuration */ |
@@ -95,7 +94,6 @@ struct lx6464es { | |||
95 | uint hardware_running[2]; | 94 | uint hardware_running[2]; |
96 | u32 board_sample_rate; /* sample rate read from | 95 | u32 board_sample_rate; /* sample rate read from |
97 | * board */ | 96 | * board */ |
98 | u32 sample_rate; /* our sample rate */ | ||
99 | u16 pcm_granularity; /* board blocksize */ | 97 | u16 pcm_granularity; /* board blocksize */ |
100 | 98 | ||
101 | /* dma */ | 99 | /* dma */ |
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c index 5812780d6e89..3086b751da4a 100644 --- a/sound/pci/lx6464es/lx_core.c +++ b/sound/pci/lx6464es/lx_core.c | |||
@@ -314,98 +314,6 @@ static inline void lx_message_dump(struct lx_rmh *rmh) | |||
314 | #define XILINX_POLL_NO_SLEEP 100 | 314 | #define XILINX_POLL_NO_SLEEP 100 |
315 | #define XILINX_POLL_ITERATIONS 150 | 315 | #define XILINX_POLL_ITERATIONS 150 |
316 | 316 | ||
317 | #if 0 /* not used now */ | ||
318 | static int lx_message_send(struct lx6464es *chip, struct lx_rmh *rmh) | ||
319 | { | ||
320 | u32 reg = ED_DSP_TIMED_OUT; | ||
321 | int dwloop; | ||
322 | int answer_received; | ||
323 | |||
324 | if (lx_dsp_reg_read(chip, eReg_CSM) & (Reg_CSM_MC | Reg_CSM_MR)) { | ||
325 | snd_printk(KERN_ERR LXP "PIOSendMessage eReg_CSM %x\n", reg); | ||
326 | return -EBUSY; | ||
327 | } | ||
328 | |||
329 | /* write command */ | ||
330 | lx_dsp_reg_writebuf(chip, eReg_CRM1, rmh->cmd, rmh->cmd_len); | ||
331 | |||
332 | snd_BUG_ON(atomic_read(&chip->send_message_locked) != 0); | ||
333 | atomic_set(&chip->send_message_locked, 1); | ||
334 | |||
335 | /* MicoBlaze gogogo */ | ||
336 | lx_dsp_reg_write(chip, eReg_CSM, Reg_CSM_MC); | ||
337 | |||
338 | /* wait for interrupt to answer */ | ||
339 | for (dwloop = 0; dwloop != XILINX_TIMEOUT_MS; ++dwloop) { | ||
340 | answer_received = atomic_read(&chip->send_message_locked); | ||
341 | if (answer_received == 0) | ||
342 | break; | ||
343 | msleep(1); | ||
344 | } | ||
345 | |||
346 | if (answer_received == 0) { | ||
347 | /* in Debug mode verify Reg_CSM_MR */ | ||
348 | snd_BUG_ON(!(lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR)); | ||
349 | |||
350 | /* command finished, read status */ | ||
351 | if (rmh->dsp_stat == 0) | ||
352 | reg = lx_dsp_reg_read(chip, eReg_CRM1); | ||
353 | else | ||
354 | reg = 0; | ||
355 | } else { | ||
356 | int i; | ||
357 | snd_printk(KERN_WARNING LXP "TIMEOUT lx_message_send! " | ||
358 | "Interrupts disabled?\n"); | ||
359 | |||
360 | /* attente bit Reg_CSM_MR */ | ||
361 | for (i = 0; i != XILINX_POLL_ITERATIONS; i++) { | ||
362 | if ((lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR)) { | ||
363 | if (rmh->dsp_stat == 0) | ||
364 | reg = lx_dsp_reg_read(chip, eReg_CRM1); | ||
365 | else | ||
366 | reg = 0; | ||
367 | goto polling_successful; | ||
368 | } | ||
369 | |||
370 | if (i > XILINX_POLL_NO_SLEEP) | ||
371 | msleep(1); | ||
372 | } | ||
373 | snd_printk(KERN_WARNING LXP "TIMEOUT lx_message_send! " | ||
374 | "polling failed\n"); | ||
375 | |||
376 | polling_successful: | ||
377 | atomic_set(&chip->send_message_locked, 0); | ||
378 | } | ||
379 | |||
380 | if ((reg & ERROR_VALUE) == 0) { | ||
381 | /* read response */ | ||
382 | if (rmh->stat_len) { | ||
383 | snd_BUG_ON(rmh->stat_len >= (REG_CRM_NUMBER-1)); | ||
384 | |||
385 | lx_dsp_reg_readbuf(chip, eReg_CRM2, rmh->stat, | ||
386 | rmh->stat_len); | ||
387 | } | ||
388 | } else | ||
389 | snd_printk(KERN_WARNING LXP "lx_message_send: error_value %x\n", | ||
390 | reg); | ||
391 | |||
392 | /* clear Reg_CSM_MR */ | ||
393 | lx_dsp_reg_write(chip, eReg_CSM, 0); | ||
394 | |||
395 | switch (reg) { | ||
396 | case ED_DSP_TIMED_OUT: | ||
397 | snd_printk(KERN_WARNING LXP "lx_message_send: dsp timeout\n"); | ||
398 | return -ETIMEDOUT; | ||
399 | |||
400 | case ED_DSP_CRASHED: | ||
401 | snd_printk(KERN_WARNING LXP "lx_message_send: dsp crashed\n"); | ||
402 | return -EAGAIN; | ||
403 | } | ||
404 | |||
405 | lx_message_dump(rmh); | ||
406 | return 0; | ||
407 | } | ||
408 | #endif /* not used now */ | ||
409 | 317 | ||
410 | static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh) | 318 | static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh) |
411 | { | 319 | { |
@@ -423,7 +331,7 @@ static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh) | |||
423 | /* MicoBlaze gogogo */ | 331 | /* MicoBlaze gogogo */ |
424 | lx_dsp_reg_write(chip, eReg_CSM, Reg_CSM_MC); | 332 | lx_dsp_reg_write(chip, eReg_CSM, Reg_CSM_MC); |
425 | 333 | ||
426 | /* wait for interrupt to answer */ | 334 | /* wait for device to answer */ |
427 | for (dwloop = 0; dwloop != XILINX_TIMEOUT_MS * 1000; ++dwloop) { | 335 | for (dwloop = 0; dwloop != XILINX_TIMEOUT_MS * 1000; ++dwloop) { |
428 | if (lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR) { | 336 | if (lx_dsp_reg_read(chip, eReg_CSM) & Reg_CSM_MR) { |
429 | if (rmh->dsp_stat == 0) | 337 | if (rmh->dsp_stat == 0) |
@@ -1175,10 +1083,6 @@ static int lx_interrupt_ack(struct lx6464es *chip, u32 *r_irqsrc, | |||
1175 | *r_async_escmd = 1; | 1083 | *r_async_escmd = 1; |
1176 | } | 1084 | } |
1177 | 1085 | ||
1178 | if (irqsrc & MASK_SYS_STATUS_CMD_DONE) | ||
1179 | /* xilinx command notification */ | ||
1180 | atomic_set(&chip->send_message_locked, 0); | ||
1181 | |||
1182 | if (irq_async) { | 1086 | if (irq_async) { |
1183 | /* snd_printd("interrupt: async event pending\n"); */ | 1087 | /* snd_printd("interrupt: async event pending\n"); */ |
1184 | *r_async_pending = 1; | 1088 | *r_async_pending = 1; |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index acfa4760da49..8a332d2f615c 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -386,6 +386,7 @@ struct via82xx { | |||
386 | 386 | ||
387 | struct snd_pcm *pcms[2]; | 387 | struct snd_pcm *pcms[2]; |
388 | struct snd_rawmidi *rmidi; | 388 | struct snd_rawmidi *rmidi; |
389 | struct snd_kcontrol *dxs_controls[4]; | ||
389 | 390 | ||
390 | struct snd_ac97_bus *ac97_bus; | 391 | struct snd_ac97_bus *ac97_bus; |
391 | struct snd_ac97 *ac97; | 392 | struct snd_ac97 *ac97; |
@@ -1216,9 +1217,9 @@ static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev, | |||
1216 | 1217 | ||
1217 | 1218 | ||
1218 | /* | 1219 | /* |
1219 | * open callback for playback on via686 and via823x DSX | 1220 | * open callback for playback on via686 |
1220 | */ | 1221 | */ |
1221 | static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) | 1222 | static int snd_via686_playback_open(struct snd_pcm_substream *substream) |
1222 | { | 1223 | { |
1223 | struct via82xx *chip = snd_pcm_substream_chip(substream); | 1224 | struct via82xx *chip = snd_pcm_substream_chip(substream); |
1224 | struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; | 1225 | struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; |
@@ -1230,6 +1231,32 @@ static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) | |||
1230 | } | 1231 | } |
1231 | 1232 | ||
1232 | /* | 1233 | /* |
1234 | * open callback for playback on via823x DXS | ||
1235 | */ | ||
1236 | static int snd_via8233_playback_open(struct snd_pcm_substream *substream) | ||
1237 | { | ||
1238 | struct via82xx *chip = snd_pcm_substream_chip(substream); | ||
1239 | struct viadev *viadev; | ||
1240 | unsigned int stream; | ||
1241 | int err; | ||
1242 | |||
1243 | viadev = &chip->devs[chip->playback_devno + substream->number]; | ||
1244 | if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0) | ||
1245 | return err; | ||
1246 | stream = viadev->reg_offset / 0x10; | ||
1247 | if (chip->dxs_controls[stream]) { | ||
1248 | chip->playback_volume[stream][0] = 0; | ||
1249 | chip->playback_volume[stream][1] = 0; | ||
1250 | chip->dxs_controls[stream]->vd[0].access &= | ||
1251 | ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
1252 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE | | ||
1253 | SNDRV_CTL_EVENT_MASK_INFO, | ||
1254 | &chip->dxs_controls[stream]->id); | ||
1255 | } | ||
1256 | return 0; | ||
1257 | } | ||
1258 | |||
1259 | /* | ||
1233 | * open callback for playback on via823x multi-channel | 1260 | * open callback for playback on via823x multi-channel |
1234 | */ | 1261 | */ |
1235 | static int snd_via8233_multi_open(struct snd_pcm_substream *substream) | 1262 | static int snd_via8233_multi_open(struct snd_pcm_substream *substream) |
@@ -1302,10 +1329,26 @@ static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream) | |||
1302 | return 0; | 1329 | return 0; |
1303 | } | 1330 | } |
1304 | 1331 | ||
1332 | static int snd_via8233_playback_close(struct snd_pcm_substream *substream) | ||
1333 | { | ||
1334 | struct via82xx *chip = snd_pcm_substream_chip(substream); | ||
1335 | struct viadev *viadev = substream->runtime->private_data; | ||
1336 | unsigned int stream; | ||
1337 | |||
1338 | stream = viadev->reg_offset / 0x10; | ||
1339 | if (chip->dxs_controls[stream]) { | ||
1340 | chip->dxs_controls[stream]->vd[0].access |= | ||
1341 | SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
1342 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, | ||
1343 | &chip->dxs_controls[stream]->id); | ||
1344 | } | ||
1345 | return snd_via82xx_pcm_close(substream); | ||
1346 | } | ||
1347 | |||
1305 | 1348 | ||
1306 | /* via686 playback callbacks */ | 1349 | /* via686 playback callbacks */ |
1307 | static struct snd_pcm_ops snd_via686_playback_ops = { | 1350 | static struct snd_pcm_ops snd_via686_playback_ops = { |
1308 | .open = snd_via82xx_playback_open, | 1351 | .open = snd_via686_playback_open, |
1309 | .close = snd_via82xx_pcm_close, | 1352 | .close = snd_via82xx_pcm_close, |
1310 | .ioctl = snd_pcm_lib_ioctl, | 1353 | .ioctl = snd_pcm_lib_ioctl, |
1311 | .hw_params = snd_via82xx_hw_params, | 1354 | .hw_params = snd_via82xx_hw_params, |
@@ -1331,8 +1374,8 @@ static struct snd_pcm_ops snd_via686_capture_ops = { | |||
1331 | 1374 | ||
1332 | /* via823x DSX playback callbacks */ | 1375 | /* via823x DSX playback callbacks */ |
1333 | static struct snd_pcm_ops snd_via8233_playback_ops = { | 1376 | static struct snd_pcm_ops snd_via8233_playback_ops = { |
1334 | .open = snd_via82xx_playback_open, | 1377 | .open = snd_via8233_playback_open, |
1335 | .close = snd_via82xx_pcm_close, | 1378 | .close = snd_via8233_playback_close, |
1336 | .ioctl = snd_pcm_lib_ioctl, | 1379 | .ioctl = snd_pcm_lib_ioctl, |
1337 | .hw_params = snd_via82xx_hw_params, | 1380 | .hw_params = snd_via82xx_hw_params, |
1338 | .hw_free = snd_via82xx_hw_free, | 1381 | .hw_free = snd_via82xx_hw_free, |
@@ -1626,7 +1669,7 @@ static int snd_via8233_dxs_volume_get(struct snd_kcontrol *kcontrol, | |||
1626 | struct snd_ctl_elem_value *ucontrol) | 1669 | struct snd_ctl_elem_value *ucontrol) |
1627 | { | 1670 | { |
1628 | struct via82xx *chip = snd_kcontrol_chip(kcontrol); | 1671 | struct via82xx *chip = snd_kcontrol_chip(kcontrol); |
1629 | unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); | 1672 | unsigned int idx = kcontrol->id.subdevice; |
1630 | 1673 | ||
1631 | ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0]; | 1674 | ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0]; |
1632 | ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1]; | 1675 | ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1]; |
@@ -1646,7 +1689,7 @@ static int snd_via8233_dxs_volume_put(struct snd_kcontrol *kcontrol, | |||
1646 | struct snd_ctl_elem_value *ucontrol) | 1689 | struct snd_ctl_elem_value *ucontrol) |
1647 | { | 1690 | { |
1648 | struct via82xx *chip = snd_kcontrol_chip(kcontrol); | 1691 | struct via82xx *chip = snd_kcontrol_chip(kcontrol); |
1649 | unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); | 1692 | unsigned int idx = kcontrol->id.subdevice; |
1650 | unsigned long port = chip->port + 0x10 * idx; | 1693 | unsigned long port = chip->port + 0x10 * idx; |
1651 | unsigned char val; | 1694 | unsigned char val; |
1652 | int i, change = 0; | 1695 | int i, change = 0; |
@@ -1705,11 +1748,13 @@ static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata = | |||
1705 | }; | 1748 | }; |
1706 | 1749 | ||
1707 | static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = { | 1750 | static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = { |
1708 | .name = "VIA DXS Playback Volume", | 1751 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1709 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1752 | .device = 0, |
1710 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1753 | /* .subdevice set later */ |
1711 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1754 | .name = "PCM Playback Volume", |
1712 | .count = 4, | 1755 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1756 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | | ||
1757 | SNDRV_CTL_ELEM_ACCESS_INACTIVE, | ||
1713 | .info = snd_via8233_dxs_volume_info, | 1758 | .info = snd_via8233_dxs_volume_info, |
1714 | .get = snd_via8233_dxs_volume_get, | 1759 | .get = snd_via8233_dxs_volume_get, |
1715 | .put = snd_via8233_dxs_volume_put, | 1760 | .put = snd_via8233_dxs_volume_put, |
@@ -1936,10 +1981,19 @@ static int __devinit snd_via8233_init_misc(struct via82xx *chip) | |||
1936 | } | 1981 | } |
1937 | else /* Using DXS when PCM emulation is enabled is really weird */ | 1982 | else /* Using DXS when PCM emulation is enabled is really weird */ |
1938 | { | 1983 | { |
1939 | /* Standalone DXS controls */ | 1984 | for (i = 0; i < 4; ++i) { |
1940 | err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs_volume_control, chip)); | 1985 | struct snd_kcontrol *kctl; |
1941 | if (err < 0) | 1986 | |
1942 | return err; | 1987 | kctl = snd_ctl_new1( |
1988 | &snd_via8233_dxs_volume_control, chip); | ||
1989 | if (!kctl) | ||
1990 | return -ENOMEM; | ||
1991 | kctl->id.subdevice = i; | ||
1992 | err = snd_ctl_add(chip->card, kctl); | ||
1993 | if (err < 0) | ||
1994 | return err; | ||
1995 | chip->dxs_controls[i] = kctl; | ||
1996 | } | ||
1943 | } | 1997 | } |
1944 | } | 1998 | } |
1945 | /* select spdif data slot 10/11 */ | 1999 | /* select spdif data slot 10/11 */ |
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 835fa19ed461..d06f780bd7e8 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
@@ -59,6 +59,18 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) | |||
59 | strlcpy(info.type, "keywest", I2C_NAME_SIZE); | 59 | strlcpy(info.type, "keywest", I2C_NAME_SIZE); |
60 | info.addr = keywest_ctx->addr; | 60 | info.addr = keywest_ctx->addr; |
61 | keywest_ctx->client = i2c_new_device(adapter, &info); | 61 | keywest_ctx->client = i2c_new_device(adapter, &info); |
62 | if (!keywest_ctx->client) | ||
63 | return -ENODEV; | ||
64 | /* | ||
65 | * We know the driver is already loaded, so the device should be | ||
66 | * already bound. If not it means binding failed, and then there | ||
67 | * is no point in keeping the device instantiated. | ||
68 | */ | ||
69 | if (!keywest_ctx->client->driver) { | ||
70 | i2c_unregister_device(keywest_ctx->client); | ||
71 | keywest_ctx->client = NULL; | ||
72 | return -ENODEV; | ||
73 | } | ||
62 | 74 | ||
63 | /* | 75 | /* |
64 | * Let i2c-core delete that device on driver removal. | 76 | * Let i2c-core delete that device on driver removal. |
@@ -86,7 +98,7 @@ static const struct i2c_device_id keywest_i2c_id[] = { | |||
86 | { } | 98 | { } |
87 | }; | 99 | }; |
88 | 100 | ||
89 | struct i2c_driver keywest_driver = { | 101 | static struct i2c_driver keywest_driver = { |
90 | .driver = { | 102 | .driver = { |
91 | .name = "PMac Keywest Audio", | 103 | .name = "PMac Keywest Audio", |
92 | }, | 104 | }, |
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index ac927ffdc961..97f1a251e446 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig | |||
@@ -7,15 +7,6 @@ config SND_BF5XX_I2S | |||
7 | mode (supports single stereo In/Out). | 7 | mode (supports single stereo In/Out). |
8 | You will also need to select the audio interfaces to support below. | 8 | You will also need to select the audio interfaces to support below. |
9 | 9 | ||
10 | config SND_BF5XX_TDM | ||
11 | tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip" | ||
12 | depends on (BLACKFIN && SND_SOC) | ||
13 | help | ||
14 | Say Y or M if you want to add support for codecs attached to | ||
15 | the Blackfin SPORT (synchronous serial ports) interface in TDM | ||
16 | mode. | ||
17 | You will also need to select the audio interfaces to support below. | ||
18 | |||
19 | config SND_BF5XX_SOC_SSM2602 | 10 | config SND_BF5XX_SOC_SSM2602 |
20 | tristate "SoC SSM2602 Audio support for BF52x ezkit" | 11 | tristate "SoC SSM2602 Audio support for BF52x ezkit" |
21 | depends on SND_BF5XX_I2S | 12 | depends on SND_BF5XX_I2S |
@@ -41,6 +32,31 @@ config SND_BFIN_AD73311_SE | |||
41 | Enter the GPIO used to control AD73311's SE pin. Acceptable | 32 | Enter the GPIO used to control AD73311's SE pin. Acceptable |
42 | values are 0 to 7 | 33 | values are 0 to 7 |
43 | 34 | ||
35 | config SND_BF5XX_TDM | ||
36 | tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip" | ||
37 | depends on (BLACKFIN && SND_SOC) | ||
38 | help | ||
39 | Say Y or M if you want to add support for codecs attached to | ||
40 | the Blackfin SPORT (synchronous serial ports) interface in TDM | ||
41 | mode. | ||
42 | You will also need to select the audio interfaces to support below. | ||
43 | |||
44 | config SND_BF5XX_SOC_AD1836 | ||
45 | tristate "SoC AD1836 Audio support for BF5xx" | ||
46 | depends on SND_BF5XX_TDM | ||
47 | select SND_BF5XX_SOC_TDM | ||
48 | select SND_SOC_AD1836 | ||
49 | help | ||
50 | Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. | ||
51 | |||
52 | config SND_BF5XX_SOC_AD1938 | ||
53 | tristate "SoC AD1938 Audio support for Blackfin" | ||
54 | depends on SND_BF5XX_TDM | ||
55 | select SND_BF5XX_SOC_TDM | ||
56 | select SND_SOC_AD1938 | ||
57 | help | ||
58 | Say Y if you want to add support for AD1938 codec on Blackfin. | ||
59 | |||
44 | config SND_BF5XX_AC97 | 60 | config SND_BF5XX_AC97 |
45 | tristate "SoC AC97 Audio for the ADI BF5xx chip" | 61 | tristate "SoC AC97 Audio for the ADI BF5xx chip" |
46 | depends on BLACKFIN | 62 | depends on BLACKFIN |
@@ -71,6 +87,30 @@ config SND_BF5XX_MULTICHAN_SUPPORT | |||
71 | Say y if you want AC97 driver to support up to 5.1 channel audio. | 87 | Say y if you want AC97 driver to support up to 5.1 channel audio. |
72 | this mode will consume much more memory for DMA. | 88 | this mode will consume much more memory for DMA. |
73 | 89 | ||
90 | config SND_BF5XX_HAVE_COLD_RESET | ||
91 | bool "BOARD has COLD Reset GPIO" | ||
92 | depends on SND_BF5XX_AC97 | ||
93 | default y if BFIN548_EZKIT | ||
94 | default n if !BFIN548_EZKIT | ||
95 | |||
96 | config SND_BF5XX_RESET_GPIO_NUM | ||
97 | int "Set a GPIO for cold reset" | ||
98 | depends on SND_BF5XX_HAVE_COLD_RESET | ||
99 | range 0 159 | ||
100 | default 19 if BFIN548_EZKIT | ||
101 | default 5 if BFIN537_STAMP | ||
102 | default 0 | ||
103 | help | ||
104 | Set the correct GPIO for RESET the sound chip. | ||
105 | |||
106 | config SND_BF5XX_SOC_AD1980 | ||
107 | tristate "SoC AD1980/1 Audio support for BF5xx" | ||
108 | depends on SND_BF5XX_AC97 | ||
109 | select SND_BF5XX_SOC_AC97 | ||
110 | select SND_SOC_AD1980 | ||
111 | help | ||
112 | Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. | ||
113 | |||
74 | config SND_BF5XX_SOC_SPORT | 114 | config SND_BF5XX_SOC_SPORT |
75 | tristate | 115 | tristate |
76 | 116 | ||
@@ -88,30 +128,6 @@ config SND_BF5XX_SOC_AC97 | |||
88 | select SND_SOC_AC97_BUS | 128 | select SND_SOC_AC97_BUS |
89 | select SND_BF5XX_SOC_SPORT | 129 | select SND_BF5XX_SOC_SPORT |
90 | 130 | ||
91 | config SND_BF5XX_SOC_AD1836 | ||
92 | tristate "SoC AD1836 Audio support for BF5xx" | ||
93 | depends on SND_BF5XX_TDM | ||
94 | select SND_BF5XX_SOC_TDM | ||
95 | select SND_SOC_AD1836 | ||
96 | help | ||
97 | Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. | ||
98 | |||
99 | config SND_BF5XX_SOC_AD1980 | ||
100 | tristate "SoC AD1980/1 Audio support for BF5xx" | ||
101 | depends on SND_BF5XX_AC97 | ||
102 | select SND_BF5XX_SOC_AC97 | ||
103 | select SND_SOC_AD1980 | ||
104 | help | ||
105 | Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT. | ||
106 | |||
107 | config SND_BF5XX_SOC_AD1938 | ||
108 | tristate "SoC AD1938 Audio support for Blackfin" | ||
109 | depends on SND_BF5XX_TDM | ||
110 | select SND_BF5XX_SOC_TDM | ||
111 | select SND_SOC_AD1938 | ||
112 | help | ||
113 | Say Y if you want to add support for AD1938 codec on Blackfin. | ||
114 | |||
115 | config SND_BF5XX_SPORT_NUM | 131 | config SND_BF5XX_SPORT_NUM |
116 | int "Set a SPORT for Sound chip" | 132 | int "Set a SPORT for Sound chip" |
117 | depends on (SND_BF5XX_I2S || SND_BF5XX_AC97 || SND_BF5XX_TDM) | 133 | depends on (SND_BF5XX_I2S || SND_BF5XX_AC97 || SND_BF5XX_TDM) |
@@ -120,19 +136,3 @@ config SND_BF5XX_SPORT_NUM | |||
120 | default 0 | 136 | default 0 |
121 | help | 137 | help |
122 | Set the correct SPORT for sound chip. | 138 | Set the correct SPORT for sound chip. |
123 | |||
124 | config SND_BF5XX_HAVE_COLD_RESET | ||
125 | bool "BOARD has COLD Reset GPIO" | ||
126 | depends on SND_BF5XX_AC97 | ||
127 | default y if BFIN548_EZKIT | ||
128 | default n if !BFIN548_EZKIT | ||
129 | |||
130 | config SND_BF5XX_RESET_GPIO_NUM | ||
131 | int "Set a GPIO for cold reset" | ||
132 | depends on SND_BF5XX_HAVE_COLD_RESET | ||
133 | range 0 159 | ||
134 | default 19 if BFIN548_EZKIT | ||
135 | default 5 if BFIN537_STAMP | ||
136 | default 0 | ||
137 | help | ||
138 | Set the correct GPIO for RESET the sound chip. | ||
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index 2758b9017a7f..e69322978739 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c | |||
@@ -277,7 +277,11 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai) | |||
277 | if (!dai->active) | 277 | if (!dai->active) |
278 | return 0; | 278 | return 0; |
279 | 279 | ||
280 | #if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) | ||
281 | ret = sport_set_multichannel(sport, 16, 0x3FF, 1); | ||
282 | #else | ||
280 | ret = sport_set_multichannel(sport, 16, 0x1F, 1); | 283 | ret = sport_set_multichannel(sport, 16, 0x1F, 1); |
284 | #endif | ||
281 | if (ret) { | 285 | if (ret) { |
282 | pr_err("SPORT is busy!\n"); | 286 | pr_err("SPORT is busy!\n"); |
283 | return -EBUSY; | 287 | return -EBUSY; |
@@ -334,7 +338,11 @@ static int bf5xx_ac97_probe(struct platform_device *pdev, | |||
334 | goto sport_err; | 338 | goto sport_err; |
335 | } | 339 | } |
336 | /*SPORT works in TDM mode to simulate AC97 transfers*/ | 340 | /*SPORT works in TDM mode to simulate AC97 transfers*/ |
341 | #if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) | ||
342 | ret = sport_set_multichannel(sport_handle, 16, 0x3FF, 1); | ||
343 | #else | ||
337 | ret = sport_set_multichannel(sport_handle, 16, 0x1F, 1); | 344 | ret = sport_set_multichannel(sport_handle, 16, 0x1F, 1); |
345 | #endif | ||
338 | if (ret) { | 346 | if (ret) { |
339 | pr_err("SPORT is busy!\n"); | 347 | pr_err("SPORT is busy!\n"); |
340 | ret = -EBUSY; | 348 | ret = -EBUSY; |
diff --git a/sound/soc/blackfin/bf5xx-ac97.h b/sound/soc/blackfin/bf5xx-ac97.h index 3f2a911fe0cb..a1f97dd809d6 100644 --- a/sound/soc/blackfin/bf5xx-ac97.h +++ b/sound/soc/blackfin/bf5xx-ac97.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/sound/arm/bf5xx-ac97.h | 2 | * sound/soc/blackfin/bf5xx-ac97.h |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c index 876abade27e1..084b68884ada 100644 --- a/sound/soc/blackfin/bf5xx-i2s.c +++ b/sound/soc/blackfin/bf5xx-i2s.c | |||
@@ -77,12 +77,12 @@ static struct sport_param sport_params[2] = { | |||
77 | * TFS. When Port G is selected and EMAC then there is a conflict between | 77 | * TFS. When Port G is selected and EMAC then there is a conflict between |
78 | * the PHY interrupt line and TFS. Current settings prevent the conflict | 78 | * the PHY interrupt line and TFS. Current settings prevent the conflict |
79 | * by ignoring the TFS pin when Port G is selected. This allows both | 79 | * by ignoring the TFS pin when Port G is selected. This allows both |
80 | * ssm2602 using Port G and EMAC concurrently. | 80 | * codecs and EMAC using Port G concurrently. |
81 | */ | 81 | */ |
82 | #ifdef CONFIG_BF527_SPORT0_PORTF | 82 | #ifdef CONFIG_BF527_SPORT0_PORTG |
83 | #define LOCAL_SPORT0_TFS (P_SPORT0_TFS) | ||
84 | #else | ||
85 | #define LOCAL_SPORT0_TFS (0) | 83 | #define LOCAL_SPORT0_TFS (0) |
84 | #else | ||
85 | #define LOCAL_SPORT0_TFS (P_SPORT0_TFS) | ||
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, | 88 | static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, |
@@ -227,7 +227,8 @@ static int bf5xx_i2s_probe(struct platform_device *pdev, | |||
227 | return 0; | 227 | return 0; |
228 | } | 228 | } |
229 | 229 | ||
230 | static void bf5xx_i2s_remove(struct snd_soc_dai *dai) | 230 | static void bf5xx_i2s_remove(struct platform_device *pdev, |
231 | struct snd_soc_dai *dai) | ||
231 | { | 232 | { |
232 | pr_debug("%s enter\n", __func__); | 233 | pr_debug("%s enter\n", __func__); |
233 | peripheral_free_list(&sport_req[sport_num][0]); | 234 | peripheral_free_list(&sport_req[sport_num][0]); |
@@ -236,36 +237,31 @@ static void bf5xx_i2s_remove(struct snd_soc_dai *dai) | |||
236 | #ifdef CONFIG_PM | 237 | #ifdef CONFIG_PM |
237 | static int bf5xx_i2s_suspend(struct snd_soc_dai *dai) | 238 | static int bf5xx_i2s_suspend(struct snd_soc_dai *dai) |
238 | { | 239 | { |
239 | struct sport_device *sport = | ||
240 | (struct sport_device *)dai->private_data; | ||
241 | 240 | ||
242 | pr_debug("%s : sport %d\n", __func__, dai->id); | 241 | pr_debug("%s : sport %d\n", __func__, dai->id); |
243 | if (!dai->active) | 242 | |
244 | return 0; | ||
245 | if (dai->capture.active) | 243 | if (dai->capture.active) |
246 | sport_rx_stop(sport); | 244 | sport_rx_stop(sport_handle); |
247 | if (dai->playback.active) | 245 | if (dai->playback.active) |
248 | sport_tx_stop(sport); | 246 | sport_tx_stop(sport_handle); |
249 | return 0; | 247 | return 0; |
250 | } | 248 | } |
251 | 249 | ||
252 | static int bf5xx_i2s_resume(struct snd_soc_dai *dai) | 250 | static int bf5xx_i2s_resume(struct snd_soc_dai *dai) |
253 | { | 251 | { |
254 | int ret; | 252 | int ret; |
255 | struct sport_device *sport = | ||
256 | (struct sport_device *)dai->private_data; | ||
257 | 253 | ||
258 | pr_debug("%s : sport %d\n", __func__, dai->id); | 254 | pr_debug("%s : sport %d\n", __func__, dai->id); |
259 | if (!dai->active) | ||
260 | return 0; | ||
261 | 255 | ||
262 | ret = sport_config_rx(sport, RFSR | RCKFE, RSFSE|0x1f, 0, 0); | 256 | ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1, |
257 | bf5xx_i2s.rcr2, 0, 0); | ||
263 | if (ret) { | 258 | if (ret) { |
264 | pr_err("SPORT is busy!\n"); | 259 | pr_err("SPORT is busy!\n"); |
265 | return -EBUSY; | 260 | return -EBUSY; |
266 | } | 261 | } |
267 | 262 | ||
268 | ret = sport_config_tx(sport, TFSR | TCKFE, TSFSE|0x1f, 0, 0); | 263 | ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1, |
264 | bf5xx_i2s.tcr2, 0, 0); | ||
269 | if (ret) { | 265 | if (ret) { |
270 | pr_err("SPORT is busy!\n"); | 266 | pr_err("SPORT is busy!\n"); |
271 | return -EBUSY; | 267 | return -EBUSY; |
diff --git a/sound/soc/blackfin/bf5xx-i2s.h b/sound/soc/blackfin/bf5xx-i2s.h index 7107d1a0b06b..264ecdcba35a 100644 --- a/sound/soc/blackfin/bf5xx-i2s.h +++ b/sound/soc/blackfin/bf5xx-i2s.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/sound/arm/bf5xx-i2s.h | 2 | * sound/soc/blackfin/bf5xx-i2s.h |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/sound/soc/blackfin/bf5xx-sport.c b/sound/soc/blackfin/bf5xx-sport.c index 469ce7fab20c..99051ff0954e 100644 --- a/sound/soc/blackfin/bf5xx-sport.c +++ b/sound/soc/blackfin/bf5xx-sport.c | |||
@@ -326,7 +326,7 @@ static inline int sport_hook_tx_dummy(struct sport_device *sport) | |||
326 | 326 | ||
327 | int sport_tx_start(struct sport_device *sport) | 327 | int sport_tx_start(struct sport_device *sport) |
328 | { | 328 | { |
329 | unsigned flags; | 329 | unsigned long flags; |
330 | pr_debug("%s: tx_run:%d, rx_run:%d\n", __func__, | 330 | pr_debug("%s: tx_run:%d, rx_run:%d\n", __func__, |
331 | sport->tx_run, sport->rx_run); | 331 | sport->tx_run, sport->rx_run); |
332 | if (sport->tx_run) | 332 | if (sport->tx_run) |
diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c index 3096badf09a5..ff546e91a22e 100644 --- a/sound/soc/blackfin/bf5xx-tdm.c +++ b/sound/soc/blackfin/bf5xx-tdm.c | |||
@@ -78,12 +78,12 @@ static struct sport_param sport_params[2] = { | |||
78 | * TFS. When Port G is selected and EMAC then there is a conflict between | 78 | * TFS. When Port G is selected and EMAC then there is a conflict between |
79 | * the PHY interrupt line and TFS. Current settings prevent the conflict | 79 | * the PHY interrupt line and TFS. Current settings prevent the conflict |
80 | * by ignoring the TFS pin when Port G is selected. This allows both | 80 | * by ignoring the TFS pin when Port G is selected. This allows both |
81 | * ssm2602 using Port G and EMAC concurrently. | 81 | * codecs and EMAC using Port G concurrently. |
82 | */ | 82 | */ |
83 | #ifdef CONFIG_BF527_SPORT0_PORTF | 83 | #ifdef CONFIG_BF527_SPORT0_PORTG |
84 | #define LOCAL_SPORT0_TFS (P_SPORT0_TFS) | ||
85 | #else | ||
86 | #define LOCAL_SPORT0_TFS (0) | 84 | #define LOCAL_SPORT0_TFS (0) |
85 | #else | ||
86 | #define LOCAL_SPORT0_TFS (P_SPORT0_TFS) | ||
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, | 89 | static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, |
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c index 01343dc984fd..c48485f2c55d 100644 --- a/sound/soc/codecs/ad1836.c +++ b/sound/soc/codecs/ad1836.c | |||
@@ -251,8 +251,7 @@ static int __devexit ad1836_spi_remove(struct spi_device *spi) | |||
251 | 251 | ||
252 | static struct spi_driver ad1836_spi_driver = { | 252 | static struct spi_driver ad1836_spi_driver = { |
253 | .driver = { | 253 | .driver = { |
254 | .name = "ad1836-spi", | 254 | .name = "ad1836", |
255 | .bus = &spi_bus_type, | ||
256 | .owner = THIS_MODULE, | 255 | .owner = THIS_MODULE, |
257 | }, | 256 | }, |
258 | .probe = ad1836_spi_probe, | 257 | .probe = ad1836_spi_probe, |
diff --git a/sound/soc/codecs/ad1938.c b/sound/soc/codecs/ad1938.c index 9a049a1995a3..34b30efc3cb0 100644 --- a/sound/soc/codecs/ad1938.c +++ b/sound/soc/codecs/ad1938.c | |||
@@ -456,7 +456,6 @@ static int __devexit ad1938_spi_remove(struct spi_device *spi) | |||
456 | static struct spi_driver ad1938_spi_driver = { | 456 | static struct spi_driver ad1938_spi_driver = { |
457 | .driver = { | 457 | .driver = { |
458 | .name = "ad1938", | 458 | .name = "ad1938", |
459 | .bus = &spi_bus_type, | ||
460 | .owner = THIS_MODULE, | 459 | .owner = THIS_MODULE, |
461 | }, | 460 | }, |
462 | .probe = ad1938_spi_probe, | 461 | .probe = ad1938_spi_probe, |
@@ -515,6 +514,7 @@ static int ad1938_register(struct ad1938_priv *ad1938) | |||
515 | codec->num_dai = 1; | 514 | codec->num_dai = 1; |
516 | codec->write = ad1938_write_reg; | 515 | codec->write = ad1938_write_reg; |
517 | codec->read = ad1938_read_reg_cache; | 516 | codec->read = ad1938_read_reg_cache; |
517 | codec->set_bias_level = ad1938_set_bias_level; | ||
518 | INIT_LIST_HEAD(&codec->dapm_widgets); | 518 | INIT_LIST_HEAD(&codec->dapm_widgets); |
519 | INIT_LIST_HEAD(&codec->dapm_paths); | 519 | INIT_LIST_HEAD(&codec->dapm_paths); |
520 | 520 | ||
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 3ff0373dff89..593d5b9c9f03 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -579,7 +579,7 @@ static const struct snd_kcontrol_new wm8350_left_capt_mixer_controls[] = { | |||
579 | SOC_DAPM_SINGLE_TLV("L3 Capture Volume", | 579 | SOC_DAPM_SINGLE_TLV("L3 Capture Volume", |
580 | WM8350_INPUT_MIXER_VOLUME_L, 9, 7, 0, out_mix_tlv), | 580 | WM8350_INPUT_MIXER_VOLUME_L, 9, 7, 0, out_mix_tlv), |
581 | SOC_DAPM_SINGLE("PGA Capture Switch", | 581 | SOC_DAPM_SINGLE("PGA Capture Switch", |
582 | WM8350_LEFT_INPUT_VOLUME, 14, 1, 0), | 582 | WM8350_LEFT_INPUT_VOLUME, 14, 1, 1), |
583 | }; | 583 | }; |
584 | 584 | ||
585 | /* Right Input Mixer */ | 585 | /* Right Input Mixer */ |
@@ -589,7 +589,7 @@ static const struct snd_kcontrol_new wm8350_right_capt_mixer_controls[] = { | |||
589 | SOC_DAPM_SINGLE_TLV("L3 Capture Volume", | 589 | SOC_DAPM_SINGLE_TLV("L3 Capture Volume", |
590 | WM8350_INPUT_MIXER_VOLUME_R, 13, 7, 0, out_mix_tlv), | 590 | WM8350_INPUT_MIXER_VOLUME_R, 13, 7, 0, out_mix_tlv), |
591 | SOC_DAPM_SINGLE("PGA Capture Switch", | 591 | SOC_DAPM_SINGLE("PGA Capture Switch", |
592 | WM8350_RIGHT_INPUT_VOLUME, 14, 1, 0), | 592 | WM8350_RIGHT_INPUT_VOLUME, 14, 1, 1), |
593 | }; | 593 | }; |
594 | 594 | ||
595 | /* Left Mic Mixer */ | 595 | /* Left Mic Mixer */ |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index d80d414cfbbd..5ad677ce80da 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -595,6 +595,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
595 | 595 | ||
596 | /* Mono Capture mixer-mux */ | 596 | /* Mono Capture mixer-mux */ |
597 | {"Capture Right Mixer", "Stereo", "Capture Right Mux"}, | 597 | {"Capture Right Mixer", "Stereo", "Capture Right Mux"}, |
598 | {"Capture Left Mixer", "Stereo", "Capture Left Mux"}, | ||
598 | {"Capture Left Mixer", "Analogue Mix Left", "Capture Left Mux"}, | 599 | {"Capture Left Mixer", "Analogue Mix Left", "Capture Left Mux"}, |
599 | {"Capture Left Mixer", "Analogue Mix Left", "Capture Right Mux"}, | 600 | {"Capture Left Mixer", "Analogue Mix Left", "Capture Right Mux"}, |
600 | {"Capture Right Mixer", "Analogue Mix Right", "Capture Left Mux"}, | 601 | {"Capture Right Mixer", "Analogue Mix Right", "Capture Left Mux"}, |
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index da97aae475a2..1ef2454c5205 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -790,7 +790,7 @@ static int wm8940_register(struct wm8940_priv *wm8940, | |||
790 | codec->reg_cache = &wm8940->reg_cache; | 790 | codec->reg_cache = &wm8940->reg_cache; |
791 | 791 | ||
792 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, control); | 792 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, control); |
793 | if (ret == 0) { | 793 | if (ret < 0) { |
794 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); | 794 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); |
795 | return ret; | 795 | return ret; |
796 | } | 796 | } |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index c64e55aa63b6..686e5aa97206 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -1027,7 +1027,7 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream, | |||
1027 | - wm9081->fs); | 1027 | - wm9081->fs); |
1028 | for (i = 1; i < ARRAY_SIZE(clk_sys_rates); i++) { | 1028 | for (i = 1; i < ARRAY_SIZE(clk_sys_rates); i++) { |
1029 | cur_val = abs((wm9081->sysclk_rate / | 1029 | cur_val = abs((wm9081->sysclk_rate / |
1030 | clk_sys_rates[i].ratio) - wm9081->fs);; | 1030 | clk_sys_rates[i].ratio) - wm9081->fs); |
1031 | if (cur_val < best_val) { | 1031 | if (cur_val < best_val) { |
1032 | best = i; | 1032 | best = i; |
1033 | best_val = cur_val; | 1033 | best_val = cur_val; |
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 12a6c549ee6e..4ae707048021 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -97,22 +97,19 @@ enum { | |||
97 | DAVINCI_MCBSP_WORD_32, | 97 | DAVINCI_MCBSP_WORD_32, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static struct davinci_pcm_dma_params davinci_i2s_pcm_out = { | ||
101 | .name = "I2S PCM Stereo out", | ||
102 | }; | ||
103 | |||
104 | static struct davinci_pcm_dma_params davinci_i2s_pcm_in = { | ||
105 | .name = "I2S PCM Stereo in", | ||
106 | }; | ||
107 | |||
108 | struct davinci_mcbsp_dev { | 100 | struct davinci_mcbsp_dev { |
101 | /* | ||
102 | * dma_params must be first because rtd->dai->cpu_dai->private_data | ||
103 | * is cast to a pointer of an array of struct davinci_pcm_dma_params in | ||
104 | * davinci_pcm_open. | ||
105 | */ | ||
106 | struct davinci_pcm_dma_params dma_params[2]; | ||
109 | void __iomem *base; | 107 | void __iomem *base; |
110 | #define MOD_DSP_A 0 | 108 | #define MOD_DSP_A 0 |
111 | #define MOD_DSP_B 1 | 109 | #define MOD_DSP_B 1 |
112 | int mode; | 110 | int mode; |
113 | u32 pcr; | 111 | u32 pcr; |
114 | struct clk *clk; | 112 | struct clk *clk; |
115 | struct davinci_pcm_dma_params *dma_params[2]; | ||
116 | }; | 113 | }; |
117 | 114 | ||
118 | static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, | 115 | static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, |
@@ -215,14 +212,6 @@ static void davinci_mcbsp_stop(struct davinci_mcbsp_dev *dev, int playback) | |||
215 | toggle_clock(dev, playback); | 212 | toggle_clock(dev, playback); |
216 | } | 213 | } |
217 | 214 | ||
218 | static int davinci_i2s_startup(struct snd_pcm_substream *substream, | ||
219 | struct snd_soc_dai *cpu_dai) | ||
220 | { | ||
221 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; | ||
222 | cpu_dai->dma_data = dev->dma_params[substream->stream]; | ||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | #define DEFAULT_BITPERSAMPLE 16 | 215 | #define DEFAULT_BITPERSAMPLE 16 |
227 | 216 | ||
228 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 217 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
@@ -353,8 +342,9 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
353 | struct snd_pcm_hw_params *params, | 342 | struct snd_pcm_hw_params *params, |
354 | struct snd_soc_dai *dai) | 343 | struct snd_soc_dai *dai) |
355 | { | 344 | { |
356 | struct davinci_pcm_dma_params *dma_params = dai->dma_data; | ||
357 | struct davinci_mcbsp_dev *dev = dai->private_data; | 345 | struct davinci_mcbsp_dev *dev = dai->private_data; |
346 | struct davinci_pcm_dma_params *dma_params = | ||
347 | &dev->dma_params[substream->stream]; | ||
358 | struct snd_interval *i = NULL; | 348 | struct snd_interval *i = NULL; |
359 | int mcbsp_word_length; | 349 | int mcbsp_word_length; |
360 | unsigned int rcr, xcr, srgr; | 350 | unsigned int rcr, xcr, srgr; |
@@ -472,7 +462,6 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | |||
472 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 | 462 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 |
473 | 463 | ||
474 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { | 464 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { |
475 | .startup = davinci_i2s_startup, | ||
476 | .shutdown = davinci_i2s_shutdown, | 465 | .shutdown = davinci_i2s_shutdown, |
477 | .prepare = davinci_i2s_prepare, | 466 | .prepare = davinci_i2s_prepare, |
478 | .trigger = davinci_i2s_trigger, | 467 | .trigger = davinci_i2s_trigger, |
@@ -534,12 +523,10 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
534 | 523 | ||
535 | dev->base = (void __iomem *)IO_ADDRESS(mem->start); | 524 | dev->base = (void __iomem *)IO_ADDRESS(mem->start); |
536 | 525 | ||
537 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &davinci_i2s_pcm_out; | 526 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr = |
538 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->dma_addr = | ||
539 | (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); | 527 | (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); |
540 | 528 | ||
541 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &davinci_i2s_pcm_in; | 529 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = |
542 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->dma_addr = | ||
543 | (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); | 530 | (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); |
544 | 531 | ||
545 | /* first TX, then RX */ | 532 | /* first TX, then RX */ |
@@ -549,7 +536,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
549 | ret = -ENXIO; | 536 | ret = -ENXIO; |
550 | goto err_free_mem; | 537 | goto err_free_mem; |
551 | } | 538 | } |
552 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->channel = res->start; | 539 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; |
553 | 540 | ||
554 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 541 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
555 | if (!res) { | 542 | if (!res) { |
@@ -557,7 +544,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
557 | ret = -ENXIO; | 544 | ret = -ENXIO; |
558 | goto err_free_mem; | 545 | goto err_free_mem; |
559 | } | 546 | } |
560 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->channel = res->start; | 547 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; |
561 | 548 | ||
562 | davinci_i2s_dai.private_data = dev; | 549 | davinci_i2s_dai.private_data = dev; |
563 | ret = snd_soc_register_dai(&davinci_i2s_dai); | 550 | ret = snd_soc_register_dai(&davinci_i2s_dai); |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index eca22d7829d2..5d1f98a4c978 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -332,14 +332,6 @@ static inline void mcasp_set_ctl_reg(void __iomem *regs, u32 val) | |||
332 | printk(KERN_ERR "GBLCTL write error\n"); | 332 | printk(KERN_ERR "GBLCTL write error\n"); |
333 | } | 333 | } |
334 | 334 | ||
335 | static int davinci_mcasp_startup(struct snd_pcm_substream *substream, | ||
336 | struct snd_soc_dai *cpu_dai) | ||
337 | { | ||
338 | struct davinci_audio_dev *dev = cpu_dai->private_data; | ||
339 | cpu_dai->dma_data = dev->dma_params[substream->stream]; | ||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | static void mcasp_start_rx(struct davinci_audio_dev *dev) | 335 | static void mcasp_start_rx(struct davinci_audio_dev *dev) |
344 | { | 336 | { |
345 | mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST); | 337 | mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST); |
@@ -386,17 +378,17 @@ static void mcasp_start_tx(struct davinci_audio_dev *dev) | |||
386 | 378 | ||
387 | static void davinci_mcasp_start(struct davinci_audio_dev *dev, int stream) | 379 | static void davinci_mcasp_start(struct davinci_audio_dev *dev, int stream) |
388 | { | 380 | { |
389 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | 381 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
382 | if (dev->txnumevt) /* enable FIFO */ | ||
383 | mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, | ||
384 | FIFO_ENABLE); | ||
390 | mcasp_start_tx(dev); | 385 | mcasp_start_tx(dev); |
391 | else | 386 | } else { |
387 | if (dev->rxnumevt) /* enable FIFO */ | ||
388 | mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, | ||
389 | FIFO_ENABLE); | ||
392 | mcasp_start_rx(dev); | 390 | mcasp_start_rx(dev); |
393 | 391 | } | |
394 | /* enable FIFO */ | ||
395 | if (dev->txnumevt) | ||
396 | mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE); | ||
397 | |||
398 | if (dev->rxnumevt) | ||
399 | mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE); | ||
400 | } | 392 | } |
401 | 393 | ||
402 | static void mcasp_stop_rx(struct davinci_audio_dev *dev) | 394 | static void mcasp_stop_rx(struct davinci_audio_dev *dev) |
@@ -413,17 +405,17 @@ static void mcasp_stop_tx(struct davinci_audio_dev *dev) | |||
413 | 405 | ||
414 | static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream) | 406 | static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream) |
415 | { | 407 | { |
416 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | 408 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
409 | if (dev->txnumevt) /* disable FIFO */ | ||
410 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, | ||
411 | FIFO_ENABLE); | ||
417 | mcasp_stop_tx(dev); | 412 | mcasp_stop_tx(dev); |
418 | else | 413 | } else { |
414 | if (dev->rxnumevt) /* disable FIFO */ | ||
415 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, | ||
416 | FIFO_ENABLE); | ||
419 | mcasp_stop_rx(dev); | 417 | mcasp_stop_rx(dev); |
420 | 418 | } | |
421 | /* disable FIFO */ | ||
422 | if (dev->txnumevt) | ||
423 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE); | ||
424 | |||
425 | if (dev->rxnumevt) | ||
426 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE); | ||
427 | } | 419 | } |
428 | 420 | ||
429 | static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 421 | static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
@@ -512,34 +504,49 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev, | |||
512 | int channel_size) | 504 | int channel_size) |
513 | { | 505 | { |
514 | u32 fmt = 0; | 506 | u32 fmt = 0; |
507 | u32 mask, rotate; | ||
515 | 508 | ||
516 | switch (channel_size) { | 509 | switch (channel_size) { |
517 | case DAVINCI_AUDIO_WORD_8: | 510 | case DAVINCI_AUDIO_WORD_8: |
518 | fmt = 0x03; | 511 | fmt = 0x03; |
512 | rotate = 6; | ||
513 | mask = 0x000000ff; | ||
519 | break; | 514 | break; |
520 | 515 | ||
521 | case DAVINCI_AUDIO_WORD_12: | 516 | case DAVINCI_AUDIO_WORD_12: |
522 | fmt = 0x05; | 517 | fmt = 0x05; |
518 | rotate = 5; | ||
519 | mask = 0x00000fff; | ||
523 | break; | 520 | break; |
524 | 521 | ||
525 | case DAVINCI_AUDIO_WORD_16: | 522 | case DAVINCI_AUDIO_WORD_16: |
526 | fmt = 0x07; | 523 | fmt = 0x07; |
524 | rotate = 4; | ||
525 | mask = 0x0000ffff; | ||
527 | break; | 526 | break; |
528 | 527 | ||
529 | case DAVINCI_AUDIO_WORD_20: | 528 | case DAVINCI_AUDIO_WORD_20: |
530 | fmt = 0x09; | 529 | fmt = 0x09; |
530 | rotate = 3; | ||
531 | mask = 0x000fffff; | ||
531 | break; | 532 | break; |
532 | 533 | ||
533 | case DAVINCI_AUDIO_WORD_24: | 534 | case DAVINCI_AUDIO_WORD_24: |
534 | fmt = 0x0B; | 535 | fmt = 0x0B; |
536 | rotate = 2; | ||
537 | mask = 0x00ffffff; | ||
535 | break; | 538 | break; |
536 | 539 | ||
537 | case DAVINCI_AUDIO_WORD_28: | 540 | case DAVINCI_AUDIO_WORD_28: |
538 | fmt = 0x0D; | 541 | fmt = 0x0D; |
542 | rotate = 1; | ||
543 | mask = 0x0fffffff; | ||
539 | break; | 544 | break; |
540 | 545 | ||
541 | case DAVINCI_AUDIO_WORD_32: | 546 | case DAVINCI_AUDIO_WORD_32: |
542 | fmt = 0x0F; | 547 | fmt = 0x0F; |
548 | rotate = 0; | ||
549 | mask = 0xffffffff; | ||
543 | break; | 550 | break; |
544 | 551 | ||
545 | default: | 552 | default: |
@@ -550,6 +557,13 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev, | |||
550 | RXSSZ(fmt), RXSSZ(0x0F)); | 557 | RXSSZ(fmt), RXSSZ(0x0F)); |
551 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, | 558 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, |
552 | TXSSZ(fmt), TXSSZ(0x0F)); | 559 | TXSSZ(fmt), TXSSZ(0x0F)); |
560 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXROT(rotate), | ||
561 | TXROT(7)); | ||
562 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXROT(rotate), | ||
563 | RXROT(7)); | ||
564 | mcasp_set_reg(dev->base + DAVINCI_MCASP_TXMASK_REG, mask); | ||
565 | mcasp_set_reg(dev->base + DAVINCI_MCASP_RXMASK_REG, mask); | ||
566 | |||
553 | return 0; | 567 | return 0; |
554 | } | 568 | } |
555 | 569 | ||
@@ -638,7 +652,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) | |||
638 | printk(KERN_ERR "playback tdm slot %d not supported\n", | 652 | printk(KERN_ERR "playback tdm slot %d not supported\n", |
639 | dev->tdm_slots); | 653 | dev->tdm_slots); |
640 | 654 | ||
641 | mcasp_set_reg(dev->base + DAVINCI_MCASP_TXMASK_REG, 0xFFFFFFFF); | ||
642 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR); | 655 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR); |
643 | } else { | 656 | } else { |
644 | /* bit stream is MSB first with no delay */ | 657 | /* bit stream is MSB first with no delay */ |
@@ -655,7 +668,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) | |||
655 | printk(KERN_ERR "capture tdm slot %d not supported\n", | 668 | printk(KERN_ERR "capture tdm slot %d not supported\n", |
656 | dev->tdm_slots); | 669 | dev->tdm_slots); |
657 | 670 | ||
658 | mcasp_set_reg(dev->base + DAVINCI_MCASP_RXMASK_REG, 0xFFFFFFFF); | ||
659 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR); | 671 | mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR); |
660 | } | 672 | } |
661 | } | 673 | } |
@@ -700,7 +712,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
700 | { | 712 | { |
701 | struct davinci_audio_dev *dev = cpu_dai->private_data; | 713 | struct davinci_audio_dev *dev = cpu_dai->private_data; |
702 | struct davinci_pcm_dma_params *dma_params = | 714 | struct davinci_pcm_dma_params *dma_params = |
703 | dev->dma_params[substream->stream]; | 715 | &dev->dma_params[substream->stream]; |
704 | int word_length; | 716 | int word_length; |
705 | u8 numevt; | 717 | u8 numevt; |
706 | 718 | ||
@@ -778,7 +790,6 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, | |||
778 | } | 790 | } |
779 | 791 | ||
780 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { | 792 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { |
781 | .startup = davinci_mcasp_startup, | ||
782 | .trigger = davinci_mcasp_trigger, | 793 | .trigger = davinci_mcasp_trigger, |
783 | .hw_params = davinci_mcasp_hw_params, | 794 | .hw_params = davinci_mcasp_hw_params, |
784 | .set_fmt = davinci_mcasp_set_dai_fmt, | 795 | .set_fmt = davinci_mcasp_set_dai_fmt, |
@@ -829,20 +840,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
829 | struct resource *mem, *ioarea, *res; | 840 | struct resource *mem, *ioarea, *res; |
830 | struct snd_platform_data *pdata; | 841 | struct snd_platform_data *pdata; |
831 | struct davinci_audio_dev *dev; | 842 | struct davinci_audio_dev *dev; |
832 | int count = 0; | ||
833 | int ret = 0; | 843 | int ret = 0; |
834 | 844 | ||
835 | dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); | 845 | dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); |
836 | if (!dev) | 846 | if (!dev) |
837 | return -ENOMEM; | 847 | return -ENOMEM; |
838 | 848 | ||
839 | dma_data = kzalloc(sizeof(struct davinci_pcm_dma_params) * 2, | ||
840 | GFP_KERNEL); | ||
841 | if (!dma_data) { | ||
842 | ret = -ENOMEM; | ||
843 | goto err_release_dev; | ||
844 | } | ||
845 | |||
846 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 849 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
847 | if (!mem) { | 850 | if (!mem) { |
848 | dev_err(&pdev->dev, "no mem resource?\n"); | 851 | dev_err(&pdev->dev, "no mem resource?\n"); |
@@ -877,11 +880,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
877 | dev->txnumevt = pdata->txnumevt; | 880 | dev->txnumevt = pdata->txnumevt; |
878 | dev->rxnumevt = pdata->rxnumevt; | 881 | dev->rxnumevt = pdata->rxnumevt; |
879 | 882 | ||
880 | dma_data[count].name = "I2S PCM Stereo out"; | 883 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; |
881 | dma_data[count].eventq_no = pdata->eventq_no; | 884 | dma_data->eventq_no = pdata->eventq_no; |
882 | dma_data[count].dma_addr = (dma_addr_t) (pdata->tx_dma_offset + | 885 | dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + |
883 | io_v2p(dev->base)); | 886 | io_v2p(dev->base)); |
884 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &dma_data[count]; | ||
885 | 887 | ||
886 | /* first TX, then RX */ | 888 | /* first TX, then RX */ |
887 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 889 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
@@ -890,13 +892,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
890 | goto err_release_region; | 892 | goto err_release_region; |
891 | } | 893 | } |
892 | 894 | ||
893 | dma_data[count].channel = res->start; | 895 | dma_data->channel = res->start; |
894 | count++; | 896 | |
895 | dma_data[count].name = "I2S PCM Stereo in"; | 897 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; |
896 | dma_data[count].eventq_no = pdata->eventq_no; | 898 | dma_data->eventq_no = pdata->eventq_no; |
897 | dma_data[count].dma_addr = (dma_addr_t)(pdata->rx_dma_offset + | 899 | dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + |
898 | io_v2p(dev->base)); | 900 | io_v2p(dev->base)); |
899 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &dma_data[count]; | ||
900 | 901 | ||
901 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 902 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
902 | if (!res) { | 903 | if (!res) { |
@@ -904,7 +905,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
904 | goto err_release_region; | 905 | goto err_release_region; |
905 | } | 906 | } |
906 | 907 | ||
907 | dma_data[count].channel = res->start; | 908 | dma_data->channel = res->start; |
908 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; | 909 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; |
909 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; | 910 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; |
910 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); | 911 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); |
@@ -916,8 +917,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
916 | err_release_region: | 917 | err_release_region: |
917 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 918 | release_mem_region(mem->start, (mem->end - mem->start) + 1); |
918 | err_release_data: | 919 | err_release_data: |
919 | kfree(dma_data); | ||
920 | err_release_dev: | ||
921 | kfree(dev); | 920 | kfree(dev); |
922 | 921 | ||
923 | return ret; | 922 | return ret; |
@@ -926,7 +925,6 @@ err_release_dev: | |||
926 | static int davinci_mcasp_remove(struct platform_device *pdev) | 925 | static int davinci_mcasp_remove(struct platform_device *pdev) |
927 | { | 926 | { |
928 | struct snd_platform_data *pdata = pdev->dev.platform_data; | 927 | struct snd_platform_data *pdata = pdev->dev.platform_data; |
929 | struct davinci_pcm_dma_params *dma_data; | ||
930 | struct davinci_audio_dev *dev; | 928 | struct davinci_audio_dev *dev; |
931 | struct resource *mem; | 929 | struct resource *mem; |
932 | 930 | ||
@@ -939,8 +937,6 @@ static int davinci_mcasp_remove(struct platform_device *pdev) | |||
939 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 937 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
940 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 938 | release_mem_region(mem->start, (mem->end - mem->start) + 1); |
941 | 939 | ||
942 | dma_data = dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; | ||
943 | kfree(dma_data); | ||
944 | kfree(dev); | 940 | kfree(dev); |
945 | 941 | ||
946 | return 0; | 942 | return 0; |
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h index 554354c1cc2f..9d179cc88f7b 100644 --- a/sound/soc/davinci/davinci-mcasp.h +++ b/sound/soc/davinci/davinci-mcasp.h | |||
@@ -39,10 +39,15 @@ enum { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct davinci_audio_dev { | 41 | struct davinci_audio_dev { |
42 | /* | ||
43 | * dma_params must be first because rtd->dai->cpu_dai->private_data | ||
44 | * is cast to a pointer of an array of struct davinci_pcm_dma_params in | ||
45 | * davinci_pcm_open. | ||
46 | */ | ||
47 | struct davinci_pcm_dma_params dma_params[2]; | ||
42 | void __iomem *base; | 48 | void __iomem *base; |
43 | int sample_rate; | 49 | int sample_rate; |
44 | struct clk *clk; | 50 | struct clk *clk; |
45 | struct davinci_pcm_dma_params *dma_params[2]; | ||
46 | unsigned int codec_fmt; | 51 | unsigned int codec_fmt; |
47 | 52 | ||
48 | /* McASP specific data */ | 53 | /* McASP specific data */ |
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 2f7da49ed34f..c73a915f233f 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -126,16 +126,9 @@ static void davinci_pcm_dma_irq(unsigned lch, u16 ch_status, void *data) | |||
126 | static int davinci_pcm_dma_request(struct snd_pcm_substream *substream) | 126 | static int davinci_pcm_dma_request(struct snd_pcm_substream *substream) |
127 | { | 127 | { |
128 | struct davinci_runtime_data *prtd = substream->runtime->private_data; | 128 | struct davinci_runtime_data *prtd = substream->runtime->private_data; |
129 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
130 | struct davinci_pcm_dma_params *dma_data = rtd->dai->cpu_dai->dma_data; | ||
131 | struct edmacc_param p_ram; | 129 | struct edmacc_param p_ram; |
132 | int ret; | 130 | int ret; |
133 | 131 | ||
134 | if (!dma_data) | ||
135 | return -ENODEV; | ||
136 | |||
137 | prtd->params = dma_data; | ||
138 | |||
139 | /* Request master DMA channel */ | 132 | /* Request master DMA channel */ |
140 | ret = edma_alloc_channel(prtd->params->channel, | 133 | ret = edma_alloc_channel(prtd->params->channel, |
141 | davinci_pcm_dma_irq, substream, | 134 | davinci_pcm_dma_irq, substream, |
@@ -244,6 +237,11 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) | |||
244 | struct snd_pcm_runtime *runtime = substream->runtime; | 237 | struct snd_pcm_runtime *runtime = substream->runtime; |
245 | struct davinci_runtime_data *prtd; | 238 | struct davinci_runtime_data *prtd; |
246 | int ret = 0; | 239 | int ret = 0; |
240 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
241 | struct davinci_pcm_dma_params *pa = rtd->dai->cpu_dai->private_data; | ||
242 | struct davinci_pcm_dma_params *params = &pa[substream->stream]; | ||
243 | if (!params) | ||
244 | return -ENODEV; | ||
247 | 245 | ||
248 | snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware); | 246 | snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware); |
249 | /* ensure that buffer size is a multiple of period size */ | 247 | /* ensure that buffer size is a multiple of period size */ |
@@ -257,6 +255,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) | |||
257 | return -ENOMEM; | 255 | return -ENOMEM; |
258 | 256 | ||
259 | spin_lock_init(&prtd->lock); | 257 | spin_lock_init(&prtd->lock); |
258 | prtd->params = params; | ||
260 | 259 | ||
261 | runtime->private_data = prtd; | 260 | runtime->private_data = prtd; |
262 | 261 | ||
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h index 63d96253c73a..8746606efc89 100644 --- a/sound/soc/davinci/davinci-pcm.h +++ b/sound/soc/davinci/davinci-pcm.h | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | 18 | ||
19 | struct davinci_pcm_dma_params { | 19 | struct davinci_pcm_dma_params { |
20 | char *name; /* stream identifier */ | ||
21 | int channel; /* sync dma channel ID */ | 20 | int channel; /* sync dma channel ID */ |
22 | unsigned short acnt; | 21 | unsigned short acnt; |
23 | dma_addr_t dma_addr; /* device physical address for DMA */ | 22 | dma_addr_t dma_addr; /* device physical address for DMA */ |
diff --git a/sound/soc/imx/mxc-ssi.c b/sound/soc/imx/mxc-ssi.c index 3806ff2c0cd4..ccdefe60e752 100644 --- a/sound/soc/imx/mxc-ssi.c +++ b/sound/soc/imx/mxc-ssi.c | |||
@@ -397,14 +397,6 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
397 | break; | 397 | break; |
398 | } | 398 | } |
399 | 399 | ||
400 | /* sync */ | ||
401 | if (!(fmt & SND_SOC_DAIFMT_ASYNC)) | ||
402 | scr |= SSI_SCR_SYN; | ||
403 | |||
404 | /* tdm - only for stereo atm */ | ||
405 | if (fmt & SND_SOC_DAIFMT_TDM) | ||
406 | scr |= SSI_SCR_NET; | ||
407 | |||
408 | if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI2) { | 400 | if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI2) { |
409 | SSI1_STCR = stcr; | 401 | SSI1_STCR = stcr; |
410 | SSI1_SRCR = srcr; | 402 | SSI1_SRCR = srcr; |
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 6375b4ea525d..dcb3181bb340 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -138,7 +138,7 @@ config SND_PXA2XX_SOC_MIOA701 | |||
138 | 138 | ||
139 | config SND_PXA2XX_SOC_IMOTE2 | 139 | config SND_PXA2XX_SOC_IMOTE2 |
140 | tristate "SoC Audio support for IMote 2" | 140 | tristate "SoC Audio support for IMote 2" |
141 | depends on SND_PXA2XX_SOC && MACH_INTELMOTE2 | 141 | depends on SND_PXA2XX_SOC && MACH_INTELMOTE2 && I2C |
142 | select SND_PXA2XX_SOC_I2S | 142 | select SND_PXA2XX_SOC_I2S |
143 | select SND_SOC_WM8940 | 143 | select SND_SOC_WM8940 |
144 | help | 144 | help |
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 5b9ed6464789..d11a6d7e384a 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -351,7 +351,7 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, | |||
351 | do_div(tmp, freq_out); | 351 | do_div(tmp, freq_out); |
352 | val = tmp; | 352 | val = tmp; |
353 | 353 | ||
354 | val = (val << 16) | 64;; | 354 | val = (val << 16) | 64; |
355 | ssp_write_reg(ssp, SSACDD, val); | 355 | ssp_write_reg(ssp, SSACDD, val); |
356 | 356 | ||
357 | ssacd |= (0x6 << 4); | 357 | ssacd |= (0x6 << 4); |
diff --git a/sound/soc/s3c24xx/s3c24xx_uda134x.c b/sound/soc/s3c24xx/s3c24xx_uda134x.c index 8e79a416db57..c215d32d6322 100644 --- a/sound/soc/s3c24xx/s3c24xx_uda134x.c +++ b/sound/soc/s3c24xx/s3c24xx_uda134x.c | |||
@@ -67,7 +67,7 @@ static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream) | |||
67 | { | 67 | { |
68 | int ret = 0; | 68 | int ret = 0; |
69 | #ifdef ENFORCE_RATES | 69 | #ifdef ENFORCE_RATES |
70 | struct snd_pcm_runtime *runtime = substream->runtime;; | 70 | struct snd_pcm_runtime *runtime = substream->runtime; |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | mutex_lock(&clk_lock); | 73 | mutex_lock(&clk_lock); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index f79711b9fa5b..8de6f9dec4a2 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -524,7 +524,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget) | |||
524 | 524 | ||
525 | /* connected jack or spk ? */ | 525 | /* connected jack or spk ? */ |
526 | if (widget->id == snd_soc_dapm_hp || widget->id == snd_soc_dapm_spk || | 526 | if (widget->id == snd_soc_dapm_hp || widget->id == snd_soc_dapm_spk || |
527 | widget->id == snd_soc_dapm_line) | 527 | (widget->id == snd_soc_dapm_line && !list_empty(&widget->sources))) |
528 | return 1; | 528 | return 1; |
529 | } | 529 | } |
530 | 530 | ||
@@ -573,7 +573,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) | |||
573 | return 1; | 573 | return 1; |
574 | 574 | ||
575 | /* connected jack ? */ | 575 | /* connected jack ? */ |
576 | if (widget->id == snd_soc_dapm_mic || widget->id == snd_soc_dapm_line) | 576 | if (widget->id == snd_soc_dapm_mic || |
577 | (widget->id == snd_soc_dapm_line && !list_empty(&widget->sinks))) | ||
577 | return 1; | 578 | return 1; |
578 | } | 579 | } |
579 | 580 | ||
diff --git a/sound/sound_core.c b/sound/sound_core.c index bb4b88e606bb..49c998186592 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -29,7 +29,7 @@ MODULE_DESCRIPTION("Core sound module"); | |||
29 | MODULE_AUTHOR("Alan Cox"); | 29 | MODULE_AUTHOR("Alan Cox"); |
30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
31 | 31 | ||
32 | static char *sound_nodename(struct device *dev) | 32 | static char *sound_devnode(struct device *dev, mode_t *mode) |
33 | { | 33 | { |
34 | if (MAJOR(dev->devt) == SOUND_MAJOR) | 34 | if (MAJOR(dev->devt) == SOUND_MAJOR) |
35 | return NULL; | 35 | return NULL; |
@@ -50,7 +50,7 @@ static int __init init_soundcore(void) | |||
50 | return PTR_ERR(sound_class); | 50 | return PTR_ERR(sound_class); |
51 | } | 51 | } |
52 | 52 | ||
53 | sound_class->nodename = sound_nodename; | 53 | sound_class->devnode = sound_devnode; |
54 | 54 | ||
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 121af0644fd9..86b2c3b92df5 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -62,10 +62,14 @@ static void | |||
62 | activate_substream(struct snd_usb_caiaqdev *dev, | 62 | activate_substream(struct snd_usb_caiaqdev *dev, |
63 | struct snd_pcm_substream *sub) | 63 | struct snd_pcm_substream *sub) |
64 | { | 64 | { |
65 | spin_lock(&dev->spinlock); | ||
66 | |||
65 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) | 67 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) |
66 | dev->sub_playback[sub->number] = sub; | 68 | dev->sub_playback[sub->number] = sub; |
67 | else | 69 | else |
68 | dev->sub_capture[sub->number] = sub; | 70 | dev->sub_capture[sub->number] = sub; |
71 | |||
72 | spin_unlock(&dev->spinlock); | ||
69 | } | 73 | } |
70 | 74 | ||
71 | static void | 75 | static void |
@@ -269,16 +273,22 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub) | |||
269 | { | 273 | { |
270 | int index = sub->number; | 274 | int index = sub->number; |
271 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); | 275 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); |
276 | snd_pcm_uframes_t ptr; | ||
277 | |||
278 | spin_lock(&dev->spinlock); | ||
272 | 279 | ||
273 | if (dev->input_panic || dev->output_panic) | 280 | if (dev->input_panic || dev->output_panic) |
274 | return SNDRV_PCM_POS_XRUN; | 281 | ptr = SNDRV_PCM_POS_XRUN; |
275 | 282 | ||
276 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) | 283 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) |
277 | return bytes_to_frames(sub->runtime, | 284 | ptr = bytes_to_frames(sub->runtime, |
278 | dev->audio_out_buf_pos[index]); | 285 | dev->audio_out_buf_pos[index]); |
279 | else | 286 | else |
280 | return bytes_to_frames(sub->runtime, | 287 | ptr = bytes_to_frames(sub->runtime, |
281 | dev->audio_in_buf_pos[index]); | 288 | dev->audio_in_buf_pos[index]); |
289 | |||
290 | spin_unlock(&dev->spinlock); | ||
291 | return ptr; | ||
282 | } | 292 | } |
283 | 293 | ||
284 | /* operators for both playback and capture */ | 294 | /* operators for both playback and capture */ |
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 83e6c1312d47..a3f02dd97440 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "input.h" | 35 | #include "input.h" |
36 | 36 | ||
37 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); | 37 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); |
38 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.19"); | 38 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.20"); |
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," | 40 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," |
41 | "{Native Instruments, RigKontrol3}," | 41 | "{Native Instruments, RigKontrol3}," |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index ab5a3ac2ac47..9efcfd08d747 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -898,6 +898,11 @@ static struct snd_kcontrol_new usb_feature_unit_ctl = { | |||
898 | * build a feature control | 898 | * build a feature control |
899 | */ | 899 | */ |
900 | 900 | ||
901 | static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str) | ||
902 | { | ||
903 | return strlcat(kctl->id.name, str, sizeof(kctl->id.name)); | ||
904 | } | ||
905 | |||
901 | static void build_feature_ctl(struct mixer_build *state, unsigned char *desc, | 906 | static void build_feature_ctl(struct mixer_build *state, unsigned char *desc, |
902 | unsigned int ctl_mask, int control, | 907 | unsigned int ctl_mask, int control, |
903 | struct usb_audio_term *iterm, int unitid) | 908 | struct usb_audio_term *iterm, int unitid) |
@@ -978,13 +983,13 @@ static void build_feature_ctl(struct mixer_build *state, unsigned char *desc, | |||
978 | */ | 983 | */ |
979 | if (! mapped_name && ! (state->oterm.type >> 16)) { | 984 | if (! mapped_name && ! (state->oterm.type >> 16)) { |
980 | if ((state->oterm.type & 0xff00) == 0x0100) { | 985 | if ((state->oterm.type & 0xff00) == 0x0100) { |
981 | len = strlcat(kctl->id.name, " Capture", sizeof(kctl->id.name)); | 986 | len = append_ctl_name(kctl, " Capture"); |
982 | } else { | 987 | } else { |
983 | len = strlcat(kctl->id.name + len, " Playback", sizeof(kctl->id.name)); | 988 | len = append_ctl_name(kctl, " Playback"); |
984 | } | 989 | } |
985 | } | 990 | } |
986 | strlcat(kctl->id.name + len, control == USB_FEATURE_MUTE ? " Switch" : " Volume", | 991 | append_ctl_name(kctl, control == USB_FEATURE_MUTE ? |
987 | sizeof(kctl->id.name)); | 992 | " Switch" : " Volume"); |
988 | if (control == USB_FEATURE_VOLUME) { | 993 | if (control == USB_FEATURE_VOLUME) { |
989 | kctl->tlv.c = mixer_vol_tlv; | 994 | kctl->tlv.c = mixer_vol_tlv; |
990 | kctl->vd[0].access |= | 995 | kctl->vd[0].access |= |
@@ -1143,7 +1148,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state, unsigned char *desc, | |||
1143 | len = get_term_name(state, iterm, kctl->id.name, sizeof(kctl->id.name), 0); | 1148 | len = get_term_name(state, iterm, kctl->id.name, sizeof(kctl->id.name), 0); |
1144 | if (! len) | 1149 | if (! len) |
1145 | len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); | 1150 | len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); |
1146 | strlcat(kctl->id.name + len, " Volume", sizeof(kctl->id.name)); | 1151 | append_ctl_name(kctl, " Volume"); |
1147 | 1152 | ||
1148 | snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n", | 1153 | snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n", |
1149 | cval->id, kctl->id.name, cval->channels, cval->min, cval->max); | 1154 | cval->id, kctl->id.name, cval->channels, cval->min, cval->max); |
@@ -1400,8 +1405,8 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, unsigned | |||
1400 | if (! len) | 1405 | if (! len) |
1401 | strlcpy(kctl->id.name, name, sizeof(kctl->id.name)); | 1406 | strlcpy(kctl->id.name, name, sizeof(kctl->id.name)); |
1402 | } | 1407 | } |
1403 | strlcat(kctl->id.name, " ", sizeof(kctl->id.name)); | 1408 | append_ctl_name(kctl, " "); |
1404 | strlcat(kctl->id.name, valinfo->suffix, sizeof(kctl->id.name)); | 1409 | append_ctl_name(kctl, valinfo->suffix); |
1405 | 1410 | ||
1406 | snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n", | 1411 | snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n", |
1407 | cval->id, kctl->id.name, cval->channels, cval->min, cval->max); | 1412 | cval->id, kctl->id.name, cval->channels, cval->min, cval->max); |
@@ -1610,9 +1615,9 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi | |||
1610 | strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); | 1615 | strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); |
1611 | 1616 | ||
1612 | if ((state->oterm.type & 0xff00) == 0x0100) | 1617 | if ((state->oterm.type & 0xff00) == 0x0100) |
1613 | strlcat(kctl->id.name, " Capture Source", sizeof(kctl->id.name)); | 1618 | append_ctl_name(kctl, " Capture Source"); |
1614 | else | 1619 | else |
1615 | strlcat(kctl->id.name, " Playback Source", sizeof(kctl->id.name)); | 1620 | append_ctl_name(kctl, " Playback Source"); |
1616 | } | 1621 | } |
1617 | 1622 | ||
1618 | snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n", | 1623 | snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n", |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index b54e8ca360d1..00cd54c236b4 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -176,7 +176,7 @@ static void usb_stream_hwdep_vm_close(struct vm_area_struct *area) | |||
176 | snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); | 176 | snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); |
177 | } | 177 | } |
178 | 178 | ||
179 | static struct vm_operations_struct usb_stream_hwdep_vm_ops = { | 179 | static const struct vm_operations_struct usb_stream_hwdep_vm_ops = { |
180 | .open = usb_stream_hwdep_vm_open, | 180 | .open = usb_stream_hwdep_vm_open, |
181 | .fault = usb_stream_hwdep_vm_fault, | 181 | .fault = usb_stream_hwdep_vm_fault, |
182 | .close = usb_stream_hwdep_vm_close, | 182 | .close = usb_stream_hwdep_vm_close, |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index f3d8f71265dd..52e04b2f35d3 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -53,7 +53,7 @@ static int snd_us428ctls_vm_fault(struct vm_area_struct *area, | |||
53 | return 0; | 53 | return 0; |
54 | } | 54 | } |
55 | 55 | ||
56 | static struct vm_operations_struct us428ctls_vm_ops = { | 56 | static const struct vm_operations_struct us428ctls_vm_ops = { |
57 | .fault = snd_us428ctls_vm_fault, | 57 | .fault = snd_us428ctls_vm_fault, |
58 | }; | 58 | }; |
59 | 59 | ||
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 117946f2debb..4b2304c2e02d 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -697,7 +697,7 @@ static int snd_usX2Y_hwdep_pcm_vm_fault(struct vm_area_struct *area, | |||
697 | } | 697 | } |
698 | 698 | ||
699 | 699 | ||
700 | static struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { | 700 | static const struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { |
701 | .open = snd_usX2Y_hwdep_pcm_vm_open, | 701 | .open = snd_usX2Y_hwdep_pcm_vm_open, |
702 | .close = snd_usX2Y_hwdep_pcm_vm_close, | 702 | .close = snd_usX2Y_hwdep_pcm_vm_close, |
703 | .fault = snd_usX2Y_hwdep_pcm_vm_fault, | 703 | .fault = snd_usX2Y_hwdep_pcm_vm_fault, |