All of 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@free-electrons.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Gustavo Padovan <gustavo@padovan.org>,
	Sean Paul <seanpaul@chromium.org>,
	Russell King <linux@armlinux.org.uk>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 6/7] drm/i2c: tda998x: split encoder and component functions from the work
Date: Thu, 19 Apr 2018 18:27:50 +0200	[thread overview]
Message-ID: <20180419162751.25223-7-peda@axentia.se> (raw)
In-Reply-To: <20180419162751.25223-1-peda@axentia.se>

This enables reuse of the machinery for the case where a drm_bridge
needs to do the same work via different interfaces.

Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 46 ++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 8f6e013f2b87..9c78f7bde49c 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1163,9 +1163,8 @@ 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_dpms(struct tda998x_priv *priv, int mode)
 {
-	struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
 	bool on;
 
 	/* we only care about on or off: */
@@ -1195,12 +1194,18 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
 	}
 }
 
-static void
-tda998x_encoder_mode_set(struct drm_encoder *encoder,
-			 struct drm_display_mode *mode,
-			 struct drm_display_mode *adjusted_mode)
+static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+
+	tda998x_dpms(priv, mode);
+}
+
+static void
+tda998x_mode_set(struct tda998x_priv *priv,
+		 struct drm_display_mode *mode,
+		 struct drm_display_mode *adjusted_mode)
+{
 	u16 ref_pix, ref_line, n_pix, n_line;
 	u16 hs_pix_s, hs_pix_e;
 	u16 vs1_pix_s, vs1_pix_e, vs1_line_s, vs1_line_e;
@@ -1407,6 +1412,16 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
 	mutex_unlock(&priv->audio_mutex);
 }
 
+static void
+tda998x_encoder_mode_set(struct drm_encoder *encoder,
+			 struct drm_display_mode *mode,
+			 struct drm_display_mode *adjusted_mode)
+{
+	struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+
+	tda998x_mode_set(priv, mode, adjusted_mode);
+}
+
 static void tda998x_destroy(struct tda998x_priv *priv)
 {
 	/* disable all IRQs and free the IRQ handler */
@@ -1653,11 +1668,10 @@ static void tda998x_set_config(struct tda998x_priv *priv,
 	priv->audio_params = p->audio_params;
 }
 
-static int tda998x_bind(struct device *dev, struct device *master, void *data)
+static int tda998x_init(struct device *dev, struct drm_device *drm)
 {
 	struct tda998x_encoder_params *params = dev->platform_data;
 	struct i2c_client *client = to_i2c_client(dev);
-	struct drm_device *drm = data;
 	struct tda998x_priv *priv;
 	u32 crtcs = 0;
 	int ret;
@@ -1705,8 +1719,7 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
 	return ret;
 }
 
-static void tda998x_unbind(struct device *dev, struct device *master,
-			   void *data)
+static void tda998x_fini(struct device *dev)
 {
 	struct tda998x_priv *priv = dev_get_drvdata(dev);
 
@@ -1715,6 +1728,19 @@ static void tda998x_unbind(struct device *dev, struct device *master,
 	tda998x_destroy(priv);
 }
 
+static int tda998x_bind(struct device *dev, struct device *master, void *data)
+{
+	struct drm_device *drm = data;
+
+	return tda998x_init(dev, drm);
+}
+
+static void tda998x_unbind(struct device *dev, struct device *master,
+			   void *data)
+{
+	tda998x_fini(dev);
+}
+
 static const struct component_ops tda998x_ops = {
 	.bind = tda998x_bind,
 	.unbind = tda998x_unbind,
-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: peda@axentia.se (Peter Rosin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 6/7] drm/i2c: tda998x: split encoder and component functions from the work
Date: Thu, 19 Apr 2018 18:27:50 +0200	[thread overview]
Message-ID: <20180419162751.25223-7-peda@axentia.se> (raw)
In-Reply-To: <20180419162751.25223-1-peda@axentia.se>

This enables reuse of the machinery for the case where a drm_bridge
needs to do the same work via different interfaces.

Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 46 ++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 8f6e013f2b87..9c78f7bde49c 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1163,9 +1163,8 @@ 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_dpms(struct tda998x_priv *priv, int mode)
 {
-	struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
 	bool on;
 
 	/* we only care about on or off: */
@@ -1195,12 +1194,18 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
 	}
 }
 
-static void
-tda998x_encoder_mode_set(struct drm_encoder *encoder,
-			 struct drm_display_mode *mode,
-			 struct drm_display_mode *adjusted_mode)
+static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+
+	tda998x_dpms(priv, mode);
+}
+
+static void
+tda998x_mode_set(struct tda998x_priv *priv,
+		 struct drm_display_mode *mode,
+		 struct drm_display_mode *adjusted_mode)
+{
 	u16 ref_pix, ref_line, n_pix, n_line;
 	u16 hs_pix_s, hs_pix_e;
 	u16 vs1_pix_s, vs1_pix_e, vs1_line_s, vs1_line_e;
@@ -1407,6 +1412,16 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
 	mutex_unlock(&priv->audio_mutex);
 }
 
+static void
+tda998x_encoder_mode_set(struct drm_encoder *encoder,
+			 struct drm_display_mode *mode,
+			 struct drm_display_mode *adjusted_mode)
+{
+	struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
+
+	tda998x_mode_set(priv, mode, adjusted_mode);
+}
+
 static void tda998x_destroy(struct tda998x_priv *priv)
 {
 	/* disable all IRQs and free the IRQ handler */
@@ -1653,11 +1668,10 @@ static void tda998x_set_config(struct tda998x_priv *priv,
 	priv->audio_params = p->audio_params;
 }
 
-static int tda998x_bind(struct device *dev, struct device *master, void *data)
+static int tda998x_init(struct device *dev, struct drm_device *drm)
 {
 	struct tda998x_encoder_params *params = dev->platform_data;
 	struct i2c_client *client = to_i2c_client(dev);
-	struct drm_device *drm = data;
 	struct tda998x_priv *priv;
 	u32 crtcs = 0;
 	int ret;
@@ -1705,8 +1719,7 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
 	return ret;
 }
 
-static void tda998x_unbind(struct device *dev, struct device *master,
-			   void *data)
+static void tda998x_fini(struct device *dev)
 {
 	struct tda998x_priv *priv = dev_get_drvdata(dev);
 
@@ -1715,6 +1728,19 @@ static void tda998x_unbind(struct device *dev, struct device *master,
 	tda998x_destroy(priv);
 }
 
+static int tda998x_bind(struct device *dev, struct device *master, void *data)
+{
+	struct drm_device *drm = data;
+
+	return tda998x_init(dev, drm);
+}
+
+static void tda998x_unbind(struct device *dev, struct device *master,
+			   void *data)
+{
+	tda998x_fini(dev);
+}
+
 static const struct component_ops tda998x_ops = {
 	.bind = tda998x_bind,
 	.unbind = tda998x_unbind,
-- 
2.11.0

  parent reply	other threads:[~2018-04-19 16:29 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 16:27 [PATCH v3 0/7] Add tda998x (HDMI) support to atmel-hlcdc Peter Rosin
2018-04-19 16:27 ` Peter Rosin
2018-04-19 16:27 ` [PATCH v3 1/7] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin
2018-04-19 16:27   ` [PATCH v3 1/7] dt-bindings: display: bridge: lvds-transmitter: add ti, ds90c185 Peter Rosin
2018-04-19 16:27 ` [PATCH v3 2/7] dt-bindings: display: atmel: optional video-interface of endpoints Peter Rosin
2018-04-19 16:27   ` Peter Rosin
2018-04-19 16:27 ` [PATCH v3 3/7] drm: of: introduce drm_of_media_bus_fmt Peter Rosin
2018-04-19 16:27   ` Peter Rosin
2018-04-19 16:27 ` [PATCH v3 4/7] drm/atmel-hlcdc: support bus-width (12/16/18/24) in endpoint nodes Peter Rosin
2018-04-19 16:27   ` Peter Rosin
2018-04-21 16:19   ` Boris Brezillon
2018-04-21 16:19     ` Boris Brezillon
2018-04-21 16:19     ` Boris Brezillon
2018-04-21 22:13     ` Peter Rosin
2018-04-21 22:13       ` Peter Rosin
2018-04-19 16:27 ` [PATCH v3 5/7] drm/i2c: tda998x: find the drm_device via the drm_connector Peter Rosin
2018-04-19 16:27   ` Peter Rosin
2018-04-20  9:41   ` Laurent Pinchart
2018-04-20  9:41     ` Laurent Pinchart
2018-04-19 16:27 ` Peter Rosin [this message]
2018-04-19 16:27   ` [PATCH v3 6/7] drm/i2c: tda998x: split encoder and component functions from the work Peter Rosin
2018-04-20  9:51   ` Laurent Pinchart
2018-04-20  9:51     ` Laurent Pinchart
2018-04-19 16:27 ` [PATCH v3 7/7] drm/i2c: tda998x: register as a drm bridge Peter Rosin
2018-04-19 16:27   ` Peter Rosin
2018-04-20 10:06   ` Laurent Pinchart
2018-04-20 10:06     ` Laurent Pinchart
2018-04-20 10:06     ` Laurent Pinchart
2018-04-20 10:24     ` Russell King - ARM Linux
2018-04-20 10:24       ` Russell King - ARM Linux
2018-04-20 13:28       ` Peter Rosin
2018-04-20 13:28         ` Peter Rosin
2018-04-20 10:41   ` kbuild test robot
2018-04-20 10:41     ` kbuild test robot
2018-04-20 10:41     ` kbuild test robot
2018-04-20 10:49     ` Peter Rosin
2018-04-20 10:49       ` Peter Rosin
2018-04-20 10:53       ` Russell King - ARM Linux
2018-04-20 10:53         ` Russell King - ARM Linux
2018-04-20 13:09         ` Peter Rosin
2018-04-20 13:09           ` Peter Rosin
2018-04-20 12:00   ` Russell King - ARM Linux
2018-04-20 12:00     ` Russell King - ARM Linux
2018-04-20  8:52 ` [PATCH v3 0/7] Add tda998x (HDMI) support to atmel-hlcdc jacopo mondi
2018-04-20  8:52   ` jacopo mondi
2018-04-20  8:52   ` jacopo mondi
2018-04-20 10:18   ` Laurent Pinchart
2018-04-20 10:18     ` Laurent Pinchart
2018-04-20 10:18     ` Laurent Pinchart
2018-04-20 11:05     ` Peter Rosin
2018-04-20 11:05       ` Peter Rosin
2018-04-20 11:38       ` jacopo mondi
2018-04-20 11:38         ` jacopo mondi
2018-04-20 11:38         ` jacopo mondi
2018-04-20 12:55         ` Peter Rosin
2018-04-20 12:55           ` Peter Rosin
2018-04-21  8:38           ` Laurent Pinchart
2018-04-21  8:38             ` Laurent Pinchart
2018-04-21  8:38             ` Laurent Pinchart
2018-04-21 15:05             ` Peter Rosin
2018-04-21 15:05               ` Peter Rosin
2018-04-20 11:22     ` jacopo mondi
2018-04-20 11:22       ` jacopo mondi
2018-04-20 11:22       ` jacopo mondi
2018-04-21  8:20       ` Laurent Pinchart
2018-04-21  8:20         ` Laurent Pinchart
2018-04-21  8:20         ` Laurent Pinchart

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=20180419162751.25223-7-peda@axentia.se \
    --to=peda@axentia.se \
    --cc=airlied@linux.ie \
    --cc=alexandre.belloni@bootlin.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=daniel.vetter@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=jacopo+renesas@jmondi.org \
    --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 \
    --cc=seanpaul@chromium.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 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.