linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ondrej Jirman <megous@megous.com>
To: linux-sunxi@googlegroups.com,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Guido Günther" <agx@sigxcpu.org>,
	"Purism Kernel Team" <kernel@puri.sm>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Icenowy Zheng" <icenowy@aosc.io>
Cc: Ondrej Jirman <megous@megous.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Samuel Holland <samuel@sholland.org>,
	Martijn Braam <martijn@brixit.nl>, Luca Weiss <luca@z3ntu.xyz>,
	Bhushan Shah <bshah@kde.org>
Subject: [PATCH v6 08/13] drm/panel: st7703: Move generic part of init sequence to enable callback
Date: Wed,  1 Jul 2020 12:31:21 +0200	[thread overview]
Message-ID: <20200701103126.1512615-9-megous@megous.com> (raw)
In-Reply-To: <20200701103126.1512615-1-megous@megous.com>

Calling sleep out and display on is a controller specific part
of the initialization process. Move it out of the panel specific
initialization function to the enable callback.

Signed-off-by: Ondrej Jirman <megous@megous.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 33 ++++++++++---------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index d03aab10cfef..cdbf7dfb4dd4 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -84,8 +84,6 @@ static inline struct st7703 *panel_to_st7703(struct drm_panel *panel)
 static int jh057n_init_sequence(struct st7703 *ctx)
 {
 	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
-	struct device *dev = ctx->dev;
-	int ret;
 
 	/*
 	 * Init sequence was supplied by the panel vendor. Most of the commands
@@ -136,20 +134,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
 			      0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41,
 			      0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10,
 			      0x11, 0x18);
-	msleep(20);
-
-	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
-	if (ret < 0) {
-		DRM_DEV_ERROR(dev, "Failed to exit sleep mode: %d\n", ret);
-		return ret;
-	}
-	/* Panel is operational 120 msec after reset */
-	msleep(60);
-	ret = mipi_dsi_dcs_set_display_on(dsi);
-	if (ret)
-		return ret;
 
-	DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done\n");
 	return 0;
 }
 
@@ -181,6 +166,7 @@ struct st7703_panel_desc jh057n00900_panel_desc = {
 static int st7703_enable(struct drm_panel *panel)
 {
 	struct st7703 *ctx = panel_to_st7703(panel);
+	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
 	int ret;
 
 	ret = ctx->desc->init_sequence(ctx);
@@ -190,6 +176,23 @@ static int st7703_enable(struct drm_panel *panel)
 		return ret;
 	}
 
+	msleep(20);
+
+	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+	if (ret < 0) {
+		DRM_DEV_ERROR(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
+		return ret;
+	}
+
+	/* Panel is operational 120 msec after reset */
+	msleep(60);
+
+	ret = mipi_dsi_dcs_set_display_on(dsi);
+	if (ret)
+		return ret;
+
+	DRM_DEV_DEBUG_DRIVER(ctx->dev, "Panel init sequence done\n");
+
 	return 0;
 }
 
-- 
2.27.0


  parent reply	other threads:[~2020-07-01 10:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 10:31 [PATCH v6 00/13] Add support for PinePhone LCD panel Ondrej Jirman
2020-07-01 10:31 ` [PATCH v6 01/13] dt-bindings: vendor-prefixes: Add Xingbangda Ondrej Jirman
2020-07-01 10:31 ` [PATCH v6 02/13] dt-bindings: panel: Convert rocktech,jh057n00900 to yaml Ondrej Jirman
2020-07-01 15:58   ` Guido Günther
2020-07-01 16:07     ` Sam Ravnborg
2020-07-01 16:32     ` Ondřej Jirman
2020-07-01 10:31 ` [PATCH v6 03/13] dt-bindings: panel: Add compatible for Xingbangda XBD599 panel Ondrej Jirman
2020-07-01 10:31 ` [PATCH v6 04/13] drm/panel: rocktech-jh057n00900: Rename the driver to st7703 Ondrej Jirman
2020-07-01 16:00   ` Guido Günther
2020-07-01 10:31 ` [PATCH v6 05/13] drm/panel: st7703: Rename functions from jh057n prefix " Ondrej Jirman
2020-07-01 16:01   ` Guido Günther
2020-07-01 10:31 ` [PATCH v6 06/13] drm/panel: st7703: Prepare for supporting multiple panels Ondrej Jirman
2020-07-01 16:02   ` Guido Günther
2020-07-01 10:31 ` [PATCH v6 07/13] drm/panel: st7703: Move code specific to jh057n closer together Ondrej Jirman
2020-07-01 16:02   ` Guido Günther
2020-07-01 10:31 ` Ondrej Jirman [this message]
2020-07-01 16:02   ` [PATCH v6 08/13] drm/panel: st7703: Move generic part of init sequence to enable callback Guido Günther
2020-07-01 10:31 ` [PATCH v6 09/13] drm/panel: st7703: Add support for Xingbangda XBD599 Ondrej Jirman
2020-07-01 16:03   ` Guido Günther
2020-07-01 10:31 ` [PATCH v6 10/13] drm/panel: st7703: Enter sleep after display off Ondrej Jirman
2020-07-01 16:04   ` Guido Günther
2020-07-01 10:31 ` [PATCH v6 11/13] drm/panel: st7703: Assert reset prior to powering down the regulators Ondrej Jirman
2020-07-01 16:04   ` Guido Günther
2020-07-01 10:31 ` [PATCH v6 12/13] arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone Ondrej Jirman
2020-07-01 10:31 ` [PATCH v6 13/13] arm64: dts: sun50i-a64-pinephone: Add touchscreen support Ondrej Jirman
2020-07-01 12:01   ` Icenowy Zheng
2020-07-01 18:57     ` Ondřej Jirman
2020-07-01 15:25 ` [PATCH v6 00/13] Add support for PinePhone LCD panel Sam Ravnborg
2020-07-01 16:30   ` Ondřej Jirman
2020-07-01 16:37     ` Linus Walleij
2020-07-01 15:54 ` Guido Günther
2020-07-01 16:42   ` Ondřej Jirman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200701103126.1512615-9-megous@megous.com \
    --to=megous@megous.com \
    --cc=agx@sigxcpu.org \
    --cc=airlied@linux.ie \
    --cc=bshah@kde.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=icenowy@aosc.io \
    --cc=kernel@puri.sm \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=luca@z3ntu.xyz \
    --cc=martijn@brixit.nl \
    --cc=mripard@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=samuel@sholland.org \
    --cc=thierry.reding@gmail.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).