Skip to content

Commit cb9b4c3

Browse files
committed
Merge tag 'leds-next-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones: - pca955x: Add HW blink support, utilizing PWM0. It supports one frequency across all blinking LEDs and falls back to software blink if different frequencies are requested. - trigger: netdev: Allow configuring LED blink interval via .blink_set even when HW offload (.hw_control) is enabled. - led-core: Fix a race condition where a quick LED_OFF followed by another brightness set could leave the LED off incorrectly, especially noticeable after the introduction of the ordered workqueue. - qcom-lpg: Add support for 6-bit PWM resolution alongside the existing 9-bit support. - qcom-lpg: Fix PWM value capping to respect the selected resolution (6-bit or 9-bit) for normal PWMs. - qcom-lpg: Fix PWM value capping to respect the selected resolution for Hi-Res PWMs. - qcom-lpg: Fix calculation of the best period for Hi-Res PWMs to prevent requested duty cycles from exceeding the maximum allowed by the selected resolution. - st1202: Add a check for the error code returned by devm_mutex_init(). - pwm-multicolor: Add a check for the return value of fwnode_property_read_u32(). - st1202: Ensure hardware initialization (st1202_setup) happens before DT node processing (st1202_dt_init). - Kconfig: leds-st1202: Add select LEDS_TRIGGER_PATTERN as it's required by the driver. - lp8860: Drop unneeded explicit assignment to REGCACHE_NONE. - pca955x: Refactor code with helper functions and rename some functions/variables for clarity. - pca955x: Pass driver data pointers instead of the I2C client to helper functions. - pca955x: Optimize probe LED selection logic to reduce I2C operations. - pca955x: Revert the removal of pca95xx_num_led_regs() (renaming it to pca955x_num_led_regs) as it's needed for HW blink support. - st1202: Refactor st1202_led_set() to use the !! operator for boolean conversion. - st1202: Minor spacing and proofreading edits in comments. - Directory Rename: Rename the drivers/leds/simple directory to drivers/leds/simatic as the drivers within are not simple. - mlxcpld: Remove unused include of acpi.h. - nic78bx: Tidy up the ACPI ID table (remove ACPI_PTR, use mod_devicetable.h, remove explicit driver_data initializer). - tlc591xx: Convert text binding to YAML format, add child node constraints, and fix typos/formatting in the example. - qcom-lpg: Document the qcom,pm8937-pwm compatible string as a fallback for qcom,pm8916-pwm. * tag 'leds-next-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (23 commits) leds: nic78bx: Tidy up ACPI ID table leds: mlxcpld: Remove unused ACPI header inclusion leds: rgb: leds-qcom-lpg: Fix calculation of best period Hi-Res PWMs leds: rgb: leds-qcom-lpg: Fix pwm resolution max for Hi-Res PWMs leds: rgb: leds-qcom-lpg: Fix pwm resolution max for normal PWMs leds: Rename simple directory to simatic leds: Kconfig: leds-st1202: Add select for required LEDS_TRIGGER_PATTERN leds: leds-st1202: Spacing and proofreading editing leds: leds-st1202: Initialize hardware before DT node child operations leds: pwm-multicolor: Add check for fwnode_property_read_u32 leds: rgb: leds-qcom-lpg: Add support for 6-bit PWM resolution leds: Fix LED_OFF brightness race Revert "leds-pca955x: Remove the unused function pca95xx_num_led_regs()" leds: st1202: Refactor st1202_led_set() to use !! operator for boolean conversion dt-bindings: leds: qcom-lpg: Document PM8937 PWM compatible leds: pca955x: Add HW blink support leds: pca955x: Optimize probe LED selection leds: pca955x: Use pointers to driver data rather than I2C client leds: pca955x: Refactor with helper functions and renaming dt-bindings: leds: Convert leds-tlc591xx.txt to yaml format ...
2 parents dcab75a + 161e3be commit cb9b4c3

22 files changed

+418
-193
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ properties:
3939
- enum:
4040
- qcom,pm8550-pwm
4141
- const: qcom,pm8350c-pwm
42+
- items:
43+
- enum:
44+
- qcom,pm8937-pwm
45+
- const: qcom,pm8916-pwm
4246

4347
"#pwm-cells":
4448
const: 2

Documentation/devicetree/bindings/leds/leds-tlc591xx.txt

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/ti,tlc59116.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: LEDs connected to tlc59116 or tlc59108
8+
9+
maintainers:
10+
- Andrew Lunn <andrew@lunn.ch>
11+
12+
properties:
13+
compatible:
14+
enum:
15+
- ti,tlc59108
16+
- ti,tlc59116
17+
18+
reg:
19+
maxItems: 1
20+
21+
"#address-cells":
22+
const: 1
23+
24+
"#size-cells":
25+
const: 0
26+
27+
patternProperties:
28+
"^led@[0-9a-f]$":
29+
type: object
30+
$ref: common.yaml#
31+
properties:
32+
reg:
33+
items:
34+
minimum: 0
35+
maximum: 15
36+
37+
unevaluatedProperties: false
38+
39+
required:
40+
- compatible
41+
- reg
42+
- "#address-cells"
43+
- "#size-cells"
44+
45+
allOf:
46+
- if:
47+
properties:
48+
compatible:
49+
contains:
50+
const: ti,tlc59108
51+
then:
52+
patternProperties:
53+
"^led@[0-9a-f]$":
54+
properties:
55+
reg:
56+
items:
57+
maximum: 7
58+
59+
additionalProperties: false
60+
61+
examples:
62+
- |
63+
i2c {
64+
#address-cells = <1>;
65+
#size-cells = <0>;
66+
67+
led-controller@68 {
68+
compatible = "ti,tlc59116";
69+
reg = <0x68>;
70+
#address-cells = <1>;
71+
#size-cells = <0>;
72+
73+
led@0 {
74+
reg = <0x0>;
75+
label = "wrt1900ac:amber:wan";
76+
};
77+
78+
led@2 {
79+
reg = <0x2>;
80+
label = "wrt1900ac:white:2g";
81+
};
82+
83+
led@9 {
84+
reg = <0x9>;
85+
label = "wrt1900ac:green:alive";
86+
linux,default-trigger = "heartbeat";
87+
};
88+
};
89+
};
90+

drivers/leds/Kconfig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ config LEDS_USER
932932
config LEDS_NIC78BX
933933
tristate "LED support for NI PXI NIC78bx devices"
934934
depends on LEDS_CLASS
935-
depends on X86 && ACPI
935+
depends on HAS_IOPORT
936+
depends on X86 || COMPILE_TEST
936937
help
937938
This option enables support for the User1 and User2 LEDs on NI
938939
PXI NIC78bx devices.
@@ -979,6 +980,7 @@ config LEDS_ST1202
979980
depends on I2C
980981
depends on OF
981982
select LEDS_TRIGGERS
983+
select LEDS_TRIGGER_PATTERN
982984
help
983985
Say Y to enable support for LEDs connected to LED1202
984986
LED driver chips accessed via the I2C bus.
@@ -1022,7 +1024,7 @@ source "drivers/leds/rgb/Kconfig"
10221024
comment "LED Triggers"
10231025
source "drivers/leds/trigger/Kconfig"
10241026

1025-
comment "Simple LED drivers"
1026-
source "drivers/leds/simple/Kconfig"
1027+
comment "Simatic LED drivers"
1028+
source "drivers/leds/simatic/Kconfig"
10271029

10281030
endif # NEW_LEDS

drivers/leds/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,5 @@ obj-$(CONFIG_LEDS_TRIGGERS) += trigger/
122122
# LED Blink
123123
obj-y += blink/
124124

125-
# Simple LED drivers
126-
obj-y += simple/
125+
# Simatic LED drivers
126+
obj-y += simatic/

drivers/leds/led-core.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,19 @@ static void set_brightness_delayed(struct work_struct *ws)
159159
* before this work item runs once. To make sure this works properly
160160
* handle LED_SET_BRIGHTNESS_OFF first.
161161
*/
162-
if (test_and_clear_bit(LED_SET_BRIGHTNESS_OFF, &led_cdev->work_flags))
162+
if (test_and_clear_bit(LED_SET_BRIGHTNESS_OFF, &led_cdev->work_flags)) {
163163
set_brightness_delayed_set_brightness(led_cdev, LED_OFF);
164+
/*
165+
* The consecutives led_set_brightness(LED_OFF),
166+
* led_set_brightness(LED_FULL) could have been executed out of
167+
* order (LED_FULL first), if the work_flags has been set
168+
* between LED_SET_BRIGHTNESS_OFF and LED_SET_BRIGHTNESS of this
169+
* work. To avoid ending with the LED turned off, turn the LED
170+
* on again.
171+
*/
172+
if (led_cdev->delayed_set_value != LED_OFF)
173+
set_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
174+
}
164175

165176
if (test_and_clear_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags))
166177
set_brightness_delayed_set_brightness(led_cdev, led_cdev->delayed_set_value);
@@ -331,10 +342,13 @@ void led_set_brightness_nopm(struct led_classdev *led_cdev, unsigned int value)
331342
* change is done immediately afterwards (before the work runs),
332343
* it uses a separate work_flag.
333344
*/
334-
if (value) {
335-
led_cdev->delayed_set_value = value;
345+
led_cdev->delayed_set_value = value;
346+
/* Ensure delayed_set_value is seen before work_flags modification */
347+
smp_mb__before_atomic();
348+
349+
if (value)
336350
set_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
337-
} else {
351+
else {
338352
clear_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
339353
clear_bit(LED_SET_BLINK, &led_cdev->work_flags);
340354
set_bit(LED_SET_BRIGHTNESS_OFF, &led_cdev->work_flags);

drivers/leds/leds-lp8860.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ static const struct regmap_config lp8860_regmap_config = {
331331
.max_register = LP8860_EEPROM_UNLOCK,
332332
.reg_defaults = lp8860_reg_defs,
333333
.num_reg_defaults = ARRAY_SIZE(lp8860_reg_defs),
334-
.cache_type = REGCACHE_NONE,
335334
};
336335

337336
static const struct reg_default lp8860_eeprom_defs[] = {
@@ -369,7 +368,6 @@ static const struct regmap_config lp8860_eeprom_regmap_config = {
369368
.max_register = LP8860_EEPROM_REG_24,
370369
.reg_defaults = lp8860_eeprom_defs,
371370
.num_reg_defaults = ARRAY_SIZE(lp8860_eeprom_defs),
372-
.cache_type = REGCACHE_NONE,
373371
};
374372

375373
static int lp8860_probe(struct i2c_client *client)

drivers/leds/leds-mlxcpld.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
* POSSIBILITY OF SUCH DAMAGE.
3333
*/
3434

35-
#include <linux/acpi.h>
3635
#include <linux/device.h>
3736
#include <linux/dmi.h>
3837
#include <linux/hwmon.h>

drivers/leds/leds-nic78bx.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
* Copyright (C) 2016 National Instruments Corp.
44
*/
55

6-
#include <linux/acpi.h>
6+
#include <linux/array_size.h>
7+
#include <linux/bits.h>
8+
#include <linux/container_of.h>
9+
#include <linux/device.h>
10+
#include <linux/errno.h>
11+
#include <linux/io.h>
12+
#include <linux/ioport.h>
713
#include <linux/leds.h>
14+
#include <linux/mod_devicetable.h>
815
#include <linux/module.h>
916
#include <linux/platform_device.h>
1017
#include <linux/spinlock.h>
18+
#include <linux/types.h>
1119

1220
#define NIC78BX_USER1_LED_MASK 0x3
1321
#define NIC78BX_USER1_GREEN_LED BIT(0)
@@ -181,16 +189,16 @@ static int nic78bx_probe(struct platform_device *pdev)
181189
}
182190

183191
static const struct acpi_device_id led_device_ids[] = {
184-
{"NIC78B3", 0},
185-
{"", 0},
192+
{ "NIC78B3" },
193+
{ }
186194
};
187195
MODULE_DEVICE_TABLE(acpi, led_device_ids);
188196

189197
static struct platform_driver led_driver = {
190198
.probe = nic78bx_probe,
191199
.driver = {
192200
.name = KBUILD_MODNAME,
193-
.acpi_match_table = ACPI_PTR(led_device_ids),
201+
.acpi_match_table = led_device_ids,
194202
},
195203
};
196204

0 commit comments

Comments
 (0)