diff options
Diffstat (limited to 'drivers/pnp/quirks.c')
-rw-r--r-- | drivers/pnp/quirks.c | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 7c3236690cc3..8e7d7738f296 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include "base.h" | 20 | #include "base.h" |
21 | 21 | ||
22 | |||
23 | static void quirk_awe32_resources(struct pnp_dev *dev) | 22 | static void quirk_awe32_resources(struct pnp_dev *dev) |
24 | { | 23 | { |
25 | struct pnp_port *port, *port2, *port3; | 24 | struct pnp_port *port, *port2, *port3; |
@@ -31,7 +30,7 @@ static void quirk_awe32_resources(struct pnp_dev *dev) | |||
31 | * two extra ports (at offset 0x400 and 0x800 from the one given) by | 30 | * two extra ports (at offset 0x400 and 0x800 from the one given) by |
32 | * hand. | 31 | * hand. |
33 | */ | 32 | */ |
34 | for ( ; res ; res = res->next ) { | 33 | for (; res; res = res->next) { |
35 | port2 = pnp_alloc(sizeof(struct pnp_port)); | 34 | port2 = pnp_alloc(sizeof(struct pnp_port)); |
36 | if (!port2) | 35 | if (!port2) |
37 | return; | 36 | return; |
@@ -58,18 +57,19 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev) | |||
58 | struct pnp_option *res = dev->dependent; | 57 | struct pnp_option *res = dev->dependent; |
59 | unsigned long tmp; | 58 | unsigned long tmp; |
60 | 59 | ||
61 | for ( ; res ; res = res->next ) { | 60 | for (; res; res = res->next) { |
62 | 61 | ||
63 | struct pnp_irq *irq; | 62 | struct pnp_irq *irq; |
64 | struct pnp_dma *dma; | 63 | struct pnp_dma *dma; |
65 | 64 | ||
66 | for( irq = res->irq; irq; irq = irq->next ) { // Valid irqs are 5, 7, 10 | 65 | for (irq = res->irq; irq; irq = irq->next) { // Valid irqs are 5, 7, 10 |
67 | tmp = 0x04A0; | 66 | tmp = 0x04A0; |
68 | bitmap_copy(irq->map, &tmp, 16); // 0000 0100 1010 0000 | 67 | bitmap_copy(irq->map, &tmp, 16); // 0000 0100 1010 0000 |
69 | } | 68 | } |
70 | 69 | ||
71 | for( dma = res->dma; dma; dma = dma->next ) // Valid 8bit dma channels are 1,3 | 70 | for (dma = res->dma; dma; dma = dma->next) // Valid 8bit dma channels are 1,3 |
72 | if( ( dma->flags & IORESOURCE_DMA_TYPE_MASK ) == IORESOURCE_DMA_8BIT ) | 71 | if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) == |
72 | IORESOURCE_DMA_8BIT) | ||
73 | dma->map = 0x000A; | 73 | dma->map = 0x000A; |
74 | } | 74 | } |
75 | printk(KERN_INFO "pnp: CMI8330 quirk - fixing interrupts and dma\n"); | 75 | printk(KERN_INFO "pnp: CMI8330 quirk - fixing interrupts and dma\n"); |
@@ -79,7 +79,7 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev) | |||
79 | { | 79 | { |
80 | struct pnp_port *port; | 80 | struct pnp_port *port; |
81 | struct pnp_option *res = dev->dependent; | 81 | struct pnp_option *res = dev->dependent; |
82 | int changed = 0; | 82 | int changed = 0; |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * The default range on the mpu port for these devices is 0x388-0x388. | 85 | * The default range on the mpu port for these devices is 0x388-0x388. |
@@ -87,23 +87,24 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev) | |||
87 | * auto-configured. | 87 | * auto-configured. |
88 | */ | 88 | */ |
89 | 89 | ||
90 | for( ; res ; res = res->next ) { | 90 | for (; res; res = res->next) { |
91 | port = res->port; | 91 | port = res->port; |
92 | if(!port) | 92 | if (!port) |
93 | continue; | 93 | continue; |
94 | port = port->next; | 94 | port = port->next; |
95 | if(!port) | 95 | if (!port) |
96 | continue; | 96 | continue; |
97 | port = port->next; | 97 | port = port->next; |
98 | if(!port) | 98 | if (!port) |
99 | continue; | 99 | continue; |
100 | if(port->min != port->max) | 100 | if (port->min != port->max) |
101 | continue; | 101 | continue; |
102 | port->max += 0x70; | 102 | port->max += 0x70; |
103 | changed = 1; | 103 | changed = 1; |
104 | } | 104 | } |
105 | if(changed) | 105 | if (changed) |
106 | printk(KERN_INFO "pnp: SB audio device quirk - increasing port range\n"); | 106 | printk(KERN_INFO |
107 | "pnp: SB audio device quirk - increasing port range\n"); | ||
107 | return; | 108 | return; |
108 | } | 109 | } |
109 | 110 | ||
@@ -124,7 +125,7 @@ static int quirk_smc_fir_enabled(struct pnp_dev *dev) | |||
124 | outb(bank, firbase + 7); | 125 | outb(bank, firbase + 7); |
125 | 126 | ||
126 | high = inb(firbase + 0); | 127 | high = inb(firbase + 0); |
127 | low = inb(firbase + 1); | 128 | low = inb(firbase + 1); |
128 | chip = inb(firbase + 2); | 129 | chip = inb(firbase + 2); |
129 | 130 | ||
130 | /* This corresponds to the check in smsc_ircc_present() */ | 131 | /* This corresponds to the check in smsc_ircc_present() */ |
@@ -153,8 +154,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) | |||
153 | */ | 154 | */ |
154 | dev_err(&dev->dev, "%s not responding at SIR 0x%lx, FIR 0x%lx; " | 155 | dev_err(&dev->dev, "%s not responding at SIR 0x%lx, FIR 0x%lx; " |
155 | "auto-configuring\n", dev->id->id, | 156 | "auto-configuring\n", dev->id->id, |
156 | (unsigned long) pnp_port_start(dev, 0), | 157 | (unsigned long)pnp_port_start(dev, 0), |
157 | (unsigned long) pnp_port_start(dev, 1)); | 158 | (unsigned long)pnp_port_start(dev, 1)); |
158 | 159 | ||
159 | pnp_disable_dev(dev); | 160 | pnp_disable_dev(dev); |
160 | pnp_init_resource_table(&dev->res); | 161 | pnp_init_resource_table(&dev->res); |
@@ -162,8 +163,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) | |||
162 | pnp_activate_dev(dev); | 163 | pnp_activate_dev(dev); |
163 | if (quirk_smc_fir_enabled(dev)) { | 164 | if (quirk_smc_fir_enabled(dev)) { |
164 | dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n", | 165 | dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n", |
165 | (unsigned long) pnp_port_start(dev, 0), | 166 | (unsigned long)pnp_port_start(dev, 0), |
166 | (unsigned long) pnp_port_start(dev, 1)); | 167 | (unsigned long)pnp_port_start(dev, 1)); |
167 | return; | 168 | return; |
168 | } | 169 | } |
169 | 170 | ||
@@ -175,8 +176,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) | |||
175 | */ | 176 | */ |
176 | dev_err(&dev->dev, "not responding at SIR 0x%lx, FIR 0x%lx; " | 177 | dev_err(&dev->dev, "not responding at SIR 0x%lx, FIR 0x%lx; " |
177 | "swapping SIR/FIR and reconfiguring\n", | 178 | "swapping SIR/FIR and reconfiguring\n", |
178 | (unsigned long) pnp_port_start(dev, 0), | 179 | (unsigned long)pnp_port_start(dev, 0), |
179 | (unsigned long) pnp_port_start(dev, 1)); | 180 | (unsigned long)pnp_port_start(dev, 1)); |
180 | 181 | ||
181 | /* | 182 | /* |
182 | * Clear IORESOURCE_AUTO so pnp_activate_dev() doesn't reassign | 183 | * Clear IORESOURCE_AUTO so pnp_activate_dev() doesn't reassign |
@@ -200,8 +201,8 @@ static void quirk_smc_enable(struct pnp_dev *dev) | |||
200 | 201 | ||
201 | if (quirk_smc_fir_enabled(dev)) { | 202 | if (quirk_smc_fir_enabled(dev)) { |
202 | dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n", | 203 | dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n", |
203 | (unsigned long) pnp_port_start(dev, 0), | 204 | (unsigned long)pnp_port_start(dev, 0), |
204 | (unsigned long) pnp_port_start(dev, 1)); | 205 | (unsigned long)pnp_port_start(dev, 1)); |
205 | return; | 206 | return; |
206 | } | 207 | } |
207 | 208 | ||
@@ -209,7 +210,6 @@ static void quirk_smc_enable(struct pnp_dev *dev) | |||
209 | "email bjorn.helgaas@hp.com\n"); | 210 | "email bjorn.helgaas@hp.com\n"); |
210 | } | 211 | } |
211 | 212 | ||
212 | |||
213 | /* | 213 | /* |
214 | * PnP Quirks | 214 | * PnP Quirks |
215 | * Cards or devices that need some tweaking due to incomplete resource info | 215 | * Cards or devices that need some tweaking due to incomplete resource info |
@@ -217,21 +217,21 @@ static void quirk_smc_enable(struct pnp_dev *dev) | |||
217 | 217 | ||
218 | static struct pnp_fixup pnp_fixups[] = { | 218 | static struct pnp_fixup pnp_fixups[] = { |
219 | /* Soundblaster awe io port quirk */ | 219 | /* Soundblaster awe io port quirk */ |
220 | { "CTL0021", quirk_awe32_resources }, | 220 | {"CTL0021", quirk_awe32_resources}, |
221 | { "CTL0022", quirk_awe32_resources }, | 221 | {"CTL0022", quirk_awe32_resources}, |
222 | { "CTL0023", quirk_awe32_resources }, | 222 | {"CTL0023", quirk_awe32_resources}, |
223 | /* CMI 8330 interrupt and dma fix */ | 223 | /* CMI 8330 interrupt and dma fix */ |
224 | { "@X@0001", quirk_cmi8330_resources }, | 224 | {"@X@0001", quirk_cmi8330_resources}, |
225 | /* Soundblaster audio device io port range quirk */ | 225 | /* Soundblaster audio device io port range quirk */ |
226 | { "CTL0001", quirk_sb16audio_resources }, | 226 | {"CTL0001", quirk_sb16audio_resources}, |
227 | { "CTL0031", quirk_sb16audio_resources }, | 227 | {"CTL0031", quirk_sb16audio_resources}, |
228 | { "CTL0041", quirk_sb16audio_resources }, | 228 | {"CTL0041", quirk_sb16audio_resources}, |
229 | { "CTL0042", quirk_sb16audio_resources }, | 229 | {"CTL0042", quirk_sb16audio_resources}, |
230 | { "CTL0043", quirk_sb16audio_resources }, | 230 | {"CTL0043", quirk_sb16audio_resources}, |
231 | { "CTL0044", quirk_sb16audio_resources }, | 231 | {"CTL0044", quirk_sb16audio_resources}, |
232 | { "CTL0045", quirk_sb16audio_resources }, | 232 | {"CTL0045", quirk_sb16audio_resources}, |
233 | { "SMCf010", quirk_smc_enable }, | 233 | {"SMCf010", quirk_smc_enable}, |
234 | { "" } | 234 | {""} |
235 | }; | 235 | }; |
236 | 236 | ||
237 | void pnp_fixup_device(struct pnp_dev *dev) | 237 | void pnp_fixup_device(struct pnp_dev *dev) |
@@ -239,9 +239,8 @@ void pnp_fixup_device(struct pnp_dev *dev) | |||
239 | int i = 0; | 239 | int i = 0; |
240 | 240 | ||
241 | while (*pnp_fixups[i].id) { | 241 | while (*pnp_fixups[i].id) { |
242 | if (compare_pnp_id(dev->id,pnp_fixups[i].id)) { | 242 | if (compare_pnp_id(dev->id, pnp_fixups[i].id)) { |
243 | pnp_dbg("Calling quirk for %s", | 243 | pnp_dbg("Calling quirk for %s", dev->dev.bus_id); |
244 | dev->dev.bus_id); | ||
245 | pnp_fixups[i].quirk_function(dev); | 244 | pnp_fixups[i].quirk_function(dev); |
246 | } | 245 | } |
247 | i++; | 246 | i++; |