mirror of https://lore.kernel.org/lkml/
 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>,
	Archit Taneja <architt@codeaurora.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Gustavo Padovan <gustavo@padovan.org>,
	Sean Paul <seanpaul@chromium.org>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org
Subject: [RFC PATCH 3/3] drm: bridge: lvds-encoder: on request, override the bus format
Date: Sat, 17 Mar 2018 23:15:25 +0100	[thread overview]
Message-ID: <20180317221525.18534-4-peda@axentia.se> (raw)
In-Reply-To: <20180317221525.18534-1-peda@axentia.se>

If the bridge changes the bus format, allow this to be described in
the bridge, instead of providing false information about the bus
format of the panel itself.

Signed-off-by: Peter Rosin <peda@axentia.se>
---
 .../bindings/display/bridge/lvds-transmitter.txt       |  8 ++++++++
 drivers/gpu/drm/bridge/lvds-encoder.c                  | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
index 9d09190d9210..c0fbe74272e7 100644
--- a/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
+++ b/Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
@@ -29,6 +29,14 @@ Required properties:
 
 	      "ti,ds90c185"
 
+Optional properties:
+
+- interface-pix-fmt:
+	      Override the bus format of the panel, in case the bridge
+	      converts the signals. Recognized formats include:
+
+	      "rgb565"
+
 Required nodes:
 
 This device has two video ports. Their connections are modeled using the OF
diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
index 75b0d3f6e4de..acff3a5b0562 100644
--- a/drivers/gpu/drm/bridge/lvds-encoder.c
+++ b/drivers/gpu/drm/bridge/lvds-encoder.c
@@ -39,6 +39,9 @@ static int lvds_encoder_probe(struct platform_device *pdev)
 	struct device_node *panel_node;
 	struct drm_panel *panel;
 	struct lvds_encoder *lvds_encoder;
+	u32 bus_format = 0;
+	const char *fmt;
+	int ret;
 
 	lvds_encoder = devm_kzalloc(&pdev->dev, sizeof(*lvds_encoder),
 				    GFP_KERNEL);
@@ -79,6 +82,21 @@ static int lvds_encoder_probe(struct platform_device *pdev)
 	if (IS_ERR(lvds_encoder->panel_bridge))
 		return PTR_ERR(lvds_encoder->panel_bridge);
 
+	ret = of_property_read_string(pdev->dev.of_node,
+				      "interface-pix-fmt", &fmt);
+	if (!ret) {
+		if (!strcmp(fmt, "rgb565")) {
+			bus_format = MEDIA_BUS_FMT_RGB565_1X16;
+		} else {
+			dev_dbg(&pdev->dev,
+				"requested interface-pix-fmt not recognized\n");
+			return -EINVAL;
+		}
+	}
+	if (bus_format)
+		drm_panel_bridge_set_bus_format(lvds_encoder->panel_bridge,
+						bus_format);
+
 	/* The panel_bridge bridge is attached to the panel's of_node,
 	 * but we need a bridge attached to our of_node for our user
 	 * to look up.
-- 
2.11.0

  parent reply	other threads:[~2018-03-17 22:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-17 22:15 [RFC PATCH 0/3] allow override of bus format in bridges Peter Rosin
2018-03-17 22:15 ` [RFC PATCH 1/3] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin
2018-03-20 13:52   ` Laurent Pinchart
2018-03-17 22:15 ` [RFC PATCH 2/3] drm: bridge: panel: allow override of the bus format Peter Rosin
2018-03-20 13:56   ` Laurent Pinchart
2018-03-25 12:01     ` Peter Rosin
2018-03-26 19:03       ` Laurent Pinchart
2018-03-27  8:16         ` jacopo mondi
2018-04-03 22:18           ` Laurent Pinchart
2018-03-17 22:15 ` Peter Rosin [this message]
2018-03-20 14:00   ` [RFC PATCH 3/3] drm: bridge: lvds-encoder: on request, override " Laurent Pinchart
2018-03-20 13:47 ` [RFC PATCH 0/3] allow override of bus format in bridges 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=20180317221525.18534-4-peda@axentia.se \
    --to=peda@axentia.se \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=architt@codeaurora.org \
    --cc=daniel.vetter@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®