All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH v2 08/28] drm: omapdrm: dpi: Replace OMAP SoC model checks with DSS device type
Date: Mon,  8 May 2017 14:32:43 +0300	[thread overview]
Message-ID: <20170508113303.27521-9-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20170508113303.27521-1-laurent.pinchart@ideasonboard.com>

The DPI code only needs to differentiate between major OMAP revisions,
which can be obtained from the DSS compatible string. Replace the OMAP
SoC model checks to prepare for removal of the OMAP SoC version platform
data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/dpi.c | 59 +++++++++++++++++----------------------
 drivers/gpu/drm/omapdrm/dss/dss.c | 10 ++++++-
 drivers/gpu/drm/omapdrm/dss/dss.h | 13 +++++++--
 3 files changed, 45 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 3d87f3af72bb..b5cb23c167db 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -39,6 +39,7 @@
 
 struct dpi_data {
 	struct platform_device *pdev;
+	enum dss_device_type type;
 
 	struct regulator *vdds_dsi_reg;
 	enum dss_clk_source clk_src;
@@ -60,25 +61,21 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
 	return container_of(dssdev, struct dpi_data, output);
 }
 
-static enum dss_clk_source dpi_get_clk_src(enum omap_channel channel)
+static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi)
 {
+	enum omap_channel channel = dpi->output.dispc_channel;
+
 	/*
 	 * XXX we can't currently use DSI PLL for DPI with OMAP3, as the DSI PLL
 	 * would also be used for DISPC fclk. Meaning, when the DPI output is
 	 * disabled, DISPC clock will be disabled, and TV out will stop.
 	 */
-	switch (omapdss_get_version()) {
-	case OMAPDSS_VER_OMAP24xx:
-	case OMAPDSS_VER_OMAP34xx_ES1:
-	case OMAPDSS_VER_OMAP34xx_ES3:
-	case OMAPDSS_VER_OMAP3630:
-	case OMAPDSS_VER_AM35xx:
-	case OMAPDSS_VER_AM43xx:
+	switch (dpi->type) {
+	case DSS_TYPE_OMAP2:
+	case DSS_TYPE_OMAP3:
 		return DSS_CLK_SRC_FCK;
 
-	case OMAPDSS_VER_OMAP4430_ES1:
-	case OMAPDSS_VER_OMAP4430_ES2:
-	case OMAPDSS_VER_OMAP4:
+	case DSS_TYPE_OMAP4:
 		switch (channel) {
 		case OMAP_DSS_CHANNEL_LCD:
 			return DSS_CLK_SRC_PLL1_1;
@@ -88,7 +85,7 @@ static enum dss_clk_source dpi_get_clk_src(enum omap_channel channel)
 			return DSS_CLK_SRC_FCK;
 		}
 
-	case OMAPDSS_VER_OMAP5:
+	case DSS_TYPE_OMAP5:
 		switch (channel) {
 		case OMAP_DSS_CHANNEL_LCD:
 			return DSS_CLK_SRC_PLL1_1;
@@ -99,7 +96,7 @@ static enum dss_clk_source dpi_get_clk_src(enum omap_channel channel)
 			return DSS_CLK_SRC_FCK;
 		}
 
-	case OMAPDSS_VER_DRA7xx:
+	case DSS_TYPE_DRA7:
 		switch (channel) {
 		case OMAP_DSS_CHANNEL_LCD:
 			return DSS_CLK_SRC_PLL1_1;
@@ -593,7 +590,7 @@ static void dpi_init_pll(struct dpi_data *dpi)
 	if (dpi->pll)
 		return;
 
-	dpi->clk_src = dpi_get_clk_src(dpi->output.dispc_channel);
+	dpi->clk_src = dpi_get_clk_src(dpi);
 
 	pll = dss_pll_find_by_src(dpi->clk_src);
 	if (!pll)
@@ -613,18 +610,14 @@ static void dpi_init_pll(struct dpi_data *dpi)
  * the channel in some more dynamic manner, or get the channel as a user
  * parameter.
  */
-static enum omap_channel dpi_get_channel(int port_num)
+static enum omap_channel dpi_get_channel(struct dpi_data *dpi, int port_num)
 {
-	switch (omapdss_get_version()) {
-	case OMAPDSS_VER_OMAP24xx:
-	case OMAPDSS_VER_OMAP34xx_ES1:
-	case OMAPDSS_VER_OMAP34xx_ES3:
-	case OMAPDSS_VER_OMAP3630:
-	case OMAPDSS_VER_AM35xx:
-	case OMAPDSS_VER_AM43xx:
+	switch (dpi->type) {
+	case DSS_TYPE_OMAP2:
+	case DSS_TYPE_OMAP3:
 		return OMAP_DSS_CHANNEL_LCD;
 
-	case OMAPDSS_VER_DRA7xx:
+	case DSS_TYPE_DRA7:
 		switch (port_num) {
 		case 2:
 			return OMAP_DSS_CHANNEL_LCD3;
@@ -635,12 +628,10 @@ static enum omap_channel dpi_get_channel(int port_num)
 			return OMAP_DSS_CHANNEL_LCD;
 		}
 
-	case OMAPDSS_VER_OMAP4430_ES1:
-	case OMAPDSS_VER_OMAP4430_ES2:
-	case OMAPDSS_VER_OMAP4:
+	case DSS_TYPE_OMAP4:
 		return OMAP_DSS_CHANNEL_LCD2;
 
-	case OMAPDSS_VER_OMAP5:
+	case DSS_TYPE_OMAP5:
 		return OMAP_DSS_CHANNEL_LCD3;
 
 	default:
@@ -707,10 +698,8 @@ static const struct omapdss_dpi_ops dpi_ops = {
 	.set_data_lines = dpi_set_data_lines,
 };
 
-static void dpi_init_output_port(struct platform_device *pdev,
-	struct device_node *port)
+static void dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
 {
-	struct dpi_data *dpi = port->data;
 	struct omap_dss_device *out = &dpi->output;
 	int r;
 	u32 port_num;
@@ -732,10 +721,10 @@ static void dpi_init_output_port(struct platform_device *pdev,
 		break;
 	}
 
-	out->dev = &pdev->dev;
+	out->dev = &dpi->pdev->dev;
 	out->id = OMAP_DSS_OUTPUT_DPI;
 	out->output_type = OMAP_DISPLAY_TYPE_DPI;
-	out->dispc_channel = dpi_get_channel(port_num);
+	out->dispc_channel = dpi_get_channel(dpi, port_num);
 	out->port_num = port_num;
 	out->ops.dpi = &dpi_ops;
 	out->owner = THIS_MODULE;
@@ -751,7 +740,8 @@ static void dpi_uninit_output_port(struct device_node *port)
 	omapdss_unregister_output(out);
 }
 
-int dpi_init_port(struct platform_device *pdev, struct device_node *port)
+int dpi_init_port(struct platform_device *pdev, struct device_node *port,
+		  enum dss_device_type type)
 {
 	struct dpi_data *dpi;
 	struct device_node *ep;
@@ -777,11 +767,12 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port)
 	of_node_put(ep);
 
 	dpi->pdev = pdev;
+	dpi->type = type;
 	port->data = dpi;
 
 	mutex_init(&dpi->lock);
 
-	dpi_init_output_port(pdev, port);
+	dpi_init_output_port(dpi, port);
 
 	dpi->port_initialized = true;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index fb57c0471000..6196f3ab73b7 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -69,6 +69,7 @@ struct dss_reg {
 	dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end))
 
 struct dss_features {
+	enum dss_device_type type;
 	u8 fck_div_max;
 	u8 dss_fck_multiplier;
 	const char *parent_clk_name;
@@ -916,6 +917,7 @@ static const enum omap_display_type dra7xx_ports[] = {
 };
 
 static const struct dss_features omap24xx_dss_feats = {
+	.type			=	DSS_TYPE_OMAP2,
 	/*
 	 * fck div max is really 16, but the divider range has gaps. The range
 	 * from 1 to 6 has no gaps, so let's use that as a max.
@@ -929,6 +931,7 @@ static const struct dss_features omap24xx_dss_feats = {
 };
 
 static const struct dss_features omap34xx_dss_feats = {
+	.type			=	DSS_TYPE_OMAP3,
 	.fck_div_max		=	16,
 	.dss_fck_multiplier	=	2,
 	.parent_clk_name	=	"dpll4_ck",
@@ -938,6 +941,7 @@ static const struct dss_features omap34xx_dss_feats = {
 };
 
 static const struct dss_features omap3630_dss_feats = {
+	.type			=	DSS_TYPE_OMAP3,
 	.fck_div_max		=	32,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll4_ck",
@@ -947,6 +951,7 @@ static const struct dss_features omap3630_dss_feats = {
 };
 
 static const struct dss_features omap44xx_dss_feats = {
+	.type			=	DSS_TYPE_OMAP4,
 	.fck_div_max		=	32,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll_per_x2_ck",
@@ -957,6 +962,7 @@ static const struct dss_features omap44xx_dss_feats = {
 };
 
 static const struct dss_features omap54xx_dss_feats = {
+	.type			=	DSS_TYPE_OMAP5,
 	.fck_div_max		=	64,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll_per_x2_ck",
@@ -967,6 +973,7 @@ static const struct dss_features omap54xx_dss_feats = {
 };
 
 static const struct dss_features am43xx_dss_feats = {
+	.type			=	DSS_TYPE_OMAP3,
 	.fck_div_max		=	0,
 	.dss_fck_multiplier	=	0,
 	.parent_clk_name	=	NULL,
@@ -976,6 +983,7 @@ static const struct dss_features am43xx_dss_feats = {
 };
 
 static const struct dss_features dra7xx_dss_feats = {
+	.type			=	DSS_TYPE_DRA7,
 	.fck_div_max		=	64,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll_per_x2_ck",
@@ -1070,7 +1078,7 @@ static int dss_init_ports(struct platform_device *pdev)
 
 		switch (port_type) {
 		case OMAP_DISPLAY_TYPE_DPI:
-			dpi_init_port(pdev, port);
+			dpi_init_port(pdev, port, dss.feat->type);
 			break;
 		case OMAP_DISPLAY_TYPE_SDI:
 			sdi_init_port(pdev, port);
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index 983838b4f45b..6360feea87cb 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -75,6 +75,14 @@
 #define FLD_MOD(orig, val, start, end) \
 	(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
 
+enum dss_device_type {
+	DSS_TYPE_OMAP2,
+	DSS_TYPE_OMAP3,
+	DSS_TYPE_OMAP4,
+	DSS_TYPE_OMAP5,
+	DSS_TYPE_DRA7,
+};
+
 enum dss_io_pad_mode {
 	DSS_IO_PAD_MODE_RESET,
 	DSS_IO_PAD_MODE_RFBI,
@@ -330,11 +338,12 @@ static inline u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
 
 /* DPI */
 #ifdef CONFIG_OMAP2_DSS_DPI
-int dpi_init_port(struct platform_device *pdev, struct device_node *port);
+int dpi_init_port(struct platform_device *pdev, struct device_node *port,
+		  enum dss_device_type type);
 void dpi_uninit_port(struct device_node *port);
 #else
 static inline int dpi_init_port(struct platform_device *pdev,
-		struct device_node *port)
+		struct device_node *port, enum dss_device_type type)
 {
 	return 0;
 }
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-05-08 11:33 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 11:32 [PATCH v2 00/29] Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 01/28] drm: omapdrm: Remove duplicate error messages when mapping memory Laurent Pinchart
2017-05-08 12:52   ` Tomi Valkeinen
2017-05-08 13:55     ` Laurent Pinchart
2017-05-09  8:37       ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 02/28] drm: omapdrm: Drop support for non-DT devices Laurent Pinchart
2017-05-09  8:40   ` Tomi Valkeinen
2017-05-09  8:46     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 03/28] drm: omapdrm: Remove unused dss_get_core_pdev() function Laurent Pinchart
2017-05-09  8:57   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 04/28] drm: omapdrm: Remove unused default display name support Laurent Pinchart
2017-05-08 12:30   ` Bartlomiej Zolnierkiewicz
2017-05-09  8:58   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 05/28] drm: omapdrm: Infer the OMAP version from the SoC family Laurent Pinchart
2017-05-09  9:02   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 06/28] drm: omapdrm: dispc: Select features based on compatible string Laurent Pinchart
2017-05-09  9:04   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 07/28] drm: omapdrm: dpi: Remove platform driver Laurent Pinchart
2017-05-09  9:06   ` Tomi Valkeinen
2017-05-09 21:38     ` Laurent Pinchart
2017-05-08 11:32 ` Laurent Pinchart [this message]
2017-05-09  9:23   ` [PATCH v2 08/28] drm: omapdrm: dpi: Replace OMAP SoC model checks with DSS device type Tomi Valkeinen
2017-05-09 22:24     ` Laurent Pinchart
2017-05-09 22:26       ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 09/28] drm: omapdrm: dsi: Store DSI type and PLL hardware data in OF data Laurent Pinchart
2017-05-09  9:31   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 10/28] drm: omapdrm: dsi: Handle pin muxing internally Laurent Pinchart
2017-05-09  9:37   ` Tomi Valkeinen
2017-05-09 21:45     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 11/28] drm: omapdrm: dss: Select features based on compatible string Laurent Pinchart
2017-05-09  9:41   ` Tomi Valkeinen
2017-05-09 21:47     ` Laurent Pinchart
2017-05-10  6:52       ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 12/28] drm: omapdrm: dss: Split operations out of dss_features structure Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 13/28] drm: omapdrm: dss: Initialize DSS internal features at probe time Laurent Pinchart
2017-05-09  9:48   ` Tomi Valkeinen
2017-05-09 21:49     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 14/28] drm: omapdrm: hdmi: Store PHY features in PHY data structure Laurent Pinchart
2017-05-09 11:14   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 15/28] drm: omapdrm: hdmi: Store PHY features in HDMI transmitter drivers Laurent Pinchart
2017-05-09 11:27   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 16/28] drm: omapdrm: hdmi: Store PLL hardware data " Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 17/28] drm: omapdrm: hdmi: Replace OMAP SoC model check with HDMI xmit version Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 18/28] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio Laurent Pinchart
2017-05-14  9:28   ` Mark Brown
2017-05-08 11:32 ` [PATCH v2 19/28] drm: omapdrm: sdi: Remove platform driver Laurent Pinchart
2017-05-09 11:29   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 20/28] drm: omapdrm: Don't forward set_min_bus_tput() to no-op platform code Laurent Pinchart
2017-05-09 11:30   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 21/28] drm: omapdrm: Move all debugfs code from core to dss Laurent Pinchart
2017-05-09 11:35   ` Tomi Valkeinen
2017-05-08 11:32 ` [PATCH v2 22/28] drm: omapdrm: Move shutdown() handler " Laurent Pinchart
2017-05-09 11:38   ` Tomi Valkeinen
2017-05-09 21:42     ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 23/28] drm: omapdrm: Merge the dss_features and omap_dss_features structures Laurent Pinchart
2017-05-09 12:02   ` Tomi Valkeinen
2017-05-09 22:09     ` Laurent Pinchart
2017-05-10  7:43       ` Tomi Valkeinen
2017-05-13 11:12         ` Laurent Pinchart
2017-05-15  6:32           ` Tomi Valkeinen
2017-08-04 14:03             ` Laurent Pinchart
2017-05-08 11:32 ` [PATCH v2 24/28] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
2017-05-09 11:48   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 25/28] drm: omapdrm: Remove the " Laurent Pinchart
2017-05-09 11:49   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 26/28] ARM: OMAP2+: Remove unused omapdrm platform device Laurent Pinchart
2017-05-08 17:09   ` Tony Lindgren
2017-05-09  8:49     ` Laurent Pinchart
2017-05-09 11:49   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 27/28] ARM: OMAP2+: Don't register omapdss device for omapdrm Laurent Pinchart
2017-05-08 17:09   ` Tony Lindgren
2017-05-09 11:51   ` Tomi Valkeinen
2017-05-08 11:33 ` [PATCH v2 28/28] drm: omapdrm: Remove omapdrm platform data Laurent Pinchart
2017-05-09 11:51   ` Tomi Valkeinen
2017-05-08 17:07 ` [PATCH v2 00/29] Remove the omapdrm and omapdss devices from platform code Tony Lindgren
2017-05-09 11:53   ` Tomi Valkeinen
2017-05-09 13:54     ` Tony Lindgren
2017-05-09 12:10 ` Tomi Valkeinen
2017-05-09 15:05   ` Sebastian Reichel
2017-05-10  7:23     ` Tomi Valkeinen
2017-05-10 16:46       ` Tony Lindgren
2017-05-10 17:40         ` Tomi Valkeinen
2017-05-10 18:29           ` Tony Lindgren
2017-05-11  8:34             ` Tomi Valkeinen
2017-05-11 14:16               ` Tony Lindgren
2017-05-12  7:29                 ` Tomi Valkeinen
2017-05-12 15:03                   ` Tony Lindgren
2017-05-09 22:18   ` Laurent Pinchart
2017-05-10  6:48     ` Tomi Valkeinen

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=20170508113303.27521-9-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ti.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 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.