Skip to content

Commit 431f105

Browse files
committed
Merge tag 'leds-next-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones: "Core Frameworks: - Add support for a bunch more colours New Drivers: - Add support for Kinetic KTD2026/7 RGB/White LEDs New Functionality: - Add support for device to enter HW Controlled Mode to Turris Omnia LEDs - Add support for HW Gamma Correction to Turris Omnia LEDs Fix-ups: - Apply new __counted_by() annotation to several data structures containing flexible arrays - Rid the return value from Platform's .remove() operation - Use *_cansleep() variants for instances were threads can sleep - Improve the semantics when setting the brightness - Generic clean-ups; code reduction, coding style, standard patterns - Replace strncpy() with strscpy() - Fix-up / add various documentation - Re-author the GPIO associated Trigger to use trigger-sources - Move to using standard APIs and helpers - Improve error checking - Stop using static GPIO bases Bug Fixes: - Fix Pointer to Enum casing warnings - Do not pretend that I2C backed device supports SMBUS - Ensure PWM LEDs are extinguished when disabled, rather than held in a state - Fix 'output may be truncated' warnings" * tag 'leds-next-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (43 commits) leds: lp5521: Add an error check in lp5521_post_init_device leds: gpio: Update headers leds: gpio: Remove unneeded assignment leds: gpio: Move temporary variable for struct device to gpio_led_probe() leds: gpio: Refactor code to use devm_gpiod_get_index_optional() leds: gpio: Utilise PTR_ERR_OR_ZERO() leds: gpio: Keep driver firmware interface agnostic leds: core: Refactor led_update_brightness() to use standard pattern leds: turris-omnia: Fix brightness setting and trigger activating leds: sc27xx: Move mutex_init() down leds: trigger: netdev: Move size check in set_device_name leds: Add ktd202x driver dt-bindings: leds: Add Kinetic KTD2026/2027 LED leds: core: Add more colors from DT bindings to led_colors dt-bindings: leds: Last color ID is now 14 (LED_COLOR_ID_LIME) leds: tca6507: Don't use fixed GPIO base leds: lp3952: Convert to use maple tree register cache leds: lm392x: Convert to use maple tree register cache leds: aw200xx: Convert to use maple tree register cache leds: lm3601x: Convert to use maple tree register cache ...
2 parents 38984d7 + b9604be commit 431f105

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1349
-366
lines changed

Documentation/ABI/testing/sysfs-class-led-driver-turris-omnia

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,17 @@ Description: (RW) On the front panel of the Turris Omnia router there is also
1212
able to change this setting from software.
1313

1414
Format: %i
15+
16+
What: /sys/class/leds/<led>/device/gamma_correction
17+
Date: August 2023
18+
KernelVersion: 6.6
19+
Contact: Marek Behún <kabel@kernel.org>
20+
Description: (RW) Newer versions of the microcontroller firmware of the
21+
Turris Omnia router support gamma correction for the RGB LEDs.
22+
This feature can be enabled/disabled by writing to this file.
23+
24+
If the feature is not supported because the MCU firmware is too
25+
old, the file always reads as 0, and writing to the file results
26+
in the EOPNOTSUPP error.
27+
28+
Format: %i

Documentation/devicetree/bindings/leds/common.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ properties:
4343
LED_COLOR_ID available, add a new one.
4444
$ref: /schemas/types.yaml#/definitions/uint32
4545
minimum: 0
46-
maximum: 9
46+
maximum: 14
4747

4848
function-enumerator:
4949
description:
@@ -191,6 +191,8 @@ properties:
191191
each of them having its own LED assigned (assuming they are not
192192
hardwired). In such cases this property should contain phandle(s) of
193193
related source device(s).
194+
Another example is a GPIO line that will be monitored and mirror the
195+
state of the line (with or without inversion flags) to the LED.
194196
In many cases LED can be related to more than one device (e.g. one USB LED
195197
vs. multiple USB ports). Each source should be represented by a node in
196198
the device tree and be referenced by a phandle and a set of phandle
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/kinetic,ktd202x.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Kinetic KTD2026/7 RGB/White LED Driver
8+
9+
maintainers:
10+
- André Apitzsch <git@apitzsch.eu>
11+
12+
description: |
13+
The KTD2026/7 is a RGB/White LED driver with I2C interface.
14+
15+
The data sheet can be found at:
16+
https://www.kinet-ic.com/uploads/KTD2026-7-04h.pdf
17+
18+
properties:
19+
compatible:
20+
enum:
21+
- kinetic,ktd2026
22+
- kinetic,ktd2027
23+
24+
reg:
25+
maxItems: 1
26+
27+
vin-supply:
28+
description: Regulator providing power to the "VIN" pin.
29+
30+
vio-supply:
31+
description: Regulator providing power for pull-up of the I/O lines.
32+
Note that this regulator does not directly connect to KTD2026, but is
33+
needed for the correct operation of the status ("ST") and I2C lines.
34+
35+
"#address-cells":
36+
const: 1
37+
38+
"#size-cells":
39+
const: 0
40+
41+
multi-led:
42+
type: object
43+
$ref: leds-class-multicolor.yaml#
44+
unevaluatedProperties: false
45+
46+
properties:
47+
"#address-cells":
48+
const: 1
49+
50+
"#size-cells":
51+
const: 0
52+
53+
patternProperties:
54+
"^led@[0-3]$":
55+
type: object
56+
$ref: common.yaml#
57+
unevaluatedProperties: false
58+
59+
properties:
60+
reg:
61+
description: Index of the LED.
62+
minimum: 0
63+
maximum: 3
64+
65+
required:
66+
- reg
67+
- color
68+
69+
required:
70+
- "#address-cells"
71+
- "#size-cells"
72+
73+
patternProperties:
74+
"^led@[0-3]$":
75+
type: object
76+
$ref: common.yaml#
77+
unevaluatedProperties: false
78+
79+
properties:
80+
reg:
81+
description: Index of the LED.
82+
minimum: 0
83+
maximum: 3
84+
85+
required:
86+
- reg
87+
88+
required:
89+
- compatible
90+
- reg
91+
- "#address-cells"
92+
- "#size-cells"
93+
94+
additionalProperties: false
95+
96+
examples:
97+
- |
98+
#include <dt-bindings/leds/common.h>
99+
100+
i2c {
101+
#address-cells = <1>;
102+
#size-cells = <0>;
103+
104+
led-controller@30 {
105+
compatible = "kinetic,ktd2026";
106+
reg = <0x30>;
107+
#address-cells = <1>;
108+
#size-cells = <0>;
109+
110+
vin-supply = <&pm8916_l17>;
111+
vio-supply = <&pm8916_l6>;
112+
113+
led@0 {
114+
reg = <0>;
115+
function = LED_FUNCTION_STATUS;
116+
color = <LED_COLOR_ID_RED>;
117+
};
118+
119+
led@1 {
120+
reg = <1>;
121+
function = LED_FUNCTION_STATUS;
122+
color = <LED_COLOR_ID_GREEN>;
123+
};
124+
125+
led@2 {
126+
reg = <2>;
127+
function = LED_FUNCTION_STATUS;
128+
color = <LED_COLOR_ID_BLUE>;
129+
};
130+
};
131+
};
132+
- |
133+
#include <dt-bindings/leds/common.h>
134+
135+
i2c {
136+
#address-cells = <1>;
137+
#size-cells = <0>;
138+
139+
led-controller@30 {
140+
compatible = "kinetic,ktd2026";
141+
reg = <0x30>;
142+
#address-cells = <1>;
143+
#size-cells = <0>;
144+
145+
vin-supply = <&pm8916_l17>;
146+
vio-supply = <&pm8916_l6>;
147+
148+
multi-led {
149+
color = <LED_COLOR_ID_RGB>;
150+
function = LED_FUNCTION_STATUS;
151+
152+
#address-cells = <1>;
153+
#size-cells = <0>;
154+
155+
led@0 {
156+
reg = <0>;
157+
color = <LED_COLOR_ID_RED>;
158+
};
159+
160+
led@1 {
161+
reg = <1>;
162+
color = <LED_COLOR_ID_GREEN>;
163+
};
164+
165+
led@2 {
166+
reg = <2>;
167+
color = <LED_COLOR_ID_BLUE>;
168+
};
169+
};
170+
};
171+
};

drivers/leds/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ config LEDS_TURRIS_OMNIA
187187
depends on I2C
188188
depends on MACH_ARMADA_38X || COMPILE_TEST
189189
depends on OF
190+
select LEDS_TRIGGERS
190191
help
191192
This option enables basic support for the LEDs found on the front
192193
side of CZ.NIC's Turris Omnia router. There are 12 RGB LEDs on the

drivers/leds/blink/leds-lgm-sso.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ static int intel_sso_led_probe(struct platform_device *pdev)
837837
return 0;
838838
}
839839

840-
static int intel_sso_led_remove(struct platform_device *pdev)
840+
static void intel_sso_led_remove(struct platform_device *pdev)
841841
{
842842
struct sso_led_priv *priv;
843843
struct sso_led *led, *n;
@@ -850,8 +850,6 @@ static int intel_sso_led_remove(struct platform_device *pdev)
850850
}
851851

852852
regmap_exit(priv->mmap);
853-
854-
return 0;
855853
}
856854

857855
static const struct of_device_id of_sso_led_match[] = {
@@ -863,7 +861,7 @@ MODULE_DEVICE_TABLE(of, of_sso_led_match);
863861

864862
static struct platform_driver intel_sso_led_driver = {
865863
.probe = intel_sso_led_probe,
866-
.remove = intel_sso_led_remove,
864+
.remove_new = intel_sso_led_remove,
867865
.driver = {
868866
.name = "lgm-ssoled",
869867
.of_match_table = of_sso_led_match,

drivers/leds/flash/leds-aat1290.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,16 +522,14 @@ static int aat1290_led_probe(struct platform_device *pdev)
522522
return ret;
523523
}
524524

525-
static int aat1290_led_remove(struct platform_device *pdev)
525+
static void aat1290_led_remove(struct platform_device *pdev)
526526
{
527527
struct aat1290_led *led = platform_get_drvdata(pdev);
528528

529529
v4l2_flash_release(led->v4l2_flash);
530530
led_classdev_flash_unregister(&led->fled_cdev);
531531

532532
mutex_destroy(&led->lock);
533-
534-
return 0;
535533
}
536534

537535
static const struct of_device_id aat1290_led_dt_match[] = {
@@ -542,7 +540,7 @@ MODULE_DEVICE_TABLE(of, aat1290_led_dt_match);
542540

543541
static struct platform_driver aat1290_led_driver = {
544542
.probe = aat1290_led_probe,
545-
.remove = aat1290_led_remove,
543+
.remove_new = aat1290_led_remove,
546544
.driver = {
547545
.name = "aat1290",
548546
.of_match_table = aat1290_led_dt_match,

drivers/leds/flash/leds-ktd2692.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,15 +386,13 @@ static int ktd2692_probe(struct platform_device *pdev)
386386
return 0;
387387
}
388388

389-
static int ktd2692_remove(struct platform_device *pdev)
389+
static void ktd2692_remove(struct platform_device *pdev)
390390
{
391391
struct ktd2692_context *led = platform_get_drvdata(pdev);
392392

393393
led_classdev_flash_unregister(&led->fled_cdev);
394394

395395
mutex_destroy(&led->lock);
396-
397-
return 0;
398396
}
399397

400398
static const struct of_device_id ktd2692_match[] = {
@@ -409,7 +407,7 @@ static struct platform_driver ktd2692_driver = {
409407
.of_match_table = ktd2692_match,
410408
},
411409
.probe = ktd2692_probe,
412-
.remove = ktd2692_remove,
410+
.remove_new = ktd2692_remove,
413411
};
414412

415413
module_platform_driver(ktd2692_driver);

drivers/leds/flash/leds-lm3601x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static const struct regmap_config lm3601x_regmap = {
123123
.max_register = LM3601X_DEV_ID_REG,
124124
.reg_defaults = lm3601x_regmap_defs,
125125
.num_reg_defaults = ARRAY_SIZE(lm3601x_regmap_defs),
126-
.cache_type = REGCACHE_RBTREE,
126+
.cache_type = REGCACHE_MAPLE,
127127
.volatile_reg = lm3601x_volatile_reg,
128128
};
129129

drivers/leds/flash/leds-max77693.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static int max77693_led_probe(struct platform_device *pdev)
10161016
return ret;
10171017
}
10181018

1019-
static int max77693_led_remove(struct platform_device *pdev)
1019+
static void max77693_led_remove(struct platform_device *pdev)
10201020
{
10211021
struct max77693_led_device *led = platform_get_drvdata(pdev);
10221022
struct max77693_sub_led *sub_leds = led->sub_leds;
@@ -1032,8 +1032,6 @@ static int max77693_led_remove(struct platform_device *pdev)
10321032
}
10331033

10341034
mutex_destroy(&led->lock);
1035-
1036-
return 0;
10371035
}
10381036

10391037
static const struct of_device_id max77693_led_dt_match[] = {
@@ -1044,7 +1042,7 @@ MODULE_DEVICE_TABLE(of, max77693_led_dt_match);
10441042

10451043
static struct platform_driver max77693_led_driver = {
10461044
.probe = max77693_led_probe,
1047-
.remove = max77693_led_remove,
1045+
.remove_new = max77693_led_remove,
10481046
.driver = {
10491047
.name = "max77693-led",
10501048
.of_match_table = max77693_led_dt_match,

drivers/leds/flash/leds-mt6360.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct mt6360_priv {
9191
unsigned int fled_torch_used;
9292
unsigned int leds_active;
9393
unsigned int leds_count;
94-
struct mt6360_led leds[];
94+
struct mt6360_led leds[] __counted_by(leds_count);
9595
};
9696

9797
static int mt6360_mc_brightness_set(struct led_classdev *lcdev,
@@ -855,12 +855,11 @@ static int mt6360_led_probe(struct platform_device *pdev)
855855
return ret;
856856
}
857857

858-
static int mt6360_led_remove(struct platform_device *pdev)
858+
static void mt6360_led_remove(struct platform_device *pdev)
859859
{
860860
struct mt6360_priv *priv = platform_get_drvdata(pdev);
861861

862862
mt6360_v4l2_flash_release(priv);
863-
return 0;
864863
}
865864

866865
static const struct of_device_id __maybe_unused mt6360_led_of_id[] = {
@@ -875,7 +874,7 @@ static struct platform_driver mt6360_led_driver = {
875874
.of_match_table = mt6360_led_of_id,
876875
},
877876
.probe = mt6360_led_probe,
878-
.remove = mt6360_led_remove,
877+
.remove_new = mt6360_led_remove,
879878
};
880879
module_platform_driver(mt6360_led_driver);
881880

0 commit comments

Comments
 (0)