Lines Matching refs:gc
27 static void cros_ec_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) in cros_ec_gpio_set() argument
29 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix); in cros_ec_gpio_set()
30 struct cros_ec_device *cros_ec = gpiochip_get_data(gc); in cros_ec_gpio_set()
44 dev_err(gc->parent, "error setting gpio%d (%s) on EC: %d\n", gpio, name, ret); in cros_ec_gpio_set()
47 static int cros_ec_gpio_get(struct gpio_chip *gc, unsigned int gpio) in cros_ec_gpio_get() argument
49 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix); in cros_ec_gpio_get()
50 struct cros_ec_device *cros_ec = gpiochip_get_data(gc); in cros_ec_gpio_get()
63 dev_err(gc->parent, "error getting gpio%d (%s) on EC: %d\n", gpio, name, ret); in cros_ec_gpio_get()
73 static int cros_ec_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio) in cros_ec_gpio_get_direction() argument
75 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix); in cros_ec_gpio_get_direction()
76 struct cros_ec_device *cros_ec = gpiochip_get_data(gc); in cros_ec_gpio_get_direction()
87 dev_err(gc->parent, "error getting direction of gpio%d (%s) on EC: %d\n", gpio, name, ret); in cros_ec_gpio_get_direction()
101 static int cros_ec_gpio_init_names(struct cros_ec_device *cros_ec, struct gpio_chip *gc) in cros_ec_gpio_init_names() argument
114 names = devm_kcalloc(gc->parent, gc->ngpio, sizeof(*names), GFP_KERNEL); in cros_ec_gpio_init_names()
117 gc->names = names; in cros_ec_gpio_init_names()
119 str = devm_kcalloc(gc->parent, gc->ngpio, name_len, GFP_KERNEL); in cros_ec_gpio_init_names()
124 for (i = 0; i < gc->ngpio; i++) { in cros_ec_gpio_init_names()
129 dev_err_probe(gc->parent, ret, "error getting gpio%d info\n", i); in cros_ec_gpio_init_names()
168 struct gpio_chip *gc; in cros_ec_gpio_probe() local
181 gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); in cros_ec_gpio_probe()
182 if (!gc) in cros_ec_gpio_probe()
185 gc->ngpio = ngpios; in cros_ec_gpio_probe()
186 gc->parent = dev; in cros_ec_gpio_probe()
187 ret = cros_ec_gpio_init_names(cros_ec, gc); in cros_ec_gpio_probe()
191 gc->can_sleep = true; in cros_ec_gpio_probe()
192 gc->label = dev_name(dev); in cros_ec_gpio_probe()
193 gc->base = -1; in cros_ec_gpio_probe()
194 gc->set = cros_ec_gpio_set; in cros_ec_gpio_probe()
195 gc->get = cros_ec_gpio_get; in cros_ec_gpio_probe()
196 gc->get_direction = cros_ec_gpio_get_direction; in cros_ec_gpio_probe()
198 return devm_gpiochip_add_data(dev, gc, cros_ec); in cros_ec_gpio_probe()