Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+52 -29
+1 -1
Documentation/devicetree/bindings/leds/backlight/common.yaml
··· 7 7 title: Common backlight properties 8 8 9 9 maintainers: 10 - - Lee Jones <lee.jones@linaro.org> 10 + - Lee Jones <lee@kernel.org> 11 11 - Daniel Thompson <daniel.thompson@linaro.org> 12 12 - Jingoo Han <jingoohan1@gmail.com> 13 13
+1 -1
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml
··· 7 7 title: gpio-backlight bindings 8 8 9 9 maintainers: 10 - - Lee Jones <lee.jones@linaro.org> 10 + - Lee Jones <lee@kernel.org> 11 11 - Daniel Thompson <daniel.thompson@linaro.org> 12 12 - Jingoo Han <jingoohan1@gmail.com> 13 13
+1 -1
Documentation/devicetree/bindings/leds/backlight/led-backlight.yaml
··· 7 7 title: led-backlight bindings 8 8 9 9 maintainers: 10 - - Lee Jones <lee.jones@linaro.org> 10 + - Lee Jones <lee@kernel.org> 11 11 - Daniel Thompson <daniel.thompson@linaro.org> 12 12 - Jingoo Han <jingoohan1@gmail.com> 13 13
+1 -1
Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml
··· 7 7 title: TI LM3630A High-Efficiency Dual-String White LED 8 8 9 9 maintainers: 10 - - Lee Jones <lee.jones@linaro.org> 10 + - Lee Jones <lee@kernel.org> 11 11 - Daniel Thompson <daniel.thompson@linaro.org> 12 12 - Jingoo Han <jingoohan1@gmail.com> 13 13
+1 -1
Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml
··· 7 7 title: pwm-backlight bindings 8 8 9 9 maintainers: 10 - - Lee Jones <lee.jones@linaro.org> 10 + - Lee Jones <lee@kernel.org> 11 11 - Daniel Thompson <daniel.thompson@linaro.org> 12 12 - Jingoo Han <jingoohan1@gmail.com> 13 13
+5
Documentation/devicetree/bindings/leds/backlight/richtek,rt4831-backlight.yaml
··· 47 47 minimum: 0 48 48 maximum: 3 49 49 50 + richtek,bled-ocp-microamp: 51 + description: | 52 + Backlight over current protection level. 53 + enum: [900000, 1200000, 1500000, 1800000] 54 + 50 55 richtek,channel-use: 51 56 description: | 52 57 Backlight LED channel to be used.
+1 -1
MAINTAINERS
··· 3501 3501 F: drivers/net/wireless/broadcom/b43legacy/ 3502 3502 3503 3503 BACKLIGHT CLASS/SUBSYSTEM 3504 - M: Lee Jones <lee.jones@linaro.org> 3504 + M: Lee Jones <lee@kernel.org> 3505 3505 M: Daniel Thompson <daniel.thompson@linaro.org> 3506 3506 M: Jingoo Han <jingoohan1@gmail.com> 3507 3507 L: dri-devel@lists.freedesktop.org
+9 -12
drivers/video/backlight/lp855x_bl.c
··· 218 218 219 219 static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) 220 220 { 221 - unsigned int period = lp->pdata->period_ns; 222 - unsigned int duty = br * period / max_br; 223 221 struct pwm_device *pwm; 222 + struct pwm_state state; 224 223 225 224 /* request pwm device with the consumer name */ 226 225 if (!lp->pwm) { ··· 229 230 230 231 lp->pwm = pwm; 231 232 232 - /* 233 - * FIXME: pwm_apply_args() should be removed when switching to 234 - * the atomic PWM API. 235 - */ 236 - pwm_apply_args(pwm); 233 + pwm_init_state(lp->pwm, &state); 234 + } else { 235 + pwm_get_state(lp->pwm, &state); 237 236 } 238 237 239 - pwm_config(lp->pwm, duty, period); 240 - if (duty) 241 - pwm_enable(lp->pwm); 242 - else 243 - pwm_disable(lp->pwm); 238 + state.period = lp->pdata->period_ns; 239 + state.duty_cycle = div_u64(br * state.period, max_br); 240 + state.enabled = state.duty_cycle; 241 + 242 + pwm_apply_state(lp->pwm, &state); 244 243 } 245 244 246 245 static int lp855x_bl_update_status(struct backlight_device *bl)
-10
drivers/video/backlight/platform_lcd.c
··· 12 12 #include <linux/fb.h> 13 13 #include <linux/backlight.h> 14 14 #include <linux/lcd.h> 15 - #include <linux/of.h> 16 15 #include <linux/slab.h> 17 16 18 17 #include <video/platform_lcd.h> ··· 132 133 static SIMPLE_DEV_PM_OPS(platform_lcd_pm_ops, platform_lcd_suspend, 133 134 platform_lcd_resume); 134 135 135 - #ifdef CONFIG_OF 136 - static const struct of_device_id platform_lcd_of_match[] = { 137 - { .compatible = "platform-lcd" }, 138 - {}, 139 - }; 140 - MODULE_DEVICE_TABLE(of, platform_lcd_of_match); 141 - #endif 142 - 143 136 static struct platform_driver platform_lcd_driver = { 144 137 .driver = { 145 138 .name = "platform-lcd", 146 139 .pm = &platform_lcd_pm_ops, 147 - .of_match_table = of_match_ptr(platform_lcd_of_match), 148 140 }, 149 141 .probe = platform_lcd_probe, 150 142 };
+32 -1
drivers/video/backlight/rt4831-backlight.c
··· 12 12 #define RT4831_REG_BLCFG 0x02 13 13 #define RT4831_REG_BLDIML 0x04 14 14 #define RT4831_REG_ENABLE 0x08 15 + #define RT4831_REG_BLOPT2 0x11 15 16 16 17 #define RT4831_BLMAX_BRIGHTNESS 2048 17 18 ··· 24 23 #define RT4831_BLDIML_MASK GENMASK(2, 0) 25 24 #define RT4831_BLDIMH_MASK GENMASK(10, 3) 26 25 #define RT4831_BLDIMH_SHIFT 3 26 + #define RT4831_BLOCP_MASK GENMASK(1, 0) 27 + 28 + #define RT4831_BLOCP_MINUA 900000 29 + #define RT4831_BLOCP_MAXUA 1800000 30 + #define RT4831_BLOCP_STEPUA 300000 27 31 28 32 struct rt4831_priv { 29 33 struct device *dev; ··· 91 85 { 92 86 struct device *dev = priv->dev; 93 87 u8 propval; 94 - u32 brightness; 88 + u32 brightness, ocp_uA; 95 89 unsigned int val = 0; 96 90 int ret; 97 91 ··· 125 119 propval << RT4831_BLOVP_SHIFT); 126 120 if (ret) 127 121 return ret; 122 + 123 + /* 124 + * This OCP level is used to protect and limit the inductor current. 125 + * If inductor peak current reach the level, low-side MOSFET will be 126 + * turned off. Meanwhile, the output channel current may be limited. 127 + * To match the configured channel current, the inductor chosen must 128 + * be higher than the OCP level. 129 + * 130 + * Not like the OVP level, the default 21V can be used in the most 131 + * application. But if the chosen OCP level is smaller than needed, 132 + * it will also affect the backlight channel output current to be 133 + * smaller than the register setting. 134 + */ 135 + ret = device_property_read_u32(dev, "richtek,bled-ocp-microamp", 136 + &ocp_uA); 137 + if (!ret) { 138 + ocp_uA = clamp_val(ocp_uA, RT4831_BLOCP_MINUA, 139 + RT4831_BLOCP_MAXUA); 140 + val = DIV_ROUND_UP(ocp_uA - RT4831_BLOCP_MINUA, 141 + RT4831_BLOCP_STEPUA); 142 + ret = regmap_update_bits(priv->regmap, RT4831_REG_BLOPT2, 143 + RT4831_BLOCP_MASK, val); 144 + if (ret) 145 + return ret; 146 + } 128 147 129 148 ret = device_property_read_u8(dev, "richtek,channel-use", &propval); 130 149 if (ret) {