Commit b546608e authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents 69352bd5 b338a2ae
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -72,6 +72,12 @@ Description:
		/sys/class/leds/<led> once a given trigger is selected. For
		their documentation see `sysfs-class-led-trigger-*`.

		Writing "none" removes the trigger for this LED.

		Writing "default" sets the trigger to the LED's default trigger
		(which would often be configured in the device tree for the
		hardware).

What:		/sys/class/leds/<led>/inverted
Date:		January 2011
KernelVersion:	2.6.38
+120 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/ti,tps61310.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Texas Instruments TPS6131X flash LED driver

maintainers:
  - Matthias Fend <matthias.fend@emfend.at>

description: |
  The TPS61310/TPS61311 is a flash LED driver with I2C interface.
  Its power stage is capable of supplying a maximum total current of roughly 1500mA.
  The TPS6131x provides three constant-current sinks, capable of sinking
  up to 2 x 400mA (LED1 and LED3) and 800mA (LED2) in flash mode.
  In torch mode, each sink (LED1, LED2, LED3) supports currents up to 175mA.
  Since the three current sinks share most of the control components such as
  flash timer, control logic, safety timer and the operating mode, they cannot
  be used completely independently of each other. Therefore, only one LED is
  supported, but the current sinks can be combined accordingly.

  The data sheet can be found at:
    https://www.ti.com/lit/ds/symlink/tps61310.pdf

properties:
  compatible:
    oneOf:
      - items:
          - enum:
              - ti,tps61311
          - const: ti,tps61310
      - items:
          - const: ti,tps61310

  reg:
    maxItems: 1

  reset-gpios:
    maxItems: 1
    description: GPIO connected to NRESET pin

  ti,valley-current-limit:
    type: boolean
    description:
      Reduce the valley peak current limit from 1750mA to 1250mA (TPS61310) or
      from 2480mA to 1800mA (TPS61311).

  led:
    type: object
    $ref: common.yaml#
    unevaluatedProperties: false

    properties:
      led-sources:
        minItems: 1
        maxItems: 3
        items:
          enum: [1, 2, 3]

      led-max-microamp:
        oneOf:
          - minimum: 50000
            maximum: 350000
            multipleOf: 50000
          - minimum: 25000
            maximum: 525000
            multipleOf: 25000

      flash-max-microamp:
        oneOf:
          - minimum: 50000
            maximum: 800000
            multipleOf: 50000
          - minimum: 25000
            maximum: 1500000
            multipleOf: 25000

      flash-max-timeout-us:
        enum: [ 5300, 10700, 16000, 21300, 26600, 32000, 37300, 68200, 71500,
                102200, 136300, 170400, 204500, 340800, 579300, 852000 ]

    required:
      - led-sources
      - led-max-microamp
      - flash-max-microamp
      - flash-max-timeout-us

required:
  - compatible
  - reg
  - led

additionalProperties: false

examples:
  - |
    #include <dt-bindings/leds/common.h>
    #include <dt-bindings/gpio/gpio.h>

    i2c {
      #address-cells = <1>;
      #size-cells = <0>;

      led-controller@33 {
        compatible = "ti,tps61311", "ti,tps61310";
        reg = <0x33>;

        reset-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;

        led {
          function = LED_FUNCTION_FLASH;
          color = <LED_COLOR_ID_WHITE>;
          led-sources = <1>, <2>, <3>;
          led-max-microamp = <525000>;
          flash-max-microamp = <1500000>;
          flash-max-timeout-us = <852000>;
        };
      };
    };
+1 −1
Original line number Diff line number Diff line
@@ -28,5 +28,5 @@ LEDs
   leds-mlxcpld
   leds-mt6370-rgb
   leds-sc27xx
   leds-st1202.rst
   leds-st1202
   leds-qcom-lpg
+7 −0
Original line number Diff line number Diff line
@@ -24447,6 +24447,13 @@ F: Documentation/devicetree/bindings/hwmon/ti,tps23861.yaml
F:	Documentation/hwmon/tps23861.rst
F:	drivers/hwmon/tps23861.c
TEXAS INSTRUMENTS TPS6131X FLASH LED DRIVER
M:	Matthias Fend <matthias.fend@emfend.at>
L:	linux-leds@vger.kernel.org
S:	Maintained
F:	Documentation/devicetree/bindings/leds/ti,tps6131x.yaml
F:	drivers/leds/flash/leds-tps6131x.c
TEXAS INSTRUMENTS' DAC7612 DAC DRIVER
M:	Ricardo Ribalda <ribalda@kernel.org>
L:	linux-iio@vger.kernel.org
+6 −6
Original line number Diff line number Diff line
@@ -928,22 +928,22 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
EXPORT_SYMBOL_GPL(fwnode_device_is_available);

/**
 * device_get_child_node_count - return the number of child nodes for device
 * @dev: Device to count the child nodes for
 * fwnode_get_child_node_count - return the number of child nodes for a given firmware node
 * @fwnode: Pointer to the parent firmware node
 *
 * Return: the number of child nodes for a given device.
 * Return: the number of child nodes for a given firmware node.
 */
unsigned int device_get_child_node_count(const struct device *dev)
unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode)
{
	struct fwnode_handle *child;
	unsigned int count = 0;

	device_for_each_child_node(dev, child)
	fwnode_for_each_child_node(fwnode, child)
		count++;

	return count;
}
EXPORT_SYMBOL_GPL(device_get_child_node_count);
EXPORT_SYMBOL_GPL(fwnode_get_child_node_count);

bool device_dma_supported(const struct device *dev)
{
Loading