From edeec4fdc78008185eff2c352d75f048959af1d6 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Mon, 2 Dec 2019 11:30:05 +0100 Subject: backlight: ams369fg06: Drop GPIO include The driver includes yet fails to use symbols from any the header so drop the include. Signed-off-by: Linus Walleij Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones --- drivers/video/backlight/ams369fg06.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c index 94ccb9042440..8a4361e95a11 100644 --- a/drivers/video/backlight/ams369fg06.c +++ b/drivers/video/backlight/ams369fg06.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3-59-g8ed1b From c8fdcc86725cc93a021139e8de68914857ea7489 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Mon, 2 Dec 2019 11:30:28 +0100 Subject: backlight: bd6107: Convert to use GPIO descriptor The Rohm BD6107 driver can pass a fixed GPIO line using the old GPIO API using platform data. As there are no in-tree users of this platform data since 2013, we can convert this to use a GPIO descriptor and require any out-of-tree consumers to pass the GPIO using a machine descriptor table instead. Signed-off-by: Linus Walleij Reviewed-by: Laurent Pinchart Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones --- drivers/video/backlight/bd6107.c | 24 ++++++++++++++++-------- include/linux/platform_data/bd6107.h | 1 - 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index d344fb03cb86..d5d5fb457e78 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -71,6 +71,7 @@ struct bd6107 { struct i2c_client *client; struct backlight_device *backlight; struct bd6107_platform_data *pdata; + struct gpio_desc *reset; }; static int bd6107_write(struct bd6107 *bd, u8 reg, u8 data) @@ -94,9 +95,10 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight) bd6107_write(bd, BD6107_MAINCNT1, brightness); bd6107_write(bd, BD6107_LEDCNT1, BD6107_LEDCNT1_LEDONOFF1); } else { - gpio_set_value(bd->pdata->reset, 0); + /* Assert the reset line (gpiolib will handle active low) */ + gpiod_set_value(bd->reset, 1); msleep(24); - gpio_set_value(bd->pdata->reset, 1); + gpiod_set_value(bd->reset, 0); } return 0; @@ -125,8 +127,8 @@ static int bd6107_probe(struct i2c_client *client, struct bd6107 *bd; int ret; - if (pdata == NULL || !pdata->reset) { - dev_err(&client->dev, "No reset GPIO in platform data\n"); + if (pdata == NULL) { + dev_err(&client->dev, "No platform data\n"); return -EINVAL; } @@ -144,10 +146,16 @@ static int bd6107_probe(struct i2c_client *client, bd->client = client; bd->pdata = pdata; - ret = devm_gpio_request_one(&client->dev, pdata->reset, - GPIOF_DIR_OUT | GPIOF_INIT_LOW, "reset"); - if (ret < 0) { + /* + * Request the reset GPIO line with GPIOD_OUT_HIGH meaning asserted, + * so in the machine descriptor table (or other hardware description), + * the line should be flagged as active low so this will assert + * the reset. + */ + bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(bd->reset)) { dev_err(&client->dev, "unable to request reset GPIO\n"); + ret = PTR_ERR(bd->reset); return ret; } diff --git a/include/linux/platform_data/bd6107.h b/include/linux/platform_data/bd6107.h index 3bd019037eb3..54a06a4d2618 100644 --- a/include/linux/platform_data/bd6107.h +++ b/include/linux/platform_data/bd6107.h @@ -9,7 +9,6 @@ struct device; struct bd6107_platform_data { struct device *fbdev; - int reset; /* Reset GPIO */ unsigned int def_value; }; -- cgit v1.2.3-59-g8ed1b From 7af43a76695db71a57203793fb9dd3c81a5783b1 Mon Sep 17 00:00:00 2001 From: Chen Zhou Date: Wed, 22 Jan 2020 09:32:40 +0800 Subject: backlight: qcom-wled: Fix unsigned comparison to zero Fixes coccicheck warning: ./drivers/video/backlight/qcom-wled.c:1104:5-15: WARNING: Unsigned expression compared with zero: string_len > 0 The unsigned variable string_len is assigned a return value from the call to of_property_count_elems_of_size(), which may return negative error code. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3") Signed-off-by: Chen Zhou Reviewed-by: Bjorn Andersson Reviewed-by: Daniel Thompson Reviewed-by: Kiran Gunda Signed-off-by: Lee Jones --- drivers/video/backlight/qcom-wled.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index d46052d8ff41..3d276b30a78c 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -956,8 +956,8 @@ static int wled_configure(struct wled *wled, int version) struct wled_config *cfg = &wled->cfg; struct device *dev = wled->dev; const __be32 *prop_addr; - u32 size, val, c, string_len; - int rc, i, j; + u32 size, val, c; + int rc, i, j, string_len; const struct wled_u32_opts *u32_opts = NULL; const struct wled_u32_opts wled3_opts[] = { -- cgit v1.2.3-59-g8ed1b