Lines Matching defs:desc
34 struct gpio_desc *desc;
75 struct gpio_desc *desc = data->desc;
80 gpiod_get_direction(desc);
81 value = !!test_bit(FLAG_IS_OUT, &desc->flags);
92 struct gpio_desc *desc = data->desc;
98 status = gpiod_direction_output_raw(desc, 1);
100 status = gpiod_direction_output_raw(desc, 0);
102 status = gpiod_direction_input(desc);
116 struct gpio_desc *desc = data->desc;
121 status = gpiod_get_value_cansleep(desc);
135 struct gpio_desc *desc = data->desc;
143 if (!test_bit(FLAG_IS_OUT, &desc->flags)) {
146 gpiod_set_value_cansleep(desc, value);
169 struct gpio_desc *desc = data->desc;
173 data->irq = gpiod_to_irq(desc);
183 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
186 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
197 ret = gpiochip_lock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc));
211 gpiochip_unlock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc));
225 struct gpio_desc *desc = data->desc;
229 gpiochip_unlock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc));
296 struct gpio_desc *desc = data->desc;
300 if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value)
303 assign_bit(FLAG_ACTIVE_LOW, &desc->flags, value);
319 struct gpio_desc *desc = data->desc;
324 value = !!test_bit(FLAG_ACTIVE_LOW, &desc->flags);
357 struct gpio_desc *desc = data->desc;
365 if (gpiod_to_irq(desc) < 0)
367 if (!show_direction && test_bit(FLAG_IS_OUT, &desc->flags))
445 struct gpio_desc *desc;
454 desc = gpio_to_desc(gpio);
456 if (!desc) {
460 gc = desc->gdev->chip;
461 offset = gpio_chip_hwgpio(desc);
472 status = gpiod_request_user(desc, "sysfs");
476 status = gpiod_set_transitory(desc, false);
478 gpiod_free(desc);
482 status = gpiod_export(desc, true);
484 gpiod_free(desc);
486 set_bit(FLAG_SYSFS, &desc->flags);
500 struct gpio_desc *desc;
507 desc = gpio_to_desc(gpio);
509 if (!desc) {
520 if (test_and_clear_bit(FLAG_SYSFS, &desc->flags)) {
521 gpiod_unexport(desc);
522 gpiod_free(desc);
547 * @desc: GPIO to make available, already requested
560 int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
577 if (!desc) {
582 gdev = desc->gdev;
594 if (!test_bit(FLAG_REQUESTED, &desc->flags) ||
595 test_bit(FLAG_EXPORT, &desc->flags)) {
597 gpiod_dbg(desc, "%s: unavailable (requested=%d, exported=%d)\n",
599 test_bit(FLAG_REQUESTED, &desc->flags),
600 test_bit(FLAG_EXPORT, &desc->flags));
612 data->desc = desc;
619 offset = gpio_chip_hwgpio(desc);
626 desc_to_gpio(desc));
632 set_bit(FLAG_EXPORT, &desc->flags);
640 gpiod_dbg(desc, "%s: status %d\n", __func__, status);
645 static int match_export(struct device *dev, const void *desc)
649 return data->desc == desc;
656 * @desc: GPIO to create symlink to, already exported
664 struct gpio_desc *desc)
669 if (!desc) {
674 cdev = class_find_device(&gpio_class, NULL, desc, match_export);
687 * @desc: GPIO to make unavailable
691 void gpiod_unexport(struct gpio_desc *desc)
696 if (!desc) {
703 if (!test_bit(FLAG_EXPORT, &desc->flags))
706 dev = class_find_device(&gpio_class, NULL, desc, match_export);
712 clear_bit(FLAG_EXPORT, &desc->flags);
774 struct gpio_desc *desc;
788 for_each_gpio_desc_with_flag(chip, desc, FLAG_SYSFS) {
789 gpiod_unexport(desc);
790 gpiod_free(desc);