From 4c3718f9d6a6f6557b6e5564af8bd90130123fb8 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Mon, 9 Dec 2019 01:42:42 +0100 Subject: leds: bd2802: Convert to use GPIO descriptors The Rohm BD2802 have no in-kernel users so we can drop the GPIO number from the platform data and require users to provide the GPIO line using machine descriptors. As the descriptors come with inherent polarity inversion semantics, we invert the calls to set the GPIO line such that 0 means "unasserted" and 1 means "asserted". Put a note in the driver that machine descriptor tables will need to specify that the line is active low. Cc: Kim Kyuwon Signed-off-by: Linus Walleij Signed-off-by: Pavel Machek --- include/linux/leds-bd2802.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/leds-bd2802.h b/include/linux/leds-bd2802.h index dd93c8d787b4..ec577f5f8707 100644 --- a/include/linux/leds-bd2802.h +++ b/include/linux/leds-bd2802.h @@ -11,7 +11,6 @@ #define _LEDS_BD2802_H_ struct bd2802_led_platform_data{ - int reset_gpio; u8 rgb_time; }; -- cgit v1.2.3 From 699a8c7c4bd376aee4808e6272188319e900c8af Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 3 Oct 2019 10:28:09 +0200 Subject: leds: Add of_led_get() and led_put() This patch adds basic support for a kernel driver to get a LED device. This will be used by the led-backlight driver. Only OF version is implemented for now, and the behavior is similar to PWM's of_pwm_get() and pwm_put(). Signed-off-by: Tomi Valkeinen Signed-off-by: Jean-Jacques Hiblot Acked-by: Pavel Machek Signed-off-by: Pavel Machek --- include/linux/leds.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/leds.h b/include/linux/leds.h index 242258f7d837..dcfb6a325866 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -20,6 +20,7 @@ struct device; struct led_pattern; +struct device_node; /* * LED Core */ @@ -196,6 +197,9 @@ void devm_led_classdev_unregister(struct device *parent, void led_classdev_suspend(struct led_classdev *led_cdev); void led_classdev_resume(struct led_classdev *led_cdev); +extern struct led_classdev *of_led_get(struct device_node *np, int index); +extern void led_put(struct led_classdev *led_cdev); + /** * led_blink_set - set blinking with software fallback * @led_cdev: the LED to start blinking -- cgit v1.2.3 From e389240ad99292d52a4f8ff30f16830dc9c63779 Mon Sep 17 00:00:00 2001 From: Jean-Jacques Hiblot Date: Thu, 3 Oct 2019 10:28:10 +0200 Subject: leds: Add managed API to get a LED from a device driver If the LED is acquired by a consumer device with devm_led_get(), it is automatically released when the device is detached. Signed-off-by: Jean-Jacques Hiblot Acked-by: Pavel Machek Signed-off-by: Pavel Machek --- include/linux/leds.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/leds.h b/include/linux/leds.h index dcfb6a325866..75353e5f9d13 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -199,6 +199,8 @@ void led_classdev_resume(struct led_classdev *led_cdev); extern struct led_classdev *of_led_get(struct device_node *np, int index); extern void led_put(struct led_classdev *led_cdev); +struct led_classdev *__must_check devm_of_led_get(struct device *dev, + int index); /** * led_blink_set - set blinking with software fallback -- cgit v1.2.3