diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-01-17 06:01:12 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-17 06:01:12 -0500 |
commit | d1a020050c6ce1a0794ff73582ccf47e4db536f7 (patch) | |
tree | 1b7250410f24703cd77c76156e758db9887137aa /sound | |
parent | dc61b66fc724f89d357c43e2319d2cb7bec1e517 (diff) | |
parent | 641b4879444c0edb276fedca5c2fcbd2e5c70044 (diff) |
Merge branch 'topic/usb-mixer-cache' into next/usb-audio
Diffstat (limited to 'sound')
34 files changed, 790 insertions, 380 deletions
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index ef6539eea579..35afd0c33be5 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c | |||
@@ -321,10 +321,6 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | |||
321 | { | 321 | { |
322 | int ret; | 322 | int ret; |
323 | 323 | ||
324 | ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL); | ||
325 | if (ret < 0) | ||
326 | goto err; | ||
327 | |||
328 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) { | 324 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) { |
329 | pxa_gpio_mode(GPIO31_SYNC_AC97_MD); | 325 | pxa_gpio_mode(GPIO31_SYNC_AC97_MD); |
330 | pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); | 326 | pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); |
@@ -339,7 +335,7 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | |||
339 | if (IS_ERR(ac97conf_clk)) { | 335 | if (IS_ERR(ac97conf_clk)) { |
340 | ret = PTR_ERR(ac97conf_clk); | 336 | ret = PTR_ERR(ac97conf_clk); |
341 | ac97conf_clk = NULL; | 337 | ac97conf_clk = NULL; |
342 | goto err_irq; | 338 | goto err_conf; |
343 | } | 339 | } |
344 | } | 340 | } |
345 | 341 | ||
@@ -347,19 +343,30 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | |||
347 | if (IS_ERR(ac97_clk)) { | 343 | if (IS_ERR(ac97_clk)) { |
348 | ret = PTR_ERR(ac97_clk); | 344 | ret = PTR_ERR(ac97_clk); |
349 | ac97_clk = NULL; | 345 | ac97_clk = NULL; |
350 | goto err_irq; | 346 | goto err_clk; |
351 | } | 347 | } |
352 | 348 | ||
353 | return clk_enable(ac97_clk); | 349 | ret = clk_enable(ac97_clk); |
350 | if (ret) | ||
351 | goto err_clk2; | ||
352 | |||
353 | ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, IRQF_DISABLED, "AC97", NULL); | ||
354 | if (ret < 0) | ||
355 | goto err_irq; | ||
356 | |||
357 | return 0; | ||
354 | 358 | ||
355 | err_irq: | 359 | err_irq: |
356 | GCR |= GCR_ACLINK_OFF; | 360 | GCR |= GCR_ACLINK_OFF; |
361 | err_clk2: | ||
362 | clk_put(ac97_clk); | ||
363 | ac97_clk = NULL; | ||
364 | err_clk: | ||
357 | if (ac97conf_clk) { | 365 | if (ac97conf_clk) { |
358 | clk_put(ac97conf_clk); | 366 | clk_put(ac97conf_clk); |
359 | ac97conf_clk = NULL; | 367 | ac97conf_clk = NULL; |
360 | } | 368 | } |
361 | free_irq(IRQ_AC97, NULL); | 369 | err_conf: |
362 | err: | ||
363 | return ret; | 370 | return ret; |
364 | } | 371 | } |
365 | EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); | 372 | EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 44a69bb8d4f0..7872a02f6ca9 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -152,6 +152,10 @@ static int __snd_open(struct inode *inode, struct file *file) | |||
152 | } | 152 | } |
153 | old_fops = file->f_op; | 153 | old_fops = file->f_op; |
154 | file->f_op = fops_get(mptr->f_ops); | 154 | file->f_op = fops_get(mptr->f_ops); |
155 | if (file->f_op == NULL) { | ||
156 | file->f_op = old_fops; | ||
157 | return -ENODEV; | ||
158 | } | ||
155 | if (file->f_op->open) | 159 | if (file->f_op->open) |
156 | err = file->f_op->open(inode, file); | 160 | err = file->f_op->open(inode, file); |
157 | if (err) { | 161 | if (err) { |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 549b4eba1496..9d98a6658ac9 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -84,7 +84,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea) | |||
84 | * Linux Video interface | 84 | * Linux Video interface |
85 | */ | 85 | */ |
86 | 86 | ||
87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, | 87 | static long snd_tea575x_ioctl(struct file *file, |
88 | unsigned int cmd, unsigned long data) | 88 | unsigned int cmd, unsigned long data) |
89 | { | 89 | { |
90 | struct snd_tea575x *tea = video_drvdata(file); | 90 | struct snd_tea575x *tea = video_drvdata(file); |
@@ -174,14 +174,14 @@ static void snd_tea575x_release(struct video_device *vfd) | |||
174 | { | 174 | { |
175 | } | 175 | } |
176 | 176 | ||
177 | static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) | 177 | static int snd_tea575x_exclusive_open(struct file *file) |
178 | { | 178 | { |
179 | struct snd_tea575x *tea = video_drvdata(file); | 179 | struct snd_tea575x *tea = video_drvdata(file); |
180 | 180 | ||
181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; | 181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; |
182 | } | 182 | } |
183 | 183 | ||
184 | static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) | 184 | static int snd_tea575x_exclusive_release(struct file *file) |
185 | { | 185 | { |
186 | struct snd_tea575x *tea = video_drvdata(file); | 186 | struct snd_tea575x *tea = video_drvdata(file); |
187 | 187 | ||
diff --git a/sound/oss/aedsp16.c b/sound/oss/aedsp16.c index a0274f3dac08..3ee9900ffd7b 100644 --- a/sound/oss/aedsp16.c +++ b/sound/oss/aedsp16.c | |||
@@ -157,7 +157,7 @@ | |||
157 | 157 | ||
158 | Started Fri Mar 17 16:13:18 MET 1995 | 158 | Started Fri Mar 17 16:13:18 MET 1995 |
159 | 159 | ||
160 | v0.1 (ALPHA, was an user-level program called AudioExcelDSP16.c) | 160 | v0.1 (ALPHA, was a user-level program called AudioExcelDSP16.c) |
161 | - Initial code. | 161 | - Initial code. |
162 | v0.2 (ALPHA) | 162 | v0.2 (ALPHA) |
163 | - Cleanups. | 163 | - Cleanups. |
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 4d45bd63718b..57d9f154c88b 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c | |||
@@ -851,8 +851,9 @@ static int __init AtaIrqInit(void) | |||
851 | mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ | 851 | mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ |
852 | mfp.tim_ct_a = 8; /* Turn on event counting. */ | 852 | mfp.tim_ct_a = 8; /* Turn on event counting. */ |
853 | /* Register interrupt handler. */ | 853 | /* Register interrupt handler. */ |
854 | request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", | 854 | if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", |
855 | AtaInterrupt); | 855 | AtaInterrupt)) |
856 | return 0; | ||
856 | mfp.int_en_a |= 0x20; /* Turn interrupt on. */ | 857 | mfp.int_en_a |= 0x20; /* Turn interrupt on. */ |
857 | mfp.int_mk_a |= 0x20; | 858 | mfp.int_mk_a |= 0x20; |
858 | return 1; | 859 | return 1; |
diff --git a/sound/oss/dmasound/dmasound_q40.c b/sound/oss/dmasound/dmasound_q40.c index 1855b14d90c3..99bcb21c2281 100644 --- a/sound/oss/dmasound/dmasound_q40.c +++ b/sound/oss/dmasound/dmasound_q40.c | |||
@@ -371,8 +371,9 @@ static void Q40Free(void *ptr, unsigned int size) | |||
371 | static int __init Q40IrqInit(void) | 371 | static int __init Q40IrqInit(void) |
372 | { | 372 | { |
373 | /* Register interrupt handler. */ | 373 | /* Register interrupt handler. */ |
374 | request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, | 374 | if (request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, |
375 | "DMA sound", Q40Interrupt); | 375 | "DMA sound", Q40Interrupt)) |
376 | return 0; | ||
376 | 377 | ||
377 | return(1); | 378 | return(1); |
378 | } | 379 | } |
@@ -401,6 +402,7 @@ static void Q40PlayNextFrame(int index) | |||
401 | u_char *start; | 402 | u_char *start; |
402 | u_long size; | 403 | u_long size; |
403 | u_char speed; | 404 | u_char speed; |
405 | int error; | ||
404 | 406 | ||
405 | /* used by Q40Play() if all doubts whether there really is something | 407 | /* used by Q40Play() if all doubts whether there really is something |
406 | * to be played are already wiped out. | 408 | * to be played are already wiped out. |
@@ -419,11 +421,13 @@ static void Q40PlayNextFrame(int index) | |||
419 | master_outb( 0,SAMPLE_ENABLE_REG); | 421 | master_outb( 0,SAMPLE_ENABLE_REG); |
420 | free_irq(Q40_IRQ_SAMPLE, Q40Interrupt); | 422 | free_irq(Q40_IRQ_SAMPLE, Q40Interrupt); |
421 | if (dmasound.soft.stereo) | 423 | if (dmasound.soft.stereo) |
422 | request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, | 424 | error = request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, |
423 | "Q40 sound", Q40Interrupt); | 425 | "Q40 sound", Q40Interrupt); |
424 | else | 426 | else |
425 | request_irq(Q40_IRQ_SAMPLE, Q40MonoInterrupt, 0, | 427 | error = request_irq(Q40_IRQ_SAMPLE, Q40MonoInterrupt, 0, |
426 | "Q40 sound", Q40Interrupt); | 428 | "Q40 sound", Q40Interrupt); |
429 | if (error && printk_ratelimit()) | ||
430 | pr_err("Couldn't register sound interrupt\n"); | ||
427 | 431 | ||
428 | master_outb( speed, SAMPLE_RATE_REG); | 432 | master_outb( speed, SAMPLE_RATE_REG); |
429 | master_outb( 1,SAMPLE_CLEAR_REG); | 433 | master_outb( 1,SAMPLE_CLEAR_REG); |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index e00421c0d8ba..960fd7970384 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -135,7 +135,6 @@ void snd_hda_detach_beep_device(struct hda_codec *codec) | |||
135 | struct hda_beep *beep = codec->beep; | 135 | struct hda_beep *beep = codec->beep; |
136 | if (beep) { | 136 | if (beep) { |
137 | cancel_work_sync(&beep->beep_work); | 137 | cancel_work_sync(&beep->beep_work); |
138 | flush_scheduled_work(); | ||
139 | 138 | ||
140 | input_unregister_device(beep->dev); | 139 | input_unregister_device(beep->dev); |
141 | kfree(beep); | 140 | kfree(beep); |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e16cf63821ae..3c596da2b9b5 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -373,7 +373,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex) | |||
373 | unsol->queue[wp] = res; | 373 | unsol->queue[wp] = res; |
374 | unsol->queue[wp + 1] = res_ex; | 374 | unsol->queue[wp + 1] = res_ex; |
375 | 375 | ||
376 | schedule_work(&unsol->work); | 376 | queue_work(bus->workq, &unsol->work); |
377 | 377 | ||
378 | return 0; | 378 | return 0; |
379 | } | 379 | } |
@@ -437,15 +437,17 @@ static int snd_hda_bus_free(struct hda_bus *bus) | |||
437 | 437 | ||
438 | if (!bus) | 438 | if (!bus) |
439 | return 0; | 439 | return 0; |
440 | if (bus->unsol) { | 440 | if (bus->workq) |
441 | flush_scheduled_work(); | 441 | flush_workqueue(bus->workq); |
442 | if (bus->unsol) | ||
442 | kfree(bus->unsol); | 443 | kfree(bus->unsol); |
443 | } | ||
444 | list_for_each_entry_safe(codec, n, &bus->codec_list, list) { | 444 | list_for_each_entry_safe(codec, n, &bus->codec_list, list) { |
445 | snd_hda_codec_free(codec); | 445 | snd_hda_codec_free(codec); |
446 | } | 446 | } |
447 | if (bus->ops.private_free) | 447 | if (bus->ops.private_free) |
448 | bus->ops.private_free(bus); | 448 | bus->ops.private_free(bus); |
449 | if (bus->workq) | ||
450 | destroy_workqueue(bus->workq); | ||
449 | kfree(bus); | 451 | kfree(bus); |
450 | return 0; | 452 | return 0; |
451 | } | 453 | } |
@@ -485,6 +487,7 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, | |||
485 | { | 487 | { |
486 | struct hda_bus *bus; | 488 | struct hda_bus *bus; |
487 | int err; | 489 | int err; |
490 | char qname[8]; | ||
488 | static struct snd_device_ops dev_ops = { | 491 | static struct snd_device_ops dev_ops = { |
489 | .dev_register = snd_hda_bus_dev_register, | 492 | .dev_register = snd_hda_bus_dev_register, |
490 | .dev_free = snd_hda_bus_dev_free, | 493 | .dev_free = snd_hda_bus_dev_free, |
@@ -514,6 +517,14 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, | |||
514 | mutex_init(&bus->cmd_mutex); | 517 | mutex_init(&bus->cmd_mutex); |
515 | INIT_LIST_HEAD(&bus->codec_list); | 518 | INIT_LIST_HEAD(&bus->codec_list); |
516 | 519 | ||
520 | snprintf(qname, sizeof(qname), "hda%d", card->number); | ||
521 | bus->workq = create_workqueue(qname); | ||
522 | if (!bus->workq) { | ||
523 | snd_printk(KERN_ERR "cannot create workqueue %s\n", qname); | ||
524 | kfree(bus); | ||
525 | return -ENOMEM; | ||
526 | } | ||
527 | |||
517 | err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops); | 528 | err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops); |
518 | if (err < 0) { | 529 | if (err < 0) { |
519 | snd_hda_bus_free(bus); | 530 | snd_hda_bus_free(bus); |
@@ -684,7 +695,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
684 | return; | 695 | return; |
685 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 696 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
686 | cancel_delayed_work(&codec->power_work); | 697 | cancel_delayed_work(&codec->power_work); |
687 | flush_scheduled_work(); | 698 | flush_workqueue(codec->bus->workq); |
688 | #endif | 699 | #endif |
689 | list_del(&codec->list); | 700 | list_del(&codec->list); |
690 | snd_array_free(&codec->mixers); | 701 | snd_array_free(&codec->mixers); |
@@ -735,6 +746,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
735 | codec->bus = bus; | 746 | codec->bus = bus; |
736 | codec->addr = codec_addr; | 747 | codec->addr = codec_addr; |
737 | mutex_init(&codec->spdif_mutex); | 748 | mutex_init(&codec->spdif_mutex); |
749 | mutex_init(&codec->control_mutex); | ||
738 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); | 750 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); |
739 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); | 751 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); |
740 | snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); | 752 | snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); |
@@ -1272,7 +1284,7 @@ void snd_hda_codec_reset(struct hda_codec *codec) | |||
1272 | 1284 | ||
1273 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1274 | cancel_delayed_work(&codec->power_work); | 1286 | cancel_delayed_work(&codec->power_work); |
1275 | flush_scheduled_work(); | 1287 | flush_workqueue(codec->bus->workq); |
1276 | #endif | 1288 | #endif |
1277 | snd_hda_ctls_clear(codec); | 1289 | snd_hda_ctls_clear(codec); |
1278 | /* relase PCMs */ | 1290 | /* relase PCMs */ |
@@ -1418,12 +1430,12 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, | |||
1418 | unsigned long pval; | 1430 | unsigned long pval; |
1419 | int err; | 1431 | int err; |
1420 | 1432 | ||
1421 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1433 | mutex_lock(&codec->control_mutex); |
1422 | pval = kcontrol->private_value; | 1434 | pval = kcontrol->private_value; |
1423 | kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ | 1435 | kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ |
1424 | err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); | 1436 | err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); |
1425 | kcontrol->private_value = pval; | 1437 | kcontrol->private_value = pval; |
1426 | mutex_unlock(&codec->spdif_mutex); | 1438 | mutex_unlock(&codec->control_mutex); |
1427 | return err; | 1439 | return err; |
1428 | } | 1440 | } |
1429 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get); | 1441 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get); |
@@ -1435,7 +1447,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, | |||
1435 | unsigned long pval; | 1447 | unsigned long pval; |
1436 | int i, indices, err = 0, change = 0; | 1448 | int i, indices, err = 0, change = 0; |
1437 | 1449 | ||
1438 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1450 | mutex_lock(&codec->control_mutex); |
1439 | pval = kcontrol->private_value; | 1451 | pval = kcontrol->private_value; |
1440 | indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; | 1452 | indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; |
1441 | for (i = 0; i < indices; i++) { | 1453 | for (i = 0; i < indices; i++) { |
@@ -1447,7 +1459,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, | |||
1447 | change |= err; | 1459 | change |= err; |
1448 | } | 1460 | } |
1449 | kcontrol->private_value = pval; | 1461 | kcontrol->private_value = pval; |
1450 | mutex_unlock(&codec->spdif_mutex); | 1462 | mutex_unlock(&codec->control_mutex); |
1451 | return err < 0 ? err : change; | 1463 | return err < 0 ? err : change; |
1452 | } | 1464 | } |
1453 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put); | 1465 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put); |
@@ -1462,12 +1474,12 @@ int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol, | |||
1462 | struct hda_bind_ctls *c; | 1474 | struct hda_bind_ctls *c; |
1463 | int err; | 1475 | int err; |
1464 | 1476 | ||
1465 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1477 | mutex_lock(&codec->control_mutex); |
1466 | c = (struct hda_bind_ctls *)kcontrol->private_value; | 1478 | c = (struct hda_bind_ctls *)kcontrol->private_value; |
1467 | kcontrol->private_value = *c->values; | 1479 | kcontrol->private_value = *c->values; |
1468 | err = c->ops->info(kcontrol, uinfo); | 1480 | err = c->ops->info(kcontrol, uinfo); |
1469 | kcontrol->private_value = (long)c; | 1481 | kcontrol->private_value = (long)c; |
1470 | mutex_unlock(&codec->spdif_mutex); | 1482 | mutex_unlock(&codec->control_mutex); |
1471 | return err; | 1483 | return err; |
1472 | } | 1484 | } |
1473 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info); | 1485 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info); |
@@ -1479,12 +1491,12 @@ int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, | |||
1479 | struct hda_bind_ctls *c; | 1491 | struct hda_bind_ctls *c; |
1480 | int err; | 1492 | int err; |
1481 | 1493 | ||
1482 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1494 | mutex_lock(&codec->control_mutex); |
1483 | c = (struct hda_bind_ctls *)kcontrol->private_value; | 1495 | c = (struct hda_bind_ctls *)kcontrol->private_value; |
1484 | kcontrol->private_value = *c->values; | 1496 | kcontrol->private_value = *c->values; |
1485 | err = c->ops->get(kcontrol, ucontrol); | 1497 | err = c->ops->get(kcontrol, ucontrol); |
1486 | kcontrol->private_value = (long)c; | 1498 | kcontrol->private_value = (long)c; |
1487 | mutex_unlock(&codec->spdif_mutex); | 1499 | mutex_unlock(&codec->control_mutex); |
1488 | return err; | 1500 | return err; |
1489 | } | 1501 | } |
1490 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get); | 1502 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get); |
@@ -1497,7 +1509,7 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, | |||
1497 | unsigned long *vals; | 1509 | unsigned long *vals; |
1498 | int err = 0, change = 0; | 1510 | int err = 0, change = 0; |
1499 | 1511 | ||
1500 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1512 | mutex_lock(&codec->control_mutex); |
1501 | c = (struct hda_bind_ctls *)kcontrol->private_value; | 1513 | c = (struct hda_bind_ctls *)kcontrol->private_value; |
1502 | for (vals = c->values; *vals; vals++) { | 1514 | for (vals = c->values; *vals; vals++) { |
1503 | kcontrol->private_value = *vals; | 1515 | kcontrol->private_value = *vals; |
@@ -1507,7 +1519,7 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, | |||
1507 | change |= err; | 1519 | change |= err; |
1508 | } | 1520 | } |
1509 | kcontrol->private_value = (long)c; | 1521 | kcontrol->private_value = (long)c; |
1510 | mutex_unlock(&codec->spdif_mutex); | 1522 | mutex_unlock(&codec->control_mutex); |
1511 | return err < 0 ? err : change; | 1523 | return err < 0 ? err : change; |
1512 | } | 1524 | } |
1513 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put); | 1525 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put); |
@@ -1519,12 +1531,12 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |||
1519 | struct hda_bind_ctls *c; | 1531 | struct hda_bind_ctls *c; |
1520 | int err; | 1532 | int err; |
1521 | 1533 | ||
1522 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1534 | mutex_lock(&codec->control_mutex); |
1523 | c = (struct hda_bind_ctls *)kcontrol->private_value; | 1535 | c = (struct hda_bind_ctls *)kcontrol->private_value; |
1524 | kcontrol->private_value = *c->values; | 1536 | kcontrol->private_value = *c->values; |
1525 | err = c->ops->tlv(kcontrol, op_flag, size, tlv); | 1537 | err = c->ops->tlv(kcontrol, op_flag, size, tlv); |
1526 | kcontrol->private_value = (long)c; | 1538 | kcontrol->private_value = (long)c; |
1527 | mutex_unlock(&codec->spdif_mutex); | 1539 | mutex_unlock(&codec->control_mutex); |
1528 | return err; | 1540 | return err; |
1529 | } | 1541 | } |
1530 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv); | 1542 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv); |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 729fc7642d7f..5810ef588402 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -614,6 +614,7 @@ struct hda_bus { | |||
614 | 614 | ||
615 | /* unsolicited event queue */ | 615 | /* unsolicited event queue */ |
616 | struct hda_bus_unsolicited *unsol; | 616 | struct hda_bus_unsolicited *unsol; |
617 | struct workqueue_struct *workq; /* common workqueue for codecs */ | ||
617 | 618 | ||
618 | /* assigned PCMs */ | 619 | /* assigned PCMs */ |
619 | DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES); | 620 | DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES); |
@@ -771,6 +772,7 @@ struct hda_codec { | |||
771 | struct hda_cache_rec cmd_cache; /* cache for other commands */ | 772 | struct hda_cache_rec cmd_cache; /* cache for other commands */ |
772 | 773 | ||
773 | struct mutex spdif_mutex; | 774 | struct mutex spdif_mutex; |
775 | struct mutex control_mutex; | ||
774 | unsigned int spdif_status; /* IEC958 status bits */ | 776 | unsigned int spdif_status; /* IEC958 status bits */ |
775 | unsigned short spdif_ctls; /* SPDIF control bits */ | 777 | unsigned short spdif_ctls; /* SPDIF control bits */ |
776 | unsigned int spdif_in_enable; /* SPDIF input enable? */ | 778 | unsigned int spdif_in_enable; /* SPDIF input enable? */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index f04de115ee11..11e791b965f6 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -996,10 +996,11 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
996 | spin_unlock(&chip->reg_lock); | 996 | spin_unlock(&chip->reg_lock); |
997 | snd_pcm_period_elapsed(azx_dev->substream); | 997 | snd_pcm_period_elapsed(azx_dev->substream); |
998 | spin_lock(&chip->reg_lock); | 998 | spin_lock(&chip->reg_lock); |
999 | } else { | 999 | } else if (chip->bus && chip->bus->workq) { |
1000 | /* bogus IRQ, process it later */ | 1000 | /* bogus IRQ, process it later */ |
1001 | azx_dev->irq_pending = 1; | 1001 | azx_dev->irq_pending = 1; |
1002 | schedule_work(&chip->irq_pending_work); | 1002 | queue_work(chip->bus->workq, |
1003 | &chip->irq_pending_work); | ||
1003 | } | 1004 | } |
1004 | } | 1005 | } |
1005 | } | 1006 | } |
@@ -1741,7 +1742,6 @@ static void azx_clear_irq_pending(struct azx *chip) | |||
1741 | for (i = 0; i < chip->num_streams; i++) | 1742 | for (i = 0; i < chip->num_streams; i++) |
1742 | chip->azx_dev[i].irq_pending = 0; | 1743 | chip->azx_dev[i].irq_pending = 0; |
1743 | spin_unlock_irq(&chip->reg_lock); | 1744 | spin_unlock_irq(&chip->reg_lock); |
1744 | flush_scheduled_work(); | ||
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | static struct snd_pcm_ops azx_pcm_ops = { | 1747 | static struct snd_pcm_ops azx_pcm_ops = { |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 26247cfe749d..2e7371ec2e23 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -3900,6 +3900,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = { | |||
3900 | 3900 | ||
3901 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | 3901 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { |
3902 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), | 3902 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), |
3903 | SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), | ||
3903 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), | 3904 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), |
3904 | SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), | 3905 | SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), |
3905 | SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), | 3906 | SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), |
@@ -4262,13 +4263,13 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4262 | spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids); | 4263 | spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids); |
4263 | spec->adc_nids = ad1882_adc_nids; | 4264 | spec->adc_nids = ad1882_adc_nids; |
4264 | spec->capsrc_nids = ad1882_capsrc_nids; | 4265 | spec->capsrc_nids = ad1882_capsrc_nids; |
4265 | if (codec->vendor_id == 0x11d1882) | 4266 | if (codec->vendor_id == 0x11d41882) |
4266 | spec->input_mux = &ad1882_capture_source; | 4267 | spec->input_mux = &ad1882_capture_source; |
4267 | else | 4268 | else |
4268 | spec->input_mux = &ad1882a_capture_source; | 4269 | spec->input_mux = &ad1882a_capture_source; |
4269 | spec->num_mixers = 2; | 4270 | spec->num_mixers = 2; |
4270 | spec->mixers[0] = ad1882_base_mixers; | 4271 | spec->mixers[0] = ad1882_base_mixers; |
4271 | if (codec->vendor_id == 0x11d1882) | 4272 | if (codec->vendor_id == 0x11d41882) |
4272 | spec->mixers[1] = ad1882_loopback_mixers; | 4273 | spec->mixers[1] = ad1882_loopback_mixers; |
4273 | else | 4274 | else |
4274 | spec->mixers[1] = ad1882a_loopback_mixers; | 4275 | spec->mixers[1] = ad1882a_loopback_mixers; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index b20e1cede00b..75de40aaab0a 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <sound/core.h> | 27 | #include <sound/core.h> |
28 | #include <sound/jack.h> | ||
29 | |||
28 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
29 | #include "hda_local.h" | 31 | #include "hda_local.h" |
30 | 32 | ||
@@ -37,8 +39,21 @@ | |||
37 | #define CONEXANT_HP_EVENT 0x37 | 39 | #define CONEXANT_HP_EVENT 0x37 |
38 | #define CONEXANT_MIC_EVENT 0x38 | 40 | #define CONEXANT_MIC_EVENT 0x38 |
39 | 41 | ||
42 | /* Conexant 5051 specific */ | ||
43 | |||
44 | #define CXT5051_SPDIF_OUT 0x1C | ||
45 | #define CXT5051_PORTB_EVENT 0x38 | ||
46 | #define CXT5051_PORTC_EVENT 0x39 | ||
40 | 47 | ||
41 | 48 | ||
49 | struct conexant_jack { | ||
50 | |||
51 | hda_nid_t nid; | ||
52 | int type; | ||
53 | struct snd_jack *jack; | ||
54 | |||
55 | }; | ||
56 | |||
42 | struct conexant_spec { | 57 | struct conexant_spec { |
43 | 58 | ||
44 | struct snd_kcontrol_new *mixers[5]; | 59 | struct snd_kcontrol_new *mixers[5]; |
@@ -83,6 +98,9 @@ struct conexant_spec { | |||
83 | 98 | ||
84 | unsigned int spdif_route; | 99 | unsigned int spdif_route; |
85 | 100 | ||
101 | /* jack detection */ | ||
102 | struct snd_array jacks; | ||
103 | |||
86 | /* dynamic controls, init_verbs and input_mux */ | 104 | /* dynamic controls, init_verbs and input_mux */ |
87 | struct auto_pin_cfg autocfg; | 105 | struct auto_pin_cfg autocfg; |
88 | struct hda_input_mux private_imux; | 106 | struct hda_input_mux private_imux; |
@@ -329,6 +347,86 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
329 | &spec->cur_mux[adc_idx]); | 347 | &spec->cur_mux[adc_idx]); |
330 | } | 348 | } |
331 | 349 | ||
350 | static int conexant_add_jack(struct hda_codec *codec, | ||
351 | hda_nid_t nid, int type) | ||
352 | { | ||
353 | struct conexant_spec *spec; | ||
354 | struct conexant_jack *jack; | ||
355 | const char *name; | ||
356 | |||
357 | spec = codec->spec; | ||
358 | snd_array_init(&spec->jacks, sizeof(*jack), 32); | ||
359 | jack = snd_array_new(&spec->jacks); | ||
360 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; | ||
361 | |||
362 | if (!jack) | ||
363 | return -ENOMEM; | ||
364 | |||
365 | jack->nid = nid; | ||
366 | jack->type = type; | ||
367 | |||
368 | return snd_jack_new(codec->bus->card, name, type, &jack->jack); | ||
369 | } | ||
370 | |||
371 | static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) | ||
372 | { | ||
373 | struct conexant_spec *spec = codec->spec; | ||
374 | struct conexant_jack *jacks = spec->jacks.list; | ||
375 | |||
376 | if (jacks) { | ||
377 | int i; | ||
378 | for (i = 0; i < spec->jacks.used; i++) { | ||
379 | if (jacks->nid == nid) { | ||
380 | unsigned int present; | ||
381 | present = snd_hda_codec_read(codec, nid, 0, | ||
382 | AC_VERB_GET_PIN_SENSE, 0) & | ||
383 | AC_PINSENSE_PRESENCE; | ||
384 | |||
385 | present = (present) ? jacks->type : 0 ; | ||
386 | |||
387 | snd_jack_report(jacks->jack, | ||
388 | present); | ||
389 | } | ||
390 | jacks++; | ||
391 | } | ||
392 | } | ||
393 | } | ||
394 | |||
395 | static int conexant_init_jacks(struct hda_codec *codec) | ||
396 | { | ||
397 | #ifdef CONFIG_SND_JACK | ||
398 | struct conexant_spec *spec = codec->spec; | ||
399 | int i; | ||
400 | |||
401 | for (i = 0; i < spec->num_init_verbs; i++) { | ||
402 | const struct hda_verb *hv; | ||
403 | |||
404 | hv = spec->init_verbs[i]; | ||
405 | while (hv->nid) { | ||
406 | int err = 0; | ||
407 | switch (hv->param ^ AC_USRSP_EN) { | ||
408 | case CONEXANT_HP_EVENT: | ||
409 | err = conexant_add_jack(codec, hv->nid, | ||
410 | SND_JACK_HEADPHONE); | ||
411 | conexant_report_jack(codec, hv->nid); | ||
412 | break; | ||
413 | case CXT5051_PORTC_EVENT: | ||
414 | case CONEXANT_MIC_EVENT: | ||
415 | err = conexant_add_jack(codec, hv->nid, | ||
416 | SND_JACK_MICROPHONE); | ||
417 | conexant_report_jack(codec, hv->nid); | ||
418 | break; | ||
419 | } | ||
420 | if (err < 0) | ||
421 | return err; | ||
422 | ++hv; | ||
423 | } | ||
424 | } | ||
425 | #endif | ||
426 | return 0; | ||
427 | |||
428 | } | ||
429 | |||
332 | static int conexant_init(struct hda_codec *codec) | 430 | static int conexant_init(struct hda_codec *codec) |
333 | { | 431 | { |
334 | struct conexant_spec *spec = codec->spec; | 432 | struct conexant_spec *spec = codec->spec; |
@@ -341,6 +439,16 @@ static int conexant_init(struct hda_codec *codec) | |||
341 | 439 | ||
342 | static void conexant_free(struct hda_codec *codec) | 440 | static void conexant_free(struct hda_codec *codec) |
343 | { | 441 | { |
442 | #ifdef CONFIG_SND_JACK | ||
443 | struct conexant_spec *spec = codec->spec; | ||
444 | if (spec->jacks.list) { | ||
445 | struct conexant_jack *jacks = spec->jacks.list; | ||
446 | int i; | ||
447 | for (i = 0; i < spec->jacks.used; i++) | ||
448 | snd_device_free(codec->bus->card, &jacks[i].jack); | ||
449 | snd_array_free(&spec->jacks); | ||
450 | } | ||
451 | #endif | ||
344 | kfree(codec->spec); | 452 | kfree(codec->spec); |
345 | } | 453 | } |
346 | 454 | ||
@@ -1526,9 +1634,6 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1526 | /* Conexant 5051 specific */ | 1634 | /* Conexant 5051 specific */ |
1527 | static hda_nid_t cxt5051_dac_nids[1] = { 0x10 }; | 1635 | static hda_nid_t cxt5051_dac_nids[1] = { 0x10 }; |
1528 | static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 }; | 1636 | static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 }; |
1529 | #define CXT5051_SPDIF_OUT 0x1C | ||
1530 | #define CXT5051_PORTB_EVENT 0x38 | ||
1531 | #define CXT5051_PORTC_EVENT 0x39 | ||
1532 | 1637 | ||
1533 | static struct hda_channel_mode cxt5051_modes[1] = { | 1638 | static struct hda_channel_mode cxt5051_modes[1] = { |
1534 | { 2, NULL }, | 1639 | { 2, NULL }, |
@@ -1608,6 +1713,7 @@ static void cxt5051_hp_automute(struct hda_codec *codec) | |||
1608 | static void cxt5051_hp_unsol_event(struct hda_codec *codec, | 1713 | static void cxt5051_hp_unsol_event(struct hda_codec *codec, |
1609 | unsigned int res) | 1714 | unsigned int res) |
1610 | { | 1715 | { |
1716 | int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; | ||
1611 | switch (res >> 26) { | 1717 | switch (res >> 26) { |
1612 | case CONEXANT_HP_EVENT: | 1718 | case CONEXANT_HP_EVENT: |
1613 | cxt5051_hp_automute(codec); | 1719 | cxt5051_hp_automute(codec); |
@@ -1619,6 +1725,7 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec, | |||
1619 | cxt5051_portc_automic(codec); | 1725 | cxt5051_portc_automic(codec); |
1620 | break; | 1726 | break; |
1621 | } | 1727 | } |
1728 | conexant_report_jack(codec, nid); | ||
1622 | } | 1729 | } |
1623 | 1730 | ||
1624 | static struct snd_kcontrol_new cxt5051_mixers[] = { | 1731 | static struct snd_kcontrol_new cxt5051_mixers[] = { |
@@ -1693,6 +1800,7 @@ static struct hda_verb cxt5051_init_verbs[] = { | |||
1693 | static int cxt5051_init(struct hda_codec *codec) | 1800 | static int cxt5051_init(struct hda_codec *codec) |
1694 | { | 1801 | { |
1695 | conexant_init(codec); | 1802 | conexant_init(codec); |
1803 | conexant_init_jacks(codec); | ||
1696 | if (codec->patch_ops.unsol_event) { | 1804 | if (codec->patch_ops.unsol_event) { |
1697 | cxt5051_hp_automute(codec); | 1805 | cxt5051_hp_automute(codec); |
1698 | cxt5051_portb_automic(codec); | 1806 | cxt5051_portb_automic(codec); |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 0270fda0bda5..96952a37d884 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -162,12 +162,14 @@ static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | |||
162 | { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi }, | 162 | { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi }, |
163 | { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi }, | 163 | { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi }, |
164 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi }, | 164 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi }, |
165 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi }, | ||
165 | {} /* terminator */ | 166 | {} /* terminator */ |
166 | }; | 167 | }; |
167 | 168 | ||
168 | MODULE_ALIAS("snd-hda-codec-id:10de0002"); | 169 | MODULE_ALIAS("snd-hda-codec-id:10de0002"); |
169 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); | 170 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); |
170 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); | 171 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); |
172 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); | ||
171 | 173 | ||
172 | MODULE_LICENSE("GPL"); | 174 | MODULE_LICENSE("GPL"); |
173 | MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec"); | 175 | MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec"); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0bd4e6bf354d..ea4c88fe05c4 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1502,11 +1502,11 @@ static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, | |||
1502 | struct alc_spec *spec = codec->spec; | 1502 | struct alc_spec *spec = codec->spec; |
1503 | int err; | 1503 | int err; |
1504 | 1504 | ||
1505 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1505 | mutex_lock(&codec->control_mutex); |
1506 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | 1506 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
1507 | HDA_INPUT); | 1507 | HDA_INPUT); |
1508 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | 1508 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
1509 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1509 | mutex_unlock(&codec->control_mutex); |
1510 | return err; | 1510 | return err; |
1511 | } | 1511 | } |
1512 | 1512 | ||
@@ -1517,11 +1517,11 @@ static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |||
1517 | struct alc_spec *spec = codec->spec; | 1517 | struct alc_spec *spec = codec->spec; |
1518 | int err; | 1518 | int err; |
1519 | 1519 | ||
1520 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1520 | mutex_lock(&codec->control_mutex); |
1521 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | 1521 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
1522 | HDA_INPUT); | 1522 | HDA_INPUT); |
1523 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | 1523 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
1524 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1524 | mutex_unlock(&codec->control_mutex); |
1525 | return err; | 1525 | return err; |
1526 | } | 1526 | } |
1527 | 1527 | ||
@@ -1537,11 +1537,11 @@ static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |||
1537 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 1537 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
1538 | int err; | 1538 | int err; |
1539 | 1539 | ||
1540 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1540 | mutex_lock(&codec->control_mutex); |
1541 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], | 1541 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
1542 | 3, 0, HDA_INPUT); | 1542 | 3, 0, HDA_INPUT); |
1543 | err = func(kcontrol, ucontrol); | 1543 | err = func(kcontrol, ucontrol); |
1544 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ | 1544 | mutex_unlock(&codec->control_mutex); |
1545 | return err; | 1545 | return err; |
1546 | } | 1546 | } |
1547 | 1547 | ||
@@ -8461,12 +8461,17 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8461 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | 8461 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
8462 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", | 8462 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
8463 | ALC888_ACER_ASPIRE_4930G), | 8463 | ALC888_ACER_ASPIRE_4930G), |
8464 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | ||
8465 | ALC888_ACER_ASPIRE_4930G), | ||
8466 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | ||
8467 | ALC888_ACER_ASPIRE_4930G), | ||
8464 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ | 8468 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
8465 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | 8469 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
8466 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 8470 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
8467 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | 8471 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
8468 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 8472 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
8469 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | 8473 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
8474 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | ||
8470 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | 8475 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
8471 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8476 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
8472 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | 8477 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
@@ -8521,6 +8526,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8521 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 8526 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
8522 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | 8527 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
8523 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | 8528 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
8529 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), | ||
8524 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), | 8530 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
8525 | {} | 8531 | {} |
8526 | }; | 8532 | }; |
@@ -11688,6 +11694,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
11688 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | 11694 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
11689 | ALC268_ACER_ASPIRE_ONE), | 11695 | ALC268_ACER_ASPIRE_ONE), |
11690 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | 11696 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
11697 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), | ||
11691 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), | 11698 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
11692 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | 11699 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
11693 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), | 11700 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
@@ -16638,9 +16645,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
16638 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 16645 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
16639 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 16646 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
16640 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, | 16647 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
16641 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, | ||
16642 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | 16648 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
16643 | .patch = patch_alc883 }, | 16649 | .patch = patch_alc883 }, |
16650 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, | ||
16644 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, | 16651 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
16645 | {} /* terminator */ | 16652 | {} /* terminator */ |
16646 | }; | 16653 | }; |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 0dfa0540ce2c..bb8d8c766b9d 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -1239,7 +1239,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) | |||
1239 | if (ice->force_pdma4 || ice->force_rdma1) | 1239 | if (ice->force_pdma4 || ice->force_rdma1) |
1240 | name = "ICE1724 Secondary"; | 1240 | name = "ICE1724 Secondary"; |
1241 | else | 1241 | else |
1242 | name = "IEC1724 IEC958"; | 1242 | name = "ICE1724 IEC958"; |
1243 | err = snd_pcm_new(ice->card, name, device, play, capt, &pcm); | 1243 | err = snd_pcm_new(ice->card, name, device, play, capt, &pcm); |
1244 | if (err < 0) | 1244 | if (err < 0) |
1245 | return err; | 1245 | return err; |
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index 1fb59a9d3719..6ea04be911d0 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c | |||
@@ -221,8 +221,8 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec) | |||
221 | snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); | 221 | snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); |
222 | 222 | ||
223 | /* not connected */ | 223 | /* not connected */ |
224 | snd_soc_dapm_disable_pin(codec, "RLINEIN"); | 224 | snd_soc_dapm_nc_pin(codec, "RLINEIN"); |
225 | snd_soc_dapm_disable_pin(codec, "LLINEIN"); | 225 | snd_soc_dapm_nc_pin(codec, "LLINEIN"); |
226 | 226 | ||
227 | /* always connected */ | 227 | /* always connected */ |
228 | snd_soc_dapm_enable_pin(codec, "Int Mic"); | 228 | snd_soc_dapm_enable_pin(codec, "Int Mic"); |
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 74c823d60f91..bc8d654576c0 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c | |||
@@ -187,7 +187,7 @@ static int au1x_pcm_dbdma_realloc(struct au1xpsc_audio_dmadata *pcd, | |||
187 | au1x_pcm_dmatx_cb, (void *)pcd); | 187 | au1x_pcm_dmatx_cb, (void *)pcd); |
188 | 188 | ||
189 | if (!pcd->ddma_chan) | 189 | if (!pcd->ddma_chan) |
190 | return -ENOMEM;; | 190 | return -ENOMEM; |
191 | 191 | ||
192 | au1xxx_dbdma_set_devwidth(pcd->ddma_chan, msbits); | 192 | au1xxx_dbdma_set_devwidth(pcd->ddma_chan, msbits); |
193 | au1xxx_dbdma_ring_alloc(pcd->ddma_chan, 2); | 193 | au1xxx_dbdma_ring_alloc(pcd->ddma_chan, 2); |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index c41289b5f586..d0e0d691ae51 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -1,3 +1,13 @@ | |||
1 | # Helper to resolve issues with configs that have SPI enabled but I2C | ||
2 | # modular, meaning we can't build the codec driver in with I2C support. | ||
3 | # We use an ordered list of conditional defaults to pick the appropriate | ||
4 | # setting - SPI can't be modular so that case doesn't need to be covered. | ||
5 | config SND_SOC_I2C_AND_SPI | ||
6 | tristate | ||
7 | default m if I2C=m | ||
8 | default y if I2C=y | ||
9 | default y if SPI_MASTER=y | ||
10 | |||
1 | config SND_SOC_ALL_CODECS | 11 | config SND_SOC_ALL_CODECS |
2 | tristate "Build all ASoC CODEC drivers" | 12 | tristate "Build all ASoC CODEC drivers" |
3 | select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS | 13 | select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS |
@@ -14,12 +24,12 @@ config SND_SOC_ALL_CODECS | |||
14 | select SND_SOC_UDA134X | 24 | select SND_SOC_UDA134X |
15 | select SND_SOC_UDA1380 if I2C | 25 | select SND_SOC_UDA1380 if I2C |
16 | select SND_SOC_WM8350 if MFD_WM8350 | 26 | select SND_SOC_WM8350 if MFD_WM8350 |
17 | select SND_SOC_WM8510 if (I2C || SPI_MASTER) | 27 | select SND_SOC_WM8510 if SND_SOC_I2C_AND_SPI |
18 | select SND_SOC_WM8580 if I2C | 28 | select SND_SOC_WM8580 if I2C |
19 | select SND_SOC_WM8728 if (I2C || SPI_MASTER) | 29 | select SND_SOC_WM8728 if SND_SOC_I2C_AND_SPI |
20 | select SND_SOC_WM8731 if (I2C || SPI_MASTER) | 30 | select SND_SOC_WM8731 if SND_SOC_I2C_AND_SPI |
21 | select SND_SOC_WM8750 if (I2C || SPI_MASTER) | 31 | select SND_SOC_WM8750 if SND_SOC_I2C_AND_SPI |
22 | select SND_SOC_WM8753 if (I2C || SPI_MASTER) | 32 | select SND_SOC_WM8753 if SND_SOC_I2C_AND_SPI |
23 | select SND_SOC_WM8900 if I2C | 33 | select SND_SOC_WM8900 if I2C |
24 | select SND_SOC_WM8903 if I2C | 34 | select SND_SOC_WM8903 if I2C |
25 | select SND_SOC_WM8971 if I2C | 35 | select SND_SOC_WM8971 if I2C |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 51848880504a..ea370a4f86d5 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -192,39 +192,51 @@ static void twl4030_init_chip(struct snd_soc_codec *codec) | |||
192 | 192 | ||
193 | /* Earpiece */ | 193 | /* Earpiece */ |
194 | static const char *twl4030_earpiece_texts[] = | 194 | static const char *twl4030_earpiece_texts[] = |
195 | {"Off", "DACL1", "DACL2", "Invalid", "DACR1"}; | 195 | {"Off", "DACL1", "DACL2", "DACR1"}; |
196 | |||
197 | static const unsigned int twl4030_earpiece_values[] = | ||
198 | {0x0, 0x1, 0x2, 0x4}; | ||
196 | 199 | ||
197 | static const struct soc_enum twl4030_earpiece_enum = | 200 | static const struct soc_enum twl4030_earpiece_enum = |
198 | SOC_ENUM_SINGLE(TWL4030_REG_EAR_CTL, 1, | 201 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_EAR_CTL, 1, 0x7, |
199 | ARRAY_SIZE(twl4030_earpiece_texts), | 202 | ARRAY_SIZE(twl4030_earpiece_texts), |
200 | twl4030_earpiece_texts); | 203 | twl4030_earpiece_texts, |
204 | twl4030_earpiece_values); | ||
201 | 205 | ||
202 | static const struct snd_kcontrol_new twl4030_dapm_earpiece_control = | 206 | static const struct snd_kcontrol_new twl4030_dapm_earpiece_control = |
203 | SOC_DAPM_ENUM("Route", twl4030_earpiece_enum); | 207 | SOC_DAPM_VALUE_ENUM("Route", twl4030_earpiece_enum); |
204 | 208 | ||
205 | /* PreDrive Left */ | 209 | /* PreDrive Left */ |
206 | static const char *twl4030_predrivel_texts[] = | 210 | static const char *twl4030_predrivel_texts[] = |
207 | {"Off", "DACL1", "DACL2", "Invalid", "DACR2"}; | 211 | {"Off", "DACL1", "DACL2", "DACR2"}; |
212 | |||
213 | static const unsigned int twl4030_predrivel_values[] = | ||
214 | {0x0, 0x1, 0x2, 0x4}; | ||
208 | 215 | ||
209 | static const struct soc_enum twl4030_predrivel_enum = | 216 | static const struct soc_enum twl4030_predrivel_enum = |
210 | SOC_ENUM_SINGLE(TWL4030_REG_PREDL_CTL, 1, | 217 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_PREDL_CTL, 1, 0x7, |
211 | ARRAY_SIZE(twl4030_predrivel_texts), | 218 | ARRAY_SIZE(twl4030_predrivel_texts), |
212 | twl4030_predrivel_texts); | 219 | twl4030_predrivel_texts, |
220 | twl4030_predrivel_values); | ||
213 | 221 | ||
214 | static const struct snd_kcontrol_new twl4030_dapm_predrivel_control = | 222 | static const struct snd_kcontrol_new twl4030_dapm_predrivel_control = |
215 | SOC_DAPM_ENUM("Route", twl4030_predrivel_enum); | 223 | SOC_DAPM_VALUE_ENUM("Route", twl4030_predrivel_enum); |
216 | 224 | ||
217 | /* PreDrive Right */ | 225 | /* PreDrive Right */ |
218 | static const char *twl4030_predriver_texts[] = | 226 | static const char *twl4030_predriver_texts[] = |
219 | {"Off", "DACR1", "DACR2", "Invalid", "DACL2"}; | 227 | {"Off", "DACR1", "DACR2", "DACL2"}; |
228 | |||
229 | static const unsigned int twl4030_predriver_values[] = | ||
230 | {0x0, 0x1, 0x2, 0x4}; | ||
220 | 231 | ||
221 | static const struct soc_enum twl4030_predriver_enum = | 232 | static const struct soc_enum twl4030_predriver_enum = |
222 | SOC_ENUM_SINGLE(TWL4030_REG_PREDR_CTL, 1, | 233 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_PREDR_CTL, 1, 0x7, |
223 | ARRAY_SIZE(twl4030_predriver_texts), | 234 | ARRAY_SIZE(twl4030_predriver_texts), |
224 | twl4030_predriver_texts); | 235 | twl4030_predriver_texts, |
236 | twl4030_predriver_values); | ||
225 | 237 | ||
226 | static const struct snd_kcontrol_new twl4030_dapm_predriver_control = | 238 | static const struct snd_kcontrol_new twl4030_dapm_predriver_control = |
227 | SOC_DAPM_ENUM("Route", twl4030_predriver_enum); | 239 | SOC_DAPM_VALUE_ENUM("Route", twl4030_predriver_enum); |
228 | 240 | ||
229 | /* Headset Left */ | 241 | /* Headset Left */ |
230 | static const char *twl4030_hsol_texts[] = | 242 | static const char *twl4030_hsol_texts[] = |
@@ -298,28 +310,90 @@ static const struct soc_enum twl4030_handsfreer_enum = | |||
298 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = | 310 | static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = |
299 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); | 311 | SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); |
300 | 312 | ||
301 | static int outmixer_event(struct snd_soc_dapm_widget *w, | 313 | /* Left analog microphone selection */ |
314 | static const char *twl4030_analoglmic_texts[] = | ||
315 | {"Off", "Main mic", "Headset mic", "AUXL", "Carkit mic"}; | ||
316 | |||
317 | static const unsigned int twl4030_analoglmic_values[] = | ||
318 | {0x0, 0x1, 0x2, 0x4, 0x8}; | ||
319 | |||
320 | static const struct soc_enum twl4030_analoglmic_enum = | ||
321 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICL, 0, 0xf, | ||
322 | ARRAY_SIZE(twl4030_analoglmic_texts), | ||
323 | twl4030_analoglmic_texts, | ||
324 | twl4030_analoglmic_values); | ||
325 | |||
326 | static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control = | ||
327 | SOC_DAPM_VALUE_ENUM("Route", twl4030_analoglmic_enum); | ||
328 | |||
329 | /* Right analog microphone selection */ | ||
330 | static const char *twl4030_analogrmic_texts[] = | ||
331 | {"Off", "Sub mic", "AUXR"}; | ||
332 | |||
333 | static const unsigned int twl4030_analogrmic_values[] = | ||
334 | {0x0, 0x1, 0x4}; | ||
335 | |||
336 | static const struct soc_enum twl4030_analogrmic_enum = | ||
337 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICR, 0, 0x5, | ||
338 | ARRAY_SIZE(twl4030_analogrmic_texts), | ||
339 | twl4030_analogrmic_texts, | ||
340 | twl4030_analogrmic_values); | ||
341 | |||
342 | static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control = | ||
343 | SOC_DAPM_VALUE_ENUM("Route", twl4030_analogrmic_enum); | ||
344 | |||
345 | /* TX1 L/R Analog/Digital microphone selection */ | ||
346 | static const char *twl4030_micpathtx1_texts[] = | ||
347 | {"Analog", "Digimic0"}; | ||
348 | |||
349 | static const struct soc_enum twl4030_micpathtx1_enum = | ||
350 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 0, | ||
351 | ARRAY_SIZE(twl4030_micpathtx1_texts), | ||
352 | twl4030_micpathtx1_texts); | ||
353 | |||
354 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control = | ||
355 | SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum); | ||
356 | |||
357 | /* TX2 L/R Analog/Digital microphone selection */ | ||
358 | static const char *twl4030_micpathtx2_texts[] = | ||
359 | {"Analog", "Digimic1"}; | ||
360 | |||
361 | static const struct soc_enum twl4030_micpathtx2_enum = | ||
362 | SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 2, | ||
363 | ARRAY_SIZE(twl4030_micpathtx2_texts), | ||
364 | twl4030_micpathtx2_texts); | ||
365 | |||
366 | static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control = | ||
367 | SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum); | ||
368 | |||
369 | static int micpath_event(struct snd_soc_dapm_widget *w, | ||
302 | struct snd_kcontrol *kcontrol, int event) | 370 | struct snd_kcontrol *kcontrol, int event) |
303 | { | 371 | { |
304 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 372 | struct soc_enum *e = (struct soc_enum *)w->kcontrols->private_value; |
305 | int ret = 0; | 373 | unsigned char adcmicsel, micbias_ctl; |
306 | int val; | 374 | |
307 | 375 | adcmicsel = twl4030_read_reg_cache(w->codec, TWL4030_REG_ADCMICSEL); | |
308 | switch (e->reg) { | 376 | micbias_ctl = twl4030_read_reg_cache(w->codec, TWL4030_REG_MICBIAS_CTL); |
309 | case TWL4030_REG_PREDL_CTL: | 377 | /* Prepare the bits for the given TX path: |
310 | case TWL4030_REG_PREDR_CTL: | 378 | * shift_l == 0: TX1 microphone path |
311 | case TWL4030_REG_EAR_CTL: | 379 | * shift_l == 2: TX2 microphone path */ |
312 | val = w->value >> e->shift_l; | 380 | if (e->shift_l) { |
313 | if (val == 3) { | 381 | /* TX2 microphone path */ |
314 | printk(KERN_WARNING | 382 | if (adcmicsel & TWL4030_TX2IN_SEL) |
315 | "Invalid MUX setting for register 0x%02x (%d)\n", | 383 | micbias_ctl |= TWL4030_MICBIAS2_CTL; /* digimic */ |
316 | e->reg, val); | 384 | else |
317 | ret = -1; | 385 | micbias_ctl &= ~TWL4030_MICBIAS2_CTL; |
318 | } | 386 | } else { |
319 | break; | 387 | /* TX1 microphone path */ |
388 | if (adcmicsel & TWL4030_TX1IN_SEL) | ||
389 | micbias_ctl |= TWL4030_MICBIAS1_CTL; /* digimic */ | ||
390 | else | ||
391 | micbias_ctl &= ~TWL4030_MICBIAS1_CTL; | ||
320 | } | 392 | } |
321 | 393 | ||
322 | return ret; | 394 | twl4030_write(w->codec, TWL4030_REG_MICBIAS_CTL, micbias_ctl); |
395 | |||
396 | return 0; | ||
323 | } | 397 | } |
324 | 398 | ||
325 | static int handsfree_event(struct snd_soc_dapm_widget *w, | 399 | static int handsfree_event(struct snd_soc_dapm_widget *w, |
@@ -503,162 +577,6 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol, | |||
503 | return err; | 577 | return err; |
504 | } | 578 | } |
505 | 579 | ||
506 | static int twl4030_get_left_input(struct snd_kcontrol *kcontrol, | ||
507 | struct snd_ctl_elem_value *ucontrol) | ||
508 | { | ||
509 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
510 | u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL); | ||
511 | int result = 0; | ||
512 | |||
513 | /* one bit must be set a time */ | ||
514 | reg &= TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN | ||
515 | | TWL4030_MAINMIC_EN; | ||
516 | if (reg != 0) { | ||
517 | result++; | ||
518 | while ((reg & 1) == 0) { | ||
519 | result++; | ||
520 | reg >>= 1; | ||
521 | } | ||
522 | } | ||
523 | |||
524 | ucontrol->value.integer.value[0] = result; | ||
525 | return 0; | ||
526 | } | ||
527 | |||
528 | static int twl4030_put_left_input(struct snd_kcontrol *kcontrol, | ||
529 | struct snd_ctl_elem_value *ucontrol) | ||
530 | { | ||
531 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
532 | int value = ucontrol->value.integer.value[0]; | ||
533 | u8 anamicl, micbias, avadc_ctl; | ||
534 | |||
535 | anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL); | ||
536 | anamicl &= ~(TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN | ||
537 | | TWL4030_MAINMIC_EN); | ||
538 | micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL); | ||
539 | micbias &= ~(TWL4030_HSMICBIAS_EN | TWL4030_MICBIAS1_EN); | ||
540 | avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL); | ||
541 | |||
542 | switch (value) { | ||
543 | case 1: | ||
544 | anamicl |= TWL4030_MAINMIC_EN; | ||
545 | micbias |= TWL4030_MICBIAS1_EN; | ||
546 | break; | ||
547 | case 2: | ||
548 | anamicl |= TWL4030_HSMIC_EN; | ||
549 | micbias |= TWL4030_HSMICBIAS_EN; | ||
550 | break; | ||
551 | case 3: | ||
552 | anamicl |= TWL4030_AUXL_EN; | ||
553 | break; | ||
554 | case 4: | ||
555 | anamicl |= TWL4030_CKMIC_EN; | ||
556 | break; | ||
557 | default: | ||
558 | break; | ||
559 | } | ||
560 | |||
561 | /* If some input is selected, enable amp and ADC */ | ||
562 | if (value != 0) { | ||
563 | anamicl |= TWL4030_MICAMPL_EN; | ||
564 | avadc_ctl |= TWL4030_ADCL_EN; | ||
565 | } else { | ||
566 | anamicl &= ~TWL4030_MICAMPL_EN; | ||
567 | avadc_ctl &= ~TWL4030_ADCL_EN; | ||
568 | } | ||
569 | |||
570 | twl4030_write(codec, TWL4030_REG_ANAMICL, anamicl); | ||
571 | twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias); | ||
572 | twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl); | ||
573 | |||
574 | return 1; | ||
575 | } | ||
576 | |||
577 | static int twl4030_get_right_input(struct snd_kcontrol *kcontrol, | ||
578 | struct snd_ctl_elem_value *ucontrol) | ||
579 | { | ||
580 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
581 | u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR); | ||
582 | int value = 0; | ||
583 | |||
584 | reg &= TWL4030_SUBMIC_EN|TWL4030_AUXR_EN; | ||
585 | switch (reg) { | ||
586 | case TWL4030_SUBMIC_EN: | ||
587 | value = 1; | ||
588 | break; | ||
589 | case TWL4030_AUXR_EN: | ||
590 | value = 2; | ||
591 | break; | ||
592 | default: | ||
593 | break; | ||
594 | } | ||
595 | |||
596 | ucontrol->value.integer.value[0] = value; | ||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | static int twl4030_put_right_input(struct snd_kcontrol *kcontrol, | ||
601 | struct snd_ctl_elem_value *ucontrol) | ||
602 | { | ||
603 | struct snd_soc_codec *codec = kcontrol->private_data; | ||
604 | int value = ucontrol->value.integer.value[0]; | ||
605 | u8 anamicr, micbias, avadc_ctl; | ||
606 | |||
607 | anamicr = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR); | ||
608 | anamicr &= ~(TWL4030_SUBMIC_EN|TWL4030_AUXR_EN); | ||
609 | micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL); | ||
610 | micbias &= ~TWL4030_MICBIAS2_EN; | ||
611 | avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL); | ||
612 | |||
613 | switch (value) { | ||
614 | case 1: | ||
615 | anamicr |= TWL4030_SUBMIC_EN; | ||
616 | micbias |= TWL4030_MICBIAS2_EN; | ||
617 | break; | ||
618 | case 2: | ||
619 | anamicr |= TWL4030_AUXR_EN; | ||
620 | break; | ||
621 | default: | ||
622 | break; | ||
623 | } | ||
624 | |||
625 | if (value != 0) { | ||
626 | anamicr |= TWL4030_MICAMPR_EN; | ||
627 | avadc_ctl |= TWL4030_ADCR_EN; | ||
628 | } else { | ||
629 | anamicr &= ~TWL4030_MICAMPR_EN; | ||
630 | avadc_ctl &= ~TWL4030_ADCR_EN; | ||
631 | } | ||
632 | |||
633 | twl4030_write(codec, TWL4030_REG_ANAMICR, anamicr); | ||
634 | twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias); | ||
635 | twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl); | ||
636 | |||
637 | return 1; | ||
638 | } | ||
639 | |||
640 | static const char *twl4030_left_in_sel[] = { | ||
641 | "None", | ||
642 | "Main Mic", | ||
643 | "Headset Mic", | ||
644 | "Line In", | ||
645 | "Carkit Mic", | ||
646 | }; | ||
647 | |||
648 | static const char *twl4030_right_in_sel[] = { | ||
649 | "None", | ||
650 | "Sub Mic", | ||
651 | "Line In", | ||
652 | }; | ||
653 | |||
654 | static const struct soc_enum twl4030_left_input_mux = | ||
655 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_left_in_sel), | ||
656 | twl4030_left_in_sel); | ||
657 | |||
658 | static const struct soc_enum twl4030_right_input_mux = | ||
659 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_right_in_sel), | ||
660 | twl4030_right_in_sel); | ||
661 | |||
662 | /* | 580 | /* |
663 | * FGAIN volume control: | 581 | * FGAIN volume control: |
664 | * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) | 582 | * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) |
@@ -741,18 +659,15 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = { | |||
741 | TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), | 659 | TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), |
742 | 660 | ||
743 | /* Common capture gain controls */ | 661 | /* Common capture gain controls */ |
744 | SOC_DOUBLE_R_TLV("Capture Volume", | 662 | SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume", |
745 | TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, | 663 | TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, |
746 | 0, 0x1f, 0, digital_capture_tlv), | 664 | 0, 0x1f, 0, digital_capture_tlv), |
665 | SOC_DOUBLE_R_TLV("TX2 Digital Capture Volume", | ||
666 | TWL4030_REG_AVTXL2PGA, TWL4030_REG_AVTXR2PGA, | ||
667 | 0, 0x1f, 0, digital_capture_tlv), | ||
747 | 668 | ||
748 | SOC_DOUBLE_TLV("Input Boost Volume", TWL4030_REG_ANAMIC_GAIN, | 669 | SOC_DOUBLE_TLV("Analog Capture Volume", TWL4030_REG_ANAMIC_GAIN, |
749 | 0, 3, 5, 0, input_gain_tlv), | 670 | 0, 3, 5, 0, input_gain_tlv), |
750 | |||
751 | /* Input source controls */ | ||
752 | SOC_ENUM_EXT("Left Input Source", twl4030_left_input_mux, | ||
753 | twl4030_get_left_input, twl4030_put_left_input), | ||
754 | SOC_ENUM_EXT("Right Input Source", twl4030_right_input_mux, | ||
755 | twl4030_get_right_input, twl4030_put_right_input), | ||
756 | }; | 671 | }; |
757 | 672 | ||
758 | /* add non dapm controls */ | 673 | /* add non dapm controls */ |
@@ -772,9 +687,19 @@ static int twl4030_add_controls(struct snd_soc_codec *codec) | |||
772 | } | 687 | } |
773 | 688 | ||
774 | static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | 689 | static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { |
775 | SND_SOC_DAPM_INPUT("INL"), | 690 | /* Left channel inputs */ |
776 | SND_SOC_DAPM_INPUT("INR"), | 691 | SND_SOC_DAPM_INPUT("MAINMIC"), |
777 | 692 | SND_SOC_DAPM_INPUT("HSMIC"), | |
693 | SND_SOC_DAPM_INPUT("AUXL"), | ||
694 | SND_SOC_DAPM_INPUT("CARKITMIC"), | ||
695 | /* Right channel inputs */ | ||
696 | SND_SOC_DAPM_INPUT("SUBMIC"), | ||
697 | SND_SOC_DAPM_INPUT("AUXR"), | ||
698 | /* Digital microphones (Stereo) */ | ||
699 | SND_SOC_DAPM_INPUT("DIGIMIC0"), | ||
700 | SND_SOC_DAPM_INPUT("DIGIMIC1"), | ||
701 | |||
702 | /* Outputs */ | ||
778 | SND_SOC_DAPM_OUTPUT("OUTL"), | 703 | SND_SOC_DAPM_OUTPUT("OUTL"), |
779 | SND_SOC_DAPM_OUTPUT("OUTR"), | 704 | SND_SOC_DAPM_OUTPUT("OUTR"), |
780 | SND_SOC_DAPM_OUTPUT("EARPIECE"), | 705 | SND_SOC_DAPM_OUTPUT("EARPIECE"), |
@@ -809,16 +734,13 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
809 | 734 | ||
810 | /* Output MUX controls */ | 735 | /* Output MUX controls */ |
811 | /* Earpiece */ | 736 | /* Earpiece */ |
812 | SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0, | 737 | SND_SOC_DAPM_VALUE_MUX("Earpiece Mux", SND_SOC_NOPM, 0, 0, |
813 | &twl4030_dapm_earpiece_control, outmixer_event, | 738 | &twl4030_dapm_earpiece_control), |
814 | SND_SOC_DAPM_PRE_REG), | ||
815 | /* PreDrivL/R */ | 739 | /* PreDrivL/R */ |
816 | SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0, | 740 | SND_SOC_DAPM_VALUE_MUX("PredriveL Mux", SND_SOC_NOPM, 0, 0, |
817 | &twl4030_dapm_predrivel_control, outmixer_event, | 741 | &twl4030_dapm_predrivel_control), |
818 | SND_SOC_DAPM_PRE_REG), | 742 | SND_SOC_DAPM_VALUE_MUX("PredriveR Mux", SND_SOC_NOPM, 0, 0, |
819 | SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0, | 743 | &twl4030_dapm_predriver_control), |
820 | &twl4030_dapm_predriver_control, outmixer_event, | ||
821 | SND_SOC_DAPM_PRE_REG), | ||
822 | /* HeadsetL/R */ | 744 | /* HeadsetL/R */ |
823 | SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, | 745 | SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, |
824 | &twl4030_dapm_hsol_control), | 746 | &twl4030_dapm_hsol_control), |
@@ -837,8 +759,48 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
837 | &twl4030_dapm_handsfreer_control, handsfree_event, | 759 | &twl4030_dapm_handsfreer_control, handsfree_event, |
838 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), | 760 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), |
839 | 761 | ||
840 | SND_SOC_DAPM_ADC("ADCL", "Left Capture", SND_SOC_NOPM, 0, 0), | 762 | /* Introducing four virtual ADC, since TWL4030 have four channel for |
841 | SND_SOC_DAPM_ADC("ADCR", "Right Capture", SND_SOC_NOPM, 0, 0), | 763 | capture */ |
764 | SND_SOC_DAPM_ADC("ADC Virtual Left1", "Left Front Capture", | ||
765 | SND_SOC_NOPM, 0, 0), | ||
766 | SND_SOC_DAPM_ADC("ADC Virtual Right1", "Right Front Capture", | ||
767 | SND_SOC_NOPM, 0, 0), | ||
768 | SND_SOC_DAPM_ADC("ADC Virtual Left2", "Left Rear Capture", | ||
769 | SND_SOC_NOPM, 0, 0), | ||
770 | SND_SOC_DAPM_ADC("ADC Virtual Right2", "Right Rear Capture", | ||
771 | SND_SOC_NOPM, 0, 0), | ||
772 | |||
773 | /* Analog/Digital mic path selection. | ||
774 | TX1 Left/Right: either analog Left/Right or Digimic0 | ||
775 | TX2 Left/Right: either analog Left/Right or Digimic1 */ | ||
776 | SND_SOC_DAPM_MUX_E("TX1 Capture Route", SND_SOC_NOPM, 0, 0, | ||
777 | &twl4030_dapm_micpathtx1_control, micpath_event, | ||
778 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| | ||
779 | SND_SOC_DAPM_POST_REG), | ||
780 | SND_SOC_DAPM_MUX_E("TX2 Capture Route", SND_SOC_NOPM, 0, 0, | ||
781 | &twl4030_dapm_micpathtx2_control, micpath_event, | ||
782 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| | ||
783 | SND_SOC_DAPM_POST_REG), | ||
784 | |||
785 | /* Analog input muxes with power switch for the physical ADCL/R */ | ||
786 | SND_SOC_DAPM_VALUE_MUX("Analog Left Capture Route", | ||
787 | TWL4030_REG_AVADC_CTL, 3, 0, &twl4030_dapm_analoglmic_control), | ||
788 | SND_SOC_DAPM_VALUE_MUX("Analog Right Capture Route", | ||
789 | TWL4030_REG_AVADC_CTL, 1, 0, &twl4030_dapm_analogrmic_control), | ||
790 | |||
791 | SND_SOC_DAPM_PGA("Analog Left Amplifier", | ||
792 | TWL4030_REG_ANAMICL, 4, 0, NULL, 0), | ||
793 | SND_SOC_DAPM_PGA("Analog Right Amplifier", | ||
794 | TWL4030_REG_ANAMICR, 4, 0, NULL, 0), | ||
795 | |||
796 | SND_SOC_DAPM_PGA("Digimic0 Enable", | ||
797 | TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0), | ||
798 | SND_SOC_DAPM_PGA("Digimic1 Enable", | ||
799 | TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0), | ||
800 | |||
801 | SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0), | ||
802 | SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0), | ||
803 | SND_SOC_DAPM_MICBIAS("Headset Mic Bias", TWL4030_REG_MICBIAS_CTL, 2, 0), | ||
842 | }; | 804 | }; |
843 | 805 | ||
844 | static const struct snd_soc_dapm_route intercon[] = { | 806 | static const struct snd_soc_dapm_route intercon[] = { |
@@ -894,9 +856,39 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
894 | {"HFL", NULL, "HandsfreeL Mux"}, | 856 | {"HFL", NULL, "HandsfreeL Mux"}, |
895 | {"HFR", NULL, "HandsfreeR Mux"}, | 857 | {"HFR", NULL, "HandsfreeR Mux"}, |
896 | 858 | ||
897 | /* inputs */ | 859 | /* Capture path */ |
898 | {"ADCL", NULL, "INL"}, | 860 | {"Analog Left Capture Route", "Main mic", "MAINMIC"}, |
899 | {"ADCR", NULL, "INR"}, | 861 | {"Analog Left Capture Route", "Headset mic", "HSMIC"}, |
862 | {"Analog Left Capture Route", "AUXL", "AUXL"}, | ||
863 | {"Analog Left Capture Route", "Carkit mic", "CARKITMIC"}, | ||
864 | |||
865 | {"Analog Right Capture Route", "Sub mic", "SUBMIC"}, | ||
866 | {"Analog Right Capture Route", "AUXR", "AUXR"}, | ||
867 | |||
868 | {"Analog Left Amplifier", NULL, "Analog Left Capture Route"}, | ||
869 | {"Analog Right Amplifier", NULL, "Analog Right Capture Route"}, | ||
870 | |||
871 | {"Digimic0 Enable", NULL, "DIGIMIC0"}, | ||
872 | {"Digimic1 Enable", NULL, "DIGIMIC1"}, | ||
873 | |||
874 | /* TX1 Left capture path */ | ||
875 | {"TX1 Capture Route", "Analog", "Analog Left Amplifier"}, | ||
876 | {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"}, | ||
877 | /* TX1 Right capture path */ | ||
878 | {"TX1 Capture Route", "Analog", "Analog Right Amplifier"}, | ||
879 | {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"}, | ||
880 | /* TX2 Left capture path */ | ||
881 | {"TX2 Capture Route", "Analog", "Analog Left Amplifier"}, | ||
882 | {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"}, | ||
883 | /* TX2 Right capture path */ | ||
884 | {"TX2 Capture Route", "Analog", "Analog Right Amplifier"}, | ||
885 | {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"}, | ||
886 | |||
887 | {"ADC Virtual Left1", NULL, "TX1 Capture Route"}, | ||
888 | {"ADC Virtual Right1", NULL, "TX1 Capture Route"}, | ||
889 | {"ADC Virtual Left2", NULL, "TX2 Capture Route"}, | ||
890 | {"ADC Virtual Right2", NULL, "TX2 Capture Route"}, | ||
891 | |||
900 | }; | 892 | }; |
901 | 893 | ||
902 | static int twl4030_add_widgets(struct snd_soc_codec *codec) | 894 | static int twl4030_add_widgets(struct snd_soc_codec *codec) |
@@ -923,6 +915,7 @@ static void twl4030_power_up(struct snd_soc_codec *codec) | |||
923 | twl4030_write(codec, TWL4030_REG_ANAMICL, | 915 | twl4030_write(codec, TWL4030_REG_ANAMICL, |
924 | anamicl | TWL4030_CNCL_OFFSET_START); | 916 | anamicl | TWL4030_CNCL_OFFSET_START); |
925 | 917 | ||
918 | |||
926 | /* wait for offset cancellation to complete */ | 919 | /* wait for offset cancellation to complete */ |
927 | do { | 920 | do { |
928 | /* this takes a little while, so don't slam i2c */ | 921 | /* this takes a little while, so don't slam i2c */ |
@@ -1287,6 +1280,8 @@ static int twl4030_remove(struct platform_device *pdev) | |||
1287 | struct snd_soc_codec *codec = socdev->codec; | 1280 | struct snd_soc_codec *codec = socdev->codec; |
1288 | 1281 | ||
1289 | printk(KERN_INFO "TWL4030 Audio Codec remove\n"); | 1282 | printk(KERN_INFO "TWL4030 Audio Codec remove\n"); |
1283 | snd_soc_free_pcms(socdev); | ||
1284 | snd_soc_dapm_free(socdev); | ||
1290 | kfree(codec); | 1285 | kfree(codec); |
1291 | 1286 | ||
1292 | return 0; | 1287 | return 0; |
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h index 54615c76802b..442e5a828617 100644 --- a/sound/soc/codecs/twl4030.h +++ b/sound/soc/codecs/twl4030.h | |||
@@ -147,6 +147,13 @@ | |||
147 | #define TWL4030_AVADC_CLK_PRIORITY 0x04 | 147 | #define TWL4030_AVADC_CLK_PRIORITY 0x04 |
148 | #define TWL4030_ADCR_EN 0x02 | 148 | #define TWL4030_ADCR_EN 0x02 |
149 | 149 | ||
150 | /* TWL4030_REG_ADCMICSEL (0x08) Fields */ | ||
151 | |||
152 | #define TWL4030_DIGMIC1_EN 0x08 | ||
153 | #define TWL4030_TX2IN_SEL 0x04 | ||
154 | #define TWL4030_DIGMIC0_EN 0x02 | ||
155 | #define TWL4030_TX1IN_SEL 0x01 | ||
156 | |||
150 | /* AUDIO_IF (0x0E) Fields */ | 157 | /* AUDIO_IF (0x0E) Fields */ |
151 | 158 | ||
152 | #define TWL4030_AIF_SLAVE_EN 0x80 | 159 | #define TWL4030_AIF_SLAVE_EN 0x80 |
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 01b948bb55a1..54851f318568 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include "davinci-pcm.h" | 26 | #include "davinci-pcm.h" |
27 | #include "davinci-i2s.h" | 27 | #include "davinci-i2s.h" |
28 | 28 | ||
29 | #define EVM_CODEC_CLOCK 22579200 | ||
30 | 29 | ||
31 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ | 30 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ |
32 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) | 31 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) |
@@ -37,6 +36,21 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
37 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 36 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; |
38 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 37 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
39 | int ret = 0; | 38 | int ret = 0; |
39 | unsigned sysclk; | ||
40 | |||
41 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ | ||
42 | if (machine_is_davinci_dm355_evm()) | ||
43 | sysclk = 27000000; | ||
44 | |||
45 | /* ASP0 in DM6446 EVM is clocked by U55, as configured by | ||
46 | * board-dm644x-evm.c using GPIOs from U18. There are six | ||
47 | * options; here we "know" we use a 48 KHz sample rate. | ||
48 | */ | ||
49 | else if (machine_is_davinci_evm()) | ||
50 | sysclk = 12288000; | ||
51 | |||
52 | else | ||
53 | return -EINVAL; | ||
40 | 54 | ||
41 | /* set codec DAI configuration */ | 55 | /* set codec DAI configuration */ |
42 | ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); | 56 | ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); |
@@ -49,8 +63,7 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
49 | return ret; | 63 | return ret; |
50 | 64 | ||
51 | /* set the codec system clock */ | 65 | /* set the codec system clock */ |
52 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, EVM_CODEC_CLOCK, | 66 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT); |
53 | SND_SOC_CLOCK_OUT); | ||
54 | if (ret < 0) | 67 | if (ret < 0) |
55 | return ret; | 68 | return ret; |
56 | 69 | ||
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 74abc9b4f1cc..366049d8578c 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -212,7 +212,7 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream) | |||
212 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 212 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
213 | count = src - runtime->dma_addr; | 213 | count = src - runtime->dma_addr; |
214 | else | 214 | else |
215 | count = dst - runtime->dma_addr;; | 215 | count = dst - runtime->dma_addr; |
216 | 216 | ||
217 | spin_unlock(&prtd->lock); | 217 | spin_unlock(&prtd->lock); |
218 | 218 | ||
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c index f67579d52765..4935d1bcbd8d 100644 --- a/sound/soc/davinci/davinci-sffsdr.c +++ b/sound/soc/davinci/davinci-sffsdr.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <sound/soc-dapm.h> | 24 | #include <sound/soc-dapm.h> |
25 | 25 | ||
26 | #include <asm/dma.h> | 26 | #include <asm/dma.h> |
27 | #include <asm/mach-types.h> | ||
27 | #include <asm/plat-sffsdr/sffsdr-fpga.h> | 28 | #include <asm/plat-sffsdr/sffsdr-fpga.h> |
28 | 29 | ||
29 | #include <mach/mcbsp.h> | 30 | #include <mach/mcbsp.h> |
@@ -115,6 +116,9 @@ static int __init sffsdr_init(void) | |||
115 | { | 116 | { |
116 | int ret; | 117 | int ret; |
117 | 118 | ||
119 | if (!machine_is_sffsdr()) | ||
120 | return -EINVAL; | ||
121 | |||
118 | sffsdr_snd_device = platform_device_alloc("soc-audio", 0); | 122 | sffsdr_snd_device = platform_device_alloc("soc-audio", 0); |
119 | if (!sffsdr_snd_device) { | 123 | if (!sffsdr_snd_device) { |
120 | printk(KERN_ERR "platform device allocation failed\n"); | 124 | printk(KERN_ERR "platform device allocation failed\n"); |
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index a7b1d77b2105..4f7f04014585 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig | |||
@@ -10,6 +10,7 @@ config SND_OMAP_SOC_N810 | |||
10 | tristate "SoC Audio support for Nokia N810" | 10 | tristate "SoC Audio support for Nokia N810" |
11 | depends on SND_OMAP_SOC && MACH_NOKIA_N810 | 11 | depends on SND_OMAP_SOC && MACH_NOKIA_N810 |
12 | select SND_OMAP_SOC_MCBSP | 12 | select SND_OMAP_SOC_MCBSP |
13 | select OMAP_MUX | ||
13 | select SND_SOC_TLV320AIC3X | 14 | select SND_SOC_TLV320AIC3X |
14 | help | 15 | help |
15 | Say Y if you want to add support for SoC audio on Nokia N810. | 16 | Say Y if you want to add support for SoC audio on Nokia N810. |
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index bd91594496b1..fcc2f5d9a878 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c | |||
@@ -180,6 +180,19 @@ static int omap3pandora_in_init(struct snd_soc_codec *codec) | |||
180 | { | 180 | { |
181 | int ret; | 181 | int ret; |
182 | 182 | ||
183 | /* All TWL4030 output pins are floating */ | ||
184 | snd_soc_dapm_nc_pin(codec, "OUTL"), | ||
185 | snd_soc_dapm_nc_pin(codec, "OUTR"), | ||
186 | snd_soc_dapm_nc_pin(codec, "EARPIECE"), | ||
187 | snd_soc_dapm_nc_pin(codec, "PREDRIVEL"), | ||
188 | snd_soc_dapm_nc_pin(codec, "PREDRIVER"), | ||
189 | snd_soc_dapm_nc_pin(codec, "HSOL"), | ||
190 | snd_soc_dapm_nc_pin(codec, "HSOR"), | ||
191 | snd_soc_dapm_nc_pin(codec, "CARKITL"), | ||
192 | snd_soc_dapm_nc_pin(codec, "CARKITR"), | ||
193 | snd_soc_dapm_nc_pin(codec, "HFL"), | ||
194 | snd_soc_dapm_nc_pin(codec, "HFR"), | ||
195 | |||
183 | ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, | 196 | ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, |
184 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); | 197 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); |
185 | if (ret < 0) | 198 | if (ret < 0) |
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index c670d08e7c9e..53b9fb127a6d 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c | |||
@@ -61,9 +61,9 @@ static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
61 | 61 | ||
62 | __pxa2xx_pcm_hw_free(substream); | 62 | __pxa2xx_pcm_hw_free(substream); |
63 | 63 | ||
64 | if (prtd->dma_ch) { | 64 | if (prtd->dma_ch >= 0) { |
65 | pxa_free_dma(prtd->dma_ch); | 65 | pxa_free_dma(prtd->dma_ch); |
66 | prtd->dma_ch = 0; | 66 | prtd->dma_ch = -1; |
67 | } | 67 | } |
68 | 68 | ||
69 | return 0; | 69 | return 0; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b098c0b4c584..55fdb4abb179 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1300,6 +1300,8 @@ EXPORT_SYMBOL_GPL(snd_soc_test_bits); | |||
1300 | /** | 1300 | /** |
1301 | * snd_soc_new_pcms - create new sound card and pcms | 1301 | * snd_soc_new_pcms - create new sound card and pcms |
1302 | * @socdev: the SoC audio device | 1302 | * @socdev: the SoC audio device |
1303 | * @idx: ALSA card index | ||
1304 | * @xid: card identification | ||
1303 | * | 1305 | * |
1304 | * Create a new sound card based upon the codec and interface pcms. | 1306 | * Create a new sound card based upon the codec and interface pcms. |
1305 | * | 1307 | * |
@@ -1472,7 +1474,7 @@ EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams); | |||
1472 | * snd_soc_cnew - create new control | 1474 | * snd_soc_cnew - create new control |
1473 | * @_template: control template | 1475 | * @_template: control template |
1474 | * @data: control private data | 1476 | * @data: control private data |
1475 | * @lnng_name: control long name | 1477 | * @long_name: control long name |
1476 | * | 1478 | * |
1477 | * Create a new mixer control from a template control. | 1479 | * Create a new mixer control from a template control. |
1478 | * | 1480 | * |
@@ -1522,7 +1524,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double); | |||
1522 | /** | 1524 | /** |
1523 | * snd_soc_get_enum_double - enumerated double mixer get callback | 1525 | * snd_soc_get_enum_double - enumerated double mixer get callback |
1524 | * @kcontrol: mixer control | 1526 | * @kcontrol: mixer control |
1525 | * @uinfo: control element information | 1527 | * @ucontrol: control element information |
1526 | * | 1528 | * |
1527 | * Callback to get the value of a double enumerated mixer. | 1529 | * Callback to get the value of a double enumerated mixer. |
1528 | * | 1530 | * |
@@ -1551,7 +1553,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double); | |||
1551 | /** | 1553 | /** |
1552 | * snd_soc_put_enum_double - enumerated double mixer put callback | 1554 | * snd_soc_put_enum_double - enumerated double mixer put callback |
1553 | * @kcontrol: mixer control | 1555 | * @kcontrol: mixer control |
1554 | * @uinfo: control element information | 1556 | * @ucontrol: control element information |
1555 | * | 1557 | * |
1556 | * Callback to set the value of a double enumerated mixer. | 1558 | * Callback to set the value of a double enumerated mixer. |
1557 | * | 1559 | * |
@@ -1583,6 +1585,80 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | |||
1583 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); | 1585 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); |
1584 | 1586 | ||
1585 | /** | 1587 | /** |
1588 | * snd_soc_get_value_enum_double - semi enumerated double mixer get callback | ||
1589 | * @kcontrol: mixer control | ||
1590 | * @ucontrol: control element information | ||
1591 | * | ||
1592 | * Callback to get the value of a double semi enumerated mixer. | ||
1593 | * | ||
1594 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1595 | * used for handling bitfield coded enumeration for example. | ||
1596 | * | ||
1597 | * Returns 0 for success. | ||
1598 | */ | ||
1599 | int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1600 | struct snd_ctl_elem_value *ucontrol) | ||
1601 | { | ||
1602 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
1603 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1604 | unsigned short reg_val, val, mux; | ||
1605 | |||
1606 | reg_val = snd_soc_read(codec, e->reg); | ||
1607 | val = (reg_val >> e->shift_l) & e->mask; | ||
1608 | for (mux = 0; mux < e->max; mux++) { | ||
1609 | if (val == e->values[mux]) | ||
1610 | break; | ||
1611 | } | ||
1612 | ucontrol->value.enumerated.item[0] = mux; | ||
1613 | if (e->shift_l != e->shift_r) { | ||
1614 | val = (reg_val >> e->shift_r) & e->mask; | ||
1615 | for (mux = 0; mux < e->max; mux++) { | ||
1616 | if (val == e->values[mux]) | ||
1617 | break; | ||
1618 | } | ||
1619 | ucontrol->value.enumerated.item[1] = mux; | ||
1620 | } | ||
1621 | |||
1622 | return 0; | ||
1623 | } | ||
1624 | EXPORT_SYMBOL_GPL(snd_soc_get_value_enum_double); | ||
1625 | |||
1626 | /** | ||
1627 | * snd_soc_put_value_enum_double - semi enumerated double mixer put callback | ||
1628 | * @kcontrol: mixer control | ||
1629 | * @ucontrol: control element information | ||
1630 | * | ||
1631 | * Callback to set the value of a double semi enumerated mixer. | ||
1632 | * | ||
1633 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1634 | * used for handling bitfield coded enumeration for example. | ||
1635 | * | ||
1636 | * Returns 0 for success. | ||
1637 | */ | ||
1638 | int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1639 | struct snd_ctl_elem_value *ucontrol) | ||
1640 | { | ||
1641 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
1642 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1643 | unsigned short val; | ||
1644 | unsigned short mask; | ||
1645 | |||
1646 | if (ucontrol->value.enumerated.item[0] > e->max - 1) | ||
1647 | return -EINVAL; | ||
1648 | val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l; | ||
1649 | mask = e->mask << e->shift_l; | ||
1650 | if (e->shift_l != e->shift_r) { | ||
1651 | if (ucontrol->value.enumerated.item[1] > e->max - 1) | ||
1652 | return -EINVAL; | ||
1653 | val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r; | ||
1654 | mask |= e->mask << e->shift_r; | ||
1655 | } | ||
1656 | |||
1657 | return snd_soc_update_bits(codec, e->reg, mask, val); | ||
1658 | } | ||
1659 | EXPORT_SYMBOL_GPL(snd_soc_put_value_enum_double); | ||
1660 | |||
1661 | /** | ||
1586 | * snd_soc_info_enum_ext - external enumerated single mixer info callback | 1662 | * snd_soc_info_enum_ext - external enumerated single mixer info callback |
1587 | * @kcontrol: mixer control | 1663 | * @kcontrol: mixer control |
1588 | * @uinfo: control element information | 1664 | * @uinfo: control element information |
@@ -1668,7 +1744,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw); | |||
1668 | /** | 1744 | /** |
1669 | * snd_soc_get_volsw - single mixer get callback | 1745 | * snd_soc_get_volsw - single mixer get callback |
1670 | * @kcontrol: mixer control | 1746 | * @kcontrol: mixer control |
1671 | * @uinfo: control element information | 1747 | * @ucontrol: control element information |
1672 | * | 1748 | * |
1673 | * Callback to get the value of a single mixer control. | 1749 | * Callback to get the value of a single mixer control. |
1674 | * | 1750 | * |
@@ -1707,7 +1783,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw); | |||
1707 | /** | 1783 | /** |
1708 | * snd_soc_put_volsw - single mixer put callback | 1784 | * snd_soc_put_volsw - single mixer put callback |
1709 | * @kcontrol: mixer control | 1785 | * @kcontrol: mixer control |
1710 | * @uinfo: control element information | 1786 | * @ucontrol: control element information |
1711 | * | 1787 | * |
1712 | * Callback to set the value of a single mixer control. | 1788 | * Callback to set the value of a single mixer control. |
1713 | * | 1789 | * |
@@ -1775,7 +1851,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r); | |||
1775 | /** | 1851 | /** |
1776 | * snd_soc_get_volsw_2r - double mixer get callback | 1852 | * snd_soc_get_volsw_2r - double mixer get callback |
1777 | * @kcontrol: mixer control | 1853 | * @kcontrol: mixer control |
1778 | * @uinfo: control element information | 1854 | * @ucontrol: control element information |
1779 | * | 1855 | * |
1780 | * Callback to get the value of a double mixer control that spans 2 registers. | 1856 | * Callback to get the value of a double mixer control that spans 2 registers. |
1781 | * | 1857 | * |
@@ -1812,7 +1888,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_2r); | |||
1812 | /** | 1888 | /** |
1813 | * snd_soc_put_volsw_2r - double mixer set callback | 1889 | * snd_soc_put_volsw_2r - double mixer set callback |
1814 | * @kcontrol: mixer control | 1890 | * @kcontrol: mixer control |
1815 | * @uinfo: control element information | 1891 | * @ucontrol: control element information |
1816 | * | 1892 | * |
1817 | * Callback to set the value of a double mixer control that spans 2 registers. | 1893 | * Callback to set the value of a double mixer control that spans 2 registers. |
1818 | * | 1894 | * |
@@ -1882,7 +1958,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_s8); | |||
1882 | /** | 1958 | /** |
1883 | * snd_soc_get_volsw_s8 - signed mixer get callback | 1959 | * snd_soc_get_volsw_s8 - signed mixer get callback |
1884 | * @kcontrol: mixer control | 1960 | * @kcontrol: mixer control |
1885 | * @uinfo: control element information | 1961 | * @ucontrol: control element information |
1886 | * | 1962 | * |
1887 | * Callback to get the value of a signed mixer control. | 1963 | * Callback to get the value of a signed mixer control. |
1888 | * | 1964 | * |
@@ -1909,7 +1985,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_s8); | |||
1909 | /** | 1985 | /** |
1910 | * snd_soc_put_volsw_sgn - signed mixer put callback | 1986 | * snd_soc_put_volsw_sgn - signed mixer put callback |
1911 | * @kcontrol: mixer control | 1987 | * @kcontrol: mixer control |
1912 | * @uinfo: control element information | 1988 | * @ucontrol: control element information |
1913 | * | 1989 | * |
1914 | * Callback to set the value of a signed mixer control. | 1990 | * Callback to set the value of a signed mixer control. |
1915 | * | 1991 | * |
@@ -1954,7 +2030,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk); | |||
1954 | /** | 2030 | /** |
1955 | * snd_soc_dai_set_clkdiv - configure DAI clock dividers. | 2031 | * snd_soc_dai_set_clkdiv - configure DAI clock dividers. |
1956 | * @dai: DAI | 2032 | * @dai: DAI |
1957 | * @clk_id: DAI specific clock divider ID | 2033 | * @div_id: DAI specific clock divider ID |
1958 | * @div: new clock divisor. | 2034 | * @div: new clock divisor. |
1959 | * | 2035 | * |
1960 | * Configures the clock dividers. This is used to derive the best DAI bit and | 2036 | * Configures the clock dividers. This is used to derive the best DAI bit and |
@@ -2060,7 +2136,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute); | |||
2060 | /** | 2136 | /** |
2061 | * snd_soc_register_card - Register a card with the ASoC core | 2137 | * snd_soc_register_card - Register a card with the ASoC core |
2062 | * | 2138 | * |
2063 | * @param card Card to register | 2139 | * @card: Card to register |
2064 | * | 2140 | * |
2065 | * Note that currently this is an internal only function: it will be | 2141 | * Note that currently this is an internal only function: it will be |
2066 | * exposed to machine drivers after further backporting of ASoC v2 | 2142 | * exposed to machine drivers after further backporting of ASoC v2 |
@@ -2087,7 +2163,7 @@ static int snd_soc_register_card(struct snd_soc_card *card) | |||
2087 | /** | 2163 | /** |
2088 | * snd_soc_unregister_card - Unregister a card with the ASoC core | 2164 | * snd_soc_unregister_card - Unregister a card with the ASoC core |
2089 | * | 2165 | * |
2090 | * @param card Card to unregister | 2166 | * @card: Card to unregister |
2091 | * | 2167 | * |
2092 | * Note that currently this is an internal only function: it will be | 2168 | * Note that currently this is an internal only function: it will be |
2093 | * exposed to machine drivers after further backporting of ASoC v2 | 2169 | * exposed to machine drivers after further backporting of ASoC v2 |
@@ -2107,7 +2183,7 @@ static int snd_soc_unregister_card(struct snd_soc_card *card) | |||
2107 | /** | 2183 | /** |
2108 | * snd_soc_register_dai - Register a DAI with the ASoC core | 2184 | * snd_soc_register_dai - Register a DAI with the ASoC core |
2109 | * | 2185 | * |
2110 | * @param dai DAI to register | 2186 | * @dai: DAI to register |
2111 | */ | 2187 | */ |
2112 | int snd_soc_register_dai(struct snd_soc_dai *dai) | 2188 | int snd_soc_register_dai(struct snd_soc_dai *dai) |
2113 | { | 2189 | { |
@@ -2134,7 +2210,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dai); | |||
2134 | /** | 2210 | /** |
2135 | * snd_soc_unregister_dai - Unregister a DAI from the ASoC core | 2211 | * snd_soc_unregister_dai - Unregister a DAI from the ASoC core |
2136 | * | 2212 | * |
2137 | * @param dai DAI to unregister | 2213 | * @dai: DAI to unregister |
2138 | */ | 2214 | */ |
2139 | void snd_soc_unregister_dai(struct snd_soc_dai *dai) | 2215 | void snd_soc_unregister_dai(struct snd_soc_dai *dai) |
2140 | { | 2216 | { |
@@ -2149,8 +2225,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai); | |||
2149 | /** | 2225 | /** |
2150 | * snd_soc_register_dais - Register multiple DAIs with the ASoC core | 2226 | * snd_soc_register_dais - Register multiple DAIs with the ASoC core |
2151 | * | 2227 | * |
2152 | * @param dai Array of DAIs to register | 2228 | * @dai: Array of DAIs to register |
2153 | * @param count Number of DAIs | 2229 | * @count: Number of DAIs |
2154 | */ | 2230 | */ |
2155 | int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) | 2231 | int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) |
2156 | { | 2232 | { |
@@ -2175,8 +2251,8 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dais); | |||
2175 | /** | 2251 | /** |
2176 | * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core | 2252 | * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core |
2177 | * | 2253 | * |
2178 | * @param dai Array of DAIs to unregister | 2254 | * @dai: Array of DAIs to unregister |
2179 | * @param count Number of DAIs | 2255 | * @count: Number of DAIs |
2180 | */ | 2256 | */ |
2181 | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) | 2257 | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) |
2182 | { | 2258 | { |
@@ -2190,7 +2266,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dais); | |||
2190 | /** | 2266 | /** |
2191 | * snd_soc_register_platform - Register a platform with the ASoC core | 2267 | * snd_soc_register_platform - Register a platform with the ASoC core |
2192 | * | 2268 | * |
2193 | * @param platform platform to register | 2269 | * @platform: platform to register |
2194 | */ | 2270 | */ |
2195 | int snd_soc_register_platform(struct snd_soc_platform *platform) | 2271 | int snd_soc_register_platform(struct snd_soc_platform *platform) |
2196 | { | 2272 | { |
@@ -2213,7 +2289,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_platform); | |||
2213 | /** | 2289 | /** |
2214 | * snd_soc_unregister_platform - Unregister a platform from the ASoC core | 2290 | * snd_soc_unregister_platform - Unregister a platform from the ASoC core |
2215 | * | 2291 | * |
2216 | * @param platform platform to unregister | 2292 | * @platform: platform to unregister |
2217 | */ | 2293 | */ |
2218 | void snd_soc_unregister_platform(struct snd_soc_platform *platform) | 2294 | void snd_soc_unregister_platform(struct snd_soc_platform *platform) |
2219 | { | 2295 | { |
@@ -2228,7 +2304,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); | |||
2228 | /** | 2304 | /** |
2229 | * snd_soc_register_codec - Register a codec with the ASoC core | 2305 | * snd_soc_register_codec - Register a codec with the ASoC core |
2230 | * | 2306 | * |
2231 | * @param codec codec to register | 2307 | * @codec: codec to register |
2232 | */ | 2308 | */ |
2233 | int snd_soc_register_codec(struct snd_soc_codec *codec) | 2309 | int snd_soc_register_codec(struct snd_soc_codec *codec) |
2234 | { | 2310 | { |
@@ -2255,7 +2331,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec); | |||
2255 | /** | 2331 | /** |
2256 | * snd_soc_unregister_codec - Unregister a codec from the ASoC core | 2332 | * snd_soc_unregister_codec - Unregister a codec from the ASoC core |
2257 | * | 2333 | * |
2258 | * @param codec codec to unregister | 2334 | * @codec: codec to unregister |
2259 | */ | 2335 | */ |
2260 | void snd_soc_unregister_codec(struct snd_soc_codec *codec) | 2336 | void snd_soc_unregister_codec(struct snd_soc_codec *codec) |
2261 | { | 2337 | { |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8863eddbac02..493a4e8aa273 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -53,13 +53,15 @@ | |||
53 | /* dapm power sequences - make this per codec in the future */ | 53 | /* dapm power sequences - make this per codec in the future */ |
54 | static int dapm_up_seq[] = { | 54 | static int dapm_up_seq[] = { |
55 | snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic, | 55 | snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic, |
56 | snd_soc_dapm_mux, snd_soc_dapm_dac, snd_soc_dapm_mixer, snd_soc_dapm_pga, | 56 | snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_dac, |
57 | snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, snd_soc_dapm_post | 57 | snd_soc_dapm_mixer, snd_soc_dapm_pga, snd_soc_dapm_adc, snd_soc_dapm_hp, |
58 | snd_soc_dapm_spk, snd_soc_dapm_post | ||
58 | }; | 59 | }; |
59 | static int dapm_down_seq[] = { | 60 | static int dapm_down_seq[] = { |
60 | snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, | 61 | snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, |
61 | snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic, | 62 | snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic, |
62 | snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_post | 63 | snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_value_mux, |
64 | snd_soc_dapm_post | ||
63 | }; | 65 | }; |
64 | 66 | ||
65 | static int dapm_status = 1; | 67 | static int dapm_status = 1; |
@@ -134,6 +136,25 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, | |||
134 | } | 136 | } |
135 | } | 137 | } |
136 | break; | 138 | break; |
139 | case snd_soc_dapm_value_mux: { | ||
140 | struct soc_enum *e = (struct soc_enum *) | ||
141 | w->kcontrols[i].private_value; | ||
142 | int val, item; | ||
143 | |||
144 | val = snd_soc_read(w->codec, e->reg); | ||
145 | val = (val >> e->shift_l) & e->mask; | ||
146 | for (item = 0; item < e->max; item++) { | ||
147 | if (val == e->values[item]) | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | p->connect = 0; | ||
152 | for (i = 0; i < e->max; i++) { | ||
153 | if (!(strcmp(p->name, e->texts[i])) && item == i) | ||
154 | p->connect = 1; | ||
155 | } | ||
156 | } | ||
157 | break; | ||
137 | /* does not effect routing - always connected */ | 158 | /* does not effect routing - always connected */ |
138 | case snd_soc_dapm_pga: | 159 | case snd_soc_dapm_pga: |
139 | case snd_soc_dapm_output: | 160 | case snd_soc_dapm_output: |
@@ -653,6 +674,7 @@ static void dbg_dump_dapm(struct snd_soc_codec* codec, const char *action) | |||
653 | case snd_soc_dapm_vmid: | 674 | case snd_soc_dapm_vmid: |
654 | continue; | 675 | continue; |
655 | case snd_soc_dapm_mux: | 676 | case snd_soc_dapm_mux: |
677 | case snd_soc_dapm_value_mux: | ||
656 | case snd_soc_dapm_output: | 678 | case snd_soc_dapm_output: |
657 | case snd_soc_dapm_input: | 679 | case snd_soc_dapm_input: |
658 | case snd_soc_dapm_switch: | 680 | case snd_soc_dapm_switch: |
@@ -960,6 +982,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, | |||
960 | path->connect = 1; | 982 | path->connect = 1; |
961 | return 0; | 983 | return 0; |
962 | case snd_soc_dapm_mux: | 984 | case snd_soc_dapm_mux: |
985 | case snd_soc_dapm_value_mux: | ||
963 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, | 986 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, |
964 | &wsink->kcontrols[0]); | 987 | &wsink->kcontrols[0]); |
965 | if (ret != 0) | 988 | if (ret != 0) |
@@ -1047,6 +1070,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec) | |||
1047 | dapm_new_mixer(codec, w); | 1070 | dapm_new_mixer(codec, w); |
1048 | break; | 1071 | break; |
1049 | case snd_soc_dapm_mux: | 1072 | case snd_soc_dapm_mux: |
1073 | case snd_soc_dapm_value_mux: | ||
1050 | dapm_new_mux(codec, w); | 1074 | dapm_new_mux(codec, w); |
1051 | break; | 1075 | break; |
1052 | case snd_soc_dapm_adc: | 1076 | case snd_soc_dapm_adc: |
@@ -1077,7 +1101,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets); | |||
1077 | /** | 1101 | /** |
1078 | * snd_soc_dapm_get_volsw - dapm mixer get callback | 1102 | * snd_soc_dapm_get_volsw - dapm mixer get callback |
1079 | * @kcontrol: mixer control | 1103 | * @kcontrol: mixer control |
1080 | * @uinfo: control element information | 1104 | * @ucontrol: control element information |
1081 | * | 1105 | * |
1082 | * Callback to get the value of a dapm mixer control. | 1106 | * Callback to get the value of a dapm mixer control. |
1083 | * | 1107 | * |
@@ -1122,7 +1146,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw); | |||
1122 | /** | 1146 | /** |
1123 | * snd_soc_dapm_put_volsw - dapm mixer set callback | 1147 | * snd_soc_dapm_put_volsw - dapm mixer set callback |
1124 | * @kcontrol: mixer control | 1148 | * @kcontrol: mixer control |
1125 | * @uinfo: control element information | 1149 | * @ucontrol: control element information |
1126 | * | 1150 | * |
1127 | * Callback to set the value of a dapm mixer control. | 1151 | * Callback to set the value of a dapm mixer control. |
1128 | * | 1152 | * |
@@ -1193,7 +1217,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); | |||
1193 | /** | 1217 | /** |
1194 | * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback | 1218 | * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback |
1195 | * @kcontrol: mixer control | 1219 | * @kcontrol: mixer control |
1196 | * @uinfo: control element information | 1220 | * @ucontrol: control element information |
1197 | * | 1221 | * |
1198 | * Callback to get the value of a dapm enumerated double mixer control. | 1222 | * Callback to get the value of a dapm enumerated double mixer control. |
1199 | * | 1223 | * |
@@ -1221,7 +1245,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); | |||
1221 | /** | 1245 | /** |
1222 | * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback | 1246 | * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback |
1223 | * @kcontrol: mixer control | 1247 | * @kcontrol: mixer control |
1224 | * @uinfo: control element information | 1248 | * @ucontrol: control element information |
1225 | * | 1249 | * |
1226 | * Callback to set the value of a dapm enumerated double mixer control. | 1250 | * Callback to set the value of a dapm enumerated double mixer control. |
1227 | * | 1251 | * |
@@ -1274,6 +1298,103 @@ out: | |||
1274 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double); | 1298 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double); |
1275 | 1299 | ||
1276 | /** | 1300 | /** |
1301 | * snd_soc_dapm_get_value_enum_double - dapm semi enumerated double mixer get | ||
1302 | * callback | ||
1303 | * @kcontrol: mixer control | ||
1304 | * @ucontrol: control element information | ||
1305 | * | ||
1306 | * Callback to get the value of a dapm semi enumerated double mixer control. | ||
1307 | * | ||
1308 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1309 | * used for handling bitfield coded enumeration for example. | ||
1310 | * | ||
1311 | * Returns 0 for success. | ||
1312 | */ | ||
1313 | int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1314 | struct snd_ctl_elem_value *ucontrol) | ||
1315 | { | ||
1316 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | ||
1317 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1318 | unsigned short reg_val, val, mux; | ||
1319 | |||
1320 | reg_val = snd_soc_read(widget->codec, e->reg); | ||
1321 | val = (reg_val >> e->shift_l) & e->mask; | ||
1322 | for (mux = 0; mux < e->max; mux++) { | ||
1323 | if (val == e->values[mux]) | ||
1324 | break; | ||
1325 | } | ||
1326 | ucontrol->value.enumerated.item[0] = mux; | ||
1327 | if (e->shift_l != e->shift_r) { | ||
1328 | val = (reg_val >> e->shift_r) & e->mask; | ||
1329 | for (mux = 0; mux < e->max; mux++) { | ||
1330 | if (val == e->values[mux]) | ||
1331 | break; | ||
1332 | } | ||
1333 | ucontrol->value.enumerated.item[1] = mux; | ||
1334 | } | ||
1335 | |||
1336 | return 0; | ||
1337 | } | ||
1338 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_value_enum_double); | ||
1339 | |||
1340 | /** | ||
1341 | * snd_soc_dapm_put_value_enum_double - dapm semi enumerated double mixer set | ||
1342 | * callback | ||
1343 | * @kcontrol: mixer control | ||
1344 | * @ucontrol: control element information | ||
1345 | * | ||
1346 | * Callback to set the value of a dapm semi enumerated double mixer control. | ||
1347 | * | ||
1348 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1349 | * used for handling bitfield coded enumeration for example. | ||
1350 | * | ||
1351 | * Returns 0 for success. | ||
1352 | */ | ||
1353 | int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1354 | struct snd_ctl_elem_value *ucontrol) | ||
1355 | { | ||
1356 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | ||
1357 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1358 | unsigned short val, mux; | ||
1359 | unsigned short mask; | ||
1360 | int ret = 0; | ||
1361 | |||
1362 | if (ucontrol->value.enumerated.item[0] > e->max - 1) | ||
1363 | return -EINVAL; | ||
1364 | mux = ucontrol->value.enumerated.item[0]; | ||
1365 | val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l; | ||
1366 | mask = e->mask << e->shift_l; | ||
1367 | if (e->shift_l != e->shift_r) { | ||
1368 | if (ucontrol->value.enumerated.item[1] > e->max - 1) | ||
1369 | return -EINVAL; | ||
1370 | val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r; | ||
1371 | mask |= e->mask << e->shift_r; | ||
1372 | } | ||
1373 | |||
1374 | mutex_lock(&widget->codec->mutex); | ||
1375 | widget->value = val; | ||
1376 | dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); | ||
1377 | if (widget->event) { | ||
1378 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { | ||
1379 | ret = widget->event(widget, | ||
1380 | kcontrol, SND_SOC_DAPM_PRE_REG); | ||
1381 | if (ret < 0) | ||
1382 | goto out; | ||
1383 | } | ||
1384 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); | ||
1385 | if (widget->event_flags & SND_SOC_DAPM_POST_REG) | ||
1386 | ret = widget->event(widget, | ||
1387 | kcontrol, SND_SOC_DAPM_POST_REG); | ||
1388 | } else | ||
1389 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); | ||
1390 | |||
1391 | out: | ||
1392 | mutex_unlock(&widget->codec->mutex); | ||
1393 | return ret; | ||
1394 | } | ||
1395 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_value_enum_double); | ||
1396 | |||
1397 | /** | ||
1277 | * snd_soc_dapm_new_control - create new dapm control | 1398 | * snd_soc_dapm_new_control - create new dapm control |
1278 | * @codec: audio codec | 1399 | * @codec: audio codec |
1279 | * @widget: widget template | 1400 | * @widget: widget template |
@@ -1419,7 +1540,7 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
1419 | 1540 | ||
1420 | /** | 1541 | /** |
1421 | * snd_soc_dapm_enable_pin - enable pin. | 1542 | * snd_soc_dapm_enable_pin - enable pin. |
1422 | * @snd_soc_codec: SoC codec | 1543 | * @codec: SoC codec |
1423 | * @pin: pin name | 1544 | * @pin: pin name |
1424 | * | 1545 | * |
1425 | * Enables input/output pin and it's parents or children widgets iff there is | 1546 | * Enables input/output pin and it's parents or children widgets iff there is |
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index d44bf98e965e..41c387587474 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -2057,7 +2057,7 @@ static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_dev | |||
2057 | if (err) | 2057 | if (err) |
2058 | return err; | 2058 | return err; |
2059 | 2059 | ||
2060 | sprintf(card->longname, "%s at 0x%lx, irq %d", | 2060 | sprintf(card->longname, "%s at 0x%llx, irq %d", |
2061 | card->shortname, | 2061 | card->shortname, |
2062 | op->resource[0].start, | 2062 | op->resource[0].start, |
2063 | op->irqs[0]); | 2063 | op->irqs[0]); |
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index a62500e387a6..41c36b055f6b 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); | 44 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); |
45 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.9"); | 45 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10"); |
46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
47 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," | 47 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," |
48 | "{Native Instruments, RigKontrol3}," | 48 | "{Native Instruments, RigKontrol3}," |
diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h index f9fbdbae269d..ab56e738c5fc 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/caiaq-device.h | |||
@@ -75,6 +75,7 @@ struct snd_usb_caiaqdev { | |||
75 | wait_queue_head_t ep1_wait_queue; | 75 | wait_queue_head_t ep1_wait_queue; |
76 | wait_queue_head_t prepare_wait_queue; | 76 | wait_queue_head_t prepare_wait_queue; |
77 | int spec_received, audio_parm_answer; | 77 | int spec_received, audio_parm_answer; |
78 | int midi_out_active; | ||
78 | 79 | ||
79 | char vendor_name[CAIAQ_USB_STR_LEN]; | 80 | char vendor_name[CAIAQ_USB_STR_LEN]; |
80 | char product_name[CAIAQ_USB_STR_LEN]; | 81 | char product_name[CAIAQ_USB_STR_LEN]; |
diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c index 30b57f97c6e4..f19fd360c936 100644 --- a/sound/usb/caiaq/caiaq-midi.c +++ b/sound/usb/caiaq/caiaq-midi.c | |||
@@ -59,6 +59,11 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea | |||
59 | 59 | ||
60 | static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) | 60 | static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) |
61 | { | 61 | { |
62 | struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; | ||
63 | if (dev->midi_out_active) { | ||
64 | usb_kill_urb(&dev->midi_out_urb); | ||
65 | dev->midi_out_active = 0; | ||
66 | } | ||
62 | return 0; | 67 | return 0; |
63 | } | 68 | } |
64 | 69 | ||
@@ -69,7 +74,8 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, | |||
69 | 74 | ||
70 | dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; | 75 | dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; |
71 | dev->midi_out_buf[1] = 0; /* port */ | 76 | dev->midi_out_buf[1] = 0; /* port */ |
72 | len = snd_rawmidi_transmit_peek(substream, dev->midi_out_buf+3, EP1_BUFSIZE-3); | 77 | len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3, |
78 | EP1_BUFSIZE - 3); | ||
73 | 79 | ||
74 | if (len <= 0) | 80 | if (len <= 0) |
75 | return; | 81 | return; |
@@ -79,24 +85,24 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, | |||
79 | 85 | ||
80 | ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); | 86 | ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); |
81 | if (ret < 0) | 87 | if (ret < 0) |
82 | log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed, %d\n", | 88 | log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," |
83 | substream, ret); | 89 | "ret=%d, len=%d\n", |
90 | substream, ret, len); | ||
91 | else | ||
92 | dev->midi_out_active = 1; | ||
84 | } | 93 | } |
85 | 94 | ||
86 | static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) | 95 | static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) |
87 | { | 96 | { |
88 | struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; | 97 | struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; |
89 | 98 | ||
90 | if (dev->midi_out_substream != NULL) | 99 | if (up) { |
91 | return; | 100 | dev->midi_out_substream = substream; |
92 | 101 | if (!dev->midi_out_active) | |
93 | if (!up) { | 102 | snd_usb_caiaq_midi_send(dev, substream); |
103 | } else { | ||
94 | dev->midi_out_substream = NULL; | 104 | dev->midi_out_substream = NULL; |
95 | return; | ||
96 | } | 105 | } |
97 | |||
98 | dev->midi_out_substream = substream; | ||
99 | snd_usb_caiaq_midi_send(dev, substream); | ||
100 | } | 106 | } |
101 | 107 | ||
102 | 108 | ||
@@ -161,16 +167,14 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) | |||
161 | void snd_usb_caiaq_midi_output_done(struct urb* urb) | 167 | void snd_usb_caiaq_midi_output_done(struct urb* urb) |
162 | { | 168 | { |
163 | struct snd_usb_caiaqdev *dev = urb->context; | 169 | struct snd_usb_caiaqdev *dev = urb->context; |
164 | char *buf = urb->transfer_buffer; | ||
165 | 170 | ||
171 | dev->midi_out_active = 0; | ||
166 | if (urb->status != 0) | 172 | if (urb->status != 0) |
167 | return; | 173 | return; |
168 | 174 | ||
169 | if (!dev->midi_out_substream) | 175 | if (!dev->midi_out_substream) |
170 | return; | 176 | return; |
171 | 177 | ||
172 | snd_rawmidi_transmit_ack(dev->midi_out_substream, buf[2]); | ||
173 | dev->midi_out_substream = NULL; | ||
174 | snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); | 178 | snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); |
175 | } | 179 | } |
176 | 180 | ||
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index bc8bd00047ad..330f2fbff2d1 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -111,6 +111,8 @@ struct mixer_build { | |||
111 | const struct usbmix_selector_map *selector_map; | 111 | const struct usbmix_selector_map *selector_map; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | #define MAX_CHANNELS 10 /* max logical channels */ | ||
115 | |||
114 | struct usb_mixer_elem_info { | 116 | struct usb_mixer_elem_info { |
115 | struct usb_mixer_interface *mixer; | 117 | struct usb_mixer_interface *mixer; |
116 | struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */ | 118 | struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */ |
@@ -121,6 +123,8 @@ struct usb_mixer_elem_info { | |||
121 | int channels; | 123 | int channels; |
122 | int val_type; | 124 | int val_type; |
123 | int min, max, res; | 125 | int min, max, res; |
126 | int cached; | ||
127 | int cache_val[MAX_CHANNELS]; | ||
124 | u8 initialized; | 128 | u8 initialized; |
125 | }; | 129 | }; |
126 | 130 | ||
@@ -182,8 +186,6 @@ enum { | |||
182 | USB_PROC_DCR_RELEASE = 6, | 186 | USB_PROC_DCR_RELEASE = 6, |
183 | }; | 187 | }; |
184 | 188 | ||
185 | #define MAX_CHANNELS 10 /* max logical channels */ | ||
186 | |||
187 | 189 | ||
188 | /* | 190 | /* |
189 | * manual mapping of mixer names | 191 | * manual mapping of mixer names |
@@ -377,11 +379,35 @@ static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int * | |||
377 | } | 379 | } |
378 | 380 | ||
379 | /* channel = 0: master, 1 = first channel */ | 381 | /* channel = 0: master, 1 = first channel */ |
380 | static inline int get_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int *value) | 382 | static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval, |
383 | int channel, int *value) | ||
381 | { | 384 | { |
382 | return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); | 385 | return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); |
383 | } | 386 | } |
384 | 387 | ||
388 | static int get_cur_mix_value(struct usb_mixer_elem_info *cval, | ||
389 | int channel, int index, int *value) | ||
390 | { | ||
391 | int err; | ||
392 | |||
393 | if (cval->cached & (1 << channel)) { | ||
394 | *value = cval->cache_val[index]; | ||
395 | return 0; | ||
396 | } | ||
397 | err = get_cur_mix_raw(cval, channel, value); | ||
398 | if (err < 0) { | ||
399 | if (!cval->mixer->ignore_ctl_error) | ||
400 | snd_printd(KERN_ERR "cannot get current value for " | ||
401 | "control %d ch %d: err = %d\n", | ||
402 | cval->control, channel, err); | ||
403 | return err; | ||
404 | } | ||
405 | cval->cached |= 1 << channel; | ||
406 | cval->cache_val[index] = *value; | ||
407 | return 0; | ||
408 | } | ||
409 | |||
410 | |||
385 | /* | 411 | /* |
386 | * set a mixer value | 412 | * set a mixer value |
387 | */ | 413 | */ |
@@ -413,9 +439,17 @@ static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int v | |||
413 | return set_ctl_value(cval, SET_CUR, validx, value); | 439 | return set_ctl_value(cval, SET_CUR, validx, value); |
414 | } | 440 | } |
415 | 441 | ||
416 | static inline int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int value) | 442 | static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, |
443 | int index, int value) | ||
417 | { | 444 | { |
418 | return set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, value); | 445 | int err; |
446 | err = set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, | ||
447 | value); | ||
448 | if (err < 0) | ||
449 | return err; | ||
450 | cval->cached |= 1 << channel; | ||
451 | cval->cache_val[index] = value; | ||
452 | return 0; | ||
419 | } | 453 | } |
420 | 454 | ||
421 | /* | 455 | /* |
@@ -719,7 +753,7 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) | |||
719 | if (cval->min + cval->res < cval->max) { | 753 | if (cval->min + cval->res < cval->max) { |
720 | int last_valid_res = cval->res; | 754 | int last_valid_res = cval->res; |
721 | int saved, test, check; | 755 | int saved, test, check; |
722 | get_cur_mix_value(cval, minchn, &saved); | 756 | get_cur_mix_raw(cval, minchn, &saved); |
723 | for (;;) { | 757 | for (;;) { |
724 | test = saved; | 758 | test = saved; |
725 | if (test < cval->max) | 759 | if (test < cval->max) |
@@ -727,8 +761,8 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) | |||
727 | else | 761 | else |
728 | test -= cval->res; | 762 | test -= cval->res; |
729 | if (test < cval->min || test > cval->max || | 763 | if (test < cval->min || test > cval->max || |
730 | set_cur_mix_value(cval, minchn, test) || | 764 | set_cur_mix_value(cval, minchn, 0, test) || |
731 | get_cur_mix_value(cval, minchn, &check)) { | 765 | get_cur_mix_raw(cval, minchn, &check)) { |
732 | cval->res = last_valid_res; | 766 | cval->res = last_valid_res; |
733 | break; | 767 | break; |
734 | } | 768 | } |
@@ -736,7 +770,7 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) | |||
736 | break; | 770 | break; |
737 | cval->res *= 2; | 771 | cval->res *= 2; |
738 | } | 772 | } |
739 | set_cur_mix_value(cval, minchn, saved); | 773 | set_cur_mix_value(cval, minchn, 0, saved); |
740 | } | 774 | } |
741 | 775 | ||
742 | cval->initialized = 1; | 776 | cval->initialized = 1; |
@@ -776,35 +810,25 @@ static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
776 | struct usb_mixer_elem_info *cval = kcontrol->private_data; | 810 | struct usb_mixer_elem_info *cval = kcontrol->private_data; |
777 | int c, cnt, val, err; | 811 | int c, cnt, val, err; |
778 | 812 | ||
813 | ucontrol->value.integer.value[0] = cval->min; | ||
779 | if (cval->cmask) { | 814 | if (cval->cmask) { |
780 | cnt = 0; | 815 | cnt = 0; |
781 | for (c = 0; c < MAX_CHANNELS; c++) { | 816 | for (c = 0; c < MAX_CHANNELS; c++) { |
782 | if (cval->cmask & (1 << c)) { | 817 | if (!(cval->cmask & (1 << c))) |
783 | err = get_cur_mix_value(cval, c + 1, &val); | 818 | continue; |
784 | if (err < 0) { | 819 | err = get_cur_mix_value(cval, c + 1, cnt, &val); |
785 | if (cval->mixer->ignore_ctl_error) { | 820 | if (err < 0) |
786 | ucontrol->value.integer.value[0] = cval->min; | 821 | return cval->mixer->ignore_ctl_error ? 0 : err; |
787 | return 0; | 822 | val = get_relative_value(cval, val); |
788 | } | 823 | ucontrol->value.integer.value[cnt] = val; |
789 | snd_printd(KERN_ERR "cannot get current value for control %d ch %d: err = %d\n", cval->control, c + 1, err); | 824 | cnt++; |
790 | return err; | ||
791 | } | ||
792 | val = get_relative_value(cval, val); | ||
793 | ucontrol->value.integer.value[cnt] = val; | ||
794 | cnt++; | ||
795 | } | ||
796 | } | 825 | } |
826 | return 0; | ||
797 | } else { | 827 | } else { |
798 | /* master channel */ | 828 | /* master channel */ |
799 | err = get_cur_mix_value(cval, 0, &val); | 829 | err = get_cur_mix_value(cval, 0, 0, &val); |
800 | if (err < 0) { | 830 | if (err < 0) |
801 | if (cval->mixer->ignore_ctl_error) { | 831 | return cval->mixer->ignore_ctl_error ? 0 : err; |
802 | ucontrol->value.integer.value[0] = cval->min; | ||
803 | return 0; | ||
804 | } | ||
805 | snd_printd(KERN_ERR "cannot get current value for control %d master ch: err = %d\n", cval->control, err); | ||
806 | return err; | ||
807 | } | ||
808 | val = get_relative_value(cval, val); | 832 | val = get_relative_value(cval, val); |
809 | ucontrol->value.integer.value[0] = val; | 833 | ucontrol->value.integer.value[0] = val; |
810 | } | 834 | } |
@@ -821,34 +845,28 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
821 | if (cval->cmask) { | 845 | if (cval->cmask) { |
822 | cnt = 0; | 846 | cnt = 0; |
823 | for (c = 0; c < MAX_CHANNELS; c++) { | 847 | for (c = 0; c < MAX_CHANNELS; c++) { |
824 | if (cval->cmask & (1 << c)) { | 848 | if (!(cval->cmask & (1 << c))) |
825 | err = get_cur_mix_value(cval, c + 1, &oval); | 849 | continue; |
826 | if (err < 0) { | 850 | err = get_cur_mix_value(cval, c + 1, cnt, &oval); |
827 | if (cval->mixer->ignore_ctl_error) | 851 | if (err < 0) |
828 | return 0; | 852 | return cval->mixer->ignore_ctl_error ? 0 : err; |
829 | return err; | 853 | val = ucontrol->value.integer.value[cnt]; |
830 | } | 854 | val = get_abs_value(cval, val); |
831 | val = ucontrol->value.integer.value[cnt]; | 855 | if (oval != val) { |
832 | val = get_abs_value(cval, val); | 856 | set_cur_mix_value(cval, c + 1, cnt, val); |
833 | if (oval != val) { | 857 | changed = 1; |
834 | set_cur_mix_value(cval, c + 1, val); | ||
835 | changed = 1; | ||
836 | } | ||
837 | get_cur_mix_value(cval, c + 1, &val); | ||
838 | cnt++; | ||
839 | } | 858 | } |
859 | cnt++; | ||
840 | } | 860 | } |
841 | } else { | 861 | } else { |
842 | /* master channel */ | 862 | /* master channel */ |
843 | err = get_cur_mix_value(cval, 0, &oval); | 863 | err = get_cur_mix_value(cval, 0, 0, &oval); |
844 | if (err < 0 && cval->mixer->ignore_ctl_error) | ||
845 | return 0; | ||
846 | if (err < 0) | 864 | if (err < 0) |
847 | return err; | 865 | return cval->mixer->ignore_ctl_error ? 0 : err; |
848 | val = ucontrol->value.integer.value[0]; | 866 | val = ucontrol->value.integer.value[0]; |
849 | val = get_abs_value(cval, val); | 867 | val = get_abs_value(cval, val); |
850 | if (val != oval) { | 868 | if (val != oval) { |
851 | set_cur_mix_value(cval, 0, val); | 869 | set_cur_mix_value(cval, 0, 0, val); |
852 | changed = 1; | 870 | changed = 1; |
853 | } | 871 | } |
854 | } | 872 | } |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index ca26c532e77e..11639bd72a51 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -238,7 +238,7 @@ static void i_usX2Y_In04Int(struct urb *urb) | |||
238 | send = 0; | 238 | send = 0; |
239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) | 239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) |
240 | if (0 == usX2Y->AS04.urb[j]->status) { | 240 | if (0 == usX2Y->AS04.urb[j]->status) { |
241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost. | 241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. |
242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, | 242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, |
243 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, | 243 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, |
244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, | 244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, |