Lines Matching +full:valid +full:- +full:sources

1 // SPDX-License-Identifier: GPL-2.0-only
3 * ledtrig-gio.c - LED Trigger Based on GPIO events
30 tmp = gpiod_get_value_cansleep(gpio_data->gpiod); in gpio_trig_irq()
32 if (gpio_data->desired_brightness) in gpio_trig_irq()
33 led_set_brightness_nosleep(gpio_data->led, in gpio_trig_irq()
34 gpio_data->desired_brightness); in gpio_trig_irq()
36 led_set_brightness_nosleep(gpio_data->led, LED_FULL); in gpio_trig_irq()
38 led_set_brightness_nosleep(gpio_data->led, LED_OFF); in gpio_trig_irq()
49 return sysfs_emit(buf, "%u\n", gpio_data->desired_brightness); in desired_brightness_show()
63 gpio_data->desired_brightness = desired_brightness; in desired_brightness_store()
78 struct device *dev = led->dev; in gpio_trig_activate()
83 return -ENOMEM; in gpio_trig_activate()
86 * The generic property "trigger-sources" is followed, in gpio_trig_activate()
89 gpio_data->gpiod = gpiod_get_optional(dev, "trigger-sources", GPIOD_IN); in gpio_trig_activate()
90 if (IS_ERR(gpio_data->gpiod)) { in gpio_trig_activate()
91 ret = PTR_ERR(gpio_data->gpiod); in gpio_trig_activate()
95 if (!gpio_data->gpiod) { in gpio_trig_activate()
96 dev_err(dev, "no valid GPIO for the trigger\n"); in gpio_trig_activate()
98 return -EINVAL; in gpio_trig_activate()
101 gpiod_set_consumer_name(gpio_data->gpiod, "led-trigger"); in gpio_trig_activate()
103 gpio_data->led = led; in gpio_trig_activate()
106 ret = request_threaded_irq(gpiod_to_irq(gpio_data->gpiod), NULL, gpio_trig_irq, in gpio_trig_activate()
108 | IRQF_TRIGGER_FALLING, "ledtrig-gpio", led); in gpio_trig_activate()
111 gpiod_put(gpio_data->gpiod); in gpio_trig_activate()
126 free_irq(gpiod_to_irq(gpio_data->gpiod), led); in gpio_trig_deactivate()
127 gpiod_put(gpio_data->gpiod); in gpio_trig_deactivate()