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
218 if (of_device_is_compatible(np, gpios[i].compatible) && in of_gpio_try_fixup_polarity()
220 of_gpio_quirk_polarity(np, gpios[i].active_high, flags); in of_gpio_try_fixup_polarity()
226 static void of_gpio_set_polarity_by_property(const struct device_node *np, in of_gpio_set_polarity_by_property() argument
230 const struct device_node *np_compat = np; in of_gpio_set_polarity_by_property()
231 const struct device_node *np_propname = np; in of_gpio_set_polarity_by_property()
288 if (of_device_is_compatible(np->parent, "atmel,hsmci")) { in of_gpio_set_polarity_by_property()
289 np_compat = np->parent; in of_gpio_set_polarity_by_property()
290 np_propname = np; in of_gpio_set_polarity_by_property()
299 of_gpio_quirk_polarity(np, active_high, flags); in of_gpio_set_polarity_by_property()
305 static void of_gpio_flags_quirks(const struct device_node *np, in of_gpio_flags_quirks() argument
310 of_gpio_try_fixup_polarity(np, propname, flags); in of_gpio_flags_quirks()
311 of_gpio_set_polarity_by_property(np, propname, flags); in of_gpio_flags_quirks()
317 of_device_is_compatible(np, "reg-fixed-voltage") && in of_gpio_flags_quirks()
318 of_property_read_bool(np, "gpio-open-drain")) { in of_gpio_flags_quirks()
321 of_node_full_name(np)); in of_gpio_flags_quirks()
330 of_property_read_bool(np, "cs-gpios")) { in of_gpio_flags_quirks()
335 for_each_child_of_node(np, child) { in of_gpio_flags_quirks()
365 of_property_read_bool(np, "snps,reset-active-low")) in of_gpio_flags_quirks()
380 static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np, in of_get_named_gpiod_flags() argument
388 ret = of_parse_phandle_with_args_map(np, propname, "gpio", index, in of_get_named_gpiod_flags()
392 __func__, propname, np, index); in of_get_named_gpiod_flags()
407 of_gpio_flags_quirks(np, propname, flags, index); in of_get_named_gpiod_flags()
410 __func__, propname, np, index, in of_get_named_gpiod_flags()
414 of_node_put(gpiospec.np); in of_get_named_gpiod_flags()
428 int of_get_named_gpio(const struct device_node *np, const char *propname, in of_get_named_gpio() argument
433 desc = of_get_named_gpiod_flags(np, propname, index, NULL); in of_get_named_gpio()
472 static struct gpio_desc *of_find_gpio_rename(struct device_node *np, in of_find_gpio_rename() argument
589 !of_device_is_compatible(np, gpios[i].compatible)) in of_find_gpio_rename()
593 desc = of_get_named_gpiod_flags(np, legacy_id, idx, of_flags); in of_find_gpio_rename()
596 of_node_full_name(np), legacy_id, con_id); in of_find_gpio_rename()
604 static struct gpio_desc *of_find_mt2701_gpio(struct device_node *np, in of_find_mt2701_gpio() argument
615 if (!of_device_is_compatible(np, "mediatek,mt2701-cs42448-machine")) in of_find_mt2701_gpio()
628 desc = of_get_named_gpiod_flags(np, legacy_id, 0, of_flags); in of_find_mt2701_gpio()
631 of_node_full_name(np), legacy_id, con_id); in of_find_mt2701_gpio()
636 typedef struct gpio_desc *(*of_find_gpio_quirk)(struct device_node *np,
646 struct gpio_desc *of_find_gpio(struct device_node *np, const char *con_id, in of_find_gpio() argument
664 desc = of_get_named_gpiod_flags(np, prop_name, idx, &of_flags); in of_find_gpio()
672 desc = (*q)(np, con_id, idx, &of_flags); in of_find_gpio()
695 static struct gpio_desc *of_parse_own_gpio(struct device_node *np, in of_parse_own_gpio() argument
721 gpiospec.np = chip_np; in of_parse_own_gpio()
725 ret = of_property_read_u32_index(np, "gpios", idx * tmp + i, in of_parse_own_gpio()
737 if (of_property_read_bool(np, "input")) in of_parse_own_gpio()
739 else if (of_property_read_bool(np, "output-low")) in of_parse_own_gpio()
741 else if (of_property_read_bool(np, "output-high")) in of_parse_own_gpio()
745 desc_to_gpio(desc), np); in of_parse_own_gpio()
749 if (name && of_property_read_string(np, "line-name", name)) in of_parse_own_gpio()
750 *name = np->name; in of_parse_own_gpio()
798 struct device_node *np; in of_gpiochip_scan_gpios() local
801 for_each_available_child_of_node(dev_of_node(&chip->gpiodev->dev), np) { in of_gpiochip_scan_gpios()
802 if (!of_property_read_bool(np, "gpio-hog")) in of_gpiochip_scan_gpios()
805 ret = of_gpiochip_add_hog(chip, np); in of_gpiochip_scan_gpios()
807 of_node_put(np); in of_gpiochip_scan_gpios()
811 of_node_set_flag(np, OF_POPULATED); in of_gpiochip_scan_gpios()
838 static struct gpio_chip *of_find_gpiochip_by_node(struct device_node *np) in of_find_gpiochip_by_node() argument
840 return gpiochip_find(np, of_gpiochip_match_node); in of_find_gpiochip_by_node()
957 int of_mm_gpiochip_add_data(struct device_node *np, in of_mm_gpiochip_add_data() argument
964 gc->label = kasprintf(GFP_KERNEL, "%pOF", np); in of_mm_gpiochip_add_data()
968 mm_gc->regs = of_iomap(np, 0); in of_mm_gpiochip_add_data()
978 mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np)); in of_mm_gpiochip_add_data()
986 of_node_put(np); in of_mm_gpiochip_add_data()
991 pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret); in of_mm_gpiochip_add_data()
1016 struct device_node *np; in of_gpiochip_add_pin_range() local
1022 np = dev_of_node(&chip->gpiodev->dev); in of_gpiochip_add_pin_range()
1023 if (!np) in of_gpiochip_add_pin_range()
1026 group_names = of_find_property(np, group_names_propname, NULL); in of_gpiochip_add_pin_range()
1029 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, in of_gpiochip_add_pin_range()
1034 pctldev = of_pinctrl_get(pinspec.np); in of_gpiochip_add_pin_range()
1035 of_node_put(pinspec.np); in of_gpiochip_add_pin_range()
1041 of_property_read_string_index(np, in of_gpiochip_add_pin_range()
1046 np); in of_gpiochip_add_pin_range()
1062 np); in of_gpiochip_add_pin_range()
1068 np, group_names_propname); in of_gpiochip_add_pin_range()
1072 ret = of_property_read_string_index(np, in of_gpiochip_add_pin_range()
1080 np); in of_gpiochip_add_pin_range()
1100 struct device_node *np; in of_gpiochip_add() local
1103 np = dev_of_node(&chip->gpiodev->dev); in of_gpiochip_add()
1104 if (!np) in of_gpiochip_add()
1119 of_node_get(np); in of_gpiochip_add()
1123 of_node_put(np); in of_gpiochip_add()