2176 Commits

Author SHA1 Message Date
Thomas Gleixner
8fa7292fee treewide: Switch/rename to timer_delete[_sync]()
timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree
over and remove the historical wrapper inlines.

Conversion was done with coccinelle plus manual fixups where necessary.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2025-04-05 10:30:12 +02:00
Linus Torvalds
cb9b4c3403 * 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmfmqRcACgkQUa+KL4f8
 d2EIjg//cmG4xqmhs5u38pAVL30ZYphGL3AlSVnAtMbBgP3u6AzzppjrDHQuPbZC
 Iw8VGRbl1JTu1kazlQ4B4VR1b0KBAScz0oIrLqb/qJUWFw9DsIeKxCsTjukRr+/O
 FaQJRwhSPd4x+RW6+yGrug0ciR+f6ZfaQl7SLP7Puo2TqQukaA28aVG+KPeVxUzi
 CdVNDyMLSpDBNvWq1zRzlGEHDUprFO+lwV5kVy9V5qT7t5WkayMkOE4qsopJVQqh
 jkbxpKfxfWh7Mi3BxACqiVVTZRlzPu8hCmm+9OwT08m+coXGkSNzhXni3dSNugOL
 XMFQatfmsRgqSt68icHA993xhNytkLN8yj98mzUcpky8VfwUMNXKN2JhTJT+QG19
 +W4/Xt1WROMr/FTi4JBLzQe3dmyXPiVpONtUuO4vVtPeXyUMOUxKU9opVF6KHu/v
 +9xF4qDYVbxvV0NysB6unsqyEL+su+//wBhR+7gSpc7Gg8gquE9kFeP+1jkK5K4d
 mKhijFr1BGP1f6nJA5wivnKJ9EIie7wnJcrLFCDDYV2uACJDwmaBIx+VLb2yf/FY
 usd1bj/4mMobtSGrYnOZf4IK8erDt/+ozm0t7pqshmI/SM54xMvF3L7CttOPPh6K
 j69dTkKJ9FzfSqy2RZ9gvbga+WoCD3++lhw5ivGJjF9lRaQQo7I=
 =cEhV
 -----END PGP SIGNATURE-----

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
  ...
2025-03-29 14:42:59 -07:00
Linus Torvalds
dcab75a3c8 * Maxim MAX77705:
* Added core MFD driver.
     * Added charger driver.
     * Added devicetree bindings for the charger and MFD core.
     * Added Haptic controller support via the input subsystem.
     * Added LED support.
     * Added support to simple-mfd-i2c for fuel gauge and hwmon.
   * Samsung S2MPU05 (Exynos7870 PMIC):
     * Added core MFD support.
     * Added Regulator support for 21 LDOs and 5 BUCKs.
     * Added devicetree bindings for regulators and the PMIC core.
   * TI TPS65215 & TPS65214:
     * Added support to the existing TPS65219 driver.
     * Added devicetree bindings.
   * STMicroelectronics STM32MP25:
     * Added support to the stm32-timers MFD driver.
     * Added devicetree bindings.
   * Congatec Board Controller (CGBC):
     * Added HWMON support for internal sensors.
     * Added support for the conga-SA8 module.
   * Microchip LAN969X:
     * Enabled the at91-usart MFD driver for this architecture.
   * MediaTek MT6359:
     * Added mfd_cell for mt6359-accdet to allow its driver to probe.
 
   * AXP20X (AXP717): Added AXP717_TS_PIN_CFG register to writeable
     regs for temperature sensor configuration.
   * SM501: Switched to using BIT() macro to mitigate potential
     integer overflows in GPIO functions.
   * ENE KB3930: Added a NULL pointer check for off_gpios during
     probe to prevent potential dereference.
   * SYSCON: Added a check for invalid resource size to prevent
     issues from DT misconfiguration.
   * CGBC: Corrected signedness issues in cgbc_session_request.
 
   * intel_soc_pmic_chtdc_ti / intel_soc_pmic_crc: Removed unneeded
     explicit assignment to REGCACHE_NONE.
   * ipaq-micro / tps65010: Switched to using str_enable_disable()
     helpers for clarity and potential size reduction.
   * upboard-fpga: Removed unnecessary ACPI_PTR() annotation.
   * max8997: Removed unused max8997_irq_exit() function, using
     devm_* helpers instead.
   * lp3943: Dropped unused #include <linux/pwm.h> from the header
     file.
   * db8500-prcmu: Removed needless return statements in void APIs.
   * qnap-mcu: Replaced commas with semicolons between expressions
     for correctness.
 
   * STA2X11: Removed the core MFD driver as the underlying
     platform support was removed.
   * EZX-PCAP: Removed the unused pcap_adc_sync function.
   * PCF50633 (OpenMoko PMIC): Removed the entire driver (core, adc,
     gpio, irq) as the underlying s3c24xx platform support was removed.
 
   * Converted fsl,mcu-mpc8349emitx binding to YAML.
   * Added qcom,msm8937-tcsr compatible.
   * Added microchip,sama7d65-flexcom compatible.
   * Added rockchip,rk3528-qos syscon compatible.
   * Added airoha,en7581-pbus-csr syscon compatible.
   * Added microchip,sama7d65-ddr3phy syscon compatible.
   * Added microchip,sama7d65-sfrbu syscon compatible.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmfmqKQACgkQUa+KL4f8
 d2G+rA//UU3UixCD8FsNN+o4DS7FbxdiSUCrATOBKia9MGfor4xCl6Qk9ZyO4sE1
 Rr9zUrTb1xlCmMZupZlkV8TDHHcaiUbgmnKB161d4HMxCbju10MKlm7faz2vRMz3
 a73ehTmUeNDiWG3t1/2zAyRt7PHPC2zakUlnXlLhLir12uR2jsDSeGOZh4xR7Hdi
 5nkOA2xWbbeW4b+ybwZ32afbLtZFkLo80QvqDx/D9lMUnQO0FqKak0Zope7IzeqC
 ilg+tIJOQRGEbjEVQ+pVXsPI6zfmO8eAja70F7sm+Q6TVDw2JhHU/YElHw+quiP+
 aLYeE+DuSun1EYlK4ATQ0vzUdgsaOEWblF0eythctXFTfM9ZKhzWYdXEOvco7N4u
 R9BYRtM/zGkxiScbr6igyjWZx7NPOsKEKIi5tOv+C2BAKb53om7vsNuMgvMDL/8W
 gztmG0SMKwJSx2Dg7h1LLUfa3tG9QRFd0I+Yfaso3MtYmxnZVcJtM5IQbvzf6i/B
 3fSiGP6PDNeJqbn9k3/7SB8Tb4XmJUN2LFdDtDuWVhgZpSDULkjpYxAXDIrbp+il
 QNdLPiU1x7OzPkFZQxtXLt7yRmlEc2lu9jJHkGVM1M18TMexQiFxoSY9NxkbUj3o
 T4s/PKGmRKHP9XxCmRSfu6Veql0MPUwtvkErlUf4GTLWK4oshag=
 =ntF1
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "Maxim MAX77705:
   - Added core MFD driver.
   - Added charger driver.
   - Added devicetree bindings for the charger and MFD core.
   - Added Haptic controller support via the input subsystem.
   - Added LED support.
   - Added support to simple-mfd-i2c for fuel gauge and hwmon.

  Samsung S2MPU05 (Exynos7870 PMIC):
   - Added core MFD support.
   - Added Regulator support for 21 LDOs and 5 BUCKs.
   - Added devicetree bindings for regulators and the PMIC core.

  TI TPS65215 & TPS65214:
   - Added support to the existing TPS65219 driver.
   - Added devicetree bindings.

  STMicroelectronics STM32MP25:
   - Added support to the stm32-timers MFD driver.
   - Added devicetree bindings.

  Congatec Board Controller (CGBC):
   - Added HWMON support for internal sensors.
   - Added support for the conga-SA8 module.

  Microchip LAN969X:
   - Enabled the at91-usart MFD driver for this architecture.

  MediaTek MT6359:
   - Added mfd_cell for mt6359-accdet to allow its driver to probe.

  Other misc driver updates:
   - AXP20X (AXP717): Added AXP717_TS_PIN_CFG register to writeable regs
     for temperature sensor configuration.
   - SM501: Switched to using BIT() macro to mitigate potential integer
     overflows in GPIO functions.
   - ENE KB3930: Added a NULL pointer check for off_gpios during probe
     to prevent potential dereference.
   - SYSCON: Added a check for invalid resource size to prevent issues
     from DT misconfiguration.
   - CGBC: Corrected signedness issues in cgbc_session_request
   - intel_soc_pmic_chtdc_ti / intel_soc_pmic_crc: Removed unneeded
     explicit assignment to REGCACHE_NONE.
   - ipaq-micro / tps65010: Switched to using str_enable_disable()
     helpers for clarity and potential size reduction.
   - upboard-fpga: Removed unnecessary ACPI_PTR() annotation.
   - max8997: Removed unused max8997_irq_exit() function, using devm_*
     helpers instead.
   - lp3943: Dropped unused #include <linux/pwm.h> from the header file.
   - db8500-prcmu: Removed needless return statements in void APIs.
   - qnap-mcu: Replaced commas with semicolons between expressions for
     correctness.
   - STA2X11: Removed the core MFD driver as the underlying platform
     support was removed.
   - EZX-PCAP: Removed the unused pcap_adc_sync function.
   - PCF50633 (OpenMoko PMIC): Removed the entire driver (core, adc,
     gpio, irq) as the underlying s3c24xx platform support was removed.

  Devicetree updates:
   - Converted fsl,mcu-mpc8349emitx binding to YAML
   - Added qcom,msm8937-tcsr compatible
   - Added microchip,sama7d65-flexcom compatible
   - Added rockchip,rk3528-qos syscon compatible
   - Added airoha,en7581-pbus-csr syscon compatible
   - Added microchip,sama7d65-ddr3phy syscon compatible
   - Added microchip,sama7d65-sfrbu syscon compatible"

* tag 'mfd-next-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (49 commits)
  mfd: cgbc-core: Add support for conga-SA8
  dt-bindings: mfd: syscon: Add microchip,sama7d65-sfrbu
  dt-bindings: mfd: syscon: Add microchip,sama7d65-ddr3phy
  mfd: cgbc: Add support for HWMON
  dt-bindings: mfd: syscon: Add the pbus-csr node for Airoha EN7581 SoC
  mfd: cgbc-core: Cleanup signedness in cgbc_session_request()
  mfd: pcf50633: Remove remaining PCF50633 support
  mfd: pcf50633: Remove unused platform IRQ code
  mfd: pcF50633-gpio: Remove unused driver
  mfd: pcf50633-adc: Remove unused driver
  mfd: qnap-mcu: Convert commas to semicolons in qnap_mcu_exec()
  mfd: mt6397-core: Add mfd_cell for mt6359-accdet
  dt-bindings: mfd: syscon: Add rk3528 QoS register compatible
  dt-bindings: mfd: atmel,sama5d2-flexcom: Add microchip,sama7d65-flexcom
  mfd: ezx-pcap: Remove unused pcap_adc_sync
  mfd: db8500-prcmu: Remove needless return in three void APIs
  mfd: Remove STA2x11 core driver
  mfd: max77620: Allow building as a module
  mfd: ene-kb3930: Fix a potential NULL pointer dereference
  dt-bindings: mfd: qcom,tcsr: Add compatible for MSM8937
  ...
2025-03-29 14:33:13 -07:00
Linus Torvalds
5143840cef gpio updates for v6.15-rc1
GPIO core:
 - add sanitization of return values of GPIO provider callbacks so that invalid
   ones don't get propagated to user-space
 - add new variants of the line setter callbacks for GPIO providers that return
   an integer and allow to indicate driver errors to the GPIO core
 - change the interface of all gpiod_set_value() variants to return an integer
   thus becoming able to indicate failures in the underlying layer to callers
 - drop unneeded ERR_CAST in gpiolib-acpi
 - use for_each_if() where applicable
 - provide gpiod_multi_set_value_cansleep() as a new, simpler interface to
   gpiod_set_array_value_cansleep() and use it across several drivers treewide
 - reduce the number of atomic reads of the descriptor flags in gpiolib debugfs
   code
 - simplify for_each_hwgpio_in_range() and for_each_requested_gpio_in_range()
 - add support for three-cell GPIO specifiers in GPIO OF code
 - don't build HTE (hardware timestamp engine) GPIO code with the HTE subsystem
   disabled in Kconfig
 - unduplicate calls to gpiod_direction_input_nonotify()
 - rework the handling of the valid_mask property of GPIO chips: don't allow
   drivers to set it as it should only be handled by GPIO core and start
   actually enforcing it in GPIO core for *all* drivers, not only the ones
   implementing a custom request() callback
 - get the `ngpios` property from the fwnode of the GPIO chip, not its device in
   order to handle multi-bank GPIO chips
 
 Driver improvements:
 - convert a part of the GPIO drivers under drivers/gpio/ to using the new value
   setter callbacks
 - convert several drivers to using automatic lock guards from cleanup.h
 - allow building gpio-bt8xx with COMPILE_TEST=y
 - refactor gpio-74x164 (use devres, cleanup helpers, __counted_by() and bits.h
   macros)
 - refactor gpio-latch (use generic device properties, lock guards and some
   local variables for better readability)
 - refactor gpio-xilinx (improve the usage of the bitmap API)
 - support multiple virtual GPIO controller instances in gpio-virtio
 - allow gpio-regmap to use the standard `ngpios` property from GPIOLIB
 - factor out the common code for synchronous probing of virtual GPIO devices
   into its own library
 - use str_enable_disable(), str_high_low() and other string helpers where
   applicable
 - extend the gpio-mmio abstraction layer to allow calling into the pinctrl
   back-end when setting direction
 - convert gpio-vf610 to using the gpio-mmio library
 - use more devres in gpio-adnp
 - add support for reset-gpios in gpio-pcf857x
 - add support for more models to gpio-loongson-64bit
 
 DT bindings:
 - add new compatibles to gpio-vf610 and gpio-loongson
 - add missing gpio-ranges property to gpio-mvebu
 - add reset-gpios to nxp,pcf8575
 - enable gpio-hog parsing in ast2400-gpio
 
 Misc:
 - coding style improvements
 - kerneldoc fixes
 - includes reordering
 - updates to the TODO list
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmfigbMACgkQEacuoBRx
 13IX7Q/9GohFf6WvjJ4eKUJqmYcQdES/PVPdHUUVpDTMkuljUbkEmDXwu3qjWF+t
 mD7Co2Fk9sndQrmAI2YqWzDObzNHn/TLhDY8WVVzvJdL7kABPchJ6ZfJ9J92SEcU
 3KbaFnih+q6M4EcM3P30pnkYEAdZ6y5mbOAB4zFCqlf3qAUGIaC2phxN767ucu/m
 kQRQInwFs5lt3H/LfJ4lplUmMF4+x64pb19tRvo/vErtuaiU61Vhu4tFbgIe3d2R
 otTqmKuZwTUZCwFsZY1DVIcF00CxxIH5riZ/S+ejkWqETsSZUSbp48q2jpWeKnrG
 n8Op6zaOrXJEDTqBK+Uxp7vvO62GV7KrcI2JvTIHmriiTYxAGhRgGMzd6swZA9Ha
 EvnDwx742iNclB3KbL3eXbGWVxxjkTiDQvEHRHB73121jjM3py+HzSmb5OZdqOMr
 NPDIAZKr5RdXdx6CXTEVDqy4+aubSyPt2AFiD9T3kiwwOeqvBmEGSda6cT89gVEJ
 QccHNWG8/91xargLyllc9eiSiN4SLqj0Pdw9IkjIQi9zoF3te5QSNdezbEPTqhAk
 Ybp4krWJFunfsbERYfZ14H841oJk1a2rAYpEET2EQzhRlGS3zOJWGOjqQPE5g319
 3gjEEQRtm2UMKv+zUsijG4BBBgbOtkWOUihCob05lzsOPw3GwKI=
 =h7Hv
 -----END PGP SIGNATURE-----

Merge tag 'gpio-updates-for-v6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio updates from Bartosz Golaszewski:
 "There are no new drivers this time but several changes to the core
  GPIO framework and various driver updates.

  This release cycle, we're starting a relatively straightforward but
  tedious rework of the GPIO consumer API: for historical reasons, the
  gpiod_set_value() variants would return void. Not only that but the
  GPIO provider interface does not even allow drivers to return a value
  to GPIO core. This is because initial GPIO controllers would be MMIO
  based and could not fail. We've had I2C, SPI and USB controllers for
  years too but no way of indicating failures to callers.

  This changes the consumer interface, adds new provider callbacks and
  starts converting the drivers under drivers/gpio/ to using them. Once
  this gets upstream, we'll keep on converting GPIO drivers that live
  elsewhere and once there are no more users of the old callbacks, we'll
  remove them and rename the new ones to the previous name. I imagine
  the last step would happen in one sweeping change like what you did
  for the remove_new() -> remove() renaming.

  We've also addressed an issue where invalid return values from GPIO
  drivers would get propagated to user-space by adding some
  GPIO-core-level sanitization. Again: not a complex change but way
  overdue.

  Other than that: lots of driver and core refactoring, DT-bindings
  changes and some other minor changes like coding style fixes or header
  reordering.

  GPIO core:
   - add sanitization of return values of GPIO provider callbacks so
     that invalid ones don't get propagated to user-space
   - add new variants of the line setter callbacks for GPIO providers
     that return an integer and allow to indicate driver errors to the
     GPIO core
   - change the interface of all gpiod_set_value() variants to return an
     integer thus becoming able to indicate failures in the underlying
     layer to callers
   - drop unneeded ERR_CAST in gpiolib-acpi
   - use for_each_if() where applicable
   - provide gpiod_multi_set_value_cansleep() as a new, simpler
     interface to gpiod_set_array_value_cansleep() and use it across
     several drivers treewide
   - reduce the number of atomic reads of the descriptor flags in
     gpiolib debugfs code
   - simplify for_each_hwgpio_in_range() and
     for_each_requested_gpio_in_range()
   - add support for three-cell GPIO specifiers in GPIO OF code
   - don't build HTE (hardware timestamp engine) GPIO code with the HTE
     subsystem disabled in Kconfig
   - unduplicate calls to gpiod_direction_input_nonotify()
   - rework the handling of the valid_mask property of GPIO chips: don't
     allow drivers to set it as it should only be handled by GPIO core
     and start actually enforcing it in GPIO core for *all* drivers, not
     only the ones implementing a custom request() callback
   - get the `ngpios` property from the fwnode of the GPIO chip, not its
     device in order to handle multi-bank GPIO chips

  Driver improvements:
   - convert a part of the GPIO drivers under drivers/gpio/ to using the
     new value setter callbacks
   - convert several drivers to using automatic lock guards from
     cleanup.h
   - allow building gpio-bt8xx with COMPILE_TEST=y
   - refactor gpio-74x164 (use devres, cleanup helpers, __counted_by()
     and bits.h macros)
   - refactor gpio-latch (use generic device properties, lock guards and
     some local variables for better readability)
   - refactor gpio-xilinx (improve the usage of the bitmap API)
   - support multiple virtual GPIO controller instances in gpio-virtio
   - allow gpio-regmap to use the standard `ngpios` property from
     GPIOLIB
   - factor out the common code for synchronous probing of virtual GPIO
     devices into its own library
   - use str_enable_disable(), str_high_low() and other string helpers
     where applicable
   - extend the gpio-mmio abstraction layer to allow calling into the
     pinctrl back-end when setting direction
   - convert gpio-vf610 to using the gpio-mmio library
   - use more devres in gpio-adnp
   - add support for reset-gpios in gpio-pcf857x
   - add support for more models to gpio-loongson-64bit

  DT bindings:
   - add new compatibles to gpio-vf610 and gpio-loongson
   - add missing gpio-ranges property to gpio-mvebu
   - add reset-gpios to nxp,pcf8575
   - enable gpio-hog parsing in ast2400-gpio

  Misc:
   - coding style improvements
   - kerneldoc fixes
   - includes reordering
   - updates to the TODO list"

* tag 'gpio-updates-for-v6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (119 commits)
  gpio: TODO: add an item to track reworking the sysfs interface
  gpio: TODO: add an item to track the conversion to the new value setters
  gpio: TODO: add delimiters between tasks for better readability
  gpio: TODO: remove the pinctrl integration task
  gpio: TODO: remove task duplication
  gpio: TODO: remove the item about the new debugfs interface
  gpio: da9055: use new line value setter callbacks
  gpio: da9052: use new line value setter callbacks
  gpio: cs5535: use new line value setter callbacks
  gpio: crystalcove: use new line value setter callbacks
  gpio: cros-ec: use new line value setter callbacks
  gpio: creg-snps: use new line value setter callbacks
  gpio: cgbc: use new line value setter callbacks
  gpio: bt8xx: use new line value setter callbacks
  gpio: bt8xx: use lock guards
  gpio: bt8xx: allow to build the module with COMPILE_TEST=y
  gpio: bd9571mwv: use new line value setter callbacks
  gpio: bd71828: use new line value setter callbacks
  gpio: bd71815: use new line value setter callbacks
  gpio: bcm-kona: use new line value setter callbacks
  ...
2025-03-25 20:05:43 -07:00
Linus Torvalds
a50b4fe095 A treewide hrtimer timer cleanup
hrtimers are initialized with hrtimer_init() and a subsequent store to
   the callback pointer. This turned out to be suboptimal for the upcoming
   Rust integration and is obviously a silly implementation to begin with.
 
   This cleanup replaces the hrtimer_init(T); T->function = cb; sequence
   with hrtimer_setup(T, cb);
 
   The conversion was done with Coccinelle and a few manual fixups.
 
   Once the conversion has completely landed in mainline, hrtimer_init()
   will be removed and the hrtimer::function becomes a private member.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmff5jQTHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYoVvRD/wKtuwmiA66NJFgXC0qVq82A6fO3bY8
 GBdbfysDJIbqGu5PTcULTbJ8qkqv3jeLUv6CcXvS4sZ7y/uJQl2lzf8yrD/0bbwc
 rLI6sHiPSZmK93kNVN4X5H7kvt7cE/DYC9nnEOgK3BY5FgKc4n9887d4aVBhL8Lv
 ODwVXvZ+xi351YCj7qRyPU24zt/p4tkkT1o2k4a0HBluqLI0D+V20fke9IERUL8r
 d1uWKlcn0TqYDesE8HXKIhbst3gx52rMJrXBJDHwFmG6v8Pj1fkTXCVpPo8QcBz8
 OTVkpomN9f/Tx4+GZwhZOF86LhLL3OhxD6pT7JhFCXdmSGv+Ez8uyk1YZysM/XpV
 Juy/1yAcBpDIDkmhMFGdAAn48Nn9Fotty0r4je60zSEp1d/4QMXcFme29qr2JTUE
 iWnQ/HD6DxUjVHqy7CYvvo26Xegg1C7qgyOVt4PYZwAM1VKF5P3kzYTb4SAdxtop
 Tpji1sfW9QV08jqMNo6XntD32DSP9S2HqjO9LwBw700jnx2jjJ35fcJs6iodMOUn
 gckIZLMn3L0OoglPdyA5O7SNTbKE7aFiRKdnT/cJtR3Fa39Qu27CwC5gfiyuie9I
 Q+LG8GLuYSBHXAR+PBK4GWlzJ7Dn8k3eqmbnLeKpRMsU6ZzcttgA64xhaviN2wN0
 iJbvLJeisXr3GA==
 =bYAX
 -----END PGP SIGNATURE-----

Merge tag 'timers-cleanups-2025-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer cleanups from Thomas Gleixner:
 "A treewide hrtimer timer cleanup

  hrtimers are initialized with hrtimer_init() and a subsequent store to
  the callback pointer. This turned out to be suboptimal for the
  upcoming Rust integration and is obviously a silly implementation to
  begin with.

  This cleanup replaces the hrtimer_init(T); T->function = cb; sequence
  with hrtimer_setup(T, cb);

  The conversion was done with Coccinelle and a few manual fixups.

  Once the conversion has completely landed in mainline, hrtimer_init()
  will be removed and the hrtimer::function becomes a private member"

* tag 'timers-cleanups-2025-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits)
  wifi: rt2x00: Switch to use hrtimer_update_function()
  io_uring: Use helper function hrtimer_update_function()
  serial: xilinx_uartps: Use helper function hrtimer_update_function()
  ASoC: fsl: imx-pcm-fiq: Switch to use hrtimer_setup()
  RDMA: Switch to use hrtimer_setup()
  virtio: mem: Switch to use hrtimer_setup()
  drm/vmwgfx: Switch to use hrtimer_setup()
  drm/xe/oa: Switch to use hrtimer_setup()
  drm/vkms: Switch to use hrtimer_setup()
  drm/msm: Switch to use hrtimer_setup()
  drm/i915/request: Switch to use hrtimer_setup()
  drm/i915/uncore: Switch to use hrtimer_setup()
  drm/i915/pmu: Switch to use hrtimer_setup()
  drm/i915/perf: Switch to use hrtimer_setup()
  drm/i915/gvt: Switch to use hrtimer_setup()
  drm/i915/huc: Switch to use hrtimer_setup()
  drm/amdgpu: Switch to use hrtimer_setup()
  stm class: heartbeat: Switch to use hrtimer_setup()
  i2c: Switch to use hrtimer_setup()
  iio: Switch to use hrtimer_setup()
  ...
2025-03-25 10:54:15 -07:00
Andy Shevchenko
161e3bea8f leds: nic78bx: Tidy up ACPI ID table
Tidy up ACPI ID table:

- Drop ACPI_PTR() and hence replace acpi.h with mod_devicetable.h and
  other necessary headers

- Remove explicit driver_data initializer

- Drop comma in the terminator entry

With that done, extend compile test coverage.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250313161630.415515-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-21 09:49:37 +00:00
Andy Shevchenko
52fc80729b leds: mlxcpld: Remove unused ACPI header inclusion
acpi.h is not used by the driver. Remove it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250313161206.415160-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-21 09:48:11 +00:00
Abel Vesa
2528eec7da leds: rgb: leds-qcom-lpg: Fix calculation of best period Hi-Res PWMs
When determining the actual best period by looping through all
possible PWM configs, the resolution currently used is based on
bit shift value which is off-by-one above the possible maximum
PWM value allowed.

So subtract one from the resolution before determining the best
period so that the maximum duty cycle requested by the PWM user
won't result in a value above the maximum allowed by the selected
resolution.

Cc: stable@vger.kernel.org    # 6.4
Fixes: b00d2ed37617 ("leds: rgb: leds-qcom-lpg: Add support for high resolution PWM")
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Link: https://lore.kernel.org/r/20250305-leds-qcom-lpg-fix-max-pwm-on-hi-res-v4-3-bfe124a53a9f@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-21 09:21:59 +00:00
Abel Vesa
b7881eacc0 leds: rgb: leds-qcom-lpg: Fix pwm resolution max for Hi-Res PWMs
Ideally, the requested duty cycle should never translate to a PWM
value higher than the selected resolution (PWM size), but currently the
best matched period is never reported back to the PWM consumer, so the
consumer will still be using the requested period which is higher than
the best matched one. This will result in PWM consumer requesting
duty cycle values higher than the allowed PWM value.

For example, a consumer might request a period of 5ms while the best
(closest) period the PWM hardware will do is 4.26ms. For this best
matched resolution, if the selected resolution is 8-bit wide, when
the consumer asks for a duty cycle of 5ms, the PWM value will be 300,
which is outside of what the resolution allows. This will happen with
all possible resolutions when selected.

Since for these Hi-Res PWMs, the current implementation is capping the PWM
value at a 15-bit resolution, even when lower resolutions are selected,
the value will be wrapped around by the HW internal logic to the selected
resolution.

Fix the issue by capping the PWM value to the maximum value allowed by
the selected resolution.

Cc: stable@vger.kernel.org    # 6.4
Fixes: b00d2ed37617 ("leds: rgb: leds-qcom-lpg: Add support for high resolution PWM")
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Link: https://lore.kernel.org/r/20250305-leds-qcom-lpg-fix-max-pwm-on-hi-res-v4-2-bfe124a53a9f@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-21 09:21:59 +00:00
Abel Vesa
2fc21e4d6f leds: rgb: leds-qcom-lpg: Fix pwm resolution max for normal PWMs
Ideally, the requested duty cycle should never translate to a PWM
value higher than the selected resolution (PWM size), but currently the
best matched period is never reported back to the PWM consumer, so the
consumer will still be using the requested period which is higher than
the best matched one. This will result in PWM consumer requesting
duty cycle values higher than the allowed PWM value.

For example, a consumer might request a period of 5ms while the best
(closest) period the PWM hardware will do is 4.26ms. For this best
matched resolution, if the selected resolution is 9-bit wide, when
the consumer asks for a duty cycle of 5ms, the PWM value will be 600,
which is outside of what the resolution allows. Similar will happen
if the 6-bit resolution is selected.

Since for these normal PWMs (non Hi-Res), the current implementation is
capping the PWM value at a 9-bit resolution, even when the 6-bit
resolution is selected, the value will be wrapped around to 6-bit value
by the HW internal logic.

Fix the issue by capping the PWM value to the maximum value allowed by
the selected resolution.

Fixes: 7a3350495d9a ("leds: rgb: leds-qcom-lpg: Add support for 6-bit PWM resolution")
Suggested-by: Anjelique Melendez <anjelique.melendez@oss.qualcomm.com>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Link: https://lore.kernel.org/r/20250305-leds-qcom-lpg-fix-max-pwm-on-hi-res-v4-1-bfe124a53a9f@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-21 09:21:58 +00:00
Lee Jones
835a0c10d3 leds: Rename simple directory to simatic
The drivers contained in this directory are not simplistic.

Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-21 09:21:56 +00:00
Bartosz Golaszewski
496fa74622 Linux 6.14-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmfXVtUeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGN/sH/i5423Gt/z51gDjA
 s4v5Z7GaBJ9zOGBahn2RWFe72zytTqKrEJmMnGfguirs0atD1DtQj4WAP7iFKP+e
 WyO663X6HF7i5y37ja0Yd4PZc31hwtqzKH8LjBf8f8tTy8UsEVqumdi5A4sS9KTM
 qm4kTyyVEY9D/s7oRY8ywjDlRJtO6nT0aKMp4kAqNEbrNUYbilT/a0hgXcgSmPyB
 uIjmjL2fZfutxGI5LgfbaSHCa1ElmhvTvivOMpaAmZSGCRVHCKGgT0CTNnHyn/7C
 dB145JkRO4ZOUqirCdO4PE/23id3ajq9fcixJGBzAv7c45y+B3JZ1r2kAfKalE8/
 qrOKLys=
 =8r7a
 -----END PGP SIGNATURE-----

Merge tag 'v6.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into gpio/for-next

Linux 6.14-rc7
2025-03-17 08:27:10 +01:00
Manuel Fombuena
be2f92844d leds: Kconfig: leds-st1202: Add select for required LEDS_TRIGGER_PATTERN
leds-st1202 requires the LED Pattern Trigger (LEDS_TRIGGER_PATTERN), which
is not selected when LED Trigger support is (LEDS_TRIGGERS).

To reproduce this:

- make menuconfig KCONFIG_CONFIG=
- select LEDS_ST1202 dependencies OF, I2C and LEDS_CLASS.
- select LEDS_ST1202
- LEDS_TRIGGERS is selected but LEDS_TRIGGER_PATTERN isn't.

The absence of LEDS_TRIGGER_PATTERN explicitly required can lead to builds
in which LEDS_ST1202 is selected while LEDS_TRIGGER_PATTERN isn't. The direct
result of that would be that /sys/class/leds/<led>/hw_pattern wouldn't be
available and there would be no way of interacting with the driver and
hardware from user space.

Add select LEDS_TRIGGER_PATTERN to Kconfig to meet the requirement and
indirectly document it as well.

Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Link: https://lore.kernel.org/r/CWLP123MB5473F4DF3A668F7DD057A280C5C22@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-13 15:28:27 +00:00
Manuel Fombuena
5d0e4816a9 leds: leds-st1202: Spacing and proofreading editing
Minor edits regarding use of spacing and proofreading.

There is a minor inconsistency in the use of spacing as margin in
one of the comments providing details about the datasheet.

There is also a typo that comes from the datasheet itself.

Change spacing on comment and correct typo.

Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Link: https://lore.kernel.org/r/CWLP123MB547333EFFFBFFA840225BC02C5C22@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-13 15:28:26 +00:00
Manuel Fombuena
a17d9e736d leds: leds-st1202: Initialize hardware before DT node child operations
Arguably, there are more chances of errors occurring during the
initialization of the hardware, so this should complete successfully
before the devicetree node's children are initialized.

st1202_dt_init() fills the led_classdev struct.

st1202_setup() initializes the hardware. Specifically, resets the chip,
enables its phase-shift delay feature, enables the device and disables all
the LEDs channels. All that writing to registers, with no input from
st1202_dt_init().

Real-world testing corroborates that calling st1202_setup() before
st1202_dt_init() doesn't cause any issue during initialization.

Switch the order of st1202_dt_init() and st1202_setup() to ensure the
hardware is correctly initialized before the led_classdev struct is
filled.

Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Link: https://lore.kernel.org/r/CWLP123MB54731877A8DC54EDD33F0229C5C22@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM
Signed-off-by: Lee Jones <lee@kernel.org>
2025-03-13 15:28:26 +00:00
Manuel Fombuena
c72e455b89 leds: leds-st1202: Fix NULL pointer access on race condition
st1202_dt_init() calls devm_led_classdev_register_ext() before the
internal data structures are properly set up, so the LEDs become visible
to user space while being partially initialized, leading to a window
where trying to access them causes a NULL pointer access.

Move devm_led_classdev_register_ext() from DT initialization
to the end of the probe function when DT and hardware are fully
initialized and ready to interact with user space.

Fixes: 259230378c65 ("leds: Add LED1202 I2C driver")
Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Link: https://lore.kernel.org/r/CWLP123MB54732771AC0CE5491B3C84DCC5C32@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-28 09:18:37 +00:00
Yuanjun Gong
6d91124e7e leds: pwm-multicolor: Add check for fwnode_property_read_u32
Add a check to the return value of fwnode_property_read_u32()
in case it fails.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
Link: https://lore.kernel.org/r/20250223121459.2889484-1-ruc_gongyuanjun@163.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-27 17:47:50 +00:00
Anjelique Melendez
7a3350495d leds: rgb: leds-qcom-lpg: Add support for 6-bit PWM resolution
Currently, driver only allows for PWM modules to use 9-bit resolution.
However, PWM modules can support 6-bit and 9-bit resolution. Add support
for 6-bit resolution.

Suggested-by: Zejiong Huang <zejiongh@qti.qualcomm.com>
Signed-off-by: Anjelique Melendez <anjelique.melendez@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250213003533.1684131-1-anjelique.melendez@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-27 16:54:41 +00:00
Remi Pommarel
2c70953b6f leds: Fix LED_OFF brightness race
While commit fa15d8c69238 ("leds: Fix set_brightness_delayed() race")
successfully forces led_set_brightness() to be called with LED_OFF at
least once when switching from blinking to LED on state so that
hw-blinking can be disabled, another race remains. Indeed in
led_set_brightness(LED_OFF) followed by led_set_brightness(any)
scenario the following CPU scheduling can happen:

    CPU0                                     CPU1
    ----                                     ----
 set_brightness_delayed() {
   test_and_clear_bit(BRIGHTNESS_OFF)
                                         led_set_brightness(LED_OFF) {
                                           set_bit(BRIGHTNESS_OFF)
					   queue_work()
                                         }
                                         led_set_brightness(any) {
                                           set_bit(BRIGHTNESS)
					   queue_work() //already queued
                                         }
   test_and_clear_bit(BRIGHTNESS)
     /* LED set with brightness any */
 }

 /* From previous CPU1 queue_work() */
 set_brightness_delayed() {
   test_and_clear_bit(BRIGHTNESS_OFF)
     /* LED turned off */
   test_and_clear_bit(BRIGHTNESS)
     /* Clear from previous run, LED remains off */

In that case the led_set_brightness(LED_OFF)/led_set_brightness(any)
sequence will be effectively executed in reverse order and LED will
remain off.

With the introduction of commit 32360bf6a5d4 ("leds: Introduce ordered
workqueue for LEDs events instead of system_wq") the race is easier to
trigger as sysfs brightness configuration does not wait for
set_brightness_delayed() work to finish (flush_work() removal).

Use delayed_set_value to optionnally re-configure brightness after a
LED_OFF. That way a LED state could be configured more that once but
final state will always be as expected. Ensure that delayed_set_value
modification is seen before set_bit() using smp_mb__before_atomic().

Fixes: fa15d8c69238 ("leds: Fix set_brightness_delayed() race")
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/19c81177059dab7b656c42063958011a8e4d1a66.1740050412.git.repk@triplefau.lt
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-27 16:28:22 +00:00
Bartosz Golaszewski
129fdfe25a leds: aw200xx: don't use return with gpiod_set_value() variants
While gpiod_set_value() currently returns void, it will soon be converted
to return an integer instead. Don't do `return gpiod_set...`.

Cc: Lee Jones <lee@kernel.org>
Cc: Pavel Machek <pavel@kernel.org>
Cc: linux-leds@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502121512.CmoMg9Q7-lkp@intel.com/
Acked-by: Lee Jones <lee@kernel.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20250220-gpio-set-retval-v2-1-bc4cfd38dae3@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-02-26 11:17:39 +01:00
Eddie James
012825dbd5 Revert "leds-pca955x: Remove the unused function pca95xx_num_led_regs()"
This reverts commit 38bcb51f81af17a6d40fc135e565fc1fb8aa8e9d.

This function is needed by the hardware blink support just introduced.
Also rename the function to pca955x_num_led_regs() to match the rest of
the functions in the driver.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20250221155144.2109806-1-eajames@linux.ibm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-21 16:13:46 +00:00
Dzmitry Sankouski
aebb5fc9a0 leds: max77705: Add LEDs support
This adds basic support for LEDs for the max77705 PMIC.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250123-starqltechn_integration_upstream-v17-7-8b06685b6612@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-20 16:38:37 +00:00
Pei Xiao
2f372a5dce leds: st1202: Refactor st1202_led_set() to use !! operator for boolean conversion
st1202_led_set function now uses the !! operator to convert the
enum led_brightness() value to a boolean active state, which is then
passed to the st1202_channel_set() function. This change maintains the
existing functionality.

cocci warnings:
    drivers/leds/leds-st1202.c:194:66-71: WARNING: conversion to bool not needed here.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502181845.xESVrC61-lkp@intel.com/
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Link: https://lore.kernel.org/r/tencent_3DF7518D407679C99C4CCCB1B8E64638700A@qq.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-20 15:48:35 +00:00
Eddie James
575f10dc64 leds: pca955x: Add HW blink support
Support blinking using the PCA955x chip. Use PWM0 for blinking
instead of LED_HALF brightness. Since there is only one frequency
and brightness register for any blinking LED, track the blink state
of each LED and only support one HW blinking frequency. If another
frequency is requested, fallback to software blinking. In addition,
blinked LEDs can only use full brightness in order to maintain 50%
duty cycle, which is required for the specified blink rate.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20250212143038.1416501-5-eajames@linux.ibm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-20 14:29:41 +00:00
Eddie James
14ef0738a3 leds: pca955x: Optimize probe LED selection
Previously, the probe function might do up to 32 reads and writes
to the same 4 registers to program the LED selection. Reduce this to
a maximum of 5 operations by accumulating the changes to the LED
selection and comparing with the previous value to write the
selection if different.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20250212143038.1416501-4-eajames@linux.ibm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-20 14:29:13 +00:00
Eddie James
1ddab1e2de leds: pca955x: Use pointers to driver data rather than I2C client
As a minor clean up item, pass the driver data pointer instead of the
I2C client to the reader and writer helper functions. Now the PCA
driver data doesn't have to be looked up again in the I2C client data

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20250212143038.1416501-3-eajames@linux.ibm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-20 14:29:08 +00:00
Eddie James
ca3362a841 leds: pca955x: Refactor with helper functions and renaming
Add helper functions to clean up the code, and rename a few
oddly named functions and variables.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20250212143038.1416501-2-eajames@linux.ibm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-20 14:29:02 +00:00
Nam Cao
a9d0ac7396 leds: trigger: pattern: Switch to use hrtimer_setup()
hrtimer_setup() takes the callback function pointer as argument and
initializes the timer completely.

Replace hrtimer_init() and the open coded initialization of
hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://lore.kernel.org/all/76fa1cc9777a99a48f49f949abadc1c10af1bc64.1738746904.git.namcao@linutronix.de
2025-02-18 11:19:05 +01:00
Thomas Weißschuh
8168906bbb leds: st1202: Check for error code from devm_mutex_init() call
Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.

Fixes: 259230378c65 ("leds: Add LED1202 I2C driver")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20250204-must_check-devm_mutex_init-v2-1-7b6271c4b7e6@weissschuh.net
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-11 13:41:00 +00:00
Andy Shevchenko
59670b23bf leds: lp8860: Drop unneeded assignment for cache_type
REGCACHE_NONE is the default type of the cache when not provided.
Drop unneeded explicit assignment to it.

Note, it's defined to 0, and if ever be redefined, it will break
literally a lot of the drivers, so it very unlikely to happen.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250129152659.1801420-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-10 17:34:57 +00:00
Marek Vasut
c629c972b3 leds: trigger: netdev: Configure LED blink interval for HW offload
In case a PHY LED implements .blink_set callback to set LED blink
interval, call it even if .hw_control is already set, as that LED
blink interval likely controls the blink rate of that HW offloaded
LED. For PHY LEDs, that can be their activity blinking interval.

The software blinking is not affected by this change.

With this change, the LED interval setting looks something like this:
$ echo netdev > /sys/class/leds/led:green:lan/trigger
$ echo 1 > /sys/class/leds/led:green:lan/brightness
$ echo 250 > /sys/class/leds/led:green:lan/interval

Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20250120113740.91807-1-marex@denx.de
Signed-off-by: Lee Jones <lee@kernel.org>
2025-02-10 16:56:53 +00:00
Linus Torvalds
2ab002c755 Driver core and debugfs updates
Here is the big set of driver core and debugfs updates for 6.14-rc1.
 It's coming late in the merge cycle as there are a number of merge
 conflicts with your tree now, and I wanted to make sure they were
 working properly.  To resolve them, look in linux-next, and I will send
 the "fixup" patch as a response to the pull request.
 
 Included in here is a bunch of driver core, PCI, OF, and platform rust
 bindings (all acked by the different subsystem maintainers), hence the
 merge conflict with the rust tree, and some driver core api updates to
 mark things as const, which will also require some fixups due to new
 stuff coming in through other trees in this merge window.
 
 There are also a bunch of debugfs updates from Al, and there is at least
 one user that does have a regression with these, but Al is working on
 tracking down the fix for it.  In my use (and everyone else's linux-next
 use), it does not seem like a big issue at the moment.
 
 Here's a short list of the things in here:
   - driver core bindings for PCI, platform, OF, and some i/o functions.
     We are almost at the "write a real driver in rust" stage now,
     depending on what you want to do.
   - misc device rust bindings and a sample driver to show how to use
     them
   - debugfs cleanups in the fs as well as the users of the fs api for
     places where drivers got it wrong or were unnecessarily doing things
     in complex ways.
   - driver core const work, making more of the api take const * for
     different parameters to make the rust bindings easier overall.
   - other small fixes and updates
 
 All of these have been in linux-next with all of the aforementioned
 merge conflicts, and the one debugfs issue, which looks to be resolved
 "soon".
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZ5koPA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymFHACfT5acDKf2Bov2Lc/5u3vBW/R6ChsAnj+LmgVI
 hcDSPodj4szR40RRnzBd
 =u5Ey
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core and debugfs updates from Greg KH:
 "Here is the big set of driver core and debugfs updates for 6.14-rc1.

  Included in here is a bunch of driver core, PCI, OF, and platform rust
  bindings (all acked by the different subsystem maintainers), hence the
  merge conflict with the rust tree, and some driver core api updates to
  mark things as const, which will also require some fixups due to new
  stuff coming in through other trees in this merge window.

  There are also a bunch of debugfs updates from Al, and there is at
  least one user that does have a regression with these, but Al is
  working on tracking down the fix for it. In my use (and everyone
  else's linux-next use), it does not seem like a big issue at the
  moment.

  Here's a short list of the things in here:

   - driver core rust bindings for PCI, platform, OF, and some i/o
     functions.

     We are almost at the "write a real driver in rust" stage now,
     depending on what you want to do.

   - misc device rust bindings and a sample driver to show how to use
     them

   - debugfs cleanups in the fs as well as the users of the fs api for
     places where drivers got it wrong or were unnecessarily doing
     things in complex ways.

   - driver core const work, making more of the api take const * for
     different parameters to make the rust bindings easier overall.

   - other small fixes and updates

  All of these have been in linux-next with all of the aforementioned
  merge conflicts, and the one debugfs issue, which looks to be resolved
  "soon""

* tag 'driver-core-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (95 commits)
  rust: device: Use as_char_ptr() to avoid explicit cast
  rust: device: Replace CString with CStr in property_present()
  devcoredump: Constify 'struct bin_attribute'
  devcoredump: Define 'struct bin_attribute' through macro
  rust: device: Add property_present()
  saner replacement for debugfs_rename()
  orangefs-debugfs: don't mess with ->d_name
  octeontx2: don't mess with ->d_parent or ->d_parent->d_name
  arm_scmi: don't mess with ->d_parent->d_name
  slub: don't mess with ->d_name
  sof-client-ipc-flood-test: don't mess with ->d_name
  qat: don't mess with ->d_name
  xhci: don't mess with ->d_iname
  mtu3: don't mess wiht ->d_iname
  greybus/camera - stop messing with ->d_iname
  mediatek: stop messing with ->d_iname
  netdevsim: don't embed file_operations into your structs
  b43legacy: make use of debugfs_get_aux()
  b43: stop embedding struct file_operations into their objects
  carl9170: stop embedding file_operations into their objects
  ...
2025-01-28 12:25:12 -08:00
Linus Torvalds
11a7b03346 - Allow struct bin_attribute instances to be placed in read-only memory for enhanced protection.
- Fix a memory leak in the cht-wcove driver by using devm_led_classdev_register().
 - Fix an OF node reference leak in the netxbig driver.
 - Ensure PWM is disabled properly in pwm-multicolor suspend.
 - Add support for Texas Instruments LP8864, LP8864S, LP8866 LED-backlight drivers.
 - Add support for STMicroelectronics's LED1202 12-channel LED driver.
 - Convert LP8860 bindings to YAML format.
 - Add bindings for the TI LP8864/LP8866 LED drivers.
 - Add LED1202 LED controller bindings.
 - Fix path to color definitions in leds-class-multicolor.yaml.
 - Add pm660l compatible to qcom,spmi-flash-led bindings.
 - Extend cznic,turris-omnia-leds binding with interrupts property.
 - Add documentation for the STMicroelectronics LED1202 driver.
 - Add entry for AAEON UP board FPGA drivers in MAINTAINERS.
 - Fix a wrong format specifier in the ledtrig-activity driver.
 - Fix a bug in the lp8860 driver where only half of the EEPROM was written.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmePbMgACgkQUa+KL4f8
 d2EeBw//XpnS9jP+CqSe8pG9m5wvbS9B3VwsJHLWvrFYOMWCEL7Io4hPc2fd2oyG
 bwlLXQqYjruFaexyDpNgDW54DQdHS9WuWnuqvKTQMvlxjdXPGhAvdEpYaJ/avijK
 288tZem98RiR4DXTPX3O4JGXfX/2BtBCNEKJHIWJyLQps8Sat+n+lm45ipM+gpl4
 NY9Vrv26/OiNIftbpgvElNNkwhOX+DSkL2fd9ZlQZAiAsIrQ5rKY/jvxD0kJ1K7p
 8GQYWDQQCKeyPKY9IUWfByjHAjFzFwjS1ii+88Iv4RA9lYqGwoFfwKAxsRG5mtg+
 yJAAvwbus2YqiLOuOC1IPNERjCvryqzHCQnXLOPqSCunsALFsiHRGMIGHovrr4UC
 h6h/QoMsQxBpqquAFbntAzW+QWtshGoNogXrfQxmOjPQ9Nb/tdrumIeks6u+eazh
 OI/zxAyDPDLUcDFuaWptxNHUBKJRKJy3mLd8s7UoDjuW6ngdo1ZzqUHQUgu8b/aN
 K9uYxn8DoBmgAi5fvqnQaNiYpZZYu231hokyVvTI4mjPZeRh/EfFe1Kv4Y1m+tH/
 0NPLeGnm70tiDpG0XRU3yG49dPBDvw2WML7NT7jPYh41dlATz13Ix7hGN63aZF8W
 mNXRDr9y7E6A9GR260zjqHKQLQP+GomGIL+3J5DfNDNEy/axeIA=
 =7V05
 -----END PGP SIGNATURE-----

Merge tag 'leds-next-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds

Pull LED updates from Lee Jones:

 - Allow struct bin_attribute instances to be placed in read-only memory
   for enhanced protection

 - Fix a memory leak in the cht-wcove driver by using
   devm_led_classdev_register()

 - Fix an OF node reference leak in the netxbig driver

 - Ensure PWM is disabled properly in pwm-multicolor suspend

 - Add support for Texas Instruments LP8864, LP8864S, LP8866
   LED-backlight drivers

 - Add support for STMicroelectronics's LED1202 12-channel LED driver

 - Convert LP8860 bindings to YAML format

 - Add bindings for the TI LP8864/LP8866 LED drivers

 - Add LED1202 LED controller bindings

 - Fix path to color definitions in leds-class-multicolor.yaml

 - Add pm660l compatible to qcom,spmi-flash-led bindings

 - Extend cznic,turris-omnia-leds binding with interrupts property

 - Add documentation for the STMicroelectronics LED1202 driver

 - Add entry for AAEON UP board FPGA drivers in MAINTAINERS

 - Fix a wrong format specifier in the ledtrig-activity driver

 - Fix a bug in the lp8860 driver where only half of the EEPROM was
   written

* tag 'leds-next-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (28 commits)
  leds: triggers: Constify 'struct bin_attribute'
  leds: cht-wcove: Use devm_led_classdev_register() to avoid memory leak
  leds: lp8864: Add support for Texas Instruments LP8864, LP8864S, LP8866 LED-backlights
  dt-bindings: leds: Convert LP8860 into YAML format
  leds: Add LED1202 I2C driver
  dt-bindings: leds: Add LED1202 LED Controller
  Documentation:leds: Add leds-st1202.rst
  leds: pwm-multicolor: Disable PWM when going to suspend
  leds: netxbig: Fix an OF node reference leak in netxbig_leds_get_of_pdata()
  turris-omnia-mcu-interface.h: Move macro definitions outside of enums
  MAINTAINERS: Add entry for AAEON UP board FPGA drivers
  leds: Add AAEON UP board LED driver
  leds: trigger: netdev: Check offload ability on interface up
  leds: turris-omnia: Use uppercase first letter in all comments
  leds: turris-omnia: Use dev_err_probe() where appropriate
  leds: turris-omnia: Inform about missing LED gamma correction feature in the MCU driver
  platform: cznic: turris-omnia-mcu: Inform about missing LED panel brightness change interrupt feature
  leds: turris-omnia: Notify sysfs on MCU global LEDs brightness change
  leds: turris-omnia: Document driver private structures
  dt-bindings: leds: cznic,turris-omnia-leds: Allow interrupts property
  ...
2025-01-22 09:19:36 -08:00
Linus Torvalds
909fd2b89f - Fix race in device_node_get_regmap() using more extensive locking.
- Remove unused platform driver support for syscon.
 - Allow syscon nodes to be registered without a "syscon" compatible string.
 - Make `platform_data` pointer const in struct mfd_cell.
 - Revert support for multiple AXP PMICs to avoid regressions.
 - Increase SoundWire attach timeout and use gpiod_set_raw() for GPIO operation.
 - Store the result from fault_log() for use by other sub-components.
 - Fix an invalid regmap-config max_register value.
 - Add another Gemini Lake ISA bridge PCI device ID.
 - Use devm_register_power_off_handler() to simplify code.
 - Add support for QNAP microcontroller units, including LEDs, input, and hwmon.
 - Use MFD_CELL macros and remove unused code.
 - Add support for AAEON UP board FPGA.
 - Remove unused includes.
 - Fix various typos and compatibility issues in multiple bindings.
 - Add new bindings for rk3562 QoS, LED1202, and qcom,tcsr-ipq5424.
 - Convert several bindings to YAML schema.
 - Update sprd,sc2731 bindings to reference sprd,sc2731-efuse bindings directly.
 - Fix rohm,bd71815 bindings by correcting resistor values and typos.
 - Documentation improvements:
 - Add documentation for LED1202 and qnap-mcu-hwmon.
 - Adjust the file entry for the qnap-mcu header in MAINTAINERS.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmePbHkACgkQUa+KL4f8
 d2HQNw//fM3+JpyTUKjUtBl8YH0ilgZ2iKiXLHyJ6vMIqv+RfLlPAliM8f1bkEj8
 x/9kKp6ytdyAhQ/oAJW/vxRhWZVsfh9T7WSy/Q/WNChcGJ0KtUwtjWWuezdDJoyr
 6Ju4PhKHVz46cBW56u3OCbcogN8AHi1gZiAh8APwVhldUO6swaisPBvxw/4u4WMs
 HGviTLueXEptF4/actnArQ1YJ6tctY7C5tV06f6Irxn6hSz8EpGBRQ47S7Hom+mx
 aIyRLkERqhZ1FNBDfk2YERqaOyxzQRYy+PMNr6AtQ/TE+7pVBOz7xoSI3VH3k7mM
 k4u8Gau9qbnVi/pUkabgcdKOCGUYeZzXZgJT/Ttq5O9ddPE8sHMcLrxKMtUP2CBE
 6Zf0EljscGFOWise/ocNUblpy0rfXPl+wMiibxY5C+X56QkluDn2Q8ObGODt0bbR
 ACgPFL2S8m2MLEOTzBKDlSgeqoMZFKVWkqAry+yNUgIKbtM6pIdaM5ZCUhgdJ5GL
 CxGP6uw68oAUnr1lRCytgGR5XtmcIXS/Jo2u/T7cmucD3inuxQyt5TrZxma48QbL
 2+P2vmymn6ZWQb82OptrnKCMsBEXnNbWv+2BiRYoKXQt48BxIocVrsyEQIh4qGcP
 KPUB1aCxP/zJ2H7rTaK4QqM+fgOloShs5nI21v5EWSCQKvTN5ko=
 =3HQm
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull mfd updates from Lee Jones:

 - Fix race in device_node_get_regmap() using more extensive locking

 - Remove unused platform driver support for syscon

 - Allow syscon nodes to be registered without a "syscon" compatible
   string

 - Make `platform_data` pointer const in struct mfd_cell

 - Revert support for multiple AXP PMICs to avoid regressions

 - Increase SoundWire attach timeout and use gpiod_set_raw() for GPIO
   operation

 - Store the result from fault_log() for use by other sub-components

 - Fix an invalid regmap-config max_register value

 - Add another Gemini Lake ISA bridge PCI device ID

 - Use devm_register_power_off_handler() to simplify code

 - Add support for QNAP microcontroller units, including LEDs, input,
   and hwmon

 - Use MFD_CELL macros and remove unused code

 - Add support for AAEON UP board FPGA

 - Remove unused includes

 - Fix various typos and compatibility issues in multiple bindings

 - Add new bindings for rk3562 QoS, LED1202, and qcom,tcsr-ipq5424

 - Convert several bindings to YAML schema

 - Update sprd,sc2731 bindings to reference sprd,sc2731-efuse bindings
   directly

 - Fix rohm,bd71815 bindings by correcting resistor values and typos

 - Documentation improvements:
    - Add documentation for LED1202 and qnap-mcu-hwmon
    - Adjust the file entry for the qnap-mcu header in MAINTAINERS

* tag 'mfd-next-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (35 commits)
  MAINTAINERS: Adjust the file entry for the qnap-mcu header
  dt-bindings: mfd: syscon: Fix ti,j784s4-acspcie-proxy-ctrl compatible
  dt-bindings: mfd: syscon: Fix al,alpine-sysfabric-service compatible
  Revert "mfd: axp20x: Allow multiple regulators"
  dt-bindings: mfd: syscon: Add rk3562 QoS register compatible
  mfd: syscon: Allow syscon nodes without a "syscon" compatible
  mfd: syscon: Remove the platform driver support
  mfd: syscon: Fix race in device_node_get_regmap()
  dt-bindings: mfd: atmel: Convert to YAML schema
  dt-bindings: mfd: atmel,at91sam9260: Convert to YAML schema
  dt-bindings: mfd: sprd,sc2731: Reference sprd,sc2731-efuse bindings
  mfd: tps65219: Remove unused macros & add regmap.h
  mfd: tps65219: Use MFD_CELL macros
  leds: Add LED1202 I2C driver
  dt-bindings: leds: Add LED1202 LED Controller
  Documentation:leds: Add leds-st1202.rst
  mfd: Add support for AAEON UP board FPGA
  mfd: da9052: Store result from fault_log
  mfd: intel_soc_pmic_chtdc_ti: Fix invalid regmap-config max_register value
  mfd: cs42l43: Use devres for remove as well
  ...
2025-01-22 09:16:02 -08:00
Thomas Weißschuh
daefd7fbd5 leds: triggers: Constify 'struct bin_attribute'
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241222-sysfs-const-bin_attr-led-v1-1-ecc5212a31fa@weissschuh.net
Signed-off-by: Lee Jones <lee@kernel.org>
2025-01-09 11:09:09 +00:00
Joe Hattori
417cad5dc7 leds: cht-wcove: Use devm_led_classdev_register() to avoid memory leak
cht_wc_leds_probe() leaks memory when the second led_classdev_register()
call in the for-loop fails as it does not call the cleanup function
led_classdev_unregister() on the first device. Avoid this leak by
calling devm_led_classdev_register().

Fixes: 047da762b9a9 ("leds: Add Intel Cherry Trail Whiskey Cove PMIC LED driver")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20241220085346.533675-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Lee Jones <lee@kernel.org>
2025-01-09 10:57:16 +00:00
Alexander Sverdlin
e14d879292 leds: lp8864: Add support for Texas Instruments LP8864, LP8864S, LP8866 LED-backlights
Add driver for TI LP8864, LP8864S, LP8866 4/6 channel LED-backlight drivers
with I2C interface.

Link: https://www.ti.com/lit/gpn/lp8864-q1
Link: https://www.ti.com/lit/gpn/lp8864s-q1
Link: https://www.ti.com/lit/gpn/lp8866-q1
Link: https://www.ti.com/lit/gpn/lp8866s-q1
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://lore.kernel.org/r/20241218210829.73191-3-alexander.sverdlin@siemens.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-01-09 10:43:34 +00:00
Vicentiu Galanopulo
939757aafe leds: Add LED1202 I2C driver
The output current can be adjusted separately for each channel by 8-bit
analog (current sink input) and 12-bit digital (PWM) dimming control. The
LED1202 implements 12 low-side current generators with independent dimming
control.
Internal volatile memory allows the user to store up to 8 different patterns,
each pattern is a particular output configuration in terms of PWM
duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but
common to all patterns. Each device tree LED node will have a corresponding
entry in /sys/class/leds with the label name. The brightness property
corresponds to the per channel analog dimming, while the patterns[1-8] to the
PWM dimming control.

Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@remote-tech.co.uk>
Link: https://lore.kernel.org/r/20241218183401.41687-4-vicentiu.galanopulo@remote-tech.co.uk
Signed-off-by: Lee Jones <lee@kernel.org>
2025-01-09 10:30:23 +00:00
Vicentiu Galanopulo
259230378c leds: Add LED1202 I2C driver
The output current can be adjusted separately for each channel by 8-bit
analog (current sink input) and 12-bit digital (PWM) dimming control. The
LED1202 implements 12 low-side current generators with independent dimming
control.
Internal volatile memory allows the user to store up to 8 different patterns,
each pattern is a particular output configuration in terms of PWM
duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but
common to all patterns. Each device tree LED node will have a corresponding
entry in /sys/class/leds with the label name. The brightness property
corresponds to the per channel analog dimming, while the patterns[1-8] to the
PWM dimming control.

Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@remote-tech.co.uk>
Link: https://lore.kernel.org/r/20241218182001.41476-4-vicentiu.galanopulo@remote-tech.co.uk
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-23 10:14:47 +00:00
Jakob Riepler
29df7025cf leds: pwm-multicolor: Disable PWM when going to suspend
This fixes suspend on platforms like stm32mp1xx, where the PWM consumer
has to be disabled for the PWM to enter suspend.
Another positive side effect is that active-low LEDs now properly
turn off instead of going back to full brightness when they are set to 0.

Link: https://lore.kernel.org/all/20240417153846.271751-2-u.kleine-koenig@pengutronix.de/
Signed-off-by: Jakob Riepler <jakob+lkml@paranoidlabs.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20241216213754.18374-2-jakob+lkml@paranoidlabs.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-17 15:04:46 +00:00
Joe Hattori
0508316be6 leds: netxbig: Fix an OF node reference leak in netxbig_leds_get_of_pdata()
netxbig_leds_get_of_pdata() does not release the OF node obtained by
of_parse_phandle() when of_find_device_by_node() fails. Add an
of_node_put() call to fix the leak.

This bug was found by an experimental static analysis tool that I am
developing.

Fixes: 9af512e81964 ("leds: netxbig: Convert to use GPIO descriptors")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20241216074923.628509-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-17 15:01:11 +00:00
Thomas Richard
0ef2929a01 leds: Add AAEON UP board LED driver
Add support for LEDs on AAEON UP boards. These leds are managed by the
onboard FPGA:
- UP boards: yellow, green, red
- UP Squared boards: blue, yellow, green, red

Based on the work done by Gary Wang <garywang@aaeon.com.tw>, largely
rewritten.

Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20241211-aaeon-up-board-pinctrl-support-v1-2-24719be27631@bootlin.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-17 13:17:55 +00:00
Heiko Stuebner
2ec8bb4757 leds: Add driver for LEDs from qnap-mcu devices
This adds a driver that connects to the qnap-mcu mfd driver and provides
access to the LEDs on it.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20241107114712.538976-6-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-17 13:14:38 +00:00
Marek Vasut
0dfda50988 leds: trigger: netdev: Check offload ability on interface up
The trigger_data->hw_control indicates whether the LED is controlled by HW
offload, i.e. the PHY. The trigger_data->hw_control = can_hw_control() is
currently called only from netdev_led_attr_store(), i.e. when writing any
sysfs attribute of the netdev trigger instance associated with a PHY LED.

The can_hw_control() calls validate_net_dev() which internally calls
led_cdev->hw_control_get_device(), which is phy_led_hw_control_get_device()
for PHY LEDs. The phy_led_hw_control_get_device() returns NULL if the PHY
is not attached.

At least in case of DWMAC (STM32MP, iMX8M, ...), the PHY device is attached
only when the interface is brought up and is detached again when the
interface is brought down. In case e.g. udev rules configure the netdev
LED trigger sysfs attributes before the interface is brought up, then when
the interface is brought up, the LEDs are not blinking.

This is because trigger_data->hw_control = can_hw_control() was called
when udev wrote the sysfs attribute files, before the interface was up,
so can_hw_control() resp. validate_net_dev() returned false, and the
trigger_data->hw_control = can_hw_control() was never called again to
update the trigger_data->hw_control content and let the offload take
over the LED blinking.

Call data->hw_control = can_hw_control() from netdev_trig_notify() to
update the offload capability of the LED when the UP notification arrives.
This makes the LEDs blink after the interface is brought up.

On STM32MP13xx with RTL8211F, it is enough to have the following udev rule
in place, boot the machine with cable plugged in, and the LEDs won't work
without this patch once the interface is brought up, even if they should:
"
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="stmmac-0:01:green:wan", ATTR{trigger}="netdev", ATTR{link_10}="1", ATTR{link_100}="1", ATTR{link_1000}="1", ATTR{device_name}="end0"
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="stmmac-0:01:yellow:wan", ATTR{trigger}="netdev", ATTR{rx}="1", ATTR{tx}="1", ATTR{device_name}="end0"
"

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20241216104826.6946-1-marex@denx.de
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-17 13:10:48 +00:00
Marek Behún
4cc40bf45b leds: turris-omnia: Use uppercase first letter in all comments
Change first letter of 4 more comments to uppercase to make the driver
comments uniform.

Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-12-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-12 18:37:36 +00:00
Marek Behún
eda057c7c7 leds: turris-omnia: Use dev_err_probe() where appropriate
Use dev_err_probe() instead of dev_err() + separate return where
appropriate.

Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-11-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-12 18:37:36 +00:00
Marek Behún
2de889e9cf leds: turris-omnia: Inform about missing LED gamma correction feature in the MCU driver
If the LED gamma correction feature is missing in the MCU firmware,
inform about this in the MCU firmware probe function instead of LED
driver probe function, so that all the feature checks are in one place.

Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-10-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-12 18:37:36 +00:00
Marek Behún
d82e09d62b leds: turris-omnia: Notify sysfs on MCU global LEDs brightness change
Recall that on Turris Omnia, the LED controller has a global brightness
property, which allows the user to make the front LED panel dimmer.

There is also a button on the front panel, which by default is
configured so that pressing it changes the global brightness to a lower
value (unless it is at 0%, in which case pressing the button changes the
global brightness to 100%).

Newer versions of the MCU firmware support informing the SOC that the
brightness was changed by button press event via an interrupt.

Now that we have the turris-omnia-mcu driver, which adds support for MCU
interrupts, add the ability to inform the userspace (via a sysfs
notification) that the global brightness was changed.

Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-8-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-12 18:37:36 +00:00
Marek Behún
8ca5bf8ad1 leds: turris-omnia: Document driver private structures
Add documentation for driver private structures, `struct omnia_leds` and
`struct omnia_led`.

Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-7-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-12 18:37:36 +00:00
Marek Behún
5d2f88320c leds: turris-omnia: Use global header for MCU command definitions
The global turris-omnia-mcu-interface.h header file contains the
definitions for MCU commands. Drop the driver-internal definitions and
use the global ones.

Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-5-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-12 18:37:36 +00:00