Skip to content

Commit 2367da5

Browse files
committed
Merge tag 'backlight-next-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "Fix-ups: - Remove superfluous code in ams369fg06 - Convert over to GPIO descriptor (gpiod) in bd6107 Bug Fixes: - Fix unsigned comparison to less than zero in qcom-wled" * tag 'backlight-next-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: qcom-wled: Fix unsigned comparison to zero backlight: bd6107: Convert to use GPIO descriptor backlight: ams369fg06: Drop GPIO include
2 parents af32f3a + 7af43a7 commit 2367da5

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

drivers/video/backlight/ams369fg06.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/backlight.h>
1212
#include <linux/delay.h>
1313
#include <linux/fb.h>
14-
#include <linux/gpio.h>
1514
#include <linux/lcd.h>
1615
#include <linux/module.h>
1716
#include <linux/spi/spi.h>

drivers/video/backlight/bd6107.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <linux/delay.h>
1212
#include <linux/err.h>
1313
#include <linux/fb.h>
14-
#include <linux/gpio.h>
14+
#include <linux/gpio/consumer.h>
1515
#include <linux/i2c.h>
1616
#include <linux/module.h>
1717
#include <linux/platform_data/bd6107.h>
@@ -71,6 +71,7 @@ struct bd6107 {
7171
struct i2c_client *client;
7272
struct backlight_device *backlight;
7373
struct bd6107_platform_data *pdata;
74+
struct gpio_desc *reset;
7475
};
7576

7677
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)
9495
bd6107_write(bd, BD6107_MAINCNT1, brightness);
9596
bd6107_write(bd, BD6107_LEDCNT1, BD6107_LEDCNT1_LEDONOFF1);
9697
} else {
97-
gpio_set_value(bd->pdata->reset, 0);
98+
/* Assert the reset line (gpiolib will handle active low) */
99+
gpiod_set_value(bd->reset, 1);
98100
msleep(24);
99-
gpio_set_value(bd->pdata->reset, 1);
101+
gpiod_set_value(bd->reset, 0);
100102
}
101103

102104
return 0;
@@ -125,8 +127,8 @@ static int bd6107_probe(struct i2c_client *client,
125127
struct bd6107 *bd;
126128
int ret;
127129

128-
if (pdata == NULL || !pdata->reset) {
129-
dev_err(&client->dev, "No reset GPIO in platform data\n");
130+
if (pdata == NULL) {
131+
dev_err(&client->dev, "No platform data\n");
130132
return -EINVAL;
131133
}
132134

@@ -144,10 +146,16 @@ static int bd6107_probe(struct i2c_client *client,
144146
bd->client = client;
145147
bd->pdata = pdata;
146148

147-
ret = devm_gpio_request_one(&client->dev, pdata->reset,
148-
GPIOF_DIR_OUT | GPIOF_INIT_LOW, "reset");
149-
if (ret < 0) {
149+
/*
150+
* Request the reset GPIO line with GPIOD_OUT_HIGH meaning asserted,
151+
* so in the machine descriptor table (or other hardware description),
152+
* the line should be flagged as active low so this will assert
153+
* the reset.
154+
*/
155+
bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
156+
if (IS_ERR(bd->reset)) {
150157
dev_err(&client->dev, "unable to request reset GPIO\n");
158+
ret = PTR_ERR(bd->reset);
151159
return ret;
152160
}
153161

drivers/video/backlight/qcom-wled.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,8 @@ static int wled_configure(struct wled *wled, int version)
956956
struct wled_config *cfg = &wled->cfg;
957957
struct device *dev = wled->dev;
958958
const __be32 *prop_addr;
959-
u32 size, val, c, string_len;
960-
int rc, i, j;
959+
u32 size, val, c;
960+
int rc, i, j, string_len;
961961

962962
const struct wled_u32_opts *u32_opts = NULL;
963963
const struct wled_u32_opts wled3_opts[] = {

include/linux/platform_data/bd6107.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ struct device;
99

1010
struct bd6107_platform_data {
1111
struct device *fbdev;
12-
int reset; /* Reset GPIO */
1312
unsigned int def_value;
1413
};
1514

0 commit comments

Comments
 (0)