14 #include <linux/device.h>
15 #include <linux/errno.h>
16 #include <linux/module.h>
22 #include <linux/slab.h>
33 static int of_gpiochip_find_and_xlate(
struct gpio_chip *
gc,
void *
data)
38 if ((gc->of_node != gg_data->
gpiospec.np) ||
39 (gc->of_gpio_n_cells != gg_data->
gpiospec.args_count) ||
78 pr_debug(
"%s: can't parse gpios property\n", __func__);
109 unsigned int cnt = 0;
117 if (ret < 0 && ret != -
EEXIST)
145 if (gc->of_gpio_n_cells < 2) {
153 if (gpiospec->
args[0] >= gc->ngpio)
157 *flags = gpiospec->
args[1];
159 return gpiospec->
args[0];
183 struct of_mm_gpio_chip *mm_gc)
186 struct gpio_chip *
gc = &mm_gc->gc;
198 if (mm_gc->save_regs)
199 mm_gc->save_regs(mm_gc);
201 mm_gc->gc.of_node = np;
213 pr_err(
"%s: GPIO chip registration failed with status %d\n",
221 if ((!chip->of_node) && (chip->dev))
222 chip->of_node = chip->dev->of_node;
227 if (!chip->of_xlate) {
228 chip->of_gpio_n_cells = 2;
232 of_node_get(chip->of_node);
238 of_node_put(chip->of_node);