Skip to content

Commit 0f105cf

Browse files
committed
Merge tag 'backlight-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "Core Frameworks - Provide helpers to enable/disable backlight - Provide standard and devres versions OF find helpers New Drivers: - Add support for the Zodiac Inflight Innovations RAVE Supervisory Processor New Functionality: - Allow pwm-on/pwm-off delay to be specified via DT Bug Fixes: - Fix ordering of the power {en,dis}able and PWM {en,dis}able signals - Fix Device Tree node look-up" * tag 'backlight-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: as3711_bl: Fix Device Tree node leaks backlight: tps65217_bl: Fix Device Tree node lookup backlight: max8925_bl: Fix Device Tree node lookup backlight: as3711_bl: Fix Device Tree node lookup MAINTAINERS: Add dri-devel for backlight subsystem patches backlight: Nuke BL_CORE_DRIVER1 staging: fbtft: Stop using BL_CORE_DRIVER1 backlight: pandora: Stop using BL_CORE_DRIVER1 backlight: generic-bl: Remove DRIVER1 state backlight: Nuke unused backlight.props.state states backlight: otm3225a: Add support for ORISE OTM3225A LCD SoC backlight: pwm_bl: Don't use GPIOF_* with gpiod_get_direction pwm-backlight: Add support for PWM delays proprieties. dt-bindings: pwm-backlight: Add PWM delay proprieties. pwm-backlight: Enable/disable the PWM before/after LCD enable toggle. dt-bindings: backlight: Add binding for RAVE SP backlight driver backlight: Add RAVE SP backlight driver
2 parents 883cad5 + d5318d3 commit 0f105cf

File tree

19 files changed

+466
-46
lines changed

19 files changed

+466
-46
lines changed

Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Optional properties:
1717
"pwms" property (see PWM binding[0])
1818
- enable-gpios: contains a single GPIO specifier for the GPIO which enables
1919
and disables the backlight (see GPIO binding[1])
20+
- post-pwm-on-delay-ms: Delay in ms between setting an initial (non-zero) PWM
21+
and enabling the backlight using GPIO.
22+
- pwm-off-delay-ms: Delay in ms between disabling the backlight using GPIO
23+
and setting PWM value to 0.
2024

2125
[0]: Documentation/devicetree/bindings/pwm/pwm.txt
2226
[1]: Documentation/devicetree/bindings/gpio/gpio.txt
@@ -32,4 +36,6 @@ Example:
3236

3337
power-supply = <&vdd_bl_reg>;
3438
enable-gpios = <&gpio 58 0>;
39+
post-pwm-on-delay-ms = <10>;
40+
pwm-off-delay-ms = <10>;
3541
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Zodiac Inflight Innovations RAVE Supervisory Processor Backlight Bindings
2+
3+
RAVE SP backlight device is a "MFD cell" device corresponding to
4+
backlight functionality of RAVE Supervisory Processor. It is expected
5+
that its Device Tree node is specified as a child of the node
6+
corresponding to the parent RAVE SP device (as documented in
7+
Documentation/devicetree/bindings/mfd/zii,rave-sp.txt)
8+
9+
Required properties:
10+
11+
- compatible: Should be "zii,rave-sp-backlight"
12+
13+
Example:
14+
15+
rave-sp {
16+
compatible = "zii,rave-sp-rdu1";
17+
current-speed = <38400>;
18+
19+
backlight {
20+
compatible = "zii,rave-sp-backlight";
21+
};
22+
}
23+

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,6 +2606,7 @@ BACKLIGHT CLASS/SUBSYSTEM
26062606
M: Lee Jones <[email protected]>
26072607
M: Daniel Thompson <[email protected]>
26082608
M: Jingoo Han <[email protected]>
2609+
26092610
T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
26102611
S: Maintained
26112612
F: drivers/video/backlight/

drivers/staging/fbtft/fbtft-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par)
246246
static int fbtft_backlight_update_status(struct backlight_device *bd)
247247
{
248248
struct fbtft_par *par = bl_get_data(bd);
249-
bool polarity = !!(bd->props.state & BL_CORE_DRIVER1);
249+
bool polarity = par->polarity;
250250

251251
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
252252
"%s: polarity=%d, power=%d, fb_blank=%d\n",
@@ -296,7 +296,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
296296
/* Assume backlight is off, get polarity from current state of pin */
297297
bl_props.power = FB_BLANK_POWERDOWN;
298298
if (!gpio_get_value(par->gpio.led[0]))
299-
bl_props.state |= BL_CORE_DRIVER1;
299+
par->polarity = true;
300300

301301
bd = backlight_device_register(dev_driver_string(par->info->device),
302302
par->info->device, par,

drivers/staging/fbtft/fbtft.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ struct fbtft_par {
229229
ktime_t update_time;
230230
bool bgr;
231231
void *extra;
232+
bool polarity;
232233
};
233234

234235
#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int))

drivers/video/backlight/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ config LCD_HX8357
150150
If you have a HX-8357 LCD panel, say Y to enable its LCD control
151151
driver.
152152

153+
config LCD_OTM3225A
154+
tristate "ORISE Technology OTM3225A support"
155+
depends on SPI
156+
help
157+
If you have a panel based on the OTM3225A controller
158+
chip then say y to include a driver for it.
159+
153160
endif # LCD_CLASS_DEVICE
154161

155162
#
@@ -467,6 +474,12 @@ config BACKLIGHT_ARCXCNN
467474
If you have an ARCxCnnnn family backlight say Y to enable
468475
the backlight driver.
469476

477+
config BACKLIGHT_RAVE_SP
478+
tristate "RAVE SP Backlight driver"
479+
depends on RAVE_SP_CORE
480+
help
481+
Support for backlight control on RAVE SP device.
482+
470483
endif # BACKLIGHT_CLASS_DEVICE
471484

472485
endif # BACKLIGHT_LCD_SUPPORT

drivers/video/backlight/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ obj-$(CONFIG_LCD_LD9040) += ld9040.o
1313
obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o
1414
obj-$(CONFIG_LCD_LMS501KF03) += lms501kf03.o
1515
obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o
16+
obj-$(CONFIG_LCD_OTM3225A) += otm3225a.o
1617
obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o
1718
obj-$(CONFIG_LCD_S6E63M0) += s6e63m0.o
1819
obj-$(CONFIG_LCD_TDO24M) += tdo24m.o
@@ -57,3 +58,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
5758
obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
5859
obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
5960
obj-$(CONFIG_BACKLIGHT_ARCXCNN) += arcxcnn_bl.o
61+
obj-$(CONFIG_BACKLIGHT_RAVE_SP) += rave-sp-backlight.o

drivers/video/backlight/as3711_bl.c

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ enum as3711_bl_type {
2828

2929
struct as3711_bl_data {
3030
bool powered;
31-
const char *fb_name;
32-
struct device *fb_dev;
3331
enum as3711_bl_type type;
3432
int brightness;
3533
struct backlight_device *bl;
@@ -262,37 +260,41 @@ static int as3711_bl_register(struct platform_device *pdev,
262260
static int as3711_backlight_parse_dt(struct device *dev)
263261
{
264262
struct as3711_bl_pdata *pdata = dev_get_platdata(dev);
265-
struct device_node *bl =
266-
of_find_node_by_name(dev->parent->of_node, "backlight"), *fb;
263+
struct device_node *bl, *fb;
267264
int ret;
268265

266+
bl = of_get_child_by_name(dev->parent->of_node, "backlight");
269267
if (!bl) {
270268
dev_dbg(dev, "backlight node not found\n");
271269
return -ENODEV;
272270
}
273271

274272
fb = of_parse_phandle(bl, "su1-dev", 0);
275273
if (fb) {
276-
pdata->su1_fb = fb->full_name;
274+
of_node_put(fb);
275+
276+
pdata->su1_fb = true;
277277

278278
ret = of_property_read_u32(bl, "su1-max-uA", &pdata->su1_max_uA);
279279
if (pdata->su1_max_uA <= 0)
280280
ret = -EINVAL;
281281
if (ret < 0)
282-
return ret;
282+
goto err_put_bl;
283283
}
284284

285285
fb = of_parse_phandle(bl, "su2-dev", 0);
286286
if (fb) {
287287
int count = 0;
288288

289-
pdata->su2_fb = fb->full_name;
289+
of_node_put(fb);
290+
291+
pdata->su2_fb = true;
290292

291293
ret = of_property_read_u32(bl, "su2-max-uA", &pdata->su2_max_uA);
292294
if (pdata->su2_max_uA <= 0)
293295
ret = -EINVAL;
294296
if (ret < 0)
295-
return ret;
297+
goto err_put_bl;
296298

297299
if (of_find_property(bl, "su2-feedback-voltage", NULL)) {
298300
pdata->su2_feedback = AS3711_SU2_VOLTAGE;
@@ -314,8 +316,10 @@ static int as3711_backlight_parse_dt(struct device *dev)
314316
pdata->su2_feedback = AS3711_SU2_CURR_AUTO;
315317
count++;
316318
}
317-
if (count != 1)
318-
return -EINVAL;
319+
if (count != 1) {
320+
ret = -EINVAL;
321+
goto err_put_bl;
322+
}
319323

320324
count = 0;
321325
if (of_find_property(bl, "su2-fbprot-lx-sd4", NULL)) {
@@ -334,8 +338,10 @@ static int as3711_backlight_parse_dt(struct device *dev)
334338
pdata->su2_fbprot = AS3711_SU2_GPIO4;
335339
count++;
336340
}
337-
if (count != 1)
338-
return -EINVAL;
341+
if (count != 1) {
342+
ret = -EINVAL;
343+
goto err_put_bl;
344+
}
339345

340346
count = 0;
341347
if (of_find_property(bl, "su2-auto-curr1", NULL)) {
@@ -355,11 +361,20 @@ static int as3711_backlight_parse_dt(struct device *dev)
355361
* At least one su2-auto-curr* must be specified iff
356362
* AS3711_SU2_CURR_AUTO is used
357363
*/
358-
if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO))
359-
return -EINVAL;
364+
if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) {
365+
ret = -EINVAL;
366+
goto err_put_bl;
367+
}
360368
}
361369

370+
of_node_put(bl);
371+
362372
return 0;
373+
374+
err_put_bl:
375+
of_node_put(bl);
376+
377+
return ret;
363378
}
364379

365380
static int as3711_backlight_probe(struct platform_device *pdev)
@@ -412,7 +427,6 @@ static int as3711_backlight_probe(struct platform_device *pdev)
412427

413428
if (pdata->su1_fb) {
414429
su = &supply->su1;
415-
su->fb_name = pdata->su1_fb;
416430
su->type = AS3711_BL_SU1;
417431

418432
max_brightness = min(pdata->su1_max_uA, 31);
@@ -423,7 +437,6 @@ static int as3711_backlight_probe(struct platform_device *pdev)
423437

424438
if (pdata->su2_fb) {
425439
su = &supply->su2;
426-
su->fb_name = pdata->su2_fb;
427440
su->type = AS3711_BL_SU2;
428441

429442
switch (pdata->su2_fbprot) {

drivers/video/backlight/generic_bl.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ static int genericbl_intensity;
2121
static struct backlight_device *generic_backlight_device;
2222
static struct generic_bl_info *bl_machinfo;
2323

24-
/* Flag to signal when the battery is low */
25-
#define GENERICBL_BATTLOW BL_CORE_DRIVER1
26-
2724
static int genericbl_send_intensity(struct backlight_device *bd)
2825
{
2926
int intensity = bd->props.brightness;
@@ -34,8 +31,6 @@ static int genericbl_send_intensity(struct backlight_device *bd)
3431
intensity = 0;
3532
if (bd->props.state & BL_CORE_SUSPENDED)
3633
intensity = 0;
37-
if (bd->props.state & GENERICBL_BATTLOW)
38-
intensity &= bl_machinfo->limit_mask;
3934

4035
bl_machinfo->set_bl_intensity(intensity);
4136

drivers/video/backlight/max8925_bl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(struct platform_device *pdev)
116116
if (!pdata)
117117
return;
118118

119-
np = of_find_node_by_name(nproot, "backlight");
119+
np = of_get_child_by_name(nproot, "backlight");
120120
if (!np) {
121121
dev_err(&pdev->dev, "failed to find backlight node\n");
122122
return;
@@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(struct platform_device *pdev)
125125
if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val))
126126
pdata->dual_string = val;
127127

128+
of_node_put(np);
129+
128130
pdev->dev.platform_data = pdata;
129131
}
130132

0 commit comments

Comments
 (0)