aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_intel.c42
-rw-r--r--sound/pci/hda/patch_realtek.c4
2 files changed, 29 insertions, 17 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 6833835a218b..72b085ae7d46 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -501,6 +501,7 @@ struct azx {
501 501
502 /* VGA-switcheroo setup */ 502 /* VGA-switcheroo setup */
503 unsigned int use_vga_switcheroo:1; 503 unsigned int use_vga_switcheroo:1;
504 unsigned int vga_switcheroo_registered:1;
504 unsigned int init_failed:1; /* delayed init failed */ 505 unsigned int init_failed:1; /* delayed init failed */
505 unsigned int disabled:1; /* disabled by VGA-switcher */ 506 unsigned int disabled:1; /* disabled by VGA-switcher */
506 507
@@ -2157,9 +2158,12 @@ static unsigned int azx_get_position(struct azx *chip,
2157 if (delay < 0) 2158 if (delay < 0)
2158 delay += azx_dev->bufsize; 2159 delay += azx_dev->bufsize;
2159 if (delay >= azx_dev->period_bytes) { 2160 if (delay >= azx_dev->period_bytes) {
2160 snd_printdd("delay %d > period_bytes %d\n", 2161 snd_printk(KERN_WARNING SFX
2161 delay, azx_dev->period_bytes); 2162 "Unstable LPIB (%d >= %d); "
2162 delay = 0; /* something is wrong */ 2163 "disabling LPIB delay counting\n",
2164 delay, azx_dev->period_bytes);
2165 delay = 0;
2166 chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY;
2163 } 2167 }
2164 azx_dev->substream->runtime->delay = 2168 azx_dev->substream->runtime->delay =
2165 bytes_to_frames(azx_dev->substream->runtime, delay); 2169 bytes_to_frames(azx_dev->substream->runtime, delay);
@@ -2640,7 +2644,9 @@ static void azx_vs_set_state(struct pci_dev *pci,
2640 if (disabled) { 2644 if (disabled) {
2641 azx_suspend(&pci->dev); 2645 azx_suspend(&pci->dev);
2642 chip->disabled = true; 2646 chip->disabled = true;
2643 snd_hda_lock_devices(chip->bus); 2647 if (snd_hda_lock_devices(chip->bus))
2648 snd_printk(KERN_WARNING SFX
2649 "Cannot lock devices!\n");
2644 } else { 2650 } else {
2645 snd_hda_unlock_devices(chip->bus); 2651 snd_hda_unlock_devices(chip->bus);
2646 chip->disabled = false; 2652 chip->disabled = false;
@@ -2683,14 +2689,20 @@ static const struct vga_switcheroo_client_ops azx_vs_ops = {
2683 2689
2684static int __devinit register_vga_switcheroo(struct azx *chip) 2690static int __devinit register_vga_switcheroo(struct azx *chip)
2685{ 2691{
2692 int err;
2693
2686 if (!chip->use_vga_switcheroo) 2694 if (!chip->use_vga_switcheroo)
2687 return 0; 2695 return 0;
2688 /* FIXME: currently only handling DIS controller 2696 /* FIXME: currently only handling DIS controller
2689 * is there any machine with two switchable HDMI audio controllers? 2697 * is there any machine with two switchable HDMI audio controllers?
2690 */ 2698 */
2691 return vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, 2699 err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops,
2692 VGA_SWITCHEROO_DIS, 2700 VGA_SWITCHEROO_DIS,
2693 chip->bus != NULL); 2701 chip->bus != NULL);
2702 if (err < 0)
2703 return err;
2704 chip->vga_switcheroo_registered = 1;
2705 return 0;
2694} 2706}
2695#else 2707#else
2696#define init_vga_switcheroo(chip) /* NOP */ 2708#define init_vga_switcheroo(chip) /* NOP */
@@ -2712,7 +2724,8 @@ static int azx_free(struct azx *chip)
2712 if (use_vga_switcheroo(chip)) { 2724 if (use_vga_switcheroo(chip)) {
2713 if (chip->disabled && chip->bus) 2725 if (chip->disabled && chip->bus)
2714 snd_hda_unlock_devices(chip->bus); 2726 snd_hda_unlock_devices(chip->bus);
2715 vga_switcheroo_unregister_client(chip->pci); 2727 if (chip->vga_switcheroo_registered)
2728 vga_switcheroo_unregister_client(chip->pci);
2716 } 2729 }
2717 2730
2718 if (chip->initialized) { 2731 if (chip->initialized) {
@@ -2813,8 +2826,6 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2813 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 2826 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
2814 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2827 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
2815 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2828 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
2816 SND_PCI_QUIRK(0x1043, 0x1ac3, "ASUS X53S", POS_FIX_POSBUF),
2817 SND_PCI_QUIRK(0x1043, 0x1b43, "ASUS K53E", POS_FIX_POSBUF),
2818 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2829 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
2819 SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB), 2830 SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB),
2820 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), 2831 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
@@ -3062,14 +3073,6 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
3062 } 3073 }
3063 3074
3064 ok: 3075 ok:
3065 err = register_vga_switcheroo(chip);
3066 if (err < 0) {
3067 snd_printk(KERN_ERR SFX
3068 "Error registering VGA-switcheroo client\n");
3069 azx_free(chip);
3070 return err;
3071 }
3072
3073 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 3076 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
3074 if (err < 0) { 3077 if (err < 0) {
3075 snd_printk(KERN_ERR SFX "Error creating device [card]!\n"); 3078 snd_printk(KERN_ERR SFX "Error creating device [card]!\n");
@@ -3340,6 +3343,13 @@ static int __devinit azx_probe(struct pci_dev *pci,
3340 if (pci_dev_run_wake(pci)) 3343 if (pci_dev_run_wake(pci))
3341 pm_runtime_put_noidle(&pci->dev); 3344 pm_runtime_put_noidle(&pci->dev);
3342 3345
3346 err = register_vga_switcheroo(chip);
3347 if (err < 0) {
3348 snd_printk(KERN_ERR SFX
3349 "Error registering VGA-switcheroo client\n");
3350 goto out_free;
3351 }
3352
3343 dev++; 3353 dev++;
3344 return 0; 3354 return 0;
3345 3355
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8253b4eeb6a1..48d9d609f89b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2598,8 +2598,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
2598 return "PCM"; 2598 return "PCM";
2599 break; 2599 break;
2600 } 2600 }
2601 if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) 2601 if (ch >= ARRAY_SIZE(channel_name)) {
2602 snd_BUG();
2602 return "PCM"; 2603 return "PCM";
2604 }
2603 2605
2604 return channel_name[ch]; 2606 return channel_name[ch];
2605} 2607}