Lines Matching refs:gc

26 static void cros_ec_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
28 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix);
29 struct cros_ec_device *cros_ec = gpiochip_get_data(gc);
43 dev_err(gc->parent, "error setting gpio%d (%s) on EC: %d\n", gpio, name, ret);
46 static int cros_ec_gpio_get(struct gpio_chip *gc, unsigned int gpio)
48 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix);
49 struct cros_ec_device *cros_ec = gpiochip_get_data(gc);
62 dev_err(gc->parent, "error getting gpio%d (%s) on EC: %d\n", gpio, name, ret);
72 static int cros_ec_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
74 const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix);
75 struct cros_ec_device *cros_ec = gpiochip_get_data(gc);
86 dev_err(gc->parent, "error getting direction of gpio%d (%s) on EC: %d\n", gpio, name, ret);
100 static int cros_ec_gpio_init_names(struct cros_ec_device *cros_ec, struct gpio_chip *gc)
113 names = devm_kcalloc(gc->parent, gc->ngpio, sizeof(*names), GFP_KERNEL);
116 gc->names = names;
118 str = devm_kcalloc(gc->parent, gc->ngpio, name_len, GFP_KERNEL);
123 for (i = 0; i < gc->ngpio; i++) {
128 dev_err_probe(gc->parent, ret, "error getting gpio%d info\n", i);
167 struct gpio_chip *gc;
180 gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
181 if (!gc)
184 gc->ngpio = ngpios;
185 gc->parent = dev;
186 ret = cros_ec_gpio_init_names(cros_ec, gc);
190 gc->can_sleep = true;
191 gc->label = dev_name(dev);
192 gc->base = -1;
193 gc->set = cros_ec_gpio_set;
194 gc->get = cros_ec_gpio_get;
195 gc->get_direction = cros_ec_gpio_get_direction;
197 return devm_gpiochip_add_data(dev, gc, cros_ec);