Lines Matching +full:int +full:- +full:gpios
1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (c) 2007-2008 MontaVista Software, Inc.
26 #include "gpiolib-of.h"
29 * This is Linux-specific flags. By default controllers' and Linux' mapping
31 * Linux-specific in their .xlate callback. Though, 1:1 mapping is recommended.
44 * of_gpio_named_count() - Count GPIOs for a device
45 * @np: device node to count GPIOs for
48 * The function returns the count of GPIOs specified for a node.
52 * Either number of GPIOs defined in the property, or
53 * * %-EINVAL for an incorrectly formed "gpios" property, or
54 * * %-ENOENT for a missing "gpios" property.
58 * gpios = <0
63 * The above example defines four GPIOs, two of which are not specified.
66 static int of_gpio_named_count(const struct device_node *np, in of_gpio_named_count()
69 return of_count_phandle_with_args(np, propname, "#gpio-cells"); in of_gpio_named_count()
73 * of_gpio_spi_cs_get_count() - special GPIO counting for SPI
79 * established "cs-gpios" for chip selects but instead rely on
80 * "gpios" for the chip select lines. If we detect this, we redirect
81 * the counting of "cs-gpios" to count "gpios" transparent to the
85 * Either number of GPIOs defined in the property, or
86 * * %-EINVAL for an incorrectly formed "gpios" property, or
87 * * %-ENOENT for a missing "gpios" property.
89 static int of_gpio_spi_cs_get_count(const struct device_node *np, in of_gpio_spi_cs_get_count()
98 !of_device_is_compatible(np, "ibm,ppc4xx-spi")) in of_gpio_spi_cs_get_count()
100 return of_gpio_named_count(np, "gpios"); in of_gpio_spi_cs_get_count()
103 int of_gpio_count(const struct fwnode_handle *fwnode, const char *con_id) in of_gpio_count()
106 int ret; in of_gpio_count()
118 return ret ? ret : -ENOENT; in of_gpio_count()
121 static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, in of_gpiochip_match_node_and_xlate()
126 return device_match_of_node(&chip->gpiodev->dev, gpiospec->np) && in of_gpiochip_match_node_and_xlate()
127 chip->of_xlate && in of_gpiochip_match_node_and_xlate()
128 chip->of_xlate(chip, gpiospec, NULL) >= 0; in of_gpiochip_match_node_and_xlate()
141 int ret; in of_xlate_and_get_gpiod_flags()
143 if (chip->of_gpio_n_cells != gpiospec->args_count) in of_xlate_and_get_gpiod_flags()
144 return ERR_PTR(-EINVAL); in of_xlate_and_get_gpiod_flags()
146 ret = chip->of_xlate(chip, gpiospec, flags); in of_xlate_and_get_gpiod_flags()
163 pr_warn("%s GPIO handle specifies active low - ignored\n", in of_gpio_quirk_polarity()
187 } gpios[] = { in of_gpio_try_fixup_polarity() local
191 * "gpios-reset" property and also specified wrong in of_gpio_try_fixup_polarity()
194 { "himax,hx8357", "gpios-reset", false }, in of_gpio_try_fixup_polarity()
195 { "himax,hx8369", "gpios-reset", false }, in of_gpio_try_fixup_polarity()
199 * The rb-gpios semantics was undocumented and qi,lb60 (along with in of_gpio_try_fixup_polarity()
202 * inverter on this board, it should be active-high. Let's fix that in of_gpio_try_fixup_polarity()
203 * here for older DTs so we can re-use the generic nand_gpio_waitrdy() in of_gpio_try_fixup_polarity()
206 { "qi,lb60", "rb-gpios", true }, in of_gpio_try_fixup_polarity()
211 * active-low signal. However, most of the device trees that in of_gpio_try_fixup_polarity()
213 * reset GPIO as active-high, and were also using wrong name in of_gpio_try_fixup_polarity()
216 { "lantiq,pci-xway", "gpio-reset", false }, in of_gpio_try_fixup_polarity()
224 { "ti,tsc2005", "reset-gpios", false }, in of_gpio_try_fixup_polarity()
227 unsigned int i; in of_gpio_try_fixup_polarity()
229 for (i = 0; i < ARRAY_SIZE(gpios); i++) { in of_gpio_try_fixup_polarity()
230 if (of_device_is_compatible(np, gpios[i].compatible) && in of_gpio_try_fixup_polarity()
231 !strcmp(propname, gpios[i].propname)) { in of_gpio_try_fixup_polarity()
232 of_gpio_quirk_polarity(np, gpios[i].active_high, flags); in of_gpio_try_fixup_polarity()
248 } gpios[] = { in of_gpio_set_polarity_by_property() local
251 { "fsl,imx25-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
252 { "fsl,imx27-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
253 { "fsl,imx28-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
254 { "fsl,imx6q-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
255 { "fsl,mvf600-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
256 { "fsl,imx6sx-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
257 { "fsl,imx6ul-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
258 { "fsl,imx8mq-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
259 { "fsl,imx8qm-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
260 { "fsl,s32v234-fec", "phy-reset-gpios", "phy-reset-active-high" }, in of_gpio_set_polarity_by_property()
263 { "fsl,imx6q-pcie", "reset-gpio", "reset-gpio-active-high" }, in of_gpio_set_polarity_by_property()
264 { "fsl,imx6sx-pcie", "reset-gpio", "reset-gpio-active-high" }, in of_gpio_set_polarity_by_property()
265 { "fsl,imx6qp-pcie", "reset-gpio", "reset-gpio-active-high" }, in of_gpio_set_polarity_by_property()
266 { "fsl,imx7d-pcie", "reset-gpio", "reset-gpio-active-high" }, in of_gpio_set_polarity_by_property()
267 { "fsl,imx8mq-pcie", "reset-gpio", "reset-gpio-active-high" }, in of_gpio_set_polarity_by_property()
268 { "fsl,imx8mm-pcie", "reset-gpio", "reset-gpio-active-high" }, in of_gpio_set_polarity_by_property()
269 { "fsl,imx8mp-pcie", "reset-gpio", "reset-gpio-active-high" }, in of_gpio_set_polarity_by_property()
274 * presence or absence of "enable-active-high" solely controls in of_gpio_set_polarity_by_property()
279 { "regulator-fixed", "gpios", "enable-active-high" }, in of_gpio_set_polarity_by_property()
280 { "regulator-fixed", "gpio", "enable-active-high" }, in of_gpio_set_polarity_by_property()
281 { "reg-fixed-voltage", "gpios", "enable-active-high" }, in of_gpio_set_polarity_by_property()
282 { "reg-fixed-voltage", "gpio", "enable-active-high" }, in of_gpio_set_polarity_by_property()
285 { "regulator-gpio", "enable-gpio", "enable-active-high" }, in of_gpio_set_polarity_by_property()
286 { "regulator-gpio", "enable-gpios", "enable-active-high" }, in of_gpio_set_polarity_by_property()
289 { "atmel,hsmci", "cd-gpios", "cd-inverted" }, in of_gpio_set_polarity_by_property()
292 unsigned int i; in of_gpio_set_polarity_by_property()
300 if (of_device_is_compatible(np->parent, "atmel,hsmci")) { in of_gpio_set_polarity_by_property()
301 np_compat = np->parent; in of_gpio_set_polarity_by_property()
306 for (i = 0; i < ARRAY_SIZE(gpios); i++) { in of_gpio_set_polarity_by_property()
307 if (of_device_is_compatible(np_compat, gpios[i].compatible) && in of_gpio_set_polarity_by_property()
308 !strcmp(propname, gpios[i].gpio_propname)) { in of_gpio_set_polarity_by_property()
310 gpios[i].polarity_propname); in of_gpio_set_polarity_by_property()
320 int index) in of_gpio_flags_quirks()
329 of_device_is_compatible(np, "reg-fixed-voltage") && in of_gpio_flags_quirks()
330 of_property_read_bool(np, "gpio-open-drain")) { in of_gpio_flags_quirks()
332 pr_info("%s uses legacy open drain flag - update the DTS if you can\n", in of_gpio_flags_quirks()
338 * property named "cs-gpios" we need to inspect the child node in of_gpio_flags_quirks()
341 if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") && in of_gpio_flags_quirks()
342 of_property_present(np, "cs-gpios")) { in of_gpio_flags_quirks()
344 int ret; in of_gpio_flags_quirks()
354 * by just omitting "spi-cs-high" in the in of_gpio_flags_quirks()
359 * and has the "spi-cs-high" set, we get a in of_gpio_flags_quirks()
360 * conflict and the "spi-cs-high" flag will in of_gpio_flags_quirks()
364 "spi-cs-high"); in of_gpio_flags_quirks()
372 /* Legacy handling of stmmac's active-low PHY reset line */ in of_gpio_flags_quirks()
374 !strcmp(propname, "snps,reset-gpio") && in of_gpio_flags_quirks()
375 of_property_read_bool(np, "snps,reset-active-low")) in of_gpio_flags_quirks()
380 * of_get_named_gpiod_flags() - Get a GPIO descriptor and flags for GPIO API
392 const char *propname, int index, enum of_gpio_flags *flags) in of_get_named_gpiod_flags()
396 int ret; in of_get_named_gpiod_flags()
409 desc = ERR_PTR(-EPROBE_DEFER); in of_get_named_gpiod_flags()
421 pr_debug("%s: parsed '%s' property of node '%pOF[%d]' - status (%d)\n", in of_get_named_gpiod_flags()
432 * of_get_named_gpio() - Get a GPIO number to use with GPIO API
443 int of_get_named_gpio(const struct device_node *np, const char *propname, in of_get_named_gpio()
444 int index) in of_get_named_gpio()
489 unsigned int idx, in of_find_gpio_rename()
494 const char *legacy_id; /* NULL - same as con_id */ in of_find_gpio_rename()
503 } gpios[] = { in of_find_gpio_rename() local
505 /* Himax LCD controllers used "gpios-reset" */ in of_find_gpio_rename()
506 { "reset", "gpios-reset", "himax,hx8357" }, in of_find_gpio_rename()
507 { "reset", "gpios-reset", "himax,hx8369" }, in of_find_gpio_rename()
513 { "rtc-data", "gpio-rtc-data", "moxa,moxart-rtc" }, in of_find_gpio_rename()
514 { "rtc-sclk", "gpio-rtc-sclk", "moxa,moxart-rtc" }, in of_find_gpio_rename()
515 { "rtc-reset", "gpio-rtc-reset", "moxa,moxart-rtc" }, in of_find_gpio_rename()
518 { "reset", "reset-n-io", "marvell,nfc-i2c" }, in of_find_gpio_rename()
521 { "reset", "reset-n-io", "marvell,nfc-spi" }, in of_find_gpio_rename()
524 { "reset", "reset-n-io", "marvell,nfc-uart" }, in of_find_gpio_rename()
525 { "reset", "reset-n-io", "mrvl,nfc-uart" }, in of_find_gpio_rename()
529 { "reset", "gpio-reset", "lantiq,pci-xway" }, in of_find_gpio_rename()
535 * "foo-gpios" so we have this special kludge for them. in of_find_gpio_rename()
546 { "reset", "cirrus,gpio-nreset", "cirrus,cs42l56" }, in of_find_gpio_rename()
549 { "i2s1-in-sel-gpio1", NULL, "mediatek,mt2701-cs42448-machine" }, in of_find_gpio_rename()
550 { "i2s1-in-sel-gpio2", NULL, "mediatek,mt2701-cs42448-machine" }, in of_find_gpio_rename()
553 { "reset", "gpio-reset", "ti,tlv320aic3x" }, in of_find_gpio_rename()
554 { "reset", "gpio-reset", "ti,tlv320aic33" }, in of_find_gpio_rename()
555 { "reset", "gpio-reset", "ti,tlv320aic3007" }, in of_find_gpio_rename()
556 { "reset", "gpio-reset", "ti,tlv320aic3104" }, in of_find_gpio_rename()
557 { "reset", "gpio-reset", "ti,tlv320aic3106" }, in of_find_gpio_rename()
563 * "foo-gpios" so we have this special kludge for them. in of_find_gpio_rename()
565 { "miso", "gpio-miso", "spi-gpio" }, in of_find_gpio_rename()
566 { "mosi", "gpio-mosi", "spi-gpio" }, in of_find_gpio_rename()
567 { "sck", "gpio-sck", "spi-gpio" }, in of_find_gpio_rename()
571 * The old Freescale bindings use simply "gpios" as name in of_find_gpio_rename()
572 * for the chip select lines rather than "cs-gpios" like in of_find_gpio_rename()
577 { "cs", "gpios", "fsl,spi" }, in of_find_gpio_rename()
578 { "cs", "gpios", "aeroflexgaisler,spictrl" }, in of_find_gpio_rename()
581 { "cs", "gpios", "ibm,ppc4xx-spi" }, in of_find_gpio_rename()
587 * property without the compulsory "-gpios" suffix. in of_find_gpio_rename()
594 unsigned int i; in of_find_gpio_rename()
597 return ERR_PTR(-ENOENT); in of_find_gpio_rename()
599 for (i = 0; i < ARRAY_SIZE(gpios); i++) { in of_find_gpio_rename()
600 if (strcmp(con_id, gpios[i].con_id)) in of_find_gpio_rename()
603 if (gpios[i].compatible && in of_find_gpio_rename()
604 !of_device_is_compatible(np, gpios[i].compatible)) in of_find_gpio_rename()
607 legacy_id = gpios[i].legacy_id ?: gpios[i].con_id; in of_find_gpio_rename()
610 pr_info("%s uses legacy gpio name '%s' instead of '%s-gpios'\n", in of_find_gpio_rename()
616 return ERR_PTR(-ENOENT); in of_find_gpio_rename()
621 unsigned int idx, in of_find_mt2701_gpio()
628 return ERR_PTR(-ENOENT); in of_find_mt2701_gpio()
630 if (!of_device_is_compatible(np, "mediatek,mt2701-cs42448-machine")) in of_find_mt2701_gpio()
631 return ERR_PTR(-ENOENT); in of_find_mt2701_gpio()
633 if (!con_id || strcmp(con_id, "i2s1-in-sel")) in of_find_mt2701_gpio()
634 return ERR_PTR(-ENOENT); in of_find_mt2701_gpio()
637 legacy_id = "i2s1-in-sel-gpio1"; in of_find_mt2701_gpio()
639 legacy_id = "i2s1-in-sel-gpio2"; in of_find_mt2701_gpio()
641 return ERR_PTR(-ENOENT); in of_find_mt2701_gpio()
645 pr_info("%s is using legacy gpio name '%s' instead of '%s-gpios'\n", in of_find_mt2701_gpio()
653 * and have the name "trigger-sources" no matter which kind of phandle it is
655 * we allow looking something up that is not named "foo-gpios".
659 unsigned int idx, in of_find_trigger_gpio()
665 return ERR_PTR(-ENOENT); in of_find_trigger_gpio()
667 if (!con_id || strcmp(con_id, "trigger-sources")) in of_find_trigger_gpio()
668 return ERR_PTR(-ENOENT); in of_find_trigger_gpio()
680 unsigned int idx,
690 unsigned int idx, unsigned long *flags) in of_find_gpio()
697 /* Try GPIO property "foo-gpios" and "foo-gpio" */ in of_find_gpio()
717 * of_parse_own_gpio() - Get a GPIO hog descriptor, names and flags for GPIO API
722 * @lflags: bitmask of gpio_lookup_flags GPIO_* values - returned from
724 * @dflags: gpiod_flags - optional GPIO initialization flags
732 unsigned int idx, const char **name, in of_parse_own_gpio()
740 unsigned int i; in of_parse_own_gpio()
742 int ret; in of_parse_own_gpio()
744 chip_np = dev_of_node(&chip->gpiodev->dev); in of_parse_own_gpio()
746 return ERR_PTR(-EINVAL); in of_parse_own_gpio()
752 ret = of_property_read_u32(chip_np, "#gpio-cells", &tmp); in of_parse_own_gpio()
760 ret = of_property_read_u32_index(np, "gpios", idx * tmp + i, in of_parse_own_gpio()
774 else if (of_property_read_bool(np, "output-low")) in of_parse_own_gpio()
776 else if (of_property_read_bool(np, "output-high")) in of_parse_own_gpio()
781 return ERR_PTR(-EINVAL); in of_parse_own_gpio()
784 if (name && of_property_read_string(np, "line-name", name)) in of_parse_own_gpio()
785 *name = np->name; in of_parse_own_gpio()
791 * of_gpiochip_add_hog - Add all hogs in a hog device node
798 static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog) in of_gpiochip_add_hog()
804 unsigned int i; in of_gpiochip_add_hog()
805 int ret; in of_gpiochip_add_hog()
817 WRITE_ONCE(desc->hog, hog); in of_gpiochip_add_hog()
825 * of_gpiochip_scan_gpios - Scan gpio-controller for gpio definitions
834 static int of_gpiochip_scan_gpios(struct gpio_chip *chip) in of_gpiochip_scan_gpios()
836 int ret; in of_gpiochip_scan_gpios()
838 for_each_available_child_of_node_scoped(dev_of_node(&chip->gpiodev->dev), np) { in of_gpiochip_scan_gpios()
839 if (!of_property_read_bool(np, "gpio-hog")) in of_gpiochip_scan_gpios()
854 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
864 if (READ_ONCE(desc->hog) == hog) in of_gpiochip_remove_hog()
868 static int of_gpiochip_match_node(struct gpio_chip *chip, const void *data) in of_gpiochip_match_node()
870 return device_match_of_node(&chip->gpiodev->dev, data); in of_gpiochip_match_node()
878 static int of_gpio_notify(struct notifier_block *nb, unsigned long action, in of_gpio_notify()
883 int ret; in of_gpio_notify()
886 * This only supports adding and removing complete gpio-hog nodes. in of_gpio_notify()
887 * Modifying an existing gpio-hog node is not supported (except for in of_gpio_notify()
893 if (!of_property_read_bool(rd->dn, "gpio-hog")) in of_gpio_notify()
896 if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) in of_gpio_notify()
899 gdev = of_find_gpio_device_by_node(rd->dn->parent); in of_gpio_notify()
903 ret = of_gpiochip_add_hog(gpio_device_get_chip(gdev), rd->dn); in of_gpio_notify()
906 rd->dn); in of_gpio_notify()
907 of_node_clear_flag(rd->dn, OF_POPULATED); in of_gpio_notify()
913 if (!of_node_check_flag(rd->dn, OF_POPULATED)) in of_gpio_notify()
916 gdev = of_find_gpio_device_by_node(rd->dn->parent); in of_gpio_notify()
920 of_gpiochip_remove_hog(gpio_device_get_chip(gdev), rd->dn); in of_gpio_notify()
921 of_node_clear_flag(rd->dn, OF_POPULATED); in of_gpio_notify()
934 * of_gpio_simple_xlate - translate gpiospec to the GPIO number and flags
946 static int of_gpio_simple_xlate(struct gpio_chip *gc, in of_gpio_simple_xlate()
953 * number and the flags from a single gpio cell -- this is possible, in of_gpio_simple_xlate()
956 if (gc->of_gpio_n_cells < 2) { in of_gpio_simple_xlate()
958 return -EINVAL; in of_gpio_simple_xlate()
961 if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) in of_gpio_simple_xlate()
962 return -EINVAL; in of_gpio_simple_xlate()
964 if (gpiospec->args[0] >= gc->ngpio) in of_gpio_simple_xlate()
965 return -EINVAL; in of_gpio_simple_xlate()
968 *flags = gpiospec->args[1]; in of_gpio_simple_xlate()
970 return gpiospec->args[0]; in of_gpio_simple_xlate()
974 #include <linux/gpio/legacy-of-mm-gpiochip.h>
976 * of_mm_gpiochip_add_data - Add memory mapped GPIO chip (bank)
984 * - all the callbacks
985 * - of_gpio_n_cells
986 * - of_xlate callback (optional)
989 * - save_regs callback (optional)
993 * to manage GPIOs from the callbacks.
998 int of_mm_gpiochip_add_data(struct device_node *np, in of_mm_gpiochip_add_data()
1002 int ret = -ENOMEM; in of_mm_gpiochip_add_data()
1003 struct gpio_chip *gc = &mm_gc->gc; in of_mm_gpiochip_add_data()
1005 gc->label = kasprintf(GFP_KERNEL, "%pOF", np); in of_mm_gpiochip_add_data()
1006 if (!gc->label) in of_mm_gpiochip_add_data()
1009 mm_gc->regs = of_iomap(np, 0); in of_mm_gpiochip_add_data()
1010 if (!mm_gc->regs) in of_mm_gpiochip_add_data()
1013 gc->base = -1; in of_mm_gpiochip_add_data()
1015 if (mm_gc->save_regs) in of_mm_gpiochip_add_data()
1016 mm_gc->save_regs(mm_gc); in of_mm_gpiochip_add_data()
1018 fwnode_handle_put(mm_gc->gc.fwnode); in of_mm_gpiochip_add_data()
1019 mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np)); in of_mm_gpiochip_add_data()
1028 iounmap(mm_gc->regs); in of_mm_gpiochip_add_data()
1030 kfree(gc->label); in of_mm_gpiochip_add_data()
1038 * of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank)
1043 struct gpio_chip *gc = &mm_gc->gc; in of_mm_gpiochip_remove()
1046 iounmap(mm_gc->regs); in of_mm_gpiochip_remove()
1047 kfree(gc->label); in of_mm_gpiochip_remove()
1053 static int of_gpiochip_add_pin_range(struct gpio_chip *chip) in of_gpiochip_add_pin_range()
1058 int index = 0, ret, trim; in of_gpiochip_add_pin_range()
1060 static const char group_names_propname[] = "gpio-ranges-group-names"; in of_gpiochip_add_pin_range()
1063 np = dev_of_node(&chip->gpiodev->dev); in of_gpiochip_add_pin_range()
1070 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, in of_gpiochip_add_pin_range()
1078 return -EPROBE_DEFER; in of_gpiochip_add_pin_range()
1081 if (pinspec.args[0] >= (chip->offset + chip->ngpio)) in of_gpiochip_add_pin_range()
1083 if (pinspec.args[0] + pinspec.args[2] <= chip->offset) in of_gpiochip_add_pin_range()
1100 if (chip->offset > pinspec.args[0]) { in of_gpiochip_add_pin_range()
1101 trim = chip->offset - pinspec.args[0]; in of_gpiochip_add_pin_range()
1102 pinspec.args[2] -= trim; in of_gpiochip_add_pin_range()
1106 pinspec.args[0] -= chip->offset; in of_gpiochip_add_pin_range()
1108 if ((pinspec.args[0] + pinspec.args[2]) > chip->ngpio) in of_gpiochip_add_pin_range()
1109 pinspec.args[2] = chip->ngpio - pinspec.args[0]; in of_gpiochip_add_pin_range()
1121 pr_err("%pOF: Illegal gpio-range format.\n", in of_gpiochip_add_pin_range()
1155 static int of_gpiochip_add_pin_range(struct gpio_chip *chip) { return 0; } in of_gpiochip_add_pin_range()
1158 int of_gpiochip_add(struct gpio_chip *chip) in of_gpiochip_add()
1161 int ret; in of_gpiochip_add()
1163 np = dev_of_node(&chip->gpiodev->dev); in of_gpiochip_add()
1167 if (!chip->of_xlate) { in of_gpiochip_add()
1168 chip->of_gpio_n_cells = 2; in of_gpiochip_add()
1169 chip->of_xlate = of_gpio_simple_xlate; in of_gpiochip_add()
1172 if (chip->of_gpio_n_cells > MAX_PHANDLE_ARGS) in of_gpiochip_add()
1173 return -EINVAL; in of_gpiochip_add()
1190 of_node_put(dev_of_node(&chip->gpiodev->dev)); in of_gpiochip_remove()