Skip to content

Commit b546608

Browse files
committed
Merge tag 'leds-next-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones: "LED Triggers: - Allow writing "default" to the sysfs 'trigger' attribute to set an LED to its default trigger - If the default trigger is "none", writing "default" will remove the current trigger - Updated sysfs ABI documentation for the new "default" trigger functionality LED KUnit Testing: - Provide a skeleton KUnit test suite for the LEDs framework - Expand the LED class device registration KUnit test to cover more scenarios, including 'brightness_get' behavior - Add KUnit tests for the LED lookup and get API ('led_add_lookup', 'devm_led_get') LED Flash Class: - Add support for setting flash/strobe duration through a new 'duration_set' op and 'led_set_flash_duration()' function, aligning with 'V4L2_CID_FLASH_DURATION' Texas Instruments TPS6131x: - Add a new driver for the TPS61310/TPS61311 flash LED controllers - The driver supports the device's three constant-current sinks for flash and torch modes LED Core: - Prevent potential 'snprintf()' truncations in LED names by checking for buffer overflows ChromeOS EC LEDs: - Avoid a -Wflex-array-member-not-at-end GCC warning by replacing an on-stack flexible structure definition with a utility function call Multicolor LEDs: - Fix issue where setting multi_intensity while software blinking is active could stop blinking PCA955x LEDs: - Avoid potential buffer overflow when creating default labels by changing a field's type to 'u8' and updating format specifiers PCA995x LEDs: - Fix a typo (stray space) in an 'of_device_id' entry in the 'pca995x_of_match' table Kconfig: - Prevent LED drivers from being enabled by default when 'COMPILE_TEST' is set Device Property API: - Split 'device_get_child_node_count()' into a new helper 'fwnode_get_child_node_count()' that doesn't require a device struct, making the API more symmetrical Driver Modernization (using 'fwnode_get_child_node_count()'): - Update 'leds-pwm-multicolor', 'leds-ncp5623' and 'leds-ncp5623' to use the new 'fwnode_get_child_node_count()' helper, removing their custom implementation - As above in the USB Type-C TCPM driver Driver Modernization (using new GPIO setter callbacks): - Convert 'leds-lgm-sso' to use new GPIO line value setter callbacks which return an integer for error handling - Convert 'leds-pca955x', 'leds-pca9532' and 'leds-tca6507' to use new GPIO setter callbacks Documentation: - Remove the '.rst' extension for 'leds-st1202' in the documentation index for consistency LP8860 LEDs: - Use 'regmap_multi_reg_write()' for EEPROM writes instead of manual looping - Use scoped mutex guards and 'devm_mutex_init()' to simplify function exits and ensure automatic cleanup - Remove default register definitions that are unused when regmap caching is not active - Use 'devm_regulator_get_enable_optional()' to handle the optional regulator, simplifying enabling and removing manual disabling - Refactor 'lp8860_unlock_eeprom()' to only perform the unlock operation, removing the lock part and an unnecessary parameter - Use a 'devm' action to disable the enable-GPIO, simplifying cleanup and error paths, and remove the now-empty '.remove()' function Turris Omnia LEDs: - Drop unnecessary commas in terminator entries of 'struct attribute' and 'struct of_device_id' arrays MT6370 RGB LEDs: - Use the 'LINEAR_RANGE()' for defining 'struct linear_range' entries to improve robustness Texas Instruments TPS6131x: - Add new devicetree bindings for the TI TPS61310/TPS61311 flash LED driver" * tag 'leds-next-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (31 commits) leds: tps6131x: Add support for Texas Instruments TPS6131X flash LED driver dt-bindings: leds: Add Texas Instruments TPS6131x flash LED driver leds: flash: Add support for flash/strobe duration leds: rgb: leds-mt6370-rgb: Improve definition of some struct linear_range leds: led-test: Provide tests for the lookup and get infrastructure leds: led-test: Fill out the registration test to cover more test cases leds: led-test: Remove standard error checking after KUNIT_ASSERT_*() leds: pca995x: Fix typo in pca995x_of_match's of_device_id entry leds: Provide skeleton KUnit testing for the LEDs framework leds: tca6507: Use new GPIO line value setter callbacks leds: pca9532: Use new GPIO line value setter callbacks leds: pca955x: Use new GPIO line value setter callbacks leds: lgm-sso: Use new GPIO line value setter callbacks leds: Do not enable by default during compile testing leds: turris-omnia: Drop commas in the terminator entries leds: lp8860: Disable GPIO with devm action leds: lp8860: Only unlock in lp8860_unlock_eeprom() leds: lp8860: Enable regulator using enable_optional helper leds: lp8860: Remove default regs when not caching leds: lp8860: Use new mutex guards to cleanup function exits ...
2 parents 69352bd + b338a2a commit b546608

30 files changed

+1290
-260
lines changed

Documentation/ABI/testing/sysfs-class-led

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ Description:
7272
/sys/class/leds/<led> once a given trigger is selected. For
7373
their documentation see `sysfs-class-led-trigger-*`.
7474

75+
Writing "none" removes the trigger for this LED.
76+
77+
Writing "default" sets the trigger to the LED's default trigger
78+
(which would often be configured in the device tree for the
79+
hardware).
80+
7581
What: /sys/class/leds/<led>/inverted
7682
Date: January 2011
7783
KernelVersion: 2.6.38
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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,tps61310.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Texas Instruments TPS6131X flash LED driver
8+
9+
maintainers:
10+
- Matthias Fend <[email protected]>
11+
12+
description: |
13+
The TPS61310/TPS61311 is a flash LED driver with I2C interface.
14+
Its power stage is capable of supplying a maximum total current of roughly 1500mA.
15+
The TPS6131x provides three constant-current sinks, capable of sinking
16+
up to 2 x 400mA (LED1 and LED3) and 800mA (LED2) in flash mode.
17+
In torch mode, each sink (LED1, LED2, LED3) supports currents up to 175mA.
18+
Since the three current sinks share most of the control components such as
19+
flash timer, control logic, safety timer and the operating mode, they cannot
20+
be used completely independently of each other. Therefore, only one LED is
21+
supported, but the current sinks can be combined accordingly.
22+
23+
The data sheet can be found at:
24+
https://www.ti.com/lit/ds/symlink/tps61310.pdf
25+
26+
properties:
27+
compatible:
28+
oneOf:
29+
- items:
30+
- enum:
31+
- ti,tps61311
32+
- const: ti,tps61310
33+
- items:
34+
- const: ti,tps61310
35+
36+
reg:
37+
maxItems: 1
38+
39+
reset-gpios:
40+
maxItems: 1
41+
description: GPIO connected to NRESET pin
42+
43+
ti,valley-current-limit:
44+
type: boolean
45+
description:
46+
Reduce the valley peak current limit from 1750mA to 1250mA (TPS61310) or
47+
from 2480mA to 1800mA (TPS61311).
48+
49+
led:
50+
type: object
51+
$ref: common.yaml#
52+
unevaluatedProperties: false
53+
54+
properties:
55+
led-sources:
56+
minItems: 1
57+
maxItems: 3
58+
items:
59+
enum: [1, 2, 3]
60+
61+
led-max-microamp:
62+
oneOf:
63+
- minimum: 50000
64+
maximum: 350000
65+
multipleOf: 50000
66+
- minimum: 25000
67+
maximum: 525000
68+
multipleOf: 25000
69+
70+
flash-max-microamp:
71+
oneOf:
72+
- minimum: 50000
73+
maximum: 800000
74+
multipleOf: 50000
75+
- minimum: 25000
76+
maximum: 1500000
77+
multipleOf: 25000
78+
79+
flash-max-timeout-us:
80+
enum: [ 5300, 10700, 16000, 21300, 26600, 32000, 37300, 68200, 71500,
81+
102200, 136300, 170400, 204500, 340800, 579300, 852000 ]
82+
83+
required:
84+
- led-sources
85+
- led-max-microamp
86+
- flash-max-microamp
87+
- flash-max-timeout-us
88+
89+
required:
90+
- compatible
91+
- reg
92+
- led
93+
94+
additionalProperties: false
95+
96+
examples:
97+
- |
98+
#include <dt-bindings/leds/common.h>
99+
#include <dt-bindings/gpio/gpio.h>
100+
101+
i2c {
102+
#address-cells = <1>;
103+
#size-cells = <0>;
104+
105+
led-controller@33 {
106+
compatible = "ti,tps61311", "ti,tps61310";
107+
reg = <0x33>;
108+
109+
reset-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
110+
111+
led {
112+
function = LED_FUNCTION_FLASH;
113+
color = <LED_COLOR_ID_WHITE>;
114+
led-sources = <1>, <2>, <3>;
115+
led-max-microamp = <525000>;
116+
flash-max-microamp = <1500000>;
117+
flash-max-timeout-us = <852000>;
118+
};
119+
};
120+
};

Documentation/leds/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ LEDs
2828
leds-mlxcpld
2929
leds-mt6370-rgb
3030
leds-sc27xx
31-
leds-st1202.rst
31+
leds-st1202
3232
leds-qcom-lpg

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24447,6 +24447,13 @@ F: Documentation/devicetree/bindings/hwmon/ti,tps23861.yaml
2444724447
F: Documentation/hwmon/tps23861.rst
2444824448
F: drivers/hwmon/tps23861.c
2444924449

24450+
TEXAS INSTRUMENTS TPS6131X FLASH LED DRIVER
24451+
M: Matthias Fend <[email protected]>
24452+
24453+
S: Maintained
24454+
F: Documentation/devicetree/bindings/leds/ti,tps6131x.yaml
24455+
F: drivers/leds/flash/leds-tps6131x.c
24456+
2445024457
TEXAS INSTRUMENTS' DAC7612 DAC DRIVER
2445124458
M: Ricardo Ribalda <[email protected]>
2445224459

drivers/base/property.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -928,22 +928,22 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
928928
EXPORT_SYMBOL_GPL(fwnode_device_is_available);
929929

930930
/**
931-
* device_get_child_node_count - return the number of child nodes for device
932-
* @dev: Device to count the child nodes for
931+
* fwnode_get_child_node_count - return the number of child nodes for a given firmware node
932+
* @fwnode: Pointer to the parent firmware node
933933
*
934-
* Return: the number of child nodes for a given device.
934+
* Return: the number of child nodes for a given firmware node.
935935
*/
936-
unsigned int device_get_child_node_count(const struct device *dev)
936+
unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode)
937937
{
938938
struct fwnode_handle *child;
939939
unsigned int count = 0;
940940

941-
device_for_each_child_node(dev, child)
941+
fwnode_for_each_child_node(fwnode, child)
942942
count++;
943943

944944
return count;
945945
}
946-
EXPORT_SYMBOL_GPL(device_get_child_node_count);
946+
EXPORT_SYMBOL_GPL(fwnode_get_child_node_count);
947947

948948
bool device_dma_supported(const struct device *dev)
949949
{

drivers/leds/.kunitconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CONFIG_KUNIT=y
2+
CONFIG_NEW_LEDS=y
3+
CONFIG_LEDS_CLASS=y
4+
CONFIG_LEDS_KUNIT_TEST=y

drivers/leds/Kconfig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ config LEDS_BRIGHTNESS_HW_CHANGED
5555

5656
See Documentation/ABI/testing/sysfs-class-led for details.
5757

58+
config LEDS_KUNIT_TEST
59+
tristate "KUnit tests for LEDs"
60+
depends on KUNIT && LEDS_CLASS
61+
default KUNIT_ALL_TESTS
62+
help
63+
Say Y here to enable KUnit testing for the LEDs framework.
64+
5865
comment "LED drivers"
5966

6067
config LEDS_88PM860X
@@ -735,7 +742,7 @@ config LEDS_NS2
735742
tristate "LED support for Network Space v2 GPIO LEDs"
736743
depends on LEDS_CLASS
737744
depends on MACH_KIRKWOOD || MACH_ARMADA_370 || COMPILE_TEST
738-
default y
745+
default y if MACH_KIRKWOOD || MACH_ARMADA_370
739746
help
740747
This option enables support for the dual-GPIO LEDs found on the
741748
following LaCie/Seagate boards:
@@ -750,7 +757,7 @@ config LEDS_NETXBIG
750757
depends on LEDS_CLASS
751758
depends on MACH_KIRKWOOD || COMPILE_TEST
752759
depends on OF_GPIO
753-
default y
760+
default MACH_KIRKWOOD
754761
help
755762
This option enables support for LEDs found on the LaCie 2Big
756763
and 5Big Network v2 boards. The LEDs are wired to a CPLD and are

drivers/leds/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ obj-$(CONFIG_LEDS_CLASS) += led-class.o
66
obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o
77
obj-$(CONFIG_LEDS_CLASS_MULTICOLOR) += led-class-multicolor.o
88
obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
9+
obj-$(CONFIG_LEDS_KUNIT_TEST) += led-test.o
910

1011
# LED Platform Drivers (keep this sorted, M-| sort)
1112
obj-$(CONFIG_LEDS_88PM860X) += leds-88pm860x.o

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,16 @@ static int sso_gpio_get(struct gpio_chip *chip, unsigned int offset)
450450
return !!(reg_val & BIT(offset));
451451
}
452452

453-
static void sso_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
453+
static int sso_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
454454
{
455455
struct sso_led_priv *priv = gpiochip_get_data(chip);
456456

457457
regmap_update_bits(priv->mmap, SSO_CPU, BIT(offset), value << offset);
458458
if (!priv->gpio.freq)
459459
regmap_update_bits(priv->mmap, SSO_CON0, SSO_CON0_SWU,
460460
SSO_CON0_SWU);
461+
462+
return 0;
461463
}
462464

463465
static int sso_gpio_gc_init(struct device *dev, struct sso_led_priv *priv)
@@ -469,7 +471,7 @@ static int sso_gpio_gc_init(struct device *dev, struct sso_led_priv *priv)
469471
gc->get_direction = sso_gpio_get_dir;
470472
gc->direction_output = sso_gpio_dir_out;
471473
gc->get = sso_gpio_get;
472-
gc->set = sso_gpio_set;
474+
gc->set_rv = sso_gpio_set;
473475

474476
gc->label = "lgm-sso";
475477
gc->base = -1;

drivers/leds/flash/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,15 @@ config LEDS_SY7802
132132

133133
This driver can be built as a module, it will be called "leds-sy7802".
134134

135+
config LEDS_TPS6131X
136+
tristate "LED support for TI TPS6131x flash LED driver"
137+
depends on I2C && OF
138+
depends on GPIOLIB
139+
select REGMAP_I2C
140+
help
141+
This option enables support for Texas Instruments TPS61310/TPS61311
142+
flash LED driver.
143+
144+
This driver can be built as a module, it will be called "leds-tps6131x".
145+
135146
endif # LEDS_CLASS_FLASH

drivers/leds/flash/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ obj-$(CONFIG_LEDS_RT4505) += leds-rt4505.o
1212
obj-$(CONFIG_LEDS_RT8515) += leds-rt8515.o
1313
obj-$(CONFIG_LEDS_SGM3140) += leds-sgm3140.o
1414
obj-$(CONFIG_LEDS_SY7802) += leds-sy7802.o
15+
obj-$(CONFIG_LEDS_TPS6131X) += leds-tps6131x.o

0 commit comments

Comments
 (0)