aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-12-14 03:27:04 -0500
committerTakashi Iwai <tiwai@suse.de>2011-12-14 03:27:04 -0500
commita1585d769731323a792277f15b7a3ee2ae36b698 (patch)
treed330aa7c8ba6d8eaa4754fdf212bbb0ee05fc1dc /sound/pci/hda/hda_intel.c
parent1815b34a626742733f846ddd266a89bd2fcea28f (diff)
ALSA: hda - Check non-snoop in a single place
Merge the checks for VIA and ATI-HDMI into a single place for better code-flow management. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9f7c901a52e3..8d17963ac021 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1153,16 +1153,6 @@ static void update_pci_byte(struct pci_dev *pci, unsigned int reg,
1153 1153
1154static void azx_init_pci(struct azx *chip) 1154static void azx_init_pci(struct azx *chip)
1155{ 1155{
1156 /* force to non-snoop mode for a new VIA controller when BIOS is set */
1157 if (chip->snoop && chip->driver_type == AZX_DRIVER_VIA) {
1158 u8 snoop;
1159 pci_read_config_byte(chip->pci, 0x42, &snoop);
1160 if (!(snoop & 0x80) && chip->pci->revision == 0x30) {
1161 chip->snoop = 0;
1162 snd_printdd(SFX "Force to non-snoop mode\n");
1163 }
1164 }
1165
1166 /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) 1156 /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
1167 * TCSEL == Traffic Class Select Register, which sets PCI express QOS 1157 * TCSEL == Traffic Class Select Register, which sets PCI express QOS
1168 * Ensuring these bits are 0 clears playback static on some HD Audio 1158 * Ensuring these bits are 0 clears playback static on some HD Audio
@@ -2634,6 +2624,35 @@ static void __devinit check_msi(struct azx *chip)
2634 } 2624 }
2635} 2625}
2636 2626
2627/* check the snoop mode availability */
2628static void __devinit azx_check_snoop_available(struct azx *chip)
2629{
2630 bool snoop = chip->snoop;
2631
2632 switch (chip->driver_type) {
2633 case AZX_DRIVER_VIA:
2634 /* force to non-snoop mode for a new VIA controller
2635 * when BIOS is set
2636 */
2637 if (snoop) {
2638 u8 val;
2639 pci_read_config_byte(chip->pci, 0x42, &val);
2640 if (!(val & 0x80) && chip->pci->revision == 0x30)
2641 snoop = false;
2642 }
2643 break;
2644 case AZX_DRIVER_ATIHDMI_NS:
2645 /* new ATI HDMI requires non-snoop */
2646 snoop = false;
2647 break;
2648 }
2649
2650 if (snoop != chip->snoop) {
2651 snd_printk(KERN_INFO SFX "Force to %s mode\n",
2652 snoop ? "snoop" : "non-snoop");
2653 chip->snoop = snoop;
2654 }
2655}
2637 2656
2638/* 2657/*
2639 * constructor 2658 * constructor
@@ -2680,8 +2699,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2680 2699
2681 chip->single_cmd = single_cmd; 2700 chip->single_cmd = single_cmd;
2682 chip->snoop = hda_snoop; 2701 chip->snoop = hda_snoop;
2683 if (chip->driver_type == AZX_DRIVER_ATIHDMI_NS) 2702 azx_check_snoop_available(chip);
2684 chip->snoop = 0;
2685 2703
2686 if (bdl_pos_adj[dev] < 0) { 2704 if (bdl_pos_adj[dev] < 0) {
2687 switch (chip->driver_type) { 2705 switch (chip->driver_type) {