Lines Matching +full:gpio +full:- +full:line +full:- +full:names
2 * Device property helpers for GPIO chips.
14 #include <linux/gpio/consumer.h>
15 #include <linux/gpio/driver.h>
20 * devprop_gpiochip_set_names - Set GPIO line names using device properties
21 * @chip: GPIO chip whose lines should be named, if possible
22 * @fwnode: Property Node containing the gpio-line-names property
24 * Looks for device property "gpio-line-names" and if it exists assigns
25 * GPIO line names for the chip. The memory allocated for the assigned
26 * names belong to the underlying firmware node and should not be released
32 struct gpio_device *gdev = chip->gpiodev; in devprop_gpiochip_set_names()
33 const char **names; in devprop_gpiochip_set_names() local
36 ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", in devprop_gpiochip_set_names()
41 if (ret != gdev->ngpio) { in devprop_gpiochip_set_names()
42 dev_warn(&gdev->dev, in devprop_gpiochip_set_names()
43 "names %d do not match number of GPIOs %d\n", ret, in devprop_gpiochip_set_names()
44 gdev->ngpio); in devprop_gpiochip_set_names()
48 names = kcalloc(gdev->ngpio, sizeof(*names), GFP_KERNEL); in devprop_gpiochip_set_names()
49 if (!names) in devprop_gpiochip_set_names()
52 ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", in devprop_gpiochip_set_names()
53 names, gdev->ngpio); in devprop_gpiochip_set_names()
55 dev_warn(&gdev->dev, "failed to read GPIO line names\n"); in devprop_gpiochip_set_names()
56 kfree(names); in devprop_gpiochip_set_names()
60 for (i = 0; i < gdev->ngpio; i++) in devprop_gpiochip_set_names()
61 gdev->descs[i].name = names[i]; in devprop_gpiochip_set_names()
63 kfree(names); in devprop_gpiochip_set_names()