[RFC/PATCH] backlight: hx8357: prepare to conversion to gpiod API

Dmitry Torokhov dmitry.torokhov at gmail.com
Tue Sep 27 15:32:35 PDT 2022


Properties describing GPIOs should be named as "<property>-gpios" or
"<property>-gpio", and that is what gpiod API expects, however the
driver uses non-standard "gpios-reset" name. Let's adjust this, and also
note that the reset line is active low as that is also important to
gpiod API.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov at gmail.com>
---

Another option is to add another quirk into gpiolib-of.c, but we
may end up with a ton of them once we convert everything away from
of_get_named_gpio() to gpiod API, so I'd prefer not doing that.

 arch/arm/boot/dts/imx28-cfa10049.dts | 7 +++++--
 arch/arm/boot/dts/imx28-cfa10055.dts | 3 ++-
 arch/arm/boot/dts/imx28-cfa10056.dts | 3 ++-
 drivers/video/backlight/hx8357.c     | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts
index 9ef0d567ea48..ae51a2aa2028 100644
--- a/arch/arm/boot/dts/imx28-cfa10049.dts
+++ b/arch/arm/boot/dts/imx28-cfa10049.dts
@@ -3,6 +3,7 @@
  * Copyright 2012 Free Electrons
  */
 
+#include <dt-bindings/gpio/gpio.h>
 /*
  * The CFA-10049 is an expansion board for the CFA-10036 module, thus we
  * need to include the CFA-10036 DTS.
@@ -346,8 +347,10 @@ hx8357: hx8357 at 0 {
 			spi-max-frequency = <100000>;
 			spi-cpol;
 			spi-cpha;
-			gpios-reset = <&gpio3 30 0>;
-			im-gpios = <&gpio5 4 0 &gpio5 5 0 &gpio5 6 0>;
+			reset-gpios = <&gpio3 30 GPIO_ACTIVE_LOW>;
+			im-gpios = <&gpio5 4 GPIO_ACTIVE_HIGH
+				    &gpio5 5 GPIO_ACTIVE_HIGH
+				    &gpio5 6 GPIO_ACTIVE_HIGH>;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/imx28-cfa10055.dts b/arch/arm/boot/dts/imx28-cfa10055.dts
index fac5bbda7a93..70e4dc67f7d2 100644
--- a/arch/arm/boot/dts/imx28-cfa10055.dts
+++ b/arch/arm/boot/dts/imx28-cfa10055.dts
@@ -4,6 +4,7 @@
  * 				  Free Electrons
  */
 
+#include <dt-bindings/gpio/gpio.h>
 /*
  * The CFA-10055 is an expansion board for the CFA-10036 module and
  * CFA-10037, thus we need to include the CFA-10037 DTS.
@@ -148,7 +149,7 @@ hx8357: hx8357 at 0 {
 			spi-max-frequency = <100000>;
 			spi-cpol;
 			spi-cpha;
-			gpios-reset = <&gpio3 30 0>;
+			reset-gpios = <&gpio3 30 GPIO_ACTIVE_LOW>;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/imx28-cfa10056.dts b/arch/arm/boot/dts/imx28-cfa10056.dts
index c5f3337e8b39..687eaa555a15 100644
--- a/arch/arm/boot/dts/imx28-cfa10056.dts
+++ b/arch/arm/boot/dts/imx28-cfa10056.dts
@@ -3,6 +3,7 @@
  * Copyright 2013 Free Electrons
  */
 
+#include <dt-bindings/gpio/gpio.h>
 /*
  * The CFA-10055 is an expansion board for the CFA-10036 module and
  * CFA-10037, thus we need to include the CFA-10037 DTS.
@@ -107,7 +108,7 @@ hx8369: hx8369 at 0 {
 			spi-max-frequency = <100000>;
 			spi-cpol;
 			spi-cpha;
-			gpios-reset = <&gpio3 30 0>;
+			reset-gpios = <&gpio3 30 GPIO_ACTIVE_LOW>;
 		};
 	};
 };
diff --git a/drivers/video/backlight/hx8357.c b/drivers/video/backlight/hx8357.c
index 9b50bc96e00f..41332f48b2df 100644
--- a/drivers/video/backlight/hx8357.c
+++ b/drivers/video/backlight/hx8357.c
@@ -601,7 +601,7 @@ static int hx8357_probe(struct spi_device *spi)
 	if (!match || !match->data)
 		return -EINVAL;
 
-	lcd->reset = of_get_named_gpio(spi->dev.of_node, "gpios-reset", 0);
+	lcd->reset = of_get_named_gpio(spi->dev.of_node, "reset-gpios", 0);
 	if (!gpio_is_valid(lcd->reset)) {
 		dev_err(&spi->dev, "Missing dt property: gpios-reset\n");
 		return -EINVAL;
-- 
2.38.0.rc1.362.ged0d419d3c-goog


-- 
Dmitry



More information about the linux-arm-kernel mailing list