Lines Matching defs:desc
22 struct gpio_desc *desc;
63 struct gpio_desc *desc = data->desc;
68 gpiod_get_direction(desc);
70 test_bit(FLAG_IS_OUT, &desc->flags)
82 struct gpio_desc *desc = data->desc;
88 status = gpiod_direction_output_raw(desc, 1);
90 status = gpiod_direction_output_raw(desc, 0);
92 status = gpiod_direction_input(desc);
106 struct gpio_desc *desc = data->desc;
111 status = gpiod_get_value_cansleep(desc);
128 struct gpio_desc *desc = data->desc;
133 if (!test_bit(FLAG_IS_OUT, &desc->flags)) {
144 gpiod_set_value_cansleep(desc, value);
168 struct gpio_desc *desc = data->desc;
172 data->irq = gpiod_to_irq(desc);
182 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
185 irq_flags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
196 ret = gpiochip_lock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc));
210 gpiochip_unlock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc));
224 struct gpio_desc *desc = data->desc;
228 gpiochip_unlock_as_irq(desc->gdev->chip, gpio_chip_hwgpio(desc));
308 struct gpio_desc *desc = data->desc;
312 if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value)
316 set_bit(FLAG_ACTIVE_LOW, &desc->flags);
318 clear_bit(FLAG_ACTIVE_LOW, &desc->flags);
334 struct gpio_desc *desc = data->desc;
340 !!test_bit(FLAG_ACTIVE_LOW, &desc->flags));
371 struct gpio_desc *desc = data->desc;
379 if (gpiod_to_irq(desc) < 0)
381 if (!show_direction && test_bit(FLAG_IS_OUT, &desc->flags))
459 struct gpio_desc *desc;
468 desc = gpio_to_desc(gpio);
470 if (!desc) {
474 gc = desc->gdev->chip;
475 offset = gpio_chip_hwgpio(desc);
486 status = gpiod_request(desc, "sysfs");
493 status = gpiod_set_transitory(desc, false);
495 gpiod_free(desc);
499 status = gpiod_export(desc, true);
501 gpiod_free(desc);
503 set_bit(FLAG_SYSFS, &desc->flags);
517 struct gpio_desc *desc;
524 desc = gpio_to_desc(gpio);
526 if (!desc) {
537 if (test_and_clear_bit(FLAG_SYSFS, &desc->flags)) {
539 gpiod_free(desc);
565 * @desc: GPIO to make available, already requested
578 int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
595 if (!desc) {
600 gdev = desc->gdev;
612 if (!test_bit(FLAG_REQUESTED, &desc->flags) ||
613 test_bit(FLAG_EXPORT, &desc->flags)) {
615 gpiod_dbg(desc, "%s: unavailable (requested=%d, exported=%d)\n",
617 test_bit(FLAG_REQUESTED, &desc->flags),
618 test_bit(FLAG_EXPORT, &desc->flags));
630 data->desc = desc;
637 offset = gpio_chip_hwgpio(desc);
644 desc_to_gpio(desc));
650 set_bit(FLAG_EXPORT, &desc->flags);
658 gpiod_dbg(desc, "%s: status %d\n", __func__, status);
663 static int match_export(struct device *dev, const void *desc)
667 return data->desc == desc;
674 * @desc: GPIO to create symlink to, already exported
682 struct gpio_desc *desc)
687 if (!desc) {
692 cdev = class_find_device(&gpio_class, NULL, desc, match_export);
705 * @desc: GPIO to make unavailable
709 void gpiod_unexport(struct gpio_desc *desc)
714 if (!desc) {
721 if (!test_bit(FLAG_EXPORT, &desc->flags))
724 dev = class_find_device(&gpio_class, NULL, desc, match_export);
730 clear_bit(FLAG_EXPORT, &desc->flags);
792 struct gpio_desc *desc;
808 desc = &gdev->descs[i];
809 if (test_and_clear_bit(FLAG_SYSFS, &desc->flags))
810 gpiod_free(desc);