All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] drm/panel: jh057n0090: Add regulators and drop magic value in init
@ 2019-06-25 17:05 Guido Günther
  2019-06-25 17:05 ` [PATCH 1/4] MAINTAINERS: Add Purism mail alias as reviewer for their devkit's panel Guido Günther
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Guido Günther @ 2019-06-25 17:05 UTC (permalink / raw)
  To: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
	David S. Miller, Greg Kroah-Hartman, Nicolas Ferre,
	Paul E. McKenney, dri-devel, devicetree, linux-kernel,
	Purism Kernel Team

Fix the omission of regulators for the recently added panel and make
sure all dsi commands start with a command instead of one having a magic
constant (which already caused confusion).

Also adds a mail alias to the panel's MAINTAINER entry to reduce the bus
factor.

To: Thierry Reding <thierry.reding@gmail.com>,Sam Ravnborg <sam@ravnborg.org>,David Airlie <airlied@linux.ie>,Daniel Vetter <daniel@ffwll.ch>,Rob Herring <robh+dt@kernel.org>,Mark Rutland <mark.rutland@arm.com>,Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,"David S. Miller" <davem@davemloft.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,Nicolas Ferre <nicolas.ferre@microchip.com>,"Paul E. McKenney" <paulmck@linux.ibm.com>,dri-devel@lists.freedesktop.org,devicetree@vger.kernel.org,linux-kernel@vger.kernel.org,Purism Kernel Team <kernel@puri.sm>


Guido Günther (4):
  MAINTAINERS: Add Purism mail alias as reviewer for their devkit's
    panel
  drm/panel: jh057n0090: Don't use magic constant
  dt-bindings: display/panel: jh057n0090: Document power supply
    properties
  drm/panel: jh057n0090: Add regulator support

 .../display/panel/rocktech,jh057n00900.txt    |  5 +++++
 MAINTAINERS                                   |  1 +
 .../drm/panel/panel-rocktech-jh057n00900.c    | 22 ++++++++++++++++++-
 3 files changed, 27 insertions(+), 1 deletion(-)

-- 
2.20.1


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

* [PATCH 1/4] MAINTAINERS: Add Purism mail alias as reviewer for their devkit's panel
  2019-06-25 17:05 [PATCH 0/4] drm/panel: jh057n0090: Add regulators and drop magic value in init Guido Günther
@ 2019-06-25 17:05 ` Guido Günther
  2019-06-25 17:05   ` Guido Günther
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Guido Günther @ 2019-06-25 17:05 UTC (permalink / raw)
  To: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
	David S. Miller, Greg Kroah-Hartman, Nicolas Ferre,
	Paul E. McKenney, dri-devel, devicetree, linux-kernel,
	Purism Kernel Team

Add a mail alias as reviewer for the rocktech jh057n00900 panel driver.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 10359a30ed3c..b7de43a4910d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5133,6 +5133,7 @@ F:	include/uapi/drm/r128_drm.h
 
 DRM DRIVER FOR ROCKTECH JH057N00900 PANELS
 M:	Guido Günther <agx@sigxcpu.org>
+R:	Purism Kernel Team <kernel@puri.sm>
 S:	Maintained
 F:	drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
 F:	Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
-- 
2.20.1


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

* [PATCH 2/4] drm/panel: jh057n0090: Don't use magic constant
  2019-06-25 17:05 [PATCH 0/4] drm/panel: jh057n0090: Add regulators and drop magic value in init Guido Günther
@ 2019-06-25 17:05   ` Guido Günther
  2019-06-25 17:05   ` Guido Günther
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Guido Günther @ 2019-06-25 17:05 UTC (permalink / raw)
  To: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
	David S. Miller, Greg Kroah-Hartman, Nicolas Ferre,
	Paul E. McKenney, dri-devel, devicetree, linux-kernel,
	Purism Kernel Team

0xBF isn't in any ST7703 data sheet so mark it as unknown. This avoids
confusion on whether there is a missing command in that
dsi_generic_write_seq() call.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
index 6dcb692c4701..b8a069055fbc 100644
--- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
+++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
@@ -33,6 +33,7 @@
 #define ST7703_CMD_SETEXTC	 0xB9
 #define ST7703_CMD_SETMIPI	 0xBA
 #define ST7703_CMD_SETVDC	 0xBC
+#define ST7703_CMD_UNKNOWN0	 0xBF
 #define ST7703_CMD_SETSCR	 0xC0
 #define ST7703_CMD_SETPOWER	 0xC1
 #define ST7703_CMD_SETPANEL	 0xCC
@@ -94,7 +95,7 @@ static int jh057n_init_sequence(struct jh057n *ctx)
 	msleep(20);
 
 	dsi_generic_write_seq(dsi, ST7703_CMD_SETVCOM, 0x3F, 0x3F);
-	dsi_generic_write_seq(dsi, 0xBF, 0x02, 0x11, 0x00);
+	dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN0, 0x02, 0x11, 0x00);
 	dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1,
 			      0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12,
 			      0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
-- 
2.20.1


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

* [PATCH 2/4] drm/panel: jh057n0090: Don't use magic constant
@ 2019-06-25 17:05   ` Guido Günther
  0 siblings, 0 replies; 11+ messages in thread
From: Guido Günther @ 2019-06-25 17:05 UTC (permalink / raw)
  To: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
	David S. Miller, Greg Kroah-Hartman, Nicolas Ferre,
	Paul E. McKenney, dri-devel, devicetree, linux-kernel,
	Purism Kernel Team

0xBF isn't in any ST7703 data sheet so mark it as unknown. This avoids
confusion on whether there is a missing command in that
dsi_generic_write_seq() call.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
index 6dcb692c4701..b8a069055fbc 100644
--- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
+++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
@@ -33,6 +33,7 @@
 #define ST7703_CMD_SETEXTC	 0xB9
 #define ST7703_CMD_SETMIPI	 0xBA
 #define ST7703_CMD_SETVDC	 0xBC
+#define ST7703_CMD_UNKNOWN0	 0xBF
 #define ST7703_CMD_SETSCR	 0xC0
 #define ST7703_CMD_SETPOWER	 0xC1
 #define ST7703_CMD_SETPANEL	 0xCC
@@ -94,7 +95,7 @@ static int jh057n_init_sequence(struct jh057n *ctx)
 	msleep(20);
 
 	dsi_generic_write_seq(dsi, ST7703_CMD_SETVCOM, 0x3F, 0x3F);
-	dsi_generic_write_seq(dsi, 0xBF, 0x02, 0x11, 0x00);
+	dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN0, 0x02, 0x11, 0x00);
 	dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1,
 			      0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12,
 			      0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 3/4] dt-bindings: display/panel: jh057n0090: Document power supply properties
  2019-06-25 17:05 [PATCH 0/4] drm/panel: jh057n0090: Add regulators and drop magic value in init Guido Günther
  2019-06-25 17:05 ` [PATCH 1/4] MAINTAINERS: Add Purism mail alias as reviewer for their devkit's panel Guido Günther
  2019-06-25 17:05   ` Guido Günther
@ 2019-06-25 17:05 ` Guido Günther
  2019-06-25 21:18   ` Sam Ravnborg
  2019-06-25 17:05 ` [PATCH 4/4] drm/panel: jh057n0090: Add regulator support Guido Günther
  3 siblings, 1 reply; 11+ messages in thread
From: Guido Günther @ 2019-06-25 17:05 UTC (permalink / raw)
  To: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
	David S. Miller, Greg Kroah-Hartman, Nicolas Ferre,
	Paul E. McKenney, dri-devel, devicetree, linux-kernel,
	Purism Kernel Team

Document the vcc-supply and iovcc-supply propertes of the Rocktech
jh057n0090 panel.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 .../bindings/display/panel/rocktech,jh057n00900.txt          | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
index 1b5763200cf6..a372c5d84695 100644
--- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
+++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
@@ -5,6 +5,9 @@ Required properties:
 - reg: DSI virtual channel of the peripheral
 - reset-gpios: panel reset gpio
 - backlight: phandle of the backlight device attached to the panel
+- vcc-supply: phandle of the regulator that provides the vcc supply voltage.
+- iovcc-supply: phandle of the regulator that provides the iovcc supply
+  voltage.
 
 Example:
 
@@ -14,5 +17,7 @@ Example:
 			reg = <0>;
 			backlight = <&backlight>;
 			reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
+			vcc-supply = <&reg_2v8_p>;
+			iovcc-supply = <&reg_1v8_p>;
 		};
 	};
-- 
2.20.1


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

* [PATCH 4/4] drm/panel: jh057n0090: Add regulator support
  2019-06-25 17:05 [PATCH 0/4] drm/panel: jh057n0090: Add regulators and drop magic value in init Guido Günther
                   ` (2 preceding siblings ...)
  2019-06-25 17:05 ` [PATCH 3/4] dt-bindings: display/panel: jh057n0090: Document power supply properties Guido Günther
@ 2019-06-25 17:05 ` Guido Günther
  2019-06-25 21:24   ` Sam Ravnborg
  3 siblings, 1 reply; 11+ messages in thread
From: Guido Günther @ 2019-06-25 17:05 UTC (permalink / raw)
  To: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Rob Herring, Mark Rutland, Mauro Carvalho Chehab,
	David S. Miller, Greg Kroah-Hartman, Nicolas Ferre,
	Paul E. McKenney, dri-devel, devicetree, linux-kernel,
	Purism Kernel Team

Allow to specify regulators for vcc and iovcc. According to the data
sheet the panel wants vcc (2.8V) and iovcc (1.8V) and there's no startup
dependency between the two.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 .../drm/panel/panel-rocktech-jh057n00900.c    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
index b8a069055fbc..f8f6f087b9bc 100644
--- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
+++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
@@ -15,6 +15,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/media-bus-format.h>
 #include <linux/module.h>
+#include <linux/regulator/consumer.h>
 #include <video/display_timing.h>
 #include <video/mipi_display.h>
 
@@ -47,6 +48,8 @@ struct jh057n {
 	struct drm_panel panel;
 	struct gpio_desc *reset_gpio;
 	struct backlight_device *backlight;
+	struct regulator *vcc;
+	struct regulator *iovcc;
 	bool prepared;
 
 	struct dentry *debugfs;
@@ -160,6 +163,8 @@ static int jh057n_unprepare(struct drm_panel *panel)
 		return 0;
 
 	mipi_dsi_dcs_set_display_off(dsi);
+	regulator_disable(ctx->iovcc);
+	regulator_disable(ctx->vcc);
 	ctx->prepared = false;
 
 	return 0;
@@ -174,6 +179,13 @@ static int jh057n_prepare(struct drm_panel *panel)
 		return 0;
 
 	DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n");
+	ret = regulator_enable(ctx->vcc);
+	if (ret < 0)
+		return ret;
+	ret = regulator_enable(ctx->iovcc);
+	if (ret < 0)
+		return ret;
+
 	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
 	usleep_range(20, 40);
 	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
@@ -301,6 +313,13 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
 	if (IS_ERR(ctx->backlight))
 		return PTR_ERR(ctx->backlight);
 
+	ctx->vcc = devm_regulator_get(dev, "vcc");
+	if (IS_ERR(ctx->vcc))
+		return PTR_ERR(ctx->vcc);
+	ctx->iovcc = devm_regulator_get(dev, "iovcc");
+	if (IS_ERR(ctx->iovcc))
+		return PTR_ERR(ctx->iovcc);
+
 	drm_panel_init(&ctx->panel);
 	ctx->panel.dev = dev;
 	ctx->panel.funcs = &jh057n_drm_funcs;
-- 
2.20.1


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

* Re: [PATCH 3/4] dt-bindings: display/panel: jh057n0090: Document power supply properties
  2019-06-25 17:05 ` [PATCH 3/4] dt-bindings: display/panel: jh057n0090: Document power supply properties Guido Günther
@ 2019-06-25 21:18   ` Sam Ravnborg
  0 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2019-06-25 21:18 UTC (permalink / raw)
  To: Guido Günther
  Cc: Thierry Reding, David Airlie, Daniel Vetter, Rob Herring,
	Mark Rutland, Mauro Carvalho Chehab, David S. Miller,
	Greg Kroah-Hartman, Nicolas Ferre, Paul E. McKenney, dri-devel,
	devicetree, linux-kernel, Purism Kernel Team

On Tue, Jun 25, 2019 at 07:05:18PM +0200, Guido Günther wrote:
> Document the vcc-supply and iovcc-supply propertes of the Rocktech
> jh057n0090 panel.
s/propertes/properties
s/jh057n0090/jh057n00900

With these fixed:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> ---
>  .../bindings/display/panel/rocktech,jh057n00900.txt          | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> index 1b5763200cf6..a372c5d84695 100644
> --- a/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> +++ b/Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> @@ -5,6 +5,9 @@ Required properties:
>  - reg: DSI virtual channel of the peripheral
>  - reset-gpios: panel reset gpio
>  - backlight: phandle of the backlight device attached to the panel
> +- vcc-supply: phandle of the regulator that provides the vcc supply voltage.
> +- iovcc-supply: phandle of the regulator that provides the iovcc supply
> +  voltage.
>  
>  Example:
>  
> @@ -14,5 +17,7 @@ Example:
>  			reg = <0>;
>  			backlight = <&backlight>;
>  			reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
> +			vcc-supply = <&reg_2v8_p>;
> +			iovcc-supply = <&reg_1v8_p>;
>  		};
>  	};
> -- 
> 2.20.1

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

* Re: [PATCH 4/4] drm/panel: jh057n0090: Add regulator support
  2019-06-25 17:05 ` [PATCH 4/4] drm/panel: jh057n0090: Add regulator support Guido Günther
@ 2019-06-25 21:24   ` Sam Ravnborg
  2019-06-26 10:40       ` Guido Günther
  0 siblings, 1 reply; 11+ messages in thread
From: Sam Ravnborg @ 2019-06-25 21:24 UTC (permalink / raw)
  To: Guido Günther
  Cc: Thierry Reding, David Airlie, Daniel Vetter, Rob Herring,
	Mark Rutland, Mauro Carvalho Chehab, David S. Miller,
	Greg Kroah-Hartman, Nicolas Ferre, Paul E. McKenney, dri-devel,
	devicetree, linux-kernel, Purism Kernel Team

On Tue, Jun 25, 2019 at 07:05:19PM +0200, Guido Günther wrote:
> Allow to specify regulators for vcc and iovcc. According to the data
> sheet the panel wants vcc (2.8V) and iovcc (1.8V) and there's no startup
> dependency between the two.
s/jh057n0090/jh057n00900

> 
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> ---
>  .../drm/panel/panel-rocktech-jh057n00900.c    | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> index b8a069055fbc..f8f6f087b9bc 100644
> --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> @@ -15,6 +15,7 @@
>  #include <linux/gpio/consumer.h>
>  #include <linux/media-bus-format.h>
>  #include <linux/module.h>
> +#include <linux/regulator/consumer.h>
>  #include <video/display_timing.h>
>  #include <video/mipi_display.h>
>  
> @@ -47,6 +48,8 @@ struct jh057n {
>  	struct drm_panel panel;
>  	struct gpio_desc *reset_gpio;
>  	struct backlight_device *backlight;
> +	struct regulator *vcc;
> +	struct regulator *iovcc;
>  	bool prepared;
>  
>  	struct dentry *debugfs;
> @@ -160,6 +163,8 @@ static int jh057n_unprepare(struct drm_panel *panel)
>  		return 0;
>  
>  	mipi_dsi_dcs_set_display_off(dsi);
> +	regulator_disable(ctx->iovcc);
> +	regulator_disable(ctx->vcc);
>  	ctx->prepared = false;
>  
>  	return 0;
> @@ -174,6 +179,13 @@ static int jh057n_prepare(struct drm_panel *panel)
>  		return 0;
>  
>  	DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n");
> +	ret = regulator_enable(ctx->vcc);
> +	if (ret < 0)
> +		return ret;
> +	ret = regulator_enable(ctx->iovcc);
> +	if (ret < 0)
> +		return ret;
> +
>  	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
>  	usleep_range(20, 40);
>  	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> @@ -301,6 +313,13 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
>  	if (IS_ERR(ctx->backlight))
>  		return PTR_ERR(ctx->backlight);
>  
> +	ctx->vcc = devm_regulator_get(dev, "vcc");
> +	if (IS_ERR(ctx->vcc))
> +		return PTR_ERR(ctx->vcc);
> +	ctx->iovcc = devm_regulator_get(dev, "iovcc");
> +	if (IS_ERR(ctx->iovcc))
> +		return PTR_ERR(ctx->iovcc);
> +
Consider to write an error message.
The regulators are now mandatory, but they be missing in some device
trees. So it would be good to help them to understand why it fails.

With this considered:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

	Sam

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

* Re: [PATCH 2/4] drm/panel: jh057n0090: Don't use magic constant
  2019-06-25 17:05   ` Guido Günther
  (?)
@ 2019-06-25 21:24   ` Sam Ravnborg
  -1 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2019-06-25 21:24 UTC (permalink / raw)
  To: Guido Günther
  Cc: Thierry Reding, David Airlie, Daniel Vetter, Rob Herring,
	Mark Rutland, Mauro Carvalho Chehab, David S. Miller,
	Greg Kroah-Hartman, Nicolas Ferre, Paul E. McKenney, dri-devel,
	devicetree, linux-kernel, Purism Kernel Team

On Tue, Jun 25, 2019 at 07:05:17PM +0200, Guido Günther wrote:
> 0xBF isn't in any ST7703 data sheet so mark it as unknown. This avoids
> confusion on whether there is a missing command in that
> dsi_generic_write_seq() call.
> 
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> index 6dcb692c4701..b8a069055fbc 100644
> --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> @@ -33,6 +33,7 @@
>  #define ST7703_CMD_SETEXTC	 0xB9
>  #define ST7703_CMD_SETMIPI	 0xBA
>  #define ST7703_CMD_SETVDC	 0xBC
> +#define ST7703_CMD_UNKNOWN0	 0xBF
>  #define ST7703_CMD_SETSCR	 0xC0
>  #define ST7703_CMD_SETPOWER	 0xC1
>  #define ST7703_CMD_SETPANEL	 0xCC
> @@ -94,7 +95,7 @@ static int jh057n_init_sequence(struct jh057n *ctx)
>  	msleep(20);
>  
>  	dsi_generic_write_seq(dsi, ST7703_CMD_SETVCOM, 0x3F, 0x3F);
> -	dsi_generic_write_seq(dsi, 0xBF, 0x02, 0x11, 0x00);
> +	dsi_generic_write_seq(dsi, ST7703_CMD_UNKNOWN0, 0x02, 0x11, 0x00);
>  	dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1,
>  			      0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12,
>  			      0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
> -- 
> 2.20.1

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

* Re: [PATCH 4/4] drm/panel: jh057n0090: Add regulator support
  2019-06-25 21:24   ` Sam Ravnborg
@ 2019-06-26 10:40       ` Guido Günther
  0 siblings, 0 replies; 11+ messages in thread
From: Guido Günther @ 2019-06-26 10:40 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Thierry Reding, David Airlie, Daniel Vetter, Rob Herring,
	Mark Rutland, Mauro Carvalho Chehab, David S. Miller,
	Greg Kroah-Hartman, Nicolas Ferre, Paul E. McKenney, dri-devel,
	devicetree, linux-kernel, Purism Kernel Team

Hi Sam,
On Tue, Jun 25, 2019 at 11:24:19PM +0200, Sam Ravnborg wrote:
> On Tue, Jun 25, 2019 at 07:05:19PM +0200, Guido Günther wrote:
> > Allow to specify regulators for vcc and iovcc. According to the data
> > sheet the panel wants vcc (2.8V) and iovcc (1.8V) and there's no startup
> > dependency between the two.
> s/jh057n0090/jh057n00900
> 
> > 
> > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> > ---
> >  .../drm/panel/panel-rocktech-jh057n00900.c    | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > index b8a069055fbc..f8f6f087b9bc 100644
> > --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > @@ -15,6 +15,7 @@
> >  #include <linux/gpio/consumer.h>
> >  #include <linux/media-bus-format.h>
> >  #include <linux/module.h>
> > +#include <linux/regulator/consumer.h>
> >  #include <video/display_timing.h>
> >  #include <video/mipi_display.h>
> >  
> > @@ -47,6 +48,8 @@ struct jh057n {
> >  	struct drm_panel panel;
> >  	struct gpio_desc *reset_gpio;
> >  	struct backlight_device *backlight;
> > +	struct regulator *vcc;
> > +	struct regulator *iovcc;
> >  	bool prepared;
> >  
> >  	struct dentry *debugfs;
> > @@ -160,6 +163,8 @@ static int jh057n_unprepare(struct drm_panel *panel)
> >  		return 0;
> >  
> >  	mipi_dsi_dcs_set_display_off(dsi);
> > +	regulator_disable(ctx->iovcc);
> > +	regulator_disable(ctx->vcc);
> >  	ctx->prepared = false;
> >  
> >  	return 0;
> > @@ -174,6 +179,13 @@ static int jh057n_prepare(struct drm_panel *panel)
> >  		return 0;
> >  
> >  	DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n");
> > +	ret = regulator_enable(ctx->vcc);
> > +	if (ret < 0)
> > +		return ret;
> > +	ret = regulator_enable(ctx->iovcc);
> > +	if (ret < 0)
> > +		return ret;
> > +
> >  	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> >  	usleep_range(20, 40);
> >  	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> > @@ -301,6 +313,13 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
> >  	if (IS_ERR(ctx->backlight))
> >  		return PTR_ERR(ctx->backlight);
> >  
> > +	ctx->vcc = devm_regulator_get(dev, "vcc");
> > +	if (IS_ERR(ctx->vcc))
> > +		return PTR_ERR(ctx->vcc);
> > +	ctx->iovcc = devm_regulator_get(dev, "iovcc");
> > +	if (IS_ERR(ctx->iovcc))
> > +		return PTR_ERR(ctx->iovcc);
> > +
> Consider to write an error message.
> The regulators are now mandatory, but they be missing in some device
> trees. So it would be good to help them to understand why it fails.

I've fixed this and your other comments in v2.
> 
> With this considered:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Thanks! I've not added this yet since I made two more changes:

- also print an error when regulator_enable() fails
- disable vcc if enabling iovcc fails afterwards

Hope this looks sane now.

Cheers,
 -- Guido

> 
> 	Sam
> 

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

* Re: [PATCH 4/4] drm/panel: jh057n0090: Add regulator support
@ 2019-06-26 10:40       ` Guido Günther
  0 siblings, 0 replies; 11+ messages in thread
From: Guido Günther @ 2019-06-26 10:40 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Mark Rutland, devicetree, Purism Kernel Team, David Airlie,
	Greg Kroah-Hartman, Nicolas Ferre, dri-devel, linux-kernel,
	Rob Herring, Thierry Reding, Mauro Carvalho Chehab,
	Paul E. McKenney, David S. Miller

Hi Sam,
On Tue, Jun 25, 2019 at 11:24:19PM +0200, Sam Ravnborg wrote:
> On Tue, Jun 25, 2019 at 07:05:19PM +0200, Guido Günther wrote:
> > Allow to specify regulators for vcc and iovcc. According to the data
> > sheet the panel wants vcc (2.8V) and iovcc (1.8V) and there's no startup
> > dependency between the two.
> s/jh057n0090/jh057n00900
> 
> > 
> > Signed-off-by: Guido Günther <agx@sigxcpu.org>
> > ---
> >  .../drm/panel/panel-rocktech-jh057n00900.c    | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > index b8a069055fbc..f8f6f087b9bc 100644
> > --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > @@ -15,6 +15,7 @@
> >  #include <linux/gpio/consumer.h>
> >  #include <linux/media-bus-format.h>
> >  #include <linux/module.h>
> > +#include <linux/regulator/consumer.h>
> >  #include <video/display_timing.h>
> >  #include <video/mipi_display.h>
> >  
> > @@ -47,6 +48,8 @@ struct jh057n {
> >  	struct drm_panel panel;
> >  	struct gpio_desc *reset_gpio;
> >  	struct backlight_device *backlight;
> > +	struct regulator *vcc;
> > +	struct regulator *iovcc;
> >  	bool prepared;
> >  
> >  	struct dentry *debugfs;
> > @@ -160,6 +163,8 @@ static int jh057n_unprepare(struct drm_panel *panel)
> >  		return 0;
> >  
> >  	mipi_dsi_dcs_set_display_off(dsi);
> > +	regulator_disable(ctx->iovcc);
> > +	regulator_disable(ctx->vcc);
> >  	ctx->prepared = false;
> >  
> >  	return 0;
> > @@ -174,6 +179,13 @@ static int jh057n_prepare(struct drm_panel *panel)
> >  		return 0;
> >  
> >  	DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n");
> > +	ret = regulator_enable(ctx->vcc);
> > +	if (ret < 0)
> > +		return ret;
> > +	ret = regulator_enable(ctx->iovcc);
> > +	if (ret < 0)
> > +		return ret;
> > +
> >  	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> >  	usleep_range(20, 40);
> >  	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> > @@ -301,6 +313,13 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
> >  	if (IS_ERR(ctx->backlight))
> >  		return PTR_ERR(ctx->backlight);
> >  
> > +	ctx->vcc = devm_regulator_get(dev, "vcc");
> > +	if (IS_ERR(ctx->vcc))
> > +		return PTR_ERR(ctx->vcc);
> > +	ctx->iovcc = devm_regulator_get(dev, "iovcc");
> > +	if (IS_ERR(ctx->iovcc))
> > +		return PTR_ERR(ctx->iovcc);
> > +
> Consider to write an error message.
> The regulators are now mandatory, but they be missing in some device
> trees. So it would be good to help them to understand why it fails.

I've fixed this and your other comments in v2.
> 
> With this considered:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Thanks! I've not added this yet since I made two more changes:

- also print an error when regulator_enable() fails
- disable vcc if enabling iovcc fails afterwards

Hope this looks sane now.

Cheers,
 -- Guido

> 
> 	Sam
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-26 10:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 17:05 [PATCH 0/4] drm/panel: jh057n0090: Add regulators and drop magic value in init Guido Günther
2019-06-25 17:05 ` [PATCH 1/4] MAINTAINERS: Add Purism mail alias as reviewer for their devkit's panel Guido Günther
2019-06-25 17:05 ` [PATCH 2/4] drm/panel: jh057n0090: Don't use magic constant Guido Günther
2019-06-25 17:05   ` Guido Günther
2019-06-25 21:24   ` Sam Ravnborg
2019-06-25 17:05 ` [PATCH 3/4] dt-bindings: display/panel: jh057n0090: Document power supply properties Guido Günther
2019-06-25 21:18   ` Sam Ravnborg
2019-06-25 17:05 ` [PATCH 4/4] drm/panel: jh057n0090: Add regulator support Guido Günther
2019-06-25 21:24   ` Sam Ravnborg
2019-06-26 10:40     ` Guido Günther
2019-06-26 10:40       ` Guido Günther

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.