Commit c39393c4 authored by Jeff Garzik's avatar Jeff Garzik

[sound/oss i810] pci id cleanups

The driver defined its own PCI id constants.  Kill the majority,
which were redundant, and move the rest to include/linux/pci_ids.h.

Also, move open-coded tests for "new ICH" audio chips to a single
helper function.  These tests were being patched with each new
ICH motherboard from Intel, resulting in each new PCI id being added
to several places in the driver.

Note that, even though this should be a harmless patch, there
exists the remote possibility that I mis-matched some of the
PCI ids, as I only tested ICH5.
parent 2eb43bc4
...@@ -481,6 +481,7 @@ ...@@ -481,6 +481,7 @@
# define PCI_DEVICE_ID_AMD_VIPER_7441 PCI_DEVICE_ID_AMD_OPUS_7441 # define PCI_DEVICE_ID_AMD_VIPER_7441 PCI_DEVICE_ID_AMD_OPUS_7441
#define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443 #define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443
# define PCI_DEVICE_ID_AMD_VIPER_7443 PCI_DEVICE_ID_AMD_OPUS_7443 # define PCI_DEVICE_ID_AMD_VIPER_7443 PCI_DEVICE_ID_AMD_OPUS_7443
#define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445
#define PCI_DEVICE_ID_AMD_OPUS_7448 0x7448 #define PCI_DEVICE_ID_AMD_OPUS_7448 0x7448
# define PCI_DEVICE_ID_AMD_VIPER_7448 PCI_DEVICE_ID_AMD_OPUS_7448 # define PCI_DEVICE_ID_AMD_VIPER_7448 PCI_DEVICE_ID_AMD_OPUS_7448
#define PCI_DEVICE_ID_AMD_OPUS_7449 0x7449 #define PCI_DEVICE_ID_AMD_OPUS_7449 0x7449
...@@ -637,6 +638,7 @@ ...@@ -637,6 +638,7 @@
#define PCI_DEVICE_ID_SI_6306 0x6306 #define PCI_DEVICE_ID_SI_6306 0x6306
#define PCI_DEVICE_ID_SI_6326 0x6326 #define PCI_DEVICE_ID_SI_6326 0x6326
#define PCI_DEVICE_ID_SI_7001 0x7001 #define PCI_DEVICE_ID_SI_7001 0x7001
#define PCI_DEVICE_ID_SI_7012 0x7012
#define PCI_DEVICE_ID_SI_7016 0x7016 #define PCI_DEVICE_ID_SI_7016 0x7016
#define PCI_VENDOR_ID_HP 0x103c #define PCI_VENDOR_ID_HP 0x103c
...@@ -1056,10 +1058,12 @@ ...@@ -1056,10 +1058,12 @@
#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085
#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e
#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 #define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0
#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1 #define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1
#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1
#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5 #define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5
#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3
...@@ -1089,6 +1093,7 @@ ...@@ -1089,6 +1093,7 @@
#define PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL 0x017C #define PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL 0x017C
#define PCI_DEVICE_ID_NVIDIA_IGEFORCE2 0x01a0 #define PCI_DEVICE_ID_NVIDIA_IGEFORCE2 0x01a0
#define PCI_DEVICE_ID_NVIDIA_NFORCE 0x01a4 #define PCI_DEVICE_ID_NVIDIA_NFORCE 0x01a4
#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1
#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc #define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc
#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0 #define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0
#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200 #define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200
...@@ -2129,6 +2134,7 @@ ...@@ -2129,6 +2134,7 @@
#define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190 #define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190
#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191 #define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191
#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 #define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192
#define PCI_DEVICE_ID_INTEL_440MX 0x7195
#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198 #define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198
#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199 #define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199
#define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a #define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a
......
...@@ -103,53 +103,7 @@ ...@@ -103,53 +103,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/hardirq.h> #include <asm/hardirq.h>
#define DRIVER_VERSION "1.00" #define DRIVER_VERSION "1.01"
#ifndef PCI_DEVICE_ID_INTEL_82801
#define PCI_DEVICE_ID_INTEL_82801 0x2415
#endif
#ifndef PCI_DEVICE_ID_INTEL_82901
#define PCI_DEVICE_ID_INTEL_82901 0x2425
#endif
#ifndef PCI_DEVICE_ID_INTEL_ICH2
#define PCI_DEVICE_ID_INTEL_ICH2 0x2445
#endif
#ifndef PCI_DEVICE_ID_INTEL_ICH3
#define PCI_DEVICE_ID_INTEL_ICH3 0x2485
#endif
#ifndef PCI_DEVICE_ID_INTEL_ICH4
#define PCI_DEVICE_ID_INTEL_ICH4 0x24c5
#endif
#ifndef PCI_DEVICE_ID_INTEL_ICH5
#define PCI_DEVICE_ID_INTEL_ICH5 0x24d5
#endif
#ifndef PCI_DEVICE_ID_INTEL_ICH6_18
#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e
#endif
#ifndef PCI_DEVICE_ID_INTEL_440MX
#define PCI_DEVICE_ID_INTEL_440MX 0x7195
#endif
#ifndef PCI_DEVICE_ID_INTEL_ESB_5
#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6
#endif
#ifndef PCI_DEVICE_ID_SI_7012
#define PCI_DEVICE_ID_SI_7012 0x7012
#endif
#ifndef PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO
#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1
#endif
#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO
#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
#endif
#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO
#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
#endif
#ifndef PCI_DEVICE_ID_AMD_768_AUDIO
#define PCI_DEVICE_ID_AMD_768_AUDIO 0x7445
#endif
#ifndef PCI_DEVICE_ID_AMD_8111_AC97
#define PCI_DEVICE_ID_AMD_8111_AC97 0x746d
#endif
#define MODULOP2(a, b) ((a) & ((b) - 1)) #define MODULOP2(a, b) ((a) & ((b) - 1))
#define MASKP2(a, b) ((a) & ~((b) - 1)) #define MASKP2(a, b) ((a) & ~((b) - 1))
...@@ -328,19 +282,19 @@ static struct { ...@@ -328,19 +282,19 @@ static struct {
}; };
static struct pci_device_id i810_pci_tbl [] = { static struct pci_device_id i810_pci_tbl [] = {
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_5,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, ICH82801AA}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ICH82801AA},
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82901, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_5,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, ICH82901AB}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ICH82901AB},
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_440MX, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_440MX,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTEL440MX}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTEL440MX},
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH2, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_4,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH2}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH2},
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH3, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_5,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH3}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH3},
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH4, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_5,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4},
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH5, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_5,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH5}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH5},
{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7012, {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7012,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, SI7012}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SI7012},
...@@ -350,9 +304,9 @@ static struct pci_device_id i810_pci_tbl [] = { ...@@ -350,9 +304,9 @@ static struct pci_device_id i810_pci_tbl [] = {
PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE},
{PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE},
{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_768_AUDIO, {PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_OPUS_7445,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD768}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD768},
{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_AC97, {PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_AUDIO,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111},
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_5, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_5,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4},
...@@ -1956,8 +1910,8 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -1956,8 +1910,8 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
} }
/* ICH and ICH0 only support 2 channels */ /* ICH and ICH0 only support 2 channels */
if ( state->card->pci_id == PCI_DEVICE_ID_INTEL_82801 if ( state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AA_5
|| state->card->pci_id == PCI_DEVICE_ID_INTEL_82901) || state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AB_5)
return put_user(2, (int *)arg); return put_user(2, (int *)arg);
/* Multi-channel support was added with ICH2. Bits in */ /* Multi-channel support was added with ICH2. Bits in */
...@@ -2772,6 +2726,26 @@ static int i810_ac97_probe_and_powerup(struct i810_card *card,struct ac97_codec ...@@ -2772,6 +2726,26 @@ static int i810_ac97_probe_and_powerup(struct i810_card *card,struct ac97_codec
return i; return i;
} }
static int is_new_ich(u16 pci_id)
{
switch (pci_id) {
case PCI_DEVICE_ID_INTEL_82801DB_5:
case PCI_DEVICE_ID_INTEL_82801EB_5:
case PCI_DEVICE_ID_INTEL_ESB_5:
case PCI_DEVICE_ID_INTEL_ICH6_18:
return 1;
default:
break;
}
return 0;
}
static inline int ich_use_mmio(struct i810_card *card)
{
return is_new_ich(card->pci_id) && card->use_mmio;
}
/** /**
* i810_ac97_power_up_bus - bring up AC97 link * i810_ac97_power_up_bus - bring up AC97 link
* @card : ICH audio device to power up * @card : ICH audio device to power up
...@@ -2821,9 +2795,7 @@ static int i810_ac97_power_up_bus(struct i810_card *card) ...@@ -2821,9 +2795,7 @@ static int i810_ac97_power_up_bus(struct i810_card *card)
*/ */
/* see i810_ac97_init for the next 7 lines (jsaw) */ /* see i810_ac97_init for the next 7 lines (jsaw) */
inw(card->ac97base); inw(card->ac97base);
if ((card->pci_id == PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH5 || if (ich_use_mmio(card)) {
card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_18)
&& (card->use_mmio)) {
primary_codec_id = (int) readl(card->iobase_mmio + SDM) & 0x3; primary_codec_id = (int) readl(card->iobase_mmio + SDM) & 0x3;
printk(KERN_INFO "i810_audio: Primary codec has ID %d\n", printk(KERN_INFO "i810_audio: Primary codec has ID %d\n",
primary_codec_id); primary_codec_id);
...@@ -2892,9 +2864,7 @@ static int __devinit i810_ac97_init(struct i810_card *card) ...@@ -2892,9 +2864,7 @@ static int __devinit i810_ac97_init(struct i810_card *card)
possible IO channels. Bit 0:1 of SDM then holds the possible IO channels. Bit 0:1 of SDM then holds the
last codec ID spoken to. last codec ID spoken to.
*/ */
if ((card->pci_id == PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH5 || if (ich_use_mmio(card)) {
card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_18)
&& (card->use_mmio)) {
ac97_id = (int) readl(card->iobase_mmio + SDM) & 0x3; ac97_id = (int) readl(card->iobase_mmio + SDM) & 0x3;
printk(KERN_INFO "i810_audio: Connection %d with codec id %d\n", printk(KERN_INFO "i810_audio: Connection %d with codec id %d\n",
num_ac97, ac97_id); num_ac97, ac97_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment