diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-08 18:07:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-08 18:07:14 -0400 |
commit | f5a246eab9a268f51ba8189ea5b098a1bfff200e (patch) | |
tree | a6ff7169e0bcaca498d9aec8b0624de1b74eaecb /sound/pci | |
parent | d5bbd43d5f450c3fca058f5b85f3dfb4e8cc88c9 (diff) | |
parent | 7ff34ad80b7080fafaac8efa9ef0061708eddd51 (diff) |
Merge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai:
"This contains pretty many small commits covering fairly large range of
files in sound/ directory. Partly because of additional API support
and partly because of constantly developed ASoC and ARM stuff.
Some highlights:
- Introduced the helper function and documentation for exposing the
channel map via control API, as discussed in Plumbers; most of PCI
drivers are covered, will follow more drivers later
- Most of drivers have been replaced with the new PM callbacks (if
the bus is supported)
- HD-audio controller got the support of runtime PM and the support
of D3 clock-stop. Also changing the power_save option in sysfs
kicks off immediately to enable / disable the power-save mode.
- Another significant code change in HD-audio is the rewrite of
firmware loading code. Other than that, most of changes in
HD-audio are continued cleanups and standardization for the generic
auto parser and bug fixes (HBR, device-specific fixups), in
addition to the support of channel-map API.
- Addition of ASoC bindings for the compressed API, used by the
mid-x86 drivers.
- Lots of cleanups and API refreshes for ASoC codec drivers and
DaVinci.
- Conversion of OMAP to dmaengine.
- New machine driver for Wolfson Microelectronics Bells.
- New CODEC driver for Wolfson Microelectronics WM0010.
- Enhancements to the ux500 and wm2000 drivers
- A new driver for DA9055 and the support for regulator bypass mode."
Fix up various arm soc header file reorg conflicts.
* tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (339 commits)
ALSA: hda - Add new codec ALC283 ALC290 support
ALSA: hda - avoid unneccesary indices on "Headphone Jack" controls
ALSA: hda - fix indices on boost volume on Conexant
ALSA: aloop - add locking to timer access
ALSA: hda - Fix hang caused by race during suspend.
sound: Remove unnecessary semicolon
ALSA: hda/realtek - Fix detection of ALC271X codec
ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310
ALSA: hda - make Realtek/Sigmatel/Conexant use the generic unsol event
ALSA: hda - make a generic unsol event handler
ASoC: codecs: Add DA9055 codec driver
ASoC: eukrea-tlv320: Convert it to platform driver
ALSA: ASoC: add DT bindings for CS4271
ASoC: wm_hubs: Ensure volume updates are handled during class W startup
ASoC: wm5110: Adding missing volume update bits
ASoC: wm5110: Add OUT3R support
ASoC: wm5110: Add AEC loopback support
ASoC: wm5110: Rename EPOUT to HPOUT3
ASoC: arizona: Add more clock rates
ASoC: arizona: Add more DSP options for mixer input muxes
...
Diffstat (limited to 'sound/pci')
93 files changed, 1813 insertions, 715 deletions
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index a872d0a82976..66a3bc95fb84 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -2595,6 +2595,21 @@ static void alc650_update_jacks(struct snd_ac97 *ac97) | |||
2595 | shared ? 0 : 0x100); | 2595 | shared ? 0 : 0x100); |
2596 | } | 2596 | } |
2597 | 2597 | ||
2598 | static int alc650_swap_surround_put(struct snd_kcontrol *kcontrol, | ||
2599 | struct snd_ctl_elem_value *ucontrol) | ||
2600 | { | ||
2601 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); | ||
2602 | struct snd_pcm_chmap *map = ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK]; | ||
2603 | |||
2604 | if (map) { | ||
2605 | if (ucontrol->value.integer.value[0]) | ||
2606 | map->chmap = snd_pcm_std_chmaps; | ||
2607 | else | ||
2608 | map->chmap = snd_pcm_alt_chmaps; | ||
2609 | } | ||
2610 | return snd_ac97_put_volsw(kcontrol, ucontrol); | ||
2611 | } | ||
2612 | |||
2598 | static const struct snd_kcontrol_new snd_ac97_controls_alc650[] = { | 2613 | static const struct snd_kcontrol_new snd_ac97_controls_alc650[] = { |
2599 | AC97_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0), | 2614 | AC97_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0), |
2600 | AC97_SINGLE("Surround Down Mix", AC97_ALC650_MULTICH, 1, 1, 0), | 2615 | AC97_SINGLE("Surround Down Mix", AC97_ALC650_MULTICH, 1, 1, 0), |
@@ -2608,7 +2623,14 @@ static const struct snd_kcontrol_new snd_ac97_controls_alc650[] = { | |||
2608 | /* 9: Line-In/Surround share */ | 2623 | /* 9: Line-In/Surround share */ |
2609 | /* 10: Mic/CLFE share */ | 2624 | /* 10: Mic/CLFE share */ |
2610 | /* 11-13: in IEC958 controls */ | 2625 | /* 11-13: in IEC958 controls */ |
2611 | AC97_SINGLE("Swap Surround Slot", AC97_ALC650_MULTICH, 14, 1, 0), | 2626 | { |
2627 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2628 | .name = "Swap Surround Slot", | ||
2629 | .info = snd_ac97_info_volsw, | ||
2630 | .get = snd_ac97_get_volsw, | ||
2631 | .put = alc650_swap_surround_put, | ||
2632 | .private_value = AC97_SINGLE_VALUE(AC97_ALC650_MULTICH, 14, 1, 0), | ||
2633 | }, | ||
2612 | #if 0 /* always set in patch_alc650 */ | 2634 | #if 0 /* always set in patch_alc650 */ |
2613 | AC97_SINGLE("IEC958 Input Clock Enable", AC97_ALC650_CLOCK, 0, 1, 0), | 2635 | AC97_SINGLE("IEC958 Input Clock Enable", AC97_ALC650_CLOCK, 0, 1, 0), |
2614 | AC97_SINGLE("IEC958 Input Pin Enable", AC97_ALC650_CLOCK, 1, 1, 0), | 2636 | AC97_SINGLE("IEC958 Input Pin Enable", AC97_ALC650_CLOCK, 1, 1, 0), |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index ee895f3c8605..c7e3c533316e 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -270,7 +270,7 @@ struct snd_ali { | |||
270 | spinlock_t reg_lock; | 270 | spinlock_t reg_lock; |
271 | spinlock_t voice_alloc; | 271 | spinlock_t voice_alloc; |
272 | 272 | ||
273 | #ifdef CONFIG_PM | 273 | #ifdef CONFIG_PM_SLEEP |
274 | struct snd_ali_image *image; | 274 | struct snd_ali_image *image; |
275 | #endif | 275 | #endif |
276 | }; | 276 | }; |
@@ -1883,7 +1883,7 @@ static int __devinit snd_ali_mixer(struct snd_ali * codec) | |||
1883 | return 0; | 1883 | return 0; |
1884 | } | 1884 | } |
1885 | 1885 | ||
1886 | #ifdef CONFIG_PM | 1886 | #ifdef CONFIG_PM_SLEEP |
1887 | static int ali_suspend(struct device *dev) | 1887 | static int ali_suspend(struct device *dev) |
1888 | { | 1888 | { |
1889 | struct pci_dev *pci = to_pci_dev(dev); | 1889 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -1989,7 +1989,7 @@ static SIMPLE_DEV_PM_OPS(ali_pm, ali_suspend, ali_resume); | |||
1989 | #define ALI_PM_OPS &ali_pm | 1989 | #define ALI_PM_OPS &ali_pm |
1990 | #else | 1990 | #else |
1991 | #define ALI_PM_OPS NULL | 1991 | #define ALI_PM_OPS NULL |
1992 | #endif /* CONFIG_PM */ | 1992 | #endif /* CONFIG_PM_SLEEP */ |
1993 | 1993 | ||
1994 | static int snd_ali_free(struct snd_ali * codec) | 1994 | static int snd_ali_free(struct snd_ali * codec) |
1995 | { | 1995 | { |
@@ -2000,7 +2000,7 @@ static int snd_ali_free(struct snd_ali * codec) | |||
2000 | if (codec->port) | 2000 | if (codec->port) |
2001 | pci_release_regions(codec->pci); | 2001 | pci_release_regions(codec->pci); |
2002 | pci_disable_device(codec->pci); | 2002 | pci_disable_device(codec->pci); |
2003 | #ifdef CONFIG_PM | 2003 | #ifdef CONFIG_PM_SLEEP |
2004 | kfree(codec->image); | 2004 | kfree(codec->image); |
2005 | #endif | 2005 | #endif |
2006 | pci_dev_put(codec->pci_m1533); | 2006 | pci_dev_put(codec->pci_m1533); |
@@ -2232,7 +2232,7 @@ static int __devinit snd_ali_create(struct snd_card *card, | |||
2232 | return err; | 2232 | return err; |
2233 | } | 2233 | } |
2234 | 2234 | ||
2235 | #ifdef CONFIG_PM | 2235 | #ifdef CONFIG_PM_SLEEP |
2236 | codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); | 2236 | codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); |
2237 | if (!codec->image) | 2237 | if (!codec->image) |
2238 | snd_printk(KERN_WARNING "can't allocate apm buffer\n"); | 2238 | snd_printk(KERN_WARNING "can't allocate apm buffer\n"); |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 68c4469c6d19..00f157a2cf64 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -765,7 +765,7 @@ static int __devinit snd_als300_create(struct snd_card *card, | |||
765 | return 0; | 765 | return 0; |
766 | } | 766 | } |
767 | 767 | ||
768 | #ifdef CONFIG_PM | 768 | #ifdef CONFIG_PM_SLEEP |
769 | static int snd_als300_suspend(struct device *dev) | 769 | static int snd_als300_suspend(struct device *dev) |
770 | { | 770 | { |
771 | struct pci_dev *pci = to_pci_dev(dev); | 771 | struct pci_dev *pci = to_pci_dev(dev); |
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 0eeca49c5754..feb2a1436830 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -987,7 +987,7 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci) | |||
987 | pci_set_drvdata(pci, NULL); | 987 | pci_set_drvdata(pci, NULL); |
988 | } | 988 | } |
989 | 989 | ||
990 | #ifdef CONFIG_PM | 990 | #ifdef CONFIG_PM_SLEEP |
991 | static int snd_als4000_suspend(struct device *dev) | 991 | static int snd_als4000_suspend(struct device *dev) |
992 | { | 992 | { |
993 | struct pci_dev *pci = to_pci_dev(dev); | 993 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -1040,7 +1040,7 @@ static SIMPLE_DEV_PM_OPS(snd_als4000_pm, snd_als4000_suspend, snd_als4000_resume | |||
1040 | #define SND_ALS4000_PM_OPS &snd_als4000_pm | 1040 | #define SND_ALS4000_PM_OPS &snd_als4000_pm |
1041 | #else | 1041 | #else |
1042 | #define SND_ALS4000_PM_OPS NULL | 1042 | #define SND_ALS4000_PM_OPS NULL |
1043 | #endif /* CONFIG_PM */ | 1043 | #endif /* CONFIG_PM_SLEEP */ |
1044 | 1044 | ||
1045 | static struct pci_driver als4000_driver = { | 1045 | static struct pci_driver als4000_driver = { |
1046 | .name = KBUILD_MODNAME, | 1046 | .name = KBUILD_MODNAME, |
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index e8de831f98bc..eedc017c1cd8 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -2658,7 +2658,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | |||
2658 | hpi_ctl.dst_node_type, | 2658 | hpi_ctl.dst_node_type, |
2659 | hpi_ctl.dst_node_index); | 2659 | hpi_ctl.dst_node_index); |
2660 | continue; | 2660 | continue; |
2661 | }; | 2661 | } |
2662 | if (err < 0) | 2662 | if (err < 0) |
2663 | return err; | 2663 | return err; |
2664 | } | 2664 | } |
@@ -2968,7 +2968,7 @@ static struct pci_driver driver = { | |||
2968 | .id_table = asihpi_pci_tbl, | 2968 | .id_table = asihpi_pci_tbl, |
2969 | .probe = snd_asihpi_probe, | 2969 | .probe = snd_asihpi_probe, |
2970 | .remove = __devexit_p(snd_asihpi_remove), | 2970 | .remove = __devexit_p(snd_asihpi_remove), |
2971 | #ifdef CONFIG_PM | 2971 | #ifdef CONFIG_PM_SLEEP |
2972 | /* .suspend = snd_asihpi_suspend, | 2972 | /* .suspend = snd_asihpi_suspend, |
2973 | .resume = snd_asihpi_resume, */ | 2973 | .resume = snd_asihpi_resume, */ |
2974 | #endif | 2974 | #endif |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 31020d2a868b..368df8b0853e 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -535,7 +535,7 @@ static int snd_atiixp_aclink_reset(struct atiixp *chip) | |||
535 | return 0; | 535 | return 0; |
536 | } | 536 | } |
537 | 537 | ||
538 | #ifdef CONFIG_PM | 538 | #ifdef CONFIG_PM_SLEEP |
539 | static int snd_atiixp_aclink_down(struct atiixp *chip) | 539 | static int snd_atiixp_aclink_down(struct atiixp *chip) |
540 | { | 540 | { |
541 | // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ | 541 | // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ |
@@ -1250,6 +1250,7 @@ static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = { | |||
1250 | static int __devinit snd_atiixp_pcm_new(struct atiixp *chip) | 1250 | static int __devinit snd_atiixp_pcm_new(struct atiixp *chip) |
1251 | { | 1251 | { |
1252 | struct snd_pcm *pcm; | 1252 | struct snd_pcm *pcm; |
1253 | struct snd_pcm_chmap *chmap; | ||
1253 | struct snd_ac97_bus *pbus = chip->ac97_bus; | 1254 | struct snd_ac97_bus *pbus = chip->ac97_bus; |
1254 | int err, i, num_pcms; | 1255 | int err, i, num_pcms; |
1255 | 1256 | ||
@@ -1293,6 +1294,14 @@ static int __devinit snd_atiixp_pcm_new(struct atiixp *chip) | |||
1293 | snd_dma_pci_data(chip->pci), | 1294 | snd_dma_pci_data(chip->pci), |
1294 | 64*1024, 128*1024); | 1295 | 64*1024, 128*1024); |
1295 | 1296 | ||
1297 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1298 | snd_pcm_alt_chmaps, chip->max_channels, 0, | ||
1299 | &chmap); | ||
1300 | if (err < 0) | ||
1301 | return err; | ||
1302 | chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; | ||
1303 | chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; | ||
1304 | |||
1296 | /* no SPDIF support on codec? */ | 1305 | /* no SPDIF support on codec? */ |
1297 | if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates) | 1306 | if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates) |
1298 | return 0; | 1307 | return 0; |
@@ -1458,7 +1467,7 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock, | |||
1458 | } | 1467 | } |
1459 | 1468 | ||
1460 | 1469 | ||
1461 | #ifdef CONFIG_PM | 1470 | #ifdef CONFIG_PM_SLEEP |
1462 | /* | 1471 | /* |
1463 | * power management | 1472 | * power management |
1464 | */ | 1473 | */ |
@@ -1533,7 +1542,7 @@ static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume); | |||
1533 | #define SND_ATIIXP_PM_OPS &snd_atiixp_pm | 1542 | #define SND_ATIIXP_PM_OPS &snd_atiixp_pm |
1534 | #else | 1543 | #else |
1535 | #define SND_ATIIXP_PM_OPS NULL | 1544 | #define SND_ATIIXP_PM_OPS NULL |
1536 | #endif /* CONFIG_PM */ | 1545 | #endif /* CONFIG_PM_SLEEP */ |
1537 | 1546 | ||
1538 | 1547 | ||
1539 | #ifdef CONFIG_PROC_FS | 1548 | #ifdef CONFIG_PROC_FS |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 79e204ec623f..6fc03d9f2cff 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -511,7 +511,7 @@ static int snd_atiixp_aclink_reset(struct atiixp_modem *chip) | |||
511 | return 0; | 511 | return 0; |
512 | } | 512 | } |
513 | 513 | ||
514 | #ifdef CONFIG_PM | 514 | #ifdef CONFIG_PM_SLEEP |
515 | static int snd_atiixp_aclink_down(struct atiixp_modem *chip) | 515 | static int snd_atiixp_aclink_down(struct atiixp_modem *chip) |
516 | { | 516 | { |
517 | // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ | 517 | // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ |
@@ -1113,7 +1113,7 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock) | |||
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | 1115 | ||
1116 | #ifdef CONFIG_PM | 1116 | #ifdef CONFIG_PM_SLEEP |
1117 | /* | 1117 | /* |
1118 | * power management | 1118 | * power management |
1119 | */ | 1119 | */ |
@@ -1169,7 +1169,7 @@ static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume); | |||
1169 | #define SND_ATIIXP_PM_OPS &snd_atiixp_pm | 1169 | #define SND_ATIIXP_PM_OPS &snd_atiixp_pm |
1170 | #else | 1170 | #else |
1171 | #define SND_ATIIXP_PM_OPS NULL | 1171 | #define SND_ATIIXP_PM_OPS NULL |
1172 | #endif /* CONFIG_PM */ | 1172 | #endif /* CONFIG_PM_SLEEP */ |
1173 | 1173 | ||
1174 | #ifdef CONFIG_PROC_FS | 1174 | #ifdef CONFIG_PROC_FS |
1175 | /* | 1175 | /* |
diff --git a/sound/pci/au88x0/au88x0_game.c b/sound/pci/au88x0/au88x0_game.c index c07c792bde8d..30a456700d89 100644 --- a/sound/pci/au88x0/au88x0_game.c +++ b/sound/pci/au88x0/au88x0_game.c | |||
@@ -100,7 +100,7 @@ static int __devinit vortex_gameport_register(vortex_t * vortex) | |||
100 | if (!gp) { | 100 | if (!gp) { |
101 | printk(KERN_ERR "vortex: cannot allocate memory for gameport\n"); | 101 | printk(KERN_ERR "vortex: cannot allocate memory for gameport\n"); |
102 | return -ENOMEM; | 102 | return -ENOMEM; |
103 | }; | 103 | } |
104 | 104 | ||
105 | gameport_set_name(gp, "AU88x0 Gameport"); | 105 | gameport_set_name(gp, "AU88x0 Gameport"); |
106 | gameport_set_phys(gp, "pci%s/gameport0", pci_name(vortex->pci_dev)); | 106 | gameport_set_phys(gp, "pci%s/gameport0", pci_name(vortex->pci_dev)); |
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index e59f120742a4..b2405020284c 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c | |||
@@ -585,7 +585,7 @@ static int snd_vortex_pcm_vol_put(struct snd_kcontrol *kcontrol, | |||
585 | case 4: | 585 | case 4: |
586 | mixin = p->mixin[i]; | 586 | mixin = p->mixin[i]; |
587 | break; | 587 | break; |
588 | }; | 588 | } |
589 | vol = p->vol[i]; | 589 | vol = p->vol[i]; |
590 | vortex_mix_setinputvolumebyte(vortex, | 590 | vortex_mix_setinputvolumebyte(vortex, |
591 | vortex->mixplayb[i], mixin, vol); | 591 | vortex->mixplayb[i], mixin, vol); |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 4dddd871548b..c03b66b784a3 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -365,7 +365,7 @@ struct snd_azf3328 { | |||
365 | * CONFIG_PM register storage below, but that's slightly difficult. */ | 365 | * CONFIG_PM register storage below, but that's slightly difficult. */ |
366 | u16 shadow_reg_ctrl_6AH; | 366 | u16 shadow_reg_ctrl_6AH; |
367 | 367 | ||
368 | #ifdef CONFIG_PM | 368 | #ifdef CONFIG_PM_SLEEP |
369 | /* register value containers for power management | 369 | /* register value containers for power management |
370 | * Note: not always full I/O range preserved (similar to Win driver!) */ | 370 | * Note: not always full I/O range preserved (similar to Win driver!) */ |
371 | u32 saved_regs_ctrl[AZF_ALIGN(AZF_IO_SIZE_CTRL_PM) / 4]; | 371 | u32 saved_regs_ctrl[AZF_ALIGN(AZF_IO_SIZE_CTRL_PM) / 4]; |
@@ -2729,7 +2729,7 @@ snd_azf3328_remove(struct pci_dev *pci) | |||
2729 | snd_azf3328_dbgcallleave(); | 2729 | snd_azf3328_dbgcallleave(); |
2730 | } | 2730 | } |
2731 | 2731 | ||
2732 | #ifdef CONFIG_PM | 2732 | #ifdef CONFIG_PM_SLEEP |
2733 | static inline void | 2733 | static inline void |
2734 | snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs) | 2734 | snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs) |
2735 | { | 2735 | { |
@@ -2866,7 +2866,7 @@ static SIMPLE_DEV_PM_OPS(snd_azf3328_pm, snd_azf3328_suspend, snd_azf3328_resume | |||
2866 | #define SND_AZF3328_PM_OPS &snd_azf3328_pm | 2866 | #define SND_AZF3328_PM_OPS &snd_azf3328_pm |
2867 | #else | 2867 | #else |
2868 | #define SND_AZF3328_PM_OPS NULL | 2868 | #define SND_AZF3328_PM_OPS NULL |
2869 | #endif /* CONFIG_PM */ | 2869 | #endif /* CONFIG_PM_SLEEP */ |
2870 | 2870 | ||
2871 | static struct pci_driver azf3328_driver = { | 2871 | static struct pci_driver azf3328_driver = { |
2872 | .name = KBUILD_MODNAME, | 2872 | .name = KBUILD_MODNAME, |
diff --git a/sound/pci/ca0106/ca0106.h b/sound/pci/ca0106/ca0106.h index e8e8ccc96403..04402c14cb23 100644 --- a/sound/pci/ca0106/ca0106.h +++ b/sound/pci/ca0106/ca0106.h | |||
@@ -710,7 +710,7 @@ struct snd_ca0106 { | |||
710 | 710 | ||
711 | u16 spi_dac_reg[16]; | 711 | u16 spi_dac_reg[16]; |
712 | 712 | ||
713 | #ifdef CONFIG_PM | 713 | #ifdef CONFIG_PM_SLEEP |
714 | #define NUM_SAVED_VOLUMES 9 | 714 | #define NUM_SAVED_VOLUMES 9 |
715 | unsigned int saved_vol[NUM_SAVED_VOLUMES]; | 715 | unsigned int saved_vol[NUM_SAVED_VOLUMES]; |
716 | #endif | 716 | #endif |
@@ -733,7 +733,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, u32 reg, u32 value); | |||
733 | int snd_ca0106_spi_write(struct snd_ca0106 * emu, | 733 | int snd_ca0106_spi_write(struct snd_ca0106 * emu, |
734 | unsigned int data); | 734 | unsigned int data); |
735 | 735 | ||
736 | #ifdef CONFIG_PM | 736 | #ifdef CONFIG_PM_SLEEP |
737 | void snd_ca0106_mixer_suspend(struct snd_ca0106 *chip); | 737 | void snd_ca0106_mixer_suspend(struct snd_ca0106 *chip); |
738 | void snd_ca0106_mixer_resume(struct snd_ca0106 *chip); | 738 | void snd_ca0106_mixer_resume(struct snd_ca0106 *chip); |
739 | #else | 739 | #else |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 83277b747b36..65c55910566b 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -1334,10 +1334,29 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) | |||
1334 | return IRQ_HANDLED; | 1334 | return IRQ_HANDLED; |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | static const struct snd_pcm_chmap_elem surround_map[] = { | ||
1338 | { .channels = 2, | ||
1339 | .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, | ||
1340 | { } | ||
1341 | }; | ||
1342 | |||
1343 | static const struct snd_pcm_chmap_elem clfe_map[] = { | ||
1344 | { .channels = 2, | ||
1345 | .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, | ||
1346 | { } | ||
1347 | }; | ||
1348 | |||
1349 | static const struct snd_pcm_chmap_elem side_map[] = { | ||
1350 | { .channels = 2, | ||
1351 | .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, | ||
1352 | { } | ||
1353 | }; | ||
1354 | |||
1337 | static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) | 1355 | static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) |
1338 | { | 1356 | { |
1339 | struct snd_pcm *pcm; | 1357 | struct snd_pcm *pcm; |
1340 | struct snd_pcm_substream *substream; | 1358 | struct snd_pcm_substream *substream; |
1359 | const struct snd_pcm_chmap_elem *map = NULL; | ||
1341 | int err; | 1360 | int err; |
1342 | 1361 | ||
1343 | err = snd_pcm_new(emu->card, "ca0106", device, 1, 1, &pcm); | 1362 | err = snd_pcm_new(emu->card, "ca0106", device, 1, 1, &pcm); |
@@ -1350,18 +1369,22 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) | |||
1350 | case 0: | 1369 | case 0: |
1351 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_front_ops); | 1370 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_front_ops); |
1352 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_0_ops); | 1371 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_0_ops); |
1372 | map = snd_pcm_std_chmaps; | ||
1353 | break; | 1373 | break; |
1354 | case 1: | 1374 | case 1: |
1355 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_rear_ops); | 1375 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_rear_ops); |
1356 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_1_ops); | 1376 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_1_ops); |
1377 | map = surround_map; | ||
1357 | break; | 1378 | break; |
1358 | case 2: | 1379 | case 2: |
1359 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_center_lfe_ops); | 1380 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_center_lfe_ops); |
1360 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_2_ops); | 1381 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_2_ops); |
1382 | map = clfe_map; | ||
1361 | break; | 1383 | break; |
1362 | case 3: | 1384 | case 3: |
1363 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_unknown_ops); | 1385 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_unknown_ops); |
1364 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_3_ops); | 1386 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_3_ops); |
1387 | map = side_map; | ||
1365 | break; | 1388 | break; |
1366 | } | 1389 | } |
1367 | 1390 | ||
@@ -1388,6 +1411,11 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) | |||
1388 | return err; | 1411 | return err; |
1389 | } | 1412 | } |
1390 | 1413 | ||
1414 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, | ||
1415 | 1 << 2, NULL); | ||
1416 | if (err < 0) | ||
1417 | return err; | ||
1418 | |||
1391 | emu->pcm[device] = pcm; | 1419 | emu->pcm[device] = pcm; |
1392 | 1420 | ||
1393 | return 0; | 1421 | return 0; |
@@ -1871,7 +1899,7 @@ static void __devexit snd_ca0106_remove(struct pci_dev *pci) | |||
1871 | pci_set_drvdata(pci, NULL); | 1899 | pci_set_drvdata(pci, NULL); |
1872 | } | 1900 | } |
1873 | 1901 | ||
1874 | #ifdef CONFIG_PM | 1902 | #ifdef CONFIG_PM_SLEEP |
1875 | static int snd_ca0106_suspend(struct device *dev) | 1903 | static int snd_ca0106_suspend(struct device *dev) |
1876 | { | 1904 | { |
1877 | struct pci_dev *pci = to_pci_dev(dev); | 1905 | struct pci_dev *pci = to_pci_dev(dev); |
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index 84f3f92436b5..68eacf7002d6 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c | |||
@@ -907,7 +907,7 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) | |||
907 | return 0; | 907 | return 0; |
908 | } | 908 | } |
909 | 909 | ||
910 | #ifdef CONFIG_PM | 910 | #ifdef CONFIG_PM_SLEEP |
911 | struct ca0106_vol_tbl { | 911 | struct ca0106_vol_tbl { |
912 | unsigned int channel_id; | 912 | unsigned int channel_id; |
913 | unsigned int reg; | 913 | unsigned int reg; |
@@ -953,4 +953,4 @@ void snd_ca0106_mixer_resume(struct snd_ca0106 *chip) | |||
953 | if (chip->details->i2c_adc) | 953 | if (chip->details->i2c_adc) |
954 | ca0106_set_capture_mic_line_in(chip); | 954 | ca0106_set_capture_mic_line_in(chip); |
955 | } | 955 | } |
956 | #endif /* CONFIG_PM */ | 956 | #endif /* CONFIG_PM_SLEEP */ |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index b7d6f2b886ef..22122ff26e34 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -504,7 +504,7 @@ struct cmipci { | |||
504 | 504 | ||
505 | spinlock_t reg_lock; | 505 | spinlock_t reg_lock; |
506 | 506 | ||
507 | #ifdef CONFIG_PM | 507 | #ifdef CONFIG_PM_SLEEP |
508 | unsigned int saved_regs[0x20]; | 508 | unsigned int saved_regs[0x20]; |
509 | unsigned char saved_mixers[0x20]; | 509 | unsigned char saved_mixers[0x20]; |
510 | #endif | 510 | #endif |
@@ -1962,6 +1962,12 @@ static int __devinit snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device) | |||
1962 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1962 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1963 | snd_dma_pci_data(cm->pci), 64*1024, 128*1024); | 1963 | snd_dma_pci_data(cm->pci), 64*1024, 128*1024); |
1964 | 1964 | ||
1965 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1966 | snd_pcm_alt_chmaps, cm->max_channels, 0, | ||
1967 | NULL); | ||
1968 | if (err < 0) | ||
1969 | return err; | ||
1970 | |||
1965 | return 0; | 1971 | return 0; |
1966 | } | 1972 | } |
1967 | 1973 | ||
@@ -3315,7 +3321,7 @@ static void __devexit snd_cmipci_remove(struct pci_dev *pci) | |||
3315 | } | 3321 | } |
3316 | 3322 | ||
3317 | 3323 | ||
3318 | #ifdef CONFIG_PM | 3324 | #ifdef CONFIG_PM_SLEEP |
3319 | /* | 3325 | /* |
3320 | * power management | 3326 | * power management |
3321 | */ | 3327 | */ |
@@ -3403,7 +3409,7 @@ static SIMPLE_DEV_PM_OPS(snd_cmipci_pm, snd_cmipci_suspend, snd_cmipci_resume); | |||
3403 | #define SND_CMIPCI_PM_OPS &snd_cmipci_pm | 3409 | #define SND_CMIPCI_PM_OPS &snd_cmipci_pm |
3404 | #else | 3410 | #else |
3405 | #define SND_CMIPCI_PM_OPS NULL | 3411 | #define SND_CMIPCI_PM_OPS NULL |
3406 | #endif /* CONFIG_PM */ | 3412 | #endif /* CONFIG_PM_SLEEP */ |
3407 | 3413 | ||
3408 | static struct pci_driver cmipci_driver = { | 3414 | static struct pci_driver cmipci_driver = { |
3409 | .name = KBUILD_MODNAME, | 3415 | .name = KBUILD_MODNAME, |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 45a8317085f4..8e86ec0031fc 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -486,7 +486,7 @@ struct cs4281 { | |||
486 | 486 | ||
487 | struct gameport *gameport; | 487 | struct gameport *gameport; |
488 | 488 | ||
489 | #ifdef CONFIG_PM | 489 | #ifdef CONFIG_PM_SLEEP |
490 | u32 suspend_regs[SUSPEND_REGISTERS]; | 490 | u32 suspend_regs[SUSPEND_REGISTERS]; |
491 | #endif | 491 | #endif |
492 | 492 | ||
@@ -1977,7 +1977,7 @@ static void __devexit snd_cs4281_remove(struct pci_dev *pci) | |||
1977 | /* | 1977 | /* |
1978 | * Power Management | 1978 | * Power Management |
1979 | */ | 1979 | */ |
1980 | #ifdef CONFIG_PM | 1980 | #ifdef CONFIG_PM_SLEEP |
1981 | 1981 | ||
1982 | static int saved_regs[SUSPEND_REGISTERS] = { | 1982 | static int saved_regs[SUSPEND_REGISTERS] = { |
1983 | BA0_JSCTL, | 1983 | BA0_JSCTL, |
@@ -2089,7 +2089,7 @@ static SIMPLE_DEV_PM_OPS(cs4281_pm, cs4281_suspend, cs4281_resume); | |||
2089 | #define CS4281_PM_OPS &cs4281_pm | 2089 | #define CS4281_PM_OPS &cs4281_pm |
2090 | #else | 2090 | #else |
2091 | #define CS4281_PM_OPS NULL | 2091 | #define CS4281_PM_OPS NULL |
2092 | #endif /* CONFIG_PM */ | 2092 | #endif /* CONFIG_PM_SLEEP */ |
2093 | 2093 | ||
2094 | static struct pci_driver cs4281_driver = { | 2094 | static struct pci_driver cs4281_driver = { |
2095 | .name = KBUILD_MODNAME, | 2095 | .name = KBUILD_MODNAME, |
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index 1e007c736a8b..575bed0836ff 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -166,7 +166,7 @@ static struct pci_driver cs46xx_driver = { | |||
166 | .id_table = snd_cs46xx_ids, | 166 | .id_table = snd_cs46xx_ids, |
167 | .probe = snd_card_cs46xx_probe, | 167 | .probe = snd_card_cs46xx_probe, |
168 | .remove = __devexit_p(snd_card_cs46xx_remove), | 168 | .remove = __devexit_p(snd_card_cs46xx_remove), |
169 | #ifdef CONFIG_PM | 169 | #ifdef CONFIG_PM_SLEEP |
170 | .driver = { | 170 | .driver = { |
171 | .pm = &snd_cs46xx_pm, | 171 | .pm = &snd_cs46xx_pm, |
172 | }, | 172 | }, |
diff --git a/sound/pci/cs46xx/cs46xx.h b/sound/pci/cs46xx/cs46xx.h index 29d8a8da1ba7..fc339ef0a0ae 100644 --- a/sound/pci/cs46xx/cs46xx.h +++ b/sound/pci/cs46xx/cs46xx.h | |||
@@ -1721,7 +1721,7 @@ struct snd_cs46xx { | |||
1721 | unsigned int play_ctl; | 1721 | unsigned int play_ctl; |
1722 | #endif | 1722 | #endif |
1723 | 1723 | ||
1724 | #ifdef CONFIG_PM | 1724 | #ifdef CONFIG_PM_SLEEP |
1725 | u32 *saved_regs; | 1725 | u32 *saved_regs; |
1726 | #endif | 1726 | #endif |
1727 | }; | 1727 | }; |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index a71d1c14a0f6..a2bb8c91ebe6 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -2797,7 +2797,7 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) | |||
2797 | } | 2797 | } |
2798 | #endif | 2798 | #endif |
2799 | 2799 | ||
2800 | #ifdef CONFIG_PM | 2800 | #ifdef CONFIG_PM_SLEEP |
2801 | kfree(chip->saved_regs); | 2801 | kfree(chip->saved_regs); |
2802 | #endif | 2802 | #endif |
2803 | 2803 | ||
@@ -3590,7 +3590,7 @@ static struct cs_card_type __devinitdata cards[] = { | |||
3590 | /* | 3590 | /* |
3591 | * APM support | 3591 | * APM support |
3592 | */ | 3592 | */ |
3593 | #ifdef CONFIG_PM | 3593 | #ifdef CONFIG_PM_SLEEP |
3594 | static unsigned int saved_regs[] = { | 3594 | static unsigned int saved_regs[] = { |
3595 | BA0_ACOSV, | 3595 | BA0_ACOSV, |
3596 | /*BA0_ASER_FADDR,*/ | 3596 | /*BA0_ASER_FADDR,*/ |
@@ -3711,7 +3711,7 @@ static int snd_cs46xx_resume(struct device *dev) | |||
3711 | } | 3711 | } |
3712 | 3712 | ||
3713 | SIMPLE_DEV_PM_OPS(snd_cs46xx_pm, snd_cs46xx_suspend, snd_cs46xx_resume); | 3713 | SIMPLE_DEV_PM_OPS(snd_cs46xx_pm, snd_cs46xx_suspend, snd_cs46xx_resume); |
3714 | #endif /* CONFIG_PM */ | 3714 | #endif /* CONFIG_PM_SLEEP */ |
3715 | 3715 | ||
3716 | 3716 | ||
3717 | /* | 3717 | /* |
@@ -3868,7 +3868,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card, | |||
3868 | 3868 | ||
3869 | snd_cs46xx_proc_init(card, chip); | 3869 | snd_cs46xx_proc_init(card, chip); |
3870 | 3870 | ||
3871 | #ifdef CONFIG_PM | 3871 | #ifdef CONFIG_PM_SLEEP |
3872 | chip->saved_regs = kmalloc(sizeof(*chip->saved_regs) * | 3872 | chip->saved_regs = kmalloc(sizeof(*chip->saved_regs) * |
3873 | ARRAY_SIZE(saved_regs), GFP_KERNEL); | 3873 | ARRAY_SIZE(saved_regs), GFP_KERNEL); |
3874 | if (!chip->saved_regs) { | 3874 | if (!chip->saved_regs) { |
diff --git a/sound/pci/cs46xx/cs46xx_lib.h b/sound/pci/cs46xx/cs46xx_lib.h index b5189495d58a..86f14620f817 100644 --- a/sound/pci/cs46xx/cs46xx_lib.h +++ b/sound/pci/cs46xx/cs46xx_lib.h | |||
@@ -90,7 +90,7 @@ static inline unsigned int snd_cs46xx_peekBA0(struct snd_cs46xx *chip, unsigned | |||
90 | struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip); | 90 | struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip); |
91 | void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip); | 91 | void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip); |
92 | int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module); | 92 | int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module); |
93 | #ifdef CONFIG_PM | 93 | #ifdef CONFIG_PM_SLEEP |
94 | int cs46xx_dsp_resume(struct snd_cs46xx * chip); | 94 | int cs46xx_dsp_resume(struct snd_cs46xx * chip); |
95 | #endif | 95 | #endif |
96 | struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, | 96 | struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, |
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 56fec0bc0efb..1686b4f4c44f 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c | |||
@@ -287,7 +287,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip) | |||
287 | if (ins->scbs[i].deleted) continue; | 287 | if (ins->scbs[i].deleted) continue; |
288 | 288 | ||
289 | cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); | 289 | cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); |
290 | #ifdef CONFIG_PM | 290 | #ifdef CONFIG_PM_SLEEP |
291 | kfree(ins->scbs[i].data); | 291 | kfree(ins->scbs[i].data); |
292 | #endif | 292 | #endif |
293 | } | 293 | } |
@@ -1019,7 +1019,7 @@ cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 | |||
1019 | { | 1019 | { |
1020 | struct dsp_scb_descriptor * desc; | 1020 | struct dsp_scb_descriptor * desc; |
1021 | 1021 | ||
1022 | #ifdef CONFIG_PM | 1022 | #ifdef CONFIG_PM_SLEEP |
1023 | /* copy the data for resume */ | 1023 | /* copy the data for resume */ |
1024 | scb_data = kmemdup(scb_data, SCB_BYTES, GFP_KERNEL); | 1024 | scb_data = kmemdup(scb_data, SCB_BYTES, GFP_KERNEL); |
1025 | if (!scb_data) | 1025 | if (!scb_data) |
@@ -1032,7 +1032,7 @@ cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 | |||
1032 | _dsp_create_scb(chip,scb_data,dest); | 1032 | _dsp_create_scb(chip,scb_data,dest); |
1033 | } else { | 1033 | } else { |
1034 | snd_printk(KERN_ERR "dsp_spos: failed to map SCB\n"); | 1034 | snd_printk(KERN_ERR "dsp_spos: failed to map SCB\n"); |
1035 | #ifdef CONFIG_PM | 1035 | #ifdef CONFIG_PM_SLEEP |
1036 | kfree(scb_data); | 1036 | kfree(scb_data); |
1037 | #endif | 1037 | #endif |
1038 | } | 1038 | } |
@@ -1937,7 +1937,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right) | |||
1937 | return 0; | 1937 | return 0; |
1938 | } | 1938 | } |
1939 | 1939 | ||
1940 | #ifdef CONFIG_PM | 1940 | #ifdef CONFIG_PM_SLEEP |
1941 | int cs46xx_dsp_resume(struct snd_cs46xx * chip) | 1941 | int cs46xx_dsp_resume(struct snd_cs46xx * chip) |
1942 | { | 1942 | { |
1943 | struct dsp_spos_instance * ins = chip->dsp_spos_instance; | 1943 | struct dsp_spos_instance * ins = chip->dsp_spos_instance; |
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index c2c695b07f8c..409e8764fbeb 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c | |||
@@ -203,7 +203,7 @@ void cs46xx_dsp_remove_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor * | |||
203 | remove_symbol (chip,scb->scb_symbol); | 203 | remove_symbol (chip,scb->scb_symbol); |
204 | 204 | ||
205 | ins->scbs[scb->index].deleted = 1; | 205 | ins->scbs[scb->index].deleted = 1; |
206 | #ifdef CONFIG_PM | 206 | #ifdef CONFIG_PM_SLEEP |
207 | kfree(ins->scbs[scb->index].data); | 207 | kfree(ins->scbs[scb->index].data); |
208 | ins->scbs[scb->index].data = NULL; | 208 | ins->scbs[scb->index].data = NULL; |
209 | #endif | 209 | #endif |
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index f1e4229993af..d1cca2831575 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -142,8 +142,7 @@ static int __devinit snd_cs5530_create(struct snd_card *card, | |||
142 | 142 | ||
143 | mem = pci_ioremap_bar(pci, 0); | 143 | mem = pci_ioremap_bar(pci, 0); |
144 | if (mem == NULL) { | 144 | if (mem == NULL) { |
145 | kfree(chip); | 145 | snd_cs5530_free(chip); |
146 | pci_disable_device(pci); | ||
147 | return -EBUSY; | 146 | return -EBUSY; |
148 | } | 147 | } |
149 | 148 | ||
diff --git a/sound/pci/cs5535audio/Makefile b/sound/pci/cs5535audio/Makefile index ccc642269b9e..a8f75f8dfda9 100644 --- a/sound/pci/cs5535audio/Makefile +++ b/sound/pci/cs5535audio/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o | 5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o |
6 | snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o | 6 | snd-cs5535audio-$(CONFIG_PM_SLEEP) += cs5535audio_pm.o |
7 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o | 7 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o |
8 | 8 | ||
9 | # Toplevel Module Dependency | 9 | # Toplevel Module Dependency |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 51f64ba5facf..4915efa551fc 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -399,7 +399,7 @@ static struct pci_driver cs5535audio_driver = { | |||
399 | .id_table = snd_cs5535audio_ids, | 399 | .id_table = snd_cs5535audio_ids, |
400 | .probe = snd_cs5535audio_probe, | 400 | .probe = snd_cs5535audio_probe, |
401 | .remove = __devexit_p(snd_cs5535audio_remove), | 401 | .remove = __devexit_p(snd_cs5535audio_remove), |
402 | #ifdef CONFIG_PM | 402 | #ifdef CONFIG_PM_SLEEP |
403 | .driver = { | 403 | .driver = { |
404 | .pm = &snd_cs5535audio_pm, | 404 | .pm = &snd_cs5535audio_pm, |
405 | }, | 405 | }, |
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 2f6e9c762d3f..a2f997a9977a 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -1536,7 +1536,7 @@ static void atc_connect_resources(struct ct_atc *atc) | |||
1536 | } | 1536 | } |
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | #ifdef CONFIG_PM | 1539 | #ifdef CONFIG_PM_SLEEP |
1540 | static int atc_suspend(struct ct_atc *atc) | 1540 | static int atc_suspend(struct ct_atc *atc) |
1541 | { | 1541 | { |
1542 | int i; | 1542 | int i; |
@@ -1647,7 +1647,7 @@ static struct ct_atc atc_preset __devinitdata = { | |||
1647 | .output_switch_put = atc_output_switch_put, | 1647 | .output_switch_put = atc_output_switch_put, |
1648 | .mic_source_switch_get = atc_mic_source_switch_get, | 1648 | .mic_source_switch_get = atc_mic_source_switch_get, |
1649 | .mic_source_switch_put = atc_mic_source_switch_put, | 1649 | .mic_source_switch_put = atc_mic_source_switch_put, |
1650 | #ifdef CONFIG_PM | 1650 | #ifdef CONFIG_PM_SLEEP |
1651 | .suspend = atc_suspend, | 1651 | .suspend = atc_suspend, |
1652 | .resume = atc_resume, | 1652 | .resume = atc_resume, |
1653 | #endif | 1653 | #endif |
diff --git a/sound/pci/ctxfi/ctatc.h b/sound/pci/ctxfi/ctatc.h index 653e813ad142..69b51f9d345e 100644 --- a/sound/pci/ctxfi/ctatc.h +++ b/sound/pci/ctxfi/ctatc.h | |||
@@ -143,7 +143,7 @@ struct ct_atc { | |||
143 | 143 | ||
144 | struct ct_timer *timer; | 144 | struct ct_timer *timer; |
145 | 145 | ||
146 | #ifdef CONFIG_PM | 146 | #ifdef CONFIG_PM_SLEEP |
147 | int (*suspend)(struct ct_atc *atc); | 147 | int (*suspend)(struct ct_atc *atc); |
148 | int (*resume)(struct ct_atc *atc); | 148 | int (*resume)(struct ct_atc *atc); |
149 | #define NUM_PCMS (NUM_CTALSADEVS - 1) | 149 | #define NUM_PCMS (NUM_CTALSADEVS - 1) |
diff --git a/sound/pci/ctxfi/cthardware.h b/sound/pci/ctxfi/cthardware.h index c56fe533b3f3..5977e9a24b5c 100644 --- a/sound/pci/ctxfi/cthardware.h +++ b/sound/pci/ctxfi/cthardware.h | |||
@@ -72,7 +72,7 @@ struct hw { | |||
72 | int (*card_init)(struct hw *hw, struct card_conf *info); | 72 | int (*card_init)(struct hw *hw, struct card_conf *info); |
73 | int (*card_stop)(struct hw *hw); | 73 | int (*card_stop)(struct hw *hw); |
74 | int (*pll_init)(struct hw *hw, unsigned int rsr); | 74 | int (*pll_init)(struct hw *hw, unsigned int rsr); |
75 | #ifdef CONFIG_PM | 75 | #ifdef CONFIG_PM_SLEEP |
76 | int (*suspend)(struct hw *hw); | 76 | int (*suspend)(struct hw *hw); |
77 | int (*resume)(struct hw *hw, struct card_conf *info); | 77 | int (*resume)(struct hw *hw, struct card_conf *info); |
78 | #endif | 78 | #endif |
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index dc1969bc67d4..4507f7088b24 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c | |||
@@ -2085,7 +2085,7 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) | |||
2085 | return 0; | 2085 | return 0; |
2086 | } | 2086 | } |
2087 | 2087 | ||
2088 | #ifdef CONFIG_PM | 2088 | #ifdef CONFIG_PM_SLEEP |
2089 | static int hw_suspend(struct hw *hw) | 2089 | static int hw_suspend(struct hw *hw) |
2090 | { | 2090 | { |
2091 | struct pci_dev *pci = hw->pci; | 2091 | struct pci_dev *pci = hw->pci; |
@@ -2180,7 +2180,7 @@ static struct hw ct20k1_preset __devinitdata = { | |||
2180 | .is_adc_source_selected = hw_is_adc_input_selected, | 2180 | .is_adc_source_selected = hw_is_adc_input_selected, |
2181 | .select_adc_source = hw_adc_input_select, | 2181 | .select_adc_source = hw_adc_input_select, |
2182 | .capabilities = hw_capabilities, | 2182 | .capabilities = hw_capabilities, |
2183 | #ifdef CONFIG_PM | 2183 | #ifdef CONFIG_PM_SLEEP |
2184 | .suspend = hw_suspend, | 2184 | .suspend = hw_suspend, |
2185 | .resume = hw_resume, | 2185 | .resume = hw_resume, |
2186 | #endif | 2186 | #endif |
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 9d1231dc4ae2..b9c9349058bc 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c | |||
@@ -2201,7 +2201,7 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) | |||
2201 | return 0; | 2201 | return 0; |
2202 | } | 2202 | } |
2203 | 2203 | ||
2204 | #ifdef CONFIG_PM | 2204 | #ifdef CONFIG_PM_SLEEP |
2205 | static int hw_suspend(struct hw *hw) | 2205 | static int hw_suspend(struct hw *hw) |
2206 | { | 2206 | { |
2207 | struct pci_dev *pci = hw->pci; | 2207 | struct pci_dev *pci = hw->pci; |
@@ -2250,7 +2250,7 @@ static struct hw ct20k2_preset __devinitdata = { | |||
2250 | .output_switch_put = hw_output_switch_put, | 2250 | .output_switch_put = hw_output_switch_put, |
2251 | .mic_source_switch_get = hw_mic_source_switch_get, | 2251 | .mic_source_switch_get = hw_mic_source_switch_get, |
2252 | .mic_source_switch_put = hw_mic_source_switch_put, | 2252 | .mic_source_switch_put = hw_mic_source_switch_put, |
2253 | #ifdef CONFIG_PM | 2253 | #ifdef CONFIG_PM_SLEEP |
2254 | .suspend = hw_suspend, | 2254 | .suspend = hw_suspend, |
2255 | .resume = hw_resume, | 2255 | .resume = hw_resume, |
2256 | #endif | 2256 | #endif |
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c index 0cc13eeef8da..48fe0e39c2be 100644 --- a/sound/pci/ctxfi/ctmixer.c +++ b/sound/pci/ctxfi/ctmixer.c | |||
@@ -1118,7 +1118,7 @@ mixer_set_input_right(struct ct_mixer *mixer, | |||
1118 | return 0; | 1118 | return 0; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | #ifdef CONFIG_PM | 1121 | #ifdef CONFIG_PM_SLEEP |
1122 | static int mixer_resume(struct ct_mixer *mixer) | 1122 | static int mixer_resume(struct ct_mixer *mixer) |
1123 | { | 1123 | { |
1124 | int i, state; | 1124 | int i, state; |
@@ -1188,7 +1188,7 @@ int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer) | |||
1188 | mixer->get_output_ports = mixer_get_output_ports; | 1188 | mixer->get_output_ports = mixer_get_output_ports; |
1189 | mixer->set_input_left = mixer_set_input_left; | 1189 | mixer->set_input_left = mixer_set_input_left; |
1190 | mixer->set_input_right = mixer_set_input_right; | 1190 | mixer->set_input_right = mixer_set_input_right; |
1191 | #ifdef CONFIG_PM | 1191 | #ifdef CONFIG_PM_SLEEP |
1192 | mixer->resume = mixer_resume; | 1192 | mixer->resume = mixer_resume; |
1193 | #endif | 1193 | #endif |
1194 | 1194 | ||
diff --git a/sound/pci/ctxfi/ctmixer.h b/sound/pci/ctxfi/ctmixer.h index b009e989e77d..be881c639fee 100644 --- a/sound/pci/ctxfi/ctmixer.h +++ b/sound/pci/ctxfi/ctmixer.h | |||
@@ -56,7 +56,7 @@ struct ct_mixer { | |||
56 | enum MIXER_PORT_T type, struct rsc *rsc); | 56 | enum MIXER_PORT_T type, struct rsc *rsc); |
57 | int (*set_input_right)(struct ct_mixer *mixer, | 57 | int (*set_input_right)(struct ct_mixer *mixer, |
58 | enum MIXER_PORT_T type, struct rsc *rsc); | 58 | enum MIXER_PORT_T type, struct rsc *rsc); |
59 | #ifdef CONFIG_PM | 59 | #ifdef CONFIG_PM_SLEEP |
60 | int (*resume)(struct ct_mixer *mixer); | 60 | int (*resume)(struct ct_mixer *mixer); |
61 | #endif | 61 | #endif |
62 | }; | 62 | }; |
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index 2c8622617c8c..e8a4feb1ed86 100644 --- a/sound/pci/ctxfi/ctpcm.c +++ b/sound/pci/ctxfi/ctpcm.c | |||
@@ -395,12 +395,38 @@ static struct snd_pcm_ops ct_pcm_capture_ops = { | |||
395 | .page = snd_pcm_sgbuf_ops_page, | 395 | .page = snd_pcm_sgbuf_ops_page, |
396 | }; | 396 | }; |
397 | 397 | ||
398 | static const struct snd_pcm_chmap_elem surround_map[] = { | ||
399 | { .channels = 1, | ||
400 | .map = { SNDRV_CHMAP_MONO } }, | ||
401 | { .channels = 2, | ||
402 | .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, | ||
403 | { } | ||
404 | }; | ||
405 | |||
406 | static const struct snd_pcm_chmap_elem clfe_map[] = { | ||
407 | { .channels = 1, | ||
408 | .map = { SNDRV_CHMAP_MONO } }, | ||
409 | { .channels = 2, | ||
410 | .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, | ||
411 | { } | ||
412 | }; | ||
413 | |||
414 | static const struct snd_pcm_chmap_elem side_map[] = { | ||
415 | { .channels = 1, | ||
416 | .map = { SNDRV_CHMAP_MONO } }, | ||
417 | { .channels = 2, | ||
418 | .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, | ||
419 | { } | ||
420 | }; | ||
421 | |||
398 | /* Create ALSA pcm device */ | 422 | /* Create ALSA pcm device */ |
399 | int ct_alsa_pcm_create(struct ct_atc *atc, | 423 | int ct_alsa_pcm_create(struct ct_atc *atc, |
400 | enum CTALSADEVS device, | 424 | enum CTALSADEVS device, |
401 | const char *device_name) | 425 | const char *device_name) |
402 | { | 426 | { |
403 | struct snd_pcm *pcm; | 427 | struct snd_pcm *pcm; |
428 | const struct snd_pcm_chmap_elem *map; | ||
429 | int chs; | ||
404 | int err; | 430 | int err; |
405 | int playback_count, capture_count; | 431 | int playback_count, capture_count; |
406 | 432 | ||
@@ -427,7 +453,31 @@ int ct_alsa_pcm_create(struct ct_atc *atc, | |||
427 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 453 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
428 | snd_dma_pci_data(atc->pci), 128*1024, 128*1024); | 454 | snd_dma_pci_data(atc->pci), 128*1024, 128*1024); |
429 | 455 | ||
430 | #ifdef CONFIG_PM | 456 | chs = 2; |
457 | switch (device) { | ||
458 | case FRONT: | ||
459 | chs = 8; | ||
460 | map = snd_pcm_std_chmaps; | ||
461 | break; | ||
462 | case SURROUND: | ||
463 | map = surround_map; | ||
464 | break; | ||
465 | case CLFE: | ||
466 | map = clfe_map; | ||
467 | break; | ||
468 | case SIDE: | ||
469 | map = side_map; | ||
470 | break; | ||
471 | default: | ||
472 | map = snd_pcm_std_chmaps; | ||
473 | break; | ||
474 | } | ||
475 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, chs, | ||
476 | 0, NULL); | ||
477 | if (err < 0) | ||
478 | return err; | ||
479 | |||
480 | #ifdef CONFIG_PM_SLEEP | ||
431 | atc->pcms[device] = pcm; | 481 | atc->pcms[device] = pcm; |
432 | #endif | 482 | #endif |
433 | 483 | ||
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c index e002183ef8b2..07c07d752fd8 100644 --- a/sound/pci/ctxfi/xfi.c +++ b/sound/pci/ctxfi/xfi.c | |||
@@ -125,7 +125,7 @@ static void __devexit ct_card_remove(struct pci_dev *pci) | |||
125 | pci_set_drvdata(pci, NULL); | 125 | pci_set_drvdata(pci, NULL); |
126 | } | 126 | } |
127 | 127 | ||
128 | #ifdef CONFIG_PM | 128 | #ifdef CONFIG_PM_SLEEP |
129 | static int ct_card_suspend(struct device *dev) | 129 | static int ct_card_suspend(struct device *dev) |
130 | { | 130 | { |
131 | struct snd_card *card = dev_get_drvdata(dev); | 131 | struct snd_card *card = dev_get_drvdata(dev); |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 0ff754f180d0..abb0b86c41c9 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -46,7 +46,7 @@ static int get_firmware(const struct firmware **fw_entry, | |||
46 | int err; | 46 | int err; |
47 | char name[30]; | 47 | char name[30]; |
48 | 48 | ||
49 | #ifdef CONFIG_PM | 49 | #ifdef CONFIG_PM_SLEEP |
50 | if (chip->fw_cache[fw_index]) { | 50 | if (chip->fw_cache[fw_index]) { |
51 | DE_ACT(("firmware requested: %s is cached\n", card_fw[fw_index].data)); | 51 | DE_ACT(("firmware requested: %s is cached\n", card_fw[fw_index].data)); |
52 | *fw_entry = chip->fw_cache[fw_index]; | 52 | *fw_entry = chip->fw_cache[fw_index]; |
@@ -59,7 +59,7 @@ static int get_firmware(const struct firmware **fw_entry, | |||
59 | err = request_firmware(fw_entry, name, pci_device(chip)); | 59 | err = request_firmware(fw_entry, name, pci_device(chip)); |
60 | if (err < 0) | 60 | if (err < 0) |
61 | snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err); | 61 | snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err); |
62 | #ifdef CONFIG_PM | 62 | #ifdef CONFIG_PM_SLEEP |
63 | else | 63 | else |
64 | chip->fw_cache[fw_index] = *fw_entry; | 64 | chip->fw_cache[fw_index] = *fw_entry; |
65 | #endif | 65 | #endif |
@@ -70,7 +70,7 @@ static int get_firmware(const struct firmware **fw_entry, | |||
70 | 70 | ||
71 | static void free_firmware(const struct firmware *fw_entry) | 71 | static void free_firmware(const struct firmware *fw_entry) |
72 | { | 72 | { |
73 | #ifdef CONFIG_PM | 73 | #ifdef CONFIG_PM_SLEEP |
74 | DE_ACT(("firmware not released (kept in cache)\n")); | 74 | DE_ACT(("firmware not released (kept in cache)\n")); |
75 | #else | 75 | #else |
76 | release_firmware(fw_entry); | 76 | release_firmware(fw_entry); |
@@ -82,7 +82,7 @@ static void free_firmware(const struct firmware *fw_entry) | |||
82 | 82 | ||
83 | static void free_firmware_cache(struct echoaudio *chip) | 83 | static void free_firmware_cache(struct echoaudio *chip) |
84 | { | 84 | { |
85 | #ifdef CONFIG_PM | 85 | #ifdef CONFIG_PM_SLEEP |
86 | int i; | 86 | int i; |
87 | 87 | ||
88 | for (i = 0; i < 8 ; i++) | 88 | for (i = 0; i < 8 ; i++) |
@@ -2203,7 +2203,7 @@ ctl_error: | |||
2203 | 2203 | ||
2204 | 2204 | ||
2205 | 2205 | ||
2206 | #if defined(CONFIG_PM) | 2206 | #if defined(CONFIG_PM_SLEEP) |
2207 | 2207 | ||
2208 | static int snd_echo_suspend(struct device *dev) | 2208 | static int snd_echo_suspend(struct device *dev) |
2209 | { | 2209 | { |
@@ -2313,7 +2313,7 @@ static SIMPLE_DEV_PM_OPS(snd_echo_pm, snd_echo_suspend, snd_echo_resume); | |||
2313 | #define SND_ECHO_PM_OPS &snd_echo_pm | 2313 | #define SND_ECHO_PM_OPS &snd_echo_pm |
2314 | #else | 2314 | #else |
2315 | #define SND_ECHO_PM_OPS NULL | 2315 | #define SND_ECHO_PM_OPS NULL |
2316 | #endif /* CONFIG_PM */ | 2316 | #endif /* CONFIG_PM_SLEEP */ |
2317 | 2317 | ||
2318 | 2318 | ||
2319 | static void __devexit snd_echo_remove(struct pci_dev *pci) | 2319 | static void __devexit snd_echo_remove(struct pci_dev *pci) |
diff --git a/sound/pci/echoaudio/echoaudio.h b/sound/pci/echoaudio/echoaudio.h index 1df974dcb5f4..e158369f5faa 100644 --- a/sound/pci/echoaudio/echoaudio.h +++ b/sound/pci/echoaudio/echoaudio.h | |||
@@ -449,7 +449,7 @@ struct echoaudio { | |||
449 | volatile u32 __iomem *dsp_registers; /* DSP's register base */ | 449 | volatile u32 __iomem *dsp_registers; /* DSP's register base */ |
450 | u32 active_mask; /* Chs. active mask or | 450 | u32 active_mask; /* Chs. active mask or |
451 | * punks out */ | 451 | * punks out */ |
452 | #ifdef CONFIG_PM | 452 | #ifdef CONFIG_PM_SLEEP |
453 | const struct firmware *fw_cache[8]; /* Cached firmwares */ | 453 | const struct firmware *fw_cache[8]; /* Cached firmwares */ |
454 | #endif | 454 | #endif |
455 | 455 | ||
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index ddac4e6d660d..b7c1875ba90e 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -206,7 +206,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci) | |||
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | #ifdef CONFIG_PM | 209 | #ifdef CONFIG_PM_SLEEP |
210 | static int snd_emu10k1_suspend(struct device *dev) | 210 | static int snd_emu10k1_suspend(struct device *dev) |
211 | { | 211 | { |
212 | struct pci_dev *pci = to_pci_dev(dev); | 212 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -268,7 +268,7 @@ static SIMPLE_DEV_PM_OPS(snd_emu10k1_pm, snd_emu10k1_suspend, snd_emu10k1_resume | |||
268 | #define SND_EMU10K1_PM_OPS &snd_emu10k1_pm | 268 | #define SND_EMU10K1_PM_OPS &snd_emu10k1_pm |
269 | #else | 269 | #else |
270 | #define SND_EMU10K1_PM_OPS NULL | 270 | #define SND_EMU10K1_PM_OPS NULL |
271 | #endif /* CONFIG_PM */ | 271 | #endif /* CONFIG_PM_SLEEP */ |
272 | 272 | ||
273 | static struct pci_driver emu10k1_driver = { | 273 | static struct pci_driver emu10k1_driver = { |
274 | .name = KBUILD_MODNAME, | 274 | .name = KBUILD_MODNAME, |
diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c index a0afa5057488..cae36597aa71 100644 --- a/sound/pci/emu10k1/emu10k1_callback.c +++ b/sound/pci/emu10k1/emu10k1_callback.c | |||
@@ -228,7 +228,7 @@ lookup_voices(struct snd_emux *emu, struct snd_emu10k1 *hw, | |||
228 | int i; | 228 | int i; |
229 | 229 | ||
230 | for (i = 0; i < V_END; i++) { | 230 | for (i = 0; i < V_END; i++) { |
231 | best[i].time = (unsigned int)-1; /* XXX MAX_?INT really */; | 231 | best[i].time = (unsigned int)-1; /* XXX MAX_?INT really */ |
232 | best[i].voice = -1; | 232 | best[i].voice = -1; |
233 | } | 233 | } |
234 | 234 | ||
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 754924081d0a..bed4485f34f6 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -1241,7 +1241,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) | |||
1241 | * Create the EMU10K1 instance | 1241 | * Create the EMU10K1 instance |
1242 | */ | 1242 | */ |
1243 | 1243 | ||
1244 | #ifdef CONFIG_PM | 1244 | #ifdef CONFIG_PM_SLEEP |
1245 | static int alloc_pm_buffer(struct snd_emu10k1 *emu); | 1245 | static int alloc_pm_buffer(struct snd_emu10k1 *emu); |
1246 | static void free_pm_buffer(struct snd_emu10k1 *emu); | 1246 | static void free_pm_buffer(struct snd_emu10k1 *emu); |
1247 | #endif | 1247 | #endif |
@@ -1275,7 +1275,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) | |||
1275 | snd_dma_free_pages(&emu->ptb_pages); | 1275 | snd_dma_free_pages(&emu->ptb_pages); |
1276 | vfree(emu->page_ptr_table); | 1276 | vfree(emu->page_ptr_table); |
1277 | vfree(emu->page_addr_table); | 1277 | vfree(emu->page_addr_table); |
1278 | #ifdef CONFIG_PM | 1278 | #ifdef CONFIG_PM_SLEEP |
1279 | free_pm_buffer(emu); | 1279 | free_pm_buffer(emu); |
1280 | #endif | 1280 | #endif |
1281 | if (emu->port) | 1281 | if (emu->port) |
@@ -1971,7 +1971,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, | |||
1971 | err = snd_emu10k1_init(emu, enable_ir, 0); | 1971 | err = snd_emu10k1_init(emu, enable_ir, 0); |
1972 | if (err < 0) | 1972 | if (err < 0) |
1973 | goto error; | 1973 | goto error; |
1974 | #ifdef CONFIG_PM | 1974 | #ifdef CONFIG_PM_SLEEP |
1975 | err = alloc_pm_buffer(emu); | 1975 | err = alloc_pm_buffer(emu); |
1976 | if (err < 0) | 1976 | if (err < 0) |
1977 | goto error; | 1977 | goto error; |
@@ -2000,7 +2000,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, | |||
2000 | return err; | 2000 | return err; |
2001 | } | 2001 | } |
2002 | 2002 | ||
2003 | #ifdef CONFIG_PM | 2003 | #ifdef CONFIG_PM_SLEEP |
2004 | static unsigned char saved_regs[] = { | 2004 | static unsigned char saved_regs[] = { |
2005 | CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP, | 2005 | CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP, |
2006 | FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL, | 2006 | FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL, |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 5c8978b2c4d9..556fd6f456e3 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -830,9 +830,22 @@ static irqreturn_t snd_emu10k1x_interrupt(int irq, void *dev_id) | |||
830 | return IRQ_HANDLED; | 830 | return IRQ_HANDLED; |
831 | } | 831 | } |
832 | 832 | ||
833 | static const struct snd_pcm_chmap_elem surround_map[] = { | ||
834 | { .channels = 2, | ||
835 | .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, | ||
836 | { } | ||
837 | }; | ||
838 | |||
839 | static const struct snd_pcm_chmap_elem clfe_map[] = { | ||
840 | { .channels = 2, | ||
841 | .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, | ||
842 | { } | ||
843 | }; | ||
844 | |||
833 | static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm) | 845 | static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm) |
834 | { | 846 | { |
835 | struct snd_pcm *pcm; | 847 | struct snd_pcm *pcm; |
848 | const struct snd_pcm_chmap_elem *map = NULL; | ||
836 | int err; | 849 | int err; |
837 | int capture = 0; | 850 | int capture = 0; |
838 | 851 | ||
@@ -861,12 +874,15 @@ static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct s | |||
861 | switch(device) { | 874 | switch(device) { |
862 | case 0: | 875 | case 0: |
863 | strcpy(pcm->name, "EMU10K1X Front"); | 876 | strcpy(pcm->name, "EMU10K1X Front"); |
877 | map = snd_pcm_std_chmaps; | ||
864 | break; | 878 | break; |
865 | case 1: | 879 | case 1: |
866 | strcpy(pcm->name, "EMU10K1X Rear"); | 880 | strcpy(pcm->name, "EMU10K1X Rear"); |
881 | map = surround_map; | ||
867 | break; | 882 | break; |
868 | case 2: | 883 | case 2: |
869 | strcpy(pcm->name, "EMU10K1X Center/LFE"); | 884 | strcpy(pcm->name, "EMU10K1X Center/LFE"); |
885 | map = clfe_map; | ||
870 | break; | 886 | break; |
871 | } | 887 | } |
872 | emu->pcm = pcm; | 888 | emu->pcm = pcm; |
@@ -875,6 +891,11 @@ static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct s | |||
875 | snd_dma_pci_data(emu->pci), | 891 | snd_dma_pci_data(emu->pci), |
876 | 32*1024, 32*1024); | 892 | 32*1024, 32*1024); |
877 | 893 | ||
894 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, | ||
895 | 1 << 2, NULL); | ||
896 | if (err < 0) | ||
897 | return err; | ||
898 | |||
878 | if (rpcm) | 899 | if (rpcm) |
879 | *rpcm = pcm; | 900 | *rpcm = pcm; |
880 | 901 | ||
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index dae4050ede5c..52419959178c 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -2646,7 +2646,7 @@ int __devinit snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct | |||
2646 | return 0; | 2646 | return 0; |
2647 | } | 2647 | } |
2648 | 2648 | ||
2649 | #ifdef CONFIG_PM | 2649 | #ifdef CONFIG_PM_SLEEP |
2650 | int __devinit snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu) | 2650 | int __devinit snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu) |
2651 | { | 2651 | { |
2652 | int len; | 2652 | int len; |
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index e22b8e2bbd88..0e6664fa6cd9 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -1310,7 +1310,7 @@ static int snd_emu10k1_capture_efx_open(struct snd_pcm_substream *substream) | |||
1310 | runtime->hw.channels_min = | 1310 | runtime->hw.channels_min = |
1311 | runtime->hw.channels_max = 16; | 1311 | runtime->hw.channels_max = 16; |
1312 | break; | 1312 | break; |
1313 | }; | 1313 | } |
1314 | #endif | 1314 | #endif |
1315 | #if 0 | 1315 | #if 0 |
1316 | /* For 96kHz */ | 1316 | /* For 96kHz */ |
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c index 0a436626182b..ae709c1ab3a8 100644 --- a/sound/pci/emu10k1/memory.c +++ b/sound/pci/emu10k1/memory.c | |||
@@ -263,8 +263,8 @@ int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *b | |||
263 | spin_lock_irqsave(&emu->memblk_lock, flags); | 263 | spin_lock_irqsave(&emu->memblk_lock, flags); |
264 | if (blk->mapped_page >= 0) { | 264 | if (blk->mapped_page >= 0) { |
265 | /* update order link */ | 265 | /* update order link */ |
266 | list_del(&blk->mapped_order_link); | 266 | list_move_tail(&blk->mapped_order_link, |
267 | list_add_tail(&blk->mapped_order_link, &emu->mapped_order_link_head); | 267 | &emu->mapped_order_link_head); |
268 | spin_unlock_irqrestore(&emu->memblk_lock, flags); | 268 | spin_unlock_irqrestore(&emu->memblk_lock, flags); |
269 | return 0; | 269 | return 0; |
270 | } | 270 | } |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index a81dc44228ea..88cec6b7dd41 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -893,7 +893,7 @@ int __devinit snd_p16v_mixer(struct snd_emu10k1 *emu) | |||
893 | return 0; | 893 | return 0; |
894 | } | 894 | } |
895 | 895 | ||
896 | #ifdef CONFIG_PM | 896 | #ifdef CONFIG_PM_SLEEP |
897 | 897 | ||
898 | #define NUM_CHS 1 /* up to 4, but only first channel is used */ | 898 | #define NUM_CHS 1 /* up to 4, but only first channel is used */ |
899 | 899 | ||
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index f7e6f73186e1..5674cc316530 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -55,8 +55,10 @@ | |||
55 | 55 | ||
56 | #ifdef CHIP1370 | 56 | #ifdef CHIP1370 |
57 | #define DRIVER_NAME "ENS1370" | 57 | #define DRIVER_NAME "ENS1370" |
58 | #define CHIP_NAME "ES1370" /* it can be ENS but just to keep compatibility... */ | ||
58 | #else | 59 | #else |
59 | #define DRIVER_NAME "ENS1371" | 60 | #define DRIVER_NAME "ENS1371" |
61 | #define CHIP_NAME "ES1371" | ||
60 | #endif | 62 | #endif |
61 | 63 | ||
62 | 64 | ||
@@ -1258,6 +1260,14 @@ static struct snd_pcm_ops snd_ensoniq_capture_ops = { | |||
1258 | .pointer = snd_ensoniq_capture_pointer, | 1260 | .pointer = snd_ensoniq_capture_pointer, |
1259 | }; | 1261 | }; |
1260 | 1262 | ||
1263 | static const struct snd_pcm_chmap_elem surround_map[] = { | ||
1264 | { .channels = 1, | ||
1265 | .map = { SNDRV_CHMAP_MONO } }, | ||
1266 | { .channels = 2, | ||
1267 | .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, | ||
1268 | { } | ||
1269 | }; | ||
1270 | |||
1261 | static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | 1271 | static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, |
1262 | struct snd_pcm ** rpcm) | 1272 | struct snd_pcm ** rpcm) |
1263 | { | 1273 | { |
@@ -1266,11 +1276,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | |||
1266 | 1276 | ||
1267 | if (rpcm) | 1277 | if (rpcm) |
1268 | *rpcm = NULL; | 1278 | *rpcm = NULL; |
1269 | #ifdef CHIP1370 | 1279 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); |
1270 | err = snd_pcm_new(ensoniq->card, "ES1370/1", device, 1, 1, &pcm); | ||
1271 | #else | ||
1272 | err = snd_pcm_new(ensoniq->card, "ES1371/1", device, 1, 1, &pcm); | ||
1273 | #endif | ||
1274 | if (err < 0) | 1280 | if (err < 0) |
1275 | return err; | 1281 | return err; |
1276 | 1282 | ||
@@ -1283,16 +1289,22 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | |||
1283 | 1289 | ||
1284 | pcm->private_data = ensoniq; | 1290 | pcm->private_data = ensoniq; |
1285 | pcm->info_flags = 0; | 1291 | pcm->info_flags = 0; |
1286 | #ifdef CHIP1370 | 1292 | strcpy(pcm->name, CHIP_NAME " DAC2/ADC"); |
1287 | strcpy(pcm->name, "ES1370 DAC2/ADC"); | ||
1288 | #else | ||
1289 | strcpy(pcm->name, "ES1371 DAC2/ADC"); | ||
1290 | #endif | ||
1291 | ensoniq->pcm1 = pcm; | 1293 | ensoniq->pcm1 = pcm; |
1292 | 1294 | ||
1293 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1295 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1294 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); | 1296 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); |
1295 | 1297 | ||
1298 | #ifdef CHIP1370 | ||
1299 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1300 | surround_map, 2, 0, NULL); | ||
1301 | #else | ||
1302 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1303 | snd_pcm_std_chmaps, 2, 0, NULL); | ||
1304 | #endif | ||
1305 | if (err < 0) | ||
1306 | return err; | ||
1307 | |||
1296 | if (rpcm) | 1308 | if (rpcm) |
1297 | *rpcm = pcm; | 1309 | *rpcm = pcm; |
1298 | return 0; | 1310 | return 0; |
@@ -1306,11 +1318,7 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, | |||
1306 | 1318 | ||
1307 | if (rpcm) | 1319 | if (rpcm) |
1308 | *rpcm = NULL; | 1320 | *rpcm = NULL; |
1309 | #ifdef CHIP1370 | 1321 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); |
1310 | err = snd_pcm_new(ensoniq->card, "ES1370/2", device, 1, 0, &pcm); | ||
1311 | #else | ||
1312 | err = snd_pcm_new(ensoniq->card, "ES1371/2", device, 1, 0, &pcm); | ||
1313 | #endif | ||
1314 | if (err < 0) | 1322 | if (err < 0) |
1315 | return err; | 1323 | return err; |
1316 | 1324 | ||
@@ -1321,16 +1329,22 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, | |||
1321 | #endif | 1329 | #endif |
1322 | pcm->private_data = ensoniq; | 1330 | pcm->private_data = ensoniq; |
1323 | pcm->info_flags = 0; | 1331 | pcm->info_flags = 0; |
1324 | #ifdef CHIP1370 | 1332 | strcpy(pcm->name, CHIP_NAME " DAC1"); |
1325 | strcpy(pcm->name, "ES1370 DAC1"); | ||
1326 | #else | ||
1327 | strcpy(pcm->name, "ES1371 DAC1"); | ||
1328 | #endif | ||
1329 | ensoniq->pcm2 = pcm; | 1333 | ensoniq->pcm2 = pcm; |
1330 | 1334 | ||
1331 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1335 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1332 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); | 1336 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); |
1333 | 1337 | ||
1338 | #ifdef CHIP1370 | ||
1339 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1340 | snd_pcm_std_chmaps, 2, 0, NULL); | ||
1341 | #else | ||
1342 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1343 | surround_map, 2, 0, NULL); | ||
1344 | #endif | ||
1345 | if (err < 0) | ||
1346 | return err; | ||
1347 | |||
1334 | if (rpcm) | 1348 | if (rpcm) |
1335 | *rpcm = pcm; | 1349 | *rpcm = pcm; |
1336 | return 0; | 1350 | return 0; |
@@ -1885,11 +1899,7 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry, | |||
1885 | { | 1899 | { |
1886 | struct ensoniq *ensoniq = entry->private_data; | 1900 | struct ensoniq *ensoniq = entry->private_data; |
1887 | 1901 | ||
1888 | #ifdef CHIP1370 | 1902 | snd_iprintf(buffer, "Ensoniq AudioPCI " CHIP_NAME "\n\n"); |
1889 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1370\n\n"); | ||
1890 | #else | ||
1891 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1371\n\n"); | ||
1892 | #endif | ||
1893 | snd_iprintf(buffer, "Joystick enable : %s\n", | 1903 | snd_iprintf(buffer, "Joystick enable : %s\n", |
1894 | ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); | 1904 | ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); |
1895 | #ifdef CHIP1370 | 1905 | #ifdef CHIP1370 |
@@ -2032,7 +2042,7 @@ static void snd_ensoniq_chip_init(struct ensoniq *ensoniq) | |||
2032 | synchronize_irq(ensoniq->irq); | 2042 | synchronize_irq(ensoniq->irq); |
2033 | } | 2043 | } |
2034 | 2044 | ||
2035 | #ifdef CONFIG_PM | 2045 | #ifdef CONFIG_PM_SLEEP |
2036 | static int snd_ensoniq_suspend(struct device *dev) | 2046 | static int snd_ensoniq_suspend(struct device *dev) |
2037 | { | 2047 | { |
2038 | struct pci_dev *pci = to_pci_dev(dev); | 2048 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -2094,7 +2104,7 @@ static SIMPLE_DEV_PM_OPS(snd_ensoniq_pm, snd_ensoniq_suspend, snd_ensoniq_resume | |||
2094 | #define SND_ENSONIQ_PM_OPS &snd_ensoniq_pm | 2104 | #define SND_ENSONIQ_PM_OPS &snd_ensoniq_pm |
2095 | #else | 2105 | #else |
2096 | #define SND_ENSONIQ_PM_OPS NULL | 2106 | #define SND_ENSONIQ_PM_OPS NULL |
2097 | #endif /* CONFIG_PM */ | 2107 | #endif /* CONFIG_PM_SLEEP */ |
2098 | 2108 | ||
2099 | static int __devinit snd_ensoniq_create(struct snd_card *card, | 2109 | static int __devinit snd_ensoniq_create(struct snd_card *card, |
2100 | struct pci_dev *pci, | 2110 | struct pci_dev *pci, |
@@ -2361,11 +2371,7 @@ static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device, | |||
2361 | *rrawmidi = NULL; | 2371 | *rrawmidi = NULL; |
2362 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) | 2372 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) |
2363 | return err; | 2373 | return err; |
2364 | #ifdef CHIP1370 | 2374 | strcpy(rmidi->name, CHIP_NAME); |
2365 | strcpy(rmidi->name, "ES1370"); | ||
2366 | #else | ||
2367 | strcpy(rmidi->name, "ES1371"); | ||
2368 | #endif | ||
2369 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); | 2375 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); |
2370 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); | 2376 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); |
2371 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | | 2377 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index dbb81807bc1a..394c5d413530 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -236,7 +236,7 @@ struct es1938 { | |||
236 | #ifdef SUPPORT_JOYSTICK | 236 | #ifdef SUPPORT_JOYSTICK |
237 | struct gameport *gameport; | 237 | struct gameport *gameport; |
238 | #endif | 238 | #endif |
239 | #ifdef CONFIG_PM | 239 | #ifdef CONFIG_PM_SLEEP |
240 | unsigned char saved_regs[SAVED_REG_SIZE]; | 240 | unsigned char saved_regs[SAVED_REG_SIZE]; |
241 | #endif | 241 | #endif |
242 | }; | 242 | }; |
@@ -1456,7 +1456,7 @@ static void snd_es1938_chip_init(struct es1938 *chip) | |||
1456 | outb(0, SLDM_REG(chip, DMACLEAR)); | 1456 | outb(0, SLDM_REG(chip, DMACLEAR)); |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | #ifdef CONFIG_PM | 1459 | #ifdef CONFIG_PM_SLEEP |
1460 | /* | 1460 | /* |
1461 | * PM support | 1461 | * PM support |
1462 | */ | 1462 | */ |
@@ -1536,7 +1536,7 @@ static SIMPLE_DEV_PM_OPS(es1938_pm, es1938_suspend, es1938_resume); | |||
1536 | #define ES1938_PM_OPS &es1938_pm | 1536 | #define ES1938_PM_OPS &es1938_pm |
1537 | #else | 1537 | #else |
1538 | #define ES1938_PM_OPS NULL | 1538 | #define ES1938_PM_OPS NULL |
1539 | #endif /* CONFIG_PM */ | 1539 | #endif /* CONFIG_PM_SLEEP */ |
1540 | 1540 | ||
1541 | #ifdef SUPPORT_JOYSTICK | 1541 | #ifdef SUPPORT_JOYSTICK |
1542 | static int __devinit snd_es1938_create_gameport(struct es1938 *chip) | 1542 | static int __devinit snd_es1938_create_gameport(struct es1938 *chip) |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index fb4c90b99c00..5d0e568fdea1 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -491,7 +491,7 @@ struct esschan { | |||
491 | /* linked list */ | 491 | /* linked list */ |
492 | struct list_head list; | 492 | struct list_head list; |
493 | 493 | ||
494 | #ifdef CONFIG_PM | 494 | #ifdef CONFIG_PM_SLEEP |
495 | u16 wc_map[4]; | 495 | u16 wc_map[4]; |
496 | #endif | 496 | #endif |
497 | }; | 497 | }; |
@@ -544,7 +544,7 @@ struct es1968 { | |||
544 | struct list_head substream_list; | 544 | struct list_head substream_list; |
545 | spinlock_t substream_lock; | 545 | spinlock_t substream_lock; |
546 | 546 | ||
547 | #ifdef CONFIG_PM | 547 | #ifdef CONFIG_PM_SLEEP |
548 | u16 apu_map[NR_APUS][NR_APU_REGS]; | 548 | u16 apu_map[NR_APUS][NR_APU_REGS]; |
549 | #endif | 549 | #endif |
550 | 550 | ||
@@ -706,7 +706,7 @@ static void __apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 dat | |||
706 | { | 706 | { |
707 | if (snd_BUG_ON(channel >= NR_APUS)) | 707 | if (snd_BUG_ON(channel >= NR_APUS)) |
708 | return; | 708 | return; |
709 | #ifdef CONFIG_PM | 709 | #ifdef CONFIG_PM_SLEEP |
710 | chip->apu_map[channel][reg] = data; | 710 | chip->apu_map[channel][reg] = data; |
711 | #endif | 711 | #endif |
712 | reg |= (channel << 4); | 712 | reg |= (channel << 4); |
@@ -993,7 +993,7 @@ static void snd_es1968_program_wavecache(struct es1968 *chip, struct esschan *es | |||
993 | /* set the wavecache control reg */ | 993 | /* set the wavecache control reg */ |
994 | wave_set_register(chip, es->apu[channel] << 3, tmpval); | 994 | wave_set_register(chip, es->apu[channel] << 3, tmpval); |
995 | 995 | ||
996 | #ifdef CONFIG_PM | 996 | #ifdef CONFIG_PM_SLEEP |
997 | es->wc_map[channel] = tmpval; | 997 | es->wc_map[channel] = tmpval; |
998 | #endif | 998 | #endif |
999 | } | 999 | } |
@@ -2377,7 +2377,7 @@ static void snd_es1968_start_irq(struct es1968 *chip) | |||
2377 | outw(w, chip->io_port + ESM_PORT_HOST_IRQ); | 2377 | outw(w, chip->io_port + ESM_PORT_HOST_IRQ); |
2378 | } | 2378 | } |
2379 | 2379 | ||
2380 | #ifdef CONFIG_PM | 2380 | #ifdef CONFIG_PM_SLEEP |
2381 | /* | 2381 | /* |
2382 | * PM support | 2382 | * PM support |
2383 | */ | 2383 | */ |
@@ -2461,7 +2461,7 @@ static SIMPLE_DEV_PM_OPS(es1968_pm, es1968_suspend, es1968_resume); | |||
2461 | #define ES1968_PM_OPS &es1968_pm | 2461 | #define ES1968_PM_OPS &es1968_pm |
2462 | #else | 2462 | #else |
2463 | #define ES1968_PM_OPS NULL | 2463 | #define ES1968_PM_OPS NULL |
2464 | #endif /* CONFIG_PM */ | 2464 | #endif /* CONFIG_PM_SLEEP */ |
2465 | 2465 | ||
2466 | #ifdef SUPPORT_JOYSTICK | 2466 | #ifdef SUPPORT_JOYSTICK |
2467 | #define JOYSTICK_ADDR 0x200 | 2467 | #define JOYSTICK_ADDR 0x200 |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 522c8706f244..cc2e91d15538 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -205,7 +205,7 @@ struct fm801 { | |||
205 | struct snd_tea575x tea; | 205 | struct snd_tea575x tea; |
206 | #endif | 206 | #endif |
207 | 207 | ||
208 | #ifdef CONFIG_PM | 208 | #ifdef CONFIG_PM_SLEEP |
209 | u16 saved_regs[0x20]; | 209 | u16 saved_regs[0x20]; |
210 | #endif | 210 | #endif |
211 | }; | 211 | }; |
@@ -711,6 +711,13 @@ static int __devinit snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pc | |||
711 | snd_dma_pci_data(chip->pci), | 711 | snd_dma_pci_data(chip->pci), |
712 | chip->multichannel ? 128*1024 : 64*1024, 128*1024); | 712 | chip->multichannel ? 128*1024 : 64*1024, 128*1024); |
713 | 713 | ||
714 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
715 | snd_pcm_alt_chmaps, | ||
716 | chip->multichannel ? 6 : 2, 0, | ||
717 | NULL); | ||
718 | if (err < 0) | ||
719 | return err; | ||
720 | |||
714 | if (rpcm) | 721 | if (rpcm) |
715 | *rpcm = pcm; | 722 | *rpcm = pcm; |
716 | return 0; | 723 | return 0; |
@@ -1361,7 +1368,7 @@ static void __devexit snd_card_fm801_remove(struct pci_dev *pci) | |||
1361 | pci_set_drvdata(pci, NULL); | 1368 | pci_set_drvdata(pci, NULL); |
1362 | } | 1369 | } |
1363 | 1370 | ||
1364 | #ifdef CONFIG_PM | 1371 | #ifdef CONFIG_PM_SLEEP |
1365 | static unsigned char saved_regs[] = { | 1372 | static unsigned char saved_regs[] = { |
1366 | FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC, | 1373 | FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC, |
1367 | FM801_PLY_CTRL, FM801_PLY_COUNT, FM801_PLY_BUF1, FM801_PLY_BUF2, | 1374 | FM801_PLY_CTRL, FM801_PLY_COUNT, FM801_PLY_BUF1, FM801_PLY_BUF2, |
@@ -1421,7 +1428,7 @@ static SIMPLE_DEV_PM_OPS(snd_fm801_pm, snd_fm801_suspend, snd_fm801_resume); | |||
1421 | #define SND_FM801_PM_OPS &snd_fm801_pm | 1428 | #define SND_FM801_PM_OPS &snd_fm801_pm |
1422 | #else | 1429 | #else |
1423 | #define SND_FM801_PM_OPS NULL | 1430 | #define SND_FM801_PM_OPS NULL |
1424 | #endif /* CONFIG_PM */ | 1431 | #endif /* CONFIG_PM_SLEEP */ |
1425 | 1432 | ||
1426 | static struct pci_driver fm801_driver = { | 1433 | static struct pci_driver fm801_driver = { |
1427 | .name = KBUILD_MODNAME, | 1434 | .name = KBUILD_MODNAME, |
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index 194d625c1f83..7105c3de1bca 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -228,17 +228,9 @@ config SND_HDA_GENERIC | |||
228 | Say Y here to enable the generic HD-audio codec parser | 228 | Say Y here to enable the generic HD-audio codec parser |
229 | in snd-hda-intel driver. | 229 | in snd-hda-intel driver. |
230 | 230 | ||
231 | config SND_HDA_POWER_SAVE | ||
232 | bool "Aggressive power-saving on HD-audio" | ||
233 | depends on PM | ||
234 | help | ||
235 | Say Y here to enable more aggressive power-saving mode on | ||
236 | HD-audio driver. The power-saving timeout can be configured | ||
237 | via power_save option or over sysfs on-the-fly. | ||
238 | |||
239 | config SND_HDA_POWER_SAVE_DEFAULT | 231 | config SND_HDA_POWER_SAVE_DEFAULT |
240 | int "Default time-out for HD-audio power-save mode" | 232 | int "Default time-out for HD-audio power-save mode" |
241 | depends on SND_HDA_POWER_SAVE | 233 | depends on PM |
242 | default 0 | 234 | default 0 |
243 | help | 235 | help |
244 | The default time-out value in seconds for HD-audio automatic | 236 | The default time-out value in seconds for HD-audio automatic |
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 4f7d2dfcef7b..4ec6dc88b7f8 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c | |||
@@ -141,7 +141,6 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, | |||
141 | memset(sequences_hp, 0, sizeof(sequences_hp)); | 141 | memset(sequences_hp, 0, sizeof(sequences_hp)); |
142 | assoc_line_out = 0; | 142 | assoc_line_out = 0; |
143 | 143 | ||
144 | codec->ignore_misc_bit = true; | ||
145 | end_nid = codec->start_nid + codec->num_nodes; | 144 | end_nid = codec->start_nid + codec->num_nodes; |
146 | for (nid = codec->start_nid; nid < end_nid; nid++) { | 145 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
147 | unsigned int wid_caps = get_wcaps(codec, nid); | 146 | unsigned int wid_caps = get_wcaps(codec, nid); |
@@ -157,9 +156,6 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, | |||
157 | continue; | 156 | continue; |
158 | 157 | ||
159 | def_conf = snd_hda_codec_get_pincfg(codec, nid); | 158 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
160 | if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & | ||
161 | AC_DEFCFG_MISC_NO_PRESENCE)) | ||
162 | codec->ignore_misc_bit = false; | ||
163 | conn = get_defcfg_connect(def_conf); | 159 | conn = get_defcfg_connect(def_conf); |
164 | if (conn == AC_JACK_PORT_NONE) | 160 | if (conn == AC_JACK_PORT_NONE) |
165 | continue; | 161 | continue; |
@@ -502,6 +498,38 @@ static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins, | |||
502 | return channel_sfx[i]; | 498 | return channel_sfx[i]; |
503 | } | 499 | } |
504 | 500 | ||
501 | static const char *check_output_pfx(struct hda_codec *codec, hda_nid_t nid) | ||
502 | { | ||
503 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
504 | int attr = snd_hda_get_input_pin_attr(def_conf); | ||
505 | |||
506 | /* check the location */ | ||
507 | switch (attr) { | ||
508 | case INPUT_PIN_ATTR_DOCK: | ||
509 | return "Dock "; | ||
510 | case INPUT_PIN_ATTR_FRONT: | ||
511 | return "Front "; | ||
512 | } | ||
513 | return ""; | ||
514 | } | ||
515 | |||
516 | static int get_hp_label_index(struct hda_codec *codec, hda_nid_t nid, | ||
517 | const hda_nid_t *pins, int num_pins) | ||
518 | { | ||
519 | int i, j, idx = 0; | ||
520 | |||
521 | const char *pfx = check_output_pfx(codec, nid); | ||
522 | |||
523 | i = find_idx_in_nid_list(nid, pins, num_pins); | ||
524 | if (i < 0) | ||
525 | return -1; | ||
526 | for (j = 0; j < i; j++) | ||
527 | if (pfx == check_output_pfx(codec, pins[j])) | ||
528 | idx++; | ||
529 | |||
530 | return idx; | ||
531 | } | ||
532 | |||
505 | static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, | 533 | static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, |
506 | const struct auto_pin_cfg *cfg, | 534 | const struct auto_pin_cfg *cfg, |
507 | const char *name, char *label, int maxlen, | 535 | const char *name, char *label, int maxlen, |
@@ -509,20 +537,13 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, | |||
509 | { | 537 | { |
510 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); | 538 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
511 | int attr = snd_hda_get_input_pin_attr(def_conf); | 539 | int attr = snd_hda_get_input_pin_attr(def_conf); |
512 | const char *pfx = "", *sfx = ""; | 540 | const char *pfx, *sfx = ""; |
513 | 541 | ||
514 | /* handle as a speaker if it's a fixed line-out */ | 542 | /* handle as a speaker if it's a fixed line-out */ |
515 | if (!strcmp(name, "Line Out") && attr == INPUT_PIN_ATTR_INT) | 543 | if (!strcmp(name, "Line Out") && attr == INPUT_PIN_ATTR_INT) |
516 | name = "Speaker"; | 544 | name = "Speaker"; |
517 | /* check the location */ | 545 | pfx = check_output_pfx(codec, nid); |
518 | switch (attr) { | 546 | |
519 | case INPUT_PIN_ATTR_DOCK: | ||
520 | pfx = "Dock "; | ||
521 | break; | ||
522 | case INPUT_PIN_ATTR_FRONT: | ||
523 | pfx = "Front "; | ||
524 | break; | ||
525 | } | ||
526 | if (cfg) { | 547 | if (cfg) { |
527 | /* try to give a unique suffix if needed */ | 548 | /* try to give a unique suffix if needed */ |
528 | sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs, | 549 | sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs, |
@@ -532,8 +553,8 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, | |||
532 | indexp); | 553 | indexp); |
533 | if (!sfx) { | 554 | if (!sfx) { |
534 | /* don't add channel suffix for Headphone controls */ | 555 | /* don't add channel suffix for Headphone controls */ |
535 | int idx = find_idx_in_nid_list(nid, cfg->hp_pins, | 556 | int idx = get_hp_label_index(codec, nid, cfg->hp_pins, |
536 | cfg->hp_outs); | 557 | cfg->hp_outs); |
537 | if (idx >= 0) | 558 | if (idx >= 0) |
538 | *indexp = idx; | 559 | *indexp = idx; |
539 | sfx = ""; | 560 | sfx = ""; |
@@ -739,7 +760,8 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
739 | for (q = quirk; q->subvendor; q++) { | 760 | for (q = quirk; q->subvendor; q++) { |
740 | unsigned int vendorid = | 761 | unsigned int vendorid = |
741 | q->subdevice | (q->subvendor << 16); | 762 | q->subdevice | (q->subvendor << 16); |
742 | if (vendorid == codec->subsystem_id) { | 763 | unsigned int mask = 0xffff0000 | q->subdevice_mask; |
764 | if ((codec->subsystem_id & mask) == (vendorid & mask)) { | ||
743 | id = q->value; | 765 | id = q->value; |
744 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 766 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
745 | name = q->name; | 767 | name = q->name; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 1c65cc5e3a31..c0ab72cbeed1 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -94,13 +94,19 @@ int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) | |||
94 | } | 94 | } |
95 | EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); | 95 | EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); |
96 | 96 | ||
97 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 97 | #ifdef CONFIG_PM |
98 | static void hda_power_work(struct work_struct *work); | 98 | static void hda_power_work(struct work_struct *work); |
99 | static void hda_keep_power_on(struct hda_codec *codec); | 99 | static void hda_keep_power_on(struct hda_codec *codec); |
100 | #define hda_codec_is_power_on(codec) ((codec)->power_on) | 100 | #define hda_codec_is_power_on(codec) ((codec)->power_on) |
101 | static inline void hda_call_pm_notify(struct hda_bus *bus, bool power_up) | ||
102 | { | ||
103 | if (bus->ops.pm_notify) | ||
104 | bus->ops.pm_notify(bus, power_up); | ||
105 | } | ||
101 | #else | 106 | #else |
102 | static inline void hda_keep_power_on(struct hda_codec *codec) {} | 107 | static inline void hda_keep_power_on(struct hda_codec *codec) {} |
103 | #define hda_codec_is_power_on(codec) 1 | 108 | #define hda_codec_is_power_on(codec) 1 |
109 | #define hda_call_pm_notify(bus, state) {} | ||
104 | #endif | 110 | #endif |
105 | 111 | ||
106 | /** | 112 | /** |
@@ -808,7 +814,7 @@ find_codec_preset(struct hda_codec *codec) | |||
808 | { | 814 | { |
809 | struct hda_codec_preset_list *tbl; | 815 | struct hda_codec_preset_list *tbl; |
810 | const struct hda_codec_preset *preset; | 816 | const struct hda_codec_preset *preset; |
811 | int mod_requested = 0; | 817 | unsigned int mod_requested = 0; |
812 | 818 | ||
813 | if (is_generic_config(codec)) | 819 | if (is_generic_config(codec)) |
814 | return NULL; /* use the generic parser */ | 820 | return NULL; /* use the generic parser */ |
@@ -1186,7 +1192,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1186 | return; | 1192 | return; |
1187 | snd_hda_jack_tbl_clear(codec); | 1193 | snd_hda_jack_tbl_clear(codec); |
1188 | restore_init_pincfgs(codec); | 1194 | restore_init_pincfgs(codec); |
1189 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1195 | #ifdef CONFIG_PM |
1190 | cancel_delayed_work(&codec->power_work); | 1196 | cancel_delayed_work(&codec->power_work); |
1191 | flush_workqueue(codec->bus->workq); | 1197 | flush_workqueue(codec->bus->workq); |
1192 | #endif | 1198 | #endif |
@@ -1199,6 +1205,10 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1199 | codec->bus->caddr_tbl[codec->addr] = NULL; | 1205 | codec->bus->caddr_tbl[codec->addr] = NULL; |
1200 | if (codec->patch_ops.free) | 1206 | if (codec->patch_ops.free) |
1201 | codec->patch_ops.free(codec); | 1207 | codec->patch_ops.free(codec); |
1208 | #ifdef CONFIG_PM | ||
1209 | if (!codec->pm_down_notified) /* cancel leftover refcounts */ | ||
1210 | hda_call_pm_notify(codec->bus, false); | ||
1211 | #endif | ||
1202 | module_put(codec->owner); | 1212 | module_put(codec->owner); |
1203 | free_hda_cache(&codec->amp_cache); | 1213 | free_hda_cache(&codec->amp_cache); |
1204 | free_hda_cache(&codec->cmd_cache); | 1214 | free_hda_cache(&codec->cmd_cache); |
@@ -1212,7 +1222,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1212 | static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, | 1222 | static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, |
1213 | hda_nid_t fg, unsigned int power_state); | 1223 | hda_nid_t fg, unsigned int power_state); |
1214 | 1224 | ||
1215 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 1225 | static unsigned int hda_set_power_state(struct hda_codec *codec, |
1216 | unsigned int power_state); | 1226 | unsigned int power_state); |
1217 | 1227 | ||
1218 | /** | 1228 | /** |
@@ -1229,6 +1239,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, | |||
1229 | { | 1239 | { |
1230 | struct hda_codec *codec; | 1240 | struct hda_codec *codec; |
1231 | char component[31]; | 1241 | char component[31]; |
1242 | hda_nid_t fg; | ||
1232 | int err; | 1243 | int err; |
1233 | 1244 | ||
1234 | if (snd_BUG_ON(!bus)) | 1245 | if (snd_BUG_ON(!bus)) |
@@ -1263,7 +1274,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, | |||
1263 | snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64); | 1274 | snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64); |
1264 | snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); | 1275 | snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); |
1265 | 1276 | ||
1266 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1277 | #ifdef CONFIG_PM |
1267 | spin_lock_init(&codec->power_lock); | 1278 | spin_lock_init(&codec->power_lock); |
1268 | INIT_DELAYED_WORK(&codec->power_work, hda_power_work); | 1279 | INIT_DELAYED_WORK(&codec->power_work, hda_power_work); |
1269 | /* snd_hda_codec_new() marks the codec as power-up, and leave it as is. | 1280 | /* snd_hda_codec_new() marks the codec as power-up, and leave it as is. |
@@ -1271,6 +1282,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, | |||
1271 | * phase. | 1282 | * phase. |
1272 | */ | 1283 | */ |
1273 | hda_keep_power_on(codec); | 1284 | hda_keep_power_on(codec); |
1285 | hda_call_pm_notify(bus, true); | ||
1274 | #endif | 1286 | #endif |
1275 | 1287 | ||
1276 | if (codec->bus->modelname) { | 1288 | if (codec->bus->modelname) { |
@@ -1304,7 +1316,8 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, | |||
1304 | goto error; | 1316 | goto error; |
1305 | } | 1317 | } |
1306 | 1318 | ||
1307 | err = read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg); | 1319 | fg = codec->afg ? codec->afg : codec->mfg; |
1320 | err = read_widget_caps(codec, fg); | ||
1308 | if (err < 0) { | 1321 | if (err < 0) { |
1309 | snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); | 1322 | snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); |
1310 | goto error; | 1323 | goto error; |
@@ -1314,20 +1327,22 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, | |||
1314 | goto error; | 1327 | goto error; |
1315 | 1328 | ||
1316 | if (!codec->subsystem_id) { | 1329 | if (!codec->subsystem_id) { |
1317 | hda_nid_t nid = codec->afg ? codec->afg : codec->mfg; | ||
1318 | codec->subsystem_id = | 1330 | codec->subsystem_id = |
1319 | snd_hda_codec_read(codec, nid, 0, | 1331 | snd_hda_codec_read(codec, fg, 0, |
1320 | AC_VERB_GET_SUBSYSTEM_ID, 0); | 1332 | AC_VERB_GET_SUBSYSTEM_ID, 0); |
1321 | } | 1333 | } |
1322 | 1334 | ||
1323 | codec->epss = snd_hda_codec_get_supported_ps(codec, | 1335 | #ifdef CONFIG_PM |
1324 | codec->afg ? codec->afg : codec->mfg, | 1336 | codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec, fg, |
1337 | AC_PWRST_CLKSTOP); | ||
1338 | if (!codec->d3_stop_clk) | ||
1339 | bus->power_keep_link_on = 1; | ||
1340 | #endif | ||
1341 | codec->epss = snd_hda_codec_get_supported_ps(codec, fg, | ||
1325 | AC_PWRST_EPSS); | 1342 | AC_PWRST_EPSS); |
1326 | 1343 | ||
1327 | /* power-up all before initialization */ | 1344 | /* power-up all before initialization */ |
1328 | hda_set_power_state(codec, | 1345 | hda_set_power_state(codec, AC_PWRST_D0); |
1329 | codec->afg ? codec->afg : codec->mfg, | ||
1330 | AC_PWRST_D0); | ||
1331 | 1346 | ||
1332 | snd_hda_codec_proc_new(codec); | 1347 | snd_hda_codec_proc_new(codec); |
1333 | 1348 | ||
@@ -2335,7 +2350,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2335 | 2350 | ||
2336 | /* OK, let it free */ | 2351 | /* OK, let it free */ |
2337 | 2352 | ||
2338 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2353 | #ifdef CONFIG_PM |
2339 | cancel_delayed_work_sync(&codec->power_work); | 2354 | cancel_delayed_work_sync(&codec->power_work); |
2340 | codec->power_on = 0; | 2355 | codec->power_on = 0; |
2341 | codec->power_transition = 0; | 2356 | codec->power_transition = 0; |
@@ -3500,20 +3515,6 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, | |||
3500 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, | 3515 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, |
3501 | power_state); | 3516 | power_state); |
3502 | } | 3517 | } |
3503 | |||
3504 | if (power_state == AC_PWRST_D0) { | ||
3505 | unsigned long end_time; | ||
3506 | int state; | ||
3507 | /* wait until the codec reachs to D0 */ | ||
3508 | end_time = jiffies + msecs_to_jiffies(500); | ||
3509 | do { | ||
3510 | state = snd_hda_codec_read(codec, fg, 0, | ||
3511 | AC_VERB_GET_POWER_STATE, 0); | ||
3512 | if (state == power_state) | ||
3513 | break; | ||
3514 | msleep(1); | ||
3515 | } while (time_after_eq(end_time, jiffies)); | ||
3516 | } | ||
3517 | } | 3518 | } |
3518 | EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all); | 3519 | EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all); |
3519 | 3520 | ||
@@ -3534,18 +3535,40 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg | |||
3534 | } | 3535 | } |
3535 | 3536 | ||
3536 | /* | 3537 | /* |
3537 | * set power state of the codec | 3538 | * wait until the state is reached, returns the current state |
3538 | */ | 3539 | */ |
3539 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 3540 | static unsigned int hda_sync_power_state(struct hda_codec *codec, |
3540 | unsigned int power_state) | 3541 | hda_nid_t fg, |
3542 | unsigned int power_state) | ||
3541 | { | 3543 | { |
3542 | int count; | 3544 | unsigned long end_time = jiffies + msecs_to_jiffies(500); |
3543 | unsigned int state; | 3545 | unsigned int state, actual_state; |
3544 | 3546 | ||
3545 | if (codec->patch_ops.set_power_state) { | 3547 | for (;;) { |
3546 | codec->patch_ops.set_power_state(codec, fg, power_state); | 3548 | state = snd_hda_codec_read(codec, fg, 0, |
3547 | return; | 3549 | AC_VERB_GET_POWER_STATE, 0); |
3550 | if (state & AC_PWRST_ERROR) | ||
3551 | break; | ||
3552 | actual_state = (state >> 4) & 0x0f; | ||
3553 | if (actual_state == power_state) | ||
3554 | break; | ||
3555 | if (time_after_eq(jiffies, end_time)) | ||
3556 | break; | ||
3557 | /* wait until the codec reachs to the target state */ | ||
3558 | msleep(1); | ||
3548 | } | 3559 | } |
3560 | return state; | ||
3561 | } | ||
3562 | |||
3563 | /* | ||
3564 | * set power state of the codec, and return the power state | ||
3565 | */ | ||
3566 | static unsigned int hda_set_power_state(struct hda_codec *codec, | ||
3567 | unsigned int power_state) | ||
3568 | { | ||
3569 | hda_nid_t fg = codec->afg ? codec->afg : codec->mfg; | ||
3570 | int count; | ||
3571 | unsigned int state; | ||
3549 | 3572 | ||
3550 | /* this delay seems necessary to avoid click noise at power-down */ | 3573 | /* this delay seems necessary to avoid click noise at power-down */ |
3551 | if (power_state == AC_PWRST_D3) { | 3574 | if (power_state == AC_PWRST_D3) { |
@@ -3555,14 +3578,22 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
3555 | 3578 | ||
3556 | /* repeat power states setting at most 10 times*/ | 3579 | /* repeat power states setting at most 10 times*/ |
3557 | for (count = 0; count < 10; count++) { | 3580 | for (count = 0; count < 10; count++) { |
3558 | snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, | 3581 | if (codec->patch_ops.set_power_state) |
3559 | power_state); | 3582 | codec->patch_ops.set_power_state(codec, fg, |
3560 | snd_hda_codec_set_power_to_all(codec, fg, power_state, true); | 3583 | power_state); |
3561 | state = snd_hda_codec_read(codec, fg, 0, | 3584 | else { |
3562 | AC_VERB_GET_POWER_STATE, 0); | 3585 | snd_hda_codec_read(codec, fg, 0, |
3586 | AC_VERB_SET_POWER_STATE, | ||
3587 | power_state); | ||
3588 | snd_hda_codec_set_power_to_all(codec, fg, power_state, | ||
3589 | true); | ||
3590 | } | ||
3591 | state = hda_sync_power_state(codec, fg, power_state); | ||
3563 | if (!(state & AC_PWRST_ERROR)) | 3592 | if (!(state & AC_PWRST_ERROR)) |
3564 | break; | 3593 | break; |
3565 | } | 3594 | } |
3595 | |||
3596 | return state; | ||
3566 | } | 3597 | } |
3567 | 3598 | ||
3568 | #ifdef CONFIG_SND_HDA_HWDEP | 3599 | #ifdef CONFIG_SND_HDA_HWDEP |
@@ -3579,17 +3610,19 @@ static inline void hda_exec_init_verbs(struct hda_codec *codec) {} | |||
3579 | #ifdef CONFIG_PM | 3610 | #ifdef CONFIG_PM |
3580 | /* | 3611 | /* |
3581 | * call suspend and power-down; used both from PM and power-save | 3612 | * call suspend and power-down; used both from PM and power-save |
3613 | * this function returns the power state in the end | ||
3582 | */ | 3614 | */ |
3583 | static void hda_call_codec_suspend(struct hda_codec *codec) | 3615 | static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq) |
3584 | { | 3616 | { |
3617 | unsigned int state; | ||
3618 | |||
3585 | if (codec->patch_ops.suspend) | 3619 | if (codec->patch_ops.suspend) |
3586 | codec->patch_ops.suspend(codec); | 3620 | codec->patch_ops.suspend(codec); |
3587 | hda_cleanup_all_streams(codec); | 3621 | hda_cleanup_all_streams(codec); |
3588 | hda_set_power_state(codec, | 3622 | state = hda_set_power_state(codec, AC_PWRST_D3); |
3589 | codec->afg ? codec->afg : codec->mfg, | 3623 | /* Cancel delayed work if we aren't currently running from it. */ |
3590 | AC_PWRST_D3); | 3624 | if (!in_wq) |
3591 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3625 | cancel_delayed_work_sync(&codec->power_work); |
3592 | cancel_delayed_work(&codec->power_work); | ||
3593 | spin_lock(&codec->power_lock); | 3626 | spin_lock(&codec->power_lock); |
3594 | snd_hda_update_power_acct(codec); | 3627 | snd_hda_update_power_acct(codec); |
3595 | trace_hda_power_down(codec); | 3628 | trace_hda_power_down(codec); |
@@ -3597,7 +3630,7 @@ static void hda_call_codec_suspend(struct hda_codec *codec) | |||
3597 | codec->power_transition = 0; | 3630 | codec->power_transition = 0; |
3598 | codec->power_jiffies = jiffies; | 3631 | codec->power_jiffies = jiffies; |
3599 | spin_unlock(&codec->power_lock); | 3632 | spin_unlock(&codec->power_lock); |
3600 | #endif | 3633 | return state; |
3601 | } | 3634 | } |
3602 | 3635 | ||
3603 | /* | 3636 | /* |
@@ -3609,9 +3642,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) | |||
3609 | * in the resume / power-save sequence | 3642 | * in the resume / power-save sequence |
3610 | */ | 3643 | */ |
3611 | hda_keep_power_on(codec); | 3644 | hda_keep_power_on(codec); |
3612 | hda_set_power_state(codec, | 3645 | hda_set_power_state(codec, AC_PWRST_D0); |
3613 | codec->afg ? codec->afg : codec->mfg, | ||
3614 | AC_PWRST_D0); | ||
3615 | restore_pincfgs(codec); /* restore all current pin configs */ | 3646 | restore_pincfgs(codec); /* restore all current pin configs */ |
3616 | restore_shutup_pins(codec); | 3647 | restore_shutup_pins(codec); |
3617 | hda_exec_init_verbs(codec); | 3648 | hda_exec_init_verbs(codec); |
@@ -3624,6 +3655,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) | |||
3624 | snd_hda_codec_resume_amp(codec); | 3655 | snd_hda_codec_resume_amp(codec); |
3625 | snd_hda_codec_resume_cache(codec); | 3656 | snd_hda_codec_resume_cache(codec); |
3626 | } | 3657 | } |
3658 | snd_hda_jack_report_sync(codec); | ||
3627 | snd_hda_power_down(codec); /* flag down before returning */ | 3659 | snd_hda_power_down(codec); /* flag down before returning */ |
3628 | } | 3660 | } |
3629 | #endif /* CONFIG_PM */ | 3661 | #endif /* CONFIG_PM */ |
@@ -3658,6 +3690,36 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) | |||
3658 | } | 3690 | } |
3659 | EXPORT_SYMBOL_HDA(snd_hda_build_controls); | 3691 | EXPORT_SYMBOL_HDA(snd_hda_build_controls); |
3660 | 3692 | ||
3693 | /* | ||
3694 | * add standard channel maps if not specified | ||
3695 | */ | ||
3696 | static int add_std_chmaps(struct hda_codec *codec) | ||
3697 | { | ||
3698 | int i, str, err; | ||
3699 | |||
3700 | for (i = 0; i < codec->num_pcms; i++) { | ||
3701 | for (str = 0; str < 2; str++) { | ||
3702 | struct snd_pcm *pcm = codec->pcm_info[i].pcm; | ||
3703 | struct hda_pcm_stream *hinfo = | ||
3704 | &codec->pcm_info[i].stream[str]; | ||
3705 | struct snd_pcm_chmap *chmap; | ||
3706 | |||
3707 | if (codec->pcm_info[i].own_chmap) | ||
3708 | continue; | ||
3709 | if (!pcm || !hinfo->substreams) | ||
3710 | continue; | ||
3711 | err = snd_pcm_add_chmap_ctls(pcm, str, | ||
3712 | snd_pcm_std_chmaps, | ||
3713 | hinfo->channels_max, | ||
3714 | 0, &chmap); | ||
3715 | if (err < 0) | ||
3716 | return err; | ||
3717 | chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; | ||
3718 | } | ||
3719 | } | ||
3720 | return 0; | ||
3721 | } | ||
3722 | |||
3661 | int snd_hda_codec_build_controls(struct hda_codec *codec) | 3723 | int snd_hda_codec_build_controls(struct hda_codec *codec) |
3662 | { | 3724 | { |
3663 | int err = 0; | 3725 | int err = 0; |
@@ -3669,6 +3731,13 @@ int snd_hda_codec_build_controls(struct hda_codec *codec) | |||
3669 | err = codec->patch_ops.build_controls(codec); | 3731 | err = codec->patch_ops.build_controls(codec); |
3670 | if (err < 0) | 3732 | if (err < 0) |
3671 | return err; | 3733 | return err; |
3734 | |||
3735 | /* we create chmaps here instead of build_pcms */ | ||
3736 | err = add_std_chmaps(codec); | ||
3737 | if (err < 0) | ||
3738 | return err; | ||
3739 | |||
3740 | snd_hda_jack_report_sync(codec); /* call at the last init point */ | ||
3672 | return 0; | 3741 | return 0; |
3673 | } | 3742 | } |
3674 | 3743 | ||
@@ -4211,7 +4280,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) | |||
4211 | * | 4280 | * |
4212 | * This function returns 0 if successful, or a negative error code. | 4281 | * This function returns 0 if successful, or a negative error code. |
4213 | */ | 4282 | */ |
4214 | int __devinit snd_hda_build_pcms(struct hda_bus *bus) | 4283 | int snd_hda_build_pcms(struct hda_bus *bus) |
4215 | { | 4284 | { |
4216 | struct hda_codec *codec; | 4285 | struct hda_codec *codec; |
4217 | 4286 | ||
@@ -4391,12 +4460,13 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, | |||
4391 | } | 4460 | } |
4392 | EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); | 4461 | EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); |
4393 | 4462 | ||
4394 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4463 | #ifdef CONFIG_PM |
4395 | static void hda_power_work(struct work_struct *work) | 4464 | static void hda_power_work(struct work_struct *work) |
4396 | { | 4465 | { |
4397 | struct hda_codec *codec = | 4466 | struct hda_codec *codec = |
4398 | container_of(work, struct hda_codec, power_work.work); | 4467 | container_of(work, struct hda_codec, power_work.work); |
4399 | struct hda_bus *bus = codec->bus; | 4468 | struct hda_bus *bus = codec->bus; |
4469 | unsigned int state; | ||
4400 | 4470 | ||
4401 | spin_lock(&codec->power_lock); | 4471 | spin_lock(&codec->power_lock); |
4402 | if (codec->power_transition > 0) { /* during power-up sequence? */ | 4472 | if (codec->power_transition > 0) { /* during power-up sequence? */ |
@@ -4410,9 +4480,12 @@ static void hda_power_work(struct work_struct *work) | |||
4410 | } | 4480 | } |
4411 | spin_unlock(&codec->power_lock); | 4481 | spin_unlock(&codec->power_lock); |
4412 | 4482 | ||
4413 | hda_call_codec_suspend(codec); | 4483 | state = hda_call_codec_suspend(codec, true); |
4414 | if (bus->ops.pm_notify) | 4484 | codec->pm_down_notified = 0; |
4415 | bus->ops.pm_notify(bus); | 4485 | if (!bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) { |
4486 | codec->pm_down_notified = 1; | ||
4487 | hda_call_pm_notify(bus, false); | ||
4488 | } | ||
4416 | } | 4489 | } |
4417 | 4490 | ||
4418 | static void hda_keep_power_on(struct hda_codec *codec) | 4491 | static void hda_keep_power_on(struct hda_codec *codec) |
@@ -4438,19 +4511,16 @@ void snd_hda_update_power_acct(struct hda_codec *codec) | |||
4438 | /* Transition to powered up, if wait_power_down then wait for a pending | 4511 | /* Transition to powered up, if wait_power_down then wait for a pending |
4439 | * transition to D3 to complete. A pending D3 transition is indicated | 4512 | * transition to D3 to complete. A pending D3 transition is indicated |
4440 | * with power_transition == -1. */ | 4513 | * with power_transition == -1. */ |
4514 | /* call this with codec->power_lock held! */ | ||
4441 | static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) | 4515 | static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) |
4442 | { | 4516 | { |
4443 | struct hda_bus *bus = codec->bus; | 4517 | struct hda_bus *bus = codec->bus; |
4444 | 4518 | ||
4445 | spin_lock(&codec->power_lock); | ||
4446 | codec->power_count++; | ||
4447 | /* Return if power_on or transitioning to power_on, unless currently | 4519 | /* Return if power_on or transitioning to power_on, unless currently |
4448 | * powering down. */ | 4520 | * powering down. */ |
4449 | if ((codec->power_on || codec->power_transition > 0) && | 4521 | if ((codec->power_on || codec->power_transition > 0) && |
4450 | !(wait_power_down && codec->power_transition < 0)) { | 4522 | !(wait_power_down && codec->power_transition < 0)) |
4451 | spin_unlock(&codec->power_lock); | ||
4452 | return; | 4523 | return; |
4453 | } | ||
4454 | spin_unlock(&codec->power_lock); | 4524 | spin_unlock(&codec->power_lock); |
4455 | 4525 | ||
4456 | cancel_delayed_work_sync(&codec->power_work); | 4526 | cancel_delayed_work_sync(&codec->power_work); |
@@ -4462,9 +4532,9 @@ static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) | |||
4462 | if (codec->power_on) { | 4532 | if (codec->power_on) { |
4463 | if (codec->power_transition < 0) | 4533 | if (codec->power_transition < 0) |
4464 | codec->power_transition = 0; | 4534 | codec->power_transition = 0; |
4465 | spin_unlock(&codec->power_lock); | ||
4466 | return; | 4535 | return; |
4467 | } | 4536 | } |
4537 | |||
4468 | trace_hda_power_up(codec); | 4538 | trace_hda_power_up(codec); |
4469 | snd_hda_update_power_acct(codec); | 4539 | snd_hda_update_power_acct(codec); |
4470 | codec->power_on = 1; | 4540 | codec->power_on = 1; |
@@ -4472,71 +4542,54 @@ static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) | |||
4472 | codec->power_transition = 1; /* avoid reentrance */ | 4542 | codec->power_transition = 1; /* avoid reentrance */ |
4473 | spin_unlock(&codec->power_lock); | 4543 | spin_unlock(&codec->power_lock); |
4474 | 4544 | ||
4475 | if (bus->ops.pm_notify) | 4545 | if (codec->pm_down_notified) { |
4476 | bus->ops.pm_notify(bus); | 4546 | codec->pm_down_notified = 0; |
4547 | hda_call_pm_notify(bus, true); | ||
4548 | } | ||
4549 | |||
4477 | hda_call_codec_resume(codec); | 4550 | hda_call_codec_resume(codec); |
4478 | 4551 | ||
4479 | spin_lock(&codec->power_lock); | 4552 | spin_lock(&codec->power_lock); |
4480 | codec->power_transition = 0; | 4553 | codec->power_transition = 0; |
4481 | spin_unlock(&codec->power_lock); | ||
4482 | } | ||
4483 | |||
4484 | /** | ||
4485 | * snd_hda_power_up - Power-up the codec | ||
4486 | * @codec: HD-audio codec | ||
4487 | * | ||
4488 | * Increment the power-up counter and power up the hardware really when | ||
4489 | * not turned on yet. | ||
4490 | */ | ||
4491 | void snd_hda_power_up(struct hda_codec *codec) | ||
4492 | { | ||
4493 | __snd_hda_power_up(codec, false); | ||
4494 | } | 4554 | } |
4495 | EXPORT_SYMBOL_HDA(snd_hda_power_up); | ||
4496 | |||
4497 | /** | ||
4498 | * snd_hda_power_up_d3wait - Power-up the codec after waiting for any pending | ||
4499 | * D3 transition to complete. This differs from snd_hda_power_up() when | ||
4500 | * power_transition == -1. snd_hda_power_up sees this case as a nop, | ||
4501 | * snd_hda_power_up_d3wait waits for the D3 transition to complete then powers | ||
4502 | * back up. | ||
4503 | * @codec: HD-audio codec | ||
4504 | * | ||
4505 | * Cancel any power down operation hapenning on the work queue, then power up. | ||
4506 | */ | ||
4507 | void snd_hda_power_up_d3wait(struct hda_codec *codec) | ||
4508 | { | ||
4509 | /* This will cancel and wait for pending power_work to complete. */ | ||
4510 | __snd_hda_power_up(codec, true); | ||
4511 | } | ||
4512 | EXPORT_SYMBOL_HDA(snd_hda_power_up_d3wait); | ||
4513 | 4555 | ||
4514 | #define power_save(codec) \ | 4556 | #define power_save(codec) \ |
4515 | ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) | 4557 | ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) |
4516 | 4558 | ||
4517 | /** | 4559 | /* Transition to powered down */ |
4518 | * snd_hda_power_down - Power-down the codec | 4560 | static void __snd_hda_power_down(struct hda_codec *codec) |
4519 | * @codec: HD-audio codec | ||
4520 | * | ||
4521 | * Decrement the power-up counter and schedules the power-off work if | ||
4522 | * the counter rearches to zero. | ||
4523 | */ | ||
4524 | void snd_hda_power_down(struct hda_codec *codec) | ||
4525 | { | 4561 | { |
4526 | spin_lock(&codec->power_lock); | 4562 | if (!codec->power_on || codec->power_count || codec->power_transition) |
4527 | --codec->power_count; | ||
4528 | if (!codec->power_on || codec->power_count || codec->power_transition) { | ||
4529 | spin_unlock(&codec->power_lock); | ||
4530 | return; | 4563 | return; |
4531 | } | 4564 | |
4532 | if (power_save(codec)) { | 4565 | if (power_save(codec)) { |
4533 | codec->power_transition = -1; /* avoid reentrance */ | 4566 | codec->power_transition = -1; /* avoid reentrance */ |
4534 | queue_delayed_work(codec->bus->workq, &codec->power_work, | 4567 | queue_delayed_work(codec->bus->workq, &codec->power_work, |
4535 | msecs_to_jiffies(power_save(codec) * 1000)); | 4568 | msecs_to_jiffies(power_save(codec) * 1000)); |
4536 | } | 4569 | } |
4570 | } | ||
4571 | |||
4572 | /** | ||
4573 | * snd_hda_power_save - Power-up/down/sync the codec | ||
4574 | * @codec: HD-audio codec | ||
4575 | * @delta: the counter delta to change | ||
4576 | * | ||
4577 | * Change the power-up counter via @delta, and power up or down the hardware | ||
4578 | * appropriately. For the power-down, queue to the delayed action. | ||
4579 | * Passing zero to @delta means to synchronize the power state. | ||
4580 | */ | ||
4581 | void snd_hda_power_save(struct hda_codec *codec, int delta, bool d3wait) | ||
4582 | { | ||
4583 | spin_lock(&codec->power_lock); | ||
4584 | codec->power_count += delta; | ||
4585 | trace_hda_power_count(codec); | ||
4586 | if (delta > 0) | ||
4587 | __snd_hda_power_up(codec, d3wait); | ||
4588 | else | ||
4589 | __snd_hda_power_down(codec); | ||
4537 | spin_unlock(&codec->power_lock); | 4590 | spin_unlock(&codec->power_lock); |
4538 | } | 4591 | } |
4539 | EXPORT_SYMBOL_HDA(snd_hda_power_down); | 4592 | EXPORT_SYMBOL_HDA(snd_hda_power_save); |
4540 | 4593 | ||
4541 | /** | 4594 | /** |
4542 | * snd_hda_check_amp_list_power - Check the amp list and update the power | 4595 | * snd_hda_check_amp_list_power - Check the amp list and update the power |
@@ -5076,7 +5129,7 @@ int snd_hda_suspend(struct hda_bus *bus) | |||
5076 | 5129 | ||
5077 | list_for_each_entry(codec, &bus->codec_list, list) { | 5130 | list_for_each_entry(codec, &bus->codec_list, list) { |
5078 | if (hda_codec_is_power_on(codec)) | 5131 | if (hda_codec_is_power_on(codec)) |
5079 | hda_call_codec_suspend(codec); | 5132 | hda_call_codec_suspend(codec, false); |
5080 | } | 5133 | } |
5081 | return 0; | 5134 | return 0; |
5082 | } | 5135 | } |
@@ -5087,9 +5140,6 @@ EXPORT_SYMBOL_HDA(snd_hda_suspend); | |||
5087 | * @bus: the HDA bus | 5140 | * @bus: the HDA bus |
5088 | * | 5141 | * |
5089 | * Returns 0 if successful. | 5142 | * Returns 0 if successful. |
5090 | * | ||
5091 | * This function is defined only when POWER_SAVE isn't set. | ||
5092 | * In the power-save mode, the codec is resumed dynamically. | ||
5093 | */ | 5143 | */ |
5094 | int snd_hda_resume(struct hda_bus *bus) | 5144 | int snd_hda_resume(struct hda_bus *bus) |
5095 | { | 5145 | { |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index e5a7e19a8071..507fe8a917b6 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -386,6 +386,10 @@ enum { | |||
386 | /* DIGITAL2 bits */ | 386 | /* DIGITAL2 bits */ |
387 | #define AC_DIG2_CC (0x7f<<0) | 387 | #define AC_DIG2_CC (0x7f<<0) |
388 | 388 | ||
389 | /* DIGITAL3 bits */ | ||
390 | #define AC_DIG3_ICT (0xf<<0) | ||
391 | #define AC_DIG3_KAE (1<<7) | ||
392 | |||
389 | /* Pin widget control - 8bit */ | 393 | /* Pin widget control - 8bit */ |
390 | #define AC_PINCTL_EPT (0x3<<0) | 394 | #define AC_PINCTL_EPT (0x3<<0) |
391 | #define AC_PINCTL_EPT_NATIVE 0 | 395 | #define AC_PINCTL_EPT_NATIVE 0 |
@@ -610,9 +614,9 @@ struct hda_bus_ops { | |||
610 | struct hda_pcm *pcm); | 614 | struct hda_pcm *pcm); |
611 | /* reset bus for retry verb */ | 615 | /* reset bus for retry verb */ |
612 | void (*bus_reset)(struct hda_bus *bus); | 616 | void (*bus_reset)(struct hda_bus *bus); |
613 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 617 | #ifdef CONFIG_PM |
614 | /* notify power-up/down from codec to controller */ | 618 | /* notify power-up/down from codec to controller */ |
615 | void (*pm_notify)(struct hda_bus *bus); | 619 | void (*pm_notify)(struct hda_bus *bus, bool power_up); |
616 | #endif | 620 | #endif |
617 | }; | 621 | }; |
618 | 622 | ||
@@ -708,8 +712,6 @@ struct hda_codec_ops { | |||
708 | #ifdef CONFIG_PM | 712 | #ifdef CONFIG_PM |
709 | int (*suspend)(struct hda_codec *codec); | 713 | int (*suspend)(struct hda_codec *codec); |
710 | int (*resume)(struct hda_codec *codec); | 714 | int (*resume)(struct hda_codec *codec); |
711 | #endif | ||
712 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
713 | int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid); | 715 | int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid); |
714 | #endif | 716 | #endif |
715 | void (*reboot_notify)(struct hda_codec *codec); | 717 | void (*reboot_notify)(struct hda_codec *codec); |
@@ -774,6 +776,7 @@ struct hda_pcm { | |||
774 | unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */ | 776 | unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */ |
775 | int device; /* device number to assign */ | 777 | int device; /* device number to assign */ |
776 | struct snd_pcm *pcm; /* assigned PCM instance */ | 778 | struct snd_pcm *pcm; /* assigned PCM instance */ |
779 | bool own_chmap; /* codec driver provides own channel maps */ | ||
777 | }; | 780 | }; |
778 | 781 | ||
779 | /* codec information */ | 782 | /* codec information */ |
@@ -859,12 +862,13 @@ struct hda_codec { | |||
859 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ | 862 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ |
860 | unsigned int pins_shutup:1; /* pins are shut up */ | 863 | unsigned int pins_shutup:1; /* pins are shut up */ |
861 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ | 864 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ |
862 | unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */ | ||
863 | unsigned int no_jack_detect:1; /* Machine has no jack-detection */ | 865 | unsigned int no_jack_detect:1; /* Machine has no jack-detection */ |
864 | unsigned int pcm_format_first:1; /* PCM format must be set first */ | 866 | unsigned int pcm_format_first:1; /* PCM format must be set first */ |
865 | unsigned int epss:1; /* supporting EPSS? */ | 867 | unsigned int epss:1; /* supporting EPSS? */ |
866 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 868 | #ifdef CONFIG_PM |
867 | unsigned int power_on :1; /* current (global) power-state */ | 869 | unsigned int power_on :1; /* current (global) power-state */ |
870 | unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ | ||
871 | unsigned int pm_down_notified:1; /* PM notified to controller */ | ||
868 | int power_transition; /* power-state in transition */ | 872 | int power_transition; /* power-state in transition */ |
869 | int power_count; /* current (global) power refcount */ | 873 | int power_count; /* current (global) power refcount */ |
870 | struct delayed_work power_work; /* delayed task for powerdown */ | 874 | struct delayed_work power_work; /* delayed task for powerdown */ |
@@ -1042,7 +1046,7 @@ int snd_hda_resume(struct hda_bus *bus); | |||
1042 | static inline | 1046 | static inline |
1043 | int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid) | 1047 | int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
1044 | { | 1048 | { |
1045 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1049 | #ifdef CONFIG_PM |
1046 | if (codec->patch_ops.check_power_status) | 1050 | if (codec->patch_ops.check_power_status) |
1047 | return codec->patch_ops.check_power_status(codec, nid); | 1051 | return codec->patch_ops.check_power_status(codec, nid); |
1048 | #endif | 1052 | #endif |
@@ -1059,22 +1063,70 @@ const char *snd_hda_get_jack_location(u32 cfg); | |||
1059 | /* | 1063 | /* |
1060 | * power saving | 1064 | * power saving |
1061 | */ | 1065 | */ |
1062 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1066 | #ifdef CONFIG_PM |
1063 | void snd_hda_power_up(struct hda_codec *codec); | 1067 | void snd_hda_power_save(struct hda_codec *codec, int delta, bool d3wait); |
1064 | void snd_hda_power_up_d3wait(struct hda_codec *codec); | ||
1065 | void snd_hda_power_down(struct hda_codec *codec); | ||
1066 | void snd_hda_update_power_acct(struct hda_codec *codec); | 1068 | void snd_hda_update_power_acct(struct hda_codec *codec); |
1067 | #else | 1069 | #else |
1068 | static inline void snd_hda_power_up(struct hda_codec *codec) {} | 1070 | static inline void snd_hda_power_save(struct hda_codec *codec, int delta, |
1069 | static inline void snd_hda_power_up_d3wait(struct hda_codec *codec) {} | 1071 | bool d3wait) {} |
1070 | static inline void snd_hda_power_down(struct hda_codec *codec) {} | ||
1071 | #endif | 1072 | #endif |
1072 | 1073 | ||
1074 | /** | ||
1075 | * snd_hda_power_up - Power-up the codec | ||
1076 | * @codec: HD-audio codec | ||
1077 | * | ||
1078 | * Increment the power-up counter and power up the hardware really when | ||
1079 | * not turned on yet. | ||
1080 | */ | ||
1081 | static inline void snd_hda_power_up(struct hda_codec *codec) | ||
1082 | { | ||
1083 | snd_hda_power_save(codec, 1, false); | ||
1084 | } | ||
1085 | |||
1086 | /** | ||
1087 | * snd_hda_power_up_d3wait - Power-up the codec after waiting for any pending | ||
1088 | * D3 transition to complete. This differs from snd_hda_power_up() when | ||
1089 | * power_transition == -1. snd_hda_power_up sees this case as a nop, | ||
1090 | * snd_hda_power_up_d3wait waits for the D3 transition to complete then powers | ||
1091 | * back up. | ||
1092 | * @codec: HD-audio codec | ||
1093 | * | ||
1094 | * Cancel any power down operation hapenning on the work queue, then power up. | ||
1095 | */ | ||
1096 | static inline void snd_hda_power_up_d3wait(struct hda_codec *codec) | ||
1097 | { | ||
1098 | snd_hda_power_save(codec, 1, true); | ||
1099 | } | ||
1100 | |||
1101 | /** | ||
1102 | * snd_hda_power_down - Power-down the codec | ||
1103 | * @codec: HD-audio codec | ||
1104 | * | ||
1105 | * Decrement the power-up counter and schedules the power-off work if | ||
1106 | * the counter rearches to zero. | ||
1107 | */ | ||
1108 | static inline void snd_hda_power_down(struct hda_codec *codec) | ||
1109 | { | ||
1110 | snd_hda_power_save(codec, -1, false); | ||
1111 | } | ||
1112 | |||
1113 | /** | ||
1114 | * snd_hda_power_sync - Synchronize the power-save status | ||
1115 | * @codec: HD-audio codec | ||
1116 | * | ||
1117 | * Synchronize the actual power state with the power account; | ||
1118 | * called when power_save parameter is changed | ||
1119 | */ | ||
1120 | static inline void snd_hda_power_sync(struct hda_codec *codec) | ||
1121 | { | ||
1122 | snd_hda_power_save(codec, 0, false); | ||
1123 | } | ||
1124 | |||
1073 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | 1125 | #ifdef CONFIG_SND_HDA_PATCH_LOADER |
1074 | /* | 1126 | /* |
1075 | * patch firmware | 1127 | * patch firmware |
1076 | */ | 1128 | */ |
1077 | int snd_hda_load_patch(struct hda_bus *bus, const char *patch); | 1129 | int snd_hda_load_patch(struct hda_bus *bus, size_t size, const void *buf); |
1078 | #endif | 1130 | #endif |
1079 | 1131 | ||
1080 | /* | 1132 | /* |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 431bf868711e..b81d3d0b952d 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -70,7 +70,7 @@ struct hda_gspec { | |||
70 | 70 | ||
71 | struct list_head nid_list; /* list of widgets */ | 71 | struct list_head nid_list; /* list of widgets */ |
72 | 72 | ||
73 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 73 | #ifdef CONFIG_PM |
74 | #define MAX_LOOPBACK_AMPS 7 | 74 | #define MAX_LOOPBACK_AMPS 7 |
75 | struct hda_loopback_check loopback; | 75 | struct hda_loopback_check loopback; |
76 | int num_loopbacks; | 76 | int num_loopbacks; |
@@ -654,7 +654,7 @@ static int parse_input(struct hda_codec *codec) | |||
654 | return 0; | 654 | return 0; |
655 | } | 655 | } |
656 | 656 | ||
657 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 657 | #ifdef CONFIG_PM |
658 | static void add_input_loopback(struct hda_codec *codec, hda_nid_t nid, | 658 | static void add_input_loopback(struct hda_codec *codec, hda_nid_t nid, |
659 | int dir, int idx) | 659 | int dir, int idx) |
660 | { | 660 | { |
@@ -1028,7 +1028,7 @@ static int build_generic_pcms(struct hda_codec *codec) | |||
1028 | return 0; | 1028 | return 0; |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1031 | #ifdef CONFIG_PM |
1032 | static int generic_check_power_status(struct hda_codec *codec, hda_nid_t nid) | 1032 | static int generic_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
1033 | { | 1033 | { |
1034 | struct hda_gspec *spec = codec->spec; | 1034 | struct hda_gspec *spec = codec->spec; |
@@ -1043,7 +1043,7 @@ static struct hda_codec_ops generic_patch_ops = { | |||
1043 | .build_controls = build_generic_controls, | 1043 | .build_controls = build_generic_controls, |
1044 | .build_pcms = build_generic_pcms, | 1044 | .build_pcms = build_generic_pcms, |
1045 | .free = snd_hda_generic_free, | 1045 | .free = snd_hda_generic_free, |
1046 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1046 | #ifdef CONFIG_PM |
1047 | .check_power_status = generic_check_power_status, | 1047 | .check_power_status = generic_check_power_status, |
1048 | #endif | 1048 | #endif |
1049 | }; | 1049 | }; |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 6b2efb8cb1f9..1af86d40eb23 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/string.h> | 27 | #include <linux/string.h> |
28 | #include <linux/firmware.h> | ||
29 | #include <linux/export.h> | 28 | #include <linux/export.h> |
30 | #include <sound/core.h> | 29 | #include <sound/core.h> |
31 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
@@ -156,7 +155,7 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) | |||
156 | return 0; | 155 | return 0; |
157 | } | 156 | } |
158 | 157 | ||
159 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 158 | #ifdef CONFIG_PM |
160 | static ssize_t power_on_acct_show(struct device *dev, | 159 | static ssize_t power_on_acct_show(struct device *dev, |
161 | struct device_attribute *attr, | 160 | struct device_attribute *attr, |
162 | char *buf) | 161 | char *buf) |
@@ -192,7 +191,7 @@ int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec) | |||
192 | hwdep->device, &power_attrs[i]); | 191 | hwdep->device, &power_attrs[i]); |
193 | return 0; | 192 | return 0; |
194 | } | 193 | } |
195 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | 194 | #endif /* CONFIG_PM */ |
196 | 195 | ||
197 | #ifdef CONFIG_SND_HDA_RECONFIG | 196 | #ifdef CONFIG_SND_HDA_RECONFIG |
198 | 197 | ||
@@ -747,18 +746,21 @@ static int parse_line_mode(char *buf, struct hda_bus *bus) | |||
747 | * | 746 | * |
748 | * the spaces at the beginning and the end of the line are stripped | 747 | * the spaces at the beginning and the end of the line are stripped |
749 | */ | 748 | */ |
750 | static int get_line_from_fw(char *buf, int size, struct firmware *fw) | 749 | static int get_line_from_fw(char *buf, int size, size_t *fw_size_p, |
750 | const void **fw_data_p) | ||
751 | { | 751 | { |
752 | int len; | 752 | int len; |
753 | const char *p = fw->data; | 753 | size_t fw_size = *fw_size_p; |
754 | while (isspace(*p) && fw->size) { | 754 | const char *p = *fw_data_p; |
755 | |||
756 | while (isspace(*p) && fw_size) { | ||
755 | p++; | 757 | p++; |
756 | fw->size--; | 758 | fw_size--; |
757 | } | 759 | } |
758 | if (!fw->size) | 760 | if (!fw_size) |
759 | return 0; | 761 | return 0; |
760 | 762 | ||
761 | for (len = 0; len < fw->size; len++) { | 763 | for (len = 0; len < fw_size; len++) { |
762 | if (!*p) | 764 | if (!*p) |
763 | break; | 765 | break; |
764 | if (*p == '\n') { | 766 | if (*p == '\n') { |
@@ -770,8 +772,8 @@ static int get_line_from_fw(char *buf, int size, struct firmware *fw) | |||
770 | *buf++ = *p++; | 772 | *buf++ = *p++; |
771 | } | 773 | } |
772 | *buf = 0; | 774 | *buf = 0; |
773 | fw->size -= len; | 775 | *fw_size_p = fw_size - len; |
774 | fw->data = p; | 776 | *fw_data_p = p; |
775 | remove_trail_spaces(buf); | 777 | remove_trail_spaces(buf); |
776 | return 1; | 778 | return 1; |
777 | } | 779 | } |
@@ -779,29 +781,15 @@ static int get_line_from_fw(char *buf, int size, struct firmware *fw) | |||
779 | /* | 781 | /* |
780 | * load a "patch" firmware file and parse it | 782 | * load a "patch" firmware file and parse it |
781 | */ | 783 | */ |
782 | int snd_hda_load_patch(struct hda_bus *bus, const char *patch) | 784 | int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf) |
783 | { | 785 | { |
784 | int err; | ||
785 | const struct firmware *fw; | ||
786 | struct firmware tmp; | ||
787 | char buf[128]; | 786 | char buf[128]; |
788 | struct hda_codec *codec; | 787 | struct hda_codec *codec; |
789 | int line_mode; | 788 | int line_mode; |
790 | struct device *dev = bus->card->dev; | ||
791 | |||
792 | if (snd_BUG_ON(!dev)) | ||
793 | return -ENODEV; | ||
794 | err = request_firmware(&fw, patch, dev); | ||
795 | if (err < 0) { | ||
796 | printk(KERN_ERR "hda-codec: Cannot load the patch '%s'\n", | ||
797 | patch); | ||
798 | return err; | ||
799 | } | ||
800 | 789 | ||
801 | tmp = *fw; | ||
802 | line_mode = LINE_MODE_NONE; | 790 | line_mode = LINE_MODE_NONE; |
803 | codec = NULL; | 791 | codec = NULL; |
804 | while (get_line_from_fw(buf, sizeof(buf) - 1, &tmp)) { | 792 | while (get_line_from_fw(buf, sizeof(buf) - 1, &fw_size, &fw_buf)) { |
805 | if (!*buf || *buf == '#' || *buf == '\n') | 793 | if (!*buf || *buf == '#' || *buf == '\n') |
806 | continue; | 794 | continue; |
807 | if (*buf == '[') | 795 | if (*buf == '[') |
@@ -810,7 +798,6 @@ int snd_hda_load_patch(struct hda_bus *bus, const char *patch) | |||
810 | (codec || !patch_items[line_mode].need_codec)) | 798 | (codec || !patch_items[line_mode].need_codec)) |
811 | patch_items[line_mode].parser(buf, bus, &codec); | 799 | patch_items[line_mode].parser(buf, bus, &codec); |
812 | } | 800 | } |
813 | release_firmware(fw); | ||
814 | return 0; | 801 | return 0; |
815 | } | 802 | } |
816 | EXPORT_SYMBOL_HDA(snd_hda_load_patch); | 803 | EXPORT_SYMBOL_HDA(snd_hda_load_patch); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c4763c52eaf6..f09ff6c14041 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
47 | #include <linux/reboot.h> | 47 | #include <linux/reboot.h> |
48 | #include <linux/io.h> | 48 | #include <linux/io.h> |
49 | #include <linux/pm_runtime.h> | ||
49 | #ifdef CONFIG_X86 | 50 | #ifdef CONFIG_X86 |
50 | /* for snoop control */ | 51 | /* for snoop control */ |
51 | #include <asm/pgtable.h> | 52 | #include <asm/pgtable.h> |
@@ -55,6 +56,7 @@ | |||
55 | #include <sound/initval.h> | 56 | #include <sound/initval.h> |
56 | #include <linux/vgaarb.h> | 57 | #include <linux/vgaarb.h> |
57 | #include <linux/vga_switcheroo.h> | 58 | #include <linux/vga_switcheroo.h> |
59 | #include <linux/firmware.h> | ||
58 | #include "hda_codec.h" | 60 | #include "hda_codec.h" |
59 | 61 | ||
60 | 62 | ||
@@ -62,7 +64,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | |||
62 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 64 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
63 | static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | 65 | static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; |
64 | static char *model[SNDRV_CARDS]; | 66 | static char *model[SNDRV_CARDS]; |
65 | static int position_fix[SNDRV_CARDS]; | 67 | static int position_fix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; |
66 | static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; | 68 | static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; |
67 | static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; | 69 | static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; |
68 | static int probe_only[SNDRV_CARDS]; | 70 | static int probe_only[SNDRV_CARDS]; |
@@ -86,7 +88,7 @@ module_param_array(model, charp, NULL, 0444); | |||
86 | MODULE_PARM_DESC(model, "Use the given board model."); | 88 | MODULE_PARM_DESC(model, "Use the given board model."); |
87 | module_param_array(position_fix, int, NULL, 0444); | 89 | module_param_array(position_fix, int, NULL, 0444); |
88 | MODULE_PARM_DESC(position_fix, "DMA pointer read method." | 90 | MODULE_PARM_DESC(position_fix, "DMA pointer read method." |
89 | "(0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO)."); | 91 | "(-1 = system default, 0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO)."); |
90 | module_param_array(bdl_pos_adj, int, NULL, 0644); | 92 | module_param_array(bdl_pos_adj, int, NULL, 0644); |
91 | MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset."); | 93 | MODULE_PARM_DESC(bdl_pos_adj, "BDL position adjustment offset."); |
92 | module_param_array(probe_mask, int, NULL, 0444); | 94 | module_param_array(probe_mask, int, NULL, 0444); |
@@ -108,9 +110,16 @@ MODULE_PARM_DESC(beep_mode, "Select HDA Beep registration mode " | |||
108 | "(0=off, 1=on) (default=1)."); | 110 | "(0=off, 1=on) (default=1)."); |
109 | #endif | 111 | #endif |
110 | 112 | ||
111 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 113 | #ifdef CONFIG_PM |
114 | static int param_set_xint(const char *val, const struct kernel_param *kp); | ||
115 | static struct kernel_param_ops param_ops_xint = { | ||
116 | .set = param_set_xint, | ||
117 | .get = param_get_int, | ||
118 | }; | ||
119 | #define param_check_xint param_check_int | ||
120 | |||
112 | static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; | 121 | static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; |
113 | module_param(power_save, int, 0644); | 122 | module_param(power_save, xint, 0644); |
114 | MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " | 123 | MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " |
115 | "(in second, 0 = disable)."); | 124 | "(in second, 0 = disable)."); |
116 | 125 | ||
@@ -121,7 +130,7 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " | |||
121 | static bool power_save_controller = 1; | 130 | static bool power_save_controller = 1; |
122 | module_param(power_save_controller, bool, 0644); | 131 | module_param(power_save_controller, bool, 0644); |
123 | MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); | 132 | MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); |
124 | #endif | 133 | #endif /* CONFIG_PM */ |
125 | 134 | ||
126 | static int align_buffer_size = -1; | 135 | static int align_buffer_size = -1; |
127 | module_param(align_buffer_size, bint, 0644); | 136 | module_param(align_buffer_size, bint, 0644); |
@@ -406,6 +415,7 @@ struct azx_dev { | |||
406 | */ | 415 | */ |
407 | unsigned int insufficient :1; | 416 | unsigned int insufficient :1; |
408 | unsigned int wc_marked:1; | 417 | unsigned int wc_marked:1; |
418 | unsigned int no_period_wakeup:1; | ||
409 | }; | 419 | }; |
410 | 420 | ||
411 | /* CORB/RIRB */ | 421 | /* CORB/RIRB */ |
@@ -471,6 +481,10 @@ struct azx { | |||
471 | struct snd_dma_buffer rb; | 481 | struct snd_dma_buffer rb; |
472 | struct snd_dma_buffer posbuf; | 482 | struct snd_dma_buffer posbuf; |
473 | 483 | ||
484 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
485 | const struct firmware *fw; | ||
486 | #endif | ||
487 | |||
474 | /* flags */ | 488 | /* flags */ |
475 | int position_fix[2]; /* for both playback/capture streams */ | 489 | int position_fix[2]; /* for both playback/capture streams */ |
476 | int poll_count; | 490 | int poll_count; |
@@ -498,6 +512,9 @@ struct azx { | |||
498 | 512 | ||
499 | /* reboot notifier (for mysterious hangup problem at power-down) */ | 513 | /* reboot notifier (for mysterious hangup problem at power-down) */ |
500 | struct notifier_block reboot_notifier; | 514 | struct notifier_block reboot_notifier; |
515 | |||
516 | /* card list (for power_save trigger) */ | ||
517 | struct list_head list; | ||
501 | }; | 518 | }; |
502 | 519 | ||
503 | /* driver types */ | 520 | /* driver types */ |
@@ -538,6 +555,7 @@ enum { | |||
538 | #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */ | 555 | #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */ |
539 | #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ | 556 | #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ |
540 | #define AZX_DCAPS_POSFIX_COMBO (1 << 24) /* Use COMBO as default */ | 557 | #define AZX_DCAPS_POSFIX_COMBO (1 << 24) /* Use COMBO as default */ |
558 | #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ | ||
541 | 559 | ||
542 | /* quirks for ATI SB / AMD Hudson */ | 560 | /* quirks for ATI SB / AMD Hudson */ |
543 | #define AZX_DCAPS_PRESET_ATI_SB \ | 561 | #define AZX_DCAPS_PRESET_ATI_SB \ |
@@ -560,13 +578,17 @@ enum { | |||
560 | * VGA-switcher support | 578 | * VGA-switcher support |
561 | */ | 579 | */ |
562 | #ifdef SUPPORT_VGA_SWITCHEROO | 580 | #ifdef SUPPORT_VGA_SWITCHEROO |
581 | #define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) | ||
582 | #else | ||
583 | #define use_vga_switcheroo(chip) 0 | ||
584 | #endif | ||
585 | |||
586 | #if defined(SUPPORT_VGA_SWITCHEROO) || defined(CONFIG_SND_HDA_PATCH_LOADER) | ||
563 | #define DELAYED_INIT_MARK | 587 | #define DELAYED_INIT_MARK |
564 | #define DELAYED_INITDATA_MARK | 588 | #define DELAYED_INITDATA_MARK |
565 | #define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) | ||
566 | #else | 589 | #else |
567 | #define DELAYED_INIT_MARK __devinit | 590 | #define DELAYED_INIT_MARK __devinit |
568 | #define DELAYED_INITDATA_MARK __devinitdata | 591 | #define DELAYED_INITDATA_MARK __devinitdata |
569 | #define use_vga_switcheroo(chip) 0 | ||
570 | #endif | 592 | #endif |
571 | 593 | ||
572 | static char *driver_short_names[] DELAYED_INITDATA_MARK = { | 594 | static char *driver_short_names[] DELAYED_INITDATA_MARK = { |
@@ -1012,8 +1034,8 @@ static unsigned int azx_get_response(struct hda_bus *bus, | |||
1012 | return azx_rirb_get_response(bus, addr); | 1034 | return azx_rirb_get_response(bus, addr); |
1013 | } | 1035 | } |
1014 | 1036 | ||
1015 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1037 | #ifdef CONFIG_PM |
1016 | static void azx_power_notify(struct hda_bus *bus); | 1038 | static void azx_power_notify(struct hda_bus *bus, bool power_up); |
1017 | #endif | 1039 | #endif |
1018 | 1040 | ||
1019 | /* reset codec link */ | 1041 | /* reset codec link */ |
@@ -1269,6 +1291,11 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
1269 | u8 sd_status; | 1291 | u8 sd_status; |
1270 | int i, ok; | 1292 | int i, ok; |
1271 | 1293 | ||
1294 | #ifdef CONFIG_PM_RUNTIME | ||
1295 | if (chip->pci->dev.power.runtime_status != RPM_ACTIVE) | ||
1296 | return IRQ_NONE; | ||
1297 | #endif | ||
1298 | |||
1272 | spin_lock(&chip->reg_lock); | 1299 | spin_lock(&chip->reg_lock); |
1273 | 1300 | ||
1274 | if (chip->disabled) { | 1301 | if (chip->disabled) { |
@@ -1394,7 +1421,7 @@ static int azx_setup_periods(struct azx *chip, | |||
1394 | ofs = 0; | 1421 | ofs = 0; |
1395 | azx_dev->frags = 0; | 1422 | azx_dev->frags = 0; |
1396 | pos_adj = bdl_pos_adj[chip->dev_index]; | 1423 | pos_adj = bdl_pos_adj[chip->dev_index]; |
1397 | if (pos_adj > 0) { | 1424 | if (!azx_dev->no_period_wakeup && pos_adj > 0) { |
1398 | struct snd_pcm_runtime *runtime = substream->runtime; | 1425 | struct snd_pcm_runtime *runtime = substream->runtime; |
1399 | int pos_align = pos_adj; | 1426 | int pos_align = pos_adj; |
1400 | pos_adj = (pos_adj * runtime->rate + 47999) / 48000; | 1427 | pos_adj = (pos_adj * runtime->rate + 47999) / 48000; |
@@ -1410,8 +1437,7 @@ static int azx_setup_periods(struct azx *chip, | |||
1410 | pos_adj = 0; | 1437 | pos_adj = 0; |
1411 | } else { | 1438 | } else { |
1412 | ofs = setup_bdle(chip, substream, azx_dev, | 1439 | ofs = setup_bdle(chip, substream, azx_dev, |
1413 | &bdl, ofs, pos_adj, | 1440 | &bdl, ofs, pos_adj, true); |
1414 | !substream->runtime->no_period_wakeup); | ||
1415 | if (ofs < 0) | 1441 | if (ofs < 0) |
1416 | goto error; | 1442 | goto error; |
1417 | } | 1443 | } |
@@ -1424,7 +1450,7 @@ static int azx_setup_periods(struct azx *chip, | |||
1424 | else | 1450 | else |
1425 | ofs = setup_bdle(chip, substream, azx_dev, &bdl, ofs, | 1451 | ofs = setup_bdle(chip, substream, azx_dev, &bdl, ofs, |
1426 | period_bytes, | 1452 | period_bytes, |
1427 | !substream->runtime->no_period_wakeup); | 1453 | !azx_dev->no_period_wakeup); |
1428 | if (ofs < 0) | 1454 | if (ofs < 0) |
1429 | goto error; | 1455 | goto error; |
1430 | } | 1456 | } |
@@ -1580,7 +1606,7 @@ static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *mode | |||
1580 | bus_temp.ops.get_response = azx_get_response; | 1606 | bus_temp.ops.get_response = azx_get_response; |
1581 | bus_temp.ops.attach_pcm = azx_attach_pcm_stream; | 1607 | bus_temp.ops.attach_pcm = azx_attach_pcm_stream; |
1582 | bus_temp.ops.bus_reset = azx_bus_reset; | 1608 | bus_temp.ops.bus_reset = azx_bus_reset; |
1583 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1609 | #ifdef CONFIG_PM |
1584 | bus_temp.power_save = &power_save; | 1610 | bus_temp.power_save = &power_save; |
1585 | bus_temp.ops.pm_notify = azx_power_notify; | 1611 | bus_temp.ops.pm_notify = azx_power_notify; |
1586 | #endif | 1612 | #endif |
@@ -1897,10 +1923,12 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1897 | 1923 | ||
1898 | if (bufsize != azx_dev->bufsize || | 1924 | if (bufsize != azx_dev->bufsize || |
1899 | period_bytes != azx_dev->period_bytes || | 1925 | period_bytes != azx_dev->period_bytes || |
1900 | format_val != azx_dev->format_val) { | 1926 | format_val != azx_dev->format_val || |
1927 | runtime->no_period_wakeup != azx_dev->no_period_wakeup) { | ||
1901 | azx_dev->bufsize = bufsize; | 1928 | azx_dev->bufsize = bufsize; |
1902 | azx_dev->period_bytes = period_bytes; | 1929 | azx_dev->period_bytes = period_bytes; |
1903 | azx_dev->format_val = format_val; | 1930 | azx_dev->format_val = format_val; |
1931 | azx_dev->no_period_wakeup = runtime->no_period_wakeup; | ||
1904 | err = azx_setup_periods(chip, substream, azx_dev); | 1932 | err = azx_setup_periods(chip, substream, azx_dev); |
1905 | if (err < 0) | 1933 | if (err < 0) |
1906 | return err; | 1934 | return err; |
@@ -1959,14 +1987,14 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1959 | } | 1987 | } |
1960 | 1988 | ||
1961 | spin_lock(&chip->reg_lock); | 1989 | spin_lock(&chip->reg_lock); |
1962 | if (nsync > 1) { | 1990 | |
1963 | /* first, set SYNC bits of corresponding streams */ | 1991 | /* first, set SYNC bits of corresponding streams */ |
1964 | if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) | 1992 | if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) |
1965 | azx_writel(chip, OLD_SSYNC, | 1993 | azx_writel(chip, OLD_SSYNC, |
1966 | azx_readl(chip, OLD_SSYNC) | sbits); | 1994 | azx_readl(chip, OLD_SSYNC) | sbits); |
1967 | else | 1995 | else |
1968 | azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) | sbits); | 1996 | azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) | sbits); |
1969 | } | 1997 | |
1970 | snd_pcm_group_for_each_entry(s, substream) { | 1998 | snd_pcm_group_for_each_entry(s, substream) { |
1971 | if (s->pcm->card != substream->pcm->card) | 1999 | if (s->pcm->card != substream->pcm->card) |
1972 | continue; | 2000 | continue; |
@@ -1984,8 +2012,6 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1984 | } | 2012 | } |
1985 | spin_unlock(&chip->reg_lock); | 2013 | spin_unlock(&chip->reg_lock); |
1986 | if (start) { | 2014 | if (start) { |
1987 | if (nsync == 1) | ||
1988 | return 0; | ||
1989 | /* wait until all FIFOs get ready */ | 2015 | /* wait until all FIFOs get ready */ |
1990 | for (timeout = 5000; timeout; timeout--) { | 2016 | for (timeout = 5000; timeout; timeout--) { |
1991 | nwait = 0; | 2017 | nwait = 0; |
@@ -2018,16 +2044,14 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
2018 | cpu_relax(); | 2044 | cpu_relax(); |
2019 | } | 2045 | } |
2020 | } | 2046 | } |
2021 | if (nsync > 1) { | 2047 | spin_lock(&chip->reg_lock); |
2022 | spin_lock(&chip->reg_lock); | 2048 | /* reset SYNC bits */ |
2023 | /* reset SYNC bits */ | 2049 | if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) |
2024 | if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC) | 2050 | azx_writel(chip, OLD_SSYNC, |
2025 | azx_writel(chip, OLD_SSYNC, | 2051 | azx_readl(chip, OLD_SSYNC) & ~sbits); |
2026 | azx_readl(chip, OLD_SSYNC) & ~sbits); | 2052 | else |
2027 | else | 2053 | azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits); |
2028 | azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits); | 2054 | spin_unlock(&chip->reg_lock); |
2029 | spin_unlock(&chip->reg_lock); | ||
2030 | } | ||
2031 | return 0; | 2055 | return 0; |
2032 | } | 2056 | } |
2033 | 2057 | ||
@@ -2120,6 +2144,27 @@ static unsigned int azx_get_position(struct azx *chip, | |||
2120 | 2144 | ||
2121 | if (pos >= azx_dev->bufsize) | 2145 | if (pos >= azx_dev->bufsize) |
2122 | pos = 0; | 2146 | pos = 0; |
2147 | |||
2148 | /* calculate runtime delay from LPIB */ | ||
2149 | if (azx_dev->substream->runtime && | ||
2150 | chip->position_fix[stream] == POS_FIX_POSBUF && | ||
2151 | (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) { | ||
2152 | unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB); | ||
2153 | int delay; | ||
2154 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
2155 | delay = pos - lpib_pos; | ||
2156 | else | ||
2157 | delay = lpib_pos - pos; | ||
2158 | if (delay < 0) | ||
2159 | delay += azx_dev->bufsize; | ||
2160 | if (delay >= azx_dev->period_bytes) { | ||
2161 | snd_printdd("delay %d > period_bytes %d\n", | ||
2162 | delay, azx_dev->period_bytes); | ||
2163 | delay = 0; /* something is wrong */ | ||
2164 | } | ||
2165 | azx_dev->substream->runtime->delay = | ||
2166 | bytes_to_frames(azx_dev->substream->runtime, delay); | ||
2167 | } | ||
2123 | return pos; | 2168 | return pos; |
2124 | } | 2169 | } |
2125 | 2170 | ||
@@ -2379,33 +2424,65 @@ static void azx_stop_chip(struct azx *chip) | |||
2379 | chip->initialized = 0; | 2424 | chip->initialized = 0; |
2380 | } | 2425 | } |
2381 | 2426 | ||
2382 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2427 | #ifdef CONFIG_PM |
2383 | /* power-up/down the controller */ | 2428 | /* power-up/down the controller */ |
2384 | static void azx_power_notify(struct hda_bus *bus) | 2429 | static void azx_power_notify(struct hda_bus *bus, bool power_up) |
2385 | { | 2430 | { |
2386 | struct azx *chip = bus->private_data; | 2431 | struct azx *chip = bus->private_data; |
2432 | |||
2433 | if (power_up) | ||
2434 | pm_runtime_get_sync(&chip->pci->dev); | ||
2435 | else | ||
2436 | pm_runtime_put_sync(&chip->pci->dev); | ||
2437 | } | ||
2438 | |||
2439 | static DEFINE_MUTEX(card_list_lock); | ||
2440 | static LIST_HEAD(card_list); | ||
2441 | |||
2442 | static void azx_add_card_list(struct azx *chip) | ||
2443 | { | ||
2444 | mutex_lock(&card_list_lock); | ||
2445 | list_add(&chip->list, &card_list); | ||
2446 | mutex_unlock(&card_list_lock); | ||
2447 | } | ||
2448 | |||
2449 | static void azx_del_card_list(struct azx *chip) | ||
2450 | { | ||
2451 | mutex_lock(&card_list_lock); | ||
2452 | list_del_init(&chip->list); | ||
2453 | mutex_unlock(&card_list_lock); | ||
2454 | } | ||
2455 | |||
2456 | /* trigger power-save check at writing parameter */ | ||
2457 | static int param_set_xint(const char *val, const struct kernel_param *kp) | ||
2458 | { | ||
2459 | struct azx *chip; | ||
2387 | struct hda_codec *c; | 2460 | struct hda_codec *c; |
2388 | int power_on = 0; | 2461 | int prev = power_save; |
2462 | int ret = param_set_int(val, kp); | ||
2389 | 2463 | ||
2390 | list_for_each_entry(c, &bus->codec_list, list) { | 2464 | if (ret || prev == power_save) |
2391 | if (c->power_on) { | 2465 | return ret; |
2392 | power_on = 1; | 2466 | |
2393 | break; | 2467 | mutex_lock(&card_list_lock); |
2394 | } | 2468 | list_for_each_entry(chip, &card_list, list) { |
2469 | if (!chip->bus || chip->disabled) | ||
2470 | continue; | ||
2471 | list_for_each_entry(c, &chip->bus->codec_list, list) | ||
2472 | snd_hda_power_sync(c); | ||
2395 | } | 2473 | } |
2396 | if (power_on) | 2474 | mutex_unlock(&card_list_lock); |
2397 | azx_init_chip(chip, 1); | 2475 | return 0; |
2398 | else if (chip->running && power_save_controller && | ||
2399 | !bus->power_keep_link_on) | ||
2400 | azx_stop_chip(chip); | ||
2401 | } | 2476 | } |
2402 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | 2477 | #else |
2478 | #define azx_add_card_list(chip) /* NOP */ | ||
2479 | #define azx_del_card_list(chip) /* NOP */ | ||
2480 | #endif /* CONFIG_PM */ | ||
2403 | 2481 | ||
2404 | #ifdef CONFIG_PM | 2482 | #if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO) |
2405 | /* | 2483 | /* |
2406 | * power management | 2484 | * power management |
2407 | */ | 2485 | */ |
2408 | |||
2409 | static int azx_suspend(struct device *dev) | 2486 | static int azx_suspend(struct device *dev) |
2410 | { | 2487 | { |
2411 | struct pci_dev *pci = to_pci_dev(dev); | 2488 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -2460,11 +2537,41 @@ static int azx_resume(struct device *dev) | |||
2460 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 2537 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
2461 | return 0; | 2538 | return 0; |
2462 | } | 2539 | } |
2463 | static SIMPLE_DEV_PM_OPS(azx_pm, azx_suspend, azx_resume); | 2540 | #endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */ |
2541 | |||
2542 | #ifdef CONFIG_PM_RUNTIME | ||
2543 | static int azx_runtime_suspend(struct device *dev) | ||
2544 | { | ||
2545 | struct snd_card *card = dev_get_drvdata(dev); | ||
2546 | struct azx *chip = card->private_data; | ||
2547 | |||
2548 | if (!power_save_controller) | ||
2549 | return -EAGAIN; | ||
2550 | |||
2551 | azx_stop_chip(chip); | ||
2552 | azx_clear_irq_pending(chip); | ||
2553 | return 0; | ||
2554 | } | ||
2555 | |||
2556 | static int azx_runtime_resume(struct device *dev) | ||
2557 | { | ||
2558 | struct snd_card *card = dev_get_drvdata(dev); | ||
2559 | struct azx *chip = card->private_data; | ||
2560 | |||
2561 | azx_init_pci(chip); | ||
2562 | azx_init_chip(chip, 1); | ||
2563 | return 0; | ||
2564 | } | ||
2565 | #endif /* CONFIG_PM_RUNTIME */ | ||
2566 | |||
2567 | #ifdef CONFIG_PM | ||
2568 | static const struct dev_pm_ops azx_pm = { | ||
2569 | SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) | ||
2570 | SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, NULL) | ||
2571 | }; | ||
2572 | |||
2464 | #define AZX_PM_OPS &azx_pm | 2573 | #define AZX_PM_OPS &azx_pm |
2465 | #else | 2574 | #else |
2466 | #define azx_suspend(dev) | ||
2467 | #define azx_resume(dev) | ||
2468 | #define AZX_PM_OPS NULL | 2575 | #define AZX_PM_OPS NULL |
2469 | #endif /* CONFIG_PM */ | 2576 | #endif /* CONFIG_PM */ |
2470 | 2577 | ||
@@ -2599,6 +2706,8 @@ static int azx_free(struct azx *chip) | |||
2599 | { | 2706 | { |
2600 | int i; | 2707 | int i; |
2601 | 2708 | ||
2709 | azx_del_card_list(chip); | ||
2710 | |||
2602 | azx_notifier_unregister(chip); | 2711 | azx_notifier_unregister(chip); |
2603 | 2712 | ||
2604 | if (use_vga_switcheroo(chip)) { | 2713 | if (use_vga_switcheroo(chip)) { |
@@ -2640,6 +2749,10 @@ static int azx_free(struct azx *chip) | |||
2640 | pci_release_regions(chip->pci); | 2749 | pci_release_regions(chip->pci); |
2641 | pci_disable_device(chip->pci); | 2750 | pci_disable_device(chip->pci); |
2642 | kfree(chip->azx_dev); | 2751 | kfree(chip->azx_dev); |
2752 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
2753 | if (chip->fw) | ||
2754 | release_firmware(chip->fw); | ||
2755 | #endif | ||
2643 | kfree(chip); | 2756 | kfree(chip); |
2644 | 2757 | ||
2645 | return 0; | 2758 | return 0; |
@@ -2719,6 +2832,7 @@ static int __devinit check_position_fix(struct azx *chip, int fix) | |||
2719 | const struct snd_pci_quirk *q; | 2832 | const struct snd_pci_quirk *q; |
2720 | 2833 | ||
2721 | switch (fix) { | 2834 | switch (fix) { |
2835 | case POS_FIX_AUTO: | ||
2722 | case POS_FIX_LPIB: | 2836 | case POS_FIX_LPIB: |
2723 | case POS_FIX_POSBUF: | 2837 | case POS_FIX_POSBUF: |
2724 | case POS_FIX_VIACOMBO: | 2838 | case POS_FIX_VIACOMBO: |
@@ -2904,6 +3018,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2904 | chip->dev_index = dev; | 3018 | chip->dev_index = dev; |
2905 | INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); | 3019 | INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); |
2906 | INIT_LIST_HEAD(&chip->pcm_list); | 3020 | INIT_LIST_HEAD(&chip->pcm_list); |
3021 | INIT_LIST_HEAD(&chip->list); | ||
2907 | init_vga_switcheroo(chip); | 3022 | init_vga_switcheroo(chip); |
2908 | 3023 | ||
2909 | chip->position_fix[0] = chip->position_fix[1] = | 3024 | chip->position_fix[0] = chip->position_fix[1] = |
@@ -3138,7 +3253,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip) | |||
3138 | 3253 | ||
3139 | static void power_down_all_codecs(struct azx *chip) | 3254 | static void power_down_all_codecs(struct azx *chip) |
3140 | { | 3255 | { |
3141 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3256 | #ifdef CONFIG_PM |
3142 | /* The codecs were powered up in snd_hda_codec_new(). | 3257 | /* The codecs were powered up in snd_hda_codec_new(). |
3143 | * Now all initialization done, so turn them down if possible | 3258 | * Now all initialization done, so turn them down if possible |
3144 | */ | 3259 | */ |
@@ -3149,12 +3264,40 @@ static void power_down_all_codecs(struct azx *chip) | |||
3149 | #endif | 3264 | #endif |
3150 | } | 3265 | } |
3151 | 3266 | ||
3267 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | ||
3268 | /* callback from request_firmware_nowait() */ | ||
3269 | static void azx_firmware_cb(const struct firmware *fw, void *context) | ||
3270 | { | ||
3271 | struct snd_card *card = context; | ||
3272 | struct azx *chip = card->private_data; | ||
3273 | struct pci_dev *pci = chip->pci; | ||
3274 | |||
3275 | if (!fw) { | ||
3276 | snd_printk(KERN_ERR SFX "Cannot load firmware, aborting\n"); | ||
3277 | goto error; | ||
3278 | } | ||
3279 | |||
3280 | chip->fw = fw; | ||
3281 | if (!chip->disabled) { | ||
3282 | /* continue probing */ | ||
3283 | if (azx_probe_continue(chip)) | ||
3284 | goto error; | ||
3285 | } | ||
3286 | return; /* OK */ | ||
3287 | |||
3288 | error: | ||
3289 | snd_card_free(card); | ||
3290 | pci_set_drvdata(pci, NULL); | ||
3291 | } | ||
3292 | #endif | ||
3293 | |||
3152 | static int __devinit azx_probe(struct pci_dev *pci, | 3294 | static int __devinit azx_probe(struct pci_dev *pci, |
3153 | const struct pci_device_id *pci_id) | 3295 | const struct pci_device_id *pci_id) |
3154 | { | 3296 | { |
3155 | static int dev; | 3297 | static int dev; |
3156 | struct snd_card *card; | 3298 | struct snd_card *card; |
3157 | struct azx *chip; | 3299 | struct azx *chip; |
3300 | bool probe_now; | ||
3158 | int err; | 3301 | int err; |
3159 | 3302 | ||
3160 | if (dev >= SNDRV_CARDS) | 3303 | if (dev >= SNDRV_CARDS) |
@@ -3170,15 +3313,28 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
3170 | return err; | 3313 | return err; |
3171 | } | 3314 | } |
3172 | 3315 | ||
3173 | /* set this here since it's referred in snd_hda_load_patch() */ | ||
3174 | snd_card_set_dev(card, &pci->dev); | 3316 | snd_card_set_dev(card, &pci->dev); |
3175 | 3317 | ||
3176 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); | 3318 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); |
3177 | if (err < 0) | 3319 | if (err < 0) |
3178 | goto out_free; | 3320 | goto out_free; |
3179 | card->private_data = chip; | 3321 | card->private_data = chip; |
3322 | probe_now = !chip->disabled; | ||
3180 | 3323 | ||
3181 | if (!chip->disabled) { | 3324 | #ifdef CONFIG_SND_HDA_PATCH_LOADER |
3325 | if (patch[dev] && *patch[dev]) { | ||
3326 | snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n", | ||
3327 | patch[dev]); | ||
3328 | err = request_firmware_nowait(THIS_MODULE, true, patch[dev], | ||
3329 | &pci->dev, GFP_KERNEL, card, | ||
3330 | azx_firmware_cb); | ||
3331 | if (err < 0) | ||
3332 | goto out_free; | ||
3333 | probe_now = false; /* continued in azx_firmware_cb() */ | ||
3334 | } | ||
3335 | #endif /* CONFIG_SND_HDA_PATCH_LOADER */ | ||
3336 | |||
3337 | if (probe_now) { | ||
3182 | err = azx_probe_continue(chip); | 3338 | err = azx_probe_continue(chip); |
3183 | if (err < 0) | 3339 | if (err < 0) |
3184 | goto out_free; | 3340 | goto out_free; |
@@ -3186,6 +3342,9 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
3186 | 3342 | ||
3187 | pci_set_drvdata(pci, card); | 3343 | pci_set_drvdata(pci, card); |
3188 | 3344 | ||
3345 | if (pci_dev_run_wake(pci)) | ||
3346 | pm_runtime_put_noidle(&pci->dev); | ||
3347 | |||
3189 | dev++; | 3348 | dev++; |
3190 | return 0; | 3349 | return 0; |
3191 | 3350 | ||
@@ -3208,12 +3367,13 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip) | |||
3208 | if (err < 0) | 3367 | if (err < 0) |
3209 | goto out_free; | 3368 | goto out_free; |
3210 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | 3369 | #ifdef CONFIG_SND_HDA_PATCH_LOADER |
3211 | if (patch[dev] && *patch[dev]) { | 3370 | if (chip->fw) { |
3212 | snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n", | 3371 | err = snd_hda_load_patch(chip->bus, chip->fw->size, |
3213 | patch[dev]); | 3372 | chip->fw->data); |
3214 | err = snd_hda_load_patch(chip->bus, patch[dev]); | ||
3215 | if (err < 0) | 3373 | if (err < 0) |
3216 | goto out_free; | 3374 | goto out_free; |
3375 | release_firmware(chip->fw); /* no longer needed */ | ||
3376 | chip->fw = NULL; | ||
3217 | } | 3377 | } |
3218 | #endif | 3378 | #endif |
3219 | if ((probe_only[dev] & 1) == 0) { | 3379 | if ((probe_only[dev] & 1) == 0) { |
@@ -3239,6 +3399,7 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip) | |||
3239 | chip->running = 1; | 3399 | chip->running = 1; |
3240 | power_down_all_codecs(chip); | 3400 | power_down_all_codecs(chip); |
3241 | azx_notifier_register(chip); | 3401 | azx_notifier_register(chip); |
3402 | azx_add_card_list(chip); | ||
3242 | 3403 | ||
3243 | return 0; | 3404 | return 0; |
3244 | 3405 | ||
@@ -3250,6 +3411,10 @@ out_free: | |||
3250 | static void __devexit azx_remove(struct pci_dev *pci) | 3411 | static void __devexit azx_remove(struct pci_dev *pci) |
3251 | { | 3412 | { |
3252 | struct snd_card *card = pci_get_drvdata(pci); | 3413 | struct snd_card *card = pci_get_drvdata(pci); |
3414 | |||
3415 | if (pci_dev_run_wake(pci)) | ||
3416 | pm_runtime_get_noresume(&pci->dev); | ||
3417 | |||
3253 | if (card) | 3418 | if (card) |
3254 | snd_card_free(card); | 3419 | snd_card_free(card); |
3255 | pci_set_drvdata(pci, NULL); | 3420 | pci_set_drvdata(pci, NULL); |
@@ -3260,7 +3425,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
3260 | /* CPT */ | 3425 | /* CPT */ |
3261 | { PCI_DEVICE(0x8086, 0x1c20), | 3426 | { PCI_DEVICE(0x8086, 0x1c20), |
3262 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | | 3427 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
3263 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, | 3428 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, |
3264 | /* PBG */ | 3429 | /* PBG */ |
3265 | { PCI_DEVICE(0x8086, 0x1d20), | 3430 | { PCI_DEVICE(0x8086, 0x1d20), |
3266 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | | 3431 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
@@ -3268,23 +3433,30 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
3268 | /* Panther Point */ | 3433 | /* Panther Point */ |
3269 | { PCI_DEVICE(0x8086, 0x1e20), | 3434 | { PCI_DEVICE(0x8086, 0x1e20), |
3270 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | | 3435 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
3271 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, | 3436 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, |
3272 | /* Lynx Point */ | 3437 | /* Lynx Point */ |
3273 | { PCI_DEVICE(0x8086, 0x8c20), | 3438 | { PCI_DEVICE(0x8086, 0x8c20), |
3274 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | | 3439 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
3275 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, | 3440 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, |
3276 | /* Lynx Point-LP */ | 3441 | /* Lynx Point-LP */ |
3277 | { PCI_DEVICE(0x8086, 0x9c20), | 3442 | { PCI_DEVICE(0x8086, 0x9c20), |
3278 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | | 3443 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
3279 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, | 3444 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, |
3280 | /* Lynx Point-LP */ | 3445 | /* Lynx Point-LP */ |
3281 | { PCI_DEVICE(0x8086, 0x9c21), | 3446 | { PCI_DEVICE(0x8086, 0x9c21), |
3282 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | | 3447 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | |
3283 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, | 3448 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, |
3284 | /* Haswell */ | 3449 | /* Haswell */ |
3285 | { PCI_DEVICE(0x8086, 0x0c0c), | 3450 | { PCI_DEVICE(0x8086, 0x0c0c), |
3286 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | 3451 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | |
3287 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO }, | 3452 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, |
3453 | { PCI_DEVICE(0x8086, 0x0d0c), | ||
3454 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | ||
3455 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, | ||
3456 | /* 5 Series/3400 */ | ||
3457 | { PCI_DEVICE(0x8086, 0x3b56), | ||
3458 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | ||
3459 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, | ||
3288 | /* SCH */ | 3460 | /* SCH */ |
3289 | { PCI_DEVICE(0x8086, 0x811b), | 3461 | { PCI_DEVICE(0x8086, 0x811b), |
3290 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | 3462 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | |
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index aaccc0236bda..5c690cb873d4 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c | |||
@@ -26,9 +26,8 @@ bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) | |||
26 | return false; | 26 | return false; |
27 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) | 27 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) |
28 | return false; | 28 | return false; |
29 | if (!codec->ignore_misc_bit && | 29 | if (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & |
30 | (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & | 30 | AC_DEFCFG_MISC_NO_PRESENCE) |
31 | AC_DEFCFG_MISC_NO_PRESENCE)) | ||
32 | return false; | 31 | return false; |
33 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) | 32 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) |
34 | return false; | 33 | return false; |
@@ -193,8 +192,9 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_detect); | |||
193 | /** | 192 | /** |
194 | * snd_hda_jack_detect_enable - enable the jack-detection | 193 | * snd_hda_jack_detect_enable - enable the jack-detection |
195 | */ | 194 | */ |
196 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, | 195 | int snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, |
197 | unsigned char action) | 196 | unsigned char action, |
197 | hda_jack_callback cb) | ||
198 | { | 198 | { |
199 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); | 199 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); |
200 | if (!jack) | 200 | if (!jack) |
@@ -204,10 +204,19 @@ int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, | |||
204 | jack->jack_detect = 1; | 204 | jack->jack_detect = 1; |
205 | if (action) | 205 | if (action) |
206 | jack->action = action; | 206 | jack->action = action; |
207 | if (cb) | ||
208 | jack->callback = cb; | ||
207 | return snd_hda_codec_write_cache(codec, nid, 0, | 209 | return snd_hda_codec_write_cache(codec, nid, 0, |
208 | AC_VERB_SET_UNSOLICITED_ENABLE, | 210 | AC_VERB_SET_UNSOLICITED_ENABLE, |
209 | AC_USRSP_EN | jack->tag); | 211 | AC_USRSP_EN | jack->tag); |
210 | } | 212 | } |
213 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable_callback); | ||
214 | |||
215 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, | ||
216 | unsigned char action) | ||
217 | { | ||
218 | return snd_hda_jack_detect_enable_callback(codec, nid, action, NULL); | ||
219 | } | ||
211 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); | 220 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); |
212 | 221 | ||
213 | /** | 222 | /** |
@@ -412,3 +421,21 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, | |||
412 | return 0; | 421 | return 0; |
413 | } | 422 | } |
414 | EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls); | 423 | EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls); |
424 | |||
425 | void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res) | ||
426 | { | ||
427 | struct hda_jack_tbl *event; | ||
428 | int tag = (res >> AC_UNSOL_RES_TAG_SHIFT) & 0x7f; | ||
429 | |||
430 | event = snd_hda_jack_tbl_get_from_tag(codec, tag); | ||
431 | if (!event) | ||
432 | return; | ||
433 | event->jack_dirty = 1; | ||
434 | |||
435 | if (event->callback) | ||
436 | event->callback(codec, event); | ||
437 | |||
438 | snd_hda_jack_report_sync(codec); | ||
439 | } | ||
440 | EXPORT_SYMBOL_HDA(snd_hda_jack_unsol_event); | ||
441 | |||
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index a9803da633c0..af8dd4724da5 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h | |||
@@ -13,12 +13,16 @@ | |||
13 | #define __SOUND_HDA_JACK_H | 13 | #define __SOUND_HDA_JACK_H |
14 | 14 | ||
15 | struct auto_pin_cfg; | 15 | struct auto_pin_cfg; |
16 | struct hda_jack_tbl; | ||
17 | |||
18 | typedef void (*hda_jack_callback) (struct hda_codec *, struct hda_jack_tbl *); | ||
16 | 19 | ||
17 | struct hda_jack_tbl { | 20 | struct hda_jack_tbl { |
18 | hda_nid_t nid; | 21 | hda_nid_t nid; |
19 | unsigned char action; /* event action (0 = none) */ | 22 | unsigned char action; /* event action (0 = none) */ |
20 | unsigned char tag; /* unsol event tag */ | 23 | unsigned char tag; /* unsol event tag */ |
21 | unsigned int private_data; /* arbitrary data */ | 24 | unsigned int private_data; /* arbitrary data */ |
25 | hda_jack_callback callback; | ||
22 | /* jack-detection stuff */ | 26 | /* jack-detection stuff */ |
23 | unsigned int pin_sense; /* cached pin-sense value */ | 27 | unsigned int pin_sense; /* cached pin-sense value */ |
24 | unsigned int jack_detect:1; /* capable of jack-detection? */ | 28 | unsigned int jack_detect:1; /* capable of jack-detection? */ |
@@ -61,6 +65,10 @@ void snd_hda_jack_set_dirty_all(struct hda_codec *codec); | |||
61 | 65 | ||
62 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, | 66 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, |
63 | unsigned char action); | 67 | unsigned char action); |
68 | int snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, | ||
69 | unsigned char action, | ||
70 | hda_jack_callback cb); | ||
71 | |||
64 | 72 | ||
65 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); | 73 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); |
66 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); | 74 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); |
@@ -74,5 +82,6 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, | |||
74 | 82 | ||
75 | void snd_hda_jack_report_sync(struct hda_codec *codec); | 83 | void snd_hda_jack_report_sync(struct hda_codec *codec); |
76 | 84 | ||
85 | void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res); | ||
77 | 86 | ||
78 | #endif /* __SOUND_HDA_JACK_H */ | 87 | #endif /* __SOUND_HDA_JACK_H */ |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 1b4c12941baa..09dbdc37f781 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -529,7 +529,7 @@ int snd_hda_create_hwdep(struct hda_codec *codec); | |||
529 | static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } | 529 | static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } |
530 | #endif | 530 | #endif |
531 | 531 | ||
532 | #if defined(CONFIG_SND_HDA_POWER_SAVE) && defined(CONFIG_SND_HDA_HWDEP) | 532 | #if defined(CONFIG_PM) && defined(CONFIG_SND_HDA_HWDEP) |
533 | int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec); | 533 | int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec); |
534 | #else | 534 | #else |
535 | static inline int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec) | 535 | static inline int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec) |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 6894ec66258c..045e5d32f5de 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -402,6 +402,9 @@ static void print_digital_conv(struct snd_info_buffer *buffer, | |||
402 | { | 402 | { |
403 | unsigned int digi1 = snd_hda_codec_read(codec, nid, 0, | 403 | unsigned int digi1 = snd_hda_codec_read(codec, nid, 0, |
404 | AC_VERB_GET_DIGI_CONVERT_1, 0); | 404 | AC_VERB_GET_DIGI_CONVERT_1, 0); |
405 | unsigned char digi2 = digi1 >> 8; | ||
406 | unsigned char digi3 = digi1 >> 16; | ||
407 | |||
405 | snd_iprintf(buffer, " Digital:"); | 408 | snd_iprintf(buffer, " Digital:"); |
406 | if (digi1 & AC_DIG1_ENABLE) | 409 | if (digi1 & AC_DIG1_ENABLE) |
407 | snd_iprintf(buffer, " Enabled"); | 410 | snd_iprintf(buffer, " Enabled"); |
@@ -419,9 +422,13 @@ static void print_digital_conv(struct snd_info_buffer *buffer, | |||
419 | snd_iprintf(buffer, " Pro"); | 422 | snd_iprintf(buffer, " Pro"); |
420 | if (digi1 & AC_DIG1_LEVEL) | 423 | if (digi1 & AC_DIG1_LEVEL) |
421 | snd_iprintf(buffer, " GenLevel"); | 424 | snd_iprintf(buffer, " GenLevel"); |
425 | if (digi3 & AC_DIG3_KAE) | ||
426 | snd_iprintf(buffer, " KAE"); | ||
422 | snd_iprintf(buffer, "\n"); | 427 | snd_iprintf(buffer, "\n"); |
423 | snd_iprintf(buffer, " Digital category: 0x%x\n", | 428 | snd_iprintf(buffer, " Digital category: 0x%x\n", |
424 | (digi1 >> 8) & AC_DIG2_CC); | 429 | digi2 & AC_DIG2_CC); |
430 | snd_iprintf(buffer, " IEC Coding Type: 0x%x\n", | ||
431 | digi3 & AC_DIG3_ICT); | ||
425 | } | 432 | } |
426 | 433 | ||
427 | static const char *get_pwr_state(u32 state) | 434 | static const char *get_pwr_state(u32 state) |
diff --git a/sound/pci/hda/hda_trace.h b/sound/pci/hda/hda_trace.h index 9884871ddb00..3a1c63161eb1 100644 --- a/sound/pci/hda/hda_trace.h +++ b/sound/pci/hda/hda_trace.h | |||
@@ -58,6 +58,7 @@ TRACE_EVENT(hda_bus_reset, | |||
58 | TP_printk("[%d]", __entry->card) | 58 | TP_printk("[%d]", __entry->card) |
59 | ); | 59 | ); |
60 | 60 | ||
61 | #ifdef CONFIG_PM | ||
61 | DECLARE_EVENT_CLASS(hda_power, | 62 | DECLARE_EVENT_CLASS(hda_power, |
62 | 63 | ||
63 | TP_PROTO(struct hda_codec *codec), | 64 | TP_PROTO(struct hda_codec *codec), |
@@ -87,6 +88,31 @@ DEFINE_EVENT(hda_power, hda_power_up, | |||
87 | TP_ARGS(codec) | 88 | TP_ARGS(codec) |
88 | ); | 89 | ); |
89 | 90 | ||
91 | TRACE_EVENT(hda_power_count, | ||
92 | TP_PROTO(struct hda_codec *codec), | ||
93 | TP_ARGS(codec), | ||
94 | TP_STRUCT__entry( | ||
95 | __field( unsigned int, card ) | ||
96 | __field( unsigned int, addr ) | ||
97 | __field( int, power_count ) | ||
98 | __field( int, power_on ) | ||
99 | __field( int, power_transition ) | ||
100 | ), | ||
101 | |||
102 | TP_fast_assign( | ||
103 | __entry->card = (codec)->bus->card->number; | ||
104 | __entry->addr = (codec)->addr; | ||
105 | __entry->power_count = (codec)->power_count; | ||
106 | __entry->power_on = (codec)->power_on; | ||
107 | __entry->power_transition = (codec)->power_transition; | ||
108 | ), | ||
109 | |||
110 | TP_printk("[%d:%d] power_count=%d, power_on=%d, power_transition=%d", | ||
111 | __entry->card, __entry->addr, __entry->power_count, | ||
112 | __entry->power_on, __entry->power_transition) | ||
113 | ); | ||
114 | #endif /* CONFIG_PM */ | ||
115 | |||
90 | TRACE_EVENT(hda_unsol_event, | 116 | TRACE_EVENT(hda_unsol_event, |
91 | 117 | ||
92 | TP_PROTO(struct hda_bus *bus, u32 res, u32 res_ex), | 118 | TP_PROTO(struct hda_bus *bus, u32 res, u32 res_ex), |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 0208fa121e5a..cdd43eadbc67 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -85,7 +85,7 @@ struct ad198x_spec { | |||
85 | unsigned int analog_beep: 1; /* analog beep input present */ | 85 | unsigned int analog_beep: 1; /* analog beep input present */ |
86 | unsigned int avoid_init_slave_vol:1; | 86 | unsigned int avoid_init_slave_vol:1; |
87 | 87 | ||
88 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 88 | #ifdef CONFIG_PM |
89 | struct hda_loopback_check loopback; | 89 | struct hda_loopback_check loopback; |
90 | #endif | 90 | #endif |
91 | /* for virtual master */ | 91 | /* for virtual master */ |
@@ -269,7 +269,7 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
269 | return 0; | 269 | return 0; |
270 | } | 270 | } |
271 | 271 | ||
272 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 272 | #ifdef CONFIG_PM |
273 | static int ad198x_check_power_status(struct hda_codec *codec, hda_nid_t nid) | 273 | static int ad198x_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
274 | { | 274 | { |
275 | struct ad198x_spec *spec = codec->spec; | 275 | struct ad198x_spec *spec = codec->spec; |
@@ -654,10 +654,8 @@ static const struct hda_codec_ops ad198x_patch_ops = { | |||
654 | .build_pcms = ad198x_build_pcms, | 654 | .build_pcms = ad198x_build_pcms, |
655 | .init = ad198x_init, | 655 | .init = ad198x_init, |
656 | .free = ad198x_free, | 656 | .free = ad198x_free, |
657 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
658 | .check_power_status = ad198x_check_power_status, | ||
659 | #endif | ||
660 | #ifdef CONFIG_PM | 657 | #ifdef CONFIG_PM |
658 | .check_power_status = ad198x_check_power_status, | ||
661 | .suspend = ad198x_suspend, | 659 | .suspend = ad198x_suspend, |
662 | #endif | 660 | #endif |
663 | .reboot_notify = ad198x_shutup, | 661 | .reboot_notify = ad198x_shutup, |
@@ -1231,7 +1229,7 @@ static const struct snd_pci_quirk ad1986a_cfg_tbl[] = { | |||
1231 | {} | 1229 | {} |
1232 | }; | 1230 | }; |
1233 | 1231 | ||
1234 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1232 | #ifdef CONFIG_PM |
1235 | static const struct hda_amp_list ad1986a_loopbacks[] = { | 1233 | static const struct hda_amp_list ad1986a_loopbacks[] = { |
1236 | { 0x13, HDA_OUTPUT, 0 }, /* Mic */ | 1234 | { 0x13, HDA_OUTPUT, 0 }, /* Mic */ |
1237 | { 0x14, HDA_OUTPUT, 0 }, /* Phone */ | 1235 | { 0x14, HDA_OUTPUT, 0 }, /* Phone */ |
@@ -1278,7 +1276,7 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1278 | spec->mixers[0] = ad1986a_mixers; | 1276 | spec->mixers[0] = ad1986a_mixers; |
1279 | spec->num_init_verbs = 1; | 1277 | spec->num_init_verbs = 1; |
1280 | spec->init_verbs[0] = ad1986a_init_verbs; | 1278 | spec->init_verbs[0] = ad1986a_init_verbs; |
1281 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1279 | #ifdef CONFIG_PM |
1282 | spec->loopback.amplist = ad1986a_loopbacks; | 1280 | spec->loopback.amplist = ad1986a_loopbacks; |
1283 | #endif | 1281 | #endif |
1284 | spec->vmaster_nid = 0x1b; | 1282 | spec->vmaster_nid = 0x1b; |
@@ -1537,7 +1535,7 @@ static const struct hda_verb ad1983_init_verbs[] = { | |||
1537 | { } /* end */ | 1535 | { } /* end */ |
1538 | }; | 1536 | }; |
1539 | 1537 | ||
1540 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1538 | #ifdef CONFIG_PM |
1541 | static const struct hda_amp_list ad1983_loopbacks[] = { | 1539 | static const struct hda_amp_list ad1983_loopbacks[] = { |
1542 | { 0x12, HDA_OUTPUT, 0 }, /* Mic */ | 1540 | { 0x12, HDA_OUTPUT, 0 }, /* Mic */ |
1543 | { 0x13, HDA_OUTPUT, 0 }, /* Line */ | 1541 | { 0x13, HDA_OUTPUT, 0 }, /* Line */ |
@@ -1576,7 +1574,7 @@ static int patch_ad1983(struct hda_codec *codec) | |||
1576 | spec->num_init_verbs = 1; | 1574 | spec->num_init_verbs = 1; |
1577 | spec->init_verbs[0] = ad1983_init_verbs; | 1575 | spec->init_verbs[0] = ad1983_init_verbs; |
1578 | spec->spdif_route = 0; | 1576 | spec->spdif_route = 0; |
1579 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1577 | #ifdef CONFIG_PM |
1580 | spec->loopback.amplist = ad1983_loopbacks; | 1578 | spec->loopback.amplist = ad1983_loopbacks; |
1581 | #endif | 1579 | #endif |
1582 | spec->vmaster_nid = 0x05; | 1580 | spec->vmaster_nid = 0x05; |
@@ -1704,7 +1702,7 @@ static const struct hda_verb ad1981_init_verbs[] = { | |||
1704 | { } /* end */ | 1702 | { } /* end */ |
1705 | }; | 1703 | }; |
1706 | 1704 | ||
1707 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1705 | #ifdef CONFIG_PM |
1708 | static const struct hda_amp_list ad1981_loopbacks[] = { | 1706 | static const struct hda_amp_list ad1981_loopbacks[] = { |
1709 | { 0x12, HDA_OUTPUT, 0 }, /* Front Mic */ | 1707 | { 0x12, HDA_OUTPUT, 0 }, /* Front Mic */ |
1710 | { 0x13, HDA_OUTPUT, 0 }, /* Line */ | 1708 | { 0x13, HDA_OUTPUT, 0 }, /* Line */ |
@@ -1812,7 +1810,7 @@ static const struct hda_input_mux ad1981_hp_capture_source = { | |||
1812 | .num_items = 3, | 1810 | .num_items = 3, |
1813 | .items = { | 1811 | .items = { |
1814 | { "Mic", 0x0 }, | 1812 | { "Mic", 0x0 }, |
1815 | { "Docking-Station", 0x1 }, | 1813 | { "Dock Mic", 0x1 }, |
1816 | { "Mix", 0x2 }, | 1814 | { "Mix", 0x2 }, |
1817 | }, | 1815 | }, |
1818 | }; | 1816 | }; |
@@ -1836,8 +1834,8 @@ static const struct snd_kcontrol_new ad1981_hp_mixers[] = { | |||
1836 | */ | 1834 | */ |
1837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x12, 0x0, HDA_OUTPUT), | 1835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x12, 0x0, HDA_OUTPUT), |
1838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), | 1836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), |
1839 | HDA_CODEC_VOLUME("Docking-Station Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 1837 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
1840 | HDA_CODEC_MUTE("Docking-Station Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 1838 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
1841 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x1c, 0x0, HDA_OUTPUT), | 1839 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x1c, 0x0, HDA_OUTPUT), |
1842 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), | 1840 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), |
1843 | /* FIXME: does this laptop have analog CD connection? */ | 1841 | /* FIXME: does this laptop have analog CD connection? */ |
@@ -1982,7 +1980,7 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1982 | spec->num_init_verbs = 1; | 1980 | spec->num_init_verbs = 1; |
1983 | spec->init_verbs[0] = ad1981_init_verbs; | 1981 | spec->init_verbs[0] = ad1981_init_verbs; |
1984 | spec->spdif_route = 0; | 1982 | spec->spdif_route = 0; |
1985 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1983 | #ifdef CONFIG_PM |
1986 | spec->loopback.amplist = ad1981_loopbacks; | 1984 | spec->loopback.amplist = ad1981_loopbacks; |
1987 | #endif | 1985 | #endif |
1988 | spec->vmaster_nid = 0x05; | 1986 | spec->vmaster_nid = 0x05; |
@@ -2807,7 +2805,7 @@ static void ad1988_laptop_unsol_event(struct hda_codec *codec, unsigned int res) | |||
2807 | snd_hda_sequence_write(codec, ad1988_laptop_hp_off); | 2805 | snd_hda_sequence_write(codec, ad1988_laptop_hp_off); |
2808 | } | 2806 | } |
2809 | 2807 | ||
2810 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2808 | #ifdef CONFIG_PM |
2811 | static const struct hda_amp_list ad1988_loopbacks[] = { | 2809 | static const struct hda_amp_list ad1988_loopbacks[] = { |
2812 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ | 2810 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ |
2813 | { 0x20, HDA_INPUT, 1 }, /* Line */ | 2811 | { 0x20, HDA_INPUT, 1 }, /* Line */ |
@@ -3399,7 +3397,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3399 | codec->patch_ops.unsol_event = ad1988_laptop_unsol_event; | 3397 | codec->patch_ops.unsol_event = ad1988_laptop_unsol_event; |
3400 | break; | 3398 | break; |
3401 | } | 3399 | } |
3402 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3400 | #ifdef CONFIG_PM |
3403 | spec->loopback.amplist = ad1988_loopbacks; | 3401 | spec->loopback.amplist = ad1988_loopbacks; |
3404 | #endif | 3402 | #endif |
3405 | spec->vmaster_nid = 0x04; | 3403 | spec->vmaster_nid = 0x04; |
@@ -3555,7 +3553,7 @@ static const struct hda_verb ad1884_init_verbs[] = { | |||
3555 | { } /* end */ | 3553 | { } /* end */ |
3556 | }; | 3554 | }; |
3557 | 3555 | ||
3558 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3556 | #ifdef CONFIG_PM |
3559 | static const struct hda_amp_list ad1884_loopbacks[] = { | 3557 | static const struct hda_amp_list ad1884_loopbacks[] = { |
3560 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ | 3558 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ |
3561 | { 0x20, HDA_INPUT, 1 }, /* Mic */ | 3559 | { 0x20, HDA_INPUT, 1 }, /* Mic */ |
@@ -3567,7 +3565,7 @@ static const struct hda_amp_list ad1884_loopbacks[] = { | |||
3567 | 3565 | ||
3568 | static const char * const ad1884_slave_vols[] = { | 3566 | static const char * const ad1884_slave_vols[] = { |
3569 | "PCM", "Mic", "Mono", "Front Mic", "Mic", "CD", | 3567 | "PCM", "Mic", "Mono", "Front Mic", "Mic", "CD", |
3570 | "Internal Mic", "Docking Mic", /* "Beep", */ "IEC958", | 3568 | "Internal Mic", "Dock Mic", /* "Beep", */ "IEC958", |
3571 | NULL | 3569 | NULL |
3572 | }; | 3570 | }; |
3573 | 3571 | ||
@@ -3602,7 +3600,7 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3602 | spec->num_init_verbs = 1; | 3600 | spec->num_init_verbs = 1; |
3603 | spec->init_verbs[0] = ad1884_init_verbs; | 3601 | spec->init_verbs[0] = ad1884_init_verbs; |
3604 | spec->spdif_route = 0; | 3602 | spec->spdif_route = 0; |
3605 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3603 | #ifdef CONFIG_PM |
3606 | spec->loopback.amplist = ad1884_loopbacks; | 3604 | spec->loopback.amplist = ad1884_loopbacks; |
3607 | #endif | 3605 | #endif |
3608 | spec->vmaster_nid = 0x04; | 3606 | spec->vmaster_nid = 0x04; |
@@ -3628,7 +3626,7 @@ static const struct hda_input_mux ad1984_thinkpad_capture_source = { | |||
3628 | { "Mic", 0x0 }, | 3626 | { "Mic", 0x0 }, |
3629 | { "Internal Mic", 0x1 }, | 3627 | { "Internal Mic", 0x1 }, |
3630 | { "Mix", 0x3 }, | 3628 | { "Mix", 0x3 }, |
3631 | { "Docking-Station", 0x4 }, | 3629 | { "Dock Mic", 0x4 }, |
3632 | }, | 3630 | }, |
3633 | }; | 3631 | }; |
3634 | 3632 | ||
@@ -3657,8 +3655,8 @@ static const struct snd_kcontrol_new ad1984_thinkpad_mixers[] = { | |||
3657 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | 3655 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), |
3658 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | 3656 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), |
3659 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | 3657 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), |
3660 | HDA_CODEC_VOLUME("Docking Mic Playback Volume", 0x20, 0x04, HDA_INPUT), | 3658 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), |
3661 | HDA_CODEC_MUTE("Docking Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | 3659 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), |
3662 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x14, 0x0, HDA_INPUT), | 3660 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x14, 0x0, HDA_INPUT), |
3663 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x15, 0x0, HDA_INPUT), | 3661 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x15, 0x0, HDA_INPUT), |
3664 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x25, 0x0, HDA_OUTPUT), | 3662 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x25, 0x0, HDA_OUTPUT), |
@@ -3994,7 +3992,7 @@ static const struct hda_verb ad1884a_init_verbs[] = { | |||
3994 | { } /* end */ | 3992 | { } /* end */ |
3995 | }; | 3993 | }; |
3996 | 3994 | ||
3997 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3995 | #ifdef CONFIG_PM |
3998 | static const struct hda_amp_list ad1884a_loopbacks[] = { | 3996 | static const struct hda_amp_list ad1884a_loopbacks[] = { |
3999 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ | 3997 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ |
4000 | { 0x20, HDA_INPUT, 1 }, /* Mic */ | 3998 | { 0x20, HDA_INPUT, 1 }, /* Mic */ |
@@ -4602,7 +4600,7 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
4602 | spec->num_init_verbs = 1; | 4600 | spec->num_init_verbs = 1; |
4603 | spec->init_verbs[0] = ad1884a_init_verbs; | 4601 | spec->init_verbs[0] = ad1884a_init_verbs; |
4604 | spec->spdif_route = 0; | 4602 | spec->spdif_route = 0; |
4605 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4603 | #ifdef CONFIG_PM |
4606 | spec->loopback.amplist = ad1884a_loopbacks; | 4604 | spec->loopback.amplist = ad1884a_loopbacks; |
4607 | #endif | 4605 | #endif |
4608 | codec->patch_ops = ad198x_patch_ops; | 4606 | codec->patch_ops = ad198x_patch_ops; |
@@ -4814,6 +4812,32 @@ static const struct snd_kcontrol_new ad1882_3stack_mixers[] = { | |||
4814 | { } /* end */ | 4812 | { } /* end */ |
4815 | }; | 4813 | }; |
4816 | 4814 | ||
4815 | /* simple auto-mute control for AD1882 3-stack board */ | ||
4816 | #define AD1882_HP_EVENT 0x01 | ||
4817 | |||
4818 | static void ad1882_3stack_automute(struct hda_codec *codec) | ||
4819 | { | ||
4820 | bool mute = snd_hda_jack_detect(codec, 0x11); | ||
4821 | snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4822 | mute ? 0 : PIN_OUT); | ||
4823 | } | ||
4824 | |||
4825 | static int ad1882_3stack_automute_init(struct hda_codec *codec) | ||
4826 | { | ||
4827 | ad198x_init(codec); | ||
4828 | ad1882_3stack_automute(codec); | ||
4829 | return 0; | ||
4830 | } | ||
4831 | |||
4832 | static void ad1882_3stack_unsol_event(struct hda_codec *codec, unsigned int res) | ||
4833 | { | ||
4834 | switch (res >> 26) { | ||
4835 | case AD1882_HP_EVENT: | ||
4836 | ad1882_3stack_automute(codec); | ||
4837 | break; | ||
4838 | } | ||
4839 | } | ||
4840 | |||
4817 | static const struct snd_kcontrol_new ad1882_6stack_mixers[] = { | 4841 | static const struct snd_kcontrol_new ad1882_6stack_mixers[] = { |
4818 | HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT), | 4842 | HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
4819 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT), | 4843 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT), |
@@ -4928,7 +4952,12 @@ static const struct hda_verb ad1882_init_verbs[] = { | |||
4928 | { } /* end */ | 4952 | { } /* end */ |
4929 | }; | 4953 | }; |
4930 | 4954 | ||
4931 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4955 | static const struct hda_verb ad1882_3stack_automute_verbs[] = { |
4956 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1882_HP_EVENT}, | ||
4957 | { } /* end */ | ||
4958 | }; | ||
4959 | |||
4960 | #ifdef CONFIG_PM | ||
4932 | static const struct hda_amp_list ad1882_loopbacks[] = { | 4961 | static const struct hda_amp_list ad1882_loopbacks[] = { |
4933 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ | 4962 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ |
4934 | { 0x20, HDA_INPUT, 1 }, /* Mic */ | 4963 | { 0x20, HDA_INPUT, 1 }, /* Mic */ |
@@ -4942,12 +4971,14 @@ static const struct hda_amp_list ad1882_loopbacks[] = { | |||
4942 | enum { | 4971 | enum { |
4943 | AD1882_3STACK, | 4972 | AD1882_3STACK, |
4944 | AD1882_6STACK, | 4973 | AD1882_6STACK, |
4974 | AD1882_3STACK_AUTOMUTE, | ||
4945 | AD1882_MODELS | 4975 | AD1882_MODELS |
4946 | }; | 4976 | }; |
4947 | 4977 | ||
4948 | static const char * const ad1882_models[AD1986A_MODELS] = { | 4978 | static const char * const ad1882_models[AD1986A_MODELS] = { |
4949 | [AD1882_3STACK] = "3stack", | 4979 | [AD1882_3STACK] = "3stack", |
4950 | [AD1882_6STACK] = "6stack", | 4980 | [AD1882_6STACK] = "6stack", |
4981 | [AD1882_3STACK_AUTOMUTE] = "3stack-automute", | ||
4951 | }; | 4982 | }; |
4952 | 4983 | ||
4953 | 4984 | ||
@@ -4989,7 +5020,7 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4989 | spec->num_init_verbs = 1; | 5020 | spec->num_init_verbs = 1; |
4990 | spec->init_verbs[0] = ad1882_init_verbs; | 5021 | spec->init_verbs[0] = ad1882_init_verbs; |
4991 | spec->spdif_route = 0; | 5022 | spec->spdif_route = 0; |
4992 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5023 | #ifdef CONFIG_PM |
4993 | spec->loopback.amplist = ad1882_loopbacks; | 5024 | spec->loopback.amplist = ad1882_loopbacks; |
4994 | #endif | 5025 | #endif |
4995 | spec->vmaster_nid = 0x04; | 5026 | spec->vmaster_nid = 0x04; |
@@ -5002,6 +5033,7 @@ static int patch_ad1882(struct hda_codec *codec) | |||
5002 | switch (board_config) { | 5033 | switch (board_config) { |
5003 | default: | 5034 | default: |
5004 | case AD1882_3STACK: | 5035 | case AD1882_3STACK: |
5036 | case AD1882_3STACK_AUTOMUTE: | ||
5005 | spec->num_mixers = 3; | 5037 | spec->num_mixers = 3; |
5006 | spec->mixers[2] = ad1882_3stack_mixers; | 5038 | spec->mixers[2] = ad1882_3stack_mixers; |
5007 | spec->channel_mode = ad1882_modes; | 5039 | spec->channel_mode = ad1882_modes; |
@@ -5009,6 +5041,12 @@ static int patch_ad1882(struct hda_codec *codec) | |||
5009 | spec->need_dac_fix = 1; | 5041 | spec->need_dac_fix = 1; |
5010 | spec->multiout.max_channels = 2; | 5042 | spec->multiout.max_channels = 2; |
5011 | spec->multiout.num_dacs = 1; | 5043 | spec->multiout.num_dacs = 1; |
5044 | if (board_config != AD1882_3STACK) { | ||
5045 | spec->init_verbs[spec->num_init_verbs++] = | ||
5046 | ad1882_3stack_automute_verbs; | ||
5047 | codec->patch_ops.unsol_event = ad1882_3stack_unsol_event; | ||
5048 | codec->patch_ops.init = ad1882_3stack_automute_init; | ||
5049 | } | ||
5012 | break; | 5050 | break; |
5013 | case AD1882_6STACK: | 5051 | case AD1882_6STACK: |
5014 | spec->num_mixers = 3; | 5052 | spec->num_mixers = 3; |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 0c4c1a61b378..fcfc9f0a056b 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -34,7 +34,8 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | struct cs_spec { | 36 | struct cs_spec { |
37 | int board_config; | 37 | struct hda_gen_spec gen; |
38 | |||
38 | struct auto_pin_cfg autocfg; | 39 | struct auto_pin_cfg autocfg; |
39 | struct hda_multi_out multiout; | 40 | struct hda_multi_out multiout; |
40 | struct snd_kcontrol *vmaster_sw; | 41 | struct snd_kcontrol *vmaster_sw; |
@@ -80,16 +81,20 @@ enum { | |||
80 | CS420X_MBP53, | 81 | CS420X_MBP53, |
81 | CS420X_MBP55, | 82 | CS420X_MBP55, |
82 | CS420X_IMAC27, | 83 | CS420X_IMAC27, |
83 | CS420X_IMAC27_122, | 84 | CS420X_GPIO_13, |
84 | CS420X_APPLE, | 85 | CS420X_GPIO_23, |
86 | CS420X_MBP101, | ||
87 | CS420X_MBP101_COEF, | ||
85 | CS420X_AUTO, | 88 | CS420X_AUTO, |
86 | CS420X_MODELS | 89 | /* aliases */ |
90 | CS420X_IMAC27_122 = CS420X_GPIO_23, | ||
91 | CS420X_APPLE = CS420X_GPIO_13, | ||
87 | }; | 92 | }; |
88 | 93 | ||
89 | /* CS421x boards */ | 94 | /* CS421x boards */ |
90 | enum { | 95 | enum { |
91 | CS421X_CDB4210, | 96 | CS421X_CDB4210, |
92 | CS421X_MODELS | 97 | CS421X_SENSE_B, |
93 | }; | 98 | }; |
94 | 99 | ||
95 | /* Vendor-specific processing widget */ | 100 | /* Vendor-specific processing widget */ |
@@ -1157,6 +1162,14 @@ static const struct hda_verb cs_errata_init_verbs[] = { | |||
1157 | {} /* terminator */ | 1162 | {} /* terminator */ |
1158 | }; | 1163 | }; |
1159 | 1164 | ||
1165 | static const struct hda_verb mbp101_init_verbs[] = { | ||
1166 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0002}, | ||
1167 | {0x11, AC_VERB_SET_PROC_COEF, 0x100a}, | ||
1168 | {0x11, AC_VERB_SET_COEF_INDEX, 0x0004}, | ||
1169 | {0x11, AC_VERB_SET_PROC_COEF, 0x000f}, | ||
1170 | {} | ||
1171 | }; | ||
1172 | |||
1160 | /* SPDIF setup */ | 1173 | /* SPDIF setup */ |
1161 | static void init_digital(struct hda_codec *codec) | 1174 | static void init_digital(struct hda_codec *codec) |
1162 | { | 1175 | { |
@@ -1193,7 +1206,6 @@ static int cs_init(struct hda_codec *codec) | |||
1193 | init_output(codec); | 1206 | init_output(codec); |
1194 | init_input(codec); | 1207 | init_input(codec); |
1195 | init_digital(codec); | 1208 | init_digital(codec); |
1196 | snd_hda_jack_report_sync(codec); | ||
1197 | 1209 | ||
1198 | return 0; | 1210 | return 0; |
1199 | } | 1211 | } |
@@ -1279,38 +1291,32 @@ static int cs_parse_auto_config(struct hda_codec *codec) | |||
1279 | return 0; | 1291 | return 0; |
1280 | } | 1292 | } |
1281 | 1293 | ||
1282 | static const char * const cs420x_models[CS420X_MODELS] = { | 1294 | static const struct hda_model_fixup cs420x_models[] = { |
1283 | [CS420X_MBP53] = "mbp53", | 1295 | { .id = CS420X_MBP53, .name = "mbp53" }, |
1284 | [CS420X_MBP55] = "mbp55", | 1296 | { .id = CS420X_MBP55, .name = "mbp55" }, |
1285 | [CS420X_IMAC27] = "imac27", | 1297 | { .id = CS420X_IMAC27, .name = "imac27" }, |
1286 | [CS420X_IMAC27_122] = "imac27_122", | 1298 | { .id = CS420X_IMAC27_122, .name = "imac27_122" }, |
1287 | [CS420X_APPLE] = "apple", | 1299 | { .id = CS420X_APPLE, .name = "apple" }, |
1288 | [CS420X_AUTO] = "auto", | 1300 | { .id = CS420X_MBP101, .name = "mbp101" }, |
1301 | {} | ||
1289 | }; | 1302 | }; |
1290 | 1303 | ||
1291 | 1304 | static const struct snd_pci_quirk cs420x_fixup_tbl[] = { | |
1292 | static const struct snd_pci_quirk cs420x_cfg_tbl[] = { | ||
1293 | SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), | 1305 | SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), |
1294 | SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), | 1306 | SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), |
1295 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), | 1307 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), |
1296 | SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), | 1308 | SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), |
1297 | /* this conflicts with too many other models */ | 1309 | /* this conflicts with too many other models */ |
1298 | /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ | 1310 | /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ |
1299 | {} /* terminator */ | ||
1300 | }; | ||
1301 | 1311 | ||
1302 | static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { | 1312 | /* codec SSID */ |
1303 | SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), | 1313 | SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), |
1314 | SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), | ||
1304 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), | 1315 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), |
1305 | {} /* terminator */ | 1316 | {} /* terminator */ |
1306 | }; | 1317 | }; |
1307 | 1318 | ||
1308 | struct cs_pincfg { | 1319 | static const struct hda_pintbl mbp53_pincfgs[] = { |
1309 | hda_nid_t nid; | ||
1310 | u32 val; | ||
1311 | }; | ||
1312 | |||
1313 | static const struct cs_pincfg mbp53_pincfgs[] = { | ||
1314 | { 0x09, 0x012b4050 }, | 1320 | { 0x09, 0x012b4050 }, |
1315 | { 0x0a, 0x90100141 }, | 1321 | { 0x0a, 0x90100141 }, |
1316 | { 0x0b, 0x90100140 }, | 1322 | { 0x0b, 0x90100140 }, |
@@ -1324,7 +1330,7 @@ static const struct cs_pincfg mbp53_pincfgs[] = { | |||
1324 | {} /* terminator */ | 1330 | {} /* terminator */ |
1325 | }; | 1331 | }; |
1326 | 1332 | ||
1327 | static const struct cs_pincfg mbp55_pincfgs[] = { | 1333 | static const struct hda_pintbl mbp55_pincfgs[] = { |
1328 | { 0x09, 0x012b4030 }, | 1334 | { 0x09, 0x012b4030 }, |
1329 | { 0x0a, 0x90100121 }, | 1335 | { 0x0a, 0x90100121 }, |
1330 | { 0x0b, 0x90100120 }, | 1336 | { 0x0b, 0x90100120 }, |
@@ -1338,7 +1344,7 @@ static const struct cs_pincfg mbp55_pincfgs[] = { | |||
1338 | {} /* terminator */ | 1344 | {} /* terminator */ |
1339 | }; | 1345 | }; |
1340 | 1346 | ||
1341 | static const struct cs_pincfg imac27_pincfgs[] = { | 1347 | static const struct hda_pintbl imac27_pincfgs[] = { |
1342 | { 0x09, 0x012b4050 }, | 1348 | { 0x09, 0x012b4050 }, |
1343 | { 0x0a, 0x90100140 }, | 1349 | { 0x0a, 0x90100140 }, |
1344 | { 0x0b, 0x90100142 }, | 1350 | { 0x0b, 0x90100142 }, |
@@ -1352,22 +1358,78 @@ static const struct cs_pincfg imac27_pincfgs[] = { | |||
1352 | {} /* terminator */ | 1358 | {} /* terminator */ |
1353 | }; | 1359 | }; |
1354 | 1360 | ||
1355 | static const struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { | 1361 | static const struct hda_pintbl mbp101_pincfgs[] = { |
1356 | [CS420X_MBP53] = mbp53_pincfgs, | 1362 | { 0x0d, 0x40ab90f0 }, |
1357 | [CS420X_MBP55] = mbp55_pincfgs, | 1363 | { 0x0e, 0x90a600f0 }, |
1358 | [CS420X_IMAC27] = imac27_pincfgs, | 1364 | { 0x12, 0x50a600f0 }, |
1365 | {} /* terminator */ | ||
1359 | }; | 1366 | }; |
1360 | 1367 | ||
1361 | static void fix_pincfg(struct hda_codec *codec, int model, | 1368 | static void cs420x_fixup_gpio_13(struct hda_codec *codec, |
1362 | const struct cs_pincfg **pin_configs) | 1369 | const struct hda_fixup *fix, int action) |
1363 | { | 1370 | { |
1364 | const struct cs_pincfg *cfg = pin_configs[model]; | 1371 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
1365 | if (!cfg) | 1372 | struct cs_spec *spec = codec->spec; |
1366 | return; | 1373 | spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ |
1367 | for (; cfg->nid; cfg++) | 1374 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ |
1368 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | 1375 | spec->gpio_mask = spec->gpio_dir = |
1376 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
1377 | } | ||
1369 | } | 1378 | } |
1370 | 1379 | ||
1380 | static void cs420x_fixup_gpio_23(struct hda_codec *codec, | ||
1381 | const struct hda_fixup *fix, int action) | ||
1382 | { | ||
1383 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
1384 | struct cs_spec *spec = codec->spec; | ||
1385 | spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ | ||
1386 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ | ||
1387 | spec->gpio_mask = spec->gpio_dir = | ||
1388 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
1389 | } | ||
1390 | } | ||
1391 | |||
1392 | static const struct hda_fixup cs420x_fixups[] = { | ||
1393 | [CS420X_MBP53] = { | ||
1394 | .type = HDA_FIXUP_PINS, | ||
1395 | .v.pins = mbp53_pincfgs, | ||
1396 | .chained = true, | ||
1397 | .chain_id = CS420X_APPLE, | ||
1398 | }, | ||
1399 | [CS420X_MBP55] = { | ||
1400 | .type = HDA_FIXUP_PINS, | ||
1401 | .v.pins = mbp55_pincfgs, | ||
1402 | .chained = true, | ||
1403 | .chain_id = CS420X_GPIO_13, | ||
1404 | }, | ||
1405 | [CS420X_IMAC27] = { | ||
1406 | .type = HDA_FIXUP_PINS, | ||
1407 | .v.pins = imac27_pincfgs, | ||
1408 | .chained = true, | ||
1409 | .chain_id = CS420X_GPIO_13, | ||
1410 | }, | ||
1411 | [CS420X_GPIO_13] = { | ||
1412 | .type = HDA_FIXUP_FUNC, | ||
1413 | .v.func = cs420x_fixup_gpio_13, | ||
1414 | }, | ||
1415 | [CS420X_GPIO_23] = { | ||
1416 | .type = HDA_FIXUP_FUNC, | ||
1417 | .v.func = cs420x_fixup_gpio_23, | ||
1418 | }, | ||
1419 | [CS420X_MBP101] = { | ||
1420 | .type = HDA_FIXUP_PINS, | ||
1421 | .v.pins = mbp101_pincfgs, | ||
1422 | .chained = true, | ||
1423 | .chain_id = CS420X_MBP101_COEF, | ||
1424 | }, | ||
1425 | [CS420X_MBP101_COEF] = { | ||
1426 | .type = HDA_FIXUP_VERBS, | ||
1427 | .v.verbs = mbp101_init_verbs, | ||
1428 | .chained = true, | ||
1429 | .chain_id = CS420X_GPIO_13, | ||
1430 | }, | ||
1431 | }; | ||
1432 | |||
1371 | static int patch_cs420x(struct hda_codec *codec) | 1433 | static int patch_cs420x(struct hda_codec *codec) |
1372 | { | 1434 | { |
1373 | struct cs_spec *spec; | 1435 | struct cs_spec *spec; |
@@ -1380,33 +1442,9 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1380 | 1442 | ||
1381 | spec->vendor_nid = CS420X_VENDOR_NID; | 1443 | spec->vendor_nid = CS420X_VENDOR_NID; |
1382 | 1444 | ||
1383 | spec->board_config = | 1445 | snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, |
1384 | snd_hda_check_board_config(codec, CS420X_MODELS, | 1446 | cs420x_fixups); |
1385 | cs420x_models, cs420x_cfg_tbl); | 1447 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
1386 | if (spec->board_config < 0) | ||
1387 | spec->board_config = | ||
1388 | snd_hda_check_board_codec_sid_config(codec, | ||
1389 | CS420X_MODELS, NULL, cs420x_codec_cfg_tbl); | ||
1390 | if (spec->board_config >= 0) | ||
1391 | fix_pincfg(codec, spec->board_config, cs_pincfgs); | ||
1392 | |||
1393 | switch (spec->board_config) { | ||
1394 | case CS420X_IMAC27: | ||
1395 | case CS420X_MBP53: | ||
1396 | case CS420X_MBP55: | ||
1397 | case CS420X_APPLE: | ||
1398 | spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ | ||
1399 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ | ||
1400 | spec->gpio_mask = spec->gpio_dir = | ||
1401 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
1402 | break; | ||
1403 | case CS420X_IMAC27_122: | ||
1404 | spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ | ||
1405 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ | ||
1406 | spec->gpio_mask = spec->gpio_dir = | ||
1407 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
1408 | break; | ||
1409 | } | ||
1410 | 1448 | ||
1411 | err = cs_parse_auto_config(codec); | 1449 | err = cs_parse_auto_config(codec); |
1412 | if (err < 0) | 1450 | if (err < 0) |
@@ -1414,6 +1452,8 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1414 | 1452 | ||
1415 | codec->patch_ops = cs_patch_ops; | 1453 | codec->patch_ops = cs_patch_ops; |
1416 | 1454 | ||
1455 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | ||
1456 | |||
1417 | return 0; | 1457 | return 0; |
1418 | 1458 | ||
1419 | error: | 1459 | error: |
@@ -1431,11 +1471,12 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1431 | */ | 1471 | */ |
1432 | 1472 | ||
1433 | /* CS4210 board names */ | 1473 | /* CS4210 board names */ |
1434 | static const char *cs421x_models[CS421X_MODELS] = { | 1474 | static const struct hda_model_fixup cs421x_models[] = { |
1435 | [CS421X_CDB4210] = "cdb4210", | 1475 | { .id = CS421X_CDB4210, .name = "cdb4210" }, |
1476 | {} | ||
1436 | }; | 1477 | }; |
1437 | 1478 | ||
1438 | static const struct snd_pci_quirk cs421x_cfg_tbl[] = { | 1479 | static const struct snd_pci_quirk cs421x_fixup_tbl[] = { |
1439 | /* Test Intel board + CDB2410 */ | 1480 | /* Test Intel board + CDB2410 */ |
1440 | SND_PCI_QUIRK(0x8086, 0x5001, "DP45SG/CDB4210", CS421X_CDB4210), | 1481 | SND_PCI_QUIRK(0x8086, 0x5001, "DP45SG/CDB4210", CS421X_CDB4210), |
1441 | {} /* terminator */ | 1482 | {} /* terminator */ |
@@ -1443,7 +1484,7 @@ static const struct snd_pci_quirk cs421x_cfg_tbl[] = { | |||
1443 | 1484 | ||
1444 | /* CS4210 board pinconfigs */ | 1485 | /* CS4210 board pinconfigs */ |
1445 | /* Default CS4210 (CDB4210)*/ | 1486 | /* Default CS4210 (CDB4210)*/ |
1446 | static const struct cs_pincfg cdb4210_pincfgs[] = { | 1487 | static const struct hda_pintbl cdb4210_pincfgs[] = { |
1447 | { 0x05, 0x0321401f }, | 1488 | { 0x05, 0x0321401f }, |
1448 | { 0x06, 0x90170010 }, | 1489 | { 0x06, 0x90170010 }, |
1449 | { 0x07, 0x03813031 }, | 1490 | { 0x07, 0x03813031 }, |
@@ -1453,8 +1494,26 @@ static const struct cs_pincfg cdb4210_pincfgs[] = { | |||
1453 | {} /* terminator */ | 1494 | {} /* terminator */ |
1454 | }; | 1495 | }; |
1455 | 1496 | ||
1456 | static const struct cs_pincfg *cs421x_pincfgs[CS421X_MODELS] = { | 1497 | /* Setup GPIO/SENSE for each board (if used) */ |
1457 | [CS421X_CDB4210] = cdb4210_pincfgs, | 1498 | static void cs421x_fixup_sense_b(struct hda_codec *codec, |
1499 | const struct hda_fixup *fix, int action) | ||
1500 | { | ||
1501 | struct cs_spec *spec = codec->spec; | ||
1502 | if (action == HDA_FIXUP_ACT_PRE_PROBE) | ||
1503 | spec->sense_b = 1; | ||
1504 | } | ||
1505 | |||
1506 | static const struct hda_fixup cs421x_fixups[] = { | ||
1507 | [CS421X_CDB4210] = { | ||
1508 | .type = HDA_FIXUP_PINS, | ||
1509 | .v.pins = cdb4210_pincfgs, | ||
1510 | .chained = true, | ||
1511 | .chain_id = CS421X_SENSE_B, | ||
1512 | }, | ||
1513 | [CS421X_SENSE_B] = { | ||
1514 | .type = HDA_FIXUP_FUNC, | ||
1515 | .v.func = cs421x_fixup_sense_b, | ||
1516 | } | ||
1458 | }; | 1517 | }; |
1459 | 1518 | ||
1460 | static const struct hda_verb cs421x_coef_init_verbs[] = { | 1519 | static const struct hda_verb cs421x_coef_init_verbs[] = { |
@@ -1643,7 +1702,6 @@ static int cs421x_init(struct hda_codec *codec) | |||
1643 | init_output(codec); | 1702 | init_output(codec); |
1644 | init_input(codec); | 1703 | init_input(codec); |
1645 | init_cs421x_digital(codec); | 1704 | init_cs421x_digital(codec); |
1646 | snd_hda_jack_report_sync(codec); | ||
1647 | 1705 | ||
1648 | return 0; | 1706 | return 0; |
1649 | } | 1707 | } |
@@ -1937,26 +1995,9 @@ static int patch_cs4210(struct hda_codec *codec) | |||
1937 | 1995 | ||
1938 | spec->vendor_nid = CS4210_VENDOR_NID; | 1996 | spec->vendor_nid = CS4210_VENDOR_NID; |
1939 | 1997 | ||
1940 | spec->board_config = | 1998 | snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, |
1941 | snd_hda_check_board_config(codec, CS421X_MODELS, | 1999 | cs421x_fixups); |
1942 | cs421x_models, cs421x_cfg_tbl); | 2000 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
1943 | if (spec->board_config >= 0) | ||
1944 | fix_pincfg(codec, spec->board_config, cs421x_pincfgs); | ||
1945 | /* | ||
1946 | Setup GPIO/SENSE for each board (if used) | ||
1947 | */ | ||
1948 | switch (spec->board_config) { | ||
1949 | case CS421X_CDB4210: | ||
1950 | snd_printd("CS4210 board: %s\n", | ||
1951 | cs421x_models[spec->board_config]); | ||
1952 | /* spec->gpio_mask = 3; | ||
1953 | spec->gpio_dir = 3; | ||
1954 | spec->gpio_data = 3; | ||
1955 | */ | ||
1956 | spec->sense_b = 1; | ||
1957 | |||
1958 | break; | ||
1959 | } | ||
1960 | 2001 | ||
1961 | /* | 2002 | /* |
1962 | Update the GPIO/DMIC/SENSE_B pinmux before the configuration | 2003 | Update the GPIO/DMIC/SENSE_B pinmux before the configuration |
@@ -1971,6 +2012,8 @@ static int patch_cs4210(struct hda_codec *codec) | |||
1971 | 2012 | ||
1972 | codec->patch_ops = cs421x_patch_ops; | 2013 | codec->patch_ops = cs421x_patch_ops; |
1973 | 2014 | ||
2015 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | ||
2016 | |||
1974 | return 0; | 2017 | return 0; |
1975 | 2018 | ||
1976 | error: | 2019 | error: |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 5e22a8f43d2e..03b1dc317ff0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -553,7 +553,7 @@ static int conexant_build_controls(struct hda_codec *codec) | |||
553 | return 0; | 553 | return 0; |
554 | } | 554 | } |
555 | 555 | ||
556 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 556 | #ifdef CONFIG_PM |
557 | static int conexant_suspend(struct hda_codec *codec) | 557 | static int conexant_suspend(struct hda_codec *codec) |
558 | { | 558 | { |
559 | snd_hda_shutup_pins(codec); | 559 | snd_hda_shutup_pins(codec); |
@@ -567,7 +567,7 @@ static const struct hda_codec_ops conexant_patch_ops = { | |||
567 | .init = conexant_init, | 567 | .init = conexant_init, |
568 | .free = conexant_free, | 568 | .free = conexant_free, |
569 | .set_power_state = conexant_set_power, | 569 | .set_power_state = conexant_set_power, |
570 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 570 | #ifdef CONFIG_PM |
571 | .suspend = conexant_suspend, | 571 | .suspend = conexant_suspend, |
572 | #endif | 572 | #endif |
573 | .reboot_notify = snd_hda_shutup_pins, | 573 | .reboot_notify = snd_hda_shutup_pins, |
@@ -1710,8 +1710,8 @@ static const struct snd_kcontrol_new cxt5051_capture_mixers[] = { | |||
1710 | HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT), | 1710 | HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT), |
1711 | HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT), | 1711 | HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT), |
1712 | HDA_CODEC_MUTE("Mic Switch", 0x14, 0x01, HDA_INPUT), | 1712 | HDA_CODEC_MUTE("Mic Switch", 0x14, 0x01, HDA_INPUT), |
1713 | HDA_CODEC_VOLUME("Docking Mic Volume", 0x15, 0x00, HDA_INPUT), | 1713 | HDA_CODEC_VOLUME("Dock Mic Volume", 0x15, 0x00, HDA_INPUT), |
1714 | HDA_CODEC_MUTE("Docking Mic Switch", 0x15, 0x00, HDA_INPUT), | 1714 | HDA_CODEC_MUTE("Dock Mic Switch", 0x15, 0x00, HDA_INPUT), |
1715 | {} | 1715 | {} |
1716 | }; | 1716 | }; |
1717 | 1717 | ||
@@ -3402,7 +3402,7 @@ static void cx_auto_update_speakers(struct hda_codec *codec) | |||
3402 | do_automute(codec, cfg->line_outs, cfg->line_out_pins, on); | 3402 | do_automute(codec, cfg->line_outs, cfg->line_out_pins, on); |
3403 | } | 3403 | } |
3404 | 3404 | ||
3405 | static void cx_auto_hp_automute(struct hda_codec *codec) | 3405 | static void cx_auto_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) |
3406 | { | 3406 | { |
3407 | struct conexant_spec *spec = codec->spec; | 3407 | struct conexant_spec *spec = codec->spec; |
3408 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3408 | struct auto_pin_cfg *cfg = &spec->autocfg; |
@@ -3413,7 +3413,7 @@ static void cx_auto_hp_automute(struct hda_codec *codec) | |||
3413 | cx_auto_update_speakers(codec); | 3413 | cx_auto_update_speakers(codec); |
3414 | } | 3414 | } |
3415 | 3415 | ||
3416 | static void cx_auto_line_automute(struct hda_codec *codec) | 3416 | static void cx_auto_line_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) |
3417 | { | 3417 | { |
3418 | struct conexant_spec *spec = codec->spec; | 3418 | struct conexant_spec *spec = codec->spec; |
3419 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3419 | struct auto_pin_cfg *cfg = &spec->autocfg; |
@@ -3540,8 +3540,9 @@ static int __select_input_connection(struct hda_codec *codec, hda_nid_t mux, | |||
3540 | hda_nid_t pin, hda_nid_t *srcp, | 3540 | hda_nid_t pin, hda_nid_t *srcp, |
3541 | bool do_select, int depth) | 3541 | bool do_select, int depth) |
3542 | { | 3542 | { |
3543 | struct conexant_spec *spec = codec->spec; | ||
3543 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | 3544 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
3544 | int i, nums; | 3545 | int startidx, i, nums; |
3545 | 3546 | ||
3546 | switch (get_wcaps_type(get_wcaps(codec, mux))) { | 3547 | switch (get_wcaps_type(get_wcaps(codec, mux))) { |
3547 | case AC_WID_AUD_IN: | 3548 | case AC_WID_AUD_IN: |
@@ -3565,14 +3566,25 @@ static int __select_input_connection(struct hda_codec *codec, hda_nid_t mux, | |||
3565 | depth++; | 3566 | depth++; |
3566 | if (depth == 2) | 3567 | if (depth == 2) |
3567 | return -1; | 3568 | return -1; |
3569 | |||
3570 | /* Try to rotate around connections to avoid one boost controlling | ||
3571 | another input path as well */ | ||
3572 | startidx = 0; | ||
3573 | for (i = 0; i < spec->private_imux.num_items; i++) | ||
3574 | if (spec->imux_info[i].pin == pin) { | ||
3575 | startidx = i; | ||
3576 | break; | ||
3577 | } | ||
3578 | |||
3568 | for (i = 0; i < nums; i++) { | 3579 | for (i = 0; i < nums; i++) { |
3569 | int ret = __select_input_connection(codec, conn[i], pin, srcp, | 3580 | int j = (i + startidx) % nums; |
3581 | int ret = __select_input_connection(codec, conn[j], pin, srcp, | ||
3570 | do_select, depth); | 3582 | do_select, depth); |
3571 | if (ret >= 0) { | 3583 | if (ret >= 0) { |
3572 | if (do_select) | 3584 | if (do_select) |
3573 | snd_hda_codec_write(codec, mux, 0, | 3585 | snd_hda_codec_write(codec, mux, 0, |
3574 | AC_VERB_SET_CONNECT_SEL, i); | 3586 | AC_VERB_SET_CONNECT_SEL, j); |
3575 | return i; | 3587 | return j; |
3576 | } | 3588 | } |
3577 | } | 3589 | } |
3578 | return -1; | 3590 | return -1; |
@@ -3652,7 +3664,7 @@ static bool select_automic(struct hda_codec *codec, int idx, bool detect) | |||
3652 | } | 3664 | } |
3653 | 3665 | ||
3654 | /* automatic switch internal and external mic */ | 3666 | /* automatic switch internal and external mic */ |
3655 | static void cx_auto_automic(struct hda_codec *codec) | 3667 | static void cx_auto_automic(struct hda_codec *codec, struct hda_jack_tbl *jack) |
3656 | { | 3668 | { |
3657 | struct conexant_spec *spec = codec->spec; | 3669 | struct conexant_spec *spec = codec->spec; |
3658 | 3670 | ||
@@ -3663,22 +3675,6 @@ static void cx_auto_automic(struct hda_codec *codec) | |||
3663 | select_automic(codec, spec->auto_mic_int, false); | 3675 | select_automic(codec, spec->auto_mic_int, false); |
3664 | } | 3676 | } |
3665 | 3677 | ||
3666 | static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) | ||
3667 | { | ||
3668 | switch (snd_hda_jack_get_action(codec, res >> 26)) { | ||
3669 | case CONEXANT_HP_EVENT: | ||
3670 | cx_auto_hp_automute(codec); | ||
3671 | break; | ||
3672 | case CONEXANT_LINE_EVENT: | ||
3673 | cx_auto_line_automute(codec); | ||
3674 | break; | ||
3675 | case CONEXANT_MIC_EVENT: | ||
3676 | cx_auto_automic(codec); | ||
3677 | break; | ||
3678 | } | ||
3679 | snd_hda_jack_report_sync(codec); | ||
3680 | } | ||
3681 | |||
3682 | /* check whether the pin config is suitable for auto-mic switching; | 3678 | /* check whether the pin config is suitable for auto-mic switching; |
3683 | * auto-mic is enabled only when one int-mic and one ext- and/or | 3679 | * auto-mic is enabled only when one int-mic and one ext- and/or |
3684 | * one dock-mic exist | 3680 | * one dock-mic exist |
@@ -3888,11 +3884,12 @@ static void mute_outputs(struct hda_codec *codec, int num_nids, | |||
3888 | } | 3884 | } |
3889 | 3885 | ||
3890 | static void enable_unsol_pins(struct hda_codec *codec, int num_pins, | 3886 | static void enable_unsol_pins(struct hda_codec *codec, int num_pins, |
3891 | hda_nid_t *pins, unsigned int action) | 3887 | hda_nid_t *pins, unsigned int action, |
3888 | hda_jack_callback cb) | ||
3892 | { | 3889 | { |
3893 | int i; | 3890 | int i; |
3894 | for (i = 0; i < num_pins; i++) | 3891 | for (i = 0; i < num_pins; i++) |
3895 | snd_hda_jack_detect_enable(codec, pins[i], action); | 3892 | snd_hda_jack_detect_enable_callback(codec, pins[i], action, cb); |
3896 | } | 3893 | } |
3897 | 3894 | ||
3898 | static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) | 3895 | static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) |
@@ -3980,13 +3977,14 @@ static void cx_auto_init_output(struct hda_codec *codec) | |||
3980 | } | 3977 | } |
3981 | if (spec->auto_mute) { | 3978 | if (spec->auto_mute) { |
3982 | enable_unsol_pins(codec, cfg->hp_outs, cfg->hp_pins, | 3979 | enable_unsol_pins(codec, cfg->hp_outs, cfg->hp_pins, |
3983 | CONEXANT_HP_EVENT); | 3980 | CONEXANT_HP_EVENT, cx_auto_hp_automute); |
3984 | spec->hp_present = detect_jacks(codec, cfg->hp_outs, | 3981 | spec->hp_present = detect_jacks(codec, cfg->hp_outs, |
3985 | cfg->hp_pins); | 3982 | cfg->hp_pins); |
3986 | if (spec->detect_line) { | 3983 | if (spec->detect_line) { |
3987 | enable_unsol_pins(codec, cfg->line_outs, | 3984 | enable_unsol_pins(codec, cfg->line_outs, |
3988 | cfg->line_out_pins, | 3985 | cfg->line_out_pins, |
3989 | CONEXANT_LINE_EVENT); | 3986 | CONEXANT_LINE_EVENT, |
3987 | cx_auto_line_automute); | ||
3990 | spec->line_present = | 3988 | spec->line_present = |
3991 | detect_jacks(codec, cfg->line_outs, | 3989 | detect_jacks(codec, cfg->line_outs, |
3992 | cfg->line_out_pins); | 3990 | cfg->line_out_pins); |
@@ -4027,16 +4025,16 @@ static void cx_auto_init_input(struct hda_codec *codec) | |||
4027 | 4025 | ||
4028 | if (spec->auto_mic) { | 4026 | if (spec->auto_mic) { |
4029 | if (spec->auto_mic_ext >= 0) { | 4027 | if (spec->auto_mic_ext >= 0) { |
4030 | snd_hda_jack_detect_enable(codec, | 4028 | snd_hda_jack_detect_enable_callback(codec, |
4031 | cfg->inputs[spec->auto_mic_ext].pin, | 4029 | cfg->inputs[spec->auto_mic_ext].pin, |
4032 | CONEXANT_MIC_EVENT); | 4030 | CONEXANT_MIC_EVENT, cx_auto_automic); |
4033 | } | 4031 | } |
4034 | if (spec->auto_mic_dock >= 0) { | 4032 | if (spec->auto_mic_dock >= 0) { |
4035 | snd_hda_jack_detect_enable(codec, | 4033 | snd_hda_jack_detect_enable_callback(codec, |
4036 | cfg->inputs[spec->auto_mic_dock].pin, | 4034 | cfg->inputs[spec->auto_mic_dock].pin, |
4037 | CONEXANT_MIC_EVENT); | 4035 | CONEXANT_MIC_EVENT, cx_auto_automic); |
4038 | } | 4036 | } |
4039 | cx_auto_automic(codec); | 4037 | cx_auto_automic(codec, NULL); |
4040 | } else { | 4038 | } else { |
4041 | select_input_connection(codec, spec->imux_info[0].adc, | 4039 | select_input_connection(codec, spec->imux_info[0].adc, |
4042 | spec->imux_info[0].pin); | 4040 | spec->imux_info[0].pin); |
@@ -4061,7 +4059,6 @@ static int cx_auto_init(struct hda_codec *codec) | |||
4061 | cx_auto_init_output(codec); | 4059 | cx_auto_init_output(codec); |
4062 | cx_auto_init_input(codec); | 4060 | cx_auto_init_input(codec); |
4063 | cx_auto_init_digital(codec); | 4061 | cx_auto_init_digital(codec); |
4064 | snd_hda_jack_report_sync(codec); | ||
4065 | snd_hda_sync_vmaster_hook(&spec->vmaster_mute); | 4062 | snd_hda_sync_vmaster_hook(&spec->vmaster_mute); |
4066 | return 0; | 4063 | return 0; |
4067 | } | 4064 | } |
@@ -4262,7 +4259,7 @@ static int cx_auto_add_boost_volume(struct hda_codec *codec, int idx, | |||
4262 | 4259 | ||
4263 | if (get_wcaps(codec, mux) & AC_WCAP_OUT_AMP) { | 4260 | if (get_wcaps(codec, mux) & AC_WCAP_OUT_AMP) { |
4264 | spec->imux_info[idx].boost = mux; | 4261 | spec->imux_info[idx].boost = mux; |
4265 | return cx_auto_add_volume(codec, label, " Boost", 0, | 4262 | return cx_auto_add_volume(codec, label, " Boost", cidx, |
4266 | mux, HDA_OUTPUT); | 4263 | mux, HDA_OUTPUT); |
4267 | } | 4264 | } |
4268 | return 0; | 4265 | return 0; |
@@ -4395,8 +4392,8 @@ static const struct hda_codec_ops cx_auto_patch_ops = { | |||
4395 | .build_pcms = conexant_build_pcms, | 4392 | .build_pcms = conexant_build_pcms, |
4396 | .init = cx_auto_init, | 4393 | .init = cx_auto_init, |
4397 | .free = conexant_free, | 4394 | .free = conexant_free, |
4398 | .unsol_event = cx_auto_unsol_event, | 4395 | .unsol_event = snd_hda_jack_unsol_event, |
4399 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4396 | #ifdef CONFIG_PM |
4400 | .suspend = conexant_suspend, | 4397 | .suspend = conexant_suspend, |
4401 | #endif | 4398 | #endif |
4402 | .reboot_notify = snd_hda_shutup_pins, | 4399 | .reboot_notify = snd_hda_shutup_pins, |
@@ -4462,6 +4459,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { | |||
4462 | SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), | 4459 | SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), |
4463 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), | 4460 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), |
4464 | SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), | 4461 | SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), |
4462 | SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), | ||
4465 | SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), | 4463 | SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), |
4466 | {} | 4464 | {} |
4467 | }; | 4465 | }; |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 8f23374fa642..71555cc54db1 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #include <sound/jack.h> | 36 | #include <sound/jack.h> |
37 | #include <sound/asoundef.h> | ||
38 | #include <sound/tlv.h> | ||
37 | #include "hda_codec.h" | 39 | #include "hda_codec.h" |
38 | #include "hda_local.h" | 40 | #include "hda_local.h" |
39 | #include "hda_jack.h" | 41 | #include "hda_jack.h" |
@@ -71,6 +73,9 @@ struct hdmi_spec_per_pin { | |||
71 | struct hdmi_eld sink_eld; | 73 | struct hdmi_eld sink_eld; |
72 | struct delayed_work work; | 74 | struct delayed_work work; |
73 | int repoll_count; | 75 | int repoll_count; |
76 | bool non_pcm; | ||
77 | bool chmap_set; /* channel-map override by ALSA API? */ | ||
78 | unsigned char chmap[8]; /* ALSA API channel-map */ | ||
74 | }; | 79 | }; |
75 | 80 | ||
76 | struct hdmi_spec { | 81 | struct hdmi_spec { |
@@ -80,6 +85,7 @@ struct hdmi_spec { | |||
80 | int num_pins; | 85 | int num_pins; |
81 | struct hdmi_spec_per_pin pins[MAX_HDMI_PINS]; | 86 | struct hdmi_spec_per_pin pins[MAX_HDMI_PINS]; |
82 | struct hda_pcm pcm_rec[MAX_HDMI_PINS]; | 87 | struct hda_pcm pcm_rec[MAX_HDMI_PINS]; |
88 | unsigned int channels_max; /* max over all cvts */ | ||
83 | 89 | ||
84 | /* | 90 | /* |
85 | * Non-generic ATI/NVIDIA specific | 91 | * Non-generic ATI/NVIDIA specific |
@@ -469,6 +475,17 @@ static void init_channel_allocations(void) | |||
469 | } | 475 | } |
470 | } | 476 | } |
471 | 477 | ||
478 | static int get_channel_allocation_order(int ca) | ||
479 | { | ||
480 | int i; | ||
481 | |||
482 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
483 | if (channel_allocations[i].ca_index == ca) | ||
484 | break; | ||
485 | } | ||
486 | return i; | ||
487 | } | ||
488 | |||
472 | /* | 489 | /* |
473 | * The transformation takes two steps: | 490 | * The transformation takes two steps: |
474 | * | 491 | * |
@@ -535,24 +552,36 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec, | |||
535 | } | 552 | } |
536 | 553 | ||
537 | 554 | ||
538 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | 555 | static void hdmi_std_setup_channel_mapping(struct hda_codec *codec, |
539 | hda_nid_t pin_nid, | 556 | hda_nid_t pin_nid, |
557 | bool non_pcm, | ||
540 | int ca) | 558 | int ca) |
541 | { | 559 | { |
542 | int i; | 560 | int i; |
543 | int err; | 561 | int err; |
562 | int order; | ||
563 | int non_pcm_mapping[8]; | ||
564 | |||
565 | order = get_channel_allocation_order(ca); | ||
544 | 566 | ||
545 | if (hdmi_channel_mapping[ca][1] == 0) { | 567 | if (hdmi_channel_mapping[ca][1] == 0) { |
546 | for (i = 0; i < channel_allocations[ca].channels; i++) | 568 | for (i = 0; i < channel_allocations[order].channels; i++) |
547 | hdmi_channel_mapping[ca][i] = i | (i << 4); | 569 | hdmi_channel_mapping[ca][i] = i | (i << 4); |
548 | for (; i < 8; i++) | 570 | for (; i < 8; i++) |
549 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); | 571 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); |
550 | } | 572 | } |
551 | 573 | ||
574 | if (non_pcm) { | ||
575 | for (i = 0; i < channel_allocations[order].channels; i++) | ||
576 | non_pcm_mapping[i] = i | (i << 4); | ||
577 | for (; i < 8; i++) | ||
578 | non_pcm_mapping[i] = 0xf | (i << 4); | ||
579 | } | ||
580 | |||
552 | for (i = 0; i < 8; i++) { | 581 | for (i = 0; i < 8; i++) { |
553 | err = snd_hda_codec_write(codec, pin_nid, 0, | 582 | err = snd_hda_codec_write(codec, pin_nid, 0, |
554 | AC_VERB_SET_HDMI_CHAN_SLOT, | 583 | AC_VERB_SET_HDMI_CHAN_SLOT, |
555 | hdmi_channel_mapping[ca][i]); | 584 | non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]); |
556 | if (err) { | 585 | if (err) { |
557 | snd_printdd(KERN_NOTICE | 586 | snd_printdd(KERN_NOTICE |
558 | "HDMI: channel mapping failed\n"); | 587 | "HDMI: channel mapping failed\n"); |
@@ -563,6 +592,136 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec, | |||
563 | hdmi_debug_channel_mapping(codec, pin_nid); | 592 | hdmi_debug_channel_mapping(codec, pin_nid); |
564 | } | 593 | } |
565 | 594 | ||
595 | struct channel_map_table { | ||
596 | unsigned char map; /* ALSA API channel map position */ | ||
597 | unsigned char cea_slot; /* CEA slot value */ | ||
598 | int spk_mask; /* speaker position bit mask */ | ||
599 | }; | ||
600 | |||
601 | static struct channel_map_table map_tables[] = { | ||
602 | { SNDRV_CHMAP_FL, 0x00, FL }, | ||
603 | { SNDRV_CHMAP_FR, 0x01, FR }, | ||
604 | { SNDRV_CHMAP_RL, 0x04, RL }, | ||
605 | { SNDRV_CHMAP_RR, 0x05, RR }, | ||
606 | { SNDRV_CHMAP_LFE, 0x02, LFE }, | ||
607 | { SNDRV_CHMAP_FC, 0x03, FC }, | ||
608 | { SNDRV_CHMAP_RLC, 0x06, RLC }, | ||
609 | { SNDRV_CHMAP_RRC, 0x07, RRC }, | ||
610 | {} /* terminator */ | ||
611 | }; | ||
612 | |||
613 | /* from ALSA API channel position to speaker bit mask */ | ||
614 | static int to_spk_mask(unsigned char c) | ||
615 | { | ||
616 | struct channel_map_table *t = map_tables; | ||
617 | for (; t->map; t++) { | ||
618 | if (t->map == c) | ||
619 | return t->spk_mask; | ||
620 | } | ||
621 | return 0; | ||
622 | } | ||
623 | |||
624 | /* from ALSA API channel position to CEA slot */ | ||
625 | static int to_cea_slot(unsigned char c) | ||
626 | { | ||
627 | struct channel_map_table *t = map_tables; | ||
628 | for (; t->map; t++) { | ||
629 | if (t->map == c) | ||
630 | return t->cea_slot; | ||
631 | } | ||
632 | return 0x0f; | ||
633 | } | ||
634 | |||
635 | /* from CEA slot to ALSA API channel position */ | ||
636 | static int from_cea_slot(unsigned char c) | ||
637 | { | ||
638 | struct channel_map_table *t = map_tables; | ||
639 | for (; t->map; t++) { | ||
640 | if (t->cea_slot == c) | ||
641 | return t->map; | ||
642 | } | ||
643 | return 0; | ||
644 | } | ||
645 | |||
646 | /* from speaker bit mask to ALSA API channel position */ | ||
647 | static int spk_to_chmap(int spk) | ||
648 | { | ||
649 | struct channel_map_table *t = map_tables; | ||
650 | for (; t->map; t++) { | ||
651 | if (t->spk_mask == spk) | ||
652 | return t->map; | ||
653 | } | ||
654 | return 0; | ||
655 | } | ||
656 | |||
657 | /* get the CA index corresponding to the given ALSA API channel map */ | ||
658 | static int hdmi_manual_channel_allocation(int chs, unsigned char *map) | ||
659 | { | ||
660 | int i, spks = 0, spk_mask = 0; | ||
661 | |||
662 | for (i = 0; i < chs; i++) { | ||
663 | int mask = to_spk_mask(map[i]); | ||
664 | if (mask) { | ||
665 | spk_mask |= mask; | ||
666 | spks++; | ||
667 | } | ||
668 | } | ||
669 | |||
670 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
671 | if ((chs == channel_allocations[i].channels || | ||
672 | spks == channel_allocations[i].channels) && | ||
673 | (spk_mask & channel_allocations[i].spk_mask) == | ||
674 | channel_allocations[i].spk_mask) | ||
675 | return channel_allocations[i].ca_index; | ||
676 | } | ||
677 | return -1; | ||
678 | } | ||
679 | |||
680 | /* set up the channel slots for the given ALSA API channel map */ | ||
681 | static int hdmi_manual_setup_channel_mapping(struct hda_codec *codec, | ||
682 | hda_nid_t pin_nid, | ||
683 | int chs, unsigned char *map) | ||
684 | { | ||
685 | int i; | ||
686 | for (i = 0; i < 8; i++) { | ||
687 | int val, err; | ||
688 | if (i < chs) | ||
689 | val = to_cea_slot(map[i]); | ||
690 | else | ||
691 | val = 0xf; | ||
692 | val |= (i << 4); | ||
693 | err = snd_hda_codec_write(codec, pin_nid, 0, | ||
694 | AC_VERB_SET_HDMI_CHAN_SLOT, val); | ||
695 | if (err) | ||
696 | return -EINVAL; | ||
697 | } | ||
698 | return 0; | ||
699 | } | ||
700 | |||
701 | /* store ALSA API channel map from the current default map */ | ||
702 | static void hdmi_setup_fake_chmap(unsigned char *map, int ca) | ||
703 | { | ||
704 | int i; | ||
705 | for (i = 0; i < 8; i++) { | ||
706 | if (i < channel_allocations[ca].channels) | ||
707 | map[i] = from_cea_slot((hdmi_channel_mapping[ca][i] >> 4) & 0x0f); | ||
708 | else | ||
709 | map[i] = 0; | ||
710 | } | ||
711 | } | ||
712 | |||
713 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | ||
714 | hda_nid_t pin_nid, bool non_pcm, int ca, | ||
715 | int channels, unsigned char *map) | ||
716 | { | ||
717 | if (!non_pcm && map) { | ||
718 | hdmi_manual_setup_channel_mapping(codec, pin_nid, | ||
719 | channels, map); | ||
720 | } else { | ||
721 | hdmi_std_setup_channel_mapping(codec, pin_nid, non_pcm, ca); | ||
722 | hdmi_setup_fake_chmap(map, ca); | ||
723 | } | ||
724 | } | ||
566 | 725 | ||
567 | /* | 726 | /* |
568 | * Audio InfoFrame routines | 727 | * Audio InfoFrame routines |
@@ -686,7 +845,8 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | |||
686 | } | 845 | } |
687 | 846 | ||
688 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, | 847 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, |
689 | struct snd_pcm_substream *substream) | 848 | bool non_pcm, |
849 | struct snd_pcm_substream *substream) | ||
690 | { | 850 | { |
691 | struct hdmi_spec *spec = codec->spec; | 851 | struct hdmi_spec *spec = codec->spec; |
692 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | 852 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; |
@@ -700,7 +860,12 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, | |||
700 | if (!eld->monitor_present) | 860 | if (!eld->monitor_present) |
701 | return; | 861 | return; |
702 | 862 | ||
703 | ca = hdmi_channel_allocation(eld, channels); | 863 | if (!non_pcm && per_pin->chmap_set) |
864 | ca = hdmi_manual_channel_allocation(channels, per_pin->chmap); | ||
865 | else | ||
866 | ca = hdmi_channel_allocation(eld, channels); | ||
867 | if (ca < 0) | ||
868 | ca = 0; | ||
704 | 869 | ||
705 | memset(&ai, 0, sizeof(ai)); | 870 | memset(&ai, 0, sizeof(ai)); |
706 | if (eld->conn_type == 0) { /* HDMI */ | 871 | if (eld->conn_type == 0) { /* HDMI */ |
@@ -737,12 +902,21 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, | |||
737 | "pin=%d channels=%d\n", | 902 | "pin=%d channels=%d\n", |
738 | pin_nid, | 903 | pin_nid, |
739 | channels); | 904 | channels); |
740 | hdmi_setup_channel_mapping(codec, pin_nid, ca); | 905 | hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca, |
906 | channels, per_pin->chmap); | ||
741 | hdmi_stop_infoframe_trans(codec, pin_nid); | 907 | hdmi_stop_infoframe_trans(codec, pin_nid); |
742 | hdmi_fill_audio_infoframe(codec, pin_nid, | 908 | hdmi_fill_audio_infoframe(codec, pin_nid, |
743 | ai.bytes, sizeof(ai)); | 909 | ai.bytes, sizeof(ai)); |
744 | hdmi_start_infoframe_trans(codec, pin_nid); | 910 | hdmi_start_infoframe_trans(codec, pin_nid); |
911 | } else { | ||
912 | /* For non-pcm audio switch, setup new channel mapping | ||
913 | * accordingly */ | ||
914 | if (per_pin->non_pcm != non_pcm) | ||
915 | hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca, | ||
916 | channels, per_pin->chmap); | ||
745 | } | 917 | } |
918 | |||
919 | per_pin->non_pcm = non_pcm; | ||
746 | } | 920 | } |
747 | 921 | ||
748 | 922 | ||
@@ -1035,6 +1209,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | |||
1035 | per_pin = &spec->pins[pin_idx]; | 1209 | per_pin = &spec->pins[pin_idx]; |
1036 | 1210 | ||
1037 | per_pin->pin_nid = pin_nid; | 1211 | per_pin->pin_nid = pin_nid; |
1212 | per_pin->non_pcm = false; | ||
1038 | 1213 | ||
1039 | err = hdmi_read_pin_conn(codec, pin_idx); | 1214 | err = hdmi_read_pin_conn(codec, pin_idx); |
1040 | if (err < 0) | 1215 | if (err < 0) |
@@ -1064,8 +1239,11 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) | |||
1064 | 1239 | ||
1065 | per_cvt->cvt_nid = cvt_nid; | 1240 | per_cvt->cvt_nid = cvt_nid; |
1066 | per_cvt->channels_min = 2; | 1241 | per_cvt->channels_min = 2; |
1067 | if (chans <= 16) | 1242 | if (chans <= 16) { |
1068 | per_cvt->channels_max = chans; | 1243 | per_cvt->channels_max = chans; |
1244 | if (chans > spec->channels_max) | ||
1245 | spec->channels_max = chans; | ||
1246 | } | ||
1069 | 1247 | ||
1070 | err = snd_hda_query_supported_pcm(codec, cvt_nid, | 1248 | err = snd_hda_query_supported_pcm(codec, cvt_nid, |
1071 | &per_cvt->rates, | 1249 | &per_cvt->rates, |
@@ -1115,7 +1293,7 @@ static int hdmi_parse_codec(struct hda_codec *codec) | |||
1115 | * can be lost and presence sense verb will become inaccurate if the | 1293 | * can be lost and presence sense verb will become inaccurate if the |
1116 | * HDA link is powered off at hot plug or hw initialization time. | 1294 | * HDA link is powered off at hot plug or hw initialization time. |
1117 | */ | 1295 | */ |
1118 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1296 | #ifdef CONFIG_PM |
1119 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | 1297 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & |
1120 | AC_PWRST_EPSS)) | 1298 | AC_PWRST_EPSS)) |
1121 | codec->bus->power_keep_link_on = 1; | 1299 | codec->bus->power_keep_link_on = 1; |
@@ -1133,6 +1311,19 @@ static char *get_hdmi_pcm_name(int idx) | |||
1133 | return &names[idx][0]; | 1311 | return &names[idx][0]; |
1134 | } | 1312 | } |
1135 | 1313 | ||
1314 | static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) | ||
1315 | { | ||
1316 | struct hda_spdif_out *spdif; | ||
1317 | bool non_pcm; | ||
1318 | |||
1319 | mutex_lock(&codec->spdif_mutex); | ||
1320 | spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid); | ||
1321 | non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO); | ||
1322 | mutex_unlock(&codec->spdif_mutex); | ||
1323 | return non_pcm; | ||
1324 | } | ||
1325 | |||
1326 | |||
1136 | /* | 1327 | /* |
1137 | * HDMI callbacks | 1328 | * HDMI callbacks |
1138 | */ | 1329 | */ |
@@ -1148,10 +1339,13 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1148 | int pin_idx = hinfo_to_pin_index(spec, hinfo); | 1339 | int pin_idx = hinfo_to_pin_index(spec, hinfo); |
1149 | hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid; | 1340 | hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid; |
1150 | int pinctl; | 1341 | int pinctl; |
1342 | bool non_pcm; | ||
1343 | |||
1344 | non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); | ||
1151 | 1345 | ||
1152 | hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels); | 1346 | hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels); |
1153 | 1347 | ||
1154 | hdmi_setup_audio_infoframe(codec, pin_idx, substream); | 1348 | hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream); |
1155 | 1349 | ||
1156 | pinctl = snd_hda_codec_read(codec, pin_nid, 0, | 1350 | pinctl = snd_hda_codec_read(codec, pin_nid, 0, |
1157 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 1351 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
@@ -1200,7 +1394,10 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, | |||
1200 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 1394 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
1201 | pinctl & ~PIN_OUT); | 1395 | pinctl & ~PIN_OUT); |
1202 | snd_hda_spdif_ctls_unassign(codec, pin_idx); | 1396 | snd_hda_spdif_ctls_unassign(codec, pin_idx); |
1397 | per_pin->chmap_set = false; | ||
1398 | memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); | ||
1203 | } | 1399 | } |
1400 | |||
1204 | return 0; | 1401 | return 0; |
1205 | } | 1402 | } |
1206 | 1403 | ||
@@ -1211,6 +1408,135 @@ static const struct hda_pcm_ops generic_ops = { | |||
1211 | .cleanup = generic_hdmi_playback_pcm_cleanup, | 1408 | .cleanup = generic_hdmi_playback_pcm_cleanup, |
1212 | }; | 1409 | }; |
1213 | 1410 | ||
1411 | /* | ||
1412 | * ALSA API channel-map control callbacks | ||
1413 | */ | ||
1414 | static int hdmi_chmap_ctl_info(struct snd_kcontrol *kcontrol, | ||
1415 | struct snd_ctl_elem_info *uinfo) | ||
1416 | { | ||
1417 | struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); | ||
1418 | struct hda_codec *codec = info->private_data; | ||
1419 | struct hdmi_spec *spec = codec->spec; | ||
1420 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
1421 | uinfo->count = spec->channels_max; | ||
1422 | uinfo->value.integer.min = 0; | ||
1423 | uinfo->value.integer.max = SNDRV_CHMAP_LAST; | ||
1424 | return 0; | ||
1425 | } | ||
1426 | |||
1427 | static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, | ||
1428 | unsigned int size, unsigned int __user *tlv) | ||
1429 | { | ||
1430 | struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); | ||
1431 | struct hda_codec *codec = info->private_data; | ||
1432 | struct hdmi_spec *spec = codec->spec; | ||
1433 | const unsigned int valid_mask = | ||
1434 | FL | FR | RL | RR | LFE | FC | RLC | RRC; | ||
1435 | unsigned int __user *dst; | ||
1436 | int chs, count = 0; | ||
1437 | |||
1438 | if (size < 8) | ||
1439 | return -ENOMEM; | ||
1440 | if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv)) | ||
1441 | return -EFAULT; | ||
1442 | size -= 8; | ||
1443 | dst = tlv + 2; | ||
1444 | for (chs = 2; chs <= spec->channels_max; chs++) { | ||
1445 | int i, c; | ||
1446 | struct cea_channel_speaker_allocation *cap; | ||
1447 | cap = channel_allocations; | ||
1448 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++, cap++) { | ||
1449 | int chs_bytes = chs * 4; | ||
1450 | if (cap->channels != chs) | ||
1451 | continue; | ||
1452 | if (cap->spk_mask & ~valid_mask) | ||
1453 | continue; | ||
1454 | if (size < 8) | ||
1455 | return -ENOMEM; | ||
1456 | if (put_user(SNDRV_CTL_TLVT_CHMAP_VAR, dst) || | ||
1457 | put_user(chs_bytes, dst + 1)) | ||
1458 | return -EFAULT; | ||
1459 | dst += 2; | ||
1460 | size -= 8; | ||
1461 | count += 8; | ||
1462 | if (size < chs_bytes) | ||
1463 | return -ENOMEM; | ||
1464 | size -= chs_bytes; | ||
1465 | count += chs_bytes; | ||
1466 | for (c = 7; c >= 0; c--) { | ||
1467 | int spk = cap->speakers[c]; | ||
1468 | if (!spk) | ||
1469 | continue; | ||
1470 | if (put_user(spk_to_chmap(spk), dst)) | ||
1471 | return -EFAULT; | ||
1472 | dst++; | ||
1473 | } | ||
1474 | } | ||
1475 | } | ||
1476 | if (put_user(count, tlv + 1)) | ||
1477 | return -EFAULT; | ||
1478 | return 0; | ||
1479 | } | ||
1480 | |||
1481 | static int hdmi_chmap_ctl_get(struct snd_kcontrol *kcontrol, | ||
1482 | struct snd_ctl_elem_value *ucontrol) | ||
1483 | { | ||
1484 | struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); | ||
1485 | struct hda_codec *codec = info->private_data; | ||
1486 | struct hdmi_spec *spec = codec->spec; | ||
1487 | int pin_idx = kcontrol->private_value; | ||
1488 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | ||
1489 | int i; | ||
1490 | |||
1491 | for (i = 0; i < ARRAY_SIZE(per_pin->chmap); i++) | ||
1492 | ucontrol->value.integer.value[i] = per_pin->chmap[i]; | ||
1493 | return 0; | ||
1494 | } | ||
1495 | |||
1496 | static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol, | ||
1497 | struct snd_ctl_elem_value *ucontrol) | ||
1498 | { | ||
1499 | struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); | ||
1500 | struct hda_codec *codec = info->private_data; | ||
1501 | struct hdmi_spec *spec = codec->spec; | ||
1502 | int pin_idx = kcontrol->private_value; | ||
1503 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | ||
1504 | unsigned int ctl_idx; | ||
1505 | struct snd_pcm_substream *substream; | ||
1506 | unsigned char chmap[8]; | ||
1507 | int i, ca, prepared = 0; | ||
1508 | |||
1509 | ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
1510 | substream = snd_pcm_chmap_substream(info, ctl_idx); | ||
1511 | if (!substream || !substream->runtime) | ||
1512 | return -EBADFD; | ||
1513 | switch (substream->runtime->status->state) { | ||
1514 | case SNDRV_PCM_STATE_OPEN: | ||
1515 | case SNDRV_PCM_STATE_SETUP: | ||
1516 | break; | ||
1517 | case SNDRV_PCM_STATE_PREPARED: | ||
1518 | prepared = 1; | ||
1519 | break; | ||
1520 | default: | ||
1521 | return -EBUSY; | ||
1522 | } | ||
1523 | memset(chmap, 0, sizeof(chmap)); | ||
1524 | for (i = 0; i < ARRAY_SIZE(chmap); i++) | ||
1525 | chmap[i] = ucontrol->value.integer.value[i]; | ||
1526 | if (!memcmp(chmap, per_pin->chmap, sizeof(chmap))) | ||
1527 | return 0; | ||
1528 | ca = hdmi_manual_channel_allocation(ARRAY_SIZE(chmap), chmap); | ||
1529 | if (ca < 0) | ||
1530 | return -EINVAL; | ||
1531 | per_pin->chmap_set = true; | ||
1532 | memcpy(per_pin->chmap, chmap, sizeof(chmap)); | ||
1533 | if (prepared) | ||
1534 | hdmi_setup_audio_infoframe(codec, pin_idx, per_pin->non_pcm, | ||
1535 | substream); | ||
1536 | |||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1214 | static int generic_hdmi_build_pcms(struct hda_codec *codec) | 1540 | static int generic_hdmi_build_pcms(struct hda_codec *codec) |
1215 | { | 1541 | { |
1216 | struct hdmi_spec *spec = codec->spec; | 1542 | struct hdmi_spec *spec = codec->spec; |
@@ -1223,6 +1549,7 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) | |||
1223 | info = &spec->pcm_rec[pin_idx]; | 1549 | info = &spec->pcm_rec[pin_idx]; |
1224 | info->name = get_hdmi_pcm_name(pin_idx); | 1550 | info->name = get_hdmi_pcm_name(pin_idx); |
1225 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 1551 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
1552 | info->own_chmap = true; | ||
1226 | 1553 | ||
1227 | pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; | 1554 | pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; |
1228 | pstr->substreams = 1; | 1555 | pstr->substreams = 1; |
@@ -1280,6 +1607,27 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) | |||
1280 | hdmi_present_sense(per_pin, 0); | 1607 | hdmi_present_sense(per_pin, 0); |
1281 | } | 1608 | } |
1282 | 1609 | ||
1610 | /* add channel maps */ | ||
1611 | for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { | ||
1612 | struct snd_pcm_chmap *chmap; | ||
1613 | struct snd_kcontrol *kctl; | ||
1614 | int i; | ||
1615 | err = snd_pcm_add_chmap_ctls(codec->pcm_info[pin_idx].pcm, | ||
1616 | SNDRV_PCM_STREAM_PLAYBACK, | ||
1617 | NULL, 0, pin_idx, &chmap); | ||
1618 | if (err < 0) | ||
1619 | return err; | ||
1620 | /* override handlers */ | ||
1621 | chmap->private_data = codec; | ||
1622 | kctl = chmap->kctl; | ||
1623 | for (i = 0; i < kctl->count; i++) | ||
1624 | kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE; | ||
1625 | kctl->info = hdmi_chmap_ctl_info; | ||
1626 | kctl->get = hdmi_chmap_ctl_get; | ||
1627 | kctl->put = hdmi_chmap_ctl_put; | ||
1628 | kctl->tlv.c = hdmi_chmap_ctl_tlv; | ||
1629 | } | ||
1630 | |||
1283 | return 0; | 1631 | return 0; |
1284 | } | 1632 | } |
1285 | 1633 | ||
@@ -1311,7 +1659,6 @@ static int generic_hdmi_init(struct hda_codec *codec) | |||
1311 | hdmi_init_pin(codec, pin_nid); | 1659 | hdmi_init_pin(codec, pin_nid); |
1312 | snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); | 1660 | snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); |
1313 | } | 1661 | } |
1314 | snd_hda_jack_report_sync(codec); | ||
1315 | return 0; | 1662 | return 0; |
1316 | } | 1663 | } |
1317 | 1664 | ||
@@ -1428,7 +1775,6 @@ static int simple_playback_init(struct hda_codec *codec) | |||
1428 | snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 1775 | snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
1429 | AMP_OUT_UNMUTE); | 1776 | AMP_OUT_UNMUTE); |
1430 | snd_hda_jack_detect_enable(codec, pin, pin); | 1777 | snd_hda_jack_detect_enable(codec, pin, pin); |
1431 | snd_hda_jack_report_sync(codec); | ||
1432 | return 0; | 1778 | return 0; |
1433 | } | 1779 | } |
1434 | 1780 | ||
@@ -1809,6 +2155,43 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
1809 | return 0; | 2155 | return 0; |
1810 | } | 2156 | } |
1811 | 2157 | ||
2158 | static int nvhdmi_7x_8ch_build_pcms(struct hda_codec *codec) | ||
2159 | { | ||
2160 | struct hdmi_spec *spec = codec->spec; | ||
2161 | int err = simple_playback_build_pcms(codec); | ||
2162 | spec->pcm_rec[0].own_chmap = true; | ||
2163 | return err; | ||
2164 | } | ||
2165 | |||
2166 | static int nvhdmi_7x_8ch_build_controls(struct hda_codec *codec) | ||
2167 | { | ||
2168 | struct hdmi_spec *spec = codec->spec; | ||
2169 | struct snd_pcm_chmap *chmap; | ||
2170 | int err; | ||
2171 | |||
2172 | err = simple_playback_build_controls(codec); | ||
2173 | if (err < 0) | ||
2174 | return err; | ||
2175 | |||
2176 | /* add channel maps */ | ||
2177 | err = snd_pcm_add_chmap_ctls(spec->pcm_rec[0].pcm, | ||
2178 | SNDRV_PCM_STREAM_PLAYBACK, | ||
2179 | snd_pcm_alt_chmaps, 8, 0, &chmap); | ||
2180 | if (err < 0) | ||
2181 | return err; | ||
2182 | switch (codec->preset->id) { | ||
2183 | case 0x10de0002: | ||
2184 | case 0x10de0003: | ||
2185 | case 0x10de0005: | ||
2186 | case 0x10de0006: | ||
2187 | chmap->channel_mask = (1U << 2) | (1U << 8); | ||
2188 | break; | ||
2189 | case 0x10de0007: | ||
2190 | chmap->channel_mask = (1U << 2) | (1U << 6) | (1U << 8); | ||
2191 | } | ||
2192 | return 0; | ||
2193 | } | ||
2194 | |||
1812 | static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) | 2195 | static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) |
1813 | { | 2196 | { |
1814 | struct hdmi_spec *spec; | 2197 | struct hdmi_spec *spec; |
@@ -1819,6 +2202,8 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) | |||
1819 | spec->multiout.max_channels = 8; | 2202 | spec->multiout.max_channels = 8; |
1820 | spec->pcm_playback = nvhdmi_pcm_playback_8ch_7x; | 2203 | spec->pcm_playback = nvhdmi_pcm_playback_8ch_7x; |
1821 | codec->patch_ops.init = nvhdmi_7x_init_8ch; | 2204 | codec->patch_ops.init = nvhdmi_7x_init_8ch; |
2205 | codec->patch_ops.build_pcms = nvhdmi_7x_8ch_build_pcms; | ||
2206 | codec->patch_ops.build_controls = nvhdmi_7x_8ch_build_controls; | ||
1822 | 2207 | ||
1823 | /* Initialize the audio infoframe channel mask and checksum to something | 2208 | /* Initialize the audio infoframe channel mask and checksum to something |
1824 | * valid */ | 2209 | * valid */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4f81dd44c837..8568aee56e2d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -174,7 +174,7 @@ struct alc_spec { | |||
174 | 174 | ||
175 | /* hooks */ | 175 | /* hooks */ |
176 | void (*init_hook)(struct hda_codec *codec); | 176 | void (*init_hook)(struct hda_codec *codec); |
177 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 177 | #ifdef CONFIG_PM |
178 | void (*power_hook)(struct hda_codec *codec); | 178 | void (*power_hook)(struct hda_codec *codec); |
179 | #endif | 179 | #endif |
180 | void (*shutup)(struct hda_codec *codec); | 180 | void (*shutup)(struct hda_codec *codec); |
@@ -215,7 +215,7 @@ struct alc_spec { | |||
215 | /* for virtual master */ | 215 | /* for virtual master */ |
216 | hda_nid_t vmaster_nid; | 216 | hda_nid_t vmaster_nid; |
217 | struct hda_vmaster_mute_hook vmaster_mute; | 217 | struct hda_vmaster_mute_hook vmaster_mute; |
218 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 218 | #ifdef CONFIG_PM |
219 | struct hda_loopback_check loopback; | 219 | struct hda_loopback_check loopback; |
220 | int num_loopbacks; | 220 | int num_loopbacks; |
221 | struct hda_amp_list loopback_list[8]; | 221 | struct hda_amp_list loopback_list[8]; |
@@ -594,7 +594,7 @@ static void call_update_outputs(struct hda_codec *codec) | |||
594 | } | 594 | } |
595 | 595 | ||
596 | /* standard HP-automute helper */ | 596 | /* standard HP-automute helper */ |
597 | static void alc_hp_automute(struct hda_codec *codec) | 597 | static void alc_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) |
598 | { | 598 | { |
599 | struct alc_spec *spec = codec->spec; | 599 | struct alc_spec *spec = codec->spec; |
600 | 600 | ||
@@ -607,7 +607,7 @@ static void alc_hp_automute(struct hda_codec *codec) | |||
607 | } | 607 | } |
608 | 608 | ||
609 | /* standard line-out-automute helper */ | 609 | /* standard line-out-automute helper */ |
610 | static void alc_line_automute(struct hda_codec *codec) | 610 | static void alc_line_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) |
611 | { | 611 | { |
612 | struct alc_spec *spec = codec->spec; | 612 | struct alc_spec *spec = codec->spec; |
613 | 613 | ||
@@ -627,7 +627,7 @@ static void alc_line_automute(struct hda_codec *codec) | |||
627 | snd_hda_get_conn_index(codec, mux, nid, 0) | 627 | snd_hda_get_conn_index(codec, mux, nid, 0) |
628 | 628 | ||
629 | /* standard mic auto-switch helper */ | 629 | /* standard mic auto-switch helper */ |
630 | static void alc_mic_automute(struct hda_codec *codec) | 630 | static void alc_mic_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) |
631 | { | 631 | { |
632 | struct alc_spec *spec = codec->spec; | 632 | struct alc_spec *spec = codec->spec; |
633 | hda_nid_t *pins = spec->imux_pins; | 633 | hda_nid_t *pins = spec->imux_pins; |
@@ -648,25 +648,8 @@ static void alc_mic_automute(struct hda_codec *codec) | |||
648 | alc_mux_select(codec, 0, spec->int_mic_idx, false); | 648 | alc_mux_select(codec, 0, spec->int_mic_idx, false); |
649 | } | 649 | } |
650 | 650 | ||
651 | /* handle the specified unsol action (ALC_XXX_EVENT) */ | ||
652 | static void alc_exec_unsol_event(struct hda_codec *codec, int action) | ||
653 | { | ||
654 | switch (action) { | ||
655 | case ALC_HP_EVENT: | ||
656 | alc_hp_automute(codec); | ||
657 | break; | ||
658 | case ALC_FRONT_EVENT: | ||
659 | alc_line_automute(codec); | ||
660 | break; | ||
661 | case ALC_MIC_EVENT: | ||
662 | alc_mic_automute(codec); | ||
663 | break; | ||
664 | } | ||
665 | snd_hda_jack_report_sync(codec); | ||
666 | } | ||
667 | |||
668 | /* update the master volume per volume-knob's unsol event */ | 651 | /* update the master volume per volume-knob's unsol event */ |
669 | static void alc_update_knob_master(struct hda_codec *codec, hda_nid_t nid) | 652 | static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl *jack) |
670 | { | 653 | { |
671 | unsigned int val; | 654 | unsigned int val; |
672 | struct snd_kcontrol *kctl; | 655 | struct snd_kcontrol *kctl; |
@@ -678,7 +661,7 @@ static void alc_update_knob_master(struct hda_codec *codec, hda_nid_t nid) | |||
678 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 661 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
679 | if (!uctl) | 662 | if (!uctl) |
680 | return; | 663 | return; |
681 | val = snd_hda_codec_read(codec, nid, 0, | 664 | val = snd_hda_codec_read(codec, jack->nid, 0, |
682 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | 665 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
683 | val &= HDA_AMP_VOLMASK; | 666 | val &= HDA_AMP_VOLMASK; |
684 | uctl->value.integer.value[0] = val; | 667 | uctl->value.integer.value[0] = val; |
@@ -687,37 +670,19 @@ static void alc_update_knob_master(struct hda_codec *codec, hda_nid_t nid) | |||
687 | kfree(uctl); | 670 | kfree(uctl); |
688 | } | 671 | } |
689 | 672 | ||
690 | /* unsolicited event for HP jack sensing */ | 673 | static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) |
691 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) | ||
692 | { | 674 | { |
693 | int action; | 675 | /* For some reason, the res given from ALC880 is broken. |
694 | 676 | Here we adjust it properly. */ | |
695 | if (codec->vendor_id == 0x10ec0880) | 677 | snd_hda_jack_unsol_event(codec, res >> 2); |
696 | res >>= 28; | ||
697 | else | ||
698 | res >>= 26; | ||
699 | action = snd_hda_jack_get_action(codec, res); | ||
700 | if (action == ALC_DCVOL_EVENT) { | ||
701 | /* Execute the dc-vol event here as it requires the NID | ||
702 | * but we don't pass NID to alc_exec_unsol_event(). | ||
703 | * Once when we convert all static quirks to the auto-parser, | ||
704 | * this can be integerated into there. | ||
705 | */ | ||
706 | struct hda_jack_tbl *jack; | ||
707 | jack = snd_hda_jack_tbl_get_from_tag(codec, res); | ||
708 | if (jack) | ||
709 | alc_update_knob_master(codec, jack->nid); | ||
710 | return; | ||
711 | } | ||
712 | alc_exec_unsol_event(codec, action); | ||
713 | } | 678 | } |
714 | 679 | ||
715 | /* call init functions of standard auto-mute helpers */ | 680 | /* call init functions of standard auto-mute helpers */ |
716 | static void alc_inithook(struct hda_codec *codec) | 681 | static void alc_inithook(struct hda_codec *codec) |
717 | { | 682 | { |
718 | alc_hp_automute(codec); | 683 | alc_hp_automute(codec, NULL); |
719 | alc_line_automute(codec); | 684 | alc_line_automute(codec, NULL); |
720 | alc_mic_automute(codec); | 685 | alc_mic_automute(codec, NULL); |
721 | } | 686 | } |
722 | 687 | ||
723 | /* additional initialization for ALC888 variants */ | 688 | /* additional initialization for ALC888 variants */ |
@@ -999,7 +964,8 @@ static void alc_init_automute(struct hda_codec *codec) | |||
999 | continue; | 964 | continue; |
1000 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | 965 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
1001 | nid); | 966 | nid); |
1002 | snd_hda_jack_detect_enable(codec, nid, ALC_HP_EVENT); | 967 | snd_hda_jack_detect_enable_callback(codec, nid, ALC_HP_EVENT, |
968 | alc_hp_automute); | ||
1003 | spec->detect_hp = 1; | 969 | spec->detect_hp = 1; |
1004 | } | 970 | } |
1005 | 971 | ||
@@ -1011,10 +977,10 @@ static void alc_init_automute(struct hda_codec *codec) | |||
1011 | continue; | 977 | continue; |
1012 | snd_printdd("realtek: Enable Line-Out " | 978 | snd_printdd("realtek: Enable Line-Out " |
1013 | "auto-muting on NID 0x%x\n", nid); | 979 | "auto-muting on NID 0x%x\n", nid); |
1014 | snd_hda_jack_detect_enable(codec, nid, | 980 | snd_hda_jack_detect_enable_callback(codec, nid, ALC_FRONT_EVENT, |
1015 | ALC_FRONT_EVENT); | 981 | alc_line_automute); |
1016 | spec->detect_lo = 1; | 982 | spec->detect_lo = 1; |
1017 | } | 983 | } |
1018 | spec->automute_lo_possible = spec->detect_hp; | 984 | spec->automute_lo_possible = spec->detect_hp; |
1019 | } | 985 | } |
1020 | 986 | ||
@@ -1110,10 +1076,12 @@ static bool alc_auto_mic_check_imux(struct hda_codec *codec) | |||
1110 | return false; /* no corresponding imux */ | 1076 | return false; /* no corresponding imux */ |
1111 | } | 1077 | } |
1112 | 1078 | ||
1113 | snd_hda_jack_detect_enable(codec, spec->ext_mic_pin, ALC_MIC_EVENT); | 1079 | snd_hda_jack_detect_enable_callback(codec, spec->ext_mic_pin, |
1080 | ALC_MIC_EVENT, alc_mic_automute); | ||
1114 | if (spec->dock_mic_pin) | 1081 | if (spec->dock_mic_pin) |
1115 | snd_hda_jack_detect_enable(codec, spec->dock_mic_pin, | 1082 | snd_hda_jack_detect_enable_callback(codec, spec->dock_mic_pin, |
1116 | ALC_MIC_EVENT); | 1083 | ALC_MIC_EVENT, |
1084 | alc_mic_automute); | ||
1117 | 1085 | ||
1118 | spec->auto_mic_valid_imux = 1; | 1086 | spec->auto_mic_valid_imux = 1; |
1119 | spec->auto_mic = 1; | 1087 | spec->auto_mic = 1; |
@@ -2053,13 +2021,11 @@ static int alc_init(struct hda_codec *codec) | |||
2053 | 2021 | ||
2054 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); | 2022 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
2055 | 2023 | ||
2056 | snd_hda_jack_report_sync(codec); | ||
2057 | |||
2058 | hda_call_check_power_status(codec, 0x01); | 2024 | hda_call_check_power_status(codec, 0x01); |
2059 | return 0; | 2025 | return 0; |
2060 | } | 2026 | } |
2061 | 2027 | ||
2062 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2028 | #ifdef CONFIG_PM |
2063 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | 2029 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
2064 | { | 2030 | { |
2065 | struct alc_spec *spec = codec->spec; | 2031 | struct alc_spec *spec = codec->spec; |
@@ -2289,6 +2255,8 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2289 | p = &alc_pcm_analog_playback; | 2255 | p = &alc_pcm_analog_playback; |
2290 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p; | 2256 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p; |
2291 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | 2257 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
2258 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = | ||
2259 | spec->multiout.max_channels; | ||
2292 | } | 2260 | } |
2293 | if (spec->adc_nids) { | 2261 | if (spec->adc_nids) { |
2294 | p = spec->stream_analog_capture; | 2262 | p = spec->stream_analog_capture; |
@@ -2437,7 +2405,7 @@ static void alc_free(struct hda_codec *codec) | |||
2437 | snd_hda_detach_beep_device(codec); | 2405 | snd_hda_detach_beep_device(codec); |
2438 | } | 2406 | } |
2439 | 2407 | ||
2440 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2408 | #ifdef CONFIG_PM |
2441 | static void alc_power_eapd(struct hda_codec *codec) | 2409 | static void alc_power_eapd(struct hda_codec *codec) |
2442 | { | 2410 | { |
2443 | alc_auto_setup_eapd(codec, false); | 2411 | alc_auto_setup_eapd(codec, false); |
@@ -2473,17 +2441,18 @@ static const struct hda_codec_ops alc_patch_ops = { | |||
2473 | .build_pcms = alc_build_pcms, | 2441 | .build_pcms = alc_build_pcms, |
2474 | .init = alc_init, | 2442 | .init = alc_init, |
2475 | .free = alc_free, | 2443 | .free = alc_free, |
2476 | .unsol_event = alc_unsol_event, | 2444 | .unsol_event = snd_hda_jack_unsol_event, |
2477 | #ifdef CONFIG_PM | 2445 | #ifdef CONFIG_PM |
2478 | .resume = alc_resume, | 2446 | .resume = alc_resume, |
2479 | #endif | 2447 | #endif |
2480 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2448 | #ifdef CONFIG_PM |
2481 | .suspend = alc_suspend, | 2449 | .suspend = alc_suspend, |
2482 | .check_power_status = alc_check_power_status, | 2450 | .check_power_status = alc_check_power_status, |
2483 | #endif | 2451 | #endif |
2484 | .reboot_notify = alc_shutup, | 2452 | .reboot_notify = alc_shutup, |
2485 | }; | 2453 | }; |
2486 | 2454 | ||
2455 | |||
2487 | /* replace the codec chip_name with the given string */ | 2456 | /* replace the codec chip_name with the given string */ |
2488 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | 2457 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
2489 | { | 2458 | { |
@@ -2633,7 +2602,7 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | |||
2633 | return channel_name[ch]; | 2602 | return channel_name[ch]; |
2634 | } | 2603 | } |
2635 | 2604 | ||
2636 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2605 | #ifdef CONFIG_PM |
2637 | /* add the powersave loopback-list entry */ | 2606 | /* add the powersave loopback-list entry */ |
2638 | static void add_loopback_list(struct alc_spec *spec, hda_nid_t mix, int idx) | 2607 | static void add_loopback_list(struct alc_spec *spec, hda_nid_t mix, int idx) |
2639 | { | 2608 | { |
@@ -4447,7 +4416,7 @@ static void alc880_fixup_vol_knob(struct hda_codec *codec, | |||
4447 | const struct alc_fixup *fix, int action) | 4416 | const struct alc_fixup *fix, int action) |
4448 | { | 4417 | { |
4449 | if (action == ALC_FIXUP_ACT_PROBE) | 4418 | if (action == ALC_FIXUP_ACT_PROBE) |
4450 | snd_hda_jack_detect_enable(codec, 0x21, ALC_DCVOL_EVENT); | 4419 | snd_hda_jack_detect_enable_callback(codec, 0x21, ALC_DCVOL_EVENT, alc_update_knob_master); |
4451 | } | 4420 | } |
4452 | 4421 | ||
4453 | static const struct alc_fixup alc880_fixups[] = { | 4422 | static const struct alc_fixup alc880_fixups[] = { |
@@ -4812,6 +4781,8 @@ static int patch_alc880(struct hda_codec *codec) | |||
4812 | } | 4781 | } |
4813 | 4782 | ||
4814 | codec->patch_ops = alc_patch_ops; | 4783 | codec->patch_ops = alc_patch_ops; |
4784 | codec->patch_ops.unsol_event = alc880_unsol_event; | ||
4785 | |||
4815 | 4786 | ||
4816 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 4787 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
4817 | 4788 | ||
@@ -4866,7 +4837,8 @@ static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, | |||
4866 | spec->detect_hp = 1; | 4837 | spec->detect_hp = 1; |
4867 | spec->automute_speaker = 1; | 4838 | spec->automute_speaker = 1; |
4868 | spec->autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ | 4839 | spec->autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ |
4869 | snd_hda_jack_detect_enable(codec, 0x0f, ALC_HP_EVENT); | 4840 | snd_hda_jack_detect_enable_callback(codec, 0x0f, ALC_HP_EVENT, |
4841 | alc_hp_automute); | ||
4870 | snd_hda_gen_add_verbs(&spec->gen, alc_gpio1_init_verbs); | 4842 | snd_hda_gen_add_verbs(&spec->gen, alc_gpio1_init_verbs); |
4871 | } | 4843 | } |
4872 | } | 4844 | } |
@@ -6189,6 +6161,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6189 | SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), | 6161 | SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), |
6190 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), | 6162 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), |
6191 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), | 6163 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), |
6164 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), | ||
6192 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | 6165 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
6193 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), | 6166 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
6194 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), | 6167 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
@@ -6334,6 +6307,12 @@ static int patch_alc269(struct hda_codec *codec) | |||
6334 | 6307 | ||
6335 | spec = codec->spec; | 6308 | spec = codec->spec; |
6336 | 6309 | ||
6310 | alc_pick_fixup(codec, alc269_fixup_models, | ||
6311 | alc269_fixup_tbl, alc269_fixups); | ||
6312 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
6313 | |||
6314 | alc_auto_parse_customize_define(codec); | ||
6315 | |||
6337 | if (codec->vendor_id == 0x10ec0269) { | 6316 | if (codec->vendor_id == 0x10ec0269) { |
6338 | spec->codec_variant = ALC269_TYPE_ALC269VA; | 6317 | spec->codec_variant = ALC269_TYPE_ALC269VA; |
6339 | switch (alc_get_coef0(codec) & 0x00f0) { | 6318 | switch (alc_get_coef0(codec) & 0x00f0) { |
@@ -6361,12 +6340,6 @@ static int patch_alc269(struct hda_codec *codec) | |||
6361 | alc269_fill_coef(codec); | 6340 | alc269_fill_coef(codec); |
6362 | } | 6341 | } |
6363 | 6342 | ||
6364 | alc_pick_fixup(codec, alc269_fixup_models, | ||
6365 | alc269_fixup_tbl, alc269_fixups); | ||
6366 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
6367 | |||
6368 | alc_auto_parse_customize_define(codec); | ||
6369 | |||
6370 | /* automatic parse from the BIOS config */ | 6343 | /* automatic parse from the BIOS config */ |
6371 | err = alc269_parse_auto_config(codec); | 6344 | err = alc269_parse_auto_config(codec); |
6372 | if (err < 0) | 6345 | if (err < 0) |
@@ -6503,7 +6476,7 @@ static int patch_alc861(struct hda_codec *codec) | |||
6503 | } | 6476 | } |
6504 | 6477 | ||
6505 | codec->patch_ops = alc_patch_ops; | 6478 | codec->patch_ops = alc_patch_ops; |
6506 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 6479 | #ifdef CONFIG_PM |
6507 | spec->power_hook = alc_power_eapd; | 6480 | spec->power_hook = alc_power_eapd; |
6508 | #endif | 6481 | #endif |
6509 | 6482 | ||
@@ -7068,6 +7041,8 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
7068 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, | 7041 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, |
7069 | { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, | 7042 | { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, |
7070 | { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, | 7043 | { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, |
7044 | { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, | ||
7045 | { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, | ||
7071 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | 7046 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
7072 | .patch = patch_alc861 }, | 7047 | .patch = patch_alc861 }, |
7073 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | 7048 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3d4722f0a1ca..fe163547f906 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -103,6 +103,7 @@ enum { | |||
103 | STAC_HP_ZEPHYR, | 103 | STAC_HP_ZEPHYR, |
104 | STAC_92HD83XXX_HP_LED, | 104 | STAC_92HD83XXX_HP_LED, |
105 | STAC_92HD83XXX_HP_INV_LED, | 105 | STAC_92HD83XXX_HP_INV_LED, |
106 | STAC_92HD83XXX_HP_MIC_LED, | ||
106 | STAC_92HD83XXX_MODELS | 107 | STAC_92HD83XXX_MODELS |
107 | }; | 108 | }; |
108 | 109 | ||
@@ -215,6 +216,9 @@ struct sigmatel_spec { | |||
215 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ | 216 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ |
216 | unsigned int vref_led; | 217 | unsigned int vref_led; |
217 | 218 | ||
219 | unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */ | ||
220 | bool mic_mute_led_on; /* current mic mute state */ | ||
221 | |||
218 | /* stream */ | 222 | /* stream */ |
219 | unsigned int stream_delay; | 223 | unsigned int stream_delay; |
220 | 224 | ||
@@ -1679,6 +1683,7 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | |||
1679 | [STAC_HP_ZEPHYR] = "hp-zephyr", | 1683 | [STAC_HP_ZEPHYR] = "hp-zephyr", |
1680 | [STAC_92HD83XXX_HP_LED] = "hp-led", | 1684 | [STAC_92HD83XXX_HP_LED] = "hp-led", |
1681 | [STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led", | 1685 | [STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led", |
1686 | [STAC_92HD83XXX_HP_MIC_LED] = "hp-mic-led", | ||
1682 | }; | 1687 | }; |
1683 | 1688 | ||
1684 | static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | 1689 | static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
@@ -1703,6 +1708,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1703 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 1708 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
1704 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, | 1709 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, |
1705 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 1710 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
1711 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, | ||
1712 | "HP Folio", STAC_92HD83XXX_HP_MIC_LED), | ||
1706 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388, | 1713 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388, |
1707 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 1714 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
1708 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389, | 1715 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389, |
@@ -2791,18 +2798,27 @@ stac_control_new(struct sigmatel_spec *spec, | |||
2791 | return knew; | 2798 | return knew; |
2792 | } | 2799 | } |
2793 | 2800 | ||
2794 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, | 2801 | static struct snd_kcontrol_new * |
2795 | const struct snd_kcontrol_new *ktemp, | 2802 | add_control_temp(struct sigmatel_spec *spec, |
2796 | int idx, const char *name, | 2803 | const struct snd_kcontrol_new *ktemp, |
2797 | unsigned long val) | 2804 | int idx, const char *name, |
2805 | unsigned long val) | ||
2798 | { | 2806 | { |
2799 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name, | 2807 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name, |
2800 | HDA_SUBDEV_AMP_FLAG); | 2808 | HDA_SUBDEV_AMP_FLAG); |
2801 | if (!knew) | 2809 | if (!knew) |
2802 | return -ENOMEM; | 2810 | return NULL; |
2803 | knew->index = idx; | 2811 | knew->index = idx; |
2804 | knew->private_value = val; | 2812 | knew->private_value = val; |
2805 | return 0; | 2813 | return knew; |
2814 | } | ||
2815 | |||
2816 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, | ||
2817 | const struct snd_kcontrol_new *ktemp, | ||
2818 | int idx, const char *name, | ||
2819 | unsigned long val) | ||
2820 | { | ||
2821 | return add_control_temp(spec, ktemp, idx, name, val) ? 0 : -ENOMEM; | ||
2806 | } | 2822 | } |
2807 | 2823 | ||
2808 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, | 2824 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, |
@@ -3226,9 +3242,12 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, | |||
3226 | idx = i; | 3242 | idx = i; |
3227 | break; | 3243 | break; |
3228 | case AUTO_PIN_SPEAKER_OUT: | 3244 | case AUTO_PIN_SPEAKER_OUT: |
3229 | name = "Speaker"; | 3245 | if (num_outs <= 1) { |
3230 | idx = i; | 3246 | name = "Speaker"; |
3231 | break; | 3247 | idx = i; |
3248 | break; | ||
3249 | } | ||
3250 | /* Fall through in case of multi speaker outs */ | ||
3232 | default: | 3251 | default: |
3233 | name = chname[i]; | 3252 | name = chname[i]; |
3234 | idx = 0; | 3253 | idx = 0; |
@@ -3242,18 +3261,56 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, | |||
3242 | return 0; | 3261 | return 0; |
3243 | } | 3262 | } |
3244 | 3263 | ||
3264 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, | ||
3265 | unsigned int dir_mask, unsigned int data); | ||
3266 | |||
3267 | /* hook for controlling mic-mute LED GPIO */ | ||
3268 | static int stac92xx_capture_sw_put_led(struct snd_kcontrol *kcontrol, | ||
3269 | struct snd_ctl_elem_value *ucontrol) | ||
3270 | { | ||
3271 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3272 | struct sigmatel_spec *spec = codec->spec; | ||
3273 | int err; | ||
3274 | bool mute; | ||
3275 | |||
3276 | err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | ||
3277 | if (err <= 0) | ||
3278 | return err; | ||
3279 | mute = !(ucontrol->value.integer.value[0] && | ||
3280 | ucontrol->value.integer.value[1]); | ||
3281 | if (spec->mic_mute_led_on != mute) { | ||
3282 | spec->mic_mute_led_on = mute; | ||
3283 | if (mute) | ||
3284 | spec->gpio_data |= spec->mic_mute_led_gpio; | ||
3285 | else | ||
3286 | spec->gpio_data &= ~spec->mic_mute_led_gpio; | ||
3287 | stac_gpio_set(codec, spec->gpio_mask, | ||
3288 | spec->gpio_dir, spec->gpio_data); | ||
3289 | } | ||
3290 | return err; | ||
3291 | } | ||
3292 | |||
3245 | static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol, | 3293 | static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol, |
3246 | unsigned long sw, int idx) | 3294 | unsigned long sw, int idx) |
3247 | { | 3295 | { |
3296 | struct sigmatel_spec *spec = codec->spec; | ||
3297 | struct snd_kcontrol_new *knew; | ||
3248 | int err; | 3298 | int err; |
3299 | |||
3249 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, | 3300 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, |
3250 | "Capture Volume", vol); | 3301 | "Capture Volume", vol); |
3251 | if (err < 0) | 3302 | if (err < 0) |
3252 | return err; | 3303 | return err; |
3253 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx, | 3304 | |
3254 | "Capture Switch", sw); | 3305 | knew = add_control_temp(spec, |
3255 | if (err < 0) | 3306 | &stac92xx_control_templates[STAC_CTL_WIDGET_MUTE], |
3256 | return err; | 3307 | idx, "Capture Switch", sw); |
3308 | if (!knew) | ||
3309 | return -ENOMEM; | ||
3310 | /* add a LED hook for some HP laptops */ | ||
3311 | if (spec->mic_mute_led_gpio) | ||
3312 | knew->put = stac92xx_capture_sw_put_led; | ||
3313 | |||
3257 | return 0; | 3314 | return 0; |
3258 | } | 3315 | } |
3259 | 3316 | ||
@@ -4155,6 +4212,9 @@ static int stac_add_event(struct hda_codec *codec, hda_nid_t nid, | |||
4155 | return 0; | 4212 | return 0; |
4156 | } | 4213 | } |
4157 | 4214 | ||
4215 | static void handle_unsol_event(struct hda_codec *codec, | ||
4216 | struct hda_jack_tbl *event); | ||
4217 | |||
4158 | /* check if given nid is a valid pin and no other events are assigned | 4218 | /* check if given nid is a valid pin and no other events are assigned |
4159 | * to it. If OK, assign the event, set the unsol flag, and returns 1. | 4219 | * to it. If OK, assign the event, set the unsol flag, and returns 1. |
4160 | * Otherwise, returns zero. | 4220 | * Otherwise, returns zero. |
@@ -4172,6 +4232,7 @@ static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, | |||
4172 | if (event->action && event->action != type) | 4232 | if (event->action && event->action != type) |
4173 | return 0; | 4233 | return 0; |
4174 | event->action = type; | 4234 | event->action = type; |
4235 | event->callback = handle_unsol_event; | ||
4175 | snd_hda_jack_detect_enable(codec, nid, 0); | 4236 | snd_hda_jack_detect_enable(codec, nid, 0); |
4176 | return 1; | 4237 | return 1; |
4177 | } | 4238 | } |
@@ -4418,8 +4479,6 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4418 | stac_toggle_power_map(codec, nid, 0); | 4479 | stac_toggle_power_map(codec, nid, 0); |
4419 | } | 4480 | } |
4420 | 4481 | ||
4421 | snd_hda_jack_report_sync(codec); | ||
4422 | |||
4423 | /* sync mute LED */ | 4482 | /* sync mute LED */ |
4424 | if (spec->gpio_led) { | 4483 | if (spec->gpio_led) { |
4425 | if (spec->vmaster_mute.hook) | 4484 | if (spec->vmaster_mute.hook) |
@@ -4812,20 +4871,6 @@ static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) | |||
4812 | handle_unsol_event(codec, event); | 4871 | handle_unsol_event(codec, event); |
4813 | } | 4872 | } |
4814 | 4873 | ||
4815 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | ||
4816 | { | ||
4817 | struct hda_jack_tbl *event; | ||
4818 | int tag; | ||
4819 | |||
4820 | tag = (res >> 26) & 0x7f; | ||
4821 | event = snd_hda_jack_tbl_get_from_tag(codec, tag); | ||
4822 | if (!event) | ||
4823 | return; | ||
4824 | event->jack_dirty = 1; | ||
4825 | handle_unsol_event(codec, event); | ||
4826 | snd_hda_jack_report_sync(codec); | ||
4827 | } | ||
4828 | |||
4829 | static int hp_blike_system(u32 subsystem_id); | 4874 | static int hp_blike_system(u32 subsystem_id); |
4830 | 4875 | ||
4831 | static void set_hp_led_gpio(struct hda_codec *codec) | 4876 | static void set_hp_led_gpio(struct hda_codec *codec) |
@@ -5076,7 +5121,7 @@ static const struct hda_codec_ops stac92xx_patch_ops = { | |||
5076 | .build_pcms = stac92xx_build_pcms, | 5121 | .build_pcms = stac92xx_build_pcms, |
5077 | .init = stac92xx_init, | 5122 | .init = stac92xx_init, |
5078 | .free = stac92xx_free, | 5123 | .free = stac92xx_free, |
5079 | .unsol_event = stac92xx_unsol_event, | 5124 | .unsol_event = snd_hda_jack_unsol_event, |
5080 | #ifdef CONFIG_PM | 5125 | #ifdef CONFIG_PM |
5081 | .suspend = stac92xx_suspend, | 5126 | .suspend = stac92xx_suspend, |
5082 | .resume = stac92xx_resume, | 5127 | .resume = stac92xx_resume, |
@@ -5578,6 +5623,9 @@ again: | |||
5578 | case STAC_92HD83XXX_HP_INV_LED: | 5623 | case STAC_92HD83XXX_HP_INV_LED: |
5579 | default_polarity = 1; | 5624 | default_polarity = 1; |
5580 | break; | 5625 | break; |
5626 | case STAC_92HD83XXX_HP_MIC_LED: | ||
5627 | spec->mic_mute_led_gpio = 0x08; /* GPIO3 */ | ||
5628 | break; | ||
5581 | } | 5629 | } |
5582 | 5630 | ||
5583 | if (find_mute_led_cfg(codec, default_polarity)) | 5631 | if (find_mute_led_cfg(codec, default_polarity)) |
@@ -5596,6 +5644,13 @@ again: | |||
5596 | } | 5644 | } |
5597 | } | 5645 | } |
5598 | 5646 | ||
5647 | if (spec->mic_mute_led_gpio) { | ||
5648 | spec->gpio_mask |= spec->mic_mute_led_gpio; | ||
5649 | spec->gpio_dir |= spec->mic_mute_led_gpio; | ||
5650 | spec->mic_mute_led_on = true; | ||
5651 | spec->gpio_data |= spec->mic_mute_led_gpio; | ||
5652 | } | ||
5653 | |||
5599 | err = stac92xx_parse_auto_config(codec); | 5654 | err = stac92xx_parse_auto_config(codec); |
5600 | if (!err) { | 5655 | if (!err) { |
5601 | if (spec->board_config < 0) { | 5656 | if (spec->board_config < 0) { |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 430771776915..5a45a912aedc 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1672,7 +1672,8 @@ static void via_hp_automute(struct hda_codec *codec) | |||
1672 | struct via_spec *spec = codec->spec; | 1672 | struct via_spec *spec = codec->spec; |
1673 | 1673 | ||
1674 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && | 1674 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && |
1675 | (spec->codec_type != VT1708 || spec->vt1708_jack_detect)) | 1675 | (spec->codec_type != VT1708 || spec->vt1708_jack_detect) && |
1676 | is_jack_detectable(codec, spec->autocfg.hp_pins[0])) | ||
1676 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); | 1677 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); |
1677 | 1678 | ||
1678 | if (spec->smart51_enabled) | 1679 | if (spec->smart51_enabled) |
@@ -1764,7 +1765,7 @@ static int via_suspend(struct hda_codec *codec) | |||
1764 | } | 1765 | } |
1765 | #endif | 1766 | #endif |
1766 | 1767 | ||
1767 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1768 | #ifdef CONFIG_PM |
1768 | static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid) | 1769 | static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
1769 | { | 1770 | { |
1770 | struct via_spec *spec = codec->spec; | 1771 | struct via_spec *spec = codec->spec; |
@@ -1785,8 +1786,6 @@ static const struct hda_codec_ops via_patch_ops = { | |||
1785 | .unsol_event = via_unsol_event, | 1786 | .unsol_event = via_unsol_event, |
1786 | #ifdef CONFIG_PM | 1787 | #ifdef CONFIG_PM |
1787 | .suspend = via_suspend, | 1788 | .suspend = via_suspend, |
1788 | #endif | ||
1789 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
1790 | .check_power_status = via_check_power_status, | 1789 | .check_power_status = via_check_power_status, |
1791 | #endif | 1790 | #endif |
1792 | }; | 1791 | }; |
@@ -2815,7 +2814,6 @@ static int via_init(struct hda_codec *codec) | |||
2815 | 2814 | ||
2816 | via_hp_automute(codec); | 2815 | via_hp_automute(codec); |
2817 | vt1708_update_hp_work(spec); | 2816 | vt1708_update_hp_work(spec); |
2818 | snd_hda_jack_report_sync(codec); | ||
2819 | 2817 | ||
2820 | return 0; | 2818 | return 0; |
2821 | } | 2819 | } |
@@ -3669,6 +3667,32 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec) | |||
3669 | update_power_state(codec, 0x21, AC_PWRST_D3); | 3667 | update_power_state(codec, 0x21, AC_PWRST_D3); |
3670 | } | 3668 | } |
3671 | 3669 | ||
3670 | /* | ||
3671 | * pin fix-up | ||
3672 | */ | ||
3673 | enum { | ||
3674 | VIA_FIXUP_INTMIC_BOOST, | ||
3675 | }; | ||
3676 | |||
3677 | static void via_fixup_intmic_boost(struct hda_codec *codec, | ||
3678 | const struct hda_fixup *fix, int action) | ||
3679 | { | ||
3680 | if (action == HDA_FIXUP_ACT_PRE_PROBE) | ||
3681 | override_mic_boost(codec, 0x30, 0, 2, 40); | ||
3682 | } | ||
3683 | |||
3684 | static const struct hda_fixup via_fixups[] = { | ||
3685 | [VIA_FIXUP_INTMIC_BOOST] = { | ||
3686 | .type = HDA_FIXUP_FUNC, | ||
3687 | .v.func = via_fixup_intmic_boost, | ||
3688 | }, | ||
3689 | }; | ||
3690 | |||
3691 | static const struct snd_pci_quirk vt2002p_fixups[] = { | ||
3692 | SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST), | ||
3693 | {} | ||
3694 | }; | ||
3695 | |||
3672 | /* patch for vt2002P */ | 3696 | /* patch for vt2002P */ |
3673 | static int patch_vt2002P(struct hda_codec *codec) | 3697 | static int patch_vt2002P(struct hda_codec *codec) |
3674 | { | 3698 | { |
@@ -3685,6 +3709,9 @@ static int patch_vt2002P(struct hda_codec *codec) | |||
3685 | override_mic_boost(codec, 0x29, 0, 3, 40); | 3709 | override_mic_boost(codec, 0x29, 0, 3, 40); |
3686 | add_secret_dac_path(codec); | 3710 | add_secret_dac_path(codec); |
3687 | 3711 | ||
3712 | snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups); | ||
3713 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | ||
3714 | |||
3688 | /* automatic parse from the BIOS config */ | 3715 | /* automatic parse from the BIOS config */ |
3689 | err = via_parse_auto_config(codec); | 3716 | err = via_parse_auto_config(codec); |
3690 | if (err < 0) { | 3717 | if (err < 0) { |
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 3e4f8c12ffce..20bcddea2eab 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c | |||
@@ -2103,7 +2103,7 @@ static int aureon_reset(struct snd_ice1712 *ice) | |||
2103 | /* | 2103 | /* |
2104 | * suspend/resume | 2104 | * suspend/resume |
2105 | */ | 2105 | */ |
2106 | #ifdef CONFIG_PM | 2106 | #ifdef CONFIG_PM_SLEEP |
2107 | static int aureon_resume(struct snd_ice1712 *ice) | 2107 | static int aureon_resume(struct snd_ice1712 *ice) |
2108 | { | 2108 | { |
2109 | struct aureon_spec *spec = ice->spec; | 2109 | struct aureon_spec *spec = ice->spec; |
@@ -2160,7 +2160,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) | |||
2160 | wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); | 2160 | wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); |
2161 | } | 2161 | } |
2162 | 2162 | ||
2163 | #ifdef CONFIG_PM | 2163 | #ifdef CONFIG_PM_SLEEP |
2164 | ice->pm_resume = aureon_resume; | 2164 | ice->pm_resume = aureon_resume; |
2165 | ice->pm_suspend_enabled = 1; | 2165 | ice->pm_suspend_enabled = 1; |
2166 | #endif | 2166 | #endif |
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 0da778a69ef8..d0e7d87f09f0 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h | |||
@@ -384,7 +384,7 @@ struct snd_ice1712 { | |||
384 | char **ext_clock_names; | 384 | char **ext_clock_names; |
385 | int ext_clock_count; | 385 | int ext_clock_count; |
386 | void (*pro_open)(struct snd_ice1712 *, struct snd_pcm_substream *); | 386 | void (*pro_open)(struct snd_ice1712 *, struct snd_pcm_substream *); |
387 | #ifdef CONFIG_PM | 387 | #ifdef CONFIG_PM_SLEEP |
388 | int (*pm_suspend)(struct snd_ice1712 *); | 388 | int (*pm_suspend)(struct snd_ice1712 *); |
389 | int (*pm_resume)(struct snd_ice1712 *); | 389 | int (*pm_resume)(struct snd_ice1712 *); |
390 | unsigned int pm_suspend_enabled:1; | 390 | unsigned int pm_suspend_enabled:1; |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index bed9f34f4efe..3050a5279253 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -2792,7 +2792,7 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci) | |||
2792 | pci_set_drvdata(pci, NULL); | 2792 | pci_set_drvdata(pci, NULL); |
2793 | } | 2793 | } |
2794 | 2794 | ||
2795 | #ifdef CONFIG_PM | 2795 | #ifdef CONFIG_PM_SLEEP |
2796 | static int snd_vt1724_suspend(struct device *dev) | 2796 | static int snd_vt1724_suspend(struct device *dev) |
2797 | { | 2797 | { |
2798 | struct pci_dev *pci = to_pci_dev(dev); | 2798 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -2878,7 +2878,7 @@ static SIMPLE_DEV_PM_OPS(snd_vt1724_pm, snd_vt1724_suspend, snd_vt1724_resume); | |||
2878 | #define SND_VT1724_PM_OPS &snd_vt1724_pm | 2878 | #define SND_VT1724_PM_OPS &snd_vt1724_pm |
2879 | #else | 2879 | #else |
2880 | #define SND_VT1724_PM_OPS NULL | 2880 | #define SND_VT1724_PM_OPS NULL |
2881 | #endif /* CONFIG_PM */ | 2881 | #endif /* CONFIG_PM_SLEEP */ |
2882 | 2882 | ||
2883 | static struct pci_driver vt1724_driver = { | 2883 | static struct pci_driver vt1724_driver = { |
2884 | .name = KBUILD_MODNAME, | 2884 | .name = KBUILD_MODNAME, |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 98bc3b7681b5..14fd536b6452 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -486,7 +486,7 @@ static int __devinit juli_add_controls(struct snd_ice1712 *ice) | |||
486 | * suspend/resume | 486 | * suspend/resume |
487 | * */ | 487 | * */ |
488 | 488 | ||
489 | #ifdef CONFIG_PM | 489 | #ifdef CONFIG_PM_SLEEP |
490 | static int juli_resume(struct snd_ice1712 *ice) | 490 | static int juli_resume(struct snd_ice1712 *ice) |
491 | { | 491 | { |
492 | struct snd_akm4xxx *ak = ice->akm; | 492 | struct snd_akm4xxx *ak = ice->akm; |
@@ -652,7 +652,7 @@ static int __devinit juli_init(struct snd_ice1712 *ice) | |||
652 | 652 | ||
653 | ice->spdif.ops.open = juli_spdif_in_open; | 653 | ice->spdif.ops.open = juli_spdif_in_open; |
654 | 654 | ||
655 | #ifdef CONFIG_PM | 655 | #ifdef CONFIG_PM_SLEEP |
656 | ice->pm_resume = juli_resume; | 656 | ice->pm_resume = juli_resume; |
657 | ice->pm_suspend = juli_suspend; | 657 | ice->pm_suspend = juli_suspend; |
658 | ice->pm_suspend_enabled = 1; | 658 | ice->pm_suspend_enabled = 1; |
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c index 075d5aa1fee0..7bf093c51ce5 100644 --- a/sound/pci/ice1712/prodigy_hifi.c +++ b/sound/pci/ice1712/prodigy_hifi.c | |||
@@ -1100,7 +1100,7 @@ static void ak4396_init(struct snd_ice1712 *ice) | |||
1100 | ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]); | 1100 | ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]); |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | #ifdef CONFIG_PM | 1103 | #ifdef CONFIG_PM_SLEEP |
1104 | static int prodigy_hd2_resume(struct snd_ice1712 *ice) | 1104 | static int prodigy_hd2_resume(struct snd_ice1712 *ice) |
1105 | { | 1105 | { |
1106 | /* initialize ak4396 codec and restore previous mixer volumes */ | 1106 | /* initialize ak4396 codec and restore previous mixer volumes */ |
@@ -1141,7 +1141,7 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | |||
1141 | return -ENOMEM; | 1141 | return -ENOMEM; |
1142 | ice->spec = spec; | 1142 | ice->spec = spec; |
1143 | 1143 | ||
1144 | #ifdef CONFIG_PM | 1144 | #ifdef CONFIG_PM_SLEEP |
1145 | ice->pm_resume = &prodigy_hd2_resume; | 1145 | ice->pm_resume = &prodigy_hd2_resume; |
1146 | ice->pm_suspend_enabled = 1; | 1146 | ice->pm_suspend_enabled = 1; |
1147 | #endif | 1147 | #endif |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index cd553f592e2d..ea4b706c8d63 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -1541,6 +1541,26 @@ static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device, | |||
1541 | snd_dma_pci_data(chip->pci), | 1541 | snd_dma_pci_data(chip->pci), |
1542 | rec->prealloc_size, rec->prealloc_max_size); | 1542 | rec->prealloc_size, rec->prealloc_max_size); |
1543 | 1543 | ||
1544 | if (rec->ac97_idx == ICHD_PCMOUT && rec->playback_ops) { | ||
1545 | struct snd_pcm_chmap *chmap; | ||
1546 | int chs = 2; | ||
1547 | if (rec->ac97_idx == ICHD_PCMOUT) { | ||
1548 | if (chip->multi8) | ||
1549 | chs = 8; | ||
1550 | else if (chip->multi6) | ||
1551 | chs = 6; | ||
1552 | else if (chip->multi4) | ||
1553 | chs = 4; | ||
1554 | } | ||
1555 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1556 | snd_pcm_alt_chmaps, chs, 0, | ||
1557 | &chmap); | ||
1558 | if (err < 0) | ||
1559 | return err; | ||
1560 | chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; | ||
1561 | chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; | ||
1562 | } | ||
1563 | |||
1544 | return 0; | 1564 | return 0; |
1545 | } | 1565 | } |
1546 | 1566 | ||
@@ -2206,7 +2226,7 @@ static int __devinit snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock, | |||
2206 | case DEVICE_INTEL_ICH4: | 2226 | case DEVICE_INTEL_ICH4: |
2207 | chip->spdif_idx = ICHD_SPBAR; | 2227 | chip->spdif_idx = ICHD_SPBAR; |
2208 | break; | 2228 | break; |
2209 | }; | 2229 | } |
2210 | } | 2230 | } |
2211 | 2231 | ||
2212 | chip->in_ac97_init = 1; | 2232 | chip->in_ac97_init = 1; |
@@ -2620,7 +2640,7 @@ static int snd_intel8x0_free(struct intel8x0 *chip) | |||
2620 | return 0; | 2640 | return 0; |
2621 | } | 2641 | } |
2622 | 2642 | ||
2623 | #ifdef CONFIG_PM | 2643 | #ifdef CONFIG_PM_SLEEP |
2624 | /* | 2644 | /* |
2625 | * power management | 2645 | * power management |
2626 | */ | 2646 | */ |
@@ -2741,7 +2761,7 @@ static SIMPLE_DEV_PM_OPS(intel8x0_pm, intel8x0_suspend, intel8x0_resume); | |||
2741 | #define INTEL8X0_PM_OPS &intel8x0_pm | 2761 | #define INTEL8X0_PM_OPS &intel8x0_pm |
2742 | #else | 2762 | #else |
2743 | #define INTEL8X0_PM_OPS NULL | 2763 | #define INTEL8X0_PM_OPS NULL |
2744 | #endif /* CONFIG_PM */ | 2764 | #endif /* CONFIG_PM_SLEEP */ |
2745 | 2765 | ||
2746 | #define INTEL8X0_TESTBUF_SIZE 32768 /* enough large for one shot */ | 2766 | #define INTEL8X0_TESTBUF_SIZE 32768 /* enough large for one shot */ |
2747 | 2767 | ||
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index da44bb3f8e7a..4d551736531e 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -1008,7 +1008,7 @@ static int snd_intel8x0m_free(struct intel8x0m *chip) | |||
1008 | return 0; | 1008 | return 0; |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | #ifdef CONFIG_PM | 1011 | #ifdef CONFIG_PM_SLEEP |
1012 | /* | 1012 | /* |
1013 | * power management | 1013 | * power management |
1014 | */ | 1014 | */ |
@@ -1067,7 +1067,7 @@ static SIMPLE_DEV_PM_OPS(intel8x0m_pm, intel8x0m_suspend, intel8x0m_resume); | |||
1067 | #define INTEL8X0M_PM_OPS &intel8x0m_pm | 1067 | #define INTEL8X0M_PM_OPS &intel8x0m_pm |
1068 | #else | 1068 | #else |
1069 | #define INTEL8X0M_PM_OPS NULL | 1069 | #define INTEL8X0M_PM_OPS NULL |
1070 | #endif /* CONFIG_PM */ | 1070 | #endif /* CONFIG_PM_SLEEP */ |
1071 | 1071 | ||
1072 | #ifdef CONFIG_PROC_FS | 1072 | #ifdef CONFIG_PROC_FS |
1073 | static void snd_intel8x0m_proc_read(struct snd_info_entry * entry, | 1073 | static void snd_intel8x0m_proc_read(struct snd_info_entry * entry, |
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index e69ce5f9c31e..8a67ce95f246 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -196,8 +196,8 @@ enum MonitorModeSelector { | |||
196 | #define K1212_ADAT_BUF_SIZE (K1212_ADAT_CHANNELS * 2 * kPlayBufferFrames * kNumBuffers) | 196 | #define K1212_ADAT_BUF_SIZE (K1212_ADAT_CHANNELS * 2 * kPlayBufferFrames * kNumBuffers) |
197 | #define K1212_MAX_BUF_SIZE (K1212_ANALOG_BUF_SIZE + K1212_ADAT_BUF_SIZE) | 197 | #define K1212_MAX_BUF_SIZE (K1212_ANALOG_BUF_SIZE + K1212_ADAT_BUF_SIZE) |
198 | 198 | ||
199 | #define k1212MinADCSens 0x7f | 199 | #define k1212MinADCSens 0x00 |
200 | #define k1212MaxADCSens 0x00 | 200 | #define k1212MaxADCSens 0x7f |
201 | #define k1212MaxVolume 0x7fff | 201 | #define k1212MaxVolume 0x7fff |
202 | #define k1212MaxWaveVolume 0xffff | 202 | #define k1212MaxWaveVolume 0xffff |
203 | #define k1212MinVolume 0x0000 | 203 | #define k1212MinVolume 0x0000 |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index c85d1ffcc955..eb3cd3a4315e 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -789,7 +789,7 @@ struct snd_m3 { | |||
789 | 789 | ||
790 | unsigned int in_suspend; | 790 | unsigned int in_suspend; |
791 | 791 | ||
792 | #ifdef CONFIG_PM | 792 | #ifdef CONFIG_PM_SLEEP |
793 | u16 *suspend_mem; | 793 | u16 *suspend_mem; |
794 | #endif | 794 | #endif |
795 | 795 | ||
@@ -2368,7 +2368,7 @@ static int snd_m3_free(struct snd_m3 *chip) | |||
2368 | outw(0, chip->iobase + HOST_INT_CTRL); /* disable ints */ | 2368 | outw(0, chip->iobase + HOST_INT_CTRL); /* disable ints */ |
2369 | } | 2369 | } |
2370 | 2370 | ||
2371 | #ifdef CONFIG_PM | 2371 | #ifdef CONFIG_PM_SLEEP |
2372 | vfree(chip->suspend_mem); | 2372 | vfree(chip->suspend_mem); |
2373 | #endif | 2373 | #endif |
2374 | 2374 | ||
@@ -2390,7 +2390,7 @@ static int snd_m3_free(struct snd_m3 *chip) | |||
2390 | /* | 2390 | /* |
2391 | * APM support | 2391 | * APM support |
2392 | */ | 2392 | */ |
2393 | #ifdef CONFIG_PM | 2393 | #ifdef CONFIG_PM_SLEEP |
2394 | static int m3_suspend(struct device *dev) | 2394 | static int m3_suspend(struct device *dev) |
2395 | { | 2395 | { |
2396 | struct pci_dev *pci = to_pci_dev(dev); | 2396 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -2485,7 +2485,7 @@ static SIMPLE_DEV_PM_OPS(m3_pm, m3_suspend, m3_resume); | |||
2485 | #define M3_PM_OPS &m3_pm | 2485 | #define M3_PM_OPS &m3_pm |
2486 | #else | 2486 | #else |
2487 | #define M3_PM_OPS NULL | 2487 | #define M3_PM_OPS NULL |
2488 | #endif /* CONFIG_PM */ | 2488 | #endif /* CONFIG_PM_SLEEP */ |
2489 | 2489 | ||
2490 | #ifdef CONFIG_SND_MAESTRO3_INPUT | 2490 | #ifdef CONFIG_SND_MAESTRO3_INPUT |
2491 | static int __devinit snd_m3_input_register(struct snd_m3 *chip) | 2491 | static int __devinit snd_m3_input_register(struct snd_m3 *chip) |
@@ -2656,7 +2656,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2656 | } | 2656 | } |
2657 | chip->irq = pci->irq; | 2657 | chip->irq = pci->irq; |
2658 | 2658 | ||
2659 | #ifdef CONFIG_PM | 2659 | #ifdef CONFIG_PM_SLEEP |
2660 | chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH)); | 2660 | chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH)); |
2661 | if (chip->suspend_mem == NULL) | 2661 | if (chip->suspend_mem == NULL) |
2662 | snd_printk(KERN_WARNING "can't allocate apm buffer\n"); | 2662 | snd_printk(KERN_WARNING "can't allocate apm buffer\n"); |
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index bfbdc91e4cb3..e0f4d87555a0 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c | |||
@@ -538,7 +538,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
538 | 538 | ||
539 | if ((err = snd_card_register(chip->card)) < 0) | 539 | if ((err = snd_card_register(chip->card)) < 0) |
540 | return err; | 540 | return err; |
541 | }; | 541 | } |
542 | 542 | ||
543 | snd_printdd("miXart firmware downloaded and successfully set up\n"); | 543 | snd_printdd("miXart firmware downloaded and successfully set up\n"); |
544 | 544 | ||
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 465cff25b146..e80e9a1e84aa 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -1377,7 +1377,7 @@ snd_nm256_peek_for_sig(struct nm256 *chip) | |||
1377 | return 0; | 1377 | return 0; |
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | #ifdef CONFIG_PM | 1380 | #ifdef CONFIG_PM_SLEEP |
1381 | /* | 1381 | /* |
1382 | * APM event handler, so the card is properly reinitialized after a power | 1382 | * APM event handler, so the card is properly reinitialized after a power |
1383 | * event. | 1383 | * event. |
@@ -1441,7 +1441,7 @@ static SIMPLE_DEV_PM_OPS(nm256_pm, nm256_suspend, nm256_resume); | |||
1441 | #define NM256_PM_OPS &nm256_pm | 1441 | #define NM256_PM_OPS &nm256_pm |
1442 | #else | 1442 | #else |
1443 | #define NM256_PM_OPS NULL | 1443 | #define NM256_PM_OPS NULL |
1444 | #endif /* CONFIG_PM */ | 1444 | #endif /* CONFIG_PM_SLEEP */ |
1445 | 1445 | ||
1446 | static int snd_nm256_free(struct nm256 *chip) | 1446 | static int snd_nm256_free(struct nm256 *chip) |
1447 | { | 1447 | { |
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index 37520a2b4dcf..2becae155a48 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c | |||
@@ -872,7 +872,7 @@ static struct pci_driver oxygen_driver = { | |||
872 | .id_table = oxygen_ids, | 872 | .id_table = oxygen_ids, |
873 | .probe = generic_oxygen_probe, | 873 | .probe = generic_oxygen_probe, |
874 | .remove = __devexit_p(oxygen_pci_remove), | 874 | .remove = __devexit_p(oxygen_pci_remove), |
875 | #ifdef CONFIG_PM | 875 | #ifdef CONFIG_PM_SLEEP |
876 | .driver = { | 876 | .driver = { |
877 | .pm = &oxygen_pci_pm, | 877 | .pm = &oxygen_pci_pm, |
878 | }, | 878 | }, |
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 7112a89fb8bd..09a24b24958b 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -161,7 +161,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | |||
161 | ) | 161 | ) |
162 | ); | 162 | ); |
163 | void oxygen_pci_remove(struct pci_dev *pci); | 163 | void oxygen_pci_remove(struct pci_dev *pci); |
164 | #ifdef CONFIG_PM | 164 | #ifdef CONFIG_PM_SLEEP |
165 | extern const struct dev_pm_ops oxygen_pci_pm; | 165 | extern const struct dev_pm_ops oxygen_pci_pm; |
166 | #endif | 166 | #endif |
167 | void oxygen_pci_shutdown(struct pci_dev *pci); | 167 | void oxygen_pci_shutdown(struct pci_dev *pci); |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index e9fa2d07951d..9562dc63ba60 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -726,7 +726,7 @@ void oxygen_pci_remove(struct pci_dev *pci) | |||
726 | } | 726 | } |
727 | EXPORT_SYMBOL(oxygen_pci_remove); | 727 | EXPORT_SYMBOL(oxygen_pci_remove); |
728 | 728 | ||
729 | #ifdef CONFIG_PM | 729 | #ifdef CONFIG_PM_SLEEP |
730 | static int oxygen_pci_suspend(struct device *dev) | 730 | static int oxygen_pci_suspend(struct device *dev) |
731 | { | 731 | { |
732 | struct pci_dev *pci = to_pci_dev(dev); | 732 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -824,7 +824,7 @@ static int oxygen_pci_resume(struct device *dev) | |||
824 | 824 | ||
825 | SIMPLE_DEV_PM_OPS(oxygen_pci_pm, oxygen_pci_suspend, oxygen_pci_resume); | 825 | SIMPLE_DEV_PM_OPS(oxygen_pci_pm, oxygen_pci_suspend, oxygen_pci_resume); |
826 | EXPORT_SYMBOL(oxygen_pci_pm); | 826 | EXPORT_SYMBOL(oxygen_pci_pm); |
827 | #endif /* CONFIG_PM */ | 827 | #endif /* CONFIG_PM_SLEEP */ |
828 | 828 | ||
829 | void oxygen_pci_shutdown(struct pci_dev *pci) | 829 | void oxygen_pci_shutdown(struct pci_dev *pci) |
830 | { | 830 | { |
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index d3b606b69f3b..3d71423b23bc 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -93,7 +93,7 @@ static struct pci_driver xonar_driver = { | |||
93 | .id_table = xonar_ids, | 93 | .id_table = xonar_ids, |
94 | .probe = xonar_probe, | 94 | .probe = xonar_probe, |
95 | .remove = __devexit_p(oxygen_pci_remove), | 95 | .remove = __devexit_p(oxygen_pci_remove), |
96 | #ifdef CONFIG_PM | 96 | #ifdef CONFIG_PM_SLEEP |
97 | .driver = { | 97 | .driver = { |
98 | .pm = &oxygen_pci_pm, | 98 | .pm = &oxygen_pci_pm, |
99 | }, | 99 | }, |
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index e3ac1f768ff6..be4f1456009a 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -91,6 +91,14 @@ enum { | |||
91 | PCI_ID_PCX924E, | 91 | PCI_ID_PCX924E, |
92 | PCI_ID_PCX924HRMIC, | 92 | PCI_ID_PCX924HRMIC, |
93 | PCI_ID_PCX924E_MIC, | 93 | PCI_ID_PCX924E_MIC, |
94 | PCI_ID_VX442HR, | ||
95 | PCI_ID_PCX442HR, | ||
96 | PCI_ID_VX442E, | ||
97 | PCI_ID_PCX442E, | ||
98 | PCI_ID_VX822HR, | ||
99 | PCI_ID_PCX822HR, | ||
100 | PCI_ID_VX822E, | ||
101 | PCI_ID_PCX822E, | ||
94 | PCI_ID_LAST | 102 | PCI_ID_LAST |
95 | }; | 103 | }; |
96 | 104 | ||
@@ -121,6 +129,14 @@ static DEFINE_PCI_DEVICE_TABLE(pcxhr_ids) = { | |||
121 | { 0x10b5, 0x9056, 0x1369, 0xbb21, 0, 0, PCI_ID_PCX924E, }, | 129 | { 0x10b5, 0x9056, 0x1369, 0xbb21, 0, 0, PCI_ID_PCX924E, }, |
122 | { 0x10b5, 0x9056, 0x1369, 0xbf01, 0, 0, PCI_ID_PCX924HRMIC, }, | 130 | { 0x10b5, 0x9056, 0x1369, 0xbf01, 0, 0, PCI_ID_PCX924HRMIC, }, |
123 | { 0x10b5, 0x9056, 0x1369, 0xbf21, 0, 0, PCI_ID_PCX924E_MIC, }, | 131 | { 0x10b5, 0x9056, 0x1369, 0xbf21, 0, 0, PCI_ID_PCX924E_MIC, }, |
132 | { 0x10b5, 0x9656, 0x1369, 0xd001, 0, 0, PCI_ID_VX442HR, }, | ||
133 | { 0x10b5, 0x9656, 0x1369, 0xd101, 0, 0, PCI_ID_PCX442HR, }, | ||
134 | { 0x10b5, 0x9056, 0x1369, 0xd021, 0, 0, PCI_ID_VX442E, }, | ||
135 | { 0x10b5, 0x9056, 0x1369, 0xd121, 0, 0, PCI_ID_PCX442E, }, | ||
136 | { 0x10b5, 0x9656, 0x1369, 0xd201, 0, 0, PCI_ID_VX822HR, }, | ||
137 | { 0x10b5, 0x9656, 0x1369, 0xd301, 0, 0, PCI_ID_PCX822HR, }, | ||
138 | { 0x10b5, 0x9056, 0x1369, 0xd221, 0, 0, PCI_ID_VX822E, }, | ||
139 | { 0x10b5, 0x9056, 0x1369, 0xd321, 0, 0, PCI_ID_PCX822E, }, | ||
124 | { 0, } | 140 | { 0, } |
125 | }; | 141 | }; |
126 | 142 | ||
@@ -160,6 +176,14 @@ static struct board_parameters pcxhr_board_params[] = { | |||
160 | [PCI_ID_PCX924E] = { "PCX924e", 1, 1, 5, 44 }, | 176 | [PCI_ID_PCX924E] = { "PCX924e", 1, 1, 5, 44 }, |
161 | [PCI_ID_PCX924HRMIC] = { "PCX924HR-Mic", 1, 1, 5, 44 }, | 177 | [PCI_ID_PCX924HRMIC] = { "PCX924HR-Mic", 1, 1, 5, 44 }, |
162 | [PCI_ID_PCX924E_MIC] = { "PCX924e-Mic", 1, 1, 5, 44 }, | 178 | [PCI_ID_PCX924E_MIC] = { "PCX924e-Mic", 1, 1, 5, 44 }, |
179 | [PCI_ID_VX442HR] = { "VX442HR", 2, 2, 0, 41 }, | ||
180 | [PCI_ID_PCX442HR] = { "PCX442HR", 2, 2, 0, 41 }, | ||
181 | [PCI_ID_VX442E] = { "VX442e", 2, 2, 1, 41 }, | ||
182 | [PCI_ID_PCX442E] = { "PCX442e", 2, 2, 1, 41 }, | ||
183 | [PCI_ID_VX822HR] = { "VX822HR", 4, 1, 2, 42 }, | ||
184 | [PCI_ID_PCX822HR] = { "PCX822HR", 4, 1, 2, 42 }, | ||
185 | [PCI_ID_VX822E] = { "VX822e", 4, 1, 3, 42 }, | ||
186 | [PCI_ID_PCX822E] = { "PCX822e", 4, 1, 3, 42 }, | ||
163 | }; | 187 | }; |
164 | 188 | ||
165 | /* boards without hw AES1 and SRC onboard are all using fw_file_set==4 */ | 189 | /* boards without hw AES1 and SRC onboard are all using fw_file_set==4 */ |
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c index ec1587cddb0c..bf207e317f71 100644 --- a/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/sound/pci/pcxhr/pcxhr_hwdep.c | |||
@@ -66,10 +66,10 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr) | |||
66 | err = pcxhr_send_msg(mgr, &rmh); | 66 | err = pcxhr_send_msg(mgr, &rmh); |
67 | if (err) | 67 | if (err) |
68 | return err; | 68 | return err; |
69 | /* test 8 or 12 phys out */ | 69 | /* test 4, 8 or 12 phys out */ |
70 | if ((rmh.stat[0] & MASK_FIRST_FIELD) != mgr->playback_chips * 2) | 70 | if ((rmh.stat[0] & MASK_FIRST_FIELD) < mgr->playback_chips * 2) |
71 | return -EINVAL; | 71 | return -EINVAL; |
72 | /* test 8 or 2 phys in */ | 72 | /* test 4, 8 or 2 phys in */ |
73 | if (((rmh.stat[0] >> (2 * FIELD_SIZE)) & MASK_FIRST_FIELD) < | 73 | if (((rmh.stat[0] >> (2 * FIELD_SIZE)) & MASK_FIRST_FIELD) < |
74 | mgr->capture_chips * 2) | 74 | mgr->capture_chips * 2) |
75 | return -EINVAL; | 75 | return -EINVAL; |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 760ee467cd9a..7d291542c5ba 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -464,7 +464,7 @@ struct snd_riptide { | |||
464 | 464 | ||
465 | unsigned long received_irqs; | 465 | unsigned long received_irqs; |
466 | unsigned long handled_irqs; | 466 | unsigned long handled_irqs; |
467 | #ifdef CONFIG_PM | 467 | #ifdef CONFIG_PM_SLEEP |
468 | int in_suspend; | 468 | int in_suspend; |
469 | #endif | 469 | #endif |
470 | }; | 470 | }; |
@@ -1150,7 +1150,7 @@ static void riptide_handleirq(unsigned long dev_id) | |||
1150 | } | 1150 | } |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | #ifdef CONFIG_PM | 1153 | #ifdef CONFIG_PM_SLEEP |
1154 | static int riptide_suspend(struct device *dev) | 1154 | static int riptide_suspend(struct device *dev) |
1155 | { | 1155 | { |
1156 | struct pci_dev *pci = to_pci_dev(dev); | 1156 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -1193,7 +1193,7 @@ static SIMPLE_DEV_PM_OPS(riptide_pm, riptide_suspend, riptide_resume); | |||
1193 | #define RIPTIDE_PM_OPS &riptide_pm | 1193 | #define RIPTIDE_PM_OPS &riptide_pm |
1194 | #else | 1194 | #else |
1195 | #define RIPTIDE_PM_OPS NULL | 1195 | #define RIPTIDE_PM_OPS NULL |
1196 | #endif /* CONFIG_PM */ | 1196 | #endif /* CONFIG_PM_SLEEP */ |
1197 | 1197 | ||
1198 | static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) | 1198 | static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) |
1199 | { | 1199 | { |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 805ab6e9a78f..51e43407ebc5 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -103,7 +103,7 @@ struct voice { | |||
103 | * we're not doing power management, we still need to allocate a page | 103 | * we're not doing power management, we still need to allocate a page |
104 | * for the silence buffer. | 104 | * for the silence buffer. |
105 | */ | 105 | */ |
106 | #ifdef CONFIG_PM | 106 | #ifdef CONFIG_PM_SLEEP |
107 | #define SIS_SUSPEND_PAGES 4 | 107 | #define SIS_SUSPEND_PAGES 4 |
108 | #else | 108 | #else |
109 | #define SIS_SUSPEND_PAGES 1 | 109 | #define SIS_SUSPEND_PAGES 1 |
@@ -1208,7 +1208,7 @@ static int sis_chip_init(struct sis7019 *sis) | |||
1208 | return 0; | 1208 | return 0; |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | #ifdef CONFIG_PM | 1211 | #ifdef CONFIG_PM_SLEEP |
1212 | static int sis_suspend(struct device *dev) | 1212 | static int sis_suspend(struct device *dev) |
1213 | { | 1213 | { |
1214 | struct pci_dev *pci = to_pci_dev(dev); | 1214 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -1305,7 +1305,7 @@ static SIMPLE_DEV_PM_OPS(sis_pm, sis_suspend, sis_resume); | |||
1305 | #define SIS_PM_OPS &sis_pm | 1305 | #define SIS_PM_OPS &sis_pm |
1306 | #else | 1306 | #else |
1307 | #define SIS_PM_OPS NULL | 1307 | #define SIS_PM_OPS NULL |
1308 | #endif /* CONFIG_PM */ | 1308 | #endif /* CONFIG_PM_SLEEP */ |
1309 | 1309 | ||
1310 | static int sis_alloc_suspend(struct sis7019 *sis) | 1310 | static int sis_alloc_suspend(struct sis7019 *sis) |
1311 | { | 1311 | { |
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index d36e6ca147e1..8a6f1f76e870 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c | |||
@@ -177,7 +177,7 @@ static struct pci_driver trident_driver = { | |||
177 | .id_table = snd_trident_ids, | 177 | .id_table = snd_trident_ids, |
178 | .probe = snd_trident_probe, | 178 | .probe = snd_trident_probe, |
179 | .remove = __devexit_p(snd_trident_remove), | 179 | .remove = __devexit_p(snd_trident_remove), |
180 | #ifdef CONFIG_PM | 180 | #ifdef CONFIG_PM_SLEEP |
181 | .driver = { | 181 | .driver = { |
182 | .pm = &snd_trident_pm, | 182 | .pm = &snd_trident_pm, |
183 | }, | 183 | }, |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 94011dcae731..06b10d1a76e5 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -3919,7 +3919,7 @@ static void snd_trident_clear_voices(struct snd_trident * trident, unsigned shor | |||
3919 | } | 3919 | } |
3920 | } | 3920 | } |
3921 | 3921 | ||
3922 | #ifdef CONFIG_PM | 3922 | #ifdef CONFIG_PM_SLEEP |
3923 | static int snd_trident_suspend(struct device *dev) | 3923 | static int snd_trident_suspend(struct device *dev) |
3924 | { | 3924 | { |
3925 | struct pci_dev *pci = to_pci_dev(dev); | 3925 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -3983,4 +3983,4 @@ static int snd_trident_resume(struct device *dev) | |||
3983 | } | 3983 | } |
3984 | 3984 | ||
3985 | SIMPLE_DEV_PM_OPS(snd_trident_pm, snd_trident_suspend, snd_trident_resume); | 3985 | SIMPLE_DEV_PM_OPS(snd_trident_pm, snd_trident_suspend, snd_trident_resume); |
3986 | #endif /* CONFIG_PM */ | 3986 | #endif /* CONFIG_PM_SLEEP */ |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 0eb7245dd362..f0b4efdb483c 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -362,7 +362,7 @@ struct via82xx { | |||
362 | 362 | ||
363 | unsigned char old_legacy; | 363 | unsigned char old_legacy; |
364 | unsigned char old_legacy_cfg; | 364 | unsigned char old_legacy_cfg; |
365 | #ifdef CONFIG_PM | 365 | #ifdef CONFIG_PM_SLEEP |
366 | unsigned char legacy_saved; | 366 | unsigned char legacy_saved; |
367 | unsigned char legacy_cfg_saved; | 367 | unsigned char legacy_cfg_saved; |
368 | unsigned char spdif_ctrl_saved; | 368 | unsigned char spdif_ctrl_saved; |
@@ -1440,6 +1440,7 @@ static void init_viadev(struct via82xx *chip, int idx, unsigned int reg_offset, | |||
1440 | static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | 1440 | static int __devinit snd_via8233_pcm_new(struct via82xx *chip) |
1441 | { | 1441 | { |
1442 | struct snd_pcm *pcm; | 1442 | struct snd_pcm *pcm; |
1443 | struct snd_pcm_chmap *chmap; | ||
1443 | int i, err; | 1444 | int i, err; |
1444 | 1445 | ||
1445 | chip->playback_devno = 0; /* x 4 */ | 1446 | chip->playback_devno = 0; /* x 4 */ |
@@ -1467,6 +1468,12 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1467 | snd_dma_pci_data(chip->pci), | 1468 | snd_dma_pci_data(chip->pci), |
1468 | 64*1024, VIA_MAX_BUFSIZE); | 1469 | 64*1024, VIA_MAX_BUFSIZE); |
1469 | 1470 | ||
1471 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1472 | snd_pcm_std_chmaps, 2, 0, | ||
1473 | &chmap); | ||
1474 | if (err < 0) | ||
1475 | return err; | ||
1476 | |||
1470 | /* PCM #1: multi-channel playback and 2nd capture */ | 1477 | /* PCM #1: multi-channel playback and 2nd capture */ |
1471 | err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm); | 1478 | err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm); |
1472 | if (err < 0) | 1479 | if (err < 0) |
@@ -1484,6 +1491,14 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1484 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1491 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1485 | snd_dma_pci_data(chip->pci), | 1492 | snd_dma_pci_data(chip->pci), |
1486 | 64*1024, VIA_MAX_BUFSIZE); | 1493 | 64*1024, VIA_MAX_BUFSIZE); |
1494 | |||
1495 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1496 | snd_pcm_alt_chmaps, 6, 0, | ||
1497 | &chmap); | ||
1498 | if (err < 0) | ||
1499 | return err; | ||
1500 | chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; | ||
1501 | |||
1487 | return 0; | 1502 | return 0; |
1488 | } | 1503 | } |
1489 | 1504 | ||
@@ -1493,6 +1508,7 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1493 | static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) | 1508 | static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) |
1494 | { | 1509 | { |
1495 | struct snd_pcm *pcm; | 1510 | struct snd_pcm *pcm; |
1511 | struct snd_pcm_chmap *chmap; | ||
1496 | int err; | 1512 | int err; |
1497 | 1513 | ||
1498 | chip->multi_devno = 0; | 1514 | chip->multi_devno = 0; |
@@ -1519,6 +1535,13 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) | |||
1519 | snd_dma_pci_data(chip->pci), | 1535 | snd_dma_pci_data(chip->pci), |
1520 | 64*1024, VIA_MAX_BUFSIZE); | 1536 | 64*1024, VIA_MAX_BUFSIZE); |
1521 | 1537 | ||
1538 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1539 | snd_pcm_alt_chmaps, 6, 0, | ||
1540 | &chmap); | ||
1541 | if (err < 0) | ||
1542 | return err; | ||
1543 | chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; | ||
1544 | |||
1522 | /* SPDIF supported? */ | 1545 | /* SPDIF supported? */ |
1523 | if (! ac97_can_spdif(chip->ac97)) | 1546 | if (! ac97_can_spdif(chip->ac97)) |
1524 | return 0; | 1547 | return 0; |
@@ -2038,7 +2061,7 @@ static int __devinit snd_via686_init_misc(struct via82xx *chip) | |||
2038 | if (mpu_port >= 0x200) { /* force MIDI */ | 2061 | if (mpu_port >= 0x200) { /* force MIDI */ |
2039 | mpu_port &= 0xfffc; | 2062 | mpu_port &= 0xfffc; |
2040 | pci_write_config_dword(chip->pci, 0x18, mpu_port | 0x01); | 2063 | pci_write_config_dword(chip->pci, 0x18, mpu_port | 0x01); |
2041 | #ifdef CONFIG_PM | 2064 | #ifdef CONFIG_PM_SLEEP |
2042 | chip->mpu_port_saved = mpu_port; | 2065 | chip->mpu_port_saved = mpu_port; |
2043 | #endif | 2066 | #endif |
2044 | } else { | 2067 | } else { |
@@ -2090,7 +2113,7 @@ static int __devinit snd_via686_init_misc(struct via82xx *chip) | |||
2090 | 2113 | ||
2091 | snd_via686_create_gameport(chip, &legacy); | 2114 | snd_via686_create_gameport(chip, &legacy); |
2092 | 2115 | ||
2093 | #ifdef CONFIG_PM | 2116 | #ifdef CONFIG_PM_SLEEP |
2094 | chip->legacy_saved = legacy; | 2117 | chip->legacy_saved = legacy; |
2095 | chip->legacy_cfg_saved = legacy_cfg; | 2118 | chip->legacy_cfg_saved = legacy_cfg; |
2096 | #endif | 2119 | #endif |
@@ -2238,7 +2261,7 @@ static int snd_via82xx_chip_init(struct via82xx *chip) | |||
2238 | return 0; | 2261 | return 0; |
2239 | } | 2262 | } |
2240 | 2263 | ||
2241 | #ifdef CONFIG_PM | 2264 | #ifdef CONFIG_PM_SLEEP |
2242 | /* | 2265 | /* |
2243 | * power management | 2266 | * power management |
2244 | */ | 2267 | */ |
@@ -2313,7 +2336,7 @@ static SIMPLE_DEV_PM_OPS(snd_via82xx_pm, snd_via82xx_suspend, snd_via82xx_resume | |||
2313 | #define SND_VIA82XX_PM_OPS &snd_via82xx_pm | 2336 | #define SND_VIA82XX_PM_OPS &snd_via82xx_pm |
2314 | #else | 2337 | #else |
2315 | #define SND_VIA82XX_PM_OPS NULL | 2338 | #define SND_VIA82XX_PM_OPS NULL |
2316 | #endif /* CONFIG_PM */ | 2339 | #endif /* CONFIG_PM_SLEEP */ |
2317 | 2340 | ||
2318 | static int snd_via82xx_free(struct via82xx *chip) | 2341 | static int snd_via82xx_free(struct via82xx *chip) |
2319 | { | 2342 | { |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index e886bc16999d..8e0efc416f22 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -1019,7 +1019,7 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip) | |||
1019 | return 0; | 1019 | return 0; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | #ifdef CONFIG_PM | 1022 | #ifdef CONFIG_PM_SLEEP |
1023 | /* | 1023 | /* |
1024 | * power management | 1024 | * power management |
1025 | */ | 1025 | */ |
@@ -1076,7 +1076,7 @@ static SIMPLE_DEV_PM_OPS(snd_via82xx_pm, snd_via82xx_suspend, snd_via82xx_resume | |||
1076 | #define SND_VIA82XX_PM_OPS &snd_via82xx_pm | 1076 | #define SND_VIA82XX_PM_OPS &snd_via82xx_pm |
1077 | #else | 1077 | #else |
1078 | #define SND_VIA82XX_PM_OPS NULL | 1078 | #define SND_VIA82XX_PM_OPS NULL |
1079 | #endif /* CONFIG_PM */ | 1079 | #endif /* CONFIG_PM_SLEEP */ |
1080 | 1080 | ||
1081 | static int snd_via82xx_free(struct via82xx_modem *chip) | 1081 | static int snd_via82xx_free(struct via82xx_modem *chip) |
1082 | { | 1082 | { |
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index b89e7a86e9d8..fdfbaf857233 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c | |||
@@ -257,7 +257,7 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci) | |||
257 | pci_set_drvdata(pci, NULL); | 257 | pci_set_drvdata(pci, NULL); |
258 | } | 258 | } |
259 | 259 | ||
260 | #ifdef CONFIG_PM | 260 | #ifdef CONFIG_PM_SLEEP |
261 | static int snd_vx222_suspend(struct device *dev) | 261 | static int snd_vx222_suspend(struct device *dev) |
262 | { | 262 | { |
263 | struct pci_dev *pci = to_pci_dev(dev); | 263 | struct pci_dev *pci = to_pci_dev(dev); |
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 4810356b97ba..e01fe34db9ec 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -355,7 +355,7 @@ static struct pci_driver ymfpci_driver = { | |||
355 | .id_table = snd_ymfpci_ids, | 355 | .id_table = snd_ymfpci_ids, |
356 | .probe = snd_card_ymfpci_probe, | 356 | .probe = snd_card_ymfpci_probe, |
357 | .remove = __devexit_p(snd_card_ymfpci_remove), | 357 | .remove = __devexit_p(snd_card_ymfpci_remove), |
358 | #ifdef CONFIG_PM | 358 | #ifdef CONFIG_PM_SLEEP |
359 | .driver = { | 359 | .driver = { |
360 | .pm = &snd_ymfpci_pm, | 360 | .pm = &snd_ymfpci_pm, |
361 | }, | 361 | }, |
diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index bddc4052286b..4631a2348915 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h | |||
@@ -363,7 +363,7 @@ struct snd_ymfpci { | |||
363 | const struct firmware *dsp_microcode; | 363 | const struct firmware *dsp_microcode; |
364 | const struct firmware *controller_microcode; | 364 | const struct firmware *controller_microcode; |
365 | 365 | ||
366 | #ifdef CONFIG_PM | 366 | #ifdef CONFIG_PM_SLEEP |
367 | u32 *saved_regs; | 367 | u32 *saved_regs; |
368 | u32 saved_ydsxgr_mode; | 368 | u32 saved_ydsxgr_mode; |
369 | u16 saved_dsxg_legacy; | 369 | u16 saved_dsxg_legacy; |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 62b23635b754..3a6f03f9b02f 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -1166,6 +1166,11 @@ int __devinit snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm | |||
1166 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1166 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1167 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1167 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1168 | 1168 | ||
1169 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1170 | snd_pcm_std_chmaps, 2, 0, NULL); | ||
1171 | if (err < 0) | ||
1172 | return err; | ||
1173 | |||
1169 | if (rpcm) | 1174 | if (rpcm) |
1170 | *rpcm = pcm; | 1175 | *rpcm = pcm; |
1171 | return 0; | 1176 | return 0; |
@@ -1257,6 +1262,14 @@ static struct snd_pcm_ops snd_ymfpci_playback_4ch_ops = { | |||
1257 | .pointer = snd_ymfpci_playback_pointer, | 1262 | .pointer = snd_ymfpci_playback_pointer, |
1258 | }; | 1263 | }; |
1259 | 1264 | ||
1265 | static const struct snd_pcm_chmap_elem surround_map[] = { | ||
1266 | { .channels = 1, | ||
1267 | .map = { SNDRV_CHMAP_MONO } }, | ||
1268 | { .channels = 2, | ||
1269 | .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, | ||
1270 | { } | ||
1271 | }; | ||
1272 | |||
1260 | int __devinit snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm) | 1273 | int __devinit snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm) |
1261 | { | 1274 | { |
1262 | struct snd_pcm *pcm; | 1275 | struct snd_pcm *pcm; |
@@ -1278,6 +1291,11 @@ int __devinit snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd | |||
1278 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1291 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1279 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1292 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1280 | 1293 | ||
1294 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1295 | surround_map, 2, 0, NULL); | ||
1296 | if (err < 0) | ||
1297 | return err; | ||
1298 | |||
1281 | if (rpcm) | 1299 | if (rpcm) |
1282 | *rpcm = pcm; | 1300 | *rpcm = pcm; |
1283 | return 0; | 1301 | return 0; |
@@ -2242,7 +2260,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip) | |||
2242 | pci_set_power_state(chip->pci, 3); | 2260 | pci_set_power_state(chip->pci, 3); |
2243 | #endif | 2261 | #endif |
2244 | 2262 | ||
2245 | #ifdef CONFIG_PM | 2263 | #ifdef CONFIG_PM_SLEEP |
2246 | vfree(chip->saved_regs); | 2264 | vfree(chip->saved_regs); |
2247 | #endif | 2265 | #endif |
2248 | if (chip->irq >= 0) | 2266 | if (chip->irq >= 0) |
@@ -2272,7 +2290,7 @@ static int snd_ymfpci_dev_free(struct snd_device *device) | |||
2272 | return snd_ymfpci_free(chip); | 2290 | return snd_ymfpci_free(chip); |
2273 | } | 2291 | } |
2274 | 2292 | ||
2275 | #ifdef CONFIG_PM | 2293 | #ifdef CONFIG_PM_SLEEP |
2276 | static int saved_regs_index[] = { | 2294 | static int saved_regs_index[] = { |
2277 | /* spdif */ | 2295 | /* spdif */ |
2278 | YDSXGR_SPDIFOUTCTRL, | 2296 | YDSXGR_SPDIFOUTCTRL, |
@@ -2374,7 +2392,7 @@ static int snd_ymfpci_resume(struct device *dev) | |||
2374 | } | 2392 | } |
2375 | 2393 | ||
2376 | SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); | 2394 | SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); |
2377 | #endif /* CONFIG_PM */ | 2395 | #endif /* CONFIG_PM_SLEEP */ |
2378 | 2396 | ||
2379 | int __devinit snd_ymfpci_create(struct snd_card *card, | 2397 | int __devinit snd_ymfpci_create(struct snd_card *card, |
2380 | struct pci_dev * pci, | 2398 | struct pci_dev * pci, |
@@ -2452,7 +2470,7 @@ int __devinit snd_ymfpci_create(struct snd_card *card, | |||
2452 | return err; | 2470 | return err; |
2453 | } | 2471 | } |
2454 | 2472 | ||
2455 | #ifdef CONFIG_PM | 2473 | #ifdef CONFIG_PM_SLEEP |
2456 | chip->saved_regs = vmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32)); | 2474 | chip->saved_regs = vmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32)); |
2457 | if (chip->saved_regs == NULL) { | 2475 | if (chip->saved_regs == NULL) { |
2458 | snd_ymfpci_free(chip); | 2476 | snd_ymfpci_free(chip); |