Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c673a2b4 authored by Mika Westerberg's avatar Mika Westerberg Committed by Rafael J. Wysocki
Browse files

leds: leds-gpio: Convert gpio_blink_set() to use GPIO descriptors



Commit 21f2aae91e902aad ("leds: leds-gpio: Add support for GPIO
descriptors") already converted most of the driver to use GPIO descriptors.
What is still missing is the platform specific hook gpio_blink_set() and
board files which pass legacy GPIO numbers to this driver in platform data.

In this patch we handle the former and convert gpio_blink_set() to take
GPIO descriptor instead. In order to do this we convert the existing four
users to accept GPIO descriptor and translate it to legacy GPIO number in
the platform code. This effectively "pushes" legacy GPIO number usage from
the driver to platforms.

Also add comment to the remaining block describing that it is legacy code
path and we are getting rid of it eventually.

Suggested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent e36d453e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ static void h1940bt_enable(int on)
		mdelay(10);
		gpio_set_value(S3C2410_GPH(1), 0);

		h1940_led_blink_set(-EINVAL, GPIO_LED_BLINK, NULL, NULL);
		h1940_led_blink_set(NULL, GPIO_LED_BLINK, NULL, NULL);
	}
	else {
		gpio_set_value(S3C2410_GPH(1), 1);
@@ -50,7 +50,7 @@ static void h1940bt_enable(int on)
		mdelay(10);
		gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);

		h1940_led_blink_set(-EINVAL, GPIO_LED_NO_BLINK_LOW, NULL, NULL);
		h1940_led_blink_set(NULL, GPIO_LED_NO_BLINK_LOW, NULL, NULL);
	}
}

+3 −1
Original line number Diff line number Diff line
@@ -19,8 +19,10 @@
#define H1940_SUSPEND_RESUMEAT		(0x30081000)
#define H1940_SUSPEND_CHECK		(0x30080000)

struct gpio_desc;

extern void h1940_pm_return(void);
extern int h1940_led_blink_set(unsigned gpio, int state,
extern int h1940_led_blink_set(struct gpio_desc *desc, int state,
			       unsigned long *delay_on,
			       unsigned long *delay_off);

+2 −1
Original line number Diff line number Diff line
@@ -359,10 +359,11 @@ static struct platform_device h1940_battery = {

static DEFINE_SPINLOCK(h1940_blink_spin);

int h1940_led_blink_set(unsigned gpio, int state,
int h1940_led_blink_set(struct gpio_desc *desc, int state,
	unsigned long *delay_on, unsigned long *delay_off)
{
	int blink_gpio, check_gpio1, check_gpio2;
	int gpio = desc ? desc_to_gpio(desc) : -EINVAL;

	switch (gpio) {
	case H1940_LATCH_LED_GREEN:
+2 −1
Original line number Diff line number Diff line
@@ -250,9 +250,10 @@ static void rx1950_disable_charger(void)

static DEFINE_SPINLOCK(rx1950_blink_spin);

static int rx1950_led_blink_set(unsigned gpio, int state,
static int rx1950_led_blink_set(struct gpio_desc *desc, int state,
	unsigned long *delay_on, unsigned long *delay_off)
{
	int gpio = desc_to_gpio(desc);
	int blink_gpio, check_gpio;

	switch (gpio) {
+2 −1
Original line number Diff line number Diff line
@@ -306,9 +306,10 @@ EXPORT_SYMBOL(orion_gpio_set_blink);

#define ORION_BLINK_HALF_PERIOD 100 /* ms */

int orion_gpio_led_blink_set(unsigned gpio, int state,
int orion_gpio_led_blink_set(struct gpio_desc *desc, int state,
	unsigned long *delay_on, unsigned long *delay_off)
{
	unsigned gpio = desc_to_gpio(desc);

	if (delay_on && delay_off && !*delay_on && !*delay_off)
		*delay_on = *delay_off = ORION_BLINK_HALF_PERIOD;
Loading