devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH leds + devicetree 00/13] leds: tca6507 cleanup
@ 2020-09-19 22:15 Marek Behún
  2020-09-19 22:15 ` [PATCH leds + devicetree 03/13] dt-bindings: leds: tca6507: convert to YAML Marek Behún
  2020-09-19 22:15 ` [PATCH leds + devicetree 04/13] ARM: dts: omap3: gta04: rename LED controlled subnodes Marek Behún
  0 siblings, 2 replies; 6+ messages in thread
From: Marek Behún @ 2020-09-19 22:15 UTC (permalink / raw)
  To: linux-leds
  Cc: Pavel Machek, Dan Murphy, Marek Behún, NeilBrown,
	Linus Walleij, H . Nikolaus Schaller, Tony Lindgren, Adam Ford,
	Viresh Kumar, Rob Herring, devicetree

Hi Pavel,

this is a cleanup of tca6507 LED driver.

This series applies on your for-next, but:
- the last patch should be added only after LED core parses
  `linux,default-trigger` property
- there is DT binding change and device tree change, I am not sure
  who should apply those patches

Mainly we are getting rid of platform data, but also a potential bug is
being fixed and bindings are DT being aligned.

Marek

Cc: NeilBrown <neilb@suse.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Adam Ford <aford173@gmail.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org

Marek Behún (13):
  leds: tca6507: Absorb platform data
  leds: tca6507: use fwnode API instead of OF
  dt-bindings: leds: tca6507: convert to YAML
  ARM: dts: omap3: gta04: rename LED controlled subnodes
  leds: tca6507: do not set GPIO names
  leds: tca6507: cosmetic change: use helper variable
  leds: tca6507: register LEDs and GPIOs immediately after parsing
  leds: tca6507: remove binding comment
  leds: tca6507: use devres for LED and gpiochip registration
  leds: tca6507: let gpiolib set gpiochip's of_node
  leds: tca6507: fail on reg value conflict
  leds: tca6507: set registers to zero before LEDs/GPIOs registration
  leds: tca6507: use struct led_init_data when registering

 .../devicetree/bindings/leds/tca6507.txt      |  49 ----
 .../devicetree/bindings/leds/ti,tca6507.yaml  | 134 ++++++++++
 arch/arm/boot/dts/omap3-gta04.dtsi            |  12 +-
 drivers/leds/leds-tca6507.c                   | 234 ++++++------------
 include/linux/leds-tca6507.h                  |  21 --
 5 files changed, 217 insertions(+), 233 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/leds/tca6507.txt
 create mode 100644 Documentation/devicetree/bindings/leds/ti,tca6507.yaml
 delete mode 100644 include/linux/leds-tca6507.h


base-commit: a0e550dc351ab5fabe8ea86e45b974494a0a6bf8
-- 
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH leds + devicetree 03/13] dt-bindings: leds: tca6507: convert to YAML
  2020-09-19 22:15 [PATCH leds + devicetree 00/13] leds: tca6507 cleanup Marek Behún
@ 2020-09-19 22:15 ` Marek Behún
  2020-09-29 16:56   ` Rob Herring
  2020-09-19 22:15 ` [PATCH leds + devicetree 04/13] ARM: dts: omap3: gta04: rename LED controlled subnodes Marek Behún
  1 sibling, 1 reply; 6+ messages in thread
From: Marek Behún @ 2020-09-19 22:15 UTC (permalink / raw)
  To: linux-leds
  Cc: Pavel Machek, Dan Murphy, Marek Behún, NeilBrown,
	Linus Walleij, H . Nikolaus Schaller, Tony Lindgren, Adam Ford,
	Viresh Kumar, Rob Herring, devicetree

This converts the tca6507 LED binding to yaml.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: NeilBrown <neilb@suse.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Adam Ford <aford173@gmail.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
---
 .../devicetree/bindings/leds/tca6507.txt      |  49 -------
 .../devicetree/bindings/leds/ti,tca6507.yaml  | 134 ++++++++++++++++++
 2 files changed, 134 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/leds/tca6507.txt
 create mode 100644 Documentation/devicetree/bindings/leds/ti,tca6507.yaml

diff --git a/Documentation/devicetree/bindings/leds/tca6507.txt b/Documentation/devicetree/bindings/leds/tca6507.txt
deleted file mode 100644
index bad9102796f32..0000000000000
--- a/Documentation/devicetree/bindings/leds/tca6507.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-LEDs connected to tca6507
-
-Required properties:
-- compatible : should be : "ti,tca6507".
-- #address-cells: must be 1
-- #size-cells: must be 0
-- reg: typically 0x45.
-
-Optional properties:
-- gpio-controller: allows lines to be used as output-only GPIOs.
-- #gpio-cells: if present, must not be 0.
-
-Each led is represented as a sub-node of the ti,tca6507 device.
-
-LED sub-node properties:
-- label : (optional) see Documentation/devicetree/bindings/leds/common.txt
-- reg : number of LED line (could be from 0 to 6)
-- linux,default-trigger : (optional)
-   see Documentation/devicetree/bindings/leds/common.txt
-- compatible: either "led" (the default) or "gpio".
-
-Examples:
-
-tca6507@45 {
-	compatible = "ti,tca6507";
-	#address-cells = <1>;
-	#size-cells = <0>;
-	reg = <0x45>;
-
-	gpio-controller;
-	#gpio-cells = <2>;
-
-	led0: red-aux@0 {
-		label = "red:aux";
-		reg = <0x0>;
-	};
-
-	led1: green-aux@1 {
-		label = "green:aux";
-		reg = <0x5>;
-		linux,default-trigger = "default-on";
-	};
-
-	wifi-reset@6 {
-		reg = <0x6>;
-		compatible = "gpio";
-	};
-};
-
diff --git a/Documentation/devicetree/bindings/leds/ti,tca6507.yaml b/Documentation/devicetree/bindings/leds/ti,tca6507.yaml
new file mode 100644
index 0000000000000..94c307c987621
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/ti,tca6507.yaml
@@ -0,0 +1,134 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/ti,tca6507.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TCA6507 LED and GPIO controller
+
+maintainers:
+  - NeilBrown <neilb@suse.de>
+
+description:
+  The TCA6507 is a programmable LED controller connected via I2C that can drive
+  7 separate lines either by holding them low, or by pulsing them with modulated
+  width.
+
+properties:
+  compatible:
+    const: ti,tca6507
+
+  reg:
+    description: I2C slave address of the controller.
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-line-names: true
+
+patternProperties:
+  "^led@[0-6]$":
+    type: object
+
+    $ref: common.yaml#
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 6
+
+    required:
+      - reg
+
+  "^gpio@[0-6]$":
+    type: object
+
+    properties:
+      compatible:
+        const: gpio
+
+      reg:
+        minimum: 0
+        maximum: 6
+
+    additionalProperties: false
+
+    required:
+      - reg
+      - compatible
+
+if:
+  patternProperties:
+    "^gpio@[0-6]$":
+      properties:
+        compatible:
+          contains:
+            const: gpio
+then:
+  required:
+    - gpio-controller
+    - "#gpio-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@45 {
+            compatible = "ti,tca6507";
+            #address-cells = <1>;
+            #size-cells = <0>;
+            reg = <0x45>;
+
+            gpio-controller;
+            #gpio-cells = <2>;
+
+            gpio-line-names = "wifi_reset@6";
+
+            led@0 {
+                label = "gta04:red:aux";
+                reg = <0x0>;
+            };
+
+            led@1 {
+                label = "gta04:green:aux";
+                reg = <0x1>;
+            };
+
+            led@3 {
+                reg = <0x3>;
+                color = <LED_COLOR_ID_RED>;
+                function = LED_FUNCTION_POWER;
+                linux,default-trigger = "default-on";
+            };
+
+            led@4 {
+                color = <LED_COLOR_ID_GREEN>;
+                function = LED_FUNCTION_POWER;
+                reg = <0x4>;
+            };
+
+            gpio@6 {
+                compatible = "gpio";
+                reg = <0x6>;
+            };
+        };
+    };
+
+...
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH leds + devicetree 04/13] ARM: dts: omap3: gta04: rename LED controlled subnodes
  2020-09-19 22:15 [PATCH leds + devicetree 00/13] leds: tca6507 cleanup Marek Behún
  2020-09-19 22:15 ` [PATCH leds + devicetree 03/13] dt-bindings: leds: tca6507: convert to YAML Marek Behún
@ 2020-09-19 22:15 ` Marek Behún
  2020-09-30 17:00   ` Pavel Machek
  1 sibling, 1 reply; 6+ messages in thread
From: Marek Behún @ 2020-09-19 22:15 UTC (permalink / raw)
  To: linux-leds
  Cc: Pavel Machek, Dan Murphy, Marek Behún, NeilBrown,
	Linus Walleij, H . Nikolaus Schaller, Tony Lindgren, Adam Ford,
	Viresh Kumar, Rob Herring, devicetree

Rename LED controller subnodes to format "led@[0-6]" or "gpio@[0-6]" to
conform to the new YAML defined binding.

Use the `gpio-line-names` property to define GPIO names.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: NeilBrown <neilb@suse.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Adam Ford <aford173@gmail.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
---
 arch/arm/boot/dts/omap3-gta04.dtsi | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
index ecc45862b4f34..a28fe1b07215c 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -541,28 +541,30 @@ tca6507: tca6507@45 {
 		gpio-controller;
 		#gpio-cells = <2>;
 
-		gta04_led0: red_aux@0 {
+		gpio-line-names = "wifi_reset@6";
+
+		gta04_led0: led@0 {
 			label = "gta04:red:aux";
 			reg = <0x0>;
 		};
 
-		gta04_led1: green_aux@1 {
+		gta04_led1: led@1 {
 			label = "gta04:green:aux";
 			reg = <0x1>;
 		};
 
-		gta04_led3: red_power@3 {
+		gta04_led3: led@3 {
 			label = "gta04:red:power";
 			reg = <0x3>;
 			linux,default-trigger = "default-on";
 		};
 
-		gta04_led4: green_power@4 {
+		gta04_led4: led@4 {
 			label = "gta04:green:power";
 			reg = <0x4>;
 		};
 
-		wifi_reset: wifi_reset@6 { /* reference as <&tca_gpios 0 0> since it is currently the only GPIO */
+		wifi_reset: gpio@6 { /* reference as <&tca_gpios 0 0> since it is currently the only GPIO */
 			reg = <0x6>;
 			compatible = "gpio";
 		};
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH leds + devicetree 03/13] dt-bindings: leds: tca6507: convert to YAML
  2020-09-19 22:15 ` [PATCH leds + devicetree 03/13] dt-bindings: leds: tca6507: convert to YAML Marek Behún
@ 2020-09-29 16:56   ` Rob Herring
  2020-09-30 16:59     ` Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2020-09-29 16:56 UTC (permalink / raw)
  To: Marek Behún
  Cc: devicetree, linux-leds, Linus Walleij, H . Nikolaus Schaller,
	Tony Lindgren, Adam Ford, Viresh Kumar, NeilBrown, Dan Murphy,
	Rob Herring, Pavel Machek

On Sun, 20 Sep 2020 00:15:38 +0200, Marek Behún wrote:
> This converts the tca6507 LED binding to yaml.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Cc: NeilBrown <neilb@suse.de>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: H. Nikolaus Schaller <hns@goldelico.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Adam Ford <aford173@gmail.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> ---
>  .../devicetree/bindings/leds/tca6507.txt      |  49 -------
>  .../devicetree/bindings/leds/ti,tca6507.yaml  | 134 ++++++++++++++++++
>  2 files changed, 134 insertions(+), 49 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/leds/tca6507.txt
>  create mode 100644 Documentation/devicetree/bindings/leds/ti,tca6507.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH leds + devicetree 03/13] dt-bindings: leds: tca6507: convert to YAML
  2020-09-29 16:56   ` Rob Herring
@ 2020-09-30 16:59     ` Pavel Machek
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2020-09-30 16:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: Marek Behún, devicetree, linux-leds, Linus Walleij,
	H . Nikolaus Schaller, Tony Lindgren, Adam Ford, Viresh Kumar,
	NeilBrown, Dan Murphy, Rob Herring

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

On Tue 2020-09-29 11:56:06, Rob Herring wrote:
> On Sun, 20 Sep 2020 00:15:38 +0200, Marek Behún wrote:
> > This converts the tca6507 LED binding to yaml.
> > 
> > Signed-off-by: Marek Behún <marek.behun@nic.cz>
> > Cc: NeilBrown <neilb@suse.de>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: H. Nikolaus Schaller <hns@goldelico.com>
> > Cc: Tony Lindgren <tony@atomide.com>
> > Cc: Adam Ford <aford173@gmail.com>
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: devicetree@vger.kernel.org
> > ---
> >  .../devicetree/bindings/leds/tca6507.txt      |  49 -------
> >  .../devicetree/bindings/leds/ti,tca6507.yaml  | 134 ++++++++++++++++++
> >  2 files changed, 134 insertions(+), 49 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/leds/tca6507.txt
> >  create mode 100644 Documentation/devicetree/bindings/leds/ti,tca6507.yaml
> > 
> 
> Reviewed-by: Rob Herring <robh@kernel.org>

Thanks, applied.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH leds + devicetree 04/13] ARM: dts: omap3: gta04: rename LED controlled subnodes
  2020-09-19 22:15 ` [PATCH leds + devicetree 04/13] ARM: dts: omap3: gta04: rename LED controlled subnodes Marek Behún
@ 2020-09-30 17:00   ` Pavel Machek
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2020-09-30 17:00 UTC (permalink / raw)
  To: Marek Behún
  Cc: linux-leds, Dan Murphy, NeilBrown, Linus Walleij,
	H . Nikolaus Schaller, Tony Lindgren, Adam Ford, Viresh Kumar,
	Rob Herring, devicetree

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

On Sun 2020-09-20 00:15:39, Marek Behún wrote:
> Rename LED controller subnodes to format "led@[0-6]" or "gpio@[0-6]" to
> conform to the new YAML defined binding.
> 
> Use the `gpio-line-names` property to define GPIO names.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

Not for me, dt maintainers should take this.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-30 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 22:15 [PATCH leds + devicetree 00/13] leds: tca6507 cleanup Marek Behún
2020-09-19 22:15 ` [PATCH leds + devicetree 03/13] dt-bindings: leds: tca6507: convert to YAML Marek Behún
2020-09-29 16:56   ` Rob Herring
2020-09-30 16:59     ` Pavel Machek
2020-09-19 22:15 ` [PATCH leds + devicetree 04/13] ARM: dts: omap3: gta04: rename LED controlled subnodes Marek Behún
2020-09-30 17:00   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).