Lines Matching refs:np

40     struct device_node *np = dev->of_node;
48 if (!of_device_is_compatible(np, "fsl,spi") && !of_device_is_compatible(np, "aeroflexgaisler,spictrl") &&
49 !of_device_is_compatible(np, "ibm,ppc4xx-spi")) {
52 return of_gpio_named_count(np, "gpios");
91 return chip->gpiodev->dev.of_node == gpiospec->np && chip->of_xlate && chip->of_xlate(chip, gpiospec, NULL) >= 0;
126 struct device_node *np = gc->of_node;
128 size = of_property_count_u32_elems(np, "gpio-reserved-ranges");
135 static void of_gpio_flags_quirks(struct device_node *np, const char *propname, enum of_gpio_flags *flags, int index)
142 (of_device_is_compatible(np, "regulator-fixed") || of_device_is_compatible(np, "reg-fixed-voltage") ||
144 of_device_is_compatible(np, "regulator-gpio")))) {
145 bool active_low = !of_property_read_bool(np, "enable-active-high");
153 pr_warn("%s GPIO handle specifies active low - ignored\n", of_node_full_name(np));
163 if (IS_ENABLED(CONFIG_REGULATOR) && of_device_is_compatible(np, "reg-fixed-voltage") &&
164 of_property_read_bool(np, "gpio-open-drain")) {
166 pr_info("%s uses legacy open drain flag - update the DTS if you can\n", of_node_full_name(np));
174 if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") && of_property_read_bool(np, "cs-gpios")) {
179 for_each_child_of_node(np, child)
217 of_property_read_bool(np, "snps,reset-active-low")) {
224 * @np: device node to get GPIO from
233 static struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, const char *propname, int index,
241 ret = of_parse_phandle_with_args_map(np, propname, "gpio", index, &gpiospec);
243 pr_debug("%s: can't parse '%s' property of node '%pOF[%d]'\n", __func__, propname, np, index);
259 of_gpio_flags_quirks(np, propname, flags, index);
262 pr_debug("%s: parsed '%s' property of node '%pOF[%d]' - status (%d)\n", __func__, propname, np, index,
266 of_node_put(gpiospec.np);
271 int of_get_named_gpio_flags(struct device_node *np, const char *list_name, int index, enum of_gpio_flags *flags)
275 desc = of_get_named_gpiod_flags(np, list_name, index, flags);
370 struct device_node *np = dev->of_node;
382 if (!of_device_is_compatible(np, "spi-gpio") || !con_id) {
389 desc = of_get_named_gpiod_flags(np, prop_name, 0, of_flags);
401 struct device_node *np = dev->of_node;
408 if (!of_device_is_compatible(np, "fsl,spi") && !of_device_is_compatible(np, "aeroflexgaisler,spictrl") &&
409 !of_device_is_compatible(np, "ibm,ppc4xx-spi")) {
438 struct device_node *np = dev->of_node;
455 desc = of_get_named_gpiod_flags(np, con_id, 0, of_flags);
569 * @np: device node to get GPIO from
580 static struct gpio_desc *of_parse_own_gpio(struct device_node *np, struct gpio_chip *chip, unsigned int idx,
605 gpiospec.np = chip_np;
609 ret = of_property_read_u32_index(np, "gpios", idx * tmp + i, &gpiospec.args[i]);
633 if (of_property_read_bool(np, "input")) {
635 } else if (of_property_read_bool(np, "output-low")) {
637 } else if (of_property_read_bool(np, "output-high")) {
640 pr_warn("GPIO line %d (%pOFn): no hogging state specified, bailing out\n", desc_to_gpio(desc), np);
644 if (name && of_property_read_string(np, "line-name", name)) {
645 *name = np->name;
696 struct device_node *np;
699 for_each_available_child_of_node(chip->of_node, np)
701 if (!of_property_read_bool(np, "gpio-hog")) {
705 ret = of_gpiochip_add_hog(chip, np);
707 of_node_put(np);
711 of_node_set_flag(np, OF_POPULATED);
740 static struct gpio_chip *of_find_gpiochip_by_node(struct device_node *np)
742 return gpiochip_find(np, of_gpiochip_match_node);
843 * @np: device node of the GPIO chip
861 int of_mm_gpiochip_add_data(struct device_node *np, struct of_mm_gpio_chip *mm_gc, void *data)
865 gc->label = kasprintf(GFP_KERNEL, "%pOF", np);
869 mm_gc->regs = of_iomap(np, 0);
878 mm_gc->gc.of_node = of_node_get(np);
886 of_node_put(np);
891 pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret);
918 struct device_node *np = chip->of_node;
920 len = of_property_count_u32_elems(np, "gpio-reserved-ranges");
926 of_property_read_u32_index(np, "gpio-reserved-ranges", i, &start);
927 of_property_read_u32_index(np, "gpio-reserved-ranges", i + 1, &count);
941 struct device_node *np = chip->of_node;
947 if (!np) {
951 if (!of_property_read_bool(np, "gpio-ranges") &&
953 return chip->of_gpio_ranges_fallback(chip, np);
956 group_names = of_find_property(np, group_names_propname, NULL);
959 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 0x3, index, &pinspec);
964 pctldev = of_pinctrl_get(pinspec.np);
965 of_node_put(pinspec.np);
972 of_property_read_string_index(np, group_names_propname, index, &name);
974 pr_err("%pOF: Group name of numeric GPIO ranges must be the empty string.\n", np);
987 pr_err("%pOF: Illegal gpio-range format.\n", np);
992 pr_err("%pOF: GPIO group range requested but no %s property.\n", np, group_names_propname);
996 ret = of_property_read_string_index(np, group_names_propname, index, &name);
1002 pr_err("%pOF: Group name of GPIO group range cannot be the empty string.\n", np);