Skip to content

Commit c969f24

Browse files
committed
Merge tag 'backlight-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "New Device Support: - Add support for PMI8994 to Qualcom WLED - Add support for KTD259 to Kinetic KTD253 Fix-ups: - Device Tree related fix-ups; kinetic,ktd253 - Use proper sequence during sync_toggle; qcom-wled - Fix Wmisleading-indentation warnings; jornada720_bl Bug Fixes: - Fix sync toggle on WLED4; qcom-wled - Fix FSC update on WLED5; qcom-wled" * tag 'backlight-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: journada720: Fix Wmisleading-indentation warning backlight: qcom-wled: Correct the sync_toggle sequence backlight: qcom-wled: Fix FSC update issue for WLED5 dt-bindings: backlight: Add Kinetic KTD259 bindings backlight: ktd253: Support KTD259 backlight: qcom-wled: Use sink_addr for sync toggle dt-bindings: backlight: qcom-wled: Add PMI8994 compatible
2 parents 71a5cc2 + 0475838 commit c969f24

File tree

5 files changed

+57
-39
lines changed

5 files changed

+57
-39
lines changed

Documentation/devicetree/bindings/leds/backlight/kinetic,ktd253.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
$id: http://devicetree.org/schemas/leds/backlight/kinetic,ktd253.yaml#
55
$schema: http://devicetree.org/meta-schemas/core.yaml#
66

7-
title: Kinetic Technologies KTD253 one-wire backlight
7+
title: Kinetic Technologies KTD253 and KTD259 one-wire backlight
88

99
maintainers:
1010
- Linus Walleij <[email protected]>
1111

1212
description: |
13-
The Kinetic Technologies KTD253 is a white LED backlight that is
13+
The Kinetic Technologies KTD253 and KTD259 are white LED backlights
1414
controlled by a single GPIO line. If you just turn on the backlight
1515
it goes to maximum backlight then you can set the level of backlight
1616
using pulses on the enable wire. This is sometimes referred to as
@@ -21,7 +21,10 @@ allOf:
2121

2222
properties:
2323
compatible:
24-
const: kinetic,ktd253
24+
items:
25+
- enum:
26+
- kinetic,ktd253
27+
- kinetic,ktd259
2528

2629
enable-gpios:
2730
description: GPIO to use to enable/disable and dim the backlight.

Documentation/devicetree/bindings/leds/backlight/qcom-wled.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ properties:
1919
compatible:
2020
enum:
2121
- qcom,pm8941-wled
22+
- qcom,pmi8994-wled
2223
- qcom,pmi8998-wled
2324
- qcom,pm660l-wled
2425
- qcom,pm8150l-wled

drivers/video/backlight/jornada720_bl.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,30 +66,30 @@ static int jornada_bl_update_status(struct backlight_device *bd)
6666
} else /* turn on backlight */
6767
PPSR |= PPC_LDD1;
6868

69-
/* send command to our mcu */
70-
if (jornada_ssp_byte(SETBRIGHTNESS) != TXDUMMY) {
71-
dev_info(&bd->dev, "failed to set brightness\n");
72-
ret = -ETIMEDOUT;
73-
goto out;
74-
}
69+
/* send command to our mcu */
70+
if (jornada_ssp_byte(SETBRIGHTNESS) != TXDUMMY) {
71+
dev_info(&bd->dev, "failed to set brightness\n");
72+
ret = -ETIMEDOUT;
73+
goto out;
74+
}
7575

76-
/*
77-
* at this point we expect that the mcu has accepted
78-
* our command and is waiting for our new value
79-
* please note that maximum brightness is 255,
80-
* but due to physical layout it is equal to 0, so we simply
81-
* invert the value (MAX VALUE - NEW VALUE).
82-
*/
83-
if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness)
84-
!= TXDUMMY) {
85-
dev_err(&bd->dev, "set brightness failed\n");
86-
ret = -ETIMEDOUT;
87-
}
76+
/*
77+
* at this point we expect that the mcu has accepted
78+
* our command and is waiting for our new value
79+
* please note that maximum brightness is 255,
80+
* but due to physical layout it is equal to 0, so we simply
81+
* invert the value (MAX VALUE - NEW VALUE).
82+
*/
83+
if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness)
84+
!= TXDUMMY) {
85+
dev_err(&bd->dev, "set brightness failed\n");
86+
ret = -ETIMEDOUT;
87+
}
8888

89-
/*
90-
* If infact we get an TXDUMMY as output we are happy and dont
91-
* make any further comments about it
92-
*/
89+
/*
90+
* If infact we get an TXDUMMY as output we are happy and dont
91+
* make any further comments about it
92+
*/
9393
out:
9494
jornada_ssp_end();
9595

drivers/video/backlight/ktd253-backlight.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
173173

174174
static const struct of_device_id ktd253_backlight_of_match[] = {
175175
{ .compatible = "kinetic,ktd253" },
176+
{ .compatible = "kinetic,ktd259" },
176177
{ /* sentinel */ }
177178
};
178179
MODULE_DEVICE_TABLE(of, ktd253_backlight_of_match);

drivers/video/backlight/qcom-wled.c

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -336,34 +336,34 @@ static int wled3_sync_toggle(struct wled *wled)
336336
unsigned int mask = GENMASK(wled->max_string_count - 1, 0);
337337

338338
rc = regmap_update_bits(wled->regmap,
339-
wled->ctrl_addr + WLED3_SINK_REG_SYNC,
340-
mask, mask);
339+
wled->sink_addr + WLED3_SINK_REG_SYNC,
340+
mask, WLED3_SINK_REG_SYNC_CLEAR);
341341
if (rc < 0)
342342
return rc;
343343

344344
rc = regmap_update_bits(wled->regmap,
345-
wled->ctrl_addr + WLED3_SINK_REG_SYNC,
346-
mask, WLED3_SINK_REG_SYNC_CLEAR);
345+
wled->sink_addr + WLED3_SINK_REG_SYNC,
346+
mask, mask);
347347

348348
return rc;
349349
}
350350

351-
static int wled5_sync_toggle(struct wled *wled)
351+
static int wled5_mod_sync_toggle(struct wled *wled)
352352
{
353353
int rc;
354354
u8 val;
355355

356-
val = (wled->cfg.mod_sel == MOD_A) ? WLED5_SINK_REG_SYNC_MOD_A_BIT :
357-
WLED5_SINK_REG_SYNC_MOD_B_BIT;
358356
rc = regmap_update_bits(wled->regmap,
359357
wled->sink_addr + WLED5_SINK_REG_MOD_SYNC_BIT,
360-
WLED5_SINK_REG_SYNC_MASK, val);
358+
WLED5_SINK_REG_SYNC_MASK, 0);
361359
if (rc < 0)
362360
return rc;
363361

362+
val = (wled->cfg.mod_sel == MOD_A) ? WLED5_SINK_REG_SYNC_MOD_A_BIT :
363+
WLED5_SINK_REG_SYNC_MOD_B_BIT;
364364
return regmap_update_bits(wled->regmap,
365365
wled->sink_addr + WLED5_SINK_REG_MOD_SYNC_BIT,
366-
WLED5_SINK_REG_SYNC_MASK, 0);
366+
WLED5_SINK_REG_SYNC_MASK, val);
367367
}
368368

369369
static int wled_ovp_fault_status(struct wled *wled, bool *fault_set)
@@ -445,10 +445,23 @@ static int wled_update_status(struct backlight_device *bl)
445445
goto unlock_mutex;
446446
}
447447

448-
rc = wled->wled_sync_toggle(wled);
449-
if (rc < 0) {
450-
dev_err(wled->dev, "wled sync failed rc:%d\n", rc);
451-
goto unlock_mutex;
448+
if (wled->version < 5) {
449+
rc = wled->wled_sync_toggle(wled);
450+
if (rc < 0) {
451+
dev_err(wled->dev, "wled sync failed rc:%d\n", rc);
452+
goto unlock_mutex;
453+
}
454+
} else {
455+
/*
456+
* For WLED5 toggling the MOD_SYNC_BIT updates the
457+
* brightness
458+
*/
459+
rc = wled5_mod_sync_toggle(wled);
460+
if (rc < 0) {
461+
dev_err(wled->dev, "wled mod sync failed rc:%d\n",
462+
rc);
463+
goto unlock_mutex;
464+
}
452465
}
453466
}
454467

@@ -1459,7 +1472,7 @@ static int wled_configure(struct wled *wled)
14591472
size = ARRAY_SIZE(wled5_opts);
14601473
*cfg = wled5_config_defaults;
14611474
wled->wled_set_brightness = wled5_set_brightness;
1462-
wled->wled_sync_toggle = wled5_sync_toggle;
1475+
wled->wled_sync_toggle = wled3_sync_toggle;
14631476
wled->wled_cabc_config = wled5_cabc_config;
14641477
wled->wled_ovp_delay = wled5_ovp_delay;
14651478
wled->wled_auto_detection_required =

0 commit comments

Comments
 (0)