Skip to content

Commit f3033eb

Browse files
committed
Merge tag 'leds-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones: "Core Frameworks: - Ensure seldom updated triggers have a brightness value before first update New Device Support: - Add support for Simatic IPC Device BX_59A to IPC LEDs Core - Add support for Qualcomm PMI8950 PWM to LPG Core New Functionality: - Add a bunch of new LED function identifiers - Add support for High Resolution Timers in LED Trigger Patten Fix-ups: - Shift out Audio Trigger to the Sound subsystem - Convert suitable calls to devm_* managed resources - Device Tree binding adaptions/conversions/creation - Remove superfluous code/variables/attributes and simplify overall - Use/convert to new/better APIs/helpers/MACROs instead of hand-rolling implementations Bug Fixes: - Repair enabling Torch Mode from V4L2 on the second LED - Ensure PWM is disabled when suspending" * tag 'leds-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (28 commits) leds: mt6370: Remove unused field 'reg_cfgs' from 'struct mt6370_priv' leds: lp50xx: Remove unused field 'num_of_banked_leds' from 'struct lp50xx' leds: lp50xx: Remove unused field 'bank_modules' from 'struct lp50xx_led' leds: aat1290: Remove unused field 'torch_brightness' from 'struct aat1290_led' leds: sun50i-a100: Use match_string() helper to simplify the code leds: pwm: Disable PWM when going to suspend leds: trigger: pattern: Add support for hrtimer leds: mt6360: Fix the second LED can not enable torch mode by V4L2 dt-bindings: leds: leds-qcom-lpg: Add support for PMI8950 PWM leds: qcom-lpg: Add support for PMI8950 PWM leds: apu: Remove duplicate DMI lookup data leds: trigger: netdev: Remove not needed call to led_set_brightness in deactivate dt-bindings: leds: Add LED_FUNCTION_SPEED_* for link speed on LAN/WAN dt-bindings: leds: Add LED_FUNCTION_MOBILE for mobile network leds: simatic-ipc-leds-gpio: Add support for module BX-59A dt-bindings: leds: qcom-lpg: Document PM6150L compatible dt-bindings: leds: pca963x: Convert text bindings to YAML leds: an30259a: Use devm_mutex_init() for mutex initialization leds: mlxreg: Use devm_mutex_init() for mutex initialization leds: nic78bx: Use devm API to cleanup module's resources ...
2 parents 7eae27c + f2994f5 commit f3033eb

34 files changed

+501
-275
lines changed

Documentation/ABI/testing/sysfs-class-led-trigger-pattern

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ Description:
1212
The exact format is described in:
1313
Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt
1414

15+
What: /sys/class/leds/<led>/hr_pattern
16+
Date: April 2024
17+
Description:
18+
Specify a software pattern for the LED, that supports altering
19+
the brightness for the specified duration with one software
20+
timer. It can do gradual dimming and step change of brightness.
21+
22+
Unlike the /sys/class/leds/<led>/pattern, this attribute runs
23+
a pattern on high-resolution timer (hrtimer).
24+
1525
What: /sys/class/leds/<led>/hw_pattern
1626
Date: September 2018
1727
KernelVersion: 4.20

Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ properties:
2727
- qcom,pm8994-lpg
2828
- qcom,pmc8180c-lpg
2929
- qcom,pmi632-lpg
30+
- qcom,pmi8950-pwm
3031
- qcom,pmi8994-lpg
3132
- qcom,pmi8998-lpg
3233
- qcom,pmk8550-pwm
34+
- items:
35+
- enum:
36+
- qcom,pm6150l-lpg
37+
- const: qcom,pm8150l-lpg
3338
- items:
3439
- enum:
3540
- qcom,pm8550-pwm
@@ -142,6 +147,7 @@ allOf:
142147
- qcom,pm8941-lpg
143148
- qcom,pm8994-lpg
144149
- qcom,pmc8180c-lpg
150+
- qcom,pmi8950-pwm
145151
- qcom,pmi8994-lpg
146152
- qcom,pmi8998-lpg
147153
- qcom,pmk8550-pwm
@@ -290,5 +296,3 @@ examples:
290296
label = "blue";
291297
};
292298
};
293-
294-
...
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/nxp,pca963x.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NXP PCA963x LED controllers
8+
9+
maintainers:
10+
- Laurent Pinchart <[email protected]>
11+
12+
description: |
13+
The NXP PCA963x are I2C-controlled LED drivers optimized for
14+
Red/Green/Blue/Amber (RGBA) color mixing applications. Each LED is
15+
individually controllable and has its own PWM controller.
16+
17+
Datasheets are available at
18+
19+
- https://www.nxp.com/docs/en/data-sheet/PCA9632.pdf
20+
- https://www.nxp.com/docs/en/data-sheet/PCA9633.pdf
21+
- https://www.nxp.com/docs/en/data-sheet/PCA9634.pdf
22+
- https://www.nxp.com/docs/en/data-sheet/PCA9635.pdf
23+
24+
properties:
25+
compatible:
26+
enum:
27+
- nxp,pca9632
28+
- nxp,pca9633
29+
- nxp,pca9634
30+
- nxp,pca9635
31+
32+
reg:
33+
maxItems: 1
34+
35+
"#address-cells":
36+
const: 1
37+
38+
"#size-cells":
39+
const: 0
40+
41+
nxp,hw-blink:
42+
type: boolean
43+
description:
44+
Use hardware blinking instead of software blinking
45+
46+
nxp,inverted-out:
47+
type: boolean
48+
description:
49+
Invert the polarity of the generated PWM.
50+
51+
nxp,period-scale:
52+
$ref: /schemas/types.yaml#/definitions/uint32
53+
description:
54+
In some configurations, the chip blinks faster than expected. This
55+
parameter provides a scaling ratio (fixed point, decimal divided by 1000)
56+
to compensate, e.g. 1300=1.3x and 750=0.75x.
57+
58+
nxp,totem-pole:
59+
type: boolean
60+
description:
61+
Use totem pole (push-pull) instead of open-drain (pca9632 defaults to
62+
open-drain, newer chips to totem pole).
63+
64+
patternProperties:
65+
"^led@[0-9a-f]+$":
66+
type: object
67+
$ref: common.yaml#
68+
unevaluatedProperties: false
69+
70+
properties:
71+
reg:
72+
minimum: 0
73+
74+
required:
75+
- reg
76+
77+
allOf:
78+
- if:
79+
properties:
80+
compatible:
81+
contains:
82+
enum:
83+
- nxp,pca9632
84+
- nxp,pca9633
85+
then:
86+
patternProperties:
87+
"^led@[0-9a-f]+$":
88+
properties:
89+
reg:
90+
maximum: 3
91+
else:
92+
patternProperties:
93+
"^led@[0-9a-f]+$":
94+
properties:
95+
reg:
96+
maximum: 7
97+
98+
additionalProperties: false
99+
100+
examples:
101+
- |
102+
#include <dt-bindings/leds/common.h>
103+
104+
i2c {
105+
#address-cells = <1>;
106+
#size-cells = <0>;
107+
108+
led-controller@62 {
109+
compatible = "nxp,pca9632";
110+
reg = <0x62>;
111+
#address-cells = <1>;
112+
#size-cells = <0>;
113+
114+
led@0 {
115+
reg = <0>;
116+
color = <LED_COLOR_ID_RED>;
117+
function = LED_FUNCTION_STATUS;
118+
};
119+
120+
led@1 {
121+
reg = <1>;
122+
color = <LED_COLOR_ID_GREEN>;
123+
function = LED_FUNCTION_STATUS;
124+
};
125+
126+
led@2 {
127+
reg = <2>;
128+
color = <LED_COLOR_ID_BLUE>;
129+
function = LED_FUNCTION_STATUS;
130+
};
131+
132+
led@3 {
133+
reg = <3>;
134+
color = <LED_COLOR_ID_WHITE>;
135+
function = LED_FUNCTION_STATUS;
136+
};
137+
};
138+
};
139+
140+
...

Documentation/devicetree/bindings/leds/pca963x.txt

Lines changed: 0 additions & 52 deletions
This file was deleted.

arch/mips/configs/ci20_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ CONFIG_LEDS_TRIGGER_CAMERA=m
152152
CONFIG_LEDS_TRIGGER_PANIC=y
153153
CONFIG_LEDS_TRIGGER_NETDEV=y
154154
CONFIG_LEDS_TRIGGER_PATTERN=y
155-
CONFIG_LEDS_TRIGGER_AUDIO=y
156155
CONFIG_RTC_CLASS=y
157156
CONFIG_RTC_DRV_JZ4740=y
158157
CONFIG_DMADEVICES=y

drivers/leds/flash/leds-aat1290.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ struct aat1290_led {
7777
int *mm_current_scale;
7878
/* device mode */
7979
bool movie_mode;
80-
/* brightness cache */
81-
unsigned int torch_brightness;
8280
};
8381

8482
static struct aat1290_led *fled_cdev_to_led(

drivers/leds/flash/leds-mt6360.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,20 @@ static int mt6360_strobe_set(struct led_classdev_flash *fl_cdev, bool state)
241241
u32 enable_mask = MT6360_STROBEN_MASK | MT6360_FLCSEN_MASK(led->led_no);
242242
u32 val = state ? MT6360_FLCSEN_MASK(led->led_no) : 0;
243243
u32 prev = priv->fled_strobe_used, curr;
244-
int ret;
244+
int ret = 0;
245245

246246
mutex_lock(&priv->lock);
247247

248+
/*
249+
* If the state of the upcoming change is the same as the current LED
250+
* device state, then skip the subsequent code to avoid conflict
251+
* with the flow of turning on LED torch mode in V4L2.
252+
*/
253+
if (state == !!(BIT(led->led_no) & prev)) {
254+
dev_info(lcdev->dev, "No change in strobe state [0x%x]\n", prev);
255+
goto unlock;
256+
}
257+
248258
/*
249259
* Only one set of flash control logic, use the flag to avoid torch is
250260
* currently used

drivers/leds/led-triggers.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
194194
spin_unlock(&trig->leddev_list_lock);
195195
led_cdev->trigger = trig;
196196

197+
ret = 0;
197198
if (trig->activate)
198199
ret = trig->activate(led_cdev);
199200
else
200-
ret = 0;
201-
201+
led_set_brightness(led_cdev, trig->brightness);
202202
if (ret)
203203
goto err_activate;
204204

@@ -387,6 +387,8 @@ void led_trigger_event(struct led_trigger *trig,
387387
if (!trig)
388388
return;
389389

390+
trig->brightness = brightness;
391+
390392
rcu_read_lock();
391393
list_for_each_entry_rcu(led_cdev, &trig->led_cdevs, trig_list)
392394
led_set_brightness(led_cdev, brightness);

drivers/leds/leds-an30259a.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ static int an30259a_probe(struct i2c_client *client)
283283
if (err < 0)
284284
return err;
285285

286-
mutex_init(&chip->mutex);
286+
err = devm_mutex_init(&client->dev, &chip->mutex);
287+
if (err)
288+
return err;
289+
287290
chip->client = client;
288291
i2c_set_clientdata(client, chip);
289292

@@ -317,17 +320,9 @@ static int an30259a_probe(struct i2c_client *client)
317320
return 0;
318321

319322
exit:
320-
mutex_destroy(&chip->mutex);
321323
return err;
322324
}
323325

324-
static void an30259a_remove(struct i2c_client *client)
325-
{
326-
struct an30259a *chip = i2c_get_clientdata(client);
327-
328-
mutex_destroy(&chip->mutex);
329-
}
330-
331326
static const struct of_device_id an30259a_match_table[] = {
332327
{ .compatible = "panasonic,an30259a", },
333328
{ /* sentinel */ },
@@ -347,7 +342,6 @@ static struct i2c_driver an30259a_driver = {
347342
.of_match_table = an30259a_match_table,
348343
},
349344
.probe = an30259a_probe,
350-
.remove = an30259a_remove,
351345
.id_table = an30259a_id,
352346
};
353347

drivers/leds/leds-apu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ static int __init apu_led_init(void)
181181
struct platform_device *pdev;
182182
int err;
183183

184-
if (!(dmi_match(DMI_SYS_VENDOR, "PC Engines") &&
185-
(dmi_match(DMI_PRODUCT_NAME, "APU") || dmi_match(DMI_PRODUCT_NAME, "apu1")))) {
184+
if (!dmi_check_system(apu_led_dmi_table)) {
186185
pr_err("No PC Engines APUv1 board detected. For APUv2,3 support, enable CONFIG_PCENGINES_APU2\n");
187186
return -ENODEV;
188187
}

0 commit comments

Comments
 (0)