Skip to content

Commit e0d97b0

Browse files
committed
Merge tag 'backlight-next-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "New Drivers: - Texas Instruments LM3509 Backlight Driver Fix-ups: - Device Tree binding adaptions/conversions/creation - Drop i2c_device_id::driver_data where the value is unused - Make use of the new *_scoped() guard APIs - Decouple from fbdev by providing Backlight with its own BACKLIGHT_POWER_* constrains Bug Fixes: - Correctly assess return values (NULL vs IS_ERR()) - Supply a bunch of MODULE_DESCRIPTIONs to silence modpost warnings" * tag 'backlight-next-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (23 commits) backlight: sky81452-backlight: Use backlight power constants backlight: rave-sp-backlight: Use backlight power constants backlight: pwm-backlight: Use backlight power constants backlight: pcf50633-backlight: Use backlight power constants backlight: pandora-backlight: Use backlight power constants backlight: mp3309c: Use backlight power constants backlight: lm3533-backlight: Use backlight power constants backlight: led-backlight: Use backlight power constants backlight: ktd253-backlight: Use backlight power constants backlight: kb3886-bl: Use backlight power constants backlight: journada_bl: Use backlight power constants backlight: ipaq-micro-backlight: Use backlight power constants backlight: gpio-backlight: Use backlight power constants backlight: corgi-lcd: Use backlight power constants backlight: ams369fb06: Use backlight power constants backlight: aat2870-backlight: Use blacklight power constants backlight: Add BACKLIGHT_POWER_ constants for power states backlight: lm3509_bl: Fix early returns in for_each_child_of_node() backlight: Drop explicit initialization of struct i2c_device_id::driver_data to 0 backlight: Add missing MODULE_DESCRIPTION() macros ...
2 parents 1200af3 + 1df5aa3 commit e0d97b0

30 files changed

+550
-64
lines changed

Documentation/ABI/stable/sysfs-class-backlight

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ Date: April 2005
33
KernelVersion: 2.6.12
44
Contact: Richard Purdie <[email protected]>
55
Description:
6-
Control BACKLIGHT power, values are FB_BLANK_* from fb.h
6+
Control BACKLIGHT power, values are compatible with
7+
FB_BLANK_* from fb.h
78

8-
- FB_BLANK_UNBLANK (0) : power on.
9-
- FB_BLANK_POWERDOWN (4) : power off
9+
- 0 (FB_BLANK_UNBLANK) : power on.
10+
- 4 (FB_BLANK_POWERDOWN) : power off
1011
Users: HAL
1112

1213
What: /sys/class/backlight/<backlight>/brightness
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/backlight/ti,lm3509.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: TI LM3509 High Efficiency Boost for White LED's and/or OLED Displays
8+
9+
maintainers:
10+
- Patrick Gansterer <[email protected]>
11+
12+
description:
13+
The LM3509 current mode boost converter offers two separate outputs.
14+
https://www.ti.com/product/LM3509
15+
16+
properties:
17+
compatible:
18+
const: ti,lm3509
19+
20+
reg:
21+
maxItems: 1
22+
23+
"#address-cells":
24+
const: 1
25+
26+
"#size-cells":
27+
const: 0
28+
29+
reset-gpios:
30+
maxItems: 1
31+
32+
ti,brightness-rate-of-change-us:
33+
description: Brightness Rate of Change in microseconds.
34+
enum: [51, 13000, 26000, 52000]
35+
36+
ti,oled-mode:
37+
description: Enable OLED mode.
38+
type: boolean
39+
40+
patternProperties:
41+
"^led@[01]$":
42+
type: object
43+
description: Properties for a string of connected LEDs.
44+
$ref: common.yaml#
45+
46+
properties:
47+
reg:
48+
description:
49+
The control register that is used to program the two current sinks.
50+
The LM3509 has two registers (BMAIN and BSUB) and are represented
51+
as 0 or 1 in this property. The two current sinks can be controlled
52+
independently with both registers, or register BMAIN can be
53+
configured to control both sinks with the led-sources property.
54+
minimum: 0
55+
maximum: 1
56+
57+
label: true
58+
59+
led-sources:
60+
minItems: 1
61+
maxItems: 2
62+
items:
63+
minimum: 0
64+
maximum: 1
65+
66+
default-brightness:
67+
minimum: 0
68+
maximum: 31
69+
default: 18
70+
71+
max-brightness:
72+
minimum: 0
73+
maximum: 31
74+
default: 31
75+
76+
required:
77+
- reg
78+
79+
additionalProperties: false
80+
81+
required:
82+
- compatible
83+
- reg
84+
85+
additionalProperties: false
86+
87+
examples:
88+
- |
89+
#include <dt-bindings/gpio/gpio.h>
90+
i2c {
91+
#address-cells = <1>;
92+
#size-cells = <0>;
93+
94+
backlight@36 {
95+
compatible = "ti,lm3509";
96+
reg = <0x36>;
97+
reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
98+
99+
ti,oled-mode;
100+
ti,brightness-rate-of-change-us = <52000>;
101+
102+
#address-cells = <1>;
103+
#size-cells = <0>;
104+
105+
led@0 {
106+
reg = <0>;
107+
led-sources = <0 1>;
108+
label = "lcd-backlight";
109+
default-brightness = <12>;
110+
max-brightness = <31>;
111+
};
112+
};
113+
};
114+
- |
115+
i2c {
116+
#address-cells = <1>;
117+
#size-cells = <0>;
118+
119+
backlight@36 {
120+
compatible = "ti,lm3509";
121+
reg = <0x36>;
122+
123+
#address-cells = <1>;
124+
#size-cells = <0>;
125+
126+
led@0 {
127+
reg = <0>;
128+
default-brightness = <12>;
129+
};
130+
131+
led@1 {
132+
reg = <1>;
133+
default-brightness = <15>;
134+
};
135+
};
136+
};

drivers/video/backlight/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@ config BACKLIGHT_AAT2870
373373
If you have a AnalogicTech AAT2870 say Y to enable the
374374
backlight driver.
375375

376+
config BACKLIGHT_LM3509
377+
tristate "Backlight Driver for LM3509"
378+
depends on I2C
379+
select REGMAP_I2C
380+
help
381+
This supports TI LM3509 Backlight Driver
382+
376383
config BACKLIGHT_LM3630A
377384
tristate "Backlight Driver for LM3630A"
378385
depends on I2C && PWM

drivers/video/backlight/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o
3636
obj-$(CONFIG_BACKLIGHT_KTD253) += ktd253-backlight.o
3737
obj-$(CONFIG_BACKLIGHT_KTD2801) += ktd2801-backlight.o
3838
obj-$(CONFIG_BACKLIGHT_KTZ8866) += ktz8866.o
39+
obj-$(CONFIG_BACKLIGHT_LM3509) += lm3509_bl.o
3940
obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
4041
obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o
4142
obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o

drivers/video/backlight/aat2870_bl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
156156
bd->props.max_brightness = 255;
157157

158158
aat2870_bl->brightness = 0;
159-
bd->props.power = FB_BLANK_UNBLANK;
159+
bd->props.power = BACKLIGHT_POWER_ON;
160160
bd->props.brightness = bd->props.max_brightness;
161161

162162
ret = aat2870_bl_update_status(bd);
@@ -176,7 +176,7 @@ static void aat2870_bl_remove(struct platform_device *pdev)
176176
struct aat2870_bl_driver_data *aat2870_bl = platform_get_drvdata(pdev);
177177
struct backlight_device *bd = aat2870_bl->bd;
178178

179-
bd->props.power = FB_BLANK_POWERDOWN;
179+
bd->props.power = BACKLIGHT_POWER_OFF;
180180
bd->props.brightness = 0;
181181
backlight_update_status(bd);
182182
}

drivers/video/backlight/adp8870_bl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ static SIMPLE_DEV_PM_OPS(adp8870_i2c_pm_ops, adp8870_i2c_suspend,
963963
adp8870_i2c_resume);
964964

965965
static const struct i2c_device_id adp8870_id[] = {
966-
{ "adp8870", 0 },
966+
{ "adp8870" },
967967
{ }
968968
};
969969
MODULE_DEVICE_TABLE(i2c, adp8870_id);

drivers/video/backlight/ams369fg06.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <linux/backlight.h>
1212
#include <linux/delay.h>
13-
#include <linux/fb.h>
1413
#include <linux/lcd.h>
1514
#include <linux/module.h>
1615
#include <linux/spi/spi.h>
@@ -300,7 +299,7 @@ static int ams369fg06_ldi_disable(struct ams369fg06 *lcd)
300299

301300
static int ams369fg06_power_is_on(int power)
302301
{
303-
return power <= FB_BLANK_NORMAL;
302+
return power <= BACKLIGHT_POWER_REDUCED;
304303
}
305304

306305
static int ams369fg06_power_on(struct ams369fg06 *lcd)
@@ -396,8 +395,8 @@ static int ams369fg06_set_power(struct lcd_device *ld, int power)
396395
{
397396
struct ams369fg06 *lcd = lcd_get_data(ld);
398397

399-
if (power != FB_BLANK_UNBLANK && power != FB_BLANK_POWERDOWN &&
400-
power != FB_BLANK_NORMAL) {
398+
if (power != BACKLIGHT_POWER_ON && power != BACKLIGHT_POWER_OFF &&
399+
power != BACKLIGHT_POWER_REDUCED) {
401400
dev_err(lcd->dev, "power value should be 0, 1 or 4.\n");
402401
return -EINVAL;
403402
}
@@ -492,11 +491,11 @@ static int ams369fg06_probe(struct spi_device *spi)
492491
* current lcd status is powerdown and then
493492
* it enables lcd panel.
494493
*/
495-
lcd->power = FB_BLANK_POWERDOWN;
494+
lcd->power = BACKLIGHT_POWER_OFF;
496495

497-
ams369fg06_power(lcd, FB_BLANK_UNBLANK);
496+
ams369fg06_power(lcd, BACKLIGHT_POWER_ON);
498497
} else {
499-
lcd->power = FB_BLANK_UNBLANK;
498+
lcd->power = BACKLIGHT_POWER_ON;
500499
}
501500

502501
spi_set_drvdata(spi, lcd);
@@ -510,7 +509,7 @@ static void ams369fg06_remove(struct spi_device *spi)
510509
{
511510
struct ams369fg06 *lcd = spi_get_drvdata(spi);
512511

513-
ams369fg06_power(lcd, FB_BLANK_POWERDOWN);
512+
ams369fg06_power(lcd, BACKLIGHT_POWER_OFF);
514513
}
515514

516515
#ifdef CONFIG_PM_SLEEP
@@ -524,16 +523,16 @@ static int ams369fg06_suspend(struct device *dev)
524523
* when lcd panel is suspend, lcd panel becomes off
525524
* regardless of status.
526525
*/
527-
return ams369fg06_power(lcd, FB_BLANK_POWERDOWN);
526+
return ams369fg06_power(lcd, BACKLIGHT_POWER_OFF);
528527
}
529528

530529
static int ams369fg06_resume(struct device *dev)
531530
{
532531
struct ams369fg06 *lcd = dev_get_drvdata(dev);
533532

534-
lcd->power = FB_BLANK_POWERDOWN;
533+
lcd->power = BACKLIGHT_POWER_OFF;
535534

536-
return ams369fg06_power(lcd, FB_BLANK_UNBLANK);
535+
return ams369fg06_power(lcd, BACKLIGHT_POWER_ON);
537536
}
538537
#endif
539538

@@ -544,7 +543,7 @@ static void ams369fg06_shutdown(struct spi_device *spi)
544543
{
545544
struct ams369fg06 *lcd = spi_get_drvdata(spi);
546545

547-
ams369fg06_power(lcd, FB_BLANK_POWERDOWN);
546+
ams369fg06_power(lcd, BACKLIGHT_POWER_OFF);
548547
}
549548

550549
static struct spi_driver ams369fg06_driver = {

drivers/video/backlight/bd6107.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static void bd6107_remove(struct i2c_client *client)
180180
}
181181

182182
static const struct i2c_device_id bd6107_ids[] = {
183-
{ "bd6107", 0 },
183+
{ "bd6107" },
184184
{ }
185185
};
186186
MODULE_DEVICE_TABLE(i2c, bd6107_ids);

drivers/video/backlight/corgi_lcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static int corgi_lcd_probe(struct spi_device *spi)
526526
return PTR_ERR(lcd->bl_dev);
527527

528528
lcd->bl_dev->props.brightness = pdata->default_intensity;
529-
lcd->bl_dev->props.power = FB_BLANK_UNBLANK;
529+
lcd->bl_dev->props.power = BACKLIGHT_POWER_ON;
530530

531531
ret = setup_gpio_backlight(lcd, pdata);
532532
if (ret)
@@ -547,7 +547,7 @@ static void corgi_lcd_remove(struct spi_device *spi)
547547
{
548548
struct corgi_lcd *lcd = spi_get_drvdata(spi);
549549

550-
lcd->bl_dev->props.power = FB_BLANK_UNBLANK;
550+
lcd->bl_dev->props.power = BACKLIGHT_POWER_ON;
551551
lcd->bl_dev->props.brightness = 0;
552552
backlight_update_status(lcd->bl_dev);
553553
corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN);

drivers/video/backlight/gpio_backlight.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <linux/backlight.h>
77
#include <linux/err.h>
8-
#include <linux/fb.h>
98
#include <linux/gpio/consumer.h>
109
#include <linux/init.h>
1110
#include <linux/kernel.h>
@@ -81,12 +80,12 @@ static int gpio_backlight_probe(struct platform_device *pdev)
8180
/* Set the initial power state */
8281
if (!of_node || !of_node->phandle)
8382
/* Not booted with device tree or no phandle link to the node */
84-
bl->props.power = def_value ? FB_BLANK_UNBLANK
85-
: FB_BLANK_POWERDOWN;
83+
bl->props.power = def_value ? BACKLIGHT_POWER_ON
84+
: BACKLIGHT_POWER_OFF;
8685
else if (gpiod_get_value_cansleep(gbl->gpiod) == 0)
87-
bl->props.power = FB_BLANK_POWERDOWN;
86+
bl->props.power = BACKLIGHT_POWER_OFF;
8887
else
89-
bl->props.power = FB_BLANK_UNBLANK;
88+
bl->props.power = BACKLIGHT_POWER_ON;
9089

9190
bl->props.brightness = 1;
9291

0 commit comments

Comments
 (0)