linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Igor Opanyuk <igor.opanyuk@toradex.com>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Stefan Agner <stefan@agner.ch>,
	Oleksandr Suvorov <oleksandr.suvorov@toradex.com>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	Sam Ravnborg <sam@ravnborg.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: [PATCH 1/3] drm/panel: make LVDS panel driver DPI capable
Date: Wed, 15 Jan 2020 12:34:17 +0000	[thread overview]
Message-ID: <20200115123401.2264293-2-oleksandr.suvorov@toradex.com> (raw)
In-Reply-To: <20200115123401.2264293-1-oleksandr.suvorov@toradex.com>

From: Stefan Agner <stefan@agner.ch>

The LVDS panel driver has almost everything which is required to
describe a simple parallel RGB panel (also known as DPI, Display
Pixel Interface).

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
---

 drivers/gpu/drm/panel/panel-lvds.c | 40 +++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index 5ce3f4a2b7a1..21a169aa3ae4 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -22,6 +22,11 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_panel.h>
 
+enum panel_type {
+	PANEL_LVDS,
+	PANEL_DPI
+};
+
 struct panel_lvds {
 	struct drm_panel panel;
 	struct device *dev;
@@ -115,6 +120,7 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 	struct display_timing timing;
 	const char *mapping;
 	int ret;
+	enum panel_type type;
 
 	ret = of_get_display_timing(np, "panel-timing", &timing);
 	if (ret < 0) {
@@ -147,13 +153,28 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 		return -ENODEV;
 	}
 
-	if (!strcmp(mapping, "jeida-18")) {
-		lvds->bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
-	} else if (!strcmp(mapping, "jeida-24")) {
-		lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
-	} else if (!strcmp(mapping, "vesa-24")) {
-		lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
-	} else {
+	type = (enum panel_type)of_device_get_match_data(lvds->dev);
+	switch (type) {
+	case PANEL_LVDS:
+		if (!strcmp(mapping, "jeida-18"))
+			lvds->bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
+		else if (!strcmp(mapping, "jeida-24"))
+			lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+		else if (!strcmp(mapping, "vesa-24"))
+			lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
+		break;
+	case PANEL_DPI:
+		if (!strcmp(mapping, "rgb24"))
+			lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
+		else if (!strcmp(mapping, "rgb565"))
+			lvds->bus_format = MEDIA_BUS_FMT_RGB565_1X16;
+		else if (!strcmp(mapping, "bgr666"))
+			lvds->bus_format = MEDIA_BUS_FMT_RGB666_1X18;
+		else if (!strcmp(mapping, "lvds666"))
+			lvds->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI;
+	};
+
+	if (!lvds->bus_format) {
 		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
 			np, "data-mapping");
 		return -EINVAL;
@@ -247,7 +268,8 @@ static int panel_lvds_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id panel_lvds_of_table[] = {
-	{ .compatible = "panel-lvds", },
+	{ .compatible = "panel-lvds", .data = (void *)PANEL_LVDS },
+	{ .compatible = "panel-dpi", .data = (void *)PANEL_DPI },
 	{ /* Sentinel */ },
 };
 
@@ -257,7 +279,7 @@ static struct platform_driver panel_lvds_driver = {
 	.probe		= panel_lvds_probe,
 	.remove		= panel_lvds_remove,
 	.driver		= {
-		.name	= "panel-lvds",
+		.name	= "panel-generic",
 		.of_match_table = panel_lvds_of_table,
 	},
 };
-- 
2.24.1


  reply	other threads:[~2020-01-15 12:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 12:34 [PATCH 0/3] Generic DPI panel on Colibri iMX7 / Col.Eval.board Oleksandr Suvorov
2020-01-15 12:34 ` Oleksandr Suvorov [this message]
2020-01-18 13:04   ` [PATCH 1/3] drm/panel: make LVDS panel driver DPI capable Sam Ravnborg
2020-01-20  9:57     ` Oleksandr Suvorov
2020-01-20 20:20       ` Sam Ravnborg
2020-01-15 12:34 ` [PATCH 2/3] drm/panel: pass video modes bus_flags Oleksandr Suvorov
2020-01-15 12:34 ` [PATCH 3/3] ARM: dts: imx7-colibri: add generic RGB (DPI) panel Oleksandr Suvorov

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=20200115123401.2264293-2-oleksandr.suvorov@toradex.com \
    --to=oleksandr.suvorov@toradex.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=igor.opanyuk@toradex.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel.ziswiler@toradex.com \
    --cc=sam@ravnborg.org \
    --cc=stefan@agner.ch \
    --cc=thierry.reding@gmail.com \
    /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).