LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: linux-kernel@vger.kernel.org
Cc: Peter Rosin <peda@axentia.se>, David Airlie <airlied@linux.ie>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Boris Brezillon <boris.brezillon@bootlin.com>,
Russell King <linux@armlinux.org.uk>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Jyri Sarha <jsarha@ti.com>,
Daniel Vetter <daniel@ffwll.ch>,
Andrzej Hajda <a.hajda@samsung.com>,
Jacopo Mondi <jacopo+renesas@jmondi.org>
Subject: [PATCH v5 5/7] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable
Date: Wed, 23 May 2018 11:31:20 +0200 [thread overview]
Message-ID: <20180523093122.27859-6-peda@axentia.se> (raw)
In-Reply-To: <20180523093122.27859-1-peda@axentia.se>
This fits better with the drm_bridge callbacks for when this
driver becomes a drm_bridge.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/gpu/drm/i2c/tda998x_drv.c | 64 ++++++++++++++++++++++-----------------
1 file changed, 37 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 933d309d2e0f..3dda07a2fd2f 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1163,36 +1163,42 @@ static int tda998x_connector_init(struct tda998x_priv *priv,
/* DRM encoder functions */
-static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
+static void tda998x_enable(struct tda998x_priv *priv)
{
- struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
- bool on;
+ if (priv->is_on)
+ return;
- /* we only care about on or off: */
- on = mode == DRM_MODE_DPMS_ON;
+ /* enable video ports, audio will be enabled later */
+ reg_write(priv, REG_ENA_VP_0, 0xff);
+ reg_write(priv, REG_ENA_VP_1, 0xff);
+ reg_write(priv, REG_ENA_VP_2, 0xff);
+ /* set muxing after enabling ports: */
+ reg_write(priv, REG_VIP_CNTRL_0, priv->vip_cntrl_0);
+ reg_write(priv, REG_VIP_CNTRL_1, priv->vip_cntrl_1);
+ reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2);
- if (on == priv->is_on)
- return;
+ priv->is_on = true;
+}
- if (on) {
- /* enable video ports, audio will be enabled later */
- reg_write(priv, REG_ENA_VP_0, 0xff);
- reg_write(priv, REG_ENA_VP_1, 0xff);
- reg_write(priv, REG_ENA_VP_2, 0xff);
- /* set muxing after enabling ports: */
- reg_write(priv, REG_VIP_CNTRL_0, priv->vip_cntrl_0);
- reg_write(priv, REG_VIP_CNTRL_1, priv->vip_cntrl_1);
- reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2);
-
- priv->is_on = true;
- } else {
- /* disable video ports */
- reg_write(priv, REG_ENA_VP_0, 0x00);
- reg_write(priv, REG_ENA_VP_1, 0x00);
- reg_write(priv, REG_ENA_VP_2, 0x00);
+static void tda998x_disable(struct tda998x_priv *priv)
+{
+ /* disable video ports */
+ reg_write(priv, REG_ENA_VP_0, 0x00);
+ reg_write(priv, REG_ENA_VP_1, 0x00);
+ reg_write(priv, REG_ENA_VP_2, 0x00);
- priv->is_on = false;
- }
+ priv->is_on = false;
+}
+
+static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+ struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+
+ /* we only care about on or off: */
+ if (mode == DRM_MODE_DPMS_ON)
+ tda998x_enable(priv);
+ else
+ tda998x_disable(priv);
}
static void
@@ -1606,12 +1612,16 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
static void tda998x_encoder_prepare(struct drm_encoder *encoder)
{
- tda998x_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+ struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+
+ tda998x_disable(priv);
}
static void tda998x_encoder_commit(struct drm_encoder *encoder)
{
- tda998x_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
+ struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+
+ tda998x_enable(priv);
}
static const struct drm_encoder_helper_funcs tda998x_encoder_helper_funcs = {
--
2.11.0
next prev parent reply other threads:[~2018-05-23 9:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 9:31 [PATCH v5 0/7] Add tda998x (HDMI) support to atmel-hlcdc Peter Rosin
2018-05-23 9:31 ` [PATCH v5 1/7] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin
2018-05-23 9:31 ` [PATCH v5 2/7] dt-bindings: display: atmel: optional video-interface of endpoints Peter Rosin
2018-05-23 9:31 ` [PATCH v5 3/7] drm/atmel-hlcdc: support bus-width (12/16/18/24) in endpoint nodes Peter Rosin
2018-05-23 9:31 ` [PATCH v5 4/7] drm/i2c: tda998x: find the drm_device via the drm_connector Peter Rosin
2018-05-23 9:31 ` Peter Rosin [this message]
2018-07-06 10:57 ` [PATCH v5 5/7] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable Russell King - ARM Linux
2018-05-23 9:31 ` [PATCH v5 6/7] drm/i2c: tda998x: split encoder and component functions from the work Peter Rosin
2018-05-23 9:31 ` [PATCH v5 7/7] drm/i2c: tda998x: register as a drm bridge Peter Rosin
2018-07-06 13:36 ` Russell King - ARM Linux
2018-07-06 14:57 ` Russell King - ARM Linux
2018-07-06 14:58 ` [PATCH 1/6] drm/i2c: tda998x: find the drm_device via the drm_connector Russell King
2018-07-06 14:58 ` [PATCH 2/6] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable Russell King
2018-07-06 14:58 ` [PATCH 3/6] drm/i2c: tda998x: move tda998x_set_config() into tda998x_create() Russell King
2018-07-06 14:59 ` [PATCH 4/6] drm/i2c: tda998x: convert to bridge driver Russell King
2018-07-07 6:19 ` kbuild test robot
2018-07-07 7:08 ` kbuild test robot
2018-07-06 14:59 ` [PATCH 5/6] drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create() Russell King
2018-07-06 14:59 ` [PATCH 6/6] drm/i2c: tda998x: cleanup from previous changes Russell King
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=20180523093122.27859-6-peda@axentia.se \
--to=peda@axentia.se \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=alexandre.belloni@bootlin.com \
--cc=boris.brezillon@bootlin.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacopo+renesas@jmondi.org \
--cc=jsarha@ti.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=nicolas.ferre@microchip.com \
--cc=robh+dt@kernel.org \
--subject='Re: [PATCH v5 5/7] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable' \
/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
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).