Skip to content

Commit 4512d92

Browse files
committed
Merge tag 'backlight-next-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "New Functionality: - Convert to GPIO descriptors Fix-ups: - Trivial: fix coding style in sky81452-backlight - Ensure backlight state is known on bring-up in ktd253 - Use common platform API in qcom-wled and fbdev" * tag 'backlight-next-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight/video: Use Platform getter/setter functions backlight: ktd253: Bring up in a known state backlight: sky81452-backlight: Convert comma to semicolon backlight: lms283gf05: Convert to GPIO descriptors
2 parents 66615c4 + 0b5e0f4 commit 4512d92

15 files changed

Lines changed: 45 additions & 72 deletions

File tree

arch/arm/mach-pxa/z2.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/spi/spi.h>
2121
#include <linux/spi/pxa2xx_spi.h>
2222
#include <linux/spi/libertas_spi.h>
23-
#include <linux/spi/lms283gf05.h>
2423
#include <linux/power_supply.h>
2524
#include <linux/mtd/physmap.h>
2625
#include <linux/gpio.h>
@@ -578,8 +577,13 @@ static struct pxa2xx_spi_chip lms283_chip_info = {
578577
.gpio_cs = GPIO88_ZIPITZ2_LCD_CS,
579578
};
580579

581-
static const struct lms283gf05_pdata lms283_pdata = {
582-
.reset_gpio = GPIO19_ZIPITZ2_LCD_RESET,
580+
static struct gpiod_lookup_table lms283_gpio_table = {
581+
.dev_id = "spi2.0", /* SPI bus 2 chip select 0 */
582+
.table = {
583+
GPIO_LOOKUP("gpio-pxa", GPIO19_ZIPITZ2_LCD_RESET,
584+
"reset", GPIO_ACTIVE_LOW),
585+
{ },
586+
},
583587
};
584588

585589
static struct spi_board_info spi_board_info[] __initdata = {
@@ -595,7 +599,6 @@ static struct spi_board_info spi_board_info[] __initdata = {
595599
{
596600
.modalias = "lms283gf05",
597601
.controller_data = &lms283_chip_info,
598-
.platform_data = &lms283_pdata,
599602
.max_speed_hz = 400000,
600603
.bus_num = 2,
601604
.chip_select = 0,
@@ -615,6 +618,7 @@ static void __init z2_spi_init(void)
615618
{
616619
pxa2xx_set_spi_info(1, &pxa_ssp1_master_info);
617620
pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
621+
gpiod_add_lookup_table(&lms283_gpio_table);
618622
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
619623
}
620624
#else

drivers/video/backlight/ktd253-backlight.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,16 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
137137
brightness = max_brightness;
138138
}
139139

140-
if (brightness)
141-
/* This will be the default ratio when the KTD253 is enabled */
142-
ktd253->ratio = KTD253_MAX_RATIO;
143-
else
144-
ktd253->ratio = 0;
145-
146-
ktd253->gpiod = devm_gpiod_get(dev, "enable",
147-
brightness ? GPIOD_OUT_HIGH :
148-
GPIOD_OUT_LOW);
140+
ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
149141
if (IS_ERR(ktd253->gpiod)) {
150142
ret = PTR_ERR(ktd253->gpiod);
151143
if (ret != -EPROBE_DEFER)
152144
dev_err(dev, "gpio line missing or invalid.\n");
153145
return ret;
154146
}
155147
gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev));
148+
/* Bring backlight to a known off state */
149+
msleep(KTD253_T_OFF_MS);
156150

157151
bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253,
158152
&ktd253_backlight_ops, NULL);

drivers/video/backlight/lms283gf05.c

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
#include <linux/kernel.h>
1010
#include <linux/delay.h>
1111
#include <linux/slab.h>
12-
#include <linux/gpio.h>
12+
#include <linux/gpio/consumer.h>
1313
#include <linux/lcd.h>
1414

1515
#include <linux/spi/spi.h>
16-
#include <linux/spi/lms283gf05.h>
1716
#include <linux/module.h>
1817

1918
struct lms283gf05_state {
2019
struct spi_device *spi;
2120
struct lcd_device *ld;
21+
struct gpio_desc *reset;
2222
};
2323

2424
struct lms283gf05_seq {
@@ -90,13 +90,13 @@ static const struct lms283gf05_seq disp_pdwnseq[] = {
9090
};
9191

9292

93-
static void lms283gf05_reset(unsigned long gpio, bool inverted)
93+
static void lms283gf05_reset(struct gpio_desc *gpiod)
9494
{
95-
gpio_set_value(gpio, !inverted);
95+
gpiod_set_value(gpiod, 0); /* De-asserted */
9696
mdelay(100);
97-
gpio_set_value(gpio, inverted);
97+
gpiod_set_value(gpiod, 1); /* Asserted */
9898
mdelay(20);
99-
gpio_set_value(gpio, !inverted);
99+
gpiod_set_value(gpiod, 0); /* De-asserted */
100100
mdelay(20);
101101
}
102102

@@ -125,18 +125,15 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power)
125125
{
126126
struct lms283gf05_state *st = lcd_get_data(ld);
127127
struct spi_device *spi = st->spi;
128-
struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);
129128

130129
if (power <= FB_BLANK_NORMAL) {
131-
if (pdata)
132-
lms283gf05_reset(pdata->reset_gpio,
133-
pdata->reset_inverted);
130+
if (st->reset)
131+
lms283gf05_reset(st->reset);
134132
lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
135133
} else {
136134
lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq));
137-
if (pdata)
138-
gpio_set_value(pdata->reset_gpio,
139-
pdata->reset_inverted);
135+
if (st->reset)
136+
gpiod_set_value(st->reset, 1); /* Asserted */
140137
}
141138

142139
return 0;
@@ -150,24 +147,18 @@ static struct lcd_ops lms_ops = {
150147
static int lms283gf05_probe(struct spi_device *spi)
151148
{
152149
struct lms283gf05_state *st;
153-
struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);
154150
struct lcd_device *ld;
155-
int ret = 0;
156-
157-
if (pdata != NULL) {
158-
ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
159-
GPIOF_DIR_OUT | (!pdata->reset_inverted ?
160-
GPIOF_INIT_HIGH : GPIOF_INIT_LOW),
161-
"LMS283GF05 RESET");
162-
if (ret)
163-
return ret;
164-
}
165151

166152
st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
167153
GFP_KERNEL);
168154
if (st == NULL)
169155
return -ENOMEM;
170156

157+
st->reset = gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_LOW);
158+
if (IS_ERR(st->reset))
159+
return PTR_ERR(st->reset);
160+
gpiod_set_consumer_name(st->reset, "LMS283GF05 RESET");
161+
171162
ld = devm_lcd_device_register(&spi->dev, "lms283gf05", &spi->dev, st,
172163
&lms_ops);
173164
if (IS_ERR(ld))
@@ -179,8 +170,8 @@ static int lms283gf05_probe(struct spi_device *spi)
179170
spi_set_drvdata(spi, st);
180171

181172
/* kick in the LCD */
182-
if (pdata)
183-
lms283gf05_reset(pdata->reset_gpio, pdata->reset_inverted);
173+
if (st->reset)
174+
lms283gf05_reset(st->reset);
184175
lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
185176

186177
return 0;

drivers/video/backlight/qcom-wled.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ static int wled_probe(struct platform_device *pdev)
16921692

16931693
static int wled_remove(struct platform_device *pdev)
16941694
{
1695-
struct wled *wled = dev_get_drvdata(&pdev->dev);
1695+
struct wled *wled = platform_get_drvdata(pdev);
16961696

16971697
mutex_destroy(&wled->lock);
16981698
cancel_delayed_work_sync(&wled->ovp_work);

drivers/video/backlight/sky81452-backlight.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static int sky81452_bl_probe(struct platform_device *pdev)
291291
}
292292

293293
memset(&props, 0, sizeof(props));
294-
props.max_brightness = SKY81452_MAX_BRIGHTNESS,
294+
props.max_brightness = SKY81452_MAX_BRIGHTNESS;
295295
name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME;
296296
bd = devm_backlight_device_register(dev, name, dev, regmap,
297297
&sky81452_bl_ops, &props);

drivers/video/fbdev/amifb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,7 +3736,7 @@ static int __init amifb_probe(struct platform_device *pdev)
37363736
if (err)
37373737
goto free_irq;
37383738

3739-
dev_set_drvdata(&pdev->dev, info);
3739+
platform_set_drvdata(pdev, info);
37403740

37413741
err = register_framebuffer(info);
37423742
if (err)
@@ -3764,7 +3764,7 @@ static int __init amifb_probe(struct platform_device *pdev)
37643764

37653765
static int __exit amifb_remove(struct platform_device *pdev)
37663766
{
3767-
struct fb_info *info = dev_get_drvdata(&pdev->dev);
3767+
struct fb_info *info = platform_get_drvdata(pdev);
37683768

37693769
unregister_framebuffer(info);
37703770
fb_dealloc_cmap(&info->cmap);

drivers/video/fbdev/da8xx-fb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ static void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par)
10661066

10671067
static int fb_remove(struct platform_device *dev)
10681068
{
1069-
struct fb_info *info = dev_get_drvdata(&dev->dev);
1069+
struct fb_info *info = platform_get_drvdata(dev);
10701070
struct da8xx_fb_par *par = info->par;
10711071
int ret;
10721072

@@ -1482,7 +1482,7 @@ static int fb_probe(struct platform_device *device)
14821482
da8xx_fb_var.activate = FB_ACTIVATE_FORCE;
14831483
fb_set_var(da8xx_fb_info, &da8xx_fb_var);
14841484

1485-
dev_set_drvdata(&device->dev, da8xx_fb_info);
1485+
platform_set_drvdata(device, da8xx_fb_info);
14861486

14871487
/* initialize the vsync wait queue */
14881488
init_waitqueue_head(&par->vsync_wait);

drivers/video/fbdev/imxfb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
657657
static int imxfb_init_fbinfo(struct platform_device *pdev)
658658
{
659659
struct imx_fb_platform_data *pdata = dev_get_platdata(&pdev->dev);
660-
struct fb_info *info = dev_get_drvdata(&pdev->dev);
660+
struct fb_info *info = platform_get_drvdata(pdev);
661661
struct imxfb_info *fbi = info->par;
662662
struct device_node *np;
663663

drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static struct omap_dss_driver lb035q02_ops = {
239239
static int lb035q02_probe_of(struct spi_device *spi)
240240
{
241241
struct device_node *node = spi->dev.of_node;
242-
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
242+
struct panel_drv_data *ddata = spi_get_drvdata(spi);
243243
struct omap_dss_device *in;
244244
struct gpio_desc *gpio;
245245

@@ -277,7 +277,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
277277
if (ddata == NULL)
278278
return -ENOMEM;
279279

280-
dev_set_drvdata(&spi->dev, ddata);
280+
spi_set_drvdata(spi, ddata);
281281

282282
ddata->spi = spi;
283283

@@ -318,7 +318,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
318318

319319
static int lb035q02_panel_spi_remove(struct spi_device *spi)
320320
{
321-
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
321+
struct panel_drv_data *ddata = spi_get_drvdata(spi);
322322
struct omap_dss_device *dssdev = &ddata->dssdev;
323323
struct omap_dss_device *in = ddata->in;
324324

drivers/video/fbdev/omap2/omapfb/dss/dpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
5555
/* only used in non-DT mode */
5656
static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev)
5757
{
58-
return dev_get_drvdata(&pdev->dev);
58+
return platform_get_drvdata(pdev);
5959
}
6060

6161
static struct dss_pll *dpi_get_pll(enum omap_channel channel)
@@ -784,7 +784,7 @@ static int dpi_bind(struct device *dev, struct device *master, void *data)
784784

785785
dpi->pdev = pdev;
786786

787-
dev_set_drvdata(&pdev->dev, dpi);
787+
platform_set_drvdata(pdev, dpi);
788788

789789
mutex_init(&dpi->lock);
790790

0 commit comments

Comments
 (0)