Lines Matching refs:desc

36 	struct gpio_desc *desc;
77 struct gpio_desc *desc = data->desc;
82 gpiod_get_direction(desc);
83 value = !!test_bit(FLAG_IS_OUT, &desc->flags);
94 struct gpio_desc *desc = data->desc;
100 status = gpiod_direction_output_raw(desc, 1);
102 status = gpiod_direction_output_raw(desc, 0);
104 status = gpiod_direction_input(desc);
118 struct gpio_desc *desc = data->desc;
123 status = gpiod_get_value_cansleep(desc);
137 struct gpio_desc *desc = data->desc;
145 if (!test_bit(FLAG_IS_OUT, &desc->flags)) {
148 gpiod_set_value_cansleep(desc, value);
171 struct gpio_desc *desc = data->desc;
175 CLASS(gpio_chip_guard, guard)(desc);
179 data->irq = gpiod_to_irq(desc);
189 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
192 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
203 ret = gpiochip_lock_as_irq(guard.gc, gpio_chip_hwgpio(desc));
217 gpiochip_unlock_as_irq(guard.gc, gpio_chip_hwgpio(desc));
231 struct gpio_desc *desc = data->desc;
233 CLASS(gpio_chip_guard, guard)(desc);
239 gpiochip_unlock_as_irq(guard.gc, gpio_chip_hwgpio(desc));
307 struct gpio_desc *desc = data->desc;
311 if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value)
314 assign_bit(FLAG_ACTIVE_LOW, &desc->flags, value);
330 struct gpio_desc *desc = data->desc;
335 value = !!test_bit(FLAG_ACTIVE_LOW, &desc->flags);
368 struct gpio_desc *desc = data->desc;
376 if (gpiod_to_irq(desc) < 0)
378 if (!show_direction && test_bit(FLAG_IS_OUT, &desc->flags))
455 struct gpio_desc *desc;
463 desc = gpio_to_desc(gpio);
465 if (!desc) {
470 CLASS(gpio_chip_guard, guard)(desc);
474 offset = gpio_chip_hwgpio(desc);
485 status = gpiod_request_user(desc, "sysfs");
489 status = gpiod_set_transitory(desc, false);
491 gpiod_free(desc);
495 status = gpiod_export(desc, true);
497 gpiod_free(desc);
499 set_bit(FLAG_SYSFS, &desc->flags);
512 struct gpio_desc *desc;
520 desc = gpio_to_desc(gpio);
522 if (!desc) {
533 if (test_and_clear_bit(FLAG_SYSFS, &desc->flags)) {
534 gpiod_unexport(desc);
535 gpiod_free(desc);
560 * @desc: GPIO to make available, already requested
573 int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
587 if (!desc) {
592 CLASS(gpio_chip_guard, guard)(desc);
596 if (test_and_set_bit(FLAG_EXPORT, &desc->flags))
599 gdev = desc->gdev;
609 if (!test_bit(FLAG_REQUESTED, &desc->flags)) {
610 gpiod_dbg(desc, "%s: unavailable (not requested)\n", __func__);
621 data->desc = desc;
628 offset = gpio_chip_hwgpio(desc);
635 desc_to_gpio(desc));
648 clear_bit(FLAG_EXPORT, &desc->flags);
649 gpiod_dbg(desc, "%s: status %d\n", __func__, status);
654 static int match_export(struct device *dev, const void *desc)
658 return data->desc == desc;
665 * @desc: GPIO to create symlink to, already exported
673 struct gpio_desc *desc)
678 if (!desc) {
683 cdev = class_find_device(&gpio_class, NULL, desc, match_export);
696 * @desc: GPIO to make unavailable
700 void gpiod_unexport(struct gpio_desc *desc)
705 if (!desc) {
712 if (!test_bit(FLAG_EXPORT, &desc->flags))
715 dev = class_find_device(&gpio_class, NULL, desc, match_export);
721 clear_bit(FLAG_EXPORT, &desc->flags);
789 struct gpio_desc *desc;
809 for_each_gpio_desc_with_flag(chip, desc, FLAG_SYSFS) {
810 gpiod_unexport(desc);
811 gpiod_free(desc);