Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-ltc3220.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/leds-ltc3220.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices LTC3220 LED Drivers

maintainers:
- Edelweise Escala <edelweise.escala@analog.com>

description: Bindings for the Analog Devices LTC3220 18 channel LED Drivers.

For more product information please see the link below
https://www.analog.com/en/products/ltc3220.html

properties:
compatible:
enum:
- adi,ltc3220
- adi,ltc3220-1

reg:
maxItems: 1

'#address-cells':
const: 1

'#size-cells':
const: 0

reset-gpios:
maxItems: 1
description: GPIO attached to the chip's reset pin

adi,force-cpo-mode:
$ref: /schemas/types.yaml#/definitions/uint32
description:
Force charge pump operation mode.
0 = Auto mode (default) - Automatically selects optimal charge pump mode
1 = 1.5x mode - 1.5x voltage multiplication
2 = 2x mode - 2x voltage multiplication
3 = 1x mode - Charge pump bypass
minimum: 0
maximum: 3
default: 0
Comment on lines +36 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this similar to LTC3208 force-cpo-mode ?
b087967#diff-abf16a96d0bb11e1c9ed3b93a7bf72cbd73355ea1d4c95ae5c5bf4df79fcd49dR46
Looks like it is. My suggestion is to make LTC3220 and LTC3208 have the same documentation for their charge pump properties. Also, I'd suggest making it a string like in LTC3208 PR. Sometimes we might be tempted to use integers to simplify the property description and make the value writable to device registers. Though, frequently, new devices are released with a similar feature and different values and register configurations. Leading to different (but similar in semantics) properties with specific sets of allowed values that don't do any favor to dts writers. A string will allow describing any new charge pump configuration with adi,force-cpo-mode (or adi,force-cpo-level, whatever is more comprehensive) with a reasonable property value.


adi,quick-write-enable:
type: boolean
description:
Enable quick write mode. When enabled, writing to LED D1 (register 0x01)
will update all 18 LED outputs with the same brightness value.
Comment on lines +48 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see why this needs to be in device tree. To me, this sounds more like a device runtime configuration property. What about registering a 19th led? Set led_classdev name to "all". At some point during probe, do something like

		ltc3220_state->uled_cfg[<19 or last led index>].led_cdev.name = "all";
		ltc3220_state->uled_cfg[i].led_cdev.brightness_set_blocking = ltc3220_set_all_led_data;

with ltc3220_set_all_led_data doing the same thing as ltc3220_set_led_data, but with is_quick_write always true.


patternProperties:
"(^led@([1-9]|1[0-8])$|led)":
type: object
$ref: /schemas/leds/common.yaml#
unevaluatedProperties: false
properties:
reg:
description: Output channel for the LED (1-18 maps to LED outputs D1-D18)
minimum: 1
maximum: 18
required:
- reg

required:
- compatible
- reg

additionalProperties: false

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

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

led-controller@1c {
compatible = "adi,ltc3220";
reg = <0x1c>;
#address-cells = <1>;
#size-cells = <0>;
reset-gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
adi,force-cpo-mode = <0>;
adi,quick-write-enable;

led@1 {
reg = <1>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <1>;
};

led@2 {
reg = <2>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <2>;
};

led@3 {
reg = <3>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <3>;
};

led@4 {
reg = <4>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <4>;
};

led@5 {
reg = <5>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <5>;
};

led@6 {
reg = <6>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <6>;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have some of the properties coming from common.yaml that the device supports. Otherwise I wonder why we $ref it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added function and function-enumerator.

};
};

...
1 change: 1 addition & 0 deletions Kconfig.adi
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

# This file exists solely to be include in the main Kconfig

Expand Down Expand Up @@ -71,6 +71,7 @@
imply PMIC_ADP5520
imply PWM_AXI_PWMGEN
imply LEDS_ADP5520
imply LEDS_LTC3220
imply BACKLIGHT_ADP5520
imply BACKLIGHT_ADP8860
imply BACKLIGHT_ADP8870
Expand Down
10 changes: 10 additions & 0 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
config LEDS_GPIO_REGISTER
bool
Expand Down Expand Up @@ -931,6 +931,16 @@
Say Y to enable the LM36274 LED driver for TI LMU devices.
This supports the LED device LM36274.

config LEDS_LTC3220
tristate "LED Driver for LTC3220/LTC3220-1"
depends on I2C && LEDS_CLASS
help
If you have an 18-Channel LED Driver connected to LTC3220, or LTC3220-1
say Y here to enable this driver.

To compile this driver as a module, choose M here: the module will
be called ltc3220.

config LEDS_TPS6105X
tristate "LED support for TI TPS6105X"
depends on LEDS_CLASS
Expand Down
1 change: 1 addition & 0 deletions drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ obj-$(CONFIG_LEDS_LP8501) += leds-lp8501.o
obj-$(CONFIG_LEDS_LP8788) += leds-lp8788.o
obj-$(CONFIG_LEDS_LP8860) += leds-lp8860.o
obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o
obj-$(CONFIG_LEDS_LTC3220) += leds-ltc3220.o
obj-$(CONFIG_LEDS_MAX5970) += leds-max5970.o
obj-$(CONFIG_LEDS_MAX77650) += leds-max77650.o
obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
Expand Down
Loading
Loading