Skip to content

Commit 38edc3d

Browse files
committed
Merge tag 'backlight-next-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "New Functionality: - Add support for an enable GPIO; lm3630a_bl - Add support for short circuit handling; qcom-wled - Add support for automatic string detection; qcom-wled Fix-ups: - Update Device Tree bindings; lm3630a-backlight, led-backlight, qcom-wled - Constify; ipaq_micro_bl - Optimise for CPU cycles; pwm_bl - Coding style fix-ups; pwm_bl - Trivial fix-ups (white space, comments, renaming); pwm_bl, gpio_backlight, qcom-wled - Kconfig dependency hacking; LCD_HP700 - Rename, refactor and add peripherals; pm8941-wled => qcom-wled - Make use of GPIO look-up tables; tosa_bl, tosa_lcd - Remove superfluous code; gpio_backlight - Adapt GPIO direction handling; gpio_backlight - Remove legacy use of platform data; gpio_backlight Bug Fixes: - Provide modules aliases; lm3630a_bl" * tag 'backlight-next-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (32 commits) backlight: qcom-wled: Fix spelling mistake "trigged" -> "triggered" backlight: gpio: Pull gpio_backlight_initial_power_state() into probe backlight: gpio: Use a helper variable for &pdev->dev backlight: gpio: Remove unused fields from platform data sh: ecovec24: don't set unused fields in platform data backlight: gpio: Simplify the platform data handling sh: ecovec24: add additional properties to the backlight device backlight: gpio: Explicitly set the direction of the GPIO backlight: gpio: Remove stray newline backlight: gpio: Remove unneeded include video: backlight: tosa: Use GPIO lookup table backlight: qcom-wled: Add auto string detection logic backlight: qcom-wled: Add support for short circuit handling backlight: qcom-wled: Add support for WLED4 peripheral backlight: qcom-wled: Restructure the driver for WLED3 backlight: qcom-wled: Rename PM8941* to WLED3 backlight: qcom-wled: Add new properties for PMI8998 backlight: qcom-wled: Restructure the qcom-wled bindings backlight: qcom-wled: Rename pm8941-wled.c to qcom-wled.c dt-bindings: backlight: lm3630a: Fix missing include ...
2 parents 8b233da + 102a1b3 commit 38edc3d

File tree

19 files changed

+1653
-612
lines changed

19 files changed

+1653
-612
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
led-backlight bindings
2+
3+
This binding is used to describe a basic backlight device made of LEDs.
4+
It can also be used to describe a backlight device controlled by the output of
5+
a LED driver.
6+
7+
Required properties:
8+
- compatible: "led-backlight"
9+
- leds: a list of LEDs
10+
11+
Optional properties:
12+
- brightness-levels: Array of distinct brightness levels. The levels must be
13+
in the range accepted by the underlying LED devices.
14+
This is used to translate a backlight brightness level
15+
into a LED brightness level. If it is not provided, the
16+
identity mapping is used.
17+
18+
- default-brightness-level: The default brightness level.
19+
20+
Example:
21+
22+
backlight {
23+
compatible = "led-backlight";
24+
25+
leds = <&led1>, <&led2>;
26+
brightness-levels = <0 4 8 16 32 64 128 255>;
27+
default-brightness-level = <6>;
28+
};

Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ properties:
2929
'#size-cells':
3030
const: 0
3131

32+
enable-gpios:
33+
description: GPIO to use to enable/disable the backlight (HWEN pin).
34+
maxItems: 1
35+
3236
required:
3337
- compatible
3438
- reg
@@ -89,13 +93,15 @@ additionalProperties: false
8993

9094
examples:
9195
- |
96+
#include <dt-bindings/gpio/gpio.h>
9297
i2c {
9398
#address-cells = <1>;
9499
#size-cells = <0>;
95100
96101
led-controller@38 {
97102
compatible = "ti,lm3630a";
98103
reg = <0x38>;
104+
enable-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
99105
100106
#address-cells = <1>;
101107
#size-cells = <0>;

Documentation/devicetree/bindings/leds/backlight/pm8941-wled.txt

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
Binding for Qualcomm Technologies, Inc. WLED driver
2+
3+
WLED (White Light Emitting Diode) driver is used for controlling display
4+
backlight that is part of PMIC on Qualcomm Technologies, Inc. reference
5+
platforms. The PMIC is connected to the host processor via SPMI bus.
6+
7+
- compatible
8+
Usage: required
9+
Value type: <string>
10+
Definition: should be one of:
11+
"qcom,pm8941-wled"
12+
"qcom,pmi8998-wled"
13+
"qcom,pm660l-wled"
14+
15+
- reg
16+
Usage: required
17+
Value type: <prop encoded array>
18+
Definition: Base address of the WLED modules.
19+
20+
- default-brightness
21+
Usage: optional
22+
Value type: <u32>
23+
Definition: brightness value on boot, value from: 0-4095.
24+
Default: 2048
25+
26+
- label
27+
Usage: required
28+
Value type: <string>
29+
Definition: The name of the backlight device
30+
31+
- qcom,cs-out
32+
Usage: optional
33+
Value type: <bool>
34+
Definition: enable current sink output.
35+
This property is supported only for PM8941.
36+
37+
- qcom,cabc
38+
Usage: optional
39+
Value type: <bool>
40+
Definition: enable content adaptive backlight control.
41+
42+
- qcom,ext-gen
43+
Usage: optional
44+
Value type: <bool>
45+
Definition: use externally generated modulator signal to dim.
46+
This property is supported only for PM8941.
47+
48+
- qcom,current-limit
49+
Usage: optional
50+
Value type: <u32>
51+
Definition: mA; per-string current limit; value from 0 to 25 with
52+
1 mA step. Default 20 mA.
53+
This property is supported only for pm8941.
54+
55+
- qcom,current-limit-microamp
56+
Usage: optional
57+
Value type: <u32>
58+
Definition: uA; per-string current limit; value from 0 to 30000 with
59+
2500 uA step. Default 25 mA.
60+
61+
- qcom,current-boost-limit
62+
Usage: optional
63+
Value type: <u32>
64+
Definition: mA; boost current limit.
65+
For pm8941: one of: 105, 385, 525, 805, 980, 1260, 1400,
66+
1680. Default: 805 mA.
67+
For pmi8998: one of: 105, 280, 450, 620, 970, 1150, 1300,
68+
1500. Default: 970 mA.
69+
70+
- qcom,switching-freq
71+
Usage: optional
72+
Value type: <u32>
73+
Definition: kHz; switching frequency; one of: 600, 640, 685, 738,
74+
800, 872, 960, 1066, 1200, 1371, 1600, 1920, 2400, 3200,
75+
4800, 9600.
76+
Default: for pm8941: 1600 kHz
77+
for pmi8998: 800 kHz
78+
79+
- qcom,ovp
80+
Usage: optional
81+
Value type: <u32>
82+
Definition: V; Over-voltage protection limit; one of:
83+
27, 29, 32, 35. Default: 29V
84+
This property is supported only for PM8941.
85+
86+
- qcom,ovp-millivolt
87+
Usage: optional
88+
Value type: <u32>
89+
Definition: mV; Over-voltage protection limit;
90+
For pmi8998: one of 18100, 19600, 29600, 31100.
91+
Default 29600 mV.
92+
If this property is not specified for PM8941, it
93+
falls back to "qcom,ovp" property.
94+
95+
- qcom,num-strings
96+
Usage: optional
97+
Value type: <u32>
98+
Definition: #; number of led strings attached;
99+
value: For PM8941 from 1 to 3. Default: 2
100+
For PMI8998 from 1 to 4.
101+
102+
- interrupts
103+
Usage: optional
104+
Value type: <prop encoded array>
105+
Definition: Interrupts associated with WLED. This should be
106+
"short" and "ovp" interrupts. Interrupts can be
107+
specified as per the encoding listed under
108+
Documentation/devicetree/bindings/spmi/
109+
qcom,spmi-pmic-arb.txt.
110+
111+
- interrupt-names
112+
Usage: optional
113+
Value type: <string>
114+
Definition: Interrupt names associated with the interrupts.
115+
Must be "short" and "ovp". The short circuit detection
116+
is not supported for PM8941.
117+
118+
- qcom,enabled-strings
119+
Usage: optional
120+
Value tyoe: <u32 array>
121+
Definition: Array of the WLED strings numbered from 0 to 3. Each
122+
string of leds are operated individually. Specify the
123+
list of strings used by the device. Any combination of
124+
led strings can be used.
125+
126+
- qcom,external-pfet
127+
Usage: optional
128+
Value type: <bool>
129+
Definition: Specify if external PFET control for short circuit
130+
protection is used. This property is supported only
131+
for PMI8998.
132+
133+
- qcom,auto-string-detection
134+
Usage: optional
135+
Value type: <bool>
136+
Definition: Enables auto-detection of the WLED string configuration.
137+
This feature is not supported for PM8941.
138+
139+
140+
Example:
141+
142+
pm8941-wled@d800 {
143+
compatible = "qcom,pm8941-wled";
144+
reg = <0xd800>;
145+
label = "backlight";
146+
147+
qcom,cs-out;
148+
qcom,current-limit = <20>;
149+
qcom,current-boost-limit = <805>;
150+
qcom,switching-freq = <1600>;
151+
qcom,ovp = <29>;
152+
qcom,num-strings = <2>;
153+
qcom,enabled-strings = <0 1>;
154+
};

arch/arm/mach-pxa/include/mach/tosa.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,6 @@
7272
#define TOSA_GPIO_BAT0_TH_ON (TOSA_TC6393XB_GPIO_BASE + 14)
7373
#define TOSA_GPIO_BAT1_TH_ON (TOSA_TC6393XB_GPIO_BASE + 15)
7474

75-
/*
76-
* Timing Generator
77-
*/
78-
#define TG_PNLCTL 0x00
79-
#define TG_TPOSCTL 0x01
80-
#define TG_DUTYCTL 0x02
81-
#define TG_GPOSR 0x03
82-
#define TG_GPODR1 0x04
83-
#define TG_GPODR2 0x05
84-
#define TG_PINICTL 0x06
85-
#define TG_HPOSCTL 0x07
86-
8775
/*
8876
* PXA GPIOs
8977
*/
@@ -192,7 +180,4 @@
192180
#define TOSA_KEY_MAIL KEY_MAIL
193181
#endif
194182

195-
struct spi_device;
196-
extern int tosa_bl_enable(struct spi_device *spi, int enable);
197-
198183
#endif /* _ASM_ARCH_TOSA_H_ */

arch/arm/mach-pxa/tosa.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,26 @@ static struct pxa2xx_spi_controller pxa_ssp_master_info = {
813813
.num_chipselect = 1,
814814
};
815815

816+
static struct gpiod_lookup_table tosa_lcd_gpio_table = {
817+
.dev_id = "spi2.0",
818+
.table = {
819+
GPIO_LOOKUP("tc6393xb",
820+
TOSA_GPIO_TG_ON - TOSA_TC6393XB_GPIO_BASE,
821+
"tg #pwr", GPIO_ACTIVE_HIGH),
822+
{ },
823+
},
824+
};
825+
826+
static struct gpiod_lookup_table tosa_lcd_bl_gpio_table = {
827+
.dev_id = "i2c-tosa-bl",
828+
.table = {
829+
GPIO_LOOKUP("tc6393xb",
830+
TOSA_GPIO_BL_C20MA - TOSA_TC6393XB_GPIO_BASE,
831+
"backlight", GPIO_ACTIVE_HIGH),
832+
{ },
833+
},
834+
};
835+
816836
static struct spi_board_info spi_board_info[] __initdata = {
817837
{
818838
.modalias = "tosa-lcd",
@@ -923,6 +943,8 @@ static void __init tosa_init(void)
923943
platform_scoop_config = &tosa_pcmcia_config;
924944

925945
pxa2xx_set_spi_info(2, &pxa_ssp_master_info);
946+
gpiod_add_lookup_table(&tosa_lcd_gpio_table);
947+
gpiod_add_lookup_table(&tosa_lcd_bl_gpio_table);
926948
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
927949

928950
clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL);

arch/sh/boards/mach-ecovec24/setup.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,20 +371,32 @@ static struct platform_device lcdc_device = {
371371
},
372372
};
373373

374+
static struct gpiod_lookup_table gpio_backlight_lookup = {
375+
.dev_id = "gpio-backlight.0",
376+
.table = {
377+
GPIO_LOOKUP("sh7724_pfc", GPIO_PTR1, NULL, GPIO_ACTIVE_HIGH),
378+
{ }
379+
},
380+
};
381+
382+
static struct property_entry gpio_backlight_props[] = {
383+
PROPERTY_ENTRY_BOOL("default-on"),
384+
{ }
385+
};
386+
374387
static struct gpio_backlight_platform_data gpio_backlight_data = {
375388
.fbdev = &lcdc_device.dev,
376-
.gpio = GPIO_PTR1,
377-
.def_value = 1,
378-
.name = "backlight",
379389
};
380390

381-
static struct platform_device gpio_backlight_device = {
391+
static const struct platform_device_info gpio_backlight_device_info = {
382392
.name = "gpio-backlight",
383-
.dev = {
384-
.platform_data = &gpio_backlight_data,
385-
},
393+
.data = &gpio_backlight_data,
394+
.size_data = sizeof(gpio_backlight_data),
395+
.properties = gpio_backlight_props,
386396
};
387397

398+
static struct platform_device *gpio_backlight_device;
399+
388400
/* CEU0 */
389401
static struct ceu_platform_data ceu0_pdata = {
390402
.num_subdevs = 2,
@@ -1006,7 +1018,6 @@ static struct platform_device *ecovec_devices[] __initdata = {
10061018
&usb1_common_device,
10071019
&usbhs_device,
10081020
&lcdc_device,
1009-
&gpio_backlight_device,
10101021
&keysc_device,
10111022
&cn12_power,
10121023
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
@@ -1462,6 +1473,12 @@ static int __init arch_setup(void)
14621473
#endif
14631474
#endif
14641475

1476+
gpiod_add_lookup_table(&gpio_backlight_lookup);
1477+
gpio_backlight_device = platform_device_register_full(
1478+
&gpio_backlight_device_info);
1479+
if (IS_ERR(gpio_backlight_device))
1480+
return PTR_ERR(gpio_backlight_device);
1481+
14651482
return platform_add_devices(ecovec_devices,
14661483
ARRAY_SIZE(ecovec_devices));
14671484
}

0 commit comments

Comments
 (0)