13 #include <linux/export.h>
31 .vg_port_index = 0x25,
37 .vg_port_index = 0x25,
43 .vg_port_index = 0x2c,
49 .vg_port_index = 0x2c,
55 .vg_port_index = 0x3d,
61 .vg_port_index = 0x3d,
66 #define VIAFB_NUM_GPIOS ARRAY_SIZE(viafb_all_gpios)
83 static void via_gpio_set(
struct gpio_chip *
chip,
unsigned int nr,
102 spin_unlock_irqrestore(&cfg->
vdev->reg_lock, flags);
105 static int via_gpio_dir_out(
struct gpio_chip *
chip,
unsigned int nr,
108 via_gpio_set(chip, nr, value);
116 static int via_gpio_dir_input(
struct gpio_chip *
chip,
unsigned int nr)
128 spin_unlock_irqrestore(&cfg->
vdev->reg_lock, flags);
132 static int via_gpio_get(
struct gpio_chip *
chip,
unsigned int nr)
144 spin_unlock_irqrestore(&cfg->
vdev->reg_lock, flags);
151 .label =
"VIAFB onboard GPIO",
153 .direction_output = via_gpio_dir_out,
155 .direction_input = via_gpio_dir_input,
178 static int viafb_gpio_suspend(
void *
private)
183 static int viafb_gpio_resume(
void *
private)
187 for (i = 0; i < viafb_gpio_config.
gpio_chip.ngpio; i += 2)
192 static struct viafb_pm_hooks viafb_gpio_pm_hooks = {
193 .suspend = viafb_gpio_suspend,
194 .resume = viafb_gpio_resume
205 for (i = 0; i < viafb_gpio_config.
gpio_chip.ngpio; i++)
219 int i, ngpio = 0,
ret;
230 for (gpio = viafb_all_gpios;
239 viafb_gpio_config.
gpio_chip.ngpio = ngpio;
241 viafb_gpio_config.
vdev = vdev;
251 for (i = 0; i < ngpio; i += 2)
253 spin_unlock_irqrestore(&viafb_gpio_config.
vdev->reg_lock, flags);
264 viafb_pm_register(&viafb_gpio_pm_hooks);
276 viafb_pm_unregister(&viafb_gpio_pm_hooks);
282 if (viafb_gpio_config.
gpio_chip.ngpio > 0) {
293 for (i = 0; i < viafb_gpio_config.
gpio_chip.ngpio; i += 2)
296 spin_unlock_irqrestore(&viafb_gpio_config.
vdev->reg_lock, flags);
302 .name =
"viafb-gpio",
304 .probe = viafb_gpio_probe,
305 .remove = viafb_gpio_remove,