mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
Merge tag 'leds-next-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones:
"New Drivers:
- Add support for MediaTek MT6370 LED Indicator
- Add support for MediaTek MT6370 Flashlight
- Add support for QCOM PMIC Flash
- Add support for Rohm BD2606MVV Charge Pump LED
New Device Support:
- Add support for PMK8550 PWM to QCOM LPG
New Functionality:
- Add support for high resolution PWM to QCOM LPG
Fix-ups:
- Kconfig 'depends' and 'select' dependency changes
- Remove unused / irrelevant includes
- Remove unnecessary checks (already performed further into the call stack)
- Trivial: Fix commentary, simplify error messages
- Rid 'defined but not used' warnings
- Provide documentation
- Explicitly provide include files
Bug Fixes:
- Mark GPIO LED as BROKEN
- Fix Kconfig entries
- Fix various Smatch staticify reports
- Fix error handling (or a lack there of)"
* tag 'leds-next-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (30 commits)
leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver
dt-bindings: leds: Add ROHM BD2606MVV LED
docs: leds: ledtrig-oneshot: Fix spelling mistake
leds: pwm-multicolor: Simplify an error message
dt-bindings: leds: Convert PCA9532 to dtschema
leds: rgb: leds-qcom-lpg: Add support for PMK8550 PWM
leds: rgb: leds-qcom-lpg: Add support for high resolution PWM
dt-bindings: leds-qcom-lpg: Add qcom,pmk8550-pwm compatible string
leds: tca6507: Fix error handling of using fwnode_property_read_string
leds: flash: Set variables mvflash_{3,4}ch_regs storage-class-specifier to static
leds: rgb: mt6370: Correct config name to select in LEDS_MT6370_RGB
MAINTAINERS: Add entry for LED devices documentation
Documentation: leds: MT6370: Use bullet lists for timing variables
Documentation: leds: mt6370: Properly wrap hw_pattern chart
Documentation: leds: Add MT6370 doc to the toctree
leds: rgb: mt6370: Fix implicit declaration for FIELD_GET
docs: leds: Add MT6370 RGB LED pattern document
leds: flash: mt6370: Add MediaTek MT6370 flashlight support
leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support
dt-bindings: leds: spmi-flash-led: Add pm6150l compatible
...
This commit is contained in:
@@ -90,22 +90,51 @@ properties:
|
||||
- heartbeat
|
||||
# LED indicates disk activity
|
||||
- disk-activity
|
||||
# LED indicates disk read activity
|
||||
- disk-read
|
||||
# LED indicates disk write activity
|
||||
- disk-write
|
||||
# LED flashes at a fixed, configurable rate
|
||||
- timer
|
||||
# LED alters the brightness for the specified duration with one software
|
||||
# timer (requires "led-pattern" property)
|
||||
- pattern
|
||||
# LED indicates mic mute state
|
||||
- audio-micmute
|
||||
# LED indicates audio mute state
|
||||
- audio-mute
|
||||
# LED indicates bluetooth power state
|
||||
- bluetooth-power
|
||||
# LED indicates activity of all CPUs
|
||||
- cpu
|
||||
# LED indicates camera flash state
|
||||
- flash
|
||||
# LED indicated keyboard capslock
|
||||
- kbd-capslock
|
||||
# LED indicates MTD memory activity
|
||||
- mtd
|
||||
# LED indicates NAND memory activity (deprecated),
|
||||
# in new implementations use "mtd"
|
||||
- nand-disk
|
||||
# No trigger assigned to the LED. This is the default mode
|
||||
# if trigger is absent
|
||||
- none
|
||||
# LED indicates camera torch state
|
||||
- torch
|
||||
# LED indicates USB gadget activity
|
||||
- usb-gadget
|
||||
# LED indicates USB host activity
|
||||
- usb-host
|
||||
# LED indicates USB port state
|
||||
- usbport
|
||||
# LED is triggered by CPU activity
|
||||
- pattern: "^cpu[0-9]*$"
|
||||
- pattern: "^hci[0-9]+-power$"
|
||||
# LED is triggered by Bluetooth activity
|
||||
- pattern: "^mmc[0-9]+$"
|
||||
- pattern: "^hci[0-9]+-power$"
|
||||
# LED is triggered by SD/MMC activity
|
||||
- pattern: "^phy[0-9]+tx$"
|
||||
- pattern: "^mmc[0-9]+$"
|
||||
# LED is triggered by WLAN activity
|
||||
- pattern: "^phy[0-9]+tx$"
|
||||
|
||||
led-pattern:
|
||||
description: |
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
*NXP - pca9532 PWM LED Driver
|
||||
|
||||
The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
|
||||
The PWM support 256 steps.
|
||||
|
||||
Required properties:
|
||||
- compatible:
|
||||
"nxp,pca9530"
|
||||
"nxp,pca9531"
|
||||
"nxp,pca9532"
|
||||
"nxp,pca9533"
|
||||
- reg - I2C slave address
|
||||
|
||||
Each led is represented as a sub-node of the nxp,pca9530.
|
||||
|
||||
Optional sub-node properties:
|
||||
- label: see Documentation/devicetree/bindings/leds/common.txt
|
||||
- type: Output configuration, see dt-bindings/leds/leds-pca9532.h (default NONE)
|
||||
- linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt
|
||||
- default-state: see Documentation/devicetree/bindings/leds/common.txt
|
||||
This property is only valid for sub-nodes of type <PCA9532_TYPE_LED>.
|
||||
|
||||
Example:
|
||||
#include <dt-bindings/leds/leds-pca9532.h>
|
||||
|
||||
leds: pca9530@60 {
|
||||
compatible = "nxp,pca9530";
|
||||
reg = <0x60>;
|
||||
|
||||
red-power {
|
||||
label = "pca:red:power";
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
};
|
||||
green-power {
|
||||
label = "pca:green:power";
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
};
|
||||
kernel-booting {
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
default-state = "on";
|
||||
};
|
||||
sys-stat {
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
default-state = "keep"; // don't touch, was set by U-Boot
|
||||
};
|
||||
};
|
||||
|
||||
For more product information please see the link below:
|
||||
http://nxp.com/documents/data_sheet/PCA9532.pdf
|
||||
@@ -27,6 +27,7 @@ properties:
|
||||
- qcom,pmc8180c-lpg
|
||||
- qcom,pmi8994-lpg
|
||||
- qcom,pmi8998-lpg
|
||||
- qcom,pmk8550-pwm
|
||||
|
||||
"#pwm-cells":
|
||||
const: 2
|
||||
|
||||
90
Documentation/devicetree/bindings/leds/nxp,pca953x.yaml
Normal file
90
Documentation/devicetree/bindings/leds/nxp,pca953x.yaml
Normal file
@@ -0,0 +1,90 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/leds/nxp,pca953x.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: NXP PCA9532 LED Dimmer
|
||||
|
||||
maintainers:
|
||||
- Riku Voipio <riku.voipio@iki.fi>
|
||||
|
||||
description: |
|
||||
The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
|
||||
The PWM support 256 steps.
|
||||
|
||||
For more product information please see the link below:
|
||||
https://www.nxp.com/docs/en/data-sheet/PCA9532.pdf
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- nxp,pca9530
|
||||
- nxp,pca9531
|
||||
- nxp,pca9532
|
||||
- nxp,pca9533
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
gpio-controller: true
|
||||
|
||||
'#gpio-cells':
|
||||
const: 2
|
||||
|
||||
patternProperties:
|
||||
"^led-[0-9a-z]+$":
|
||||
type: object
|
||||
$ref: common.yaml#
|
||||
unevaluatedProperties: false
|
||||
|
||||
properties:
|
||||
type:
|
||||
description: |
|
||||
Output configuration, see include/dt-bindings/leds/leds-pca9532.h
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
default: 0
|
||||
minimum: 0
|
||||
maximum: 4
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/leds/leds-pca9532.h>
|
||||
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
led-controller@62 {
|
||||
compatible = "nxp,pca9533";
|
||||
reg = <0x62>;
|
||||
|
||||
led-1 {
|
||||
label = "pca:red:power";
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
};
|
||||
|
||||
led-2 {
|
||||
label = "pca:green:power";
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
};
|
||||
|
||||
led-3 {
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
default-state = "on";
|
||||
};
|
||||
|
||||
led-4 {
|
||||
type = <PCA9532_TYPE_LED>;
|
||||
default-state = "keep";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
...
|
||||
117
Documentation/devicetree/bindings/leds/qcom,spmi-flash-led.yaml
Normal file
117
Documentation/devicetree/bindings/leds/qcom,spmi-flash-led.yaml
Normal file
@@ -0,0 +1,117 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/leds/qcom,spmi-flash-led.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Flash LED device inside Qualcomm Technologies, Inc. PMICs
|
||||
|
||||
maintainers:
|
||||
- Fenglin Wu <quic_fenglinw@quicinc.com>
|
||||
|
||||
description: |
|
||||
Flash LED controller is present inside some Qualcomm Technologies, Inc. PMICs.
|
||||
The flash LED module can have different number of LED channels supported
|
||||
e.g. 3 or 4. There are some different registers between them but they can
|
||||
both support maximum current up to 1.5 A per channel and they can also support
|
||||
ganging 2 channels together to supply maximum current up to 2 A. The current
|
||||
will be split symmetrically on each channel and they will be enabled and
|
||||
disabled at the same time.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
items:
|
||||
- enum:
|
||||
- qcom,pm6150l-flash-led
|
||||
- qcom,pm8150c-flash-led
|
||||
- qcom,pm8150l-flash-led
|
||||
- qcom,pm8350c-flash-led
|
||||
- const: qcom,spmi-flash-led
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
patternProperties:
|
||||
"^led-[0-3]$":
|
||||
type: object
|
||||
$ref: common.yaml#
|
||||
unevaluatedProperties: false
|
||||
description:
|
||||
Represents the physical LED components which are connected to the
|
||||
flash LED channels' output.
|
||||
|
||||
properties:
|
||||
led-sources:
|
||||
description:
|
||||
The HW indices of the flash LED channels that connect to the
|
||||
physical LED
|
||||
allOf:
|
||||
- minItems: 1
|
||||
maxItems: 2
|
||||
items:
|
||||
enum: [1, 2, 3, 4]
|
||||
|
||||
led-max-microamp:
|
||||
anyOf:
|
||||
- minimum: 5000
|
||||
maximum: 500000
|
||||
multipleOf: 5000
|
||||
- minimum: 10000
|
||||
maximum: 1000000
|
||||
multipleOf: 10000
|
||||
|
||||
flash-max-microamp:
|
||||
anyOf:
|
||||
- minimum: 12500
|
||||
maximum: 1500000
|
||||
multipleOf: 12500
|
||||
- minimum: 25000
|
||||
maximum: 2000000
|
||||
multipleOf: 25000
|
||||
|
||||
flash-max-timeout-us:
|
||||
minimum: 10000
|
||||
maximum: 1280000
|
||||
multipleOf: 10000
|
||||
|
||||
required:
|
||||
- led-sources
|
||||
- led-max-microamp
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/leds/common.h>
|
||||
spmi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
led-controller@ee00 {
|
||||
compatible = "qcom,pm8350c-flash-led", "qcom,spmi-flash-led";
|
||||
reg = <0xee00>;
|
||||
|
||||
led-0 {
|
||||
function = LED_FUNCTION_FLASH;
|
||||
color = <LED_COLOR_ID_WHITE>;
|
||||
led-sources = <1>, <4>;
|
||||
led-max-microamp = <300000>;
|
||||
flash-max-microamp = <2000000>;
|
||||
flash-max-timeout-us = <1280000>;
|
||||
function-enumerator = <0>;
|
||||
};
|
||||
|
||||
led-1 {
|
||||
function = LED_FUNCTION_FLASH;
|
||||
color = <LED_COLOR_ID_YELLOW>;
|
||||
led-sources = <2>, <3>;
|
||||
led-max-microamp = <300000>;
|
||||
flash-max-microamp = <2000000>;
|
||||
flash-max-timeout-us = <1280000>;
|
||||
function-enumerator = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
81
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml
Normal file
81
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml
Normal file
@@ -0,0 +1,81 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/leds/rohm,bd2606mvv.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: ROHM BD2606MVV LED controller
|
||||
|
||||
maintainers:
|
||||
- Andreas Kemnade <andreas@kemnade.info>
|
||||
|
||||
description:
|
||||
The BD2606 MVV is a programmable LED controller connected via I2C that can
|
||||
drive 6 separate lines. Each of them can be individually switched on and off,
|
||||
but the brightness setting is shared between pairs of them.
|
||||
|
||||
Datasheet is available at
|
||||
https://fscdn.rohm.com/en/products/databook/datasheet/ic/power/led_driver/bd2606mvv_1-e.pdf
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: rohm,bd2606mvv
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
"#address-cells":
|
||||
const: 1
|
||||
|
||||
"#size-cells":
|
||||
const: 0
|
||||
|
||||
enable-gpios:
|
||||
maxItems: 1
|
||||
description: GPIO pin to enable/disable the device.
|
||||
|
||||
patternProperties:
|
||||
"^led@[0-6]$":
|
||||
type: object
|
||||
$ref: common.yaml#
|
||||
unevaluatedProperties: false
|
||||
|
||||
properties:
|
||||
reg:
|
||||
minimum: 0
|
||||
maximum: 6
|
||||
|
||||
required:
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/leds/common.h>
|
||||
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
led-controller@66 {
|
||||
compatible = "rohm,bd2606mvv";
|
||||
reg = <0x66>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
led@0 {
|
||||
reg = <0x0>;
|
||||
color = <LED_COLOR_ID_RED>;
|
||||
function = LED_FUNCTION_POWER;
|
||||
};
|
||||
|
||||
led@2 {
|
||||
reg = <0x2>;
|
||||
color = <LED_COLOR_ID_WHITE>;
|
||||
function = LED_FUNCTION_STATUS;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
...
|
||||
@@ -25,5 +25,6 @@ LEDs
|
||||
leds-lp5562
|
||||
leds-lp55xx
|
||||
leds-mlxcpld
|
||||
leds-mt6370-rgb
|
||||
leds-sc27xx
|
||||
leds-qcom-lpg
|
||||
|
||||
64
Documentation/leds/leds-mt6370-rgb.rst
Normal file
64
Documentation/leds/leds-mt6370-rgb.rst
Normal file
@@ -0,0 +1,64 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
=========================================
|
||||
The device for Mediatek MT6370 RGB LED
|
||||
=========================================
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
The MT6370 integrates a four-channel RGB LED driver, designed to provide a
|
||||
variety of lighting effect for mobile device applications. The RGB LED devices
|
||||
includes a smart LED string controller and it can drive 3 channels of LEDs with
|
||||
a sink current up to 24mA and a CHG_VIN power good indicator LED with sink
|
||||
current up to 6mA. It provides three operation modes for RGB LEDs:
|
||||
PWM Dimming mode, breath pattern mode, and constant current mode. The device
|
||||
can increase or decrease the brightness of the RGB LED via an I2C interface.
|
||||
|
||||
The breath pattern for a channel can be programmed using the "pattern" trigger,
|
||||
using the hw_pattern attribute.
|
||||
|
||||
/sys/class/leds/<led>/hw_pattern
|
||||
--------------------------------
|
||||
|
||||
Specify a hardware breath pattern for a MT6370 RGB LED.
|
||||
|
||||
The breath pattern is a series of timing pairs, with the hold-time expressed in
|
||||
milliseconds. And the brightness is controlled by
|
||||
'/sys/class/leds/<led>/brightness'. The pattern doesn't include the brightness
|
||||
setting. Hardware pattern only controls the timing for each pattern stage
|
||||
depending on the current brightness setting.
|
||||
|
||||
Pattern diagram::
|
||||
|
||||
"0 Tr1 0 Tr2 0 Tf1 0 Tf2 0 Ton 0 Toff" --> '0' for dummy brightness code
|
||||
|
||||
^
|
||||
| ============
|
||||
| / \ /
|
||||
Icurr | / \ /
|
||||
| / \ /
|
||||
| / \ / .....repeat
|
||||
| / \ /
|
||||
| --- --- ---
|
||||
|--- --- ---
|
||||
+----------------------------------============------------> Time
|
||||
< Tr1><Tr2>< Ton ><Tf1><Tf2 >< Toff >< Tr1><Tr2>
|
||||
|
||||
Timing description:
|
||||
|
||||
* Tr1: First rising time for 0% - 30% load.
|
||||
* Tr2: Second rising time for 31% - 100% load.
|
||||
* Ton: On time for 100% load.
|
||||
* Tf1: First falling time for 100% - 31% load.
|
||||
* Tf2: Second falling time for 30% to 0% load.
|
||||
* Toff: Off time for 0% load.
|
||||
|
||||
* Tr1/Tr2/Tf1/Tf2/Ton: 125ms to 3125ms, 200ms per step.
|
||||
* Toff: 250ms to 6250ms, 400ms per step.
|
||||
|
||||
Pattern example::
|
||||
|
||||
"0 125 0 125 0 125 0 125 0 625 0 1050"
|
||||
|
||||
This Will configure Tr1/Tr2/Tf1/Tf2 to 125m, Ton to 625ms, and Toff to 1050ms.
|
||||
@@ -5,7 +5,7 @@ One-shot LED Trigger
|
||||
This is a LED trigger useful for signaling the user of an event where there are
|
||||
no clear trap points to put standard led-on and led-off settings. Using this
|
||||
trigger, the application needs only to signal the trigger when an event has
|
||||
happened, than the trigger turns the LED on and than keeps it off for a
|
||||
happened, then the trigger turns the LED on and then keeps it off for a
|
||||
specified amount of time.
|
||||
|
||||
This trigger is meant to be usable both for sporadic and dense events. In the
|
||||
|
||||
@@ -11724,6 +11724,7 @@ L: linux-leds@vger.kernel.org
|
||||
S: Maintained
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git
|
||||
F: Documentation/devicetree/bindings/leds/
|
||||
F: Documentation/leds/
|
||||
F: drivers/leds/
|
||||
F: include/dt-bindings/leds/
|
||||
F: include/linux/leds.h
|
||||
|
||||
@@ -551,6 +551,20 @@ config LEDS_REGULATOR
|
||||
help
|
||||
This option enables support for regulator driven LEDs.
|
||||
|
||||
config LEDS_BD2606MVV
|
||||
tristate "LED driver for BD2606MVV"
|
||||
depends on LEDS_CLASS
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
This option enables support for BD2606MVV LED driver chips
|
||||
accessed via the I2C bus. It supports setting brightness, with
|
||||
the limitiation that there are groups of two channels sharing
|
||||
a brightness setting, but not the on/off setting.
|
||||
|
||||
To compile this driver as a module, choose M here: the module will
|
||||
be called leds-bd2606mvv.
|
||||
|
||||
config LEDS_BD2802
|
||||
tristate "LED driver for BD2802 RGB LED"
|
||||
depends on LEDS_CLASS
|
||||
@@ -795,7 +809,7 @@ config LEDS_SPI_BYTE
|
||||
config LEDS_TI_LMU_COMMON
|
||||
tristate "LED driver for TI LMU"
|
||||
depends on LEDS_CLASS
|
||||
depends on REGMAP
|
||||
select REGMAP
|
||||
help
|
||||
Say Y to enable the LED driver for TI LMU devices.
|
||||
This supports common features between the TI LM3532, LM3631, LM3632,
|
||||
|
||||
@@ -17,6 +17,7 @@ obj-$(CONFIG_LEDS_ARIEL) += leds-ariel.o
|
||||
obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o
|
||||
obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o
|
||||
obj-$(CONFIG_LEDS_BCM6358) += leds-bcm6358.o
|
||||
obj-$(CONFIG_LEDS_BD2606MVV) += leds-bd2606mvv.o
|
||||
obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o
|
||||
obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o
|
||||
obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o
|
||||
|
||||
@@ -61,6 +61,34 @@ config LEDS_MT6360
|
||||
Independent current sources supply for each flash LED support torch
|
||||
and strobe mode.
|
||||
|
||||
config LEDS_MT6370_FLASH
|
||||
tristate "Flash LED Support for MediaTek MT6370 PMIC"
|
||||
depends on LEDS_CLASS
|
||||
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
|
||||
depends on MFD_MT6370
|
||||
help
|
||||
Support 2 channels and torch/strobe mode.
|
||||
Say Y here to enable support for
|
||||
MT6370_FLASH_LED device.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called "leds-mt6370-flash".
|
||||
|
||||
config LEDS_QCOM_FLASH
|
||||
tristate "LED support for flash module inside Qualcomm Technologies, Inc. PMIC"
|
||||
depends on MFD_SPMI_PMIC || COMPILE_TEST
|
||||
depends on LEDS_CLASS && OF
|
||||
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
|
||||
select REGMAP
|
||||
help
|
||||
This option enables support for the flash module found in Qualcomm
|
||||
Technologies, Inc. PMICs. The flash module can have 3 or 4 flash LED
|
||||
channels and each channel is programmable to support up to 1.5 A full
|
||||
scale current. It also supports connecting two channels' output together
|
||||
to supply one LED component to achieve current up to 2 A. In such case,
|
||||
the total LED current will be split symmetrically on each channel and
|
||||
they will be enabled/disabled at the same time.
|
||||
|
||||
config LEDS_RT4505
|
||||
tristate "LED support for RT4505 flashlight controller"
|
||||
depends on I2C && OF
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
obj-$(CONFIG_LEDS_MT6360) += leds-mt6360.o
|
||||
obj-$(CONFIG_LEDS_MT6370_FLASH) += leds-mt6370-flash.o
|
||||
obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
|
||||
obj-$(CONFIG_LEDS_AS3645A) += leds-as3645a.o
|
||||
obj-$(CONFIG_LEDS_KTD2692) += leds-ktd2692.o
|
||||
obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o
|
||||
obj-$(CONFIG_LEDS_MAX77693) += leds-max77693.o
|
||||
obj-$(CONFIG_LEDS_QCOM_FLASH) += leds-qcom-flash.o
|
||||
obj-$(CONFIG_LEDS_RT4505) += leds-rt4505.o
|
||||
obj-$(CONFIG_LEDS_RT8515) += leds-rt8515.o
|
||||
obj-$(CONFIG_LEDS_SGM3140) += leds-sgm3140.o
|
||||
|
||||
573
drivers/leds/flash/leds-mt6370-flash.c
Normal file
573
drivers/leds/flash/leds-mt6370-flash.c
Normal file
File diff suppressed because it is too large
Load Diff
773
drivers/leds/flash/leds-qcom-flash.c
Normal file
773
drivers/leds/flash/leds-qcom-flash.c
Normal file
File diff suppressed because it is too large
Load Diff
160
drivers/leds/leds-bd2606mvv.c
Normal file
160
drivers/leds/leds-bd2606mvv.c
Normal file
@@ -0,0 +1,160 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2023 Andreas Kemnade
|
||||
*
|
||||
* Datasheet:
|
||||
* https://fscdn.rohm.com/en/products/databook/datasheet/ic/power/led_driver/bd2606mvv_1-e.pdf
|
||||
*
|
||||
* If LED brightness cannot be controlled independently due to shared
|
||||
* brightness registers, max_brightness is set to 1 and only on/off
|
||||
* is possible for the affected LED pair.
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define BD2606_MAX_LEDS 6
|
||||
#define BD2606_MAX_BRIGHTNESS 63
|
||||
#define BD2606_REG_PWRCNT 3
|
||||
#define ldev_to_led(c) container_of(c, struct bd2606mvv_led, ldev)
|
||||
|
||||
struct bd2606mvv_led {
|
||||
unsigned int led_no;
|
||||
struct led_classdev ldev;
|
||||
struct bd2606mvv_priv *priv;
|
||||
};
|
||||
|
||||
struct bd2606mvv_priv {
|
||||
struct bd2606mvv_led leds[BD2606_MAX_LEDS];
|
||||
struct regmap *regmap;
|
||||
};
|
||||
|
||||
static int
|
||||
bd2606mvv_brightness_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct bd2606mvv_led *led = ldev_to_led(led_cdev);
|
||||
struct bd2606mvv_priv *priv = led->priv;
|
||||
int err;
|
||||
|
||||
if (brightness == 0)
|
||||
return regmap_update_bits(priv->regmap,
|
||||
BD2606_REG_PWRCNT,
|
||||
1 << led->led_no,
|
||||
0);
|
||||
|
||||
/* shared brightness register */
|
||||
err = regmap_write(priv->regmap, led->led_no / 2,
|
||||
led_cdev->max_brightness == 1 ?
|
||||
BD2606_MAX_BRIGHTNESS : brightness);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return regmap_update_bits(priv->regmap,
|
||||
BD2606_REG_PWRCNT,
|
||||
1 << led->led_no,
|
||||
1 << led->led_no);
|
||||
}
|
||||
|
||||
static const struct regmap_config bd2606mvv_regmap = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.max_register = 0x3,
|
||||
};
|
||||
|
||||
static int bd2606mvv_probe(struct i2c_client *client)
|
||||
{
|
||||
struct fwnode_handle *np, *child;
|
||||
struct device *dev = &client->dev;
|
||||
struct bd2606mvv_priv *priv;
|
||||
struct fwnode_handle *led_fwnodes[BD2606_MAX_LEDS] = { 0 };
|
||||
int active_pairs[BD2606_MAX_LEDS / 2] = { 0 };
|
||||
int err, reg;
|
||||
int i;
|
||||
|
||||
np = dev_fwnode(dev);
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->regmap = devm_regmap_init_i2c(client, &bd2606mvv_regmap);
|
||||
if (IS_ERR(priv->regmap)) {
|
||||
err = PTR_ERR(priv->regmap);
|
||||
dev_err(dev, "Failed to allocate register map: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
i2c_set_clientdata(client, priv);
|
||||
|
||||
fwnode_for_each_available_child_node(np, child) {
|
||||
struct bd2606mvv_led *led;
|
||||
|
||||
err = fwnode_property_read_u32(child, "reg", ®);
|
||||
if (err) {
|
||||
fwnode_handle_put(child);
|
||||
return err;
|
||||
}
|
||||
if (reg < 0 || reg >= BD2606_MAX_LEDS || led_fwnodes[reg]) {
|
||||
fwnode_handle_put(child);
|
||||
return -EINVAL;
|
||||
}
|
||||
led = &priv->leds[reg];
|
||||
led_fwnodes[reg] = child;
|
||||
active_pairs[reg / 2]++;
|
||||
led->priv = priv;
|
||||
led->led_no = reg;
|
||||
led->ldev.brightness_set_blocking = bd2606mvv_brightness_set;
|
||||
led->ldev.max_brightness = BD2606_MAX_BRIGHTNESS;
|
||||
}
|
||||
|
||||
for (i = 0; i < BD2606_MAX_LEDS; i++) {
|
||||
struct led_init_data init_data = {};
|
||||
|
||||
if (!led_fwnodes[i])
|
||||
continue;
|
||||
|
||||
init_data.fwnode = led_fwnodes[i];
|
||||
/* Check whether brightness can be independently adjusted. */
|
||||
if (active_pairs[i / 2] == 2)
|
||||
priv->leds[i].ldev.max_brightness = 1;
|
||||
|
||||
err = devm_led_classdev_register_ext(dev,
|
||||
&priv->leds[i].ldev,
|
||||
&init_data);
|
||||
if (err < 0) {
|
||||
fwnode_handle_put(child);
|
||||
return dev_err_probe(dev, err,
|
||||
"couldn't register LED %s\n",
|
||||
priv->leds[i].ldev.name);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id __maybe_unused of_bd2606mvv_leds_match[] = {
|
||||
{ .compatible = "rohm,bd2606mvv", },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_bd2606mvv_leds_match);
|
||||
|
||||
static struct i2c_driver bd2606mvv_driver = {
|
||||
.driver = {
|
||||
.name = "leds-bd2606mvv",
|
||||
.of_match_table = of_match_ptr(of_bd2606mvv_leds_match),
|
||||
},
|
||||
.probe_new = bd2606mvv_probe,
|
||||
};
|
||||
|
||||
module_i2c_driver(bd2606mvv_driver);
|
||||
|
||||
MODULE_AUTHOR("Andreas Kemnade <andreas@kemnade.info>");
|
||||
MODULE_DESCRIPTION("BD2606 LED driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
@@ -250,8 +249,7 @@ static int lp8860_init(struct lp8860_led *led)
|
||||
}
|
||||
}
|
||||
|
||||
if (led->enable_gpio)
|
||||
gpiod_direction_output(led->enable_gpio, 1);
|
||||
gpiod_direction_output(led->enable_gpio, 1);
|
||||
|
||||
ret = lp8860_fault_check(led);
|
||||
if (ret)
|
||||
@@ -294,8 +292,7 @@ static int lp8860_init(struct lp8860_led *led)
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
if (led->enable_gpio)
|
||||
gpiod_direction_output(led->enable_gpio, 0);
|
||||
gpiod_direction_output(led->enable_gpio, 0);
|
||||
|
||||
if (led->regulator) {
|
||||
ret = regulator_disable(led->regulator);
|
||||
@@ -449,8 +446,7 @@ static void lp8860_remove(struct i2c_client *client)
|
||||
struct lp8860_led *led = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
|
||||
if (led->enable_gpio)
|
||||
gpiod_direction_output(led->enable_gpio, 0);
|
||||
gpiod_direction_output(led->enable_gpio, 0);
|
||||
|
||||
if (led->regulator) {
|
||||
ret = regulator_disable(led->regulator);
|
||||
|
||||
@@ -691,8 +691,9 @@ tca6507_led_dt_init(struct device *dev)
|
||||
if (fwnode_property_read_string(child, "label", &led.name))
|
||||
led.name = fwnode_get_name(child);
|
||||
|
||||
fwnode_property_read_string(child, "linux,default-trigger",
|
||||
&led.default_trigger);
|
||||
if (fwnode_property_read_string(child, "linux,default-trigger",
|
||||
&led.default_trigger))
|
||||
led.default_trigger = NULL;
|
||||
|
||||
led.flags = 0;
|
||||
if (fwnode_device_is_compatible(child, "gpio"))
|
||||
|
||||
@@ -135,7 +135,7 @@ static const struct regmap_config tlc591xx_regmap = {
|
||||
.max_register = 0x1e,
|
||||
};
|
||||
|
||||
static const struct of_device_id of_tlc591xx_leds_match[] = {
|
||||
static const struct of_device_id of_tlc591xx_leds_match[] __maybe_unused = {
|
||||
{ .compatible = "ti,tlc59116",
|
||||
.data = &tlc59116 },
|
||||
{ .compatible = "ti,tlc59108",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user