diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-08 10:34:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-08 10:34:26 -0500 |
commit | 56b78921c32ae825c596c158e74ab48c0e8e280d (patch) | |
tree | 3a5b9dd3b89c1f4d1bf7fe75e3283bd490bee40e /sound | |
parent | 3c443cbc1dbb9a3b4dd9a134b97349195bcb4990 (diff) | |
parent | a3087ae970e5c8984fab2306b1f4dbe5ef132ff7 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (26 commits)
ALSA: hdmi - show debug message on changing audio infoframe
ALSA: hdmi - merge common code for intelhdmi and nvhdmi
ALSA: hda - Add ASRock mobo to MSI blacklist
ALSA: hda: uninitialized variable fix
ALSA: hda: Use LPIB for a Biostar Microtech board
ALSA: usb/audio.h: Fix field order
ALSA: fix jazz16 compile (udelay)
ALSA: hda: Use LPIB for Dell Latitude 131L
ALSA: hda - Build hda_eld into snd-hda-codec module
ALSA: hda - Support NVIDIA MCP89 and GT21x hdmi audio
ALSA: hda - Support max codecs to 8 for nvidia hda controller
ALSA: riptide: clean up while loop
ALSA: usbaudio - remove debug "SAMPLE BYTES" printk line
ALSA: timer - pass real event in snd_timer_notify1() to instance callback
ALSA: oxygen: change || to &&
ALSA: opti92x: use PnP data to select Master Control port
ASoC: fix ak4104 register array access
ASoC: soc_pcm_open: Add missing bailout tag
ALSA: usbaudio: Fix wrong bitrate for Creative Creative VF0470 Live Cam
ALSA: ua101: removing debugging code
...
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/timer.c | 2 | ||||
-rw-r--r-- | sound/isa/opti9xx/miro.c | 2 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 120 | ||||
-rw-r--r-- | sound/isa/sb/jazz16.c | 1 | ||||
-rw-r--r-- | sound/oss/coproc.h | 2 | ||||
-rw-r--r-- | sound/oss/v_midi.h | 5 | ||||
-rw-r--r-- | sound/pci/hda/Kconfig | 2 | ||||
-rw-r--r-- | sound/pci/hda/Makefile | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 69 | ||||
-rw-r--r-- | sound/pci/hda/hda_eld.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 9 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 849 | ||||
-rw-r--r-- | sound/pci/hda/patch_intelhdmi.c | 821 | ||||
-rw-r--r-- | sound/pci/hda/patch_nvhdmi.c | 275 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 10 | ||||
-rw-r--r-- | sound/pci/oxygen/xonar_wm87x6.c | 2 | ||||
-rw-r--r-- | sound/pci/riptide/riptide.c | 6 | ||||
-rw-r--r-- | sound/soc/codecs/ak4104.c | 6 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 14 | ||||
-rw-r--r-- | sound/usb/Kconfig | 6 | ||||
-rw-r--r-- | sound/usb/caiaq/midi.h | 2 | ||||
-rw-r--r-- | sound/usb/ua101.c | 100 | ||||
-rw-r--r-- | sound/usb/usbaudio.c | 57 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 3 | ||||
-rw-r--r-- | sound/usb/usbquirks.h | 30 |
25 files changed, 1281 insertions, 1122 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c index 8f8b17ac074d..73943651caed 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -393,7 +393,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) | |||
393 | event == SNDRV_TIMER_EVENT_CONTINUE) | 393 | event == SNDRV_TIMER_EVENT_CONTINUE) |
394 | resolution = snd_timer_resolution(ti); | 394 | resolution = snd_timer_resolution(ti); |
395 | if (ti->ccallback) | 395 | if (ti->ccallback) |
396 | ti->ccallback(ti, SNDRV_TIMER_EVENT_START, &tstamp, resolution); | 396 | ti->ccallback(ti, event, &tstamp, resolution); |
397 | if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) | 397 | if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) |
398 | return; | 398 | return; |
399 | timer = ti->timer; | 399 | timer = ti->timer; |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index b865e45a8f9b..5913717c1be6 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -1558,7 +1558,7 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip, | |||
1558 | 1558 | ||
1559 | err = pnp_activate_dev(devmc); | 1559 | err = pnp_activate_dev(devmc); |
1560 | if (err < 0) { | 1560 | if (err < 0) { |
1561 | snd_printk(KERN_ERR "OPL syntg pnp configure failure: %d\n", | 1561 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", |
1562 | err); | 1562 | err); |
1563 | return err; | 1563 | return err; |
1564 | } | 1564 | } |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index a4af53b5c1cf..becd90d7536d 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -144,12 +144,8 @@ struct snd_opti9xx { | |||
144 | 144 | ||
145 | spinlock_t lock; | 145 | spinlock_t lock; |
146 | 146 | ||
147 | long wss_base; | ||
147 | int irq; | 148 | int irq; |
148 | |||
149 | #ifdef CONFIG_PNP | ||
150 | struct pnp_dev *dev; | ||
151 | struct pnp_dev *devmpu; | ||
152 | #endif /* CONFIG_PNP */ | ||
153 | }; | 149 | }; |
154 | 150 | ||
155 | static int snd_opti9xx_pnp_is_probed; | 151 | static int snd_opti9xx_pnp_is_probed; |
@@ -159,12 +155,17 @@ static int snd_opti9xx_pnp_is_probed; | |||
159 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { | 155 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { |
160 | #ifndef OPTi93X | 156 | #ifndef OPTi93X |
161 | /* OPTi 82C924 */ | 157 | /* OPTi 82C924 */ |
162 | { .id = "OPT0924", .devs = { { "OPT0000" }, { "OPT0002" } }, .driver_data = 0x0924 }, | 158 | { .id = "OPT0924", |
159 | .devs = { { "OPT0000" }, { "OPT0002" }, { "OPT0005" } }, | ||
160 | .driver_data = 0x0924 }, | ||
163 | /* OPTi 82C925 */ | 161 | /* OPTi 82C925 */ |
164 | { .id = "OPT0925", .devs = { { "OPT9250" }, { "OPT0002" } }, .driver_data = 0x0925 }, | 162 | { .id = "OPT0925", |
163 | .devs = { { "OPT9250" }, { "OPT0002" }, { "OPT0005" } }, | ||
164 | .driver_data = 0x0925 }, | ||
165 | #else | 165 | #else |
166 | /* OPTi 82C931/3 */ | 166 | /* OPTi 82C931/3 */ |
167 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, .driver_data = 0x0931 }, | 167 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, |
168 | .driver_data = 0x0931 }, | ||
168 | #endif /* OPTi93X */ | 169 | #endif /* OPTi93X */ |
169 | { .id = "" } | 170 | { .id = "" } |
170 | }; | 171 | }; |
@@ -207,24 +208,34 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, | |||
207 | chip->hardware = hardware; | 208 | chip->hardware = hardware; |
208 | strcpy(chip->name, snd_opti9xx_names[hardware]); | 209 | strcpy(chip->name, snd_opti9xx_names[hardware]); |
209 | 210 | ||
210 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
211 | |||
212 | spin_lock_init(&chip->lock); | 211 | spin_lock_init(&chip->lock); |
213 | 212 | ||
214 | chip->irq = -1; | 213 | chip->irq = -1; |
215 | 214 | ||
215 | #ifndef OPTi93X | ||
216 | #ifdef CONFIG_PNP | ||
217 | if (isapnp && chip->mc_base) | ||
218 | /* PnP resource gives the least 10 bits */ | ||
219 | chip->mc_base |= 0xc00; | ||
220 | #endif /* CONFIG_PNP */ | ||
221 | else { | ||
222 | chip->mc_base = 0xf8c; | ||
223 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
224 | } | ||
225 | #else | ||
226 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
227 | #endif | ||
228 | |||
216 | switch (hardware) { | 229 | switch (hardware) { |
217 | #ifndef OPTi93X | 230 | #ifndef OPTi93X |
218 | case OPTi9XX_HW_82C928: | 231 | case OPTi9XX_HW_82C928: |
219 | case OPTi9XX_HW_82C929: | 232 | case OPTi9XX_HW_82C929: |
220 | chip->mc_base = 0xf8c; | ||
221 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; | 233 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; |
222 | chip->pwd_reg = 3; | 234 | chip->pwd_reg = 3; |
223 | break; | 235 | break; |
224 | 236 | ||
225 | case OPTi9XX_HW_82C924: | 237 | case OPTi9XX_HW_82C924: |
226 | case OPTi9XX_HW_82C925: | 238 | case OPTi9XX_HW_82C925: |
227 | chip->mc_base = 0xf8c; | ||
228 | chip->password = 0xe5; | 239 | chip->password = 0xe5; |
229 | chip->pwd_reg = 3; | 240 | chip->pwd_reg = 3; |
230 | break; | 241 | break; |
@@ -292,7 +303,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip, | |||
292 | spin_unlock_irqrestore(&chip->lock, flags); | 303 | spin_unlock_irqrestore(&chip->lock, flags); |
293 | return retval; | 304 | return retval; |
294 | } | 305 | } |
295 | 306 | ||
296 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | 307 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, |
297 | unsigned char value) | 308 | unsigned char value) |
298 | { | 309 | { |
@@ -341,7 +352,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | |||
341 | 352 | ||
342 | 353 | ||
343 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | 354 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, |
344 | long wss_base, | 355 | long port, |
345 | int irq, int dma1, int dma2, | 356 | int irq, int dma1, int dma2, |
346 | long mpu_port, int mpu_irq) | 357 | long mpu_port, int mpu_irq) |
347 | { | 358 | { |
@@ -354,16 +365,23 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
354 | switch (chip->hardware) { | 365 | switch (chip->hardware) { |
355 | #ifndef OPTi93X | 366 | #ifndef OPTi93X |
356 | case OPTi9XX_HW_82C924: | 367 | case OPTi9XX_HW_82C924: |
368 | /* opti 929 mode (?), OPL3 clock output, audio enable */ | ||
357 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); | 369 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); |
370 | /* enable wave audio */ | ||
358 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); | 371 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); |
359 | 372 | ||
360 | case OPTi9XX_HW_82C925: | 373 | case OPTi9XX_HW_82C925: |
374 | /* enable WSS mode */ | ||
361 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | 375 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); |
376 | /* OPL3 FM synthesis */ | ||
362 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); | 377 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); |
378 | /* disable Sound Blaster IRQ and DMA */ | ||
363 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); | 379 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); |
364 | #ifdef CS4231 | 380 | #ifdef CS4231 |
381 | /* cs4231/4248 fix enabled */ | ||
365 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | 382 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); |
366 | #else | 383 | #else |
384 | /* cs4231/4248 fix disabled */ | ||
367 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); | 385 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); |
368 | #endif /* CS4231 */ | 386 | #endif /* CS4231 */ |
369 | break; | 387 | break; |
@@ -411,21 +429,26 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
411 | return -EINVAL; | 429 | return -EINVAL; |
412 | } | 430 | } |
413 | 431 | ||
414 | switch (wss_base) { | 432 | /* PnP resource says it decodes only 10 bits of address */ |
415 | case 0x530: | 433 | switch (port & 0x3ff) { |
434 | case 0x130: | ||
435 | chip->wss_base = 0x530; | ||
416 | wss_base_bits = 0x00; | 436 | wss_base_bits = 0x00; |
417 | break; | 437 | break; |
418 | case 0x604: | 438 | case 0x204: |
439 | chip->wss_base = 0x604; | ||
419 | wss_base_bits = 0x03; | 440 | wss_base_bits = 0x03; |
420 | break; | 441 | break; |
421 | case 0xe80: | 442 | case 0x280: |
443 | chip->wss_base = 0xe80; | ||
422 | wss_base_bits = 0x01; | 444 | wss_base_bits = 0x01; |
423 | break; | 445 | break; |
424 | case 0xf40: | 446 | case 0x340: |
447 | chip->wss_base = 0xf40; | ||
425 | wss_base_bits = 0x02; | 448 | wss_base_bits = 0x02; |
426 | break; | 449 | break; |
427 | default: | 450 | default: |
428 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base); | 451 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port); |
429 | goto __skip_base; | 452 | goto __skip_base; |
430 | } | 453 | } |
431 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); | 454 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); |
@@ -487,7 +510,7 @@ __skip_base: | |||
487 | #endif /* CS4231 || OPTi93X */ | 510 | #endif /* CS4231 || OPTi93X */ |
488 | 511 | ||
489 | #ifndef OPTi93X | 512 | #ifndef OPTi93X |
490 | outb(irq_bits << 3 | dma_bits, wss_base); | 513 | outb(irq_bits << 3 | dma_bits, chip->wss_base); |
491 | #else /* OPTi93X */ | 514 | #else /* OPTi93X */ |
492 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); | 515 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); |
493 | #endif /* OPTi93X */ | 516 | #endif /* OPTi93X */ |
@@ -729,15 +752,15 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
729 | { | 752 | { |
730 | struct pnp_dev *pdev; | 753 | struct pnp_dev *pdev; |
731 | int err; | 754 | int err; |
755 | struct pnp_dev *devmpu; | ||
756 | #ifndef OPTi93X | ||
757 | struct pnp_dev *devmc; | ||
758 | #endif | ||
732 | 759 | ||
733 | chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); | 760 | pdev = pnp_request_card_device(card, pid->devs[0].id, NULL); |
734 | if (chip->dev == NULL) | 761 | if (pdev == NULL) |
735 | return -EBUSY; | 762 | return -EBUSY; |
736 | 763 | ||
737 | chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); | ||
738 | |||
739 | pdev = chip->dev; | ||
740 | |||
741 | err = pnp_activate_dev(pdev); | 764 | err = pnp_activate_dev(pdev); |
742 | if (err < 0) { | 765 | if (err < 0) { |
743 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); | 766 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); |
@@ -750,9 +773,24 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
750 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; | 773 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; |
751 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; | 774 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; |
752 | #else | 775 | #else |
753 | if (pid->driver_data != 0x0924) | 776 | devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); |
754 | port = pnp_port_start(pdev, 1); | 777 | if (devmc == NULL) |
778 | return -EBUSY; | ||
779 | |||
780 | err = pnp_activate_dev(devmc); | ||
781 | if (err < 0) { | ||
782 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err); | ||
783 | return err; | ||
784 | } | ||
785 | |||
786 | port = pnp_port_start(pdev, 1); | ||
755 | fm_port = pnp_port_start(pdev, 2) + 8; | 787 | fm_port = pnp_port_start(pdev, 2) + 8; |
788 | /* | ||
789 | * The MC(0) is never accessed and card does not | ||
790 | * include it in the PnP resource range. OPTI93x include it. | ||
791 | */ | ||
792 | chip->mc_base = pnp_port_start(devmc, 0) - 1; | ||
793 | chip->mc_base_size = pnp_port_len(devmc, 0) + 1; | ||
756 | #endif /* OPTi93X */ | 794 | #endif /* OPTi93X */ |
757 | irq = pnp_irq(pdev, 0); | 795 | irq = pnp_irq(pdev, 0); |
758 | dma1 = pnp_dma(pdev, 0); | 796 | dma1 = pnp_dma(pdev, 0); |
@@ -760,16 +798,16 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
760 | dma2 = pnp_dma(pdev, 1); | 798 | dma2 = pnp_dma(pdev, 1); |
761 | #endif /* CS4231 || OPTi93X */ | 799 | #endif /* CS4231 || OPTi93X */ |
762 | 800 | ||
763 | pdev = chip->devmpu; | 801 | devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); |
764 | if (pdev && mpu_port > 0) { | 802 | |
765 | err = pnp_activate_dev(pdev); | 803 | if (devmpu && mpu_port > 0) { |
804 | err = pnp_activate_dev(devmpu); | ||
766 | if (err < 0) { | 805 | if (err < 0) { |
767 | snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); | 806 | snd_printk(KERN_ERR "MPU401 pnp configure failure\n"); |
768 | mpu_port = -1; | 807 | mpu_port = -1; |
769 | chip->devmpu = NULL; | ||
770 | } else { | 808 | } else { |
771 | mpu_port = pnp_port_start(pdev, 0); | 809 | mpu_port = pnp_port_start(devmpu, 0); |
772 | mpu_irq = pnp_irq(pdev, 0); | 810 | mpu_irq = pnp_irq(devmpu, 0); |
773 | } | 811 | } |
774 | } | 812 | } |
775 | return pid->driver_data; | 813 | return pid->driver_data; |
@@ -824,7 +862,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
824 | if (error) | 862 | if (error) |
825 | return error; | 863 | return error; |
826 | 864 | ||
827 | error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2, | 865 | error = snd_wss_create(card, chip->wss_base + 4, -1, irq, dma1, xdma2, |
828 | #ifdef OPTi93X | 866 | #ifdef OPTi93X |
829 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, | 867 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, |
830 | #else | 868 | #else |
@@ -865,10 +903,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
865 | sprintf(card->shortname, "OPTi %s", card->driver); | 903 | sprintf(card->shortname, "OPTi %s", card->driver); |
866 | #if defined(CS4231) || defined(OPTi93X) | 904 | #if defined(CS4231) || defined(OPTi93X) |
867 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", | 905 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", |
868 | card->shortname, pcm->name, port + 4, irq, dma1, xdma2); | 906 | card->shortname, pcm->name, |
907 | chip->wss_base + 4, irq, dma1, xdma2); | ||
869 | #else | 908 | #else |
870 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", | 909 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", |
871 | card->shortname, pcm->name, port + 4, irq, dma1); | 910 | card->shortname, pcm->name, chip->wss_base + 4, irq, dma1); |
872 | #endif /* CS4231 || OPTi93X */ | 911 | #endif /* CS4231 || OPTi93X */ |
873 | 912 | ||
874 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) | 913 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) |
@@ -1062,9 +1101,6 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | |||
1062 | snd_card_free(card); | 1101 | snd_card_free(card); |
1063 | return error; | 1102 | return error; |
1064 | } | 1103 | } |
1065 | if (hw <= OPTi9XX_HW_82C930) | ||
1066 | chip->mc_base -= 0x80; | ||
1067 | |||
1068 | error = snd_opti9xx_read_check(chip); | 1104 | error = snd_opti9xx_read_check(chip); |
1069 | if (error) { | 1105 | if (error) { |
1070 | snd_printk(KERN_ERR "OPTI chip not found\n"); | 1106 | snd_printk(KERN_ERR "OPTI chip not found\n"); |
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index 8d21a3feda3a..8ccbcddf08e1 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/delay.h> | ||
17 | #include <asm/dma.h> | 18 | #include <asm/dma.h> |
18 | #include <linux/isa.h> | 19 | #include <linux/isa.h> |
19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
diff --git a/sound/oss/coproc.h b/sound/oss/coproc.h index 7306346e9ac4..7bec21bbdd88 100644 --- a/sound/oss/coproc.h +++ b/sound/oss/coproc.h | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * Coprocessor access types | 7 | * Coprocessor access types |
8 | */ | 8 | */ |
9 | #define COPR_CUSTOM 0x0001 /* Custom applications */ | 9 | #define COPR_CUSTOM 0x0001 /* Custom applications */ |
10 | #define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ | 10 | #define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ |
diff --git a/sound/oss/v_midi.h b/sound/oss/v_midi.h index 1b86cb45c607..08e2185ee816 100644 --- a/sound/oss/v_midi.h +++ b/sound/oss/v_midi.h | |||
@@ -2,9 +2,9 @@ typedef struct vmidi_devc { | |||
2 | int dev; | 2 | int dev; |
3 | 3 | ||
4 | /* State variables */ | 4 | /* State variables */ |
5 | int opened; | 5 | int opened; |
6 | spinlock_t lock; | 6 | spinlock_t lock; |
7 | 7 | ||
8 | /* MIDI fields */ | 8 | /* MIDI fields */ |
9 | int my_mididev; | 9 | int my_mididev; |
10 | int pair_mididev; | 10 | int pair_mididev; |
@@ -12,4 +12,3 @@ typedef struct vmidi_devc { | |||
12 | int intr_active; | 12 | int intr_active; |
13 | void (*midi_input_intr) (int dev, unsigned char data); | 13 | void (*midi_input_intr) (int dev, unsigned char data); |
14 | } vmidi_devc; | 14 | } vmidi_devc; |
15 | |||
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index 556cff937be7..567348b05b5a 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -157,7 +157,7 @@ config SND_HDA_CODEC_INTELHDMI | |||
157 | 157 | ||
158 | config SND_HDA_ELD | 158 | config SND_HDA_ELD |
159 | def_bool y | 159 | def_bool y |
160 | depends on SND_HDA_CODEC_INTELHDMI | 160 | depends on SND_HDA_CODEC_INTELHDMI || SND_HDA_CODEC_NVHDMI |
161 | 161 | ||
162 | config SND_HDA_CODEC_CIRRUS | 162 | config SND_HDA_CODEC_CIRRUS |
163 | bool "Build Cirrus Logic codec support" | 163 | bool "Build Cirrus Logic codec support" |
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 315a1c4f8998..24bc195b02da 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -3,7 +3,7 @@ snd-hda-intel-objs := hda_intel.o | |||
3 | snd-hda-codec-y := hda_codec.o | 3 | snd-hda-codec-y := hda_codec.o |
4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o | 4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o |
5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o | 5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o |
6 | # snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o | 6 | snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o |
7 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | 7 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o |
8 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o | 8 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o |
9 | 9 | ||
@@ -18,7 +18,7 @@ snd-hda-codec-ca0110-objs := patch_ca0110.o | |||
18 | snd-hda-codec-conexant-objs := patch_conexant.o | 18 | snd-hda-codec-conexant-objs := patch_conexant.o |
19 | snd-hda-codec-via-objs := patch_via.o | 19 | snd-hda-codec-via-objs := patch_via.o |
20 | snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o | 20 | snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o |
21 | snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o hda_eld.o | 21 | snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o |
22 | 22 | ||
23 | # common driver | 23 | # common driver |
24 | obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o | 24 | obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 76d3c4c049db..5bd7cf45f3a5 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -978,8 +978,9 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
978 | * | 978 | * |
979 | * Returns 0 if successful, or a negative error code. | 979 | * Returns 0 if successful, or a negative error code. |
980 | */ | 980 | */ |
981 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | 981 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, |
982 | struct hda_codec **codecp) | 982 | unsigned int codec_addr, |
983 | struct hda_codec **codecp) | ||
983 | { | 984 | { |
984 | struct hda_codec *codec; | 985 | struct hda_codec *codec; |
985 | char component[31]; | 986 | char component[31]; |
@@ -1186,7 +1187,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); | |||
1186 | */ | 1187 | */ |
1187 | 1188 | ||
1188 | /* FIXME: more better hash key? */ | 1189 | /* FIXME: more better hash key? */ |
1189 | #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) | 1190 | #define HDA_HASH_KEY(nid, dir, idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) |
1190 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) | 1191 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) |
1191 | #define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24)) | 1192 | #define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24)) |
1192 | #define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24)) | 1193 | #define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24)) |
@@ -1356,7 +1357,8 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) | |||
1356 | if (!codec->no_trigger_sense) { | 1357 | if (!codec->no_trigger_sense) { |
1357 | pincap = snd_hda_query_pin_caps(codec, nid); | 1358 | pincap = snd_hda_query_pin_caps(codec, nid); |
1358 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | 1359 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
1359 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | 1360 | snd_hda_codec_read(codec, nid, 0, |
1361 | AC_VERB_SET_PIN_SENSE, 0); | ||
1360 | } | 1362 | } |
1361 | return snd_hda_codec_read(codec, nid, 0, | 1363 | return snd_hda_codec_read(codec, nid, 0, |
1362 | AC_VERB_GET_PIN_SENSE, 0); | 1364 | AC_VERB_GET_PIN_SENSE, 0); |
@@ -1372,8 +1374,8 @@ EXPORT_SYMBOL_HDA(snd_hda_pin_sense); | |||
1372 | */ | 1374 | */ |
1373 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) | 1375 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) |
1374 | { | 1376 | { |
1375 | u32 sense = snd_hda_pin_sense(codec, nid); | 1377 | u32 sense = snd_hda_pin_sense(codec, nid); |
1376 | return !!(sense & AC_PINSENSE_PRESENCE); | 1378 | return !!(sense & AC_PINSENSE_PRESENCE); |
1377 | } | 1379 | } |
1378 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); | 1380 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); |
1379 | 1381 | ||
@@ -1952,7 +1954,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
1952 | err = snd_hda_ctl_add(codec, 0, kctl); | 1954 | err = snd_hda_ctl_add(codec, 0, kctl); |
1953 | if (err < 0) | 1955 | if (err < 0) |
1954 | return err; | 1956 | return err; |
1955 | 1957 | ||
1956 | for (s = slaves; *s; s++) { | 1958 | for (s = slaves; *s; s++) { |
1957 | struct snd_kcontrol *sctl; | 1959 | struct snd_kcontrol *sctl; |
1958 | int i = 0; | 1960 | int i = 0; |
@@ -2439,27 +2441,27 @@ static struct snd_kcontrol_new dig_mixes[] = { | |||
2439 | { | 2441 | { |
2440 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2442 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2441 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2442 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 2444 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), |
2443 | .info = snd_hda_spdif_mask_info, | 2445 | .info = snd_hda_spdif_mask_info, |
2444 | .get = snd_hda_spdif_cmask_get, | 2446 | .get = snd_hda_spdif_cmask_get, |
2445 | }, | 2447 | }, |
2446 | { | 2448 | { |
2447 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2449 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2448 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2450 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2449 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 2451 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), |
2450 | .info = snd_hda_spdif_mask_info, | 2452 | .info = snd_hda_spdif_mask_info, |
2451 | .get = snd_hda_spdif_pmask_get, | 2453 | .get = snd_hda_spdif_pmask_get, |
2452 | }, | 2454 | }, |
2453 | { | 2455 | { |
2454 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2456 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2455 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 2457 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), |
2456 | .info = snd_hda_spdif_mask_info, | 2458 | .info = snd_hda_spdif_mask_info, |
2457 | .get = snd_hda_spdif_default_get, | 2459 | .get = snd_hda_spdif_default_get, |
2458 | .put = snd_hda_spdif_default_put, | 2460 | .put = snd_hda_spdif_default_put, |
2459 | }, | 2461 | }, |
2460 | { | 2462 | { |
2461 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2463 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2462 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), | 2464 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), |
2463 | .info = snd_hda_spdif_out_switch_info, | 2465 | .info = snd_hda_spdif_out_switch_info, |
2464 | .get = snd_hda_spdif_out_switch_get, | 2466 | .get = snd_hda_spdif_out_switch_get, |
2465 | .put = snd_hda_spdif_out_switch_put, | 2467 | .put = snd_hda_spdif_out_switch_put, |
@@ -2610,7 +2612,7 @@ static int snd_hda_spdif_in_status_get(struct snd_kcontrol *kcontrol, | |||
2610 | static struct snd_kcontrol_new dig_in_ctls[] = { | 2612 | static struct snd_kcontrol_new dig_in_ctls[] = { |
2611 | { | 2613 | { |
2612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2614 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2613 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), | 2615 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH), |
2614 | .info = snd_hda_spdif_in_switch_info, | 2616 | .info = snd_hda_spdif_in_switch_info, |
2615 | .get = snd_hda_spdif_in_switch_get, | 2617 | .get = snd_hda_spdif_in_switch_get, |
2616 | .put = snd_hda_spdif_in_switch_put, | 2618 | .put = snd_hda_spdif_in_switch_put, |
@@ -2618,7 +2620,7 @@ static struct snd_kcontrol_new dig_in_ctls[] = { | |||
2618 | { | 2620 | { |
2619 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2621 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2620 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2621 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT), | 2623 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT), |
2622 | .info = snd_hda_spdif_mask_info, | 2624 | .info = snd_hda_spdif_mask_info, |
2623 | .get = snd_hda_spdif_in_status_get, | 2625 | .get = snd_hda_spdif_in_status_get, |
2624 | }, | 2626 | }, |
@@ -2883,7 +2885,7 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) | |||
2883 | int err = snd_hda_codec_build_controls(codec); | 2885 | int err = snd_hda_codec_build_controls(codec); |
2884 | if (err < 0) { | 2886 | if (err < 0) { |
2885 | printk(KERN_ERR "hda_codec: cannot build controls" | 2887 | printk(KERN_ERR "hda_codec: cannot build controls" |
2886 | "for #%d (error %d)\n", codec->addr, err); | 2888 | "for #%d (error %d)\n", codec->addr, err); |
2887 | err = snd_hda_codec_reset(codec); | 2889 | err = snd_hda_codec_reset(codec); |
2888 | if (err < 0) { | 2890 | if (err < 0) { |
2889 | printk(KERN_ERR | 2891 | printk(KERN_ERR |
@@ -2979,8 +2981,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
2979 | val |= channels - 1; | 2981 | val |= channels - 1; |
2980 | 2982 | ||
2981 | switch (snd_pcm_format_width(format)) { | 2983 | switch (snd_pcm_format_width(format)) { |
2982 | case 8: val |= 0x00; break; | 2984 | case 8: |
2983 | case 16: val |= 0x10; break; | 2985 | val |= 0x00; |
2986 | break; | ||
2987 | case 16: | ||
2988 | val |= 0x10; | ||
2989 | break; | ||
2984 | case 20: | 2990 | case 20: |
2985 | case 24: | 2991 | case 24: |
2986 | case 32: | 2992 | case 32: |
@@ -3298,7 +3304,8 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) | |||
3298 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) | 3304 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) |
3299 | return audio_idx[type][i]; | 3305 | return audio_idx[type][i]; |
3300 | 3306 | ||
3301 | snd_printk(KERN_WARNING "Too many %s devices\n", snd_hda_pcm_type_name[type]); | 3307 | snd_printk(KERN_WARNING "Too many %s devices\n", |
3308 | snd_hda_pcm_type_name[type]); | ||
3302 | return -EAGAIN; | 3309 | return -EAGAIN; |
3303 | } | 3310 | } |
3304 | 3311 | ||
@@ -3336,7 +3343,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) | |||
3336 | err = codec->patch_ops.build_pcms(codec); | 3343 | err = codec->patch_ops.build_pcms(codec); |
3337 | if (err < 0) { | 3344 | if (err < 0) { |
3338 | printk(KERN_ERR "hda_codec: cannot build PCMs" | 3345 | printk(KERN_ERR "hda_codec: cannot build PCMs" |
3339 | "for #%d (error %d)\n", codec->addr, err); | 3346 | "for #%d (error %d)\n", codec->addr, err); |
3340 | err = snd_hda_codec_reset(codec); | 3347 | err = snd_hda_codec_reset(codec); |
3341 | if (err < 0) { | 3348 | if (err < 0) { |
3342 | printk(KERN_ERR | 3349 | printk(KERN_ERR |
@@ -3466,8 +3473,8 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_config); | |||
3466 | 3473 | ||
3467 | /** | 3474 | /** |
3468 | * snd_hda_check_board_codec_sid_config - compare the current codec | 3475 | * snd_hda_check_board_codec_sid_config - compare the current codec |
3469 | subsystem ID with the | 3476 | subsystem ID with the |
3470 | config table | 3477 | config table |
3471 | 3478 | ||
3472 | This is important for Gateway notebooks with SB450 HDA Audio | 3479 | This is important for Gateway notebooks with SB450 HDA Audio |
3473 | where the vendor ID of the PCI device is: | 3480 | where the vendor ID of the PCI device is: |
@@ -3607,7 +3614,7 @@ void snd_hda_update_power_acct(struct hda_codec *codec) | |||
3607 | * | 3614 | * |
3608 | * Increment the power-up counter and power up the hardware really when | 3615 | * Increment the power-up counter and power up the hardware really when |
3609 | * not turned on yet. | 3616 | * not turned on yet. |
3610 | */ | 3617 | */ |
3611 | void snd_hda_power_up(struct hda_codec *codec) | 3618 | void snd_hda_power_up(struct hda_codec *codec) |
3612 | { | 3619 | { |
3613 | struct hda_bus *bus = codec->bus; | 3620 | struct hda_bus *bus = codec->bus; |
@@ -3636,7 +3643,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_up); | |||
3636 | * | 3643 | * |
3637 | * Decrement the power-up counter and schedules the power-off work if | 3644 | * Decrement the power-up counter and schedules the power-off work if |
3638 | * the counter rearches to zero. | 3645 | * the counter rearches to zero. |
3639 | */ | 3646 | */ |
3640 | void snd_hda_power_down(struct hda_codec *codec) | 3647 | void snd_hda_power_down(struct hda_codec *codec) |
3641 | { | 3648 | { |
3642 | --codec->power_count; | 3649 | --codec->power_count; |
@@ -3662,7 +3669,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_down); | |||
3662 | * | 3669 | * |
3663 | * This function is supposed to be set or called from the check_power_status | 3670 | * This function is supposed to be set or called from the check_power_status |
3664 | * patch ops. | 3671 | * patch ops. |
3665 | */ | 3672 | */ |
3666 | int snd_hda_check_amp_list_power(struct hda_codec *codec, | 3673 | int snd_hda_check_amp_list_power(struct hda_codec *codec, |
3667 | struct hda_loopback_check *check, | 3674 | struct hda_loopback_check *check, |
3668 | hda_nid_t nid) | 3675 | hda_nid_t nid) |
@@ -3830,7 +3837,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, | |||
3830 | { | 3837 | { |
3831 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 3838 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
3832 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) | 3839 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
3833 | set_dig_out_convert(codec, nid, | 3840 | set_dig_out_convert(codec, nid, |
3834 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, | 3841 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, |
3835 | -1); | 3842 | -1); |
3836 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | 3843 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
@@ -4089,13 +4096,13 @@ static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) | |||
4089 | /* | 4096 | /* |
4090 | * Sort an associated group of pins according to their sequence numbers. | 4097 | * Sort an associated group of pins according to their sequence numbers. |
4091 | */ | 4098 | */ |
4092 | static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, | 4099 | static void sort_pins_by_sequence(hda_nid_t *pins, short *sequences, |
4093 | int num_pins) | 4100 | int num_pins) |
4094 | { | 4101 | { |
4095 | int i, j; | 4102 | int i, j; |
4096 | short seq; | 4103 | short seq; |
4097 | hda_nid_t nid; | 4104 | hda_nid_t nid; |
4098 | 4105 | ||
4099 | for (i = 0; i < num_pins; i++) { | 4106 | for (i = 0; i < num_pins; i++) { |
4100 | for (j = i + 1; j < num_pins; j++) { | 4107 | for (j = i + 1; j < num_pins; j++) { |
4101 | if (sequences[i] > sequences[j]) { | 4108 | if (sequences[i] > sequences[j]) { |
@@ -4123,7 +4130,7 @@ static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, | |||
4123 | * is detected, one of speaker of HP pins is assigned as the primary | 4130 | * is detected, one of speaker of HP pins is assigned as the primary |
4124 | * output, i.e. to line_out_pins[0]. So, line_outs is always positive | 4131 | * output, i.e. to line_out_pins[0]. So, line_outs is always positive |
4125 | * if any analog output exists. | 4132 | * if any analog output exists. |
4126 | * | 4133 | * |
4127 | * The analog input pins are assigned to input_pins array. | 4134 | * The analog input pins are assigned to input_pins array. |
4128 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, | 4135 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, |
4129 | * respectively. | 4136 | * respectively. |
@@ -4186,9 +4193,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4186 | case AC_JACK_SPEAKER: | 4193 | case AC_JACK_SPEAKER: |
4187 | seq = get_defcfg_sequence(def_conf); | 4194 | seq = get_defcfg_sequence(def_conf); |
4188 | assoc = get_defcfg_association(def_conf); | 4195 | assoc = get_defcfg_association(def_conf); |
4189 | if (! assoc) | 4196 | if (!assoc) |
4190 | continue; | 4197 | continue; |
4191 | if (! assoc_speaker) | 4198 | if (!assoc_speaker) |
4192 | assoc_speaker = assoc; | 4199 | assoc_speaker = assoc; |
4193 | else if (assoc_speaker != assoc) | 4200 | else if (assoc_speaker != assoc) |
4194 | continue; | 4201 | continue; |
@@ -4286,7 +4293,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4286 | cfg->speaker_outs); | 4293 | cfg->speaker_outs); |
4287 | sort_pins_by_sequence(cfg->hp_pins, sequences_hp, | 4294 | sort_pins_by_sequence(cfg->hp_pins, sequences_hp, |
4288 | cfg->hp_outs); | 4295 | cfg->hp_outs); |
4289 | 4296 | ||
4290 | /* if we have only one mic, make it AUTO_PIN_MIC */ | 4297 | /* if we have only one mic, make it AUTO_PIN_MIC */ |
4291 | if (!cfg->input_pins[AUTO_PIN_MIC] && | 4298 | if (!cfg->input_pins[AUTO_PIN_MIC] && |
4292 | cfg->input_pins[AUTO_PIN_FRONT_MIC]) { | 4299 | cfg->input_pins[AUTO_PIN_FRONT_MIC]) { |
@@ -4436,7 +4443,7 @@ EXPORT_SYMBOL_HDA(snd_hda_resume); | |||
4436 | /** | 4443 | /** |
4437 | * snd_array_new - get a new element from the given array | 4444 | * snd_array_new - get a new element from the given array |
4438 | * @array: the array object | 4445 | * @array: the array object |
4439 | * | 4446 | * |
4440 | * Get a new element from the given array. If it exceeds the | 4447 | * Get a new element from the given array. If it exceeds the |
4441 | * pre-allocated array size, re-allocate the array. | 4448 | * pre-allocated array size, re-allocate the array. |
4442 | * | 4449 | * |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 4228f2fe5956..dcd22446cfc7 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -331,6 +331,7 @@ int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid) | |||
331 | return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, | 331 | return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, |
332 | AC_DIPSIZE_ELD_BUF); | 332 | AC_DIPSIZE_ELD_BUF); |
333 | } | 333 | } |
334 | EXPORT_SYMBOL_HDA(snd_hdmi_get_eld_size); | ||
334 | 335 | ||
335 | int snd_hdmi_get_eld(struct hdmi_eld *eld, | 336 | int snd_hdmi_get_eld(struct hdmi_eld *eld, |
336 | struct hda_codec *codec, hda_nid_t nid) | 337 | struct hda_codec *codec, hda_nid_t nid) |
@@ -366,6 +367,7 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
366 | kfree(buf); | 367 | kfree(buf); |
367 | return ret; | 368 | return ret; |
368 | } | 369 | } |
370 | EXPORT_SYMBOL_HDA(snd_hdmi_get_eld); | ||
369 | 371 | ||
370 | static void hdmi_show_short_audio_desc(struct cea_sad *a) | 372 | static void hdmi_show_short_audio_desc(struct cea_sad *a) |
371 | { | 373 | { |
@@ -404,6 +406,7 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) | |||
404 | } | 406 | } |
405 | buf[j] = '\0'; /* necessary when j == 0 */ | 407 | buf[j] = '\0'; /* necessary when j == 0 */ |
406 | } | 408 | } |
409 | EXPORT_SYMBOL_HDA(snd_print_channel_allocation); | ||
407 | 410 | ||
408 | void snd_hdmi_show_eld(struct hdmi_eld *e) | 411 | void snd_hdmi_show_eld(struct hdmi_eld *e) |
409 | { | 412 | { |
@@ -422,6 +425,7 @@ void snd_hdmi_show_eld(struct hdmi_eld *e) | |||
422 | for (i = 0; i < e->sad_count; i++) | 425 | for (i = 0; i < e->sad_count; i++) |
423 | hdmi_show_short_audio_desc(e->sad + i); | 426 | hdmi_show_short_audio_desc(e->sad + i); |
424 | } | 427 | } |
428 | EXPORT_SYMBOL_HDA(snd_hdmi_show_eld); | ||
425 | 429 | ||
426 | #ifdef CONFIG_PROC_FS | 430 | #ifdef CONFIG_PROC_FS |
427 | 431 | ||
@@ -580,6 +584,7 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld, | |||
580 | 584 | ||
581 | return 0; | 585 | return 0; |
582 | } | 586 | } |
587 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_new); | ||
583 | 588 | ||
584 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) | 589 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) |
585 | { | 590 | { |
@@ -588,5 +593,6 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) | |||
588 | eld->proc_entry = NULL; | 593 | eld->proc_entry = NULL; |
589 | } | 594 | } |
590 | } | 595 | } |
596 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free); | ||
591 | 597 | ||
592 | #endif /* CONFIG_PROC_FS */ | 598 | #endif /* CONFIG_PROC_FS */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d5c93ad852ee..43b7cfb7cffd 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -267,7 +267,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
267 | #define RIRB_INT_MASK 0x05 | 267 | #define RIRB_INT_MASK 0x05 |
268 | 268 | ||
269 | /* STATESTS int mask: S3,SD2,SD1,SD0 */ | 269 | /* STATESTS int mask: S3,SD2,SD1,SD0 */ |
270 | #define AZX_MAX_CODECS 4 | 270 | #define AZX_MAX_CODECS 8 |
271 | #define AZX_DEFAULT_CODECS 4 | ||
271 | #define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1) | 272 | #define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1) |
272 | 273 | ||
273 | /* SD_CTL bits */ | 274 | /* SD_CTL bits */ |
@@ -1367,6 +1368,7 @@ static void azx_bus_reset(struct hda_bus *bus) | |||
1367 | 1368 | ||
1368 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ | 1369 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ |
1369 | static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | 1370 | static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { |
1371 | [AZX_DRIVER_NVIDIA] = 8, | ||
1370 | [AZX_DRIVER_TERA] = 1, | 1372 | [AZX_DRIVER_TERA] = 1, |
1371 | }; | 1373 | }; |
1372 | 1374 | ||
@@ -1399,7 +1401,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model) | |||
1399 | codecs = 0; | 1401 | codecs = 0; |
1400 | max_slots = azx_max_codecs[chip->driver_type]; | 1402 | max_slots = azx_max_codecs[chip->driver_type]; |
1401 | if (!max_slots) | 1403 | if (!max_slots) |
1402 | max_slots = AZX_MAX_CODECS; | 1404 | max_slots = AZX_DEFAULT_CODECS; |
1403 | 1405 | ||
1404 | /* First try to probe all given codec slots */ | 1406 | /* First try to probe all given codec slots */ |
1405 | for (c = 0; c < max_slots; c++) { | 1407 | for (c = 0; c < max_slots; c++) { |
@@ -2263,10 +2265,12 @@ static int azx_dev_free(struct snd_device *device) | |||
2263 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { | 2265 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { |
2264 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), | 2266 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
2265 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), | 2267 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
2268 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), | ||
2266 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), | 2269 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
2267 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), | 2270 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), |
2268 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2271 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2269 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), | 2272 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), |
2273 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB), | ||
2270 | {} | 2274 | {} |
2271 | }; | 2275 | }; |
2272 | 2276 | ||
@@ -2354,6 +2358,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) | |||
2354 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { | 2358 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { |
2355 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ | 2359 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ |
2356 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ | 2360 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ |
2361 | SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ | ||
2357 | {} | 2362 | {} |
2358 | }; | 2363 | }; |
2359 | 2364 | ||
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c new file mode 100644 index 000000000000..2c2bafbf0258 --- /dev/null +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -0,0 +1,849 @@ | |||
1 | /* | ||
2 | * | ||
3 | * patch_hdmi.c - routines for HDMI/DisplayPort codecs | ||
4 | * | ||
5 | * Copyright(c) 2008-2010 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * Authors: | ||
8 | * Wu Fengguang <wfg@linux.intel.com> | ||
9 | * | ||
10 | * Maintained by: | ||
11 | * Wu Fengguang <wfg@linux.intel.com> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the Free | ||
15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
16 | * any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, but | ||
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
20 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
21 | * for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software Foundation, | ||
25 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
26 | */ | ||
27 | |||
28 | |||
29 | struct hdmi_spec { | ||
30 | int num_cvts; | ||
31 | int num_pins; | ||
32 | hda_nid_t cvt[MAX_HDMI_CVTS+1]; /* audio sources */ | ||
33 | hda_nid_t pin[MAX_HDMI_PINS+1]; /* audio sinks */ | ||
34 | |||
35 | /* | ||
36 | * source connection for each pin | ||
37 | */ | ||
38 | hda_nid_t pin_cvt[MAX_HDMI_PINS+1]; | ||
39 | |||
40 | /* | ||
41 | * HDMI sink attached to each pin | ||
42 | */ | ||
43 | struct hdmi_eld sink_eld[MAX_HDMI_PINS]; | ||
44 | |||
45 | /* | ||
46 | * export one pcm per pipe | ||
47 | */ | ||
48 | struct hda_pcm pcm_rec[MAX_HDMI_CVTS]; | ||
49 | |||
50 | /* | ||
51 | * nvhdmi specific | ||
52 | */ | ||
53 | struct hda_multi_out multiout; | ||
54 | unsigned int codec_type; | ||
55 | }; | ||
56 | |||
57 | |||
58 | struct hdmi_audio_infoframe { | ||
59 | u8 type; /* 0x84 */ | ||
60 | u8 ver; /* 0x01 */ | ||
61 | u8 len; /* 0x0a */ | ||
62 | |||
63 | u8 checksum; /* PB0 */ | ||
64 | u8 CC02_CT47; /* CC in bits 0:2, CT in 4:7 */ | ||
65 | u8 SS01_SF24; | ||
66 | u8 CXT04; | ||
67 | u8 CA; | ||
68 | u8 LFEPBL01_LSV36_DM_INH7; | ||
69 | u8 reserved[5]; /* PB6 - PB10 */ | ||
70 | }; | ||
71 | |||
72 | /* | ||
73 | * CEA speaker placement: | ||
74 | * | ||
75 | * FLH FCH FRH | ||
76 | * FLW FL FLC FC FRC FR FRW | ||
77 | * | ||
78 | * LFE | ||
79 | * TC | ||
80 | * | ||
81 | * RL RLC RC RRC RR | ||
82 | * | ||
83 | * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M corresponds to | ||
84 | * CEA RL/RR; The SMPTE channel _assignment_ C/LFE is swapped to CEA LFE/FC. | ||
85 | */ | ||
86 | enum cea_speaker_placement { | ||
87 | FL = (1 << 0), /* Front Left */ | ||
88 | FC = (1 << 1), /* Front Center */ | ||
89 | FR = (1 << 2), /* Front Right */ | ||
90 | FLC = (1 << 3), /* Front Left Center */ | ||
91 | FRC = (1 << 4), /* Front Right Center */ | ||
92 | RL = (1 << 5), /* Rear Left */ | ||
93 | RC = (1 << 6), /* Rear Center */ | ||
94 | RR = (1 << 7), /* Rear Right */ | ||
95 | RLC = (1 << 8), /* Rear Left Center */ | ||
96 | RRC = (1 << 9), /* Rear Right Center */ | ||
97 | LFE = (1 << 10), /* Low Frequency Effect */ | ||
98 | FLW = (1 << 11), /* Front Left Wide */ | ||
99 | FRW = (1 << 12), /* Front Right Wide */ | ||
100 | FLH = (1 << 13), /* Front Left High */ | ||
101 | FCH = (1 << 14), /* Front Center High */ | ||
102 | FRH = (1 << 15), /* Front Right High */ | ||
103 | TC = (1 << 16), /* Top Center */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * ELD SA bits in the CEA Speaker Allocation data block | ||
108 | */ | ||
109 | static int eld_speaker_allocation_bits[] = { | ||
110 | [0] = FL | FR, | ||
111 | [1] = LFE, | ||
112 | [2] = FC, | ||
113 | [3] = RL | RR, | ||
114 | [4] = RC, | ||
115 | [5] = FLC | FRC, | ||
116 | [6] = RLC | RRC, | ||
117 | /* the following are not defined in ELD yet */ | ||
118 | [7] = FLW | FRW, | ||
119 | [8] = FLH | FRH, | ||
120 | [9] = TC, | ||
121 | [10] = FCH, | ||
122 | }; | ||
123 | |||
124 | struct cea_channel_speaker_allocation { | ||
125 | int ca_index; | ||
126 | int speakers[8]; | ||
127 | |||
128 | /* derived values, just for convenience */ | ||
129 | int channels; | ||
130 | int spk_mask; | ||
131 | }; | ||
132 | |||
133 | /* | ||
134 | * ALSA sequence is: | ||
135 | * | ||
136 | * surround40 surround41 surround50 surround51 surround71 | ||
137 | * ch0 front left = = = = | ||
138 | * ch1 front right = = = = | ||
139 | * ch2 rear left = = = = | ||
140 | * ch3 rear right = = = = | ||
141 | * ch4 LFE center center center | ||
142 | * ch5 LFE LFE | ||
143 | * ch6 side left | ||
144 | * ch7 side right | ||
145 | * | ||
146 | * surround71 = {FL, FR, RLC, RRC, FC, LFE, RL, RR} | ||
147 | */ | ||
148 | static int hdmi_channel_mapping[0x32][8] = { | ||
149 | /* stereo */ | ||
150 | [0x00] = { 0x00, 0x11, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
151 | /* 2.1 */ | ||
152 | [0x01] = { 0x00, 0x11, 0x22, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
153 | /* Dolby Surround */ | ||
154 | [0x02] = { 0x00, 0x11, 0x23, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
155 | /* surround40 */ | ||
156 | [0x08] = { 0x00, 0x11, 0x24, 0x35, 0xf3, 0xf2, 0xf6, 0xf7 }, | ||
157 | /* 4ch */ | ||
158 | [0x03] = { 0x00, 0x11, 0x23, 0x32, 0x44, 0xf5, 0xf6, 0xf7 }, | ||
159 | /* surround41 */ | ||
160 | [0x09] = { 0x00, 0x11, 0x24, 0x34, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
161 | /* surround50 */ | ||
162 | [0x0a] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
163 | /* surround51 */ | ||
164 | [0x0b] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0x52, 0xf6, 0xf7 }, | ||
165 | /* 7.1 */ | ||
166 | [0x13] = { 0x00, 0x11, 0x26, 0x37, 0x43, 0x52, 0x64, 0x75 }, | ||
167 | }; | ||
168 | |||
169 | /* | ||
170 | * This is an ordered list! | ||
171 | * | ||
172 | * The preceding ones have better chances to be selected by | ||
173 | * hdmi_setup_channel_allocation(). | ||
174 | */ | ||
175 | static struct cea_channel_speaker_allocation channel_allocations[] = { | ||
176 | /* channel: 7 6 5 4 3 2 1 0 */ | ||
177 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, | ||
178 | /* 2.1 */ | ||
179 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, | ||
180 | /* Dolby Surround */ | ||
181 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, | ||
182 | /* surround40 */ | ||
183 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
184 | /* surround41 */ | ||
185 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
186 | /* surround50 */ | ||
187 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
188 | /* surround51 */ | ||
189 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
190 | /* 6.1 */ | ||
191 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
192 | /* surround71 */ | ||
193 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
194 | |||
195 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, | ||
196 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, | ||
197 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, | ||
198 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, | ||
199 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, | ||
200 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, | ||
201 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, | ||
202 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, | ||
203 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, | ||
204 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, | ||
205 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, | ||
206 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, | ||
207 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, | ||
208 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, | ||
209 | { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, | ||
210 | { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, | ||
211 | { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, | ||
212 | { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, | ||
213 | { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, | ||
214 | { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, | ||
215 | { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, | ||
216 | { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, | ||
217 | { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, | ||
218 | { .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, | ||
219 | { .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
220 | { .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, | ||
221 | { .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, | ||
222 | { .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, | ||
223 | { .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, | ||
224 | { .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, | ||
225 | { .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, | ||
226 | { .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, | ||
227 | { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, | ||
228 | { .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, | ||
229 | { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, | ||
230 | { .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, | ||
231 | { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
232 | { .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, | ||
233 | { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, | ||
234 | { .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, | ||
235 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, | ||
236 | }; | ||
237 | |||
238 | |||
239 | /* | ||
240 | * HDMI routines | ||
241 | */ | ||
242 | |||
243 | static int hda_node_index(hda_nid_t *nids, hda_nid_t nid) | ||
244 | { | ||
245 | int i; | ||
246 | |||
247 | for (i = 0; nids[i]; i++) | ||
248 | if (nids[i] == nid) | ||
249 | return i; | ||
250 | |||
251 | snd_printk(KERN_WARNING "HDMI: nid %d not registered\n", nid); | ||
252 | return -EINVAL; | ||
253 | } | ||
254 | |||
255 | static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid, | ||
256 | struct hdmi_eld *eld) | ||
257 | { | ||
258 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | ||
259 | snd_hdmi_show_eld(eld); | ||
260 | } | ||
261 | |||
262 | #ifdef BE_PARANOID | ||
263 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
264 | int *packet_index, int *byte_index) | ||
265 | { | ||
266 | int val; | ||
267 | |||
268 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
269 | AC_VERB_GET_HDMI_DIP_INDEX, 0); | ||
270 | |||
271 | *packet_index = val >> 5; | ||
272 | *byte_index = val & 0x1f; | ||
273 | } | ||
274 | #endif | ||
275 | |||
276 | static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
277 | int packet_index, int byte_index) | ||
278 | { | ||
279 | int val; | ||
280 | |||
281 | val = (packet_index << 5) | (byte_index & 0x1f); | ||
282 | |||
283 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); | ||
284 | } | ||
285 | |||
286 | static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, | ||
287 | unsigned char val) | ||
288 | { | ||
289 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); | ||
290 | } | ||
291 | |||
292 | static void hdmi_enable_output(struct hda_codec *codec, hda_nid_t pin_nid) | ||
293 | { | ||
294 | /* Unmute */ | ||
295 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) | ||
296 | snd_hda_codec_write(codec, pin_nid, 0, | ||
297 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
298 | /* Enable pin out */ | ||
299 | snd_hda_codec_write(codec, pin_nid, 0, | ||
300 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
301 | } | ||
302 | |||
303 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t nid) | ||
304 | { | ||
305 | return 1 + snd_hda_codec_read(codec, nid, 0, | ||
306 | AC_VERB_GET_CVT_CHAN_COUNT, 0); | ||
307 | } | ||
308 | |||
309 | static void hdmi_set_channel_count(struct hda_codec *codec, | ||
310 | hda_nid_t nid, int chs) | ||
311 | { | ||
312 | if (chs != hdmi_get_channel_count(codec, nid)) | ||
313 | snd_hda_codec_write(codec, nid, 0, | ||
314 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | ||
315 | } | ||
316 | |||
317 | |||
318 | /* | ||
319 | * Channel mapping routines | ||
320 | */ | ||
321 | |||
322 | /* | ||
323 | * Compute derived values in channel_allocations[]. | ||
324 | */ | ||
325 | static void init_channel_allocations(void) | ||
326 | { | ||
327 | int i, j; | ||
328 | struct cea_channel_speaker_allocation *p; | ||
329 | |||
330 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
331 | p = channel_allocations + i; | ||
332 | p->channels = 0; | ||
333 | p->spk_mask = 0; | ||
334 | for (j = 0; j < ARRAY_SIZE(p->speakers); j++) | ||
335 | if (p->speakers[j]) { | ||
336 | p->channels++; | ||
337 | p->spk_mask |= p->speakers[j]; | ||
338 | } | ||
339 | } | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * The transformation takes two steps: | ||
344 | * | ||
345 | * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask | ||
346 | * spk_mask => (channel_allocations[]) => ai->CA | ||
347 | * | ||
348 | * TODO: it could select the wrong CA from multiple candidates. | ||
349 | */ | ||
350 | static int hdmi_setup_channel_allocation(struct hda_codec *codec, hda_nid_t nid, | ||
351 | struct hdmi_audio_infoframe *ai) | ||
352 | { | ||
353 | struct hdmi_spec *spec = codec->spec; | ||
354 | struct hdmi_eld *eld; | ||
355 | int i; | ||
356 | int spk_mask = 0; | ||
357 | int channels = 1 + (ai->CC02_CT47 & 0x7); | ||
358 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | ||
359 | |||
360 | /* | ||
361 | * CA defaults to 0 for basic stereo audio | ||
362 | */ | ||
363 | if (channels <= 2) | ||
364 | return 0; | ||
365 | |||
366 | i = hda_node_index(spec->pin_cvt, nid); | ||
367 | if (i < 0) | ||
368 | return 0; | ||
369 | eld = &spec->sink_eld[i]; | ||
370 | |||
371 | /* | ||
372 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
373 | * in console or for audio devices. Assume the highest speakers | ||
374 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
375 | */ | ||
376 | if (!eld->spk_alloc) | ||
377 | eld->spk_alloc = 0xffff; | ||
378 | |||
379 | /* | ||
380 | * expand ELD's speaker allocation mask | ||
381 | * | ||
382 | * ELD tells the speaker mask in a compact(paired) form, | ||
383 | * expand ELD's notions to match the ones used by Audio InfoFrame. | ||
384 | */ | ||
385 | for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { | ||
386 | if (eld->spk_alloc & (1 << i)) | ||
387 | spk_mask |= eld_speaker_allocation_bits[i]; | ||
388 | } | ||
389 | |||
390 | /* search for the first working match in the CA table */ | ||
391 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
392 | if (channels == channel_allocations[i].channels && | ||
393 | (spk_mask & channel_allocations[i].spk_mask) == | ||
394 | channel_allocations[i].spk_mask) { | ||
395 | ai->CA = channel_allocations[i].ca_index; | ||
396 | break; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | snd_print_channel_allocation(eld->spk_alloc, buf, sizeof(buf)); | ||
401 | snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n", | ||
402 | ai->CA, channels, buf); | ||
403 | |||
404 | return ai->CA; | ||
405 | } | ||
406 | |||
407 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, | ||
408 | hda_nid_t pin_nid) | ||
409 | { | ||
410 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
411 | int i; | ||
412 | int slot; | ||
413 | |||
414 | for (i = 0; i < 8; i++) { | ||
415 | slot = snd_hda_codec_read(codec, pin_nid, 0, | ||
416 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | ||
417 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | ||
418 | slot >> 4, slot & 0xf); | ||
419 | } | ||
420 | #endif | ||
421 | } | ||
422 | |||
423 | |||
424 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | ||
425 | hda_nid_t pin_nid, | ||
426 | struct hdmi_audio_infoframe *ai) | ||
427 | { | ||
428 | int i; | ||
429 | int ca = ai->CA; | ||
430 | int err; | ||
431 | |||
432 | if (hdmi_channel_mapping[ca][1] == 0) { | ||
433 | for (i = 0; i < channel_allocations[ca].channels; i++) | ||
434 | hdmi_channel_mapping[ca][i] = i | (i << 4); | ||
435 | for (; i < 8; i++) | ||
436 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); | ||
437 | } | ||
438 | |||
439 | for (i = 0; i < 8; i++) { | ||
440 | err = snd_hda_codec_write(codec, pin_nid, 0, | ||
441 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
442 | hdmi_channel_mapping[ca][i]); | ||
443 | if (err) { | ||
444 | snd_printdd(KERN_NOTICE | ||
445 | "HDMI: channel mapping failed\n"); | ||
446 | break; | ||
447 | } | ||
448 | } | ||
449 | |||
450 | hdmi_debug_channel_mapping(codec, pin_nid); | ||
451 | } | ||
452 | |||
453 | |||
454 | /* | ||
455 | * Audio InfoFrame routines | ||
456 | */ | ||
457 | |||
458 | /* | ||
459 | * Enable Audio InfoFrame Transmission | ||
460 | */ | ||
461 | static void hdmi_start_infoframe_trans(struct hda_codec *codec, | ||
462 | hda_nid_t pin_nid) | ||
463 | { | ||
464 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
465 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
466 | AC_DIPXMIT_BEST); | ||
467 | } | ||
468 | |||
469 | /* | ||
470 | * Disable Audio InfoFrame Transmission | ||
471 | */ | ||
472 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec, | ||
473 | hda_nid_t pin_nid) | ||
474 | { | ||
475 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
476 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
477 | AC_DIPXMIT_DISABLE); | ||
478 | } | ||
479 | |||
480 | static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) | ||
481 | { | ||
482 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
483 | int i; | ||
484 | int size; | ||
485 | |||
486 | size = snd_hdmi_get_eld_size(codec, pin_nid); | ||
487 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); | ||
488 | |||
489 | for (i = 0; i < 8; i++) { | ||
490 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
491 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
492 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); | ||
493 | } | ||
494 | #endif | ||
495 | } | ||
496 | |||
497 | static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) | ||
498 | { | ||
499 | #ifdef BE_PARANOID | ||
500 | int i, j; | ||
501 | int size; | ||
502 | int pi, bi; | ||
503 | for (i = 0; i < 8; i++) { | ||
504 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
505 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
506 | if (size == 0) | ||
507 | continue; | ||
508 | |||
509 | hdmi_set_dip_index(codec, pin_nid, i, 0x0); | ||
510 | for (j = 1; j < 1000; j++) { | ||
511 | hdmi_write_dip_byte(codec, pin_nid, 0x0); | ||
512 | hdmi_get_dip_index(codec, pin_nid, &pi, &bi); | ||
513 | if (pi != i) | ||
514 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", | ||
515 | bi, pi, i); | ||
516 | if (bi == 0) /* byte index wrapped around */ | ||
517 | break; | ||
518 | } | ||
519 | snd_printd(KERN_INFO | ||
520 | "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", | ||
521 | i, size, j); | ||
522 | } | ||
523 | #endif | ||
524 | } | ||
525 | |||
526 | static void hdmi_checksum_audio_infoframe(struct hdmi_audio_infoframe *ai) | ||
527 | { | ||
528 | u8 *bytes = (u8 *)ai; | ||
529 | u8 sum = 0; | ||
530 | int i; | ||
531 | |||
532 | ai->checksum = 0; | ||
533 | |||
534 | for (i = 0; i < sizeof(*ai); i++) | ||
535 | sum += bytes[i]; | ||
536 | |||
537 | ai->checksum = -sum; | ||
538 | } | ||
539 | |||
540 | static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | ||
541 | hda_nid_t pin_nid, | ||
542 | struct hdmi_audio_infoframe *ai) | ||
543 | { | ||
544 | u8 *bytes = (u8 *)ai; | ||
545 | int i; | ||
546 | |||
547 | hdmi_debug_dip_size(codec, pin_nid); | ||
548 | hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ | ||
549 | |||
550 | hdmi_checksum_audio_infoframe(ai); | ||
551 | |||
552 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
553 | for (i = 0; i < sizeof(*ai); i++) | ||
554 | hdmi_write_dip_byte(codec, pin_nid, bytes[i]); | ||
555 | } | ||
556 | |||
557 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | ||
558 | struct hdmi_audio_infoframe *ai) | ||
559 | { | ||
560 | u8 *bytes = (u8 *)ai; | ||
561 | u8 val; | ||
562 | int i; | ||
563 | |||
564 | if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) | ||
565 | != AC_DIPXMIT_BEST) | ||
566 | return false; | ||
567 | |||
568 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
569 | for (i = 0; i < sizeof(*ai); i++) { | ||
570 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
571 | AC_VERB_GET_HDMI_DIP_DATA, 0); | ||
572 | if (val != bytes[i]) | ||
573 | return false; | ||
574 | } | ||
575 | |||
576 | return true; | ||
577 | } | ||
578 | |||
579 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | ||
580 | struct snd_pcm_substream *substream) | ||
581 | { | ||
582 | struct hdmi_spec *spec = codec->spec; | ||
583 | hda_nid_t pin_nid; | ||
584 | int i; | ||
585 | struct hdmi_audio_infoframe ai = { | ||
586 | .type = 0x84, | ||
587 | .ver = 0x01, | ||
588 | .len = 0x0a, | ||
589 | .CC02_CT47 = substream->runtime->channels - 1, | ||
590 | }; | ||
591 | |||
592 | hdmi_setup_channel_allocation(codec, nid, &ai); | ||
593 | |||
594 | for (i = 0; i < spec->num_pins; i++) { | ||
595 | if (spec->pin_cvt[i] != nid) | ||
596 | continue; | ||
597 | if (!spec->sink_eld[i].monitor_present) | ||
598 | continue; | ||
599 | |||
600 | pin_nid = spec->pin[i]; | ||
601 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { | ||
602 | snd_printdd("hdmi_setup_audio_infoframe: " | ||
603 | "cvt=%d pin=%d channels=%d\n", | ||
604 | nid, pin_nid, | ||
605 | substream->runtime->channels); | ||
606 | hdmi_setup_channel_mapping(codec, pin_nid, &ai); | ||
607 | hdmi_stop_infoframe_trans(codec, pin_nid); | ||
608 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); | ||
609 | hdmi_start_infoframe_trans(codec, pin_nid); | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | |||
614 | |||
615 | /* | ||
616 | * Unsolicited events | ||
617 | */ | ||
618 | |||
619 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
620 | { | ||
621 | struct hdmi_spec *spec = codec->spec; | ||
622 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
623 | int pind = !!(res & AC_UNSOL_RES_PD); | ||
624 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | ||
625 | int index; | ||
626 | |||
627 | printk(KERN_INFO | ||
628 | "HDMI hot plug event: Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | ||
629 | tag, pind, eldv); | ||
630 | |||
631 | index = hda_node_index(spec->pin, tag); | ||
632 | if (index < 0) | ||
633 | return; | ||
634 | |||
635 | spec->sink_eld[index].monitor_present = pind; | ||
636 | spec->sink_eld[index].eld_valid = eldv; | ||
637 | |||
638 | if (pind && eldv) { | ||
639 | hdmi_get_show_eld(codec, spec->pin[index], | ||
640 | &spec->sink_eld[index]); | ||
641 | /* TODO: do real things about ELD */ | ||
642 | } | ||
643 | } | ||
644 | |||
645 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
646 | { | ||
647 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
648 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
649 | int cp_state = !!(res & AC_UNSOL_RES_CP_STATE); | ||
650 | int cp_ready = !!(res & AC_UNSOL_RES_CP_READY); | ||
651 | |||
652 | printk(KERN_INFO | ||
653 | "HDMI CP event: PIN=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", | ||
654 | tag, | ||
655 | subtag, | ||
656 | cp_state, | ||
657 | cp_ready); | ||
658 | |||
659 | /* TODO */ | ||
660 | if (cp_state) | ||
661 | ; | ||
662 | if (cp_ready) | ||
663 | ; | ||
664 | } | ||
665 | |||
666 | |||
667 | static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | ||
668 | { | ||
669 | struct hdmi_spec *spec = codec->spec; | ||
670 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
671 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
672 | |||
673 | if (hda_node_index(spec->pin, tag) < 0) { | ||
674 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); | ||
675 | return; | ||
676 | } | ||
677 | |||
678 | if (subtag == 0) | ||
679 | hdmi_intrinsic_event(codec, res); | ||
680 | else | ||
681 | hdmi_non_intrinsic_event(codec, res); | ||
682 | } | ||
683 | |||
684 | /* | ||
685 | * Callbacks | ||
686 | */ | ||
687 | |||
688 | static void hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid, | ||
689 | u32 stream_tag, int format) | ||
690 | { | ||
691 | int tag; | ||
692 | int fmt; | ||
693 | |||
694 | tag = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0) >> 4; | ||
695 | fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); | ||
696 | |||
697 | snd_printdd("hdmi_setup_stream: " | ||
698 | "NID=0x%x, %sstream=0x%x, %sformat=0x%x\n", | ||
699 | nid, | ||
700 | tag == stream_tag ? "" : "new-", | ||
701 | stream_tag, | ||
702 | fmt == format ? "" : "new-", | ||
703 | format); | ||
704 | |||
705 | if (tag != stream_tag) | ||
706 | snd_hda_codec_write(codec, nid, 0, | ||
707 | AC_VERB_SET_CHANNEL_STREAMID, | ||
708 | stream_tag << 4); | ||
709 | if (fmt != format) | ||
710 | snd_hda_codec_write(codec, nid, 0, | ||
711 | AC_VERB_SET_STREAM_FORMAT, format); | ||
712 | } | ||
713 | |||
714 | /* | ||
715 | * HDA/HDMI auto parsing | ||
716 | */ | ||
717 | |||
718 | static int hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid) | ||
719 | { | ||
720 | struct hdmi_spec *spec = codec->spec; | ||
721 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
722 | int conn_len, curr; | ||
723 | int index; | ||
724 | |||
725 | if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { | ||
726 | snd_printk(KERN_WARNING | ||
727 | "HDMI: pin %d wcaps %#x " | ||
728 | "does not support connection list\n", | ||
729 | pin_nid, get_wcaps(codec, pin_nid)); | ||
730 | return -EINVAL; | ||
731 | } | ||
732 | |||
733 | conn_len = snd_hda_get_connections(codec, pin_nid, conn_list, | ||
734 | HDA_MAX_CONNECTIONS); | ||
735 | if (conn_len > 1) | ||
736 | curr = snd_hda_codec_read(codec, pin_nid, 0, | ||
737 | AC_VERB_GET_CONNECT_SEL, 0); | ||
738 | else | ||
739 | curr = 0; | ||
740 | |||
741 | index = hda_node_index(spec->pin, pin_nid); | ||
742 | if (index < 0) | ||
743 | return -EINVAL; | ||
744 | |||
745 | spec->pin_cvt[index] = conn_list[curr]; | ||
746 | |||
747 | return 0; | ||
748 | } | ||
749 | |||
750 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | ||
751 | struct hdmi_eld *eld) | ||
752 | { | ||
753 | int present = snd_hda_pin_sense(codec, pin_nid); | ||
754 | |||
755 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); | ||
756 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); | ||
757 | |||
758 | if (present & AC_PINSENSE_ELDV) | ||
759 | hdmi_get_show_eld(codec, pin_nid, eld); | ||
760 | } | ||
761 | |||
762 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | ||
763 | { | ||
764 | struct hdmi_spec *spec = codec->spec; | ||
765 | |||
766 | if (spec->num_pins >= MAX_HDMI_PINS) { | ||
767 | snd_printk(KERN_WARNING | ||
768 | "HDMI: no space for pin %d\n", pin_nid); | ||
769 | return -EINVAL; | ||
770 | } | ||
771 | |||
772 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); | ||
773 | |||
774 | spec->pin[spec->num_pins] = pin_nid; | ||
775 | spec->num_pins++; | ||
776 | |||
777 | /* | ||
778 | * It is assumed that converter nodes come first in the node list and | ||
779 | * hence have been registered and usable now. | ||
780 | */ | ||
781 | return hdmi_read_pin_conn(codec, pin_nid); | ||
782 | } | ||
783 | |||
784 | static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid) | ||
785 | { | ||
786 | struct hdmi_spec *spec = codec->spec; | ||
787 | |||
788 | if (spec->num_cvts >= MAX_HDMI_CVTS) { | ||
789 | snd_printk(KERN_WARNING | ||
790 | "HDMI: no space for converter %d\n", nid); | ||
791 | return -EINVAL; | ||
792 | } | ||
793 | |||
794 | spec->cvt[spec->num_cvts] = nid; | ||
795 | spec->num_cvts++; | ||
796 | |||
797 | return 0; | ||
798 | } | ||
799 | |||
800 | static int hdmi_parse_codec(struct hda_codec *codec) | ||
801 | { | ||
802 | hda_nid_t nid; | ||
803 | int i, nodes; | ||
804 | |||
805 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); | ||
806 | if (!nid || nodes < 0) { | ||
807 | snd_printk(KERN_WARNING "HDMI: failed to get afg sub nodes\n"); | ||
808 | return -EINVAL; | ||
809 | } | ||
810 | |||
811 | for (i = 0; i < nodes; i++, nid++) { | ||
812 | unsigned int caps; | ||
813 | unsigned int type; | ||
814 | |||
815 | caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); | ||
816 | type = get_wcaps_type(caps); | ||
817 | |||
818 | if (!(caps & AC_WCAP_DIGITAL)) | ||
819 | continue; | ||
820 | |||
821 | switch (type) { | ||
822 | case AC_WID_AUD_OUT: | ||
823 | if (hdmi_add_cvt(codec, nid) < 0) | ||
824 | return -EINVAL; | ||
825 | break; | ||
826 | case AC_WID_PIN: | ||
827 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
828 | if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) | ||
829 | continue; | ||
830 | if (hdmi_add_pin(codec, nid) < 0) | ||
831 | return -EINVAL; | ||
832 | break; | ||
833 | } | ||
834 | } | ||
835 | |||
836 | /* | ||
837 | * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event | ||
838 | * can be lost and presence sense verb will become inaccurate if the | ||
839 | * HDA link is powered off at hot plug or hw initialization time. | ||
840 | */ | ||
841 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
842 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | ||
843 | AC_PWRST_EPSS)) | ||
844 | codec->bus->power_keep_link_on = 1; | ||
845 | #endif | ||
846 | |||
847 | return 0; | ||
848 | } | ||
849 | |||
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 918f40378d52..88d035104cc5 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c | |||
@@ -40,815 +40,20 @@ | |||
40 | * | 40 | * |
41 | * The HDA correspondence of pipes/ports are converter/pin nodes. | 41 | * The HDA correspondence of pipes/ports are converter/pin nodes. |
42 | */ | 42 | */ |
43 | #define INTEL_HDMI_CVTS 2 | 43 | #define MAX_HDMI_CVTS 2 |
44 | #define INTEL_HDMI_PINS 3 | 44 | #define MAX_HDMI_PINS 3 |
45 | 45 | ||
46 | static char *intel_hdmi_pcm_names[INTEL_HDMI_CVTS] = { | 46 | #include "patch_hdmi.c" |
47 | |||
48 | static char *intel_hdmi_pcm_names[MAX_HDMI_CVTS] = { | ||
47 | "INTEL HDMI 0", | 49 | "INTEL HDMI 0", |
48 | "INTEL HDMI 1", | 50 | "INTEL HDMI 1", |
49 | }; | 51 | }; |
50 | 52 | ||
51 | struct intel_hdmi_spec { | ||
52 | int num_cvts; | ||
53 | int num_pins; | ||
54 | hda_nid_t cvt[INTEL_HDMI_CVTS+1]; /* audio sources */ | ||
55 | hda_nid_t pin[INTEL_HDMI_PINS+1]; /* audio sinks */ | ||
56 | |||
57 | /* | ||
58 | * source connection for each pin | ||
59 | */ | ||
60 | hda_nid_t pin_cvt[INTEL_HDMI_PINS+1]; | ||
61 | |||
62 | /* | ||
63 | * HDMI sink attached to each pin | ||
64 | */ | ||
65 | struct hdmi_eld sink_eld[INTEL_HDMI_PINS]; | ||
66 | |||
67 | /* | ||
68 | * export one pcm per pipe | ||
69 | */ | ||
70 | struct hda_pcm pcm_rec[INTEL_HDMI_CVTS]; | ||
71 | }; | ||
72 | |||
73 | struct hdmi_audio_infoframe { | ||
74 | u8 type; /* 0x84 */ | ||
75 | u8 ver; /* 0x01 */ | ||
76 | u8 len; /* 0x0a */ | ||
77 | |||
78 | u8 checksum; /* PB0 */ | ||
79 | u8 CC02_CT47; /* CC in bits 0:2, CT in 4:7 */ | ||
80 | u8 SS01_SF24; | ||
81 | u8 CXT04; | ||
82 | u8 CA; | ||
83 | u8 LFEPBL01_LSV36_DM_INH7; | ||
84 | u8 reserved[5]; /* PB6 - PB10 */ | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * CEA speaker placement: | ||
89 | * | ||
90 | * FLH FCH FRH | ||
91 | * FLW FL FLC FC FRC FR FRW | ||
92 | * | ||
93 | * LFE | ||
94 | * TC | ||
95 | * | ||
96 | * RL RLC RC RRC RR | ||
97 | * | ||
98 | * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M corresponds to | ||
99 | * CEA RL/RR; The SMPTE channel _assignment_ C/LFE is swapped to CEA LFE/FC. | ||
100 | */ | ||
101 | enum cea_speaker_placement { | ||
102 | FL = (1 << 0), /* Front Left */ | ||
103 | FC = (1 << 1), /* Front Center */ | ||
104 | FR = (1 << 2), /* Front Right */ | ||
105 | FLC = (1 << 3), /* Front Left Center */ | ||
106 | FRC = (1 << 4), /* Front Right Center */ | ||
107 | RL = (1 << 5), /* Rear Left */ | ||
108 | RC = (1 << 6), /* Rear Center */ | ||
109 | RR = (1 << 7), /* Rear Right */ | ||
110 | RLC = (1 << 8), /* Rear Left Center */ | ||
111 | RRC = (1 << 9), /* Rear Right Center */ | ||
112 | LFE = (1 << 10), /* Low Frequency Effect */ | ||
113 | FLW = (1 << 11), /* Front Left Wide */ | ||
114 | FRW = (1 << 12), /* Front Right Wide */ | ||
115 | FLH = (1 << 13), /* Front Left High */ | ||
116 | FCH = (1 << 14), /* Front Center High */ | ||
117 | FRH = (1 << 15), /* Front Right High */ | ||
118 | TC = (1 << 16), /* Top Center */ | ||
119 | }; | ||
120 | |||
121 | /* | ||
122 | * ELD SA bits in the CEA Speaker Allocation data block | ||
123 | */ | ||
124 | static int eld_speaker_allocation_bits[] = { | ||
125 | [0] = FL | FR, | ||
126 | [1] = LFE, | ||
127 | [2] = FC, | ||
128 | [3] = RL | RR, | ||
129 | [4] = RC, | ||
130 | [5] = FLC | FRC, | ||
131 | [6] = RLC | RRC, | ||
132 | /* the following are not defined in ELD yet */ | ||
133 | [7] = FLW | FRW, | ||
134 | [8] = FLH | FRH, | ||
135 | [9] = TC, | ||
136 | [10] = FCH, | ||
137 | }; | ||
138 | |||
139 | struct cea_channel_speaker_allocation { | ||
140 | int ca_index; | ||
141 | int speakers[8]; | ||
142 | |||
143 | /* derived values, just for convenience */ | ||
144 | int channels; | ||
145 | int spk_mask; | ||
146 | }; | ||
147 | |||
148 | /* | ||
149 | * ALSA sequence is: | ||
150 | * | ||
151 | * surround40 surround41 surround50 surround51 surround71 | ||
152 | * ch0 front left = = = = | ||
153 | * ch1 front right = = = = | ||
154 | * ch2 rear left = = = = | ||
155 | * ch3 rear right = = = = | ||
156 | * ch4 LFE center center center | ||
157 | * ch5 LFE LFE | ||
158 | * ch6 side left | ||
159 | * ch7 side right | ||
160 | * | ||
161 | * surround71 = {FL, FR, RLC, RRC, FC, LFE, RL, RR} | ||
162 | */ | ||
163 | static int hdmi_channel_mapping[0x32][8] = { | ||
164 | /* stereo */ | ||
165 | [0x00] = { 0x00, 0x11, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
166 | /* 2.1 */ | ||
167 | [0x01] = { 0x00, 0x11, 0x22, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
168 | /* Dolby Surround */ | ||
169 | [0x02] = { 0x00, 0x11, 0x23, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
170 | /* surround40 */ | ||
171 | [0x08] = { 0x00, 0x11, 0x24, 0x35, 0xf3, 0xf2, 0xf6, 0xf7 }, | ||
172 | /* 4ch */ | ||
173 | [0x03] = { 0x00, 0x11, 0x23, 0x32, 0x44, 0xf5, 0xf6, 0xf7 }, | ||
174 | /* surround41 */ | ||
175 | [0x09] = { 0x00, 0x11, 0x24, 0x34, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
176 | /* surround50 */ | ||
177 | [0x0a] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
178 | /* surround51 */ | ||
179 | [0x0b] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0x52, 0xf6, 0xf7 }, | ||
180 | /* 7.1 */ | ||
181 | [0x13] = { 0x00, 0x11, 0x26, 0x37, 0x43, 0x52, 0x64, 0x75 }, | ||
182 | }; | ||
183 | |||
184 | /* | ||
185 | * This is an ordered list! | ||
186 | * | ||
187 | * The preceding ones have better chances to be selected by | ||
188 | * hdmi_setup_channel_allocation(). | ||
189 | */ | ||
190 | static struct cea_channel_speaker_allocation channel_allocations[] = { | ||
191 | /* channel: 7 6 5 4 3 2 1 0 */ | ||
192 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, | ||
193 | /* 2.1 */ | ||
194 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, | ||
195 | /* Dolby Surround */ | ||
196 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, | ||
197 | /* surround40 */ | ||
198 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
199 | /* surround41 */ | ||
200 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
201 | /* surround50 */ | ||
202 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
203 | /* surround51 */ | ||
204 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
205 | /* 6.1 */ | ||
206 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
207 | /* surround71 */ | ||
208 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
209 | |||
210 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, | ||
211 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, | ||
212 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, | ||
213 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, | ||
214 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, | ||
215 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, | ||
216 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, | ||
217 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, | ||
218 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, | ||
219 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, | ||
220 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, | ||
221 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, | ||
222 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, | ||
223 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, | ||
224 | { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, | ||
225 | { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, | ||
226 | { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, | ||
227 | { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, | ||
228 | { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, | ||
229 | { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, | ||
230 | { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, | ||
231 | { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, | ||
232 | { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, | ||
233 | { .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, | ||
234 | { .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
235 | { .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, | ||
236 | { .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, | ||
237 | { .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, | ||
238 | { .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, | ||
239 | { .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, | ||
240 | { .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, | ||
241 | { .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, | ||
242 | { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, | ||
243 | { .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, | ||
244 | { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, | ||
245 | { .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, | ||
246 | { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
247 | { .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, | ||
248 | { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, | ||
249 | { .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, | ||
250 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, | ||
251 | }; | ||
252 | |||
253 | /* | ||
254 | * HDA/HDMI auto parsing | ||
255 | */ | ||
256 | |||
257 | static int hda_node_index(hda_nid_t *nids, hda_nid_t nid) | ||
258 | { | ||
259 | int i; | ||
260 | |||
261 | for (i = 0; nids[i]; i++) | ||
262 | if (nids[i] == nid) | ||
263 | return i; | ||
264 | |||
265 | snd_printk(KERN_WARNING "HDMI: nid %d not registered\n", nid); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | static int intel_hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid) | ||
270 | { | ||
271 | struct intel_hdmi_spec *spec = codec->spec; | ||
272 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
273 | int conn_len, curr; | ||
274 | int index; | ||
275 | |||
276 | if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { | ||
277 | snd_printk(KERN_WARNING | ||
278 | "HDMI: pin %d wcaps %#x " | ||
279 | "does not support connection list\n", | ||
280 | pin_nid, get_wcaps(codec, pin_nid)); | ||
281 | return -EINVAL; | ||
282 | } | ||
283 | |||
284 | conn_len = snd_hda_get_connections(codec, pin_nid, conn_list, | ||
285 | HDA_MAX_CONNECTIONS); | ||
286 | if (conn_len > 1) | ||
287 | curr = snd_hda_codec_read(codec, pin_nid, 0, | ||
288 | AC_VERB_GET_CONNECT_SEL, 0); | ||
289 | else | ||
290 | curr = 0; | ||
291 | |||
292 | index = hda_node_index(spec->pin, pin_nid); | ||
293 | if (index < 0) | ||
294 | return -EINVAL; | ||
295 | |||
296 | spec->pin_cvt[index] = conn_list[curr]; | ||
297 | |||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid, | ||
302 | struct hdmi_eld *eld) | ||
303 | { | ||
304 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | ||
305 | snd_hdmi_show_eld(eld); | ||
306 | } | ||
307 | |||
308 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | ||
309 | struct hdmi_eld *eld) | ||
310 | { | ||
311 | int present = snd_hda_pin_sense(codec, pin_nid); | ||
312 | |||
313 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); | ||
314 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); | ||
315 | |||
316 | if (present & AC_PINSENSE_ELDV) | ||
317 | hdmi_get_show_eld(codec, pin_nid, eld); | ||
318 | } | ||
319 | |||
320 | static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | ||
321 | { | ||
322 | struct intel_hdmi_spec *spec = codec->spec; | ||
323 | |||
324 | if (spec->num_pins >= INTEL_HDMI_PINS) { | ||
325 | snd_printk(KERN_WARNING | ||
326 | "HDMI: no space for pin %d \n", pin_nid); | ||
327 | return -EINVAL; | ||
328 | } | ||
329 | |||
330 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); | ||
331 | |||
332 | spec->pin[spec->num_pins] = pin_nid; | ||
333 | spec->num_pins++; | ||
334 | |||
335 | /* | ||
336 | * It is assumed that converter nodes come first in the node list and | ||
337 | * hence have been registered and usable now. | ||
338 | */ | ||
339 | return intel_hdmi_read_pin_conn(codec, pin_nid); | ||
340 | } | ||
341 | |||
342 | static int intel_hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid) | ||
343 | { | ||
344 | struct intel_hdmi_spec *spec = codec->spec; | ||
345 | |||
346 | if (spec->num_cvts >= INTEL_HDMI_CVTS) { | ||
347 | snd_printk(KERN_WARNING | ||
348 | "HDMI: no space for converter %d \n", nid); | ||
349 | return -EINVAL; | ||
350 | } | ||
351 | |||
352 | spec->cvt[spec->num_cvts] = nid; | ||
353 | spec->num_cvts++; | ||
354 | |||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | static int intel_hdmi_parse_codec(struct hda_codec *codec) | ||
359 | { | ||
360 | hda_nid_t nid; | ||
361 | int i, nodes; | ||
362 | |||
363 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); | ||
364 | if (!nid || nodes < 0) { | ||
365 | snd_printk(KERN_WARNING "HDMI: failed to get afg sub nodes\n"); | ||
366 | return -EINVAL; | ||
367 | } | ||
368 | |||
369 | for (i = 0; i < nodes; i++, nid++) { | ||
370 | unsigned int caps; | ||
371 | unsigned int type; | ||
372 | |||
373 | caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); | ||
374 | type = get_wcaps_type(caps); | ||
375 | |||
376 | if (!(caps & AC_WCAP_DIGITAL)) | ||
377 | continue; | ||
378 | |||
379 | switch (type) { | ||
380 | case AC_WID_AUD_OUT: | ||
381 | if (intel_hdmi_add_cvt(codec, nid) < 0) | ||
382 | return -EINVAL; | ||
383 | break; | ||
384 | case AC_WID_PIN: | ||
385 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
386 | if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) | ||
387 | continue; | ||
388 | if (intel_hdmi_add_pin(codec, nid) < 0) | ||
389 | return -EINVAL; | ||
390 | break; | ||
391 | } | ||
392 | } | ||
393 | |||
394 | /* | ||
395 | * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event | ||
396 | * can be lost and presence sense verb will become inaccurate if the | ||
397 | * HDA link is powered off at hot plug or hw initialization time. | ||
398 | */ | ||
399 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
400 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | ||
401 | AC_PWRST_EPSS)) | ||
402 | codec->bus->power_keep_link_on = 1; | ||
403 | #endif | ||
404 | |||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | /* | ||
409 | * HDMI routines | ||
410 | */ | ||
411 | |||
412 | #ifdef BE_PARANOID | ||
413 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
414 | int *packet_index, int *byte_index) | ||
415 | { | ||
416 | int val; | ||
417 | |||
418 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
419 | AC_VERB_GET_HDMI_DIP_INDEX, 0); | ||
420 | |||
421 | *packet_index = val >> 5; | ||
422 | *byte_index = val & 0x1f; | ||
423 | } | ||
424 | #endif | ||
425 | |||
426 | static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
427 | int packet_index, int byte_index) | ||
428 | { | ||
429 | int val; | ||
430 | |||
431 | val = (packet_index << 5) | (byte_index & 0x1f); | ||
432 | |||
433 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); | ||
434 | } | ||
435 | |||
436 | static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, | ||
437 | unsigned char val) | ||
438 | { | ||
439 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); | ||
440 | } | ||
441 | |||
442 | static void hdmi_enable_output(struct hda_codec *codec, hda_nid_t pin_nid) | ||
443 | { | ||
444 | /* Unmute */ | ||
445 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) | ||
446 | snd_hda_codec_write(codec, pin_nid, 0, | ||
447 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
448 | /* Enable pin out */ | ||
449 | snd_hda_codec_write(codec, pin_nid, 0, | ||
450 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
451 | } | ||
452 | |||
453 | /* | ||
454 | * Enable Audio InfoFrame Transmission | ||
455 | */ | ||
456 | static void hdmi_start_infoframe_trans(struct hda_codec *codec, | ||
457 | hda_nid_t pin_nid) | ||
458 | { | ||
459 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
460 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
461 | AC_DIPXMIT_BEST); | ||
462 | } | ||
463 | |||
464 | /* | ||
465 | * Disable Audio InfoFrame Transmission | ||
466 | */ | ||
467 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec, | ||
468 | hda_nid_t pin_nid) | ||
469 | { | ||
470 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
471 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
472 | AC_DIPXMIT_DISABLE); | ||
473 | } | ||
474 | |||
475 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t nid) | ||
476 | { | ||
477 | return 1 + snd_hda_codec_read(codec, nid, 0, | ||
478 | AC_VERB_GET_CVT_CHAN_COUNT, 0); | ||
479 | } | ||
480 | |||
481 | static void hdmi_set_channel_count(struct hda_codec *codec, | ||
482 | hda_nid_t nid, int chs) | ||
483 | { | ||
484 | if (chs != hdmi_get_channel_count(codec, nid)) | ||
485 | snd_hda_codec_write(codec, nid, 0, | ||
486 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | ||
487 | } | ||
488 | |||
489 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, | ||
490 | hda_nid_t pin_nid) | ||
491 | { | ||
492 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
493 | int i; | ||
494 | int slot; | ||
495 | |||
496 | for (i = 0; i < 8; i++) { | ||
497 | slot = snd_hda_codec_read(codec, pin_nid, 0, | ||
498 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | ||
499 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | ||
500 | slot >> 4, slot & 0xf); | ||
501 | } | ||
502 | #endif | ||
503 | } | ||
504 | |||
505 | |||
506 | /* | ||
507 | * Audio InfoFrame routines | ||
508 | */ | ||
509 | |||
510 | static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) | ||
511 | { | ||
512 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
513 | int i; | ||
514 | int size; | ||
515 | |||
516 | size = snd_hdmi_get_eld_size(codec, pin_nid); | ||
517 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); | ||
518 | |||
519 | for (i = 0; i < 8; i++) { | ||
520 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
521 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
522 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); | ||
523 | } | ||
524 | #endif | ||
525 | } | ||
526 | |||
527 | static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) | ||
528 | { | ||
529 | #ifdef BE_PARANOID | ||
530 | int i, j; | ||
531 | int size; | ||
532 | int pi, bi; | ||
533 | for (i = 0; i < 8; i++) { | ||
534 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
535 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
536 | if (size == 0) | ||
537 | continue; | ||
538 | |||
539 | hdmi_set_dip_index(codec, pin_nid, i, 0x0); | ||
540 | for (j = 1; j < 1000; j++) { | ||
541 | hdmi_write_dip_byte(codec, pin_nid, 0x0); | ||
542 | hdmi_get_dip_index(codec, pin_nid, &pi, &bi); | ||
543 | if (pi != i) | ||
544 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", | ||
545 | bi, pi, i); | ||
546 | if (bi == 0) /* byte index wrapped around */ | ||
547 | break; | ||
548 | } | ||
549 | snd_printd(KERN_INFO | ||
550 | "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", | ||
551 | i, size, j); | ||
552 | } | ||
553 | #endif | ||
554 | } | ||
555 | |||
556 | static void hdmi_checksum_audio_infoframe(struct hdmi_audio_infoframe *ai) | ||
557 | { | ||
558 | u8 *bytes = (u8 *)ai; | ||
559 | u8 sum = 0; | ||
560 | int i; | ||
561 | |||
562 | ai->checksum = 0; | ||
563 | |||
564 | for (i = 0; i < sizeof(*ai); i++) | ||
565 | sum += bytes[i]; | ||
566 | |||
567 | ai->checksum = - sum; | ||
568 | } | ||
569 | |||
570 | static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | ||
571 | hda_nid_t pin_nid, | ||
572 | struct hdmi_audio_infoframe *ai) | ||
573 | { | ||
574 | u8 *bytes = (u8 *)ai; | ||
575 | int i; | ||
576 | |||
577 | hdmi_debug_dip_size(codec, pin_nid); | ||
578 | hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ | ||
579 | |||
580 | hdmi_checksum_audio_infoframe(ai); | ||
581 | |||
582 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
583 | for (i = 0; i < sizeof(*ai); i++) | ||
584 | hdmi_write_dip_byte(codec, pin_nid, bytes[i]); | ||
585 | } | ||
586 | |||
587 | /* | ||
588 | * Compute derived values in channel_allocations[]. | ||
589 | */ | ||
590 | static void init_channel_allocations(void) | ||
591 | { | ||
592 | int i, j; | ||
593 | struct cea_channel_speaker_allocation *p; | ||
594 | |||
595 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
596 | p = channel_allocations + i; | ||
597 | p->channels = 0; | ||
598 | p->spk_mask = 0; | ||
599 | for (j = 0; j < ARRAY_SIZE(p->speakers); j++) | ||
600 | if (p->speakers[j]) { | ||
601 | p->channels++; | ||
602 | p->spk_mask |= p->speakers[j]; | ||
603 | } | ||
604 | } | ||
605 | } | ||
606 | |||
607 | /* | ||
608 | * The transformation takes two steps: | ||
609 | * | ||
610 | * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask | ||
611 | * spk_mask => (channel_allocations[]) => ai->CA | ||
612 | * | ||
613 | * TODO: it could select the wrong CA from multiple candidates. | ||
614 | */ | ||
615 | static int hdmi_setup_channel_allocation(struct hda_codec *codec, hda_nid_t nid, | ||
616 | struct hdmi_audio_infoframe *ai) | ||
617 | { | ||
618 | struct intel_hdmi_spec *spec = codec->spec; | ||
619 | struct hdmi_eld *eld; | ||
620 | int i; | ||
621 | int spk_mask = 0; | ||
622 | int channels = 1 + (ai->CC02_CT47 & 0x7); | ||
623 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | ||
624 | |||
625 | /* | ||
626 | * CA defaults to 0 for basic stereo audio | ||
627 | */ | ||
628 | if (channels <= 2) | ||
629 | return 0; | ||
630 | |||
631 | i = hda_node_index(spec->pin_cvt, nid); | ||
632 | if (i < 0) | ||
633 | return 0; | ||
634 | eld = &spec->sink_eld[i]; | ||
635 | |||
636 | /* | ||
637 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
638 | * in console or for audio devices. Assume the highest speakers | ||
639 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
640 | */ | ||
641 | if (!eld->spk_alloc) | ||
642 | eld->spk_alloc = 0xffff; | ||
643 | |||
644 | /* | ||
645 | * expand ELD's speaker allocation mask | ||
646 | * | ||
647 | * ELD tells the speaker mask in a compact(paired) form, | ||
648 | * expand ELD's notions to match the ones used by Audio InfoFrame. | ||
649 | */ | ||
650 | for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { | ||
651 | if (eld->spk_alloc & (1 << i)) | ||
652 | spk_mask |= eld_speaker_allocation_bits[i]; | ||
653 | } | ||
654 | |||
655 | /* search for the first working match in the CA table */ | ||
656 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
657 | if (channels == channel_allocations[i].channels && | ||
658 | (spk_mask & channel_allocations[i].spk_mask) == | ||
659 | channel_allocations[i].spk_mask) { | ||
660 | ai->CA = channel_allocations[i].ca_index; | ||
661 | break; | ||
662 | } | ||
663 | } | ||
664 | |||
665 | snd_print_channel_allocation(eld->spk_alloc, buf, sizeof(buf)); | ||
666 | snd_printdd(KERN_INFO | ||
667 | "HDMI: select CA 0x%x for %d-channel allocation: %s\n", | ||
668 | ai->CA, channels, buf); | ||
669 | |||
670 | return ai->CA; | ||
671 | } | ||
672 | |||
673 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | ||
674 | hda_nid_t pin_nid, | ||
675 | struct hdmi_audio_infoframe *ai) | ||
676 | { | ||
677 | int i; | ||
678 | int ca = ai->CA; | ||
679 | int err; | ||
680 | |||
681 | if (hdmi_channel_mapping[ca][1] == 0) { | ||
682 | for (i = 0; i < channel_allocations[ca].channels; i++) | ||
683 | hdmi_channel_mapping[ca][i] = i | (i << 4); | ||
684 | for (; i < 8; i++) | ||
685 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); | ||
686 | } | ||
687 | |||
688 | for (i = 0; i < 8; i++) { | ||
689 | err = snd_hda_codec_write(codec, pin_nid, 0, | ||
690 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
691 | hdmi_channel_mapping[ca][i]); | ||
692 | if (err) { | ||
693 | snd_printdd(KERN_INFO "HDMI: channel mapping failed\n"); | ||
694 | break; | ||
695 | } | ||
696 | } | ||
697 | |||
698 | hdmi_debug_channel_mapping(codec, pin_nid); | ||
699 | } | ||
700 | |||
701 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | ||
702 | struct hdmi_audio_infoframe *ai) | ||
703 | { | ||
704 | u8 *bytes = (u8 *)ai; | ||
705 | u8 val; | ||
706 | int i; | ||
707 | |||
708 | if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) | ||
709 | != AC_DIPXMIT_BEST) | ||
710 | return false; | ||
711 | |||
712 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
713 | for (i = 0; i < sizeof(*ai); i++) { | ||
714 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
715 | AC_VERB_GET_HDMI_DIP_DATA, 0); | ||
716 | if (val != bytes[i]) | ||
717 | return false; | ||
718 | } | ||
719 | |||
720 | return true; | ||
721 | } | ||
722 | |||
723 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | ||
724 | struct snd_pcm_substream *substream) | ||
725 | { | ||
726 | struct intel_hdmi_spec *spec = codec->spec; | ||
727 | hda_nid_t pin_nid; | ||
728 | int i; | ||
729 | struct hdmi_audio_infoframe ai = { | ||
730 | .type = 0x84, | ||
731 | .ver = 0x01, | ||
732 | .len = 0x0a, | ||
733 | .CC02_CT47 = substream->runtime->channels - 1, | ||
734 | }; | ||
735 | |||
736 | hdmi_setup_channel_allocation(codec, nid, &ai); | ||
737 | |||
738 | for (i = 0; i < spec->num_pins; i++) { | ||
739 | if (spec->pin_cvt[i] != nid) | ||
740 | continue; | ||
741 | if (!spec->sink_eld[i].monitor_present) | ||
742 | continue; | ||
743 | |||
744 | pin_nid = spec->pin[i]; | ||
745 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { | ||
746 | hdmi_setup_channel_mapping(codec, pin_nid, &ai); | ||
747 | hdmi_stop_infoframe_trans(codec, pin_nid); | ||
748 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); | ||
749 | hdmi_start_infoframe_trans(codec, pin_nid); | ||
750 | } | ||
751 | } | ||
752 | } | ||
753 | |||
754 | |||
755 | /* | 53 | /* |
756 | * Unsolicited events | 54 | * HDMI callbacks |
757 | */ | 55 | */ |
758 | 56 | ||
759 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
760 | { | ||
761 | struct intel_hdmi_spec *spec = codec->spec; | ||
762 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
763 | int pind = !!(res & AC_UNSOL_RES_PD); | ||
764 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | ||
765 | int index; | ||
766 | |||
767 | printk(KERN_INFO | ||
768 | "HDMI hot plug event: Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | ||
769 | tag, pind, eldv); | ||
770 | |||
771 | index = hda_node_index(spec->pin, tag); | ||
772 | if (index < 0) | ||
773 | return; | ||
774 | |||
775 | spec->sink_eld[index].monitor_present = pind; | ||
776 | spec->sink_eld[index].eld_valid = eldv; | ||
777 | |||
778 | if (pind && eldv) { | ||
779 | hdmi_get_show_eld(codec, spec->pin[index], &spec->sink_eld[index]); | ||
780 | /* TODO: do real things about ELD */ | ||
781 | } | ||
782 | } | ||
783 | |||
784 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
785 | { | ||
786 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
787 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
788 | int cp_state = !!(res & AC_UNSOL_RES_CP_STATE); | ||
789 | int cp_ready = !!(res & AC_UNSOL_RES_CP_READY); | ||
790 | |||
791 | printk(KERN_INFO | ||
792 | "HDMI CP event: PIN=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", | ||
793 | tag, | ||
794 | subtag, | ||
795 | cp_state, | ||
796 | cp_ready); | ||
797 | |||
798 | /* TODO */ | ||
799 | if (cp_state) | ||
800 | ; | ||
801 | if (cp_ready) | ||
802 | ; | ||
803 | } | ||
804 | |||
805 | |||
806 | static void intel_hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | ||
807 | { | ||
808 | struct intel_hdmi_spec *spec = codec->spec; | ||
809 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
810 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
811 | |||
812 | if (hda_node_index(spec->pin, tag) < 0) { | ||
813 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); | ||
814 | return; | ||
815 | } | ||
816 | |||
817 | if (subtag == 0) | ||
818 | hdmi_intrinsic_event(codec, res); | ||
819 | else | ||
820 | hdmi_non_intrinsic_event(codec, res); | ||
821 | } | ||
822 | |||
823 | /* | ||
824 | * Callbacks | ||
825 | */ | ||
826 | |||
827 | static void hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid, | ||
828 | u32 stream_tag, int format) | ||
829 | { | ||
830 | int tag; | ||
831 | int fmt; | ||
832 | |||
833 | tag = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0) >> 4; | ||
834 | fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); | ||
835 | |||
836 | snd_printdd("hdmi_setup_stream: " | ||
837 | "NID=0x%x, %sstream=0x%x, %sformat=0x%x\n", | ||
838 | nid, | ||
839 | tag == stream_tag ? "" : "new-", | ||
840 | stream_tag, | ||
841 | fmt == format ? "" : "new-", | ||
842 | format); | ||
843 | |||
844 | if (tag != stream_tag) | ||
845 | snd_hda_codec_write(codec, nid, 0, | ||
846 | AC_VERB_SET_CHANNEL_STREAMID, stream_tag << 4); | ||
847 | if (fmt != format) | ||
848 | snd_hda_codec_write(codec, nid, 0, | ||
849 | AC_VERB_SET_STREAM_FORMAT, format); | ||
850 | } | ||
851 | |||
852 | static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 57 | static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
853 | struct hda_codec *codec, | 58 | struct hda_codec *codec, |
854 | unsigned int stream_tag, | 59 | unsigned int stream_tag, |
@@ -882,7 +87,7 @@ static struct hda_pcm_stream intel_hdmi_pcm_playback = { | |||
882 | 87 | ||
883 | static int intel_hdmi_build_pcms(struct hda_codec *codec) | 88 | static int intel_hdmi_build_pcms(struct hda_codec *codec) |
884 | { | 89 | { |
885 | struct intel_hdmi_spec *spec = codec->spec; | 90 | struct hdmi_spec *spec = codec->spec; |
886 | struct hda_pcm *info = spec->pcm_rec; | 91 | struct hda_pcm *info = spec->pcm_rec; |
887 | int i; | 92 | int i; |
888 | 93 | ||
@@ -908,7 +113,7 @@ static int intel_hdmi_build_pcms(struct hda_codec *codec) | |||
908 | 113 | ||
909 | static int intel_hdmi_build_controls(struct hda_codec *codec) | 114 | static int intel_hdmi_build_controls(struct hda_codec *codec) |
910 | { | 115 | { |
911 | struct intel_hdmi_spec *spec = codec->spec; | 116 | struct hdmi_spec *spec = codec->spec; |
912 | int err; | 117 | int err; |
913 | int i; | 118 | int i; |
914 | 119 | ||
@@ -923,7 +128,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec) | |||
923 | 128 | ||
924 | static int intel_hdmi_init(struct hda_codec *codec) | 129 | static int intel_hdmi_init(struct hda_codec *codec) |
925 | { | 130 | { |
926 | struct intel_hdmi_spec *spec = codec->spec; | 131 | struct hdmi_spec *spec = codec->spec; |
927 | int i; | 132 | int i; |
928 | 133 | ||
929 | for (i = 0; spec->pin[i]; i++) { | 134 | for (i = 0; spec->pin[i]; i++) { |
@@ -937,7 +142,7 @@ static int intel_hdmi_init(struct hda_codec *codec) | |||
937 | 142 | ||
938 | static void intel_hdmi_free(struct hda_codec *codec) | 143 | static void intel_hdmi_free(struct hda_codec *codec) |
939 | { | 144 | { |
940 | struct intel_hdmi_spec *spec = codec->spec; | 145 | struct hdmi_spec *spec = codec->spec; |
941 | int i; | 146 | int i; |
942 | 147 | ||
943 | for (i = 0; i < spec->num_pins; i++) | 148 | for (i = 0; i < spec->num_pins; i++) |
@@ -951,12 +156,12 @@ static struct hda_codec_ops intel_hdmi_patch_ops = { | |||
951 | .free = intel_hdmi_free, | 156 | .free = intel_hdmi_free, |
952 | .build_pcms = intel_hdmi_build_pcms, | 157 | .build_pcms = intel_hdmi_build_pcms, |
953 | .build_controls = intel_hdmi_build_controls, | 158 | .build_controls = intel_hdmi_build_controls, |
954 | .unsol_event = intel_hdmi_unsol_event, | 159 | .unsol_event = hdmi_unsol_event, |
955 | }; | 160 | }; |
956 | 161 | ||
957 | static int patch_intel_hdmi(struct hda_codec *codec) | 162 | static int patch_intel_hdmi(struct hda_codec *codec) |
958 | { | 163 | { |
959 | struct intel_hdmi_spec *spec; | 164 | struct hdmi_spec *spec; |
960 | int i; | 165 | int i; |
961 | 166 | ||
962 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 167 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -964,7 +169,7 @@ static int patch_intel_hdmi(struct hda_codec *codec) | |||
964 | return -ENOMEM; | 169 | return -ENOMEM; |
965 | 170 | ||
966 | codec->spec = spec; | 171 | codec->spec = spec; |
967 | if (intel_hdmi_parse_codec(codec) < 0) { | 172 | if (hdmi_parse_codec(codec) < 0) { |
968 | codec->spec = NULL; | 173 | codec->spec = NULL; |
969 | kfree(spec); | 174 | kfree(spec); |
970 | return -EINVAL; | 175 | return -EINVAL; |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 6afdab09bab7..70669a246902 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -29,13 +29,23 @@ | |||
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | 31 | ||
32 | #define MAX_HDMI_CVTS 1 | ||
33 | #define MAX_HDMI_PINS 1 | ||
34 | |||
35 | #include "patch_hdmi.c" | ||
36 | |||
37 | static char *nvhdmi_pcm_names[MAX_HDMI_CVTS] = { | ||
38 | "NVIDIA HDMI", | ||
39 | }; | ||
40 | |||
32 | /* define below to restrict the supported rates and formats */ | 41 | /* define below to restrict the supported rates and formats */ |
33 | /* #define LIMITED_RATE_FMT_SUPPORT */ | 42 | /* #define LIMITED_RATE_FMT_SUPPORT */ |
34 | 43 | ||
35 | struct nvhdmi_spec { | 44 | enum HDACodec { |
36 | struct hda_multi_out multiout; | 45 | HDA_CODEC_NVIDIA_MCP7X, |
37 | 46 | HDA_CODEC_NVIDIA_MCP89, | |
38 | struct hda_pcm pcm_rec; | 47 | HDA_CODEC_NVIDIA_GT21X, |
48 | HDA_CODEC_INVALID | ||
39 | }; | 49 | }; |
40 | 50 | ||
41 | #define Nv_VERB_SET_Channel_Allocation 0xF79 | 51 | #define Nv_VERB_SET_Channel_Allocation 0xF79 |
@@ -43,15 +53,18 @@ struct nvhdmi_spec { | |||
43 | #define Nv_VERB_SET_Audio_Protection_On 0xF98 | 53 | #define Nv_VERB_SET_Audio_Protection_On 0xF98 |
44 | #define Nv_VERB_SET_Audio_Protection_Off 0xF99 | 54 | #define Nv_VERB_SET_Audio_Protection_Off 0xF99 |
45 | 55 | ||
46 | #define Nv_Master_Convert_nid 0x04 | 56 | #define nvhdmi_master_con_nid_7x 0x04 |
47 | #define Nv_Master_Pin_nid 0x05 | 57 | #define nvhdmi_master_pin_nid_7x 0x05 |
48 | 58 | ||
49 | static hda_nid_t nvhdmi_convert_nids[4] = { | 59 | #define nvhdmi_master_con_nid_89 0x04 |
60 | #define nvhdmi_master_pin_nid_89 0x05 | ||
61 | |||
62 | static hda_nid_t nvhdmi_con_nids_7x[4] = { | ||
50 | /*front, rear, clfe, rear_surr */ | 63 | /*front, rear, clfe, rear_surr */ |
51 | 0x6, 0x8, 0xa, 0xc, | 64 | 0x6, 0x8, 0xa, 0xc, |
52 | }; | 65 | }; |
53 | 66 | ||
54 | static struct hda_verb nvhdmi_basic_init[] = { | 67 | static struct hda_verb nvhdmi_basic_init_7x[] = { |
55 | /* set audio protect on */ | 68 | /* set audio protect on */ |
56 | { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1}, | 69 | { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1}, |
57 | /* enable digital output on pin widget */ | 70 | /* enable digital output on pin widget */ |
@@ -84,22 +97,60 @@ static struct hda_verb nvhdmi_basic_init[] = { | |||
84 | */ | 97 | */ |
85 | static int nvhdmi_build_controls(struct hda_codec *codec) | 98 | static int nvhdmi_build_controls(struct hda_codec *codec) |
86 | { | 99 | { |
87 | struct nvhdmi_spec *spec = codec->spec; | 100 | struct hdmi_spec *spec = codec->spec; |
88 | int err; | 101 | int err; |
102 | int i; | ||
89 | 103 | ||
90 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 104 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) |
91 | if (err < 0) | 105 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { |
92 | return err; | 106 | for (i = 0; i < codec->num_pcms; i++) { |
107 | err = snd_hda_create_spdif_out_ctls(codec, | ||
108 | spec->cvt[i]); | ||
109 | if (err < 0) | ||
110 | return err; | ||
111 | } | ||
112 | } else { | ||
113 | err = snd_hda_create_spdif_out_ctls(codec, | ||
114 | spec->multiout.dig_out_nid); | ||
115 | if (err < 0) | ||
116 | return err; | ||
117 | } | ||
93 | 118 | ||
94 | return 0; | 119 | return 0; |
95 | } | 120 | } |
96 | 121 | ||
97 | static int nvhdmi_init(struct hda_codec *codec) | 122 | static int nvhdmi_init(struct hda_codec *codec) |
98 | { | 123 | { |
99 | snd_hda_sequence_write(codec, nvhdmi_basic_init); | 124 | struct hdmi_spec *spec = codec->spec; |
125 | int i; | ||
126 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) | ||
127 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { | ||
128 | for (i = 0; spec->pin[i]; i++) { | ||
129 | hdmi_enable_output(codec, spec->pin[i]); | ||
130 | snd_hda_codec_write(codec, spec->pin[i], 0, | ||
131 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
132 | AC_USRSP_EN | spec->pin[i]); | ||
133 | } | ||
134 | } else { | ||
135 | snd_hda_sequence_write(codec, nvhdmi_basic_init_7x); | ||
136 | } | ||
100 | return 0; | 137 | return 0; |
101 | } | 138 | } |
102 | 139 | ||
140 | static void nvhdmi_free(struct hda_codec *codec) | ||
141 | { | ||
142 | struct hdmi_spec *spec = codec->spec; | ||
143 | int i; | ||
144 | |||
145 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) | ||
146 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { | ||
147 | for (i = 0; i < spec->num_pins; i++) | ||
148 | snd_hda_eld_proc_free(codec, &spec->sink_eld[i]); | ||
149 | } | ||
150 | |||
151 | kfree(spec); | ||
152 | } | ||
153 | |||
103 | /* | 154 | /* |
104 | * Digital out | 155 | * Digital out |
105 | */ | 156 | */ |
@@ -107,25 +158,25 @@ static int nvhdmi_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
107 | struct hda_codec *codec, | 158 | struct hda_codec *codec, |
108 | struct snd_pcm_substream *substream) | 159 | struct snd_pcm_substream *substream) |
109 | { | 160 | { |
110 | struct nvhdmi_spec *spec = codec->spec; | 161 | struct hdmi_spec *spec = codec->spec; |
111 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | 162 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
112 | } | 163 | } |
113 | 164 | ||
114 | static int nvhdmi_dig_playback_pcm_close_8ch(struct hda_pcm_stream *hinfo, | 165 | static int nvhdmi_dig_playback_pcm_close_8ch_7x(struct hda_pcm_stream *hinfo, |
115 | struct hda_codec *codec, | 166 | struct hda_codec *codec, |
116 | struct snd_pcm_substream *substream) | 167 | struct snd_pcm_substream *substream) |
117 | { | 168 | { |
118 | struct nvhdmi_spec *spec = codec->spec; | 169 | struct hdmi_spec *spec = codec->spec; |
119 | int i; | 170 | int i; |
120 | 171 | ||
121 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, | 172 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, |
122 | 0, AC_VERB_SET_CHANNEL_STREAMID, 0); | 173 | 0, AC_VERB_SET_CHANNEL_STREAMID, 0); |
123 | for (i = 0; i < 4; i++) { | 174 | for (i = 0; i < 4; i++) { |
124 | /* set the stream id */ | 175 | /* set the stream id */ |
125 | snd_hda_codec_write(codec, nvhdmi_convert_nids[i], 0, | 176 | snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0, |
126 | AC_VERB_SET_CHANNEL_STREAMID, 0); | 177 | AC_VERB_SET_CHANNEL_STREAMID, 0); |
127 | /* set the stream format */ | 178 | /* set the stream format */ |
128 | snd_hda_codec_write(codec, nvhdmi_convert_nids[i], 0, | 179 | snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0, |
129 | AC_VERB_SET_STREAM_FORMAT, 0); | 180 | AC_VERB_SET_STREAM_FORMAT, 0); |
130 | } | 181 | } |
131 | 182 | ||
@@ -136,10 +187,25 @@ static int nvhdmi_dig_playback_pcm_close_2ch(struct hda_pcm_stream *hinfo, | |||
136 | struct hda_codec *codec, | 187 | struct hda_codec *codec, |
137 | struct snd_pcm_substream *substream) | 188 | struct snd_pcm_substream *substream) |
138 | { | 189 | { |
139 | struct nvhdmi_spec *spec = codec->spec; | 190 | struct hdmi_spec *spec = codec->spec; |
140 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | 191 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
141 | } | 192 | } |
142 | 193 | ||
194 | static int nvhdmi_dig_playback_pcm_prepare_8ch_89(struct hda_pcm_stream *hinfo, | ||
195 | struct hda_codec *codec, | ||
196 | unsigned int stream_tag, | ||
197 | unsigned int format, | ||
198 | struct snd_pcm_substream *substream) | ||
199 | { | ||
200 | hdmi_set_channel_count(codec, hinfo->nid, | ||
201 | substream->runtime->channels); | ||
202 | |||
203 | hdmi_setup_audio_infoframe(codec, hinfo->nid, substream); | ||
204 | |||
205 | hdmi_setup_stream(codec, hinfo->nid, stream_tag, format); | ||
206 | return 0; | ||
207 | } | ||
208 | |||
143 | static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | 209 | static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, |
144 | struct hda_codec *codec, | 210 | struct hda_codec *codec, |
145 | unsigned int stream_tag, | 211 | unsigned int stream_tag, |
@@ -181,29 +247,29 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
181 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 247 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
182 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) | 248 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
183 | snd_hda_codec_write(codec, | 249 | snd_hda_codec_write(codec, |
184 | Nv_Master_Convert_nid, | 250 | nvhdmi_master_con_nid_7x, |
185 | 0, | 251 | 0, |
186 | AC_VERB_SET_DIGI_CONVERT_1, | 252 | AC_VERB_SET_DIGI_CONVERT_1, |
187 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | 253 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); |
188 | 254 | ||
189 | /* set the stream id */ | 255 | /* set the stream id */ |
190 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, 0, | 256 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0, |
191 | AC_VERB_SET_CHANNEL_STREAMID, (stream_tag << 4) | 0x0); | 257 | AC_VERB_SET_CHANNEL_STREAMID, (stream_tag << 4) | 0x0); |
192 | 258 | ||
193 | /* set the stream format */ | 259 | /* set the stream format */ |
194 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, 0, | 260 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0, |
195 | AC_VERB_SET_STREAM_FORMAT, format); | 261 | AC_VERB_SET_STREAM_FORMAT, format); |
196 | 262 | ||
197 | /* turn on again (if needed) */ | 263 | /* turn on again (if needed) */ |
198 | /* enable and set the channel status audio/data flag */ | 264 | /* enable and set the channel status audio/data flag */ |
199 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) { | 265 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) { |
200 | snd_hda_codec_write(codec, | 266 | snd_hda_codec_write(codec, |
201 | Nv_Master_Convert_nid, | 267 | nvhdmi_master_con_nid_7x, |
202 | 0, | 268 | 0, |
203 | AC_VERB_SET_DIGI_CONVERT_1, | 269 | AC_VERB_SET_DIGI_CONVERT_1, |
204 | codec->spdif_ctls & 0xff); | 270 | codec->spdif_ctls & 0xff); |
205 | snd_hda_codec_write(codec, | 271 | snd_hda_codec_write(codec, |
206 | Nv_Master_Convert_nid, | 272 | nvhdmi_master_con_nid_7x, |
207 | 0, | 273 | 0, |
208 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); | 274 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); |
209 | } | 275 | } |
@@ -220,19 +286,19 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
220 | if (codec->spdif_status_reset && | 286 | if (codec->spdif_status_reset && |
221 | (codec->spdif_ctls & AC_DIG1_ENABLE)) | 287 | (codec->spdif_ctls & AC_DIG1_ENABLE)) |
222 | snd_hda_codec_write(codec, | 288 | snd_hda_codec_write(codec, |
223 | nvhdmi_convert_nids[i], | 289 | nvhdmi_con_nids_7x[i], |
224 | 0, | 290 | 0, |
225 | AC_VERB_SET_DIGI_CONVERT_1, | 291 | AC_VERB_SET_DIGI_CONVERT_1, |
226 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | 292 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); |
227 | /* set the stream id */ | 293 | /* set the stream id */ |
228 | snd_hda_codec_write(codec, | 294 | snd_hda_codec_write(codec, |
229 | nvhdmi_convert_nids[i], | 295 | nvhdmi_con_nids_7x[i], |
230 | 0, | 296 | 0, |
231 | AC_VERB_SET_CHANNEL_STREAMID, | 297 | AC_VERB_SET_CHANNEL_STREAMID, |
232 | (stream_tag << 4) | channel_id); | 298 | (stream_tag << 4) | channel_id); |
233 | /* set the stream format */ | 299 | /* set the stream format */ |
234 | snd_hda_codec_write(codec, | 300 | snd_hda_codec_write(codec, |
235 | nvhdmi_convert_nids[i], | 301 | nvhdmi_con_nids_7x[i], |
236 | 0, | 302 | 0, |
237 | AC_VERB_SET_STREAM_FORMAT, | 303 | AC_VERB_SET_STREAM_FORMAT, |
238 | format); | 304 | format); |
@@ -241,12 +307,12 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
241 | if (codec->spdif_status_reset && | 307 | if (codec->spdif_status_reset && |
242 | (codec->spdif_ctls & AC_DIG1_ENABLE)) { | 308 | (codec->spdif_ctls & AC_DIG1_ENABLE)) { |
243 | snd_hda_codec_write(codec, | 309 | snd_hda_codec_write(codec, |
244 | nvhdmi_convert_nids[i], | 310 | nvhdmi_con_nids_7x[i], |
245 | 0, | 311 | 0, |
246 | AC_VERB_SET_DIGI_CONVERT_1, | 312 | AC_VERB_SET_DIGI_CONVERT_1, |
247 | codec->spdif_ctls & 0xff); | 313 | codec->spdif_ctls & 0xff); |
248 | snd_hda_codec_write(codec, | 314 | snd_hda_codec_write(codec, |
249 | nvhdmi_convert_nids[i], | 315 | nvhdmi_con_nids_7x[i], |
250 | 0, | 316 | 0, |
251 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); | 317 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); |
252 | } | 318 | } |
@@ -261,28 +327,47 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
261 | return 0; | 327 | return 0; |
262 | } | 328 | } |
263 | 329 | ||
330 | static int nvhdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
331 | struct hda_codec *codec, | ||
332 | struct snd_pcm_substream *substream) | ||
333 | { | ||
334 | return 0; | ||
335 | } | ||
336 | |||
264 | static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo, | 337 | static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo, |
265 | struct hda_codec *codec, | 338 | struct hda_codec *codec, |
266 | unsigned int stream_tag, | 339 | unsigned int stream_tag, |
267 | unsigned int format, | 340 | unsigned int format, |
268 | struct snd_pcm_substream *substream) | 341 | struct snd_pcm_substream *substream) |
269 | { | 342 | { |
270 | struct nvhdmi_spec *spec = codec->spec; | 343 | struct hdmi_spec *spec = codec->spec; |
271 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | 344 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, |
272 | format, substream); | 345 | format, substream); |
273 | } | 346 | } |
274 | 347 | ||
275 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch = { | 348 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch_89 = { |
349 | .substreams = 1, | ||
350 | .channels_min = 2, | ||
351 | .rates = SUPPORTED_RATES, | ||
352 | .maxbps = SUPPORTED_MAXBPS, | ||
353 | .formats = SUPPORTED_FORMATS, | ||
354 | .ops = { | ||
355 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch_89, | ||
356 | .cleanup = nvhdmi_playback_pcm_cleanup, | ||
357 | }, | ||
358 | }; | ||
359 | |||
360 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch_7x = { | ||
276 | .substreams = 1, | 361 | .substreams = 1, |
277 | .channels_min = 2, | 362 | .channels_min = 2, |
278 | .channels_max = 8, | 363 | .channels_max = 8, |
279 | .nid = Nv_Master_Convert_nid, | 364 | .nid = nvhdmi_master_con_nid_7x, |
280 | .rates = SUPPORTED_RATES, | 365 | .rates = SUPPORTED_RATES, |
281 | .maxbps = SUPPORTED_MAXBPS, | 366 | .maxbps = SUPPORTED_MAXBPS, |
282 | .formats = SUPPORTED_FORMATS, | 367 | .formats = SUPPORTED_FORMATS, |
283 | .ops = { | 368 | .ops = { |
284 | .open = nvhdmi_dig_playback_pcm_open, | 369 | .open = nvhdmi_dig_playback_pcm_open, |
285 | .close = nvhdmi_dig_playback_pcm_close_8ch, | 370 | .close = nvhdmi_dig_playback_pcm_close_8ch_7x, |
286 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch | 371 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch |
287 | }, | 372 | }, |
288 | }; | 373 | }; |
@@ -291,7 +376,7 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
291 | .substreams = 1, | 376 | .substreams = 1, |
292 | .channels_min = 2, | 377 | .channels_min = 2, |
293 | .channels_max = 2, | 378 | .channels_max = 2, |
294 | .nid = Nv_Master_Convert_nid, | 379 | .nid = nvhdmi_master_con_nid_7x, |
295 | .rates = SUPPORTED_RATES, | 380 | .rates = SUPPORTED_RATES, |
296 | .maxbps = SUPPORTED_MAXBPS, | 381 | .maxbps = SUPPORTED_MAXBPS, |
297 | .formats = SUPPORTED_FORMATS, | 382 | .formats = SUPPORTED_FORMATS, |
@@ -302,10 +387,36 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
302 | }, | 387 | }, |
303 | }; | 388 | }; |
304 | 389 | ||
305 | static int nvhdmi_build_pcms_8ch(struct hda_codec *codec) | 390 | static int nvhdmi_build_pcms_8ch_89(struct hda_codec *codec) |
391 | { | ||
392 | struct hdmi_spec *spec = codec->spec; | ||
393 | struct hda_pcm *info = spec->pcm_rec; | ||
394 | int i; | ||
395 | |||
396 | codec->num_pcms = spec->num_cvts; | ||
397 | codec->pcm_info = info; | ||
398 | |||
399 | for (i = 0; i < codec->num_pcms; i++, info++) { | ||
400 | unsigned int chans; | ||
401 | |||
402 | chans = get_wcaps(codec, spec->cvt[i]); | ||
403 | chans = get_wcaps_channels(chans); | ||
404 | |||
405 | info->name = nvhdmi_pcm_names[i]; | ||
406 | info->pcm_type = HDA_PCM_TYPE_HDMI; | ||
407 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] | ||
408 | = nvhdmi_pcm_digital_playback_8ch_89; | ||
409 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->cvt[i]; | ||
410 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; | ||
411 | } | ||
412 | |||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | static int nvhdmi_build_pcms_8ch_7x(struct hda_codec *codec) | ||
306 | { | 417 | { |
307 | struct nvhdmi_spec *spec = codec->spec; | 418 | struct hdmi_spec *spec = codec->spec; |
308 | struct hda_pcm *info = &spec->pcm_rec; | 419 | struct hda_pcm *info = spec->pcm_rec; |
309 | 420 | ||
310 | codec->num_pcms = 1; | 421 | codec->num_pcms = 1; |
311 | codec->pcm_info = info; | 422 | codec->pcm_info = info; |
@@ -313,15 +424,15 @@ static int nvhdmi_build_pcms_8ch(struct hda_codec *codec) | |||
313 | info->name = "NVIDIA HDMI"; | 424 | info->name = "NVIDIA HDMI"; |
314 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 425 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
315 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] | 426 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] |
316 | = nvhdmi_pcm_digital_playback_8ch; | 427 | = nvhdmi_pcm_digital_playback_8ch_7x; |
317 | 428 | ||
318 | return 0; | 429 | return 0; |
319 | } | 430 | } |
320 | 431 | ||
321 | static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) | 432 | static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) |
322 | { | 433 | { |
323 | struct nvhdmi_spec *spec = codec->spec; | 434 | struct hdmi_spec *spec = codec->spec; |
324 | struct hda_pcm *info = &spec->pcm_rec; | 435 | struct hda_pcm *info = spec->pcm_rec; |
325 | 436 | ||
326 | codec->num_pcms = 1; | 437 | codec->num_pcms = 1; |
327 | codec->pcm_info = info; | 438 | codec->pcm_info = info; |
@@ -334,14 +445,17 @@ static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) | |||
334 | return 0; | 445 | return 0; |
335 | } | 446 | } |
336 | 447 | ||
337 | static void nvhdmi_free(struct hda_codec *codec) | 448 | static struct hda_codec_ops nvhdmi_patch_ops_8ch_89 = { |
338 | { | 449 | .build_controls = nvhdmi_build_controls, |
339 | kfree(codec->spec); | 450 | .build_pcms = nvhdmi_build_pcms_8ch_89, |
340 | } | 451 | .init = nvhdmi_init, |
452 | .free = nvhdmi_free, | ||
453 | .unsol_event = hdmi_unsol_event, | ||
454 | }; | ||
341 | 455 | ||
342 | static struct hda_codec_ops nvhdmi_patch_ops_8ch = { | 456 | static struct hda_codec_ops nvhdmi_patch_ops_8ch_7x = { |
343 | .build_controls = nvhdmi_build_controls, | 457 | .build_controls = nvhdmi_build_controls, |
344 | .build_pcms = nvhdmi_build_pcms_8ch, | 458 | .build_pcms = nvhdmi_build_pcms_8ch_7x, |
345 | .init = nvhdmi_init, | 459 | .init = nvhdmi_init, |
346 | .free = nvhdmi_free, | 460 | .free = nvhdmi_free, |
347 | }; | 461 | }; |
@@ -353,9 +467,36 @@ static struct hda_codec_ops nvhdmi_patch_ops_2ch = { | |||
353 | .free = nvhdmi_free, | 467 | .free = nvhdmi_free, |
354 | }; | 468 | }; |
355 | 469 | ||
356 | static int patch_nvhdmi_8ch(struct hda_codec *codec) | 470 | static int patch_nvhdmi_8ch_89(struct hda_codec *codec) |
471 | { | ||
472 | struct hdmi_spec *spec; | ||
473 | int i; | ||
474 | |||
475 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
476 | if (spec == NULL) | ||
477 | return -ENOMEM; | ||
478 | |||
479 | codec->spec = spec; | ||
480 | spec->codec_type = HDA_CODEC_NVIDIA_MCP89; | ||
481 | |||
482 | if (hdmi_parse_codec(codec) < 0) { | ||
483 | codec->spec = NULL; | ||
484 | kfree(spec); | ||
485 | return -EINVAL; | ||
486 | } | ||
487 | codec->patch_ops = nvhdmi_patch_ops_8ch_89; | ||
488 | |||
489 | for (i = 0; i < spec->num_pins; i++) | ||
490 | snd_hda_eld_proc_new(codec, &spec->sink_eld[i], i); | ||
491 | |||
492 | init_channel_allocations(); | ||
493 | |||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) | ||
357 | { | 498 | { |
358 | struct nvhdmi_spec *spec; | 499 | struct hdmi_spec *spec; |
359 | 500 | ||
360 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 501 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
361 | if (spec == NULL) | 502 | if (spec == NULL) |
@@ -365,16 +506,17 @@ static int patch_nvhdmi_8ch(struct hda_codec *codec) | |||
365 | 506 | ||
366 | spec->multiout.num_dacs = 0; /* no analog */ | 507 | spec->multiout.num_dacs = 0; /* no analog */ |
367 | spec->multiout.max_channels = 8; | 508 | spec->multiout.max_channels = 8; |
368 | spec->multiout.dig_out_nid = Nv_Master_Convert_nid; | 509 | spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; |
510 | spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; | ||
369 | 511 | ||
370 | codec->patch_ops = nvhdmi_patch_ops_8ch; | 512 | codec->patch_ops = nvhdmi_patch_ops_8ch_7x; |
371 | 513 | ||
372 | return 0; | 514 | return 0; |
373 | } | 515 | } |
374 | 516 | ||
375 | static int patch_nvhdmi_2ch(struct hda_codec *codec) | 517 | static int patch_nvhdmi_2ch(struct hda_codec *codec) |
376 | { | 518 | { |
377 | struct nvhdmi_spec *spec; | 519 | struct hdmi_spec *spec; |
378 | 520 | ||
379 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 521 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
380 | if (spec == NULL) | 522 | if (spec == NULL) |
@@ -384,7 +526,8 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
384 | 526 | ||
385 | spec->multiout.num_dacs = 0; /* no analog */ | 527 | spec->multiout.num_dacs = 0; /* no analog */ |
386 | spec->multiout.max_channels = 2; | 528 | spec->multiout.max_channels = 2; |
387 | spec->multiout.dig_out_nid = Nv_Master_Convert_nid; | 529 | spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; |
530 | spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; | ||
388 | 531 | ||
389 | codec->patch_ops = nvhdmi_patch_ops_2ch; | 532 | codec->patch_ops = nvhdmi_patch_ops_2ch; |
390 | 533 | ||
@@ -395,13 +538,24 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
395 | * patch entries | 538 | * patch entries |
396 | */ | 539 | */ |
397 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | 540 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { |
398 | { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
399 | { .id = 0x10de0003, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
400 | { .id = 0x10de0005, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
401 | { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
402 | { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi_8ch }, | ||
403 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, | 541 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, |
404 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, | 542 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, |
543 | { .id = 0x10de0002, .name = "MCP77/78 HDMI", | ||
544 | .patch = patch_nvhdmi_8ch_7x }, | ||
545 | { .id = 0x10de0003, .name = "MCP77/78 HDMI", | ||
546 | .patch = patch_nvhdmi_8ch_7x }, | ||
547 | { .id = 0x10de0005, .name = "MCP77/78 HDMI", | ||
548 | .patch = patch_nvhdmi_8ch_7x }, | ||
549 | { .id = 0x10de0006, .name = "MCP77/78 HDMI", | ||
550 | .patch = patch_nvhdmi_8ch_7x }, | ||
551 | { .id = 0x10de0007, .name = "MCP79/7A HDMI", | ||
552 | .patch = patch_nvhdmi_8ch_7x }, | ||
553 | { .id = 0x10de000c, .name = "MCP89 HDMI", | ||
554 | .patch = patch_nvhdmi_8ch_89 }, | ||
555 | { .id = 0x10de000b, .name = "GT21x HDMI", | ||
556 | .patch = patch_nvhdmi_8ch_89 }, | ||
557 | { .id = 0x10de000d, .name = "GT240 HDMI", | ||
558 | .patch = patch_nvhdmi_8ch_89 }, | ||
405 | {} /* terminator */ | 559 | {} /* terminator */ |
406 | }; | 560 | }; |
407 | 561 | ||
@@ -412,9 +566,12 @@ MODULE_ALIAS("snd-hda-codec-id:10de0006"); | |||
412 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); | 566 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); |
413 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); | 567 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); |
414 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); | 568 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); |
569 | MODULE_ALIAS("snd-hda-codec-id:10de000c"); | ||
570 | MODULE_ALIAS("snd-hda-codec-id:10de000b"); | ||
571 | MODULE_ALIAS("snd-hda-codec-id:10de000d"); | ||
415 | 572 | ||
416 | MODULE_LICENSE("GPL"); | 573 | MODULE_LICENSE("GPL"); |
417 | MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec"); | 574 | MODULE_DESCRIPTION("NVIDIA HDMI HD-audio codec"); |
418 | 575 | ||
419 | static struct hda_codec_preset_list nvhdmi_list = { | 576 | static struct hda_codec_preset_list nvhdmi_list = { |
420 | .preset = snd_hda_preset_nvhdmi, | 577 | .preset = snd_hda_preset_nvhdmi, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e8cbe216e912..5d2fbb87b871 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4915,7 +4915,7 @@ static void fixup_automic_adc(struct hda_codec *codec) | |||
4915 | static void fixup_single_adc(struct hda_codec *codec) | 4915 | static void fixup_single_adc(struct hda_codec *codec) |
4916 | { | 4916 | { |
4917 | struct alc_spec *spec = codec->spec; | 4917 | struct alc_spec *spec = codec->spec; |
4918 | hda_nid_t pin; | 4918 | hda_nid_t pin = 0; |
4919 | int i; | 4919 | int i; |
4920 | 4920 | ||
4921 | /* search for the input pin; there must be only one */ | 4921 | /* search for the input pin; there must be only one */ |
@@ -13561,6 +13561,8 @@ static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |||
13561 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | 13561 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
13562 | { | 13562 | { |
13563 | struct alc_spec *spec = codec->spec; | 13563 | struct alc_spec *spec = codec->spec; |
13564 | spec->autocfg.hp_pins[0] = 0x15; | ||
13565 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13564 | spec->ext_mic.pin = 0x18; | 13566 | spec->ext_mic.pin = 0x18; |
13565 | spec->ext_mic.mux_idx = 0; | 13567 | spec->ext_mic.mux_idx = 0; |
13566 | spec->int_mic.pin = 0x19; | 13568 | spec->int_mic.pin = 0x19; |
@@ -13656,6 +13658,8 @@ static void alc269_laptop_unsol_event(struct hda_codec *codec, | |||
13656 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | 13658 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
13657 | { | 13659 | { |
13658 | struct alc_spec *spec = codec->spec; | 13660 | struct alc_spec *spec = codec->spec; |
13661 | spec->autocfg.hp_pins[0] = 0x15; | ||
13662 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13659 | spec->ext_mic.pin = 0x18; | 13663 | spec->ext_mic.pin = 0x18; |
13660 | spec->ext_mic.mux_idx = 0; | 13664 | spec->ext_mic.mux_idx = 0; |
13661 | spec->int_mic.pin = 0x12; | 13665 | spec->int_mic.pin = 0x12; |
@@ -13666,6 +13670,8 @@ static void alc269_laptop_dmic_setup(struct hda_codec *codec) | |||
13666 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | 13670 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
13667 | { | 13671 | { |
13668 | struct alc_spec *spec = codec->spec; | 13672 | struct alc_spec *spec = codec->spec; |
13673 | spec->autocfg.hp_pins[0] = 0x15; | ||
13674 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13669 | spec->ext_mic.pin = 0x18; | 13675 | spec->ext_mic.pin = 0x18; |
13670 | spec->ext_mic.mux_idx = 0; | 13676 | spec->ext_mic.mux_idx = 0; |
13671 | spec->int_mic.pin = 0x12; | 13677 | spec->int_mic.pin = 0x12; |
@@ -13676,6 +13682,8 @@ static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | |||
13676 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | 13682 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
13677 | { | 13683 | { |
13678 | struct alc_spec *spec = codec->spec; | 13684 | struct alc_spec *spec = codec->spec; |
13685 | spec->autocfg.hp_pins[0] = 0x15; | ||
13686 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13679 | spec->ext_mic.pin = 0x18; | 13687 | spec->ext_mic.pin = 0x18; |
13680 | spec->ext_mic.mux_idx = 0; | 13688 | spec->ext_mic.mux_idx = 0; |
13681 | spec->int_mic.pin = 0x19; | 13689 | spec->int_mic.pin = 0x19; |
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c index 7754db166d9e..dbc4b89d74e4 100644 --- a/sound/pci/oxygen/xonar_wm87x6.c +++ b/sound/pci/oxygen/xonar_wm87x6.c | |||
@@ -68,7 +68,7 @@ static void wm8776_write(struct oxygen *chip, | |||
68 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, | 68 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, |
69 | (reg << 9) | value); | 69 | (reg << 9) | value); |
70 | if (reg < ARRAY_SIZE(data->wm8776_regs)) { | 70 | if (reg < ARRAY_SIZE(data->wm8776_regs)) { |
71 | if (reg >= WM8776_HPLVOL || reg <= WM8776_DACMASTER) | 71 | if (reg >= WM8776_HPLVOL && reg <= WM8776_DACMASTER) |
72 | value &= ~WM8776_UPDATE; | 72 | value &= ~WM8776_UPDATE; |
73 | data->wm8776_regs[reg] = value; | 73 | data->wm8776_regs[reg] = value; |
74 | } | 74 | } |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 960a227eb653..ad4462677615 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1974,9 +1974,9 @@ snd_riptide_proc_read(struct snd_info_entry *entry, | |||
1974 | } | 1974 | } |
1975 | snd_iprintf(buffer, "Paths:\n"); | 1975 | snd_iprintf(buffer, "Paths:\n"); |
1976 | i = getpaths(cif, p); | 1976 | i = getpaths(cif, p); |
1977 | while (i--) { | 1977 | while (i >= 2) { |
1978 | snd_iprintf(buffer, "%x->%x ", p[i - 1], p[i]); | 1978 | i -= 2; |
1979 | i--; | 1979 | snd_iprintf(buffer, "%x->%x ", p[i], p[i + 1]); |
1980 | } | 1980 | } |
1981 | snd_iprintf(buffer, "\n"); | 1981 | snd_iprintf(buffer, "\n"); |
1982 | } | 1982 | } |
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index b9ef7e45891d..b68d99fb6af0 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c | |||
@@ -90,12 +90,10 @@ static int ak4104_spi_write(struct snd_soc_codec *codec, unsigned int reg, | |||
90 | if (reg >= codec->reg_cache_size) | 90 | if (reg >= codec->reg_cache_size) |
91 | return -EINVAL; | 91 | return -EINVAL; |
92 | 92 | ||
93 | reg &= AK4104_REG_MASK; | ||
94 | reg |= AK4104_WRITE; | ||
95 | |||
96 | /* only write to the hardware if value has changed */ | 93 | /* only write to the hardware if value has changed */ |
97 | if (cache[reg] != value) { | 94 | if (cache[reg] != value) { |
98 | u8 tmp[2] = { reg, value }; | 95 | u8 tmp[2] = { (reg & AK4104_REG_MASK) | AK4104_WRITE, value }; |
96 | |||
99 | if (spi_write(spi, tmp, sizeof(tmp))) { | 97 | if (spi_write(spi, tmp, sizeof(tmp))) { |
100 | dev_err(&spi->dev, "SPI write failed\n"); | 98 | dev_err(&spi->dev, "SPI write failed\n"); |
101 | return -EIO; | 99 | return -EIO; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a03bac943aaf..c8b0556ef431 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -427,24 +427,24 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
427 | if (!runtime->hw.rates) { | 427 | if (!runtime->hw.rates) { |
428 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", | 428 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", |
429 | codec_dai->name, cpu_dai->name); | 429 | codec_dai->name, cpu_dai->name); |
430 | goto machine_err; | 430 | goto config_err; |
431 | } | 431 | } |
432 | if (!runtime->hw.formats) { | 432 | if (!runtime->hw.formats) { |
433 | printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", | 433 | printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", |
434 | codec_dai->name, cpu_dai->name); | 434 | codec_dai->name, cpu_dai->name); |
435 | goto machine_err; | 435 | goto config_err; |
436 | } | 436 | } |
437 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { | 437 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { |
438 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", | 438 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", |
439 | codec_dai->name, cpu_dai->name); | 439 | codec_dai->name, cpu_dai->name); |
440 | goto machine_err; | 440 | goto config_err; |
441 | } | 441 | } |
442 | 442 | ||
443 | /* Symmetry only applies if we've already got an active stream. */ | 443 | /* Symmetry only applies if we've already got an active stream. */ |
444 | if (cpu_dai->active || codec_dai->active) { | 444 | if (cpu_dai->active || codec_dai->active) { |
445 | ret = soc_pcm_apply_symmetry(substream); | 445 | ret = soc_pcm_apply_symmetry(substream); |
446 | if (ret != 0) | 446 | if (ret != 0) |
447 | goto machine_err; | 447 | goto config_err; |
448 | } | 448 | } |
449 | 449 | ||
450 | pr_debug("asoc: %s <-> %s info:\n", codec_dai->name, cpu_dai->name); | 450 | pr_debug("asoc: %s <-> %s info:\n", codec_dai->name, cpu_dai->name); |
@@ -464,10 +464,14 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
464 | mutex_unlock(&pcm_mutex); | 464 | mutex_unlock(&pcm_mutex); |
465 | return 0; | 465 | return 0; |
466 | 466 | ||
467 | machine_err: | 467 | config_err: |
468 | if (machine->ops && machine->ops->shutdown) | 468 | if (machine->ops && machine->ops->shutdown) |
469 | machine->ops->shutdown(substream); | 469 | machine->ops->shutdown(substream); |
470 | 470 | ||
471 | machine_err: | ||
472 | if (codec_dai->ops->shutdown) | ||
473 | codec_dai->ops->shutdown(substream, codec_dai); | ||
474 | |||
471 | codec_dai_err: | 475 | codec_dai_err: |
472 | if (platform->pcm_ops->close) | 476 | if (platform->pcm_ops->close) |
473 | platform->pcm_ops->close(substream); | 477 | platform->pcm_ops->close(substream); |
diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index 8c2925814ce4..c570ae3e6d55 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig | |||
@@ -22,13 +22,13 @@ config SND_USB_AUDIO | |||
22 | will be called snd-usb-audio. | 22 | will be called snd-usb-audio. |
23 | 23 | ||
24 | config SND_USB_UA101 | 24 | config SND_USB_UA101 |
25 | tristate "Edirol UA-101 driver (EXPERIMENTAL)" | 25 | tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)" |
26 | depends on EXPERIMENTAL | 26 | depends on EXPERIMENTAL |
27 | select SND_PCM | 27 | select SND_PCM |
28 | select SND_RAWMIDI | 28 | select SND_RAWMIDI |
29 | help | 29 | help |
30 | Say Y here to include support for the Edirol UA-101 audio/MIDI | 30 | Say Y here to include support for the Edirol UA-101 and UA-1000 |
31 | interface. | 31 | audio/MIDI interfaces. |
32 | 32 | ||
33 | To compile this driver as a module, choose M here: the module | 33 | To compile this driver as a module, choose M here: the module |
34 | will be called snd-ua101. | 34 | will be called snd-ua101. |
diff --git a/sound/usb/caiaq/midi.h b/sound/usb/caiaq/midi.h index 9d16db027fc3..380f984babc9 100644 --- a/sound/usb/caiaq/midi.h +++ b/sound/usb/caiaq/midi.h | |||
@@ -3,6 +3,6 @@ | |||
3 | 3 | ||
4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); | 4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); |
5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); | 5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); |
6 | void snd_usb_caiaq_midi_output_done(struct urb* urb); | 6 | void snd_usb_caiaq_midi_output_done(struct urb *urb); |
7 | 7 | ||
8 | #endif /* CAIAQ_MIDI_H */ | 8 | #endif /* CAIAQ_MIDI_H */ |
diff --git a/sound/usb/ua101.c b/sound/usb/ua101.c index 4f4ccdf70dd0..3d458d3b9962 100644 --- a/sound/usb/ua101.c +++ b/sound/usb/ua101.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Edirol UA-101 driver | 2 | * Edirol UA-101/UA-1000 driver |
3 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> | 3 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> |
4 | * | 4 | * |
5 | * This driver is free software: you can redistribute it and/or modify | 5 | * This driver is free software: you can redistribute it and/or modify |
@@ -25,13 +25,10 @@ | |||
25 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
26 | #include "usbaudio.h" | 26 | #include "usbaudio.h" |
27 | 27 | ||
28 | MODULE_DESCRIPTION("Edirol UA-101 driver"); | 28 | MODULE_DESCRIPTION("Edirol UA-101/1000 driver"); |
29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
30 | MODULE_LICENSE("GPL v2"); | 30 | MODULE_LICENSE("GPL v2"); |
31 | MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); | 31 | MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); |
32 | |||
33 | /* I use my UA-1A for testing because I don't have a UA-101 ... */ | ||
34 | #define UA1A_HACK | ||
35 | 32 | ||
36 | /* | 33 | /* |
37 | * Should not be lower than the minimum scheduling delay of the host | 34 | * Should not be lower than the minimum scheduling delay of the host |
@@ -132,9 +129,6 @@ struct ua101 { | |||
132 | dma_addr_t dma; | 129 | dma_addr_t dma; |
133 | } buffers[MAX_MEMORY_BUFFERS]; | 130 | } buffers[MAX_MEMORY_BUFFERS]; |
134 | } capture, playback; | 131 | } capture, playback; |
135 | |||
136 | unsigned int fps[10]; | ||
137 | unsigned int frame_counter; | ||
138 | }; | 132 | }; |
139 | 133 | ||
140 | static DEFINE_MUTEX(devices_mutex); | 134 | static DEFINE_MUTEX(devices_mutex); |
@@ -424,16 +418,6 @@ static void capture_urb_complete(struct urb *urb) | |||
424 | if (do_period_elapsed) | 418 | if (do_period_elapsed) |
425 | snd_pcm_period_elapsed(stream->substream); | 419 | snd_pcm_period_elapsed(stream->substream); |
426 | 420 | ||
427 | /* for debugging: measure the sample rate relative to the USB clock */ | ||
428 | ua->fps[ua->frame_counter++ / ua->packets_per_second] += frames; | ||
429 | if (ua->frame_counter >= ARRAY_SIZE(ua->fps) * ua->packets_per_second) { | ||
430 | printk(KERN_DEBUG "capture rate:"); | ||
431 | for (frames = 0; frames < ARRAY_SIZE(ua->fps); ++frames) | ||
432 | printk(KERN_CONT " %u", ua->fps[frames]); | ||
433 | printk(KERN_CONT "\n"); | ||
434 | memset(ua->fps, 0, sizeof(ua->fps)); | ||
435 | ua->frame_counter = 0; | ||
436 | } | ||
437 | return; | 421 | return; |
438 | 422 | ||
439 | stream_stopped: | 423 | stream_stopped: |
@@ -1200,13 +1184,30 @@ static int ua101_probe(struct usb_interface *interface, | |||
1200 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 1184 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
1201 | .data = &midi_ep | 1185 | .data = &midi_ep |
1202 | }; | 1186 | }; |
1187 | static const int intf_numbers[2][3] = { | ||
1188 | { /* UA-101 */ | ||
1189 | [INTF_PLAYBACK] = 0, | ||
1190 | [INTF_CAPTURE] = 1, | ||
1191 | [INTF_MIDI] = 2, | ||
1192 | }, | ||
1193 | { /* UA-1000 */ | ||
1194 | [INTF_CAPTURE] = 1, | ||
1195 | [INTF_PLAYBACK] = 2, | ||
1196 | [INTF_MIDI] = 3, | ||
1197 | }, | ||
1198 | }; | ||
1203 | struct snd_card *card; | 1199 | struct snd_card *card; |
1204 | struct ua101 *ua; | 1200 | struct ua101 *ua; |
1205 | unsigned int card_index, i; | 1201 | unsigned int card_index, i; |
1202 | int is_ua1000; | ||
1203 | const char *name; | ||
1206 | char usb_path[32]; | 1204 | char usb_path[32]; |
1207 | int err; | 1205 | int err; |
1208 | 1206 | ||
1209 | if (interface->altsetting->desc.bInterfaceNumber != 0) | 1207 | is_ua1000 = usb_id->idProduct == 0x0044; |
1208 | |||
1209 | if (interface->altsetting->desc.bInterfaceNumber != | ||
1210 | intf_numbers[is_ua1000][0]) | ||
1210 | return -ENODEV; | 1211 | return -ENODEV; |
1211 | 1212 | ||
1212 | mutex_lock(&devices_mutex); | 1213 | mutex_lock(&devices_mutex); |
@@ -1239,20 +1240,13 @@ static int ua101_probe(struct usb_interface *interface, | |||
1239 | init_waitqueue_head(&ua->rate_feedback_wait); | 1240 | init_waitqueue_head(&ua->rate_feedback_wait); |
1240 | init_waitqueue_head(&ua->alsa_playback_wait); | 1241 | init_waitqueue_head(&ua->alsa_playback_wait); |
1241 | 1242 | ||
1242 | #ifdef UA1A_HACK | ||
1243 | if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { | ||
1244 | ua->intf[2] = interface; | ||
1245 | ua->intf[0] = usb_ifnum_to_if(ua->dev, 1); | ||
1246 | ua->intf[1] = usb_ifnum_to_if(ua->dev, 2); | ||
1247 | usb_driver_claim_interface(&ua101_driver, ua->intf[0], ua); | ||
1248 | usb_driver_claim_interface(&ua101_driver, ua->intf[1], ua); | ||
1249 | } else { | ||
1250 | #endif | ||
1251 | ua->intf[0] = interface; | 1243 | ua->intf[0] = interface; |
1252 | for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { | 1244 | for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { |
1253 | ua->intf[i] = usb_ifnum_to_if(ua->dev, i); | 1245 | ua->intf[i] = usb_ifnum_to_if(ua->dev, |
1246 | intf_numbers[is_ua1000][i]); | ||
1254 | if (!ua->intf[i]) { | 1247 | if (!ua->intf[i]) { |
1255 | dev_err(&ua->dev->dev, "interface %u not found\n", i); | 1248 | dev_err(&ua->dev->dev, "interface %u not found\n", |
1249 | intf_numbers[is_ua1000][i]); | ||
1256 | err = -ENXIO; | 1250 | err = -ENXIO; |
1257 | goto probe_error; | 1251 | goto probe_error; |
1258 | } | 1252 | } |
@@ -1264,39 +1258,19 @@ static int ua101_probe(struct usb_interface *interface, | |||
1264 | goto probe_error; | 1258 | goto probe_error; |
1265 | } | 1259 | } |
1266 | } | 1260 | } |
1267 | #ifdef UA1A_HACK | ||
1268 | } | ||
1269 | #endif | ||
1270 | 1261 | ||
1271 | snd_card_set_dev(card, &interface->dev); | 1262 | snd_card_set_dev(card, &interface->dev); |
1272 | 1263 | ||
1273 | #ifdef UA1A_HACK | ||
1274 | if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { | ||
1275 | ua->format_bit = SNDRV_PCM_FMTBIT_S16_LE; | ||
1276 | ua->rate = 44100; | ||
1277 | ua->packets_per_second = 1000; | ||
1278 | ua->capture.channels = 2; | ||
1279 | ua->playback.channels = 2; | ||
1280 | ua->capture.frame_bytes = 4; | ||
1281 | ua->playback.frame_bytes = 4; | ||
1282 | ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, 2); | ||
1283 | ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, 1); | ||
1284 | ua->capture.max_packet_bytes = 192; | ||
1285 | ua->playback.max_packet_bytes = 192; | ||
1286 | } else { | ||
1287 | #endif | ||
1288 | err = detect_usb_format(ua); | 1264 | err = detect_usb_format(ua); |
1289 | if (err < 0) | 1265 | if (err < 0) |
1290 | goto probe_error; | 1266 | goto probe_error; |
1291 | #ifdef UA1A_HACK | ||
1292 | } | ||
1293 | #endif | ||
1294 | 1267 | ||
1268 | name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101"; | ||
1295 | strcpy(card->driver, "UA-101"); | 1269 | strcpy(card->driver, "UA-101"); |
1296 | strcpy(card->shortname, "UA-101"); | 1270 | strcpy(card->shortname, name); |
1297 | usb_make_path(ua->dev, usb_path, sizeof(usb_path)); | 1271 | usb_make_path(ua->dev, usb_path, sizeof(usb_path)); |
1298 | snprintf(ua->card->longname, sizeof(ua->card->longname), | 1272 | snprintf(ua->card->longname, sizeof(ua->card->longname), |
1299 | "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", | 1273 | "EDIROL %s (serial %s), %u Hz at %s, %s speed", name, |
1300 | ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, | 1274 | ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, |
1301 | ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); | 1275 | ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); |
1302 | 1276 | ||
@@ -1314,24 +1288,18 @@ static int ua101_probe(struct usb_interface *interface, | |||
1314 | if (err < 0) | 1288 | if (err < 0) |
1315 | goto probe_error; | 1289 | goto probe_error; |
1316 | 1290 | ||
1317 | err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); | 1291 | err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm); |
1318 | if (err < 0) | 1292 | if (err < 0) |
1319 | goto probe_error; | 1293 | goto probe_error; |
1320 | ua->pcm->private_data = ua; | 1294 | ua->pcm->private_data = ua; |
1321 | strcpy(ua->pcm->name, "UA-101"); | 1295 | strcpy(ua->pcm->name, name); |
1322 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); | 1296 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); |
1323 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); | 1297 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); |
1324 | 1298 | ||
1325 | #ifdef UA1A_HACK | ||
1326 | if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) { | ||
1327 | #endif | ||
1328 | err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], | 1299 | err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], |
1329 | &ua->midi_list, &midi_quirk); | 1300 | &ua->midi_list, &midi_quirk); |
1330 | if (err < 0) | 1301 | if (err < 0) |
1331 | goto probe_error; | 1302 | goto probe_error; |
1332 | #ifdef UA1A_HACK | ||
1333 | } | ||
1334 | #endif | ||
1335 | 1303 | ||
1336 | err = snd_card_register(card); | 1304 | err = snd_card_register(card); |
1337 | if (err < 0) | 1305 | if (err < 0) |
@@ -1386,11 +1354,9 @@ static void ua101_disconnect(struct usb_interface *interface) | |||
1386 | } | 1354 | } |
1387 | 1355 | ||
1388 | static struct usb_device_id ua101_ids[] = { | 1356 | static struct usb_device_id ua101_ids[] = { |
1389 | #ifdef UA1A_HACK | 1357 | { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */ |
1390 | { USB_DEVICE(0x0582, 0x0018) }, | 1358 | { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */ |
1391 | #endif | 1359 | { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */ |
1392 | { USB_DEVICE(0x0582, 0x007d) }, | ||
1393 | { USB_DEVICE(0x0582, 0x008d) }, | ||
1394 | { } | 1360 | { } |
1395 | }; | 1361 | }; |
1396 | MODULE_DEVICE_TABLE(usb, ua101_ids); | 1362 | MODULE_DEVICE_TABLE(usb, ua101_ids); |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c539f7fe292f..11b0826b8fe6 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2483,7 +2483,6 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
2483 | sample_width, sample_bytes); | 2483 | sample_width, sample_bytes); |
2484 | } | 2484 | } |
2485 | /* check the format byte size */ | 2485 | /* check the format byte size */ |
2486 | printk(" XXXXX SAMPLE BYTES %d\n", sample_bytes); | ||
2487 | switch (sample_bytes) { | 2486 | switch (sample_bytes) { |
2488 | case 1: | 2487 | case 1: |
2489 | pcm_format = SNDRV_PCM_FORMAT_S8; | 2488 | pcm_format = SNDRV_PCM_FORMAT_S8; |
@@ -2581,6 +2580,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
2581 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | 2580 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && |
2582 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2581 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2583 | rate = 96000; | 2582 | rate = 96000; |
2583 | /* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */ | ||
2584 | if (rate == 16000 && chip->usb_id == USB_ID(0x041e, 0x4068)) | ||
2585 | rate = 8000; | ||
2584 | fp->rate_table[fp->nr_rates] = rate; | 2586 | fp->rate_table[fp->nr_rates] = rate; |
2585 | if (!fp->rate_min || rate < fp->rate_min) | 2587 | if (!fp->rate_min || rate < fp->rate_min) |
2586 | fp->rate_min = rate; | 2588 | fp->rate_min = rate; |
@@ -3386,58 +3388,6 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
3386 | return 0; | 3388 | return 0; |
3387 | } | 3389 | } |
3388 | 3390 | ||
3389 | /* | ||
3390 | * Create a stream for an Edirol UA-1000 interface. | ||
3391 | */ | ||
3392 | static int create_ua1000_quirk(struct snd_usb_audio *chip, | ||
3393 | struct usb_interface *iface, | ||
3394 | const struct snd_usb_audio_quirk *quirk) | ||
3395 | { | ||
3396 | static const struct audioformat ua1000_format = { | ||
3397 | .format = SNDRV_PCM_FORMAT_S32_LE, | ||
3398 | .fmt_type = UAC_FORMAT_TYPE_I, | ||
3399 | .altsetting = 1, | ||
3400 | .altset_idx = 1, | ||
3401 | .attributes = 0, | ||
3402 | .rates = SNDRV_PCM_RATE_CONTINUOUS, | ||
3403 | }; | ||
3404 | struct usb_host_interface *alts; | ||
3405 | struct usb_interface_descriptor *altsd; | ||
3406 | struct audioformat *fp; | ||
3407 | int stream, err; | ||
3408 | |||
3409 | if (iface->num_altsetting != 2) | ||
3410 | return -ENXIO; | ||
3411 | alts = &iface->altsetting[1]; | ||
3412 | altsd = get_iface_desc(alts); | ||
3413 | if (alts->extralen != 11 || alts->extra[1] != USB_DT_CS_INTERFACE || | ||
3414 | altsd->bNumEndpoints != 1) | ||
3415 | return -ENXIO; | ||
3416 | |||
3417 | fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL); | ||
3418 | if (!fp) | ||
3419 | return -ENOMEM; | ||
3420 | |||
3421 | fp->channels = alts->extra[4]; | ||
3422 | fp->iface = altsd->bInterfaceNumber; | ||
3423 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; | ||
3424 | fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; | ||
3425 | fp->datainterval = parse_datainterval(chip, alts); | ||
3426 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); | ||
3427 | fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]); | ||
3428 | |||
3429 | stream = (fp->endpoint & USB_DIR_IN) | ||
3430 | ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; | ||
3431 | err = add_audio_endpoint(chip, stream, fp); | ||
3432 | if (err < 0) { | ||
3433 | kfree(fp); | ||
3434 | return err; | ||
3435 | } | ||
3436 | /* FIXME: playback must be synchronized to capture */ | ||
3437 | usb_set_interface(chip->dev, fp->iface, 0); | ||
3438 | return 0; | ||
3439 | } | ||
3440 | |||
3441 | static int snd_usb_create_quirk(struct snd_usb_audio *chip, | 3391 | static int snd_usb_create_quirk(struct snd_usb_audio *chip, |
3442 | struct usb_interface *iface, | 3392 | struct usb_interface *iface, |
3443 | const struct snd_usb_audio_quirk *quirk); | 3393 | const struct snd_usb_audio_quirk *quirk); |
@@ -3686,7 +3636,6 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
3686 | [QUIRK_MIDI_CME] = create_any_midi_quirk, | 3636 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
3687 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, | 3637 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3688 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3638 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3689 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, | ||
3690 | [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, | 3639 | [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, |
3691 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk | 3640 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk |
3692 | }; | 3641 | }; |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 6b016d4aac6b..42c299cbf63a 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -75,7 +75,6 @@ enum quirk_type { | |||
75 | QUIRK_MIDI_US122L, | 75 | QUIRK_MIDI_US122L, |
76 | QUIRK_AUDIO_STANDARD_INTERFACE, | 76 | QUIRK_AUDIO_STANDARD_INTERFACE, |
77 | QUIRK_AUDIO_FIXED_ENDPOINT, | 77 | QUIRK_AUDIO_FIXED_ENDPOINT, |
78 | QUIRK_AUDIO_EDIROL_UA1000, | ||
79 | QUIRK_AUDIO_EDIROL_UAXX, | 78 | QUIRK_AUDIO_EDIROL_UAXX, |
80 | QUIRK_AUDIO_ALIGN_TRANSFER, | 79 | QUIRK_AUDIO_ALIGN_TRANSFER, |
81 | 80 | ||
@@ -112,7 +111,7 @@ struct snd_usb_midi_endpoint_info { | |||
112 | 111 | ||
113 | /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ | 112 | /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ |
114 | 113 | ||
115 | /* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */ | 114 | /* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */ |
116 | 115 | ||
117 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ | 116 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ |
118 | 117 | ||
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index f06faf7917b9..2b426c1fd0e8 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -1016,36 +1016,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1016 | } | 1016 | } |
1017 | }, | 1017 | }, |
1018 | { | 1018 | { |
1019 | USB_DEVICE(0x0582, 0x0044), | ||
1020 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1021 | .vendor_name = "Roland", | ||
1022 | .product_name = "UA-1000", | ||
1023 | .ifnum = QUIRK_ANY_INTERFACE, | ||
1024 | .type = QUIRK_COMPOSITE, | ||
1025 | .data = (const struct snd_usb_audio_quirk[]) { | ||
1026 | { | ||
1027 | .ifnum = 1, | ||
1028 | .type = QUIRK_AUDIO_EDIROL_UA1000 | ||
1029 | }, | ||
1030 | { | ||
1031 | .ifnum = 2, | ||
1032 | .type = QUIRK_AUDIO_EDIROL_UA1000 | ||
1033 | }, | ||
1034 | { | ||
1035 | .ifnum = 3, | ||
1036 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1037 | .data = & (const struct snd_usb_midi_endpoint_info) { | ||
1038 | .out_cables = 0x0003, | ||
1039 | .in_cables = 0x0003 | ||
1040 | } | ||
1041 | }, | ||
1042 | { | ||
1043 | .ifnum = -1 | ||
1044 | } | ||
1045 | } | ||
1046 | } | ||
1047 | }, | ||
1048 | { | ||
1049 | /* has ID 0x0049 when not in "Advanced Driver" mode */ | 1019 | /* has ID 0x0049 when not in "Advanced Driver" mode */ |
1050 | USB_DEVICE(0x0582, 0x0047), | 1020 | USB_DEVICE(0x0582, 0x0047), |
1051 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 1021 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |