Lines Matching refs:np
63 static int of_gpio_named_count(const struct device_node *np, in of_gpio_named_count() argument
66 return of_count_phandle_with_args(np, propname, "#gpio-cells"); in of_gpio_named_count()
83 struct device_node *np = dev->of_node; in of_gpio_spi_cs_get_count() local
89 if (!of_device_is_compatible(np, "fsl,spi") && in of_gpio_spi_cs_get_count()
90 !of_device_is_compatible(np, "aeroflexgaisler,spictrl") && in of_gpio_spi_cs_get_count()
91 !of_device_is_compatible(np, "ibm,ppc4xx-spi")) in of_gpio_spi_cs_get_count()
93 return of_gpio_named_count(np, "gpios"); in of_gpio_spi_cs_get_count()
125 return device_match_of_node(&chip->gpiodev->dev, gpiospec->np) && in of_gpiochip_match_node_and_xlate()
156 static void of_gpio_quirk_polarity(const struct device_node *np, in of_gpio_quirk_polarity() argument
163 of_node_full_name(np)); in of_gpio_quirk_polarity()
169 of_node_full_name(np)); in of_gpio_quirk_polarity()
178 static void of_gpio_try_fixup_polarity(const struct device_node *np, in of_gpio_try_fixup_polarity() argument
200 if (of_device_is_compatible(np, gpios[i].compatible) && in of_gpio_try_fixup_polarity()
202 of_gpio_quirk_polarity(np, gpios[i].active_high, flags); in of_gpio_try_fixup_polarity()
208 static void of_gpio_set_polarity_by_property(const struct device_node *np, in of_gpio_set_polarity_by_property() argument
212 const struct device_node *np_compat = np; in of_gpio_set_polarity_by_property()
213 const struct device_node *np_propname = np; in of_gpio_set_polarity_by_property()
270 if (of_device_is_compatible(np->parent, "atmel,hsmci")) { in of_gpio_set_polarity_by_property()
271 np_compat = np->parent; in of_gpio_set_polarity_by_property()
272 np_propname = np; in of_gpio_set_polarity_by_property()
281 of_gpio_quirk_polarity(np, active_high, flags); in of_gpio_set_polarity_by_property()
287 static void of_gpio_flags_quirks(const struct device_node *np, in of_gpio_flags_quirks() argument
292 of_gpio_try_fixup_polarity(np, propname, flags); in of_gpio_flags_quirks()
293 of_gpio_set_polarity_by_property(np, propname, flags); in of_gpio_flags_quirks()
299 of_device_is_compatible(np, "reg-fixed-voltage") && in of_gpio_flags_quirks()
300 of_property_read_bool(np, "gpio-open-drain")) { in of_gpio_flags_quirks()
303 of_node_full_name(np)); in of_gpio_flags_quirks()
312 of_property_read_bool(np, "cs-gpios")) { in of_gpio_flags_quirks()
317 for_each_child_of_node(np, child) { in of_gpio_flags_quirks()
347 of_property_read_bool(np, "snps,reset-active-low")) in of_gpio_flags_quirks()
362 static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np, in of_get_named_gpiod_flags() argument
370 ret = of_parse_phandle_with_args_map(np, propname, "gpio", index, in of_get_named_gpiod_flags()
374 __func__, propname, np, index); in of_get_named_gpiod_flags()
389 of_gpio_flags_quirks(np, propname, flags, index); in of_get_named_gpiod_flags()
392 __func__, propname, np, index, in of_get_named_gpiod_flags()
396 of_node_put(gpiospec.np); in of_get_named_gpiod_flags()
410 int of_get_named_gpio(const struct device_node *np, const char *propname, in of_get_named_gpio() argument
415 desc = of_get_named_gpiod_flags(np, propname, index, NULL); in of_get_named_gpio()
454 static struct gpio_desc *of_find_gpio_rename(struct device_node *np, in of_find_gpio_rename() argument
571 !of_device_is_compatible(np, gpios[i].compatible)) in of_find_gpio_rename()
575 desc = of_get_named_gpiod_flags(np, legacy_id, idx, of_flags); in of_find_gpio_rename()
578 of_node_full_name(np), legacy_id, con_id); in of_find_gpio_rename()
586 static struct gpio_desc *of_find_mt2701_gpio(struct device_node *np, in of_find_mt2701_gpio() argument
597 if (!of_device_is_compatible(np, "mediatek,mt2701-cs42448-machine")) in of_find_mt2701_gpio()
610 desc = of_get_named_gpiod_flags(np, legacy_id, 0, of_flags); in of_find_mt2701_gpio()
613 of_node_full_name(np), legacy_id, con_id); in of_find_mt2701_gpio()
618 typedef struct gpio_desc *(*of_find_gpio_quirk)(struct device_node *np,
628 struct gpio_desc *of_find_gpio(struct device_node *np, const char *con_id, in of_find_gpio() argument
646 desc = of_get_named_gpiod_flags(np, prop_name, idx, &of_flags); in of_find_gpio()
654 desc = (*q)(np, con_id, idx, &of_flags); in of_find_gpio()
677 static struct gpio_desc *of_parse_own_gpio(struct device_node *np, in of_parse_own_gpio() argument
703 gpiospec.np = chip_np; in of_parse_own_gpio()
707 ret = of_property_read_u32_index(np, "gpios", idx * tmp + i, in of_parse_own_gpio()
719 if (of_property_read_bool(np, "input")) in of_parse_own_gpio()
721 else if (of_property_read_bool(np, "output-low")) in of_parse_own_gpio()
723 else if (of_property_read_bool(np, "output-high")) in of_parse_own_gpio()
727 desc_to_gpio(desc), np); in of_parse_own_gpio()
731 if (name && of_property_read_string(np, "line-name", name)) in of_parse_own_gpio()
732 *name = np->name; in of_parse_own_gpio()
780 struct device_node *np; in of_gpiochip_scan_gpios() local
783 for_each_available_child_of_node(dev_of_node(&chip->gpiodev->dev), np) { in of_gpiochip_scan_gpios()
784 if (!of_property_read_bool(np, "gpio-hog")) in of_gpiochip_scan_gpios()
787 ret = of_gpiochip_add_hog(chip, np); in of_gpiochip_scan_gpios()
789 of_node_put(np); in of_gpiochip_scan_gpios()
793 of_node_set_flag(np, OF_POPULATED); in of_gpiochip_scan_gpios()
820 static struct gpio_chip *of_find_gpiochip_by_node(struct device_node *np) in of_find_gpiochip_by_node() argument
822 return gpiochip_find(np, of_gpiochip_match_node); in of_find_gpiochip_by_node()
939 int of_mm_gpiochip_add_data(struct device_node *np, in of_mm_gpiochip_add_data() argument
946 gc->label = kasprintf(GFP_KERNEL, "%pOF", np); in of_mm_gpiochip_add_data()
950 mm_gc->regs = of_iomap(np, 0); in of_mm_gpiochip_add_data()
960 mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np)); in of_mm_gpiochip_add_data()
968 of_node_put(np); in of_mm_gpiochip_add_data()
973 pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret); in of_mm_gpiochip_add_data()
998 struct device_node *np; in of_gpiochip_add_pin_range() local
1004 np = dev_of_node(&chip->gpiodev->dev); in of_gpiochip_add_pin_range()
1005 if (!np) in of_gpiochip_add_pin_range()
1008 group_names = of_find_property(np, group_names_propname, NULL); in of_gpiochip_add_pin_range()
1011 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, in of_gpiochip_add_pin_range()
1016 pctldev = of_pinctrl_get(pinspec.np); in of_gpiochip_add_pin_range()
1017 of_node_put(pinspec.np); in of_gpiochip_add_pin_range()
1023 of_property_read_string_index(np, in of_gpiochip_add_pin_range()
1028 np); in of_gpiochip_add_pin_range()
1044 np); in of_gpiochip_add_pin_range()
1050 np, group_names_propname); in of_gpiochip_add_pin_range()
1054 ret = of_property_read_string_index(np, in of_gpiochip_add_pin_range()
1062 np); in of_gpiochip_add_pin_range()
1082 struct device_node *np; in of_gpiochip_add() local
1085 np = dev_of_node(&chip->gpiodev->dev); in of_gpiochip_add()
1086 if (!np) in of_gpiochip_add()
1101 of_node_get(np); in of_gpiochip_add()
1105 of_node_put(np); in of_gpiochip_add()