Lines Matching refs:gc
26 struct gpio_chip gc; member
54 static int rpi_exp_gpio_get_polarity(struct gpio_chip *gc, unsigned int off) in rpi_exp_gpio_get_polarity() argument
60 gpio = gpiochip_get_data(gc); in rpi_exp_gpio_get_polarity()
67 dev_err(gc->parent, "Failed to get GPIO %u config (%d %x)\n", in rpi_exp_gpio_get_polarity()
74 static int rpi_exp_gpio_dir_in(struct gpio_chip *gc, unsigned int off) in rpi_exp_gpio_dir_in() argument
80 gpio = gpiochip_get_data(gc); in rpi_exp_gpio_dir_in()
88 ret = rpi_exp_gpio_get_polarity(gc, off); in rpi_exp_gpio_dir_in()
96 dev_err(gc->parent, "Failed to set GPIO %u to input (%d %x)\n", in rpi_exp_gpio_dir_in()
103 static int rpi_exp_gpio_dir_out(struct gpio_chip *gc, unsigned int off, int val) in rpi_exp_gpio_dir_out() argument
109 gpio = gpiochip_get_data(gc); in rpi_exp_gpio_dir_out()
117 ret = rpi_exp_gpio_get_polarity(gc, off); in rpi_exp_gpio_dir_out()
125 dev_err(gc->parent, "Failed to set GPIO %u to output (%d %x)\n", in rpi_exp_gpio_dir_out()
132 static int rpi_exp_gpio_get_direction(struct gpio_chip *gc, unsigned int off) in rpi_exp_gpio_get_direction() argument
138 gpio = gpiochip_get_data(gc); in rpi_exp_gpio_get_direction()
145 dev_err(gc->parent, in rpi_exp_gpio_get_direction()
156 static int rpi_exp_gpio_get(struct gpio_chip *gc, unsigned int off) in rpi_exp_gpio_get() argument
162 gpio = gpiochip_get_data(gc); in rpi_exp_gpio_get()
170 dev_err(gc->parent, in rpi_exp_gpio_get()
178 static void rpi_exp_gpio_set(struct gpio_chip *gc, unsigned int off, int val) in rpi_exp_gpio_set() argument
184 gpio = gpiochip_get_data(gc); in rpi_exp_gpio_set()
192 dev_err(gc->parent, in rpi_exp_gpio_set()
221 rpi_gpio->gc.parent = dev; in rpi_exp_gpio_probe()
222 rpi_gpio->gc.label = MODULE_NAME; in rpi_exp_gpio_probe()
223 rpi_gpio->gc.owner = THIS_MODULE; in rpi_exp_gpio_probe()
224 rpi_gpio->gc.base = -1; in rpi_exp_gpio_probe()
225 rpi_gpio->gc.ngpio = NUM_GPIO; in rpi_exp_gpio_probe()
227 rpi_gpio->gc.direction_input = rpi_exp_gpio_dir_in; in rpi_exp_gpio_probe()
228 rpi_gpio->gc.direction_output = rpi_exp_gpio_dir_out; in rpi_exp_gpio_probe()
229 rpi_gpio->gc.get_direction = rpi_exp_gpio_get_direction; in rpi_exp_gpio_probe()
230 rpi_gpio->gc.get = rpi_exp_gpio_get; in rpi_exp_gpio_probe()
231 rpi_gpio->gc.set = rpi_exp_gpio_set; in rpi_exp_gpio_probe()
232 rpi_gpio->gc.can_sleep = true; in rpi_exp_gpio_probe()
234 return devm_gpiochip_add_data(dev, &rpi_gpio->gc, rpi_gpio); in rpi_exp_gpio_probe()