Skip to content

Commit 75b9fcb

Browse files
committed
Merge tag 'backlight-next-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "Core Framework: - Change maintainer email address Fix-ups: - Obtain OCP level from Device Tree; rt4831-backlight - DT fix-ups/conversions; richtek,rt4831-backlight - Remove unused code / functionatlity; platform_lcd - Switch to atomic PWM API; lp855x_bl * tag 'backlight-next-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: MAINTAINERS: Use Lee Jones' kernel.org address for Backlight submissions backlight: lp855x: Switch to atomic PWM API dt-bindings: backlight: Update Lee Jones' email address Revert "drivers/video/backlight/platform_lcd.c: add support for device tree based probe" backlight: rt4831: Apply ocp level from devicetree dt-bindings: backlight: rt4831: Add the new ocp level property
2 parents 613b2a8 + fe201f6 commit 75b9fcb

File tree

10 files changed

+52
-29
lines changed

10 files changed

+52
-29
lines changed

Documentation/devicetree/bindings/leds/backlight/common.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
77
title: Common backlight properties
88

99
maintainers:
10-
- Lee Jones <lee.jones@linaro.org>
10+
- Lee Jones <lee@kernel.org>
1111
- Daniel Thompson <[email protected]>
1212
- Jingoo Han <[email protected]>
1313

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
77
title: gpio-backlight bindings
88

99
maintainers:
10-
- Lee Jones <lee.jones@linaro.org>
10+
- Lee Jones <lee@kernel.org>
1111
- Daniel Thompson <[email protected]>
1212
- Jingoo Han <[email protected]>
1313

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
77
title: led-backlight bindings
88

99
maintainers:
10-
- Lee Jones <lee.jones@linaro.org>
10+
- Lee Jones <lee@kernel.org>
1111
- Daniel Thompson <[email protected]>
1212
- Jingoo Han <[email protected]>
1313

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
77
title: TI LM3630A High-Efficiency Dual-String White LED
88

99
maintainers:
10-
- Lee Jones <lee.jones@linaro.org>
10+
- Lee Jones <lee@kernel.org>
1111
- Daniel Thompson <[email protected]>
1212
- Jingoo Han <[email protected]>
1313

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
77
title: pwm-backlight bindings
88

99
maintainers:
10-
- Lee Jones <lee.jones@linaro.org>
10+
- Lee Jones <lee@kernel.org>
1111
- Daniel Thompson <[email protected]>
1212
- Jingoo Han <[email protected]>
1313

Documentation/devicetree/bindings/leds/backlight/richtek,rt4831-backlight.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ properties:
4747
minimum: 0
4848
maximum: 3
4949

50+
richtek,bled-ocp-microamp:
51+
description: |
52+
Backlight over current protection level.
53+
enum: [900000, 1200000, 1500000, 1800000]
54+
5055
richtek,channel-use:
5156
description: |
5257
Backlight LED channel to be used.

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3501,7 +3501,7 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/b43
35013501
F: drivers/net/wireless/broadcom/b43legacy/
35023502

35033503
BACKLIGHT CLASS/SUBSYSTEM
3504-
M: Lee Jones <lee.jones@linaro.org>
3504+
M: Lee Jones <lee@kernel.org>
35053505
M: Daniel Thompson <[email protected]>
35063506
M: Jingoo Han <[email protected]>
35073507

drivers/video/backlight/lp855x_bl.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,8 @@ static int lp855x_configure(struct lp855x *lp)
218218

219219
static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
220220
{
221-
unsigned int period = lp->pdata->period_ns;
222-
unsigned int duty = br * period / max_br;
223221
struct pwm_device *pwm;
222+
struct pwm_state state;
224223

225224
/* request pwm device with the consumer name */
226225
if (!lp->pwm) {
@@ -230,18 +229,16 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
230229

231230
lp->pwm = pwm;
232231

233-
/*
234-
* FIXME: pwm_apply_args() should be removed when switching to
235-
* the atomic PWM API.
236-
*/
237-
pwm_apply_args(pwm);
232+
pwm_init_state(lp->pwm, &state);
233+
} else {
234+
pwm_get_state(lp->pwm, &state);
238235
}
239236

240-
pwm_config(lp->pwm, duty, period);
241-
if (duty)
242-
pwm_enable(lp->pwm);
243-
else
244-
pwm_disable(lp->pwm);
237+
state.period = lp->pdata->period_ns;
238+
state.duty_cycle = div_u64(br * state.period, max_br);
239+
state.enabled = state.duty_cycle;
240+
241+
pwm_apply_state(lp->pwm, &state);
245242
}
246243

247244
static int lp855x_bl_update_status(struct backlight_device *bl)

drivers/video/backlight/platform_lcd.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <linux/fb.h>
1313
#include <linux/backlight.h>
1414
#include <linux/lcd.h>
15-
#include <linux/of.h>
1615
#include <linux/slab.h>
1716

1817
#include <video/platform_lcd.h>
@@ -133,19 +132,10 @@ static int platform_lcd_resume(struct device *dev)
133132
static SIMPLE_DEV_PM_OPS(platform_lcd_pm_ops, platform_lcd_suspend,
134133
platform_lcd_resume);
135134

136-
#ifdef CONFIG_OF
137-
static const struct of_device_id platform_lcd_of_match[] = {
138-
{ .compatible = "platform-lcd" },
139-
{},
140-
};
141-
MODULE_DEVICE_TABLE(of, platform_lcd_of_match);
142-
#endif
143-
144135
static struct platform_driver platform_lcd_driver = {
145136
.driver = {
146137
.name = "platform-lcd",
147138
.pm = &platform_lcd_pm_ops,
148-
.of_match_table = of_match_ptr(platform_lcd_of_match),
149139
},
150140
.probe = platform_lcd_probe,
151141
};

drivers/video/backlight/rt4831-backlight.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define RT4831_REG_BLCFG 0x02
1313
#define RT4831_REG_BLDIML 0x04
1414
#define RT4831_REG_ENABLE 0x08
15+
#define RT4831_REG_BLOPT2 0x11
1516

1617
#define RT4831_BLMAX_BRIGHTNESS 2048
1718

@@ -23,6 +24,11 @@
2324
#define RT4831_BLDIML_MASK GENMASK(2, 0)
2425
#define RT4831_BLDIMH_MASK GENMASK(10, 3)
2526
#define RT4831_BLDIMH_SHIFT 3
27+
#define RT4831_BLOCP_MASK GENMASK(1, 0)
28+
29+
#define RT4831_BLOCP_MINUA 900000
30+
#define RT4831_BLOCP_MAXUA 1800000
31+
#define RT4831_BLOCP_STEPUA 300000
2632

2733
struct rt4831_priv {
2834
struct device *dev;
@@ -85,7 +91,7 @@ static int rt4831_parse_backlight_properties(struct rt4831_priv *priv,
8591
{
8692
struct device *dev = priv->dev;
8793
u8 propval;
88-
u32 brightness;
94+
u32 brightness, ocp_uA;
8995
unsigned int val = 0;
9096
int ret;
9197

@@ -120,6 +126,31 @@ static int rt4831_parse_backlight_properties(struct rt4831_priv *priv,
120126
if (ret)
121127
return ret;
122128

129+
/*
130+
* This OCP level is used to protect and limit the inductor current.
131+
* If inductor peak current reach the level, low-side MOSFET will be
132+
* turned off. Meanwhile, the output channel current may be limited.
133+
* To match the configured channel current, the inductor chosen must
134+
* be higher than the OCP level.
135+
*
136+
* Not like the OVP level, the default 21V can be used in the most
137+
* application. But if the chosen OCP level is smaller than needed,
138+
* it will also affect the backlight channel output current to be
139+
* smaller than the register setting.
140+
*/
141+
ret = device_property_read_u32(dev, "richtek,bled-ocp-microamp",
142+
&ocp_uA);
143+
if (!ret) {
144+
ocp_uA = clamp_val(ocp_uA, RT4831_BLOCP_MINUA,
145+
RT4831_BLOCP_MAXUA);
146+
val = DIV_ROUND_UP(ocp_uA - RT4831_BLOCP_MINUA,
147+
RT4831_BLOCP_STEPUA);
148+
ret = regmap_update_bits(priv->regmap, RT4831_REG_BLOPT2,
149+
RT4831_BLOCP_MASK, val);
150+
if (ret)
151+
return ret;
152+
}
153+
123154
ret = device_property_read_u8(dev, "richtek,channel-use", &propval);
124155
if (ret) {
125156
dev_err(dev, "richtek,channel-use DT property missing\n");

0 commit comments

Comments
 (0)