diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 15:14:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 15:14:41 -0400 |
commit | 8b29336fe01dab3541ebb283daddf9d0168c3f05 (patch) | |
tree | d64c1a3e00bf66c9ea9b50085f22662871cb5696 /drivers/video/via | |
parent | 9f1912c48ce829d24789e3e5d499de0d44d3306a (diff) | |
parent | 1adb656e52e1159b0187bf6590df94c7ff44d389 (diff) |
Merge branch 'gpio/next' of git://git.secretlab.ca/git/linux-2.6
* 'gpio/next' of git://git.secretlab.ca/git/linux-2.6:
gpio/via: rename VIA local config struct
basic_mmio_gpio: split into a gpio library and platform device
gpio: remove some legacy comments in build files
gpio: add trace events for setting direction and value
gpio/pca953x: Use handle_simple_irq instead of handle_edge_irq
gpiolib: export gpiochip_find
gpio: remove redundant Kconfig depends on GPIOLIB
basic_mmio_gpio: convert to non-__raw* accessors
basic_mmio_gpio: support direction registers
basic_mmio_gpio: support different input/output registers
basic_mmio_gpio: detect output method at probe time
basic_mmio_gpio: request register regions
basic_mmio_gpio: allow overriding number of gpio
basic_mmio_gpio: convert to platform_{get,set}_drvdata()
basic_mmio_gpio: remove runtime width/endianness evaluation
Diffstat (limited to 'drivers/video/via')
-rw-r--r-- | drivers/video/via/via-gpio.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/video/via/via-gpio.c b/drivers/video/via/via-gpio.c index c2a0a1cfd3b3..ab5341814c74 100644 --- a/drivers/video/via/via-gpio.c +++ b/drivers/video/via/via-gpio.c | |||
@@ -145,7 +145,7 @@ static int via_gpio_get(struct gpio_chip *chip, unsigned int nr) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | static struct viafb_gpio_cfg gpio_config = { | 148 | static struct viafb_gpio_cfg viafb_gpio_config = { |
149 | .gpio_chip = { | 149 | .gpio_chip = { |
150 | .label = "VIAFB onboard GPIO", | 150 | .label = "VIAFB onboard GPIO", |
151 | .owner = THIS_MODULE, | 151 | .owner = THIS_MODULE, |
@@ -183,8 +183,8 @@ static int viafb_gpio_resume(void *private) | |||
183 | { | 183 | { |
184 | int i; | 184 | int i; |
185 | 185 | ||
186 | for (i = 0; i < gpio_config.gpio_chip.ngpio; i += 2) | 186 | for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i += 2) |
187 | viafb_gpio_enable(gpio_config.active_gpios[i]); | 187 | viafb_gpio_enable(viafb_gpio_config.active_gpios[i]); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | 190 | ||
@@ -201,9 +201,9 @@ int viafb_gpio_lookup(const char *name) | |||
201 | { | 201 | { |
202 | int i; | 202 | int i; |
203 | 203 | ||
204 | for (i = 0; i < gpio_config.gpio_chip.ngpio; i++) | 204 | for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i++) |
205 | if (!strcmp(name, gpio_config.active_gpios[i]->vg_name)) | 205 | if (!strcmp(name, viafb_gpio_config.active_gpios[i]->vg_name)) |
206 | return gpio_config.gpio_chip.base + i; | 206 | return viafb_gpio_config.gpio_chip.base + i; |
207 | return -1; | 207 | return -1; |
208 | } | 208 | } |
209 | EXPORT_SYMBOL_GPL(viafb_gpio_lookup); | 209 | EXPORT_SYMBOL_GPL(viafb_gpio_lookup); |
@@ -229,14 +229,15 @@ static __devinit int viafb_gpio_probe(struct platform_device *platdev) | |||
229 | for (gpio = viafb_all_gpios; | 229 | for (gpio = viafb_all_gpios; |
230 | gpio < viafb_all_gpios + VIAFB_NUM_GPIOS; gpio++) | 230 | gpio < viafb_all_gpios + VIAFB_NUM_GPIOS; gpio++) |
231 | if (gpio->vg_port_index == port_cfg[i].ioport_index) { | 231 | if (gpio->vg_port_index == port_cfg[i].ioport_index) { |
232 | gpio_config.active_gpios[ngpio] = gpio; | 232 | viafb_gpio_config.active_gpios[ngpio] = gpio; |
233 | gpio_config.gpio_names[ngpio] = gpio->vg_name; | 233 | viafb_gpio_config.gpio_names[ngpio] = |
234 | gpio->vg_name; | ||
234 | ngpio++; | 235 | ngpio++; |
235 | } | 236 | } |
236 | } | 237 | } |
237 | gpio_config.gpio_chip.ngpio = ngpio; | 238 | viafb_gpio_config.gpio_chip.ngpio = ngpio; |
238 | gpio_config.gpio_chip.names = gpio_config.gpio_names; | 239 | viafb_gpio_config.gpio_chip.names = viafb_gpio_config.gpio_names; |
239 | gpio_config.vdev = vdev; | 240 | viafb_gpio_config.vdev = vdev; |
240 | if (ngpio == 0) { | 241 | if (ngpio == 0) { |
241 | printk(KERN_INFO "viafb: no GPIOs configured\n"); | 242 | printk(KERN_INFO "viafb: no GPIOs configured\n"); |
242 | return 0; | 243 | return 0; |
@@ -245,18 +246,18 @@ static __devinit int viafb_gpio_probe(struct platform_device *platdev) | |||
245 | * Enable the ports. They come in pairs, with a single | 246 | * Enable the ports. They come in pairs, with a single |
246 | * enable bit for both. | 247 | * enable bit for both. |
247 | */ | 248 | */ |
248 | spin_lock_irqsave(&gpio_config.vdev->reg_lock, flags); | 249 | spin_lock_irqsave(&viafb_gpio_config.vdev->reg_lock, flags); |
249 | for (i = 0; i < ngpio; i += 2) | 250 | for (i = 0; i < ngpio; i += 2) |
250 | viafb_gpio_enable(gpio_config.active_gpios[i]); | 251 | viafb_gpio_enable(viafb_gpio_config.active_gpios[i]); |
251 | spin_unlock_irqrestore(&gpio_config.vdev->reg_lock, flags); | 252 | spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags); |
252 | /* | 253 | /* |
253 | * Get registered. | 254 | * Get registered. |
254 | */ | 255 | */ |
255 | gpio_config.gpio_chip.base = -1; /* Dynamic */ | 256 | viafb_gpio_config.gpio_chip.base = -1; /* Dynamic */ |
256 | ret = gpiochip_add(&gpio_config.gpio_chip); | 257 | ret = gpiochip_add(&viafb_gpio_config.gpio_chip); |
257 | if (ret) { | 258 | if (ret) { |
258 | printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); | 259 | printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); |
259 | gpio_config.gpio_chip.ngpio = 0; | 260 | viafb_gpio_config.gpio_chip.ngpio = 0; |
260 | } | 261 | } |
261 | #ifdef CONFIG_PM | 262 | #ifdef CONFIG_PM |
262 | viafb_pm_register(&viafb_gpio_pm_hooks); | 263 | viafb_pm_register(&viafb_gpio_pm_hooks); |
@@ -277,8 +278,8 @@ static int viafb_gpio_remove(struct platform_device *platdev) | |||
277 | /* | 278 | /* |
278 | * Get unregistered. | 279 | * Get unregistered. |
279 | */ | 280 | */ |
280 | if (gpio_config.gpio_chip.ngpio > 0) { | 281 | if (viafb_gpio_config.gpio_chip.ngpio > 0) { |
281 | ret = gpiochip_remove(&gpio_config.gpio_chip); | 282 | ret = gpiochip_remove(&viafb_gpio_config.gpio_chip); |
282 | if (ret) { /* Somebody still using it? */ | 283 | if (ret) { /* Somebody still using it? */ |
283 | printk(KERN_ERR "Viafb: GPIO remove failed\n"); | 284 | printk(KERN_ERR "Viafb: GPIO remove failed\n"); |
284 | return ret; | 285 | return ret; |
@@ -287,11 +288,11 @@ static int viafb_gpio_remove(struct platform_device *platdev) | |||
287 | /* | 288 | /* |
288 | * Disable the ports. | 289 | * Disable the ports. |
289 | */ | 290 | */ |
290 | spin_lock_irqsave(&gpio_config.vdev->reg_lock, flags); | 291 | spin_lock_irqsave(&viafb_gpio_config.vdev->reg_lock, flags); |
291 | for (i = 0; i < gpio_config.gpio_chip.ngpio; i += 2) | 292 | for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i += 2) |
292 | viafb_gpio_disable(gpio_config.active_gpios[i]); | 293 | viafb_gpio_disable(viafb_gpio_config.active_gpios[i]); |
293 | gpio_config.gpio_chip.ngpio = 0; | 294 | viafb_gpio_config.gpio_chip.ngpio = 0; |
294 | spin_unlock_irqrestore(&gpio_config.vdev->reg_lock, flags); | 295 | spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags); |
295 | return ret; | 296 | return ret; |
296 | } | 297 | } |
297 | 298 | ||