dt: bindings: lm3697: Add bindings for lm3697 driver
Subsystems (2)
PATCH v2 1/2 dt: bindings: lm3697: Add bindings for lm3697 driver
Add the device tree bindings for the lm3697
led driver for backlighting and display.
---
v2 - Fixed subject and patch commit message - https://lore.kernel.org/patchwork/patch/971326/
.../devicetree/bindings/leds/leds-lm3697.txt | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3697.txt
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +64 -0
@@ -0,0 +1,64 @@ +* Texas Instruments - LM3697 Highly Efficient White LED Driver + +The LM3697 11-bit LED driver provides high- +performance backlight dimming for 1, 2, or 3 series +LED strings while delivering up to 90% efficiency. + +This device is suitable for Display and Keypad Lighting + +Required properties: + - compatible: + "ti,lm3967" + - reg : I2C slave address + - #address-cells : 1 + - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank B + +Optional properties: + - enable-gpios : gpio pin to enable/disable the device. + - vled-supply : LED supply + +Required child properties: + - reg : 0 - LED is Controlled by bank A + 1 - LED is Controlled by bank B + +Optional child properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Example: + +led-controller@36 { + compatible = "ti,lm3967"; + reg = <0x36>; + #address-cells = <1>; + #size-cells = <0>; + + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vbatt>; + control-bank-cfg = <0>; + + led@0 { + reg = <0>; + label = "white:first_backlight_cluster"; + linux,default-trigger = "backlight"; + }; + + led@1 { + reg = <1>; + label = "white:second_backlight_cluster"; + linux,default-trigger = "frontlight"; + }; +} + +For more product information please see the link below: +http://www.ti.com/lit/ds/symlink/lm3697.pdf
Signature · 1 line
2.17.0.582.gccdcbd54c
PATCH v2 2/2 leds: lm3697: Introduce the lm3697 driver
Introduce the lm3697 LED driver for
backlighting and display.
Datasheet location:
http://www.ti.com/lit/ds/symlink/lm3697.pdf
---
v2 - Removed unneed 'of' calls in dt_parse, fixed comment, fixed checkpatch error, and change led registration - https://lore.kernel.org/patchwork/patch/971327/
drivers/leds/Kconfig | 9 + drivers/leds/Makefile | 1 + drivers/leds/leds-lm3697.c | 368 +++++++++++++++++++++++++++++++++++++ 3 files changed, 378 insertions(+) create mode 100644 drivers/leds/leds-lm3697.c
drivers/leds/Kconfig +9 -0
@@ -150,6 +150,15 @@ config LEDS_LM3642 converter plus 1.5A constant current driver for a high-current white LED. +config LEDS_LM3697 + tristate "LED support for LM3697 Chip" + depends on LEDS_CLASS && I2C + select REGMAP_I2C + help + This option enables support for LEDs connected to LM3697. + The LM3697 is an 11 bit high performance backlight driver for + keypad and display lighting. + config LEDS_LM3692X tristate "LED support for LM3692x Chips" depends on LEDS_CLASS && I2C && OF
drivers/leds/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o obj-$(CONFIG_LEDS_LM3642) += leds-lm3642.o +obj-$(CONFIG_LEDS_LM3697) += leds-lm3697.o obj-$(CONFIG_LEDS_MIKROTIK_RB532) += leds-rb532.o obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
drivers/leds/leds-lm3697.c new file +368 -0
368 lines not on this page · raw message
Signature · 1 line
2.17.0.582.gccdcbd54c
Quoted 2 lines · Dan Murphy
Add the device tree bindings for the lm3697
led driver for backlighting and display.
Hi Dan,
it seems like you missed to fix part of the subject as Jacek suggested.
I think it should be: "dt-bindings: leds: Add bindings for lm3697 driver"
Best regards,
Michal
Quoted 5 lines
Signed-off-by Dan Murphy <[email protected]>---
v2 - Fixed subject and patch commit message - https://lore.kernel.org/patchwork/patch/971326/
Hi Michal.
Thanks for the heads-up.
"dt-" prefix is indeed more preferred than "dt: ".
Dan - I will fix it by myself, no need to resend.
Best regards,
Jacek Anaszewski
Quoted 19 lines · Michal Vokáč
Quoted 2 lines · Dan Murphy
Add the device tree bindings for the lm3697
led driver for backlighting and display.Hi Dan,
it seems like you missed to fix part of the subject as Jacek suggested.I think it should be: "dt-bindings: leds: Add bindings for lm3697 driver"
Best regards,
MichalQuoted 6 lines
Signed-off-by Dan Murphy <[email protected]>---
v2 - Fixed subject and patch commit message -
https://lore.kernel.org/patchwork/patch/971326/
Quoted 31 lines · Dan Murphy
Add the device tree bindings for the lm3697
led driver for backlighting and display.Signed-off-by Dan Murphy <[email protected]>---
v2 - Fixed subject and patch commit message - https://lore.kernel.org/patchwork/patch/971326/
.../devicetree/bindings/leds/leds-lm3697.txt | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3697.txtDocumentation/devicetree/bindings/leds/leds-lm3697.txt new file +13
-0@@ -0,0 +1,64 @@ +* Texas Instruments - LM3697 Highly Efficient White LED Driver + +The LM3697 11-bit LED driver provides high- +performance backlight dimming for 1, 2, or 3 series +LED strings while delivering up to 90% efficiency. + +This device is suitable for Display and Keypad Lighting + +Required properties: + - compatible: + "ti,lm3967" + - reg : I2C slave address + - #address-cells : 1
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank B
This is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 31
Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +7
-0+Optional properties: + - enable-gpios : gpio pin to enable/disable the device. + - vled-supply : LED supply + +Required child properties: + - reg : 0 - LED is Controlled by bank A + 1 - LED is Controlled by bank B
Can we compute control-bank-cfg from this?
Quoted 19 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +19
-0+Optional child properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Example: + +led-controller@36 { + compatible = "ti,lm3967"; + reg = <0x36>; + #address-cells = <1>; + #size-cells = <0>; + + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vbatt>; + control-bank-cfg = <0>; + + led@0 { + reg = <0>;
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 61
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +10
-0+ label = "white:first_backlight_cluster"; + linux,default-trigger = "backlight"; + }; + + led@1 { + reg = <1>; + label = "white:second_backlight_cluster"; + linux,default-trigger = "frontlight"; + }; +}
Does the example show correct config? AFAICT all controls go to bank A according to control-bank-cfg, yet led@1 describes bank B...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH v2 2/2] leds: lm3697: Introduce the lm3697 driver
In reply to Dan MurphyHi!
Quoted 8 lines
Introduce the lm3697 LED driver for
backlighting and display.Datasheet location:
http://www.ti.com/lit/ds/symlink/lm3697.pdfSigned-off-by Dan Murphy <[email protected]>
drivers/leds/leds-lm3697.c line 51
Quoted 9 lines
drivers/leds/leds-lm3697.c new file +9
-0+ +#define LM3697_HVLED1_2_3_A 0 +#define LM3697_HVLED1_B_HVLED2_3_A 1 +#define LM3697_HVLED2_B_HVLED1_3_A 2 +#define LM3697_HVLED1_2_B_HVLED3_A 3 +#define LM3697_HVLED3_B_HVLED1_2_A 4 +#define LM3697_HVLED1_3_B_HVLED2_A 5 +#define LM3697_HVLED1_A_HVLED2_3_B 6 +#define LM3697_HVLED1_2_3_B 7
That's rather long and verbose way to describe a bitmap, right?
drivers/leds/leds-lm3697.c line 115
Quoted 9 lines
drivers/leds/leds-lm3697.c new file +9
-0+static const struct regmap_config lm3697_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + + .max_register =LM3697_CTRL_ENABLE , + .reg_defaults = lm3697_reg_defs, + .num_reg_defaults =ARRAY_SIZE (lm3697_reg_defs), + .cache_type =REGCACHE_RBTREE , +};
Is rbtree good idea? You don't have that many registers.
Quoted 4 lines
drivers/leds/leds-lm3697.c new file +4
-0+static int lm3697_init (struct lm3697 *priv) +{ +int ret; +
....
drivers/leds/leds-lm3697.c line 173
Quoted 1 line
drivers/leds/leds-lm3697.c new file +1
-0+regmap_write (priv->regmap,LM3697_RESET ,LM3697_SW_RESET );
No error checking required here?
Quoted 31 lines
drivers/leds/leds-lm3697.c new file +31
-0+if (priv->control_bank_config <LM3697_HVLED1_2_3_A || + priv->control_bank_config >LM3697_HVLED1_2_3_B ) { +dev_err (&priv->client->dev,"Control bank configuration is out of range\n" ); + ret = -EINVAL ; + goto out; + } + +device_for_each_child_node (priv->dev, child) { + led = &priv->leds[i]; + + ret =fwnode_property_read_u32 (child,"reg" , &led->control_bank); +if (ret) { +dev_err (&priv->client->dev,"reg DT property missing\n" ); + goto child_out; + } + +fwnode_property_read_string (child,"linux,default-trigger" , + &led->led_dev.default_trigger); + + ret =fwnode_property_read_string (child,"label" , &name); +if (ret) +snprintf (led->label,sizeof (led->label), +"%s::" , priv->client->name); +else +snprintf (led->label,sizeof (led->label), +"%s:%s" , priv->client->name, name); + + + led->priv = priv; + led->led_dev.name = led->label; + led->led_dev.brightness_set_blocking = lm3697_brightness_set;
drivers/leds/leds-lm3697.c line 262
Quoted 10 lines
drivers/leds/leds-lm3697.c new file +10
-0+ + ret =devm_led_classdev_register (priv->dev, &led->led_dev); +if (ret) { +dev_err (&priv->client->dev,"led register err: %d\n" , ret); + goto child_out; + } + +if (priv->control_bank_config ==LM3697_HVLED1_2_3_A || + priv->control_bank_config ==LM3697_HVLED1_2_3_B ) + goto child_out;
This checks if we have just one bank, I see it. Should it also check the led actually uses the correct bank?
drivers/leds/leds-lm3697.c line 269
Quoted 6 lines
drivers/leds/leds-lm3697.c new file +6
-0+ i++; +fwnode_handle_put (child); + } + +child_out: +fwnode_handle_put (child);
Is not the fwnode_handle_put() done twice for non-error case?
drivers/leds/leds-lm3697.c line 314
Quoted 6 lines
drivers/leds/leds-lm3697.c new file +6
-0+ ret =lm3697_init (led); +if (ret) +return ret; + +return ret; +}
The if is not needed here.
drivers/leds/leds-lm3697.c line 325
Quoted 10 lines
drivers/leds/leds-lm3697.c new file +10
-0+static int lm3697_remove (struct i2c_client *client) +{ +struct lm3697 *led =i2c_get_clientdata (client); +int ret; + + ret =regmap_update_bits (led->regmap,LM3697_CTRL_ENABLE , +LM3697_CTRL_A_B_EN ,0 ); +if (ret) { +dev_err (&led->client->dev,"Failed to disable regulator\n" ); +return ret;
Misleading, this does nothing with regulators.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Pavel
Thanks for the review
Quoted 37 lines · Pavel Machek
Quoted 36 lines · Dan Murphy
Add the device tree bindings for the lm3697
led driver for backlighting and display.Signed-off-by Dan Murphy <[email protected]>---
v2 - Fixed subject and patch commit message - https://lore.kernel.org/patchwork/patch/971326/
.../devicetree/bindings/leds/leds-lm3697.txt | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3697.txtDocumentation/devicetree/bindings/leds/leds-lm3697.txt new file +18
-0@@ -0,0 +1,64 @@ +* Texas Instruments - LM3697 Highly Efficient White LED Driver + +The LM3697 11-bit LED driver provides high- +performance backlight dimming for 1, 2, or 3 series +LED strings while delivering up to 90% efficiency. + +This device is suitable for Display and Keypad Lighting + +Required properties: + - compatible: + "ti,lm3967" + - reg : I2C slave address + - #address-cells : 1 + - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A
Quoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.
These values represent device level control and configuration of the LED strings to a specific control bank.
I racked my brain trying to figure out how to configure the control banks and associated LED strings. These values are for the device configuration itself and the reg below indicates which control bank the LED node is assigned to.
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 31
Quoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +7
-0+Optional properties: + - enable-gpios : gpio pin to enable/disable the device. + - vled-supply : LED supply + +Required child properties: + - reg : 0 - LED is Controlled by bank A + 1 - LED is Controlled by bank BCan we compute control-bank-cfg from this?
Don't see how you could compute this. There is no easy way to give indication to the driver which LED node belongs to which control bank. The control-bank-cfg is a device level property and the reg under the child is a LED string level property denoting the Class node to control bank mapping.
Furthermore there are 2 device configurations that can be configured to only use 1 bank for all 3 LED strings. This will be answered in your comments in the code.
Quoted 25 lines
Quoted 25 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +24
-0+Optional child properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Example: + +led-controller@36 { + compatible = "ti,lm3967"; + reg = <0x36>; + #address-cells = <1>; + #size-cells = <0>; + + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vbatt>; + control-bank-cfg = <0>; + + led@0 { + reg = <0>; + label = "white:first_backlight_cluster"; + linux,default-trigger = "backlight"; + }; + + led@1 {
Quoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 61
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ reg = <1>; + label = "white:second_backlight_cluster"; + linux,default-trigger = "frontlight"; + }; +}Does the example show correct config? AFAICT all controls go to bank A according to control-bank-cfg, yet led@1 describes bank B...
This I can fix it should be a value between 1 and 6
Quoted 3 lines
Pavel
Signature · 2 lines
------------------ Dan Murphy
Hi!
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank AQuoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.
Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 16 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 7 lines
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Dan
Quoted 2 lines
Pavel
Signature · 2 lines
------------------ Dan Murphy
Quoted 22 lines · Dan Murphy
Quoted 21 lines · Pavel Machek
Hi!
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank AQuoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.
Quoted 5 lines
Quoted 2 lines
Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Yes, and LED strings are statically assigned to banks, right?
So why not simply forget about LED strings for sake of hw abstractions, and work just with banks?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi Dan,
Quoted 22 lines · Dan Murphy
Quoted 21 lines · Pavel Machek
Hi!
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank AQuoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.
Quoted 5 lines
Quoted 2 lines
Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Just a blind shot, without going into details - could you please check if led-sources property documented in the common LED bindings couldn't help here?
Signature · 2 lines
Best regards, Jacek Anaszewski
Quoted 26 lines · Pavel Machek
Quoted 25 lines · Dan Murphy
Quoted 23 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank AQuoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
Quoted 7 lines
Quoted 2 lines
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Yes, and LED strings are statically assigned to banks, right?
So why not simply forget about LED strings for sake of hw abstractions, and work just with banks?
How would you set the control bank register for the correct LED string configuration?
Dan
Quoted 2 lines
Pavel
Signature · 2 lines
------------------ Dan Murphy
Jacek
Quoted 28 lines · Jacek Anaszewski
Hi Dan,
Quoted 25 lines · Dan Murphy
Quoted 23 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank AQuoted 8 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +5
-0+ 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
Quoted 7 lines
Quoted 2 lines
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Just a blind shot, without going into details - could you please check if led-sources property documented in the common LED bindings couldn't help here?
I could change the name to led-sources. But this part does not really follow the 1 output to a 1 LED string topology.
Signature · 2 lines
------------------ Dan Murphy
Quoted 30 lines · Dan Murphy
Quoted 29 lines · Pavel Machek
Quoted 27 lines · Dan Murphy
Quoted 16 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 7 lines
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Quoted 6 lines
Quoted 4 lines
Yes, and LED strings are statically assigned to banks, right?
So why not simply forget about LED strings for sake of hw abstractions, and work just with banks?
How would you set the control bank register for the correct LED string configuration?
Have property at each LED saying which which HVLEDs it controls?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Pavel
Quoted 31 lines · Pavel Machek
Quoted 30 lines · Dan Murphy
Quoted 29 lines · Pavel Machek
Quoted 27 lines · Dan Murphy
Quoted 16 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 7 lines
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Yes, and LED strings are statically assigned to banks, right?
So why not simply forget about LED strings for sake of hw abstractions, and work just with banks?
How would you set the control bank register for the correct LED string configuration?
Have property at each LED saying which which HVLEDs it controls?
Isn't that what I have already using the reg property?
Then we would have to aggregate the configuration and make a determination in the driver.
But that does not follow the LED child node ideology. Each output of the LED driver should have a child node.
In this case the outputs are the sinks(inputs) and there are only 2 sinks so having 3 LED child nodes would be confusing and there are required properties for each child like label.
Each child node would then need to present 1 LED node to the user space to control the LED string. Which would be technically incorrect because you would have 2 LED nodes controlling the same control bank sink.
Quoted 3 lines
Pavel
Signature · 2 lines
------------------ Dan Murphy
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Yes, and LED strings are statically assigned to banks, right?
So why not simply forget about LED strings for sake of hw abstractions, and work just with banks?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
How would you set the control bank register for the correct LED string configuration?
Have property at each LED saying which which HVLEDs it controls?
Isn't that what I have already using the reg property?
Then we would have to aggregate the configuration and make a determination in the driver.
Yes.
Quoted 5 lines
But that does not follow the LED child node ideology. Each output of the LED driver should have a child node.
In this case the outputs are the sinks(inputs) and there are only 2 sinks so having 3 LED child nodes would be confusing and there are required properties for each child like label.
No, I don't want that.
I'd like 2 child nodes, each specifying which HVLEDs it controls.
Let me edit the original proposal.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 2 lines · Dan Murphy
Add the device tree bindings for the lm3697
led driver for backlighting and display.
What I'd like to see:
Quoted 19 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +13
-0@@ -0,0 +1,64 @@ +* Texas Instruments - LM3697 Highly Efficient White LED Driver + +The LM3697 11-bit LED driver provides high- +performance backlight dimming for 1, 2, or 3 series +LED strings while delivering up to 90% efficiency. + +This device is suitable for Display and Keypad Lighting + +Required properties: + - compatible: + "ti,lm3967" + - reg : I2C slave address + - #address-cells : 1
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank B
Remove control-bank-cfg.
Documentation/devicetree/bindings/leds/leds-lm3697.txt line 31
Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +7
-0+Optional properties: + - enable-gpios : gpio pin to enable/disable the device. + - vled-supply : LED supply + +Required child properties: + - reg : 0 - LED is Controlled by bank A + 1 - LED is Controlled by bank B
Add required child property:
- hvleds = <list> -- set of outputs this child controls.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Dan,
Quoted 34 lines · Dan Murphy
Jacek
Quoted 31 lines · Jacek Anaszewski
Hi Dan,
Quoted 27 lines · Dan Murphy
Quoted 16 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 7 lines
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Quoted 7 lines
Quoted 4 lines
Just a blind shot, without going into details - could you please check if led-sources property documented in the common LED bindings couldn't help here?
I could change the name to led-sources. But this part does not really follow the 1 output to a 1 LED string topology.
led-sources was designed for describing the topology where one LED can be connected to more then one output, see bindings of max77693-led (in Documentation/devicetree/bindings/mfd/max77693.txt).
Here the topology is a bit different - more than one LED (string) can be connected to a single bank, but this is accomplished inside the chip. Logically LEDs configured that way can be treated as a single LED (string) connected to two outputs, and what follows they should be described by a single DT child node.
led-sources will fit very well for this purpose. You could do the following mapping:
0 - HVLED1
1 - HVLED2
2 - HVLED3
Then, in the child DT nodes you would use these identifiers to describe the topology:
Following node would describe strings connected to the outputs HVLED1 and HVLED2 controlled by bank A.
led@0 {
reg = <0>;
led-sources = <0>. <1>;
label = "white:first_backlight_cluster";
linux,default-trigger = "backlight";
};IOW I agree with Pavel, but I propose to use already documented common DT LED property.
Signature · 2 lines
Best regards, Jacek Anaszewski
Hi!
Quoted 42 lines
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Just a blind shot, without going into details - could you please check if led-sources property documented in the common LED bindings couldn't help here?
I could change the name to led-sources. But this part does not really follow the 1 output to a 1 LED string topology.
led-sources was designed for describing the topology where one LED can be connected to more then one output, see bindings of max77693-led (in
Documentation/devicetree/bindings/mfd/max77693.txt).Here the topology is a bit different - more than one LED (string) can be connected to a single bank, but this is accomplished inside the chip. Logically LEDs configured that way can be treated as a single LED (string) connected to two outputs, and what follows they should be described by a single DT child node.
led-sources will fit very well for this purpose. You could do the following mapping:
0 - HVLED1
1 - HVLED2
2 - HVLED3Then, in the child DT nodes you would use these identifiers to describe the topology:
Following node would describe strings connected to the outputs HVLED1 and HVLED2 controlled by bank A.
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };
Quoted 2 lines
IOW I agree with Pavel, but I propose to use already documented common DT LED property.
This is better than my proposal. Thanks!
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Jacek and Pavel
Quoted 76 lines · Jacek Anaszewski
Dan,
Quoted 34 lines · Dan Murphy
Jacek
Quoted 31 lines · Jacek Anaszewski
Hi Dan,
Quoted 27 lines · Dan Murphy
Quoted 16 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 7 lines
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Quoted 7 lines
Quoted 4 lines
Just a blind shot, without going into details - could you please check if led-sources property documented in the common LED bindings couldn't help here?
I could change the name to led-sources. But this part does not really follow the 1 output to a 1 LED string topology.
led-sources was designed for describing the topology where one LED can be connected to more then one output, see bindings of max77693-led (in
Documentation/devicetree/bindings/mfd/max77693.txt).Here the topology is a bit different - more than one LED (string) can be connected to a single bank, but this is accomplished inside the chip. Logically LEDs configured that way can be treated as a single LED (string) connected to two outputs, and what follows they should be described by a single DT child node.
led-sources will fit very well for this purpose. You could do the following mapping:
0 - HVLED1
1 - HVLED2
2 - HVLED3Then, in the child DT nodes you would use these identifiers to describe the topology:
Following node would describe strings connected to the outputs HVLED1 and HVLED2 controlled by bank A.
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };
Quoted 3 lines
IOW I agree with Pavel, but I propose to use already documented common DT LED property.
I agree to use the led-sources but I still believe this approach may be confusing to other sw devs and will lead to configuration issues by users.
This implementation requires the sw dev to know which strings are controlled by which bank. And this method may produce a misconfiguration like something below where HVLED2 is declared in both bank A and bank B
led@0 {
reg = <0>;
led-sources = <0>. <1>;
label = "white:first_backlight_cluster";
linux,default-trigger = "backlight";
};led@1 {
reg = <1>;
led-sources = <1>. <2>;
label = "white:keypad_cluster";
linux,default-trigger = "backlight";
};The driver will need to be intelligent and declare a miss configuration on the above.
Not saying this cannot be done but I am not sure why we want to add all of these extra LoC and intelligence in the kernel driver.
The driver cannot make assumptions on the intention. And the device tree documentation will need to pretty much need a lengthy explanation on how to configure the child nodes.
The implementation I suggested removes that ambiguity. It is a simple integer that is written to the device as part of the device configuration, which the config is a setting for the device.
The child nodes denote which bank the exposed LED node will control. Removing any need for the sw developers new or old to know the specific device configurations.
Dan
Signature · 2 lines
------------------ Dan Murphy
Dan,
Quoted 104 lines · Dan Murphy
Jacek and Pavel
Quoted 76 lines · Jacek Anaszewski
Dan,
Quoted 34 lines · Dan Murphy
Jacek
Quoted 31 lines · Jacek Anaszewski
Hi Dan,
Quoted 27 lines · Dan Murphy
Quoted 16 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 7 lines
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Quoted 7 lines
Quoted 4 lines
Just a blind shot, without going into details - could you please check if led-sources property documented in the common LED bindings couldn't help here?
I could change the name to led-sources. But this part does not really follow the 1 output to a 1 LED string topology.
led-sources was designed for describing the topology where one LED can be connected to more then one output, see bindings of max77693-led (in
Documentation/devicetree/bindings/mfd/max77693.txt).Here the topology is a bit different - more than one LED (string) can be connected to a single bank, but this is accomplished inside the chip. Logically LEDs configured that way can be treated as a single LED (string) connected to two outputs, and what follows they should be described by a single DT child node.
led-sources will fit very well for this purpose. You could do the following mapping:
0 - HVLED1
1 - HVLED2
2 - HVLED3Then, in the child DT nodes you would use these identifiers to describe the topology:
Following node would describe strings connected to the outputs HVLED1 and HVLED2 controlled by bank A.
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };Quoted 3 lines
IOW I agree with Pavel, but I propose to use already documented common DT LED property.
I agree to use the led-sources but I still believe this approach may be confusing to other sw devs and will lead to configuration issues by users.
This implementation requires the sw dev to know which strings are controlled by which bank. And this method may produce a misconfiguration like something below where HVLED2 is declared in both bank A and bank B
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };led@1 { reg = <1>; led-sources = <1>. <2>; label = "white:keypad_cluster"; linux,default-trigger = "backlight"; };
Quoted 3 lines
The driver will need to be intelligent and declare a miss configuration on the above.
Not saying this cannot be done but I am not sure why we want to add all of these extra LoC and intelligence in the kernel driver.
It is better do add some complexity to the driver than to the user configurable settings like DT. Besides - you will only need to check if given led-source is already taken by another node.
Quoted 2 lines
The driver cannot make assumptions on the intention. And the device tree documentation will need to pretty much need a lengthy explanation on how to configure the child nodes.
Some description will be needed for sure, but I don't expect it to be overwhelmingly lengthy.
Quoted 2 lines
The implementation I suggested removes that ambiguity. It is a simple integer that is written to the device as part of the device configuration, which the config is a setting for the device.
Your control-bank-cfg seemed like having much room for improvement, and it would for sure raise questions on why it was implemented that way. Documenting all available combinations of the configuration is seldom the best solution. It often obscures the issue.
Quoted 2 lines
The child nodes denote which bank the exposed LED node will control. Removing any need for the sw developers new or old to know the specific device configurations.
In your bindings device configuration is scattered among global control-bank-cfg property and child node's reg property.
In my proposal each child node contains all the needed configuration, also in the form of two properties - led-sources and reg. IMHO having all the LED class device related configuration in one place simplifies the analysis.
Signature · 2 lines
Best regards, Jacek Anaszewski
Quoted 107 lines · Jacek Anaszewski
Dan,
Quoted 104 lines · Dan Murphy
Jacek and Pavel
Quoted 76 lines · Jacek Anaszewski
Dan,
Quoted 34 lines · Dan Murphy
Jacek
Quoted 31 lines · Jacek Anaszewski
Hi Dan,
Quoted 27 lines · Dan Murphy
Quoted 16 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+ - #size-cells : 0 + - control-bank-cfg - : Indicates which sink is connected to which control bank + 0 - All HVLED outputs are controlled by bank A + 1 - HVLED1 is controlled bank B, HVLED2/3 are controlled by bank A + 2 - HVLED2 is controlled bank B, HVLED1/3 are controlled by bank A + 3 - HVLED1/2 are controlled by bank B, HVLED3 is controlled by bank A + 4 - HVLED3 is controlled by bank B, HVLED1/2 are controlled by bank A + 5 - HVLED1/3 is controlled by bank B, HVLED2 is controlled by bank A + 6 - (default) HVLED1 is controlled by bank A, HVLED2/3 are controlled by bank B + 7 - All HVLED outputs are controlled by bank BThis is quite long way to describe a bitmask, no? Could we make it so that control-bank-cfg is not needed?
Quoted 7 lines
Quoted 4 lines
The problem we have here is there is a potential to control
3 different LED string but only 2 sinks. So control bank A can control 2 LED strings and control bank b can control 1 LED string.Can we forget about the LED strings, and just expose the sinks as Linux LED devices?
2 sinks 3 LED strings. How do you know which LED string is which and what bank it belongs to when setting the brightness. Each Bank has a separate register for brightness control.
Quoted 7 lines
Quoted 4 lines
Just a blind shot, without going into details - could you please check if led-sources property documented in the common LED bindings couldn't help here?
I could change the name to led-sources. But this part does not really follow the 1 output to a 1 LED string topology.
led-sources was designed for describing the topology where one LED can be connected to more then one output, see bindings of max77693-led (in
Documentation/devicetree/bindings/mfd/max77693.txt).Here the topology is a bit different - more than one LED (string) can be connected to a single bank, but this is accomplished inside the chip. Logically LEDs configured that way can be treated as a single LED (string) connected to two outputs, and what follows they should be described by a single DT child node.
led-sources will fit very well for this purpose. You could do the following mapping:
0 - HVLED1
1 - HVLED2
2 - HVLED3Then, in the child DT nodes you would use these identifiers to describe the topology:
Following node would describe strings connected to the outputs HVLED1 and HVLED2 controlled by bank A.
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };Quoted 3 lines
IOW I agree with Pavel, but I propose to use already documented common DT LED property.
I agree to use the led-sources but I still believe this approach may be confusing to other sw devs and will lead to configuration issues by users.
This implementation requires the sw dev to know which strings are controlled by which bank. And this method may produce a misconfiguration like something below where HVLED2 is declared in both bank A and bank B
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };led@1 { reg = <1>; led-sources = <1>. <2>; label = "white:keypad_cluster"; linux,default-trigger = "backlight"; };
Quoted 7 lines
Quoted 3 lines
The driver will need to be intelligent and declare a miss configuration on the above.
Not saying this cannot be done but I am not sure why we want to add all of these extra LoC and intelligence in the kernel driver.It is better do add some complexity to the driver than to the user configurable settings like DT. Besides - you will only need to check if given led-source is already taken by another node.
Yes I know that the driver can check the string but if the same string is declared by another child then the driver must exit with -EINVAL. Again a lot of code for little pay off.
I believe we should keep drivers as simple as possible.
I will add the changes.
Quoted 7 lines
Quoted 3 lines
The driver cannot make assumptions on the intention. And the device tree documentation will need to pretty much need a lengthy explanation on how to configure the child nodes.
Some description will be needed for sure, but I don't expect it to be overwhelmingly lengthy.
Quoted 7 lines
Quoted 2 lines
The implementation I suggested removes that ambiguity. It is a simple integer that is written to the device as part of the device configuration, which the config is a setting for the device.
Your control-bank-cfg seemed like having much room for improvement, and it would for sure raise questions on why it was implemented that way. Documenting all available combinations of the configuration is seldom the best solution. It often obscures the issue.
Unfortunately in either case this high level of documentation will need to be done. I believe both solutions will raise questions and concerns.
There does not seem to be a good way to describe this device. Both solutions are wrought with issues and concerns.
But like I said I will re-write the code with the above suggestion.
Quoted 11 lines
Quoted 3 lines
The child nodes denote which bank the exposed LED node will control. Removing any need for the sw developers new or old to know the specific device configurations.
In your bindings device configuration is scattered among global control-bank-cfg property and child node's reg property.
In my proposal each child node contains all the needed configuration, also in the form of two properties - led-sources and reg. IMHO having all the LED class device related configuration in one place simplifies the analysis.
Dan
Signature · 2 lines
------------------ Dan Murphy
Hi!
Quoted 36 lines
Quoted 11 lines
Following node would describe strings connected to the outputs HVLED1 and HVLED2 controlled by bank A.
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };Quoted 3 lines
IOW I agree with Pavel, but I propose to use already documented common DT LED property.
I agree to use the led-sources but I still believe this approach may be confusing to other sw devs and will lead to configuration issues by users.
This implementation requires the sw dev to know which strings are controlled by which bank. And this method may produce a misconfiguration like something below where HVLED2 is declared in both bank A and bank B
led@0 { reg = <0>; led-sources = <0>. <1>; label = "white:first_backlight_cluster"; linux,default-trigger = "backlight"; };led@1 { reg = <1>; led-sources = <1>. <2>; label = "white:keypad_cluster"; linux,default-trigger = "backlight"; };
Quoted 2 lines
The driver will need to be intelligent and declare a miss configuration on the above.
Yes. But please do it that way, it is still better than being different from all the other drivers.
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH v2 2/2] leds: lm3697: Introduce the lm3697 driver
In reply to Pavel MachekPavel
Thanks for the review
Quoted 10 lines · Pavel Machek
Hi!
Quoted 7 lines
Introduce the lm3697 LED driver for
backlighting and display.Datasheet location:
http://www.ti.com/lit/ds/symlink/lm3697.pdfSigned-off-by Dan Murphy <[email protected]>
Quoted 11 lines
drivers/leds/leds-lm3697.c line 51
Quoted 9 lines
drivers/leds/leds-lm3697.c new file +9
-0+ +#define LM3697_HVLED1_2_3_A 0 +#define LM3697_HVLED1_B_HVLED2_3_A 1 +#define LM3697_HVLED2_B_HVLED1_3_A 2 +#define LM3697_HVLED1_2_B_HVLED3_A 3 +#define LM3697_HVLED3_B_HVLED1_2_A 4 +#define LM3697_HVLED1_3_B_HVLED2_A 5 +#define LM3697_HVLED1_A_HVLED2_3_B 6 +#define LM3697_HVLED1_2_3_B 7That's rather long and verbose way to describe a bitmap, right?
It will be removed with v3
Quoted 12 lines
drivers/leds/leds-lm3697.c line 115
Quoted 10 lines
drivers/leds/leds-lm3697.c new file +9
-0+static const struct regmap_config lm3697_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + + .max_register =LM3697_CTRL_ENABLE , + .reg_defaults = lm3697_reg_defs, + .num_reg_defaults =ARRAY_SIZE (lm3697_reg_defs), + .cache_type =REGCACHE_RBTREE , +};Is rbtree good idea? You don't have that many registers.
ack
Quoted 9 lines
Quoted 5 lines
drivers/leds/leds-lm3697.c new file +4
-0+static int lm3697_init (struct lm3697 *priv) +{ +int ret; +....
drivers/leds/leds-lm3697.c line 173
Quoted 1 line
drivers/leds/leds-lm3697.c new file +1
-0+regmap_write (priv->regmap,LM3697_RESET ,LM3697_SW_RESET );No error checking required here?
Ack
Quoted 37 lines
Quoted 37 lines
drivers/leds/leds-lm3697.c new file +36
-0+if (priv->control_bank_config <LM3697_HVLED1_2_3_A || + priv->control_bank_config >LM3697_HVLED1_2_3_B ) { +dev_err (&priv->client->dev,"Control bank configuration is out of range\n" ); + ret = -EINVAL ; + goto out; + } + +device_for_each_child_node (priv->dev, child) { + led = &priv->leds[i]; + + ret =fwnode_property_read_u32 (child,"reg" , &led->control_bank); +if (ret) { +dev_err (&priv->client->dev,"reg DT property missing\n" ); + goto child_out; + } + +fwnode_property_read_string (child,"linux,default-trigger" , + &led->led_dev.default_trigger); + + ret =fwnode_property_read_string (child,"label" , &name); +if (ret) +snprintf (led->label,sizeof (led->label), +"%s::" , priv->client->name); +else +snprintf (led->label,sizeof (led->label), +"%s:%s" , priv->client->name, name); + + + led->priv = priv; + led->led_dev.name = led->label; + led->led_dev.brightness_set_blocking = lm3697_brightness_set; + + ret =devm_led_classdev_register (priv->dev, &led->led_dev); +if (ret) { +dev_err (&priv->client->dev,"led register err: %d\n" , ret); + goto child_out;
Quoted 8 lines
drivers/leds/leds-lm3697.c line 262
Quoted 5 lines
drivers/leds/leds-lm3697.c new file +5
-0+ } + +if (priv->control_bank_config ==LM3697_HVLED1_2_3_A || + priv->control_bank_config ==LM3697_HVLED1_2_3_B ) + goto child_out;This checks if we have just one bank, I see it. Should it also check the led actually uses the correct bank?
It will be removed with v3
Quoted 9 lines
drivers/leds/leds-lm3697.c line 269
Quoted 7 lines
drivers/leds/leds-lm3697.c new file +6
-0+ i++; +fwnode_handle_put (child); + } + +child_out: +fwnode_handle_put (child);Is not the
fwnode_handle_put()done twice for non-error case?
Ack
Quoted 10 lines
drivers/leds/leds-lm3697.c line 314
Quoted 7 lines
drivers/leds/leds-lm3697.c new file +6
-0+ ret =lm3697_init (led); +if (ret) +return ret; + +return ret; +}The if is not needed here.
Ack
Quoted 4 lines
Quoted 4 lines
drivers/leds/leds-lm3697.c new file +4
-0+static int lm3697_remove (struct i2c_client *client) +{ +struct lm3697 *led =i2c_get_clientdata (client); +int ret;
Quoted 8 lines
drivers/leds/leds-lm3697.c line 325
Quoted 6 lines
drivers/leds/leds-lm3697.c new file +6
-0+ + ret =regmap_update_bits (led->regmap,LM3697_CTRL_ENABLE , +LM3697_CTRL_A_B_EN ,0 ); +if (ret) { +dev_err (&led->client->dev,"Failed to disable regulator\n" ); +return ret;Misleading, this does nothing with regulators.
Ack
Quoted 3 lines
Pavel
Signature · 2 lines
------------------ Dan Murphy