Skip to contentSkip to conversation

dt-bindings: Add docs for EL15203000

PATCH Superseded Oleh Kravchenko 3 participants 13 messages Jun 7, 2019 – Jul 16, 2019 6 messages not in the archive

Subsystems (2)

v2 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 dt-bindings: Add docs for EL15203000

Add documentation and example for dt-bindings EL15203000. LED board (aka RED LED board) from Crane Merchandising Systems.

---
 .../bindings/leds/leds-el15203000.txt         | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-el15203000.txt
Documentation/devicetree/bindings/leds/leds-el15203000.txt new file +53 -0
new file mode 100644
index 000000000000..457fd8d7226f
@@ -0,0 +1,53 @@
+Crane Merchandising System - el15203000 LED driver
+--------------------------------------------------
+
+This LED Board (aka RED LEDs board) is widely used in coffee vending machines
+produced by Crane Merchandising Systems.
+
+Required properties:
+- compatible : "crane,el15203000"
+- reg :
+	see Documentation/devicetree/bindings/spi/spi-bus.txt
+- spi-max-frequency : (optional)
+	see Documentation/devicetree/bindings/spi/spi-bus.txt
+
+LED sub-node properties:
+- label :
+	see Documentation/devicetree/bindings/leds/common.txt
+- linux,default-trigger : (optional)
+	see Documentation/devicetree/bindings/leds/common.txt
+- max-brightness : (optional)
+	Specify here 2 if LED has special effect. Effects by LED type:
+	- Pipe has leaking
+	- Screen Frame has blinking
+
+Example
+-------
+
+led-controller@0 {
+	compatible = "crane,el15203000";
+	reg = <0>;
+	spi-max-frequency = <50000>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	/* water pipe */
+	pipe@50 {
+		reg = <0x50>;
+		label = "red:pipe";
+		max-brightness = <2>;
+	};
+
+	/* screen frame */
+	screen@53 {
+		reg = <0x53>;
+		label = "red:screen";
+		max-brightness = <2>;
+	};
+
+	/* vending area */
+	vend@56 {
+		reg = <0x56>;
+		label = "red:vend";
+	};
+};
Signature · 1 line
2.21.0
#1 lore raw

Oleh

Quoted 21 lines · Oleh Kravchenko

Add documentation and example for dt-bindings EL15203000. LED board (aka RED LED board) from Crane Merchandising Systems.

---
  .../bindings/leds/leds-el15203000.txt         | 53 +++++++++++++++++++
  1 file changed, 53 insertions(+)

create mode 100644 Documentation/devicetree/bindings/leds/leds-el15203000.txt

Documentation/devicetree/bindings/leds/leds-el15203000.txt new file +6 -0
new file mode 100644
index 000000000000..457fd8d7226f
@@ -0,0 +1,53 @@
+Crane Merchandising System - el15203000 LED driver
+--------------------------------------------------
+
+This LED Board (aka RED LEDs board) is widely used in coffee vending machines
+produced by Crane Merchandising Systems.
+

Documentation/devicetree/bindings/leds/leds-el15203000.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-el15203000.txt new file +10 -0
+Required properties:
+- compatible : "crane,el15203000"
+- reg :
+	see Documentation/devicetree/bindings/spi/spi-bus.txt
+- spi-max-frequency : (optional)
+	see Documentation/devicetree/bindings/spi/spi-bus.txt
+
+LED sub-node properties:
+- label :
+	see Documentation/devicetree/bindings/leds/common.txt

Add this

Optional LED sub-node properties:

And remove (optional) from the below.

Documentation/devicetree/bindings/leds/leds-el15203000.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-el15203000.txt new file +4 -0
+- linux,default-trigger : (optional)
+	see Documentation/devicetree/bindings/leds/common.txt
+- max-brightness : (optional)
+	Specify here 2 if LED has special effect. Effects by LED type:

s/Specify here 2/Specify 2

But this is not really max_brightness now this is a feature and now does not make sense in this context

You may need to use something different for this property or expose a file in the driver.

Quoted 33 lines
Documentation/devicetree/bindings/leds/leds-el15203000.txt new file +33 -0
+	- Pipe has leaking
+	- Screen Frame has blinking
+
+Example
+-------
+
+led-controller@0 {
+	compatible = "crane,el15203000";
+	reg = <0>;
+	spi-max-frequency = <50000>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	/* water pipe */
+	pipe@50 {
+		reg = <0x50>;
+		label = "red:pipe";
+		max-brightness = <2>;
+	};
+
+	/* screen frame */
+	screen@53 {
+		reg = <0x53>;
+		label = "red:screen";
+		max-brightness = <2>;
+	};
+
+	/* vending area */
+	vend@56 {
+		reg = <0x56>;
+		label = "red:vend";
+	};
+};
#2 lore raw

07.06.19 23:14, Dan Murphy пише:

Quoted 7 lines

Oleh

Quoted 3 lines · Oleh Kravchenko

+LED sub-node properties:
+- label :
+    see Documentation/devicetree/bindings/leds/common.txt

Quoted 6 lines

Add this

Optional LED sub-node properties:

And remove (optional) from the below.

Done

Quoted 7 lines
Quoted 4 lines

+- linux,default-trigger : (optional)
+    see Documentation/devicetree/bindings/leds/common.txt +- max-brightness : (optional)
+    Specify here 2 if LED has special effect. Effects by LED type:

s/Specify here 2/Specify 2

Done

Quoted 5 lines

But this is not really max_brightness now this is a feature and now does not make sense in this context

You may need to use something different for this property or expose a file in the driver.

Protocol for this board define 0x32 as brightness level. This behaviur needed to keep backward compatibity.

Signature · 2 lines
Best regards,
Oleh Kravchenko
#3 lore raw

Oleh

Quoted 24 lines · Oleh Kravchenko

07.06.19 23:14, Dan Murphy пише:

Quoted 12 lines

Oleh

Quoted 3 lines · Oleh Kravchenko

+LED sub-node properties:
+- label :
+    see Documentation/devicetree/bindings/leds/common.txt

Add this

Optional LED sub-node properties:

And remove (optional) from the below.

Done

Quoted 6 lines
Quoted 4 lines

+- linux,default-trigger : (optional)
+    see Documentation/devicetree/bindings/leds/common.txt +- max-brightness : (optional)
+    Specify here 2 if LED has special effect. Effects by LED type:

s/Specify here 2/Specify 2

Done

Quoted 9 lines
Quoted 5 lines

But this is not really max_brightness now this is a feature and now does not make sense in this context

You may need to use something different for this property or expose a file in the driver.

Protocol for this board define 0x32 as brightness level. This behaviur needed to keep backward compatibity.

Backwards compatibility to what?

This is a new driver there should be no DT that has this compatible or definition.

I will let Rob ack or nack this node.

Dan

#4 lore raw

Dan,

Quoted 8 lines · Dan Murphy

Oleh
But this is not really max_brightness now this is a feature and now does not make sense in this context

Quoted 5 lines
Quoted 5 lines

You may need to use something different for this property or expose a file in the driver.

Quoted 5 lines
Quoted 4 lines

Protocol for this board define 0x32 as brightness level. This behaviur needed to keep backward compatibity.

Backwards compatibility to what?

With old/new boards.

Quoted 8 lines

This is a new driver there should be no DT that has this compatible or definition.

I will let Rob ack or nack this node.

Dan

#5 lore raw

Hi Oleh.

Quoted 11 lines · Oleh Kravchenko

Dan,

Quoted 8 lines · Dan Murphy

Oleh
But this is not really max_brightness now this is a feature and now does not make sense in this context

Quoted 5 lines
Quoted 5 lines

You may need to use something different for this property or expose a file in the driver.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Protocol for this board define 0x32 as brightness level. This behaviur needed to keep backward compatibity.

Backwards compatibility to what?

With old/new boards.

You have in your driver the following:

+ * BRIGHTNESS Can be 0x30 (OFF), 0x31 (ON).
+ * 0x32 (Effect) can be used for 0x50 (leaking) and
+ * for 0x53 (blinking)

If your max-brightness DT property is to be used for controlling this, then I don't see how it would be backward compatible with anything.

Clearly, you don't need max-brightness DT property at all.

For blinking you can use blink_set op. To be able to recommend you anoptimal solution for the effect we would need more details regarding its nature.

Quoted 9 lines
Quoted 7 lines

This is a new driver there should be no DT that has this compatible or definition.

I will let Rob ack or nack this node.

Dan

Signature · 2 lines
Best regards,
Jacek Anaszewski
#6 lore raw

Jacek,

08.06.19 00:23, Jacek Anaszewski пише:

Quoted 23 lines

Hi Oleh.

Quoted 11 lines · Oleh Kravchenko

Dan,

Quoted 8 lines · Dan Murphy

Oleh
But this is not really max_brightness now this is a feature and now does not make sense in this context

Quoted 5 lines
Quoted 5 lines

You may need to use something different for this property or expose a file in the driver.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Protocol for this board define 0x32 as brightness level. This behaviur needed to keep backward compatibity.

Backwards compatibility to what?

With old/new boards.

You have in your driver the following:

Quoted 8 lines

+ * BRIGHTNESS    Can be 0x30 (OFF), 0x31 (ON).
+ *         0x32 (Effect) can be used for 0x50 (leaking) and
+ *         for 0x53 (blinking)

If your max-brightness DT property is to be used for controlling this, then I don't see how it would be backward compatible with anything.

Clearly, you don't need max-brightness DT property at all.

What I should do with board which accept brightness in range 0x30 - 0x3a? Where 0x3a means special effect.

Quoted 4 lines

For blinking you can use blink_set op. To be able to recommend you anoptimal solution for the effect we would need more details regarding its nature.

Thanks, I will do that.
But how to properly handle other effects? Not only blinking?

And how to define it by device tree?
Driver can't get this information about what is really supported. I don't want define effect code inside DT.

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines

This is a new driver there should be no DT that has this compatible or definition.

I will let Rob ack or nack this node.

Dan

Signature · 3 lines
Best regards,
Oleh Kravchenko
Phone: +380972763224 | [email protected] | Skype: oleg_krava
#7 lore raw

Hello Jacek,

08.06.19 00:48, Oleh Kravchenko пише:

Quoted 8 lines

Jacek,

Quoted 3 lines

For blinking you can use blink_set op. To be able to recommend you anoptimal solution for the effect we would need more details regarding its nature.

Thanks, I will do that.
But how to properly handle other effects? Not only blinking?

int (*blink_set)(struct led_classdev *led_cdev,
unsigned long *delay_on, unsigned long *delay_off);

My LED board doesn't support any delay settings at all. Should I always set delay_on, delay_off to zero?

Quoted 6 lines

And how to define it by device tree?
Driver can't get this information about what is really supported. I don't want define effect code inside DT.

Quoted 1 line
Quoted 1 line
Quoted 1 line

This is a new driver there should be no DT that has this compatible or

Signature · 2 lines
Best regards,
Oleh Kravchenko

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20190611120156.GA1161@amd

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Hello Jacek,

11.06.19 22:52, Jacek Anaszewski пише:

Quoted 43 lines · Pavel Machek
Quoted 23 lines

Hi!

Quoted 21 lines
Quoted 5 lines

I just want to clerify - for now LEDs board has 2 from 3 LEDs with effect function.

1. Screen frame led is just blinking, so blink_set() is fit well to this.
2. Pipe led actually consist from 3 leds and when effect is enabled next pattern is used:

Quoted 9 lines

       ^
       |
LED1  >   OFF  ON   ON   ON
       |
LED2  >   OFF  OFF  ON   ON
       |
LED3  >   OFF  OFF  OFF  ON
       |
       +----^----^----^----^----> time

Pattern trigger applies to a single LED so it won't fit for this pattern.

Currently we don't support patterns spanning on multiple LEDs, so you would have to come up with your own solution.

Quoted 7 lines
Quoted 2 lines

What I can recommend is a trigger that would be created by your driver and would activate this sequence.

Yes, please.

While adding custom files to sysfs may appear easier, we'll need "led-specific-triggers" for other reasons.

For what reasons exactly?

This is similar to the generic hw trigger support proposed by Marek Behun. In the reply to that patch I asked some questions [0]. So far the mechanism looks too me awkward and not introducing any novelty besides requiring one more step - setting the trigger.

Quoted 4 lines

And for the record... Handling 3 LEDs as one is not something usual in the LED subsystem; I guess it makes sense in your specific case, but hopefully noone will copy that design.

Quoted 7 lines
Quoted 4 lines

(I guess they are not individually controllable?)

                                    Pavel

[0] https://www.spinics.net/lists/linux-leds/msg12269.html

I just figure out that this Pipe LED actually consist from 5 LEDs, not 3 :) And supports next level 'brightness' from SPI driver:
- '0' Off
- '1' On
- '2' Cascade (waterfall down)
-'3' InverseCascade (waterfall up)
- '4' Bounce
- '5' InverseBounce

Please advice, can I proceed with sys attribute file to set '2'..'5' levels?

Signature · 2 lines
Best regards,
Oleh Kravchenko
#15 lore raw

Hi Oleh,

Quoted 63 lines · Oleh Kravchenko

Hello Jacek,

11.06.19 22:52, Jacek Anaszewski пише:

Quoted 43 lines · Pavel Machek
Quoted 23 lines

Hi!

Quoted 21 lines
Quoted 5 lines

I just want to clerify - for now LEDs board has 2 from 3 LEDs with effect function.

1. Screen frame led is just blinking, so blink_set() is fit well to this.
2. Pipe led actually consist from 3 leds and when effect is enabled next pattern is used:

Quoted 9 lines

       ^
       |
LED1  >   OFF  ON   ON   ON
       |
LED2  >   OFF  OFF  ON   ON
       |
LED3  >   OFF  OFF  OFF  ON
       |
       +----^----^----^----^----> time

Pattern trigger applies to a single LED so it won't fit for this pattern.

Currently we don't support patterns spanning on multiple LEDs, so you would have to come up with your own solution.

Quoted 7 lines
Quoted 2 lines

What I can recommend is a trigger that would be created by your driver and would activate this sequence.

Yes, please.

While adding custom files to sysfs may appear easier, we'll need "led-specific-triggers" for other reasons.

For what reasons exactly?

This is similar to the generic hw trigger support proposed by Marek Behun. In the reply to that patch I asked some questions [0]. So far the mechanism looks too me awkward and not introducing any novelty besides requiring one more step - setting the trigger.

Quoted 4 lines

And for the record... Handling 3 LEDs as one is not something usual in the LED subsystem; I guess it makes sense in your specific case, but hopefully noone will copy that design.

Quoted 7 lines
Quoted 4 lines

(I guess they are not individually controllable?)

                                    Pavel

[0] https://www.spinics.net/lists/linux-leds/msg12269.html

I just figure out that this Pipe LED actually consist from 5 LEDs, not 3 :) And supports next level 'brightness' from SPI driver:
- '0' Off
- '1' On
- '2' Cascade (waterfall down)
-'3' InverseCascade (waterfall up)
- '4' Bounce
- '5' InverseBounce

Quoted 1 line

Please advice, can I proceed with sys attribute file to set '2'..'5' levels?

It looks like pattern trigger is the most appropriate solution for the effects 2-5. Your driver will need to implement pattern_set op for the LEDs supporting the effects, and then the effect will be enabled after writing required sequence to the hw_pattern file. You will need to come up with a sequence of values that the driver will recognize as a request of enabling given hardware effect. Please compare drivers/leds/leds-sc27xx-bltc.c and its ABI documentation [0] for reference. See also hw_pattern file description in [1].

[0] Documentation/ABI/testing/sysfs-class-led-driver-sc27xx
[1] Documentation/ABI/testing/sysfs-class-led-trigger-pattern

Signature · 2 lines
Best regards,
Jacek Anaszewski
#16 lore raw

Thank you for advice!

16.07.19 21:41, Jacek Anaszewski пише:

Quoted 26 lines

Hi Oleh,

Quoted 11 lines · Oleh Kravchenko

I just figure out that this Pipe LED actually consist from 5 LEDs, not 3 :) And supports next level 'brightness' from SPI driver:
- '0' Off
- '1' On
- '2' Cascade (waterfall down)
-'3' InverseCascade (waterfall up)
- '4' Bounce
- '5' InverseBounce

Please advice, can I proceed with sys attribute file to set '2'..'5' levels?

It looks like pattern trigger is the most appropriate solution for the effects 2-5. Your driver will need to implement pattern_set op for the LEDs supporting the effects, and then the effect will be enabled after writing required sequence to the hw_pattern file. You will need to come up with a sequence of values that the driver will recognize as a request of enabling given hardware effect. Please compare drivers/leds/leds-sc27xx-bltc.c and its ABI documentation [0] for reference. See also hw_pattern file description in [1].

[0] Documentation/ABI/testing/sysfs-class-led-driver-sc27xx
[1] Documentation/ABI/testing/sysfs-class-led-trigger-pattern

#17 lore raw
In reply to Oleh Kravchenko

Hi Oleh,

Quoted 30 lines · Oleh Kravchenko

Jacek,

08.06.19 00:23, Jacek Anaszewski пише:

Quoted 27 lines

Hi Oleh.

Quoted 11 lines · Oleh Kravchenko

Dan,

Quoted 8 lines · Dan Murphy

Oleh
But this is not really max_brightness now this is a feature and now does not make sense in this context

Quoted 5 lines
Quoted 5 lines

You may need to use something different for this property or expose a file in the driver.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Protocol for this board define 0x32 as brightness level. This behaviur needed to keep backward compatibity.

Backwards compatibility to what?

With old/new boards.

You have in your driver the following:

+ * BRIGHTNESS    Can be 0x30 (OFF), 0x31 (ON).
+ *         0x32 (Effect) can be used for 0x50 (leaking) and
+ *         for 0x53 (blinking)

Quoted 7 lines
Quoted 4 lines

If your max-brightness DT property is to be used for controlling this, then I don't see how it would be backward compatible with anything.

Clearly, you don't need max-brightness DT property at all.

What I should do with board which accept brightness in range 0x30 - 0x3a? Where 0x3a means special effect.

I believe 0x3a is a typo since above you have 0x32 for the effect.

Anyway, we shouldn't propagate hardware design flaws to the userspace interface. You have ON/OFF register values for manipulating brightness, so use them appropriately. struct led_classdev's max_brightness property should be set to 1, as already pointed out by Dan.

Quoted 6 lines
Quoted 3 lines

For blinking you can use blink_set op. To be able to recommend you anoptimal solution for the effect we would need more details regarding its nature.

Thanks, I will do that.
But how to properly handle other effects? Not only blinking?

For the effects we could probably use pattern trigger, but we need more information on how it can be configured.

Quoted 3 lines

And how to define it by device tree?
Driver can't get this information about what is really supported. I don't want define effect code inside DT.

We now have led-pattern DT property, which allows to initialize a LED with the DT provided pattern
(see Documentation/devicetree/bindings/leds/common.txt).

Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 7 lines

This is a new driver there should be no DT that has this compatible or definition.

I will let Rob ack or nack this node.

Dan

Signature · 2 lines
Best regards,
Jacek Anaszewski
#18 lore raw
In reply to Oleh Kravchenko

Oleh

Quoted 10 lines · Oleh Kravchenko

Dan,

Quoted 7 lines · Dan Murphy

Oleh
But this is not really max_brightness now this is a feature and now does not make sense in this context

Quoted 4 lines
Quoted 4 lines

You may need to use something different for this property or expose a file in the driver.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Protocol for this board define 0x32 as brightness level. This behaviur needed to keep backward compatibity.

Backwards compatibility to what?

With old/new boards.

This does not make sense.

How would a device tree entry or a file that controls the blinking have to deal with the hardware?

If it allows feature setting then you should create a bool in the device tree.

el15203000-blink;

If the board supports the feature you set this and create a file to dis/enable the feature.

If the board does not support it then no file is created.

max_brightness for this device appears to be 1.

Dan

Quoted 8 lines
Quoted 7 lines

This is a new driver there should be no DT that has this compatible or definition.

I will let Rob ack or nack this node.

Dan