Lines Matching refs:chip

33  * established "cs-gpios" for chip selects but instead rely on
34 * "gpios" for the chip select lines. If we detect this, we redirect
87 static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
91 return chip->gpiodev->dev.of_node == gpiospec->np && chip->of_xlate && chip->of_xlate(chip, gpiospec, NULL) >= 0;
99 static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *chip, struct of_phandle_args *gpiospec,
104 if (chip->of_gpio_n_cells != gpiospec->args_count) {
108 ret = chip->of_xlate(chip, gpiospec, flags);
113 return gpiochip_get_desc(chip, ret);
170 * Legacy handling of SPI active high chip select. If we have a
187 * SPI children have active low chip selects
237 struct gpio_chip *chip;
247 chip = of_find_gpiochip_by_xlate(&gpiospec);
248 if (!chip) {
253 desc = of_xlate_and_get_gpiod_flags(chip, &gpiospec, flags);
394 * The old Freescale bindings use simply "gpios" as name for the chip select
570 * @chip: GPIO chip whose hog is parsed
580 static struct gpio_desc *of_parse_own_gpio(struct device_node *np, struct gpio_chip *chip, unsigned int idx,
591 chip_np = chip->of_node;
615 desc = of_xlate_and_get_gpiod_flags(chip, &gpiospec, &xlate_flags);
653 * @chip: gpio chip to act on
658 static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog)
668 desc = of_parse_own_gpio(hog, chip, i, &name, &lflags, &dflags);
688 * @chip: gpio chip to act on
694 static int of_gpiochip_scan_gpios(struct gpio_chip *chip)
699 for_each_available_child_of_node(chip->of_node, np)
705 ret = of_gpiochip_add_hog(chip, np);
720 * @chip: gpio chip to act on
723 static void of_gpiochip_remove_hog(struct gpio_chip *chip, struct device_node *hog)
725 struct gpio_desc *descs = chip->gpiodev->descs;
728 for (i = 0; i < chip->ngpio; i++) {
735 static int of_gpiochip_match_node(struct gpio_chip *chip, void *data)
737 return chip->gpiodev->dev.of_node == data;
748 struct gpio_chip *chip;
767 chip = of_find_gpiochip_by_node(rd->dn->parent);
768 if (chip == NULL) {
772 ret = of_gpiochip_add_hog(chip, rd->dn);
785 chip = of_find_gpiochip_by_node(rd->dn->parent);
786 if (chip == NULL) {
790 of_gpiochip_remove_hog(chip, rd->dn);
842 * of_mm_gpiochip_add_data - Add memory mapped GPIO chip (bank)
843 * @np: device node of the GPIO chip
891 pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret);
897 * of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank)
914 static void of_gpiochip_init_valid_mask(struct gpio_chip *chip)
918 struct device_node *np = chip->of_node;
928 if (start >= chip->ngpio || start + count > chip->ngpio) {
932 bitmap_clear(chip->valid_mask, start, count);
937 static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
941 struct device_node *np = chip->of_node;
952 chip->of_gpio_ranges_fallback) {
953 return chip->of_gpio_ranges_fallback(chip, np);
979 ret = gpiochip_add_pin_range(chip, pinctrl_dev_get_devname(pctldev), pinspec.args[0x0], pinspec.args[0x1],
1006 ret = gpiochip_add_pingroup_range(chip, pctldev, pinspec.args[0], name);
1017 static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
1023 int of_gpiochip_add(struct gpio_chip *chip)
1027 if (!chip->of_node) {
1031 if (!chip->of_xlate) {
1032 chip->of_gpio_n_cells = 0x2;
1033 chip->of_xlate = of_gpio_simple_xlate;
1036 if (chip->of_gpio_n_cells > MAX_PHANDLE_ARGS) {
1040 of_gpiochip_init_valid_mask(chip);
1042 ret = of_gpiochip_add_pin_range(chip);
1047 of_node_get(chip->of_node);
1049 ret = of_gpiochip_scan_gpios(chip);
1051 of_node_put(chip->of_node);
1057 void of_gpiochip_remove(struct gpio_chip *chip)
1059 of_node_put(chip->of_node);