Lines Matching refs:gc

27 static int cros_ec_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
29 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix);
30 struct cros_ec_device *cros_ec = gpiochip_get_data(gc);
44 static int cros_ec_gpio_get(struct gpio_chip *gc, unsigned int gpio)
46 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix);
47 struct cros_ec_device *cros_ec = gpiochip_get_data(gc);
60 dev_err(gc->parent, "error getting gpio%d (%s) on EC: %d\n", gpio, name, ret);
70 static int cros_ec_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
72 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix);
73 struct cros_ec_device *cros_ec = gpiochip_get_data(gc);
84 dev_err(gc->parent, "error getting direction of gpio%d (%s) on EC: %d\n", gpio, name, ret);
98 static int cros_ec_gpio_init_names(struct cros_ec_device *cros_ec, struct gpio_chip *gc)
111 names = devm_kcalloc(gc->parent, gc->ngpio, sizeof(*names), GFP_KERNEL);
114 gc->names = names;
116 str = devm_kcalloc(gc->parent, gc->ngpio, name_len, GFP_KERNEL);
121 for (i = 0; i < gc->ngpio; i++) {
126 dev_err_probe(gc->parent, ret, "error getting gpio%d info\n", i);
165 struct gpio_chip *gc;
178 gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
179 if (!gc)
182 gc->ngpio = ngpios;
183 gc->parent = dev;
184 ret = cros_ec_gpio_init_names(cros_ec, gc);
188 gc->can_sleep = true;
189 gc->label = dev_name(dev);
190 gc->base = -1;
191 gc->set_rv = cros_ec_gpio_set;
192 gc->get = cros_ec_gpio_get;
193 gc->get_direction = cros_ec_gpio_get_direction;
195 return devm_gpiochip_add_data(dev, gc, cros_ec);