Lines Matching refs:desc

35 	struct gpio_desc *desc;  member
76 struct gpio_desc *desc = data->desc; in direction_show() local
81 gpiod_get_direction(desc); in direction_show()
82 value = !!test_bit(FLAG_IS_OUT, &desc->flags); in direction_show()
93 struct gpio_desc *desc = data->desc; in direction_store() local
99 status = gpiod_direction_output_raw(desc, 1); in direction_store()
101 status = gpiod_direction_output_raw(desc, 0); in direction_store()
103 status = gpiod_direction_input(desc); in direction_store()
117 struct gpio_desc *desc = data->desc; in value_show() local
122 status = gpiod_get_value_cansleep(desc); in value_show()
136 struct gpio_desc *desc = data->desc; in value_store() local
144 if (!test_bit(FLAG_IS_OUT, &desc->flags)) { in value_store()
147 gpiod_set_value_cansleep(desc, value); in value_store()
170 struct gpio_desc *desc = data->desc; in gpio_sysfs_request_irq() local
174 data->irq = gpiod_to_irq(desc); in gpio_sysfs_request_irq()
184 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? in gpio_sysfs_request_irq()
187 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? in gpio_sysfs_request_irq()
198 ret = gpiochip_lock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc)); in gpio_sysfs_request_irq()
212 gpiochip_unlock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc)); in gpio_sysfs_request_irq()
226 struct gpio_desc *desc = data->desc; in gpio_sysfs_free_irq() local
230 gpiochip_unlock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc)); in gpio_sysfs_free_irq()
297 struct gpio_desc *desc = data->desc; in gpio_sysfs_set_active_low() local
301 if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value) in gpio_sysfs_set_active_low()
304 assign_bit(FLAG_ACTIVE_LOW, &desc->flags, value); in gpio_sysfs_set_active_low()
320 struct gpio_desc *desc = data->desc; in active_low_show() local
325 value = !!test_bit(FLAG_ACTIVE_LOW, &desc->flags); in active_low_show()
358 struct gpio_desc *desc = data->desc; in gpio_is_visible() local
366 if (gpiod_to_irq(desc) < 0) in gpio_is_visible()
368 if (!show_direction && test_bit(FLAG_IS_OUT, &desc->flags)) in gpio_is_visible()
446 struct gpio_desc *desc; in export_store() local
455 desc = gpio_to_desc(gpio); in export_store()
457 if (!desc) { in export_store()
461 gc = desc->gdev->chip; in export_store()
462 offset = gpio_chip_hwgpio(desc); in export_store()
473 status = gpiod_request_user(desc, "sysfs"); in export_store()
477 status = gpiod_set_transitory(desc, false); in export_store()
479 gpiod_free(desc); in export_store()
483 status = gpiod_export(desc, true); in export_store()
485 gpiod_free(desc); in export_store()
487 set_bit(FLAG_SYSFS, &desc->flags); in export_store()
501 struct gpio_desc *desc; in unexport_store() local
508 desc = gpio_to_desc(gpio); in unexport_store()
510 if (!desc) { in unexport_store()
521 if (test_and_clear_bit(FLAG_SYSFS, &desc->flags)) { in unexport_store()
522 gpiod_unexport(desc); in unexport_store()
523 gpiod_free(desc); in unexport_store()
561 int gpiod_export(struct gpio_desc *desc, bool direction_may_change) in gpiod_export() argument
578 if (!desc) { in gpiod_export()
583 gdev = desc->gdev; in gpiod_export()
595 if (!test_bit(FLAG_REQUESTED, &desc->flags) || in gpiod_export()
596 test_bit(FLAG_EXPORT, &desc->flags)) { in gpiod_export()
598 gpiod_dbg(desc, "%s: unavailable (requested=%d, exported=%d)\n", in gpiod_export()
600 test_bit(FLAG_REQUESTED, &desc->flags), in gpiod_export()
601 test_bit(FLAG_EXPORT, &desc->flags)); in gpiod_export()
613 data->desc = desc; in gpiod_export()
620 offset = gpio_chip_hwgpio(desc); in gpiod_export()
627 desc_to_gpio(desc)); in gpiod_export()
633 set_bit(FLAG_EXPORT, &desc->flags); in gpiod_export()
641 gpiod_dbg(desc, "%s: status %d\n", __func__, status); in gpiod_export()
646 static int match_export(struct device *dev, const void *desc) in match_export() argument
650 return data->desc == desc; in match_export()
665 struct gpio_desc *desc) in gpiod_export_link() argument
670 if (!desc) { in gpiod_export_link()
675 cdev = class_find_device(&gpio_class, NULL, desc, match_export); in gpiod_export_link()
692 void gpiod_unexport(struct gpio_desc *desc) in gpiod_unexport() argument
697 if (!desc) { in gpiod_unexport()
704 if (!test_bit(FLAG_EXPORT, &desc->flags)) in gpiod_unexport()
707 dev = class_find_device(&gpio_class, NULL, desc, match_export); in gpiod_unexport()
713 clear_bit(FLAG_EXPORT, &desc->flags); in gpiod_unexport()
775 struct gpio_desc *desc; in gpiochip_sysfs_unregister() local
789 for_each_gpio_desc_with_flag(chip, desc, FLAG_SYSFS) { in gpiochip_sysfs_unregister()
790 gpiod_unexport(desc); in gpiochip_sysfs_unregister()
791 gpiod_free(desc); in gpiochip_sysfs_unregister()