diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-01-26 15:38:35 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-01-30 15:07:06 -0500 |
commit | a6ca2e10f795111a90a4efabb07717258669e03d (patch) | |
tree | e39ccc815a49c0d07587ae412305666f1277b85f /drivers/ssb/driver_gpio.c | |
parent | 5b2e2eccab80e2f56d06df582e473fb0d8630f35 (diff) |
ssb: add gpio_to_irq
The old bcm47xx gpio code had support for gpio_to_irq, but the new
code did not provide this function, but returned -ENXIO all the time.
This patch adds the missing function.
arch/mips/bcm47xx/wgt634u.c calls gpio_to_irq() and got the correct irq
number with the old gpio handling code. With this patch the code in
wgt634u.c should work again. I do not have a wgt634u to test this.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/driver_gpio.c')
-rw-r--r-- | drivers/ssb/driver_gpio.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/ssb/driver_gpio.c b/drivers/ssb/driver_gpio.c index 97ac0a38e3d0..accabe39b320 100644 --- a/drivers/ssb/driver_gpio.c +++ b/drivers/ssb/driver_gpio.c | |||
@@ -74,6 +74,16 @@ static void ssb_gpio_chipco_free(struct gpio_chip *chip, unsigned gpio) | |||
74 | ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0); | 74 | ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0); |
75 | } | 75 | } |
76 | 76 | ||
77 | static int ssb_gpio_chipco_to_irq(struct gpio_chip *chip, unsigned gpio) | ||
78 | { | ||
79 | struct ssb_bus *bus = ssb_gpio_get_bus(chip); | ||
80 | |||
81 | if (bus->bustype == SSB_BUSTYPE_SSB) | ||
82 | return ssb_mips_irq(bus->chipco.dev) + 2; | ||
83 | else | ||
84 | return -EINVAL; | ||
85 | } | ||
86 | |||
77 | static int ssb_gpio_chipco_init(struct ssb_bus *bus) | 87 | static int ssb_gpio_chipco_init(struct ssb_bus *bus) |
78 | { | 88 | { |
79 | struct gpio_chip *chip = &bus->gpio; | 89 | struct gpio_chip *chip = &bus->gpio; |
@@ -86,6 +96,7 @@ static int ssb_gpio_chipco_init(struct ssb_bus *bus) | |||
86 | chip->set = ssb_gpio_chipco_set_value; | 96 | chip->set = ssb_gpio_chipco_set_value; |
87 | chip->direction_input = ssb_gpio_chipco_direction_input; | 97 | chip->direction_input = ssb_gpio_chipco_direction_input; |
88 | chip->direction_output = ssb_gpio_chipco_direction_output; | 98 | chip->direction_output = ssb_gpio_chipco_direction_output; |
99 | chip->to_irq = ssb_gpio_chipco_to_irq; | ||
89 | chip->ngpio = 16; | 100 | chip->ngpio = 16; |
90 | /* There is just one SoC in one device and its GPIO addresses should be | 101 | /* There is just one SoC in one device and its GPIO addresses should be |
91 | * deterministic to address them more easily. The other buses could get | 102 | * deterministic to address them more easily. The other buses could get |
@@ -134,6 +145,16 @@ static int ssb_gpio_extif_direction_output(struct gpio_chip *chip, | |||
134 | return 0; | 145 | return 0; |
135 | } | 146 | } |
136 | 147 | ||
148 | static int ssb_gpio_extif_to_irq(struct gpio_chip *chip, unsigned gpio) | ||
149 | { | ||
150 | struct ssb_bus *bus = ssb_gpio_get_bus(chip); | ||
151 | |||
152 | if (bus->bustype == SSB_BUSTYPE_SSB) | ||
153 | return ssb_mips_irq(bus->extif.dev) + 2; | ||
154 | else | ||
155 | return -EINVAL; | ||
156 | } | ||
157 | |||
137 | static int ssb_gpio_extif_init(struct ssb_bus *bus) | 158 | static int ssb_gpio_extif_init(struct ssb_bus *bus) |
138 | { | 159 | { |
139 | struct gpio_chip *chip = &bus->gpio; | 160 | struct gpio_chip *chip = &bus->gpio; |
@@ -144,6 +165,7 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus) | |||
144 | chip->set = ssb_gpio_extif_set_value; | 165 | chip->set = ssb_gpio_extif_set_value; |
145 | chip->direction_input = ssb_gpio_extif_direction_input; | 166 | chip->direction_input = ssb_gpio_extif_direction_input; |
146 | chip->direction_output = ssb_gpio_extif_direction_output; | 167 | chip->direction_output = ssb_gpio_extif_direction_output; |
168 | chip->to_irq = ssb_gpio_extif_to_irq; | ||
147 | chip->ngpio = 5; | 169 | chip->ngpio = 5; |
148 | /* There is just one SoC in one device and its GPIO addresses should be | 170 | /* There is just one SoC in one device and its GPIO addresses should be |
149 | * deterministic to address them more easily. The other buses could get | 171 | * deterministic to address them more easily. The other buses could get |