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 v3 12/35] drm: omapdrm: dpi: Replace OMAP SoC model checks with DSS model
Date: Sat,  5 Aug 2017 01:43:56 +0300	[thread overview]
Message-ID: <20170804224419.30758-13-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20170804224419.30758-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>
---
Changes since v2:

- Rename dss_device_type to dss_model
---
 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 2828b1c1f625..857d462b3786 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_model dss_model;
 
 	struct regulator *vdds_dsi_reg;
 	enum dss_clk_source clk_src;
@@ -99,25 +100,21 @@ static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel)
 	return DSS_CLK_SRC_FCK;
 }
 
-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->dss_model) {
+	case DSS_MODEL_OMAP2:
+	case DSS_MODEL_OMAP3:
 		return DSS_CLK_SRC_FCK;
 
-	case OMAPDSS_VER_OMAP4430_ES1:
-	case OMAPDSS_VER_OMAP4430_ES2:
-	case OMAPDSS_VER_OMAP4:
+	case DSS_MODEL_OMAP4:
 		switch (channel) {
 		case OMAP_DSS_CHANNEL_LCD:
 			return DSS_CLK_SRC_PLL1_1;
@@ -127,7 +124,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_MODEL_OMAP5:
 		switch (channel) {
 		case OMAP_DSS_CHANNEL_LCD:
 			return DSS_CLK_SRC_PLL1_1;
@@ -138,7 +135,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_MODEL_DRA7:
 		return dpi_get_clk_src_dra7xx(channel);
 
 	default:
@@ -597,7 +594,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)
@@ -617,18 +614,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->dss_model) {
+	case DSS_MODEL_OMAP2:
+	case DSS_MODEL_OMAP3:
 		return OMAP_DSS_CHANNEL_LCD;
 
-	case OMAPDSS_VER_DRA7xx:
+	case DSS_MODEL_DRA7:
 		switch (port_num) {
 		case 2:
 			return OMAP_DSS_CHANNEL_LCD3;
@@ -639,12 +632,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_MODEL_OMAP4:
 		return OMAP_DSS_CHANNEL_LCD2;
 
-	case OMAPDSS_VER_OMAP5:
+	case DSS_MODEL_OMAP5:
 		return OMAP_DSS_CHANNEL_LCD3;
 
 	default:
@@ -709,10 +700,8 @@ static const struct omapdss_dpi_ops dpi_ops = {
 	.get_timings = dpi_get_timings,
 };
 
-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;
@@ -734,10 +723,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;
@@ -753,7 +742,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_model dss_model)
 {
 	struct dpi_data *dpi;
 	struct device_node *ep;
@@ -779,11 +769,12 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port)
 	of_node_put(ep);
 
 	dpi->pdev = pdev;
+	dpi->dss_model = dss_model;
 	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 b8a2f92efcba..7be69b1d535a 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -76,6 +76,7 @@ struct dss_ops {
 };
 
 struct dss_features {
+	enum dss_model model;
 	u8 fck_div_max;
 	u8 dss_fck_multiplier;
 	const char *parent_clk_name;
@@ -932,6 +933,7 @@ static const enum omap_display_type dra7xx_ports[] = {
 };
 
 static const struct dss_features omap24xx_dss_feats = {
+	.model			=	DSS_MODEL_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.
@@ -945,6 +947,7 @@ static const struct dss_features omap24xx_dss_feats = {
 };
 
 static const struct dss_features omap34xx_dss_feats = {
+	.model			=	DSS_MODEL_OMAP3,
 	.fck_div_max		=	16,
 	.dss_fck_multiplier	=	2,
 	.parent_clk_name	=	"dpll4_ck",
@@ -954,6 +957,7 @@ static const struct dss_features omap34xx_dss_feats = {
 };
 
 static const struct dss_features omap3630_dss_feats = {
+	.model			=	DSS_MODEL_OMAP3,
 	.fck_div_max		=	32,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll4_ck",
@@ -963,6 +967,7 @@ static const struct dss_features omap3630_dss_feats = {
 };
 
 static const struct dss_features omap44xx_dss_feats = {
+	.model			=	DSS_MODEL_OMAP4,
 	.fck_div_max		=	32,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll_per_x2_ck",
@@ -972,6 +977,7 @@ static const struct dss_features omap44xx_dss_feats = {
 };
 
 static const struct dss_features omap54xx_dss_feats = {
+	.model			=	DSS_MODEL_OMAP5,
 	.fck_div_max		=	64,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll_per_x2_ck",
@@ -981,6 +987,7 @@ static const struct dss_features omap54xx_dss_feats = {
 };
 
 static const struct dss_features am43xx_dss_feats = {
+	.model			=	DSS_MODEL_OMAP3,
 	.fck_div_max		=	0,
 	.dss_fck_multiplier	=	0,
 	.parent_clk_name	=	NULL,
@@ -990,6 +997,7 @@ static const struct dss_features am43xx_dss_feats = {
 };
 
 static const struct dss_features dra7xx_dss_feats = {
+	.model			=	DSS_MODEL_DRA7,
 	.fck_div_max		=	64,
 	.dss_fck_multiplier	=	1,
 	.parent_clk_name	=	"dpll_per_x2_ck",
@@ -1065,7 +1073,7 @@ static int dss_init_ports(struct platform_device *pdev)
 
 		switch (dss.feat->ports[i]) {
 		case OMAP_DISPLAY_TYPE_DPI:
-			dpi_init_port(pdev, port);
+			dpi_init_port(pdev, port, dss.feat->model);
 			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 136977cb1aeb..0d595a2ee200 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -72,6 +72,14 @@
 #define FLD_MOD(orig, val, start, end) \
 	(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
 
+enum dss_model {
+	DSS_MODEL_OMAP2,
+	DSS_MODEL_OMAP3,
+	DSS_MODEL_OMAP4,
+	DSS_MODEL_OMAP5,
+	DSS_MODEL_DRA7,
+};
+
 enum dss_io_pad_mode {
 	DSS_IO_PAD_MODE_RESET,
 	DSS_IO_PAD_MODE_RFBI,
@@ -315,11 +323,12 @@ void dsi_irq_handler(void);
 
 /* 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_model dss_model);
 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_model dss_model)
 {
 	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-08-04 22:44 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 22:43 [PATCH v3 00/35] omapdrm: Deconstruct DSS features Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 01/35] ARM: OMAP2+: Register SoC device attributes from machine .init() Laurent Pinchart
2017-08-09 12:56   ` Tomi Valkeinen
2017-08-09 21:49     ` Tony Lindgren
2017-08-04 22:43 ` [PATCH v3 02/35] drm: omapdrm: acx565akm: Remove unneeded check for OF node Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 03/35] drm: omapdrm: connector-analog-tv: " Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 04/35] drm: omapdrm: panel-dpi: " Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 05/35] drm: omapdrm: dpi: Remove unneeded regulator check Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 06/35] drm: omapdrm: venc: Don't export omap_dss_pal_vm and omap_dss_ntsc_vm Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 07/35] drm: omapdrm: hdmi: Store PHY features in PHY data structure Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 08/35] drm: omapdrm: dss: Split operations out of dss_features structure Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 09/35] drm: omapdrm: dsi: Handle pin muxing internally Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 10/35] drm: omapdrm: Don't forward set_min_bus_tput() to no-op platform code Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 11/35] drm: omapdrm: dispc: Select features based on compatible string Laurent Pinchart
2017-08-04 22:43 ` Laurent Pinchart [this message]
2017-08-04 22:43 ` [PATCH v3 13/35] drm: omapdrm: dsi: Store DSI model and PLL hardware data in OF data Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 14/35] drm: omapdrm: dss: Select features based on compatible string Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 15/35] drm: omapdrm: dss: Use supported outputs instead of display types Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 16/35] drm: omapdrm: dss: Initialize DSS internal features at probe time Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 17/35] drm: omapdrm: Move all debugfs code from core to dss Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 18/35] drm: omapdrm: Move shutdown() handler " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 19/35] drm: omapdrm: Move size unit features to dispc_features structure Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 20/35] drm: omapdrm: Move color modes feature " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 21/35] drm: omapdrm: Move overlay caps features " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 22/35] drm: omapdrm: Move num_ovls and num_mgrs " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 23/35] drm: omapdrm: Move DISPC_CLK_SWITCH reg feature to struct dss_features Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 24/35] drm: omapdrm: Move reg_fields to dispc_features structure Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 25/35] drm: omapdrm: Move FEAT_VENC_REQUIRES_TV_DAC_CLK to venc driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 26/35] drm: omapdrm: Move FEAT_DSI_* features to dsi driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 27/35] drm: omapdrm: Move FEAT_HDMI_* features to hdmi4 driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 28/35] drm: omapdrm: Move FEAT_DPI_USES_VDDS_DSI feature to dpi code Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 29/35] drm: omapdrm: Move FEAT_LCD_CLK_SRC feature to dss_features structure Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 30/35] drm: omapdrm: Move FEAT_* features to dispc driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 31/35] drm: omapdrm: Move FEAT_PARAM_DSI* features to dsi driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 32/35] drm: omapdrm: Move PCD, LINEWIDTH and DOWNSCALE features to dispc driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 33/35] drm: omapdrm: Move DSS_FCK feature to dss driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 34/35] drm: omapdrm: Move supported outputs " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 35/35] drm: omapdrm: Remove dss_features.h Laurent Pinchart
2017-08-04 22:49 ` [PATCH v3 00/35] omapdrm: Deconstruct DSS features Laurent Pinchart
2017-08-08 12:56 ` Tomi Valkeinen
2017-08-08 13:02   ` Laurent Pinchart
2017-08-08 13:04     ` Tomi Valkeinen
2017-08-08 13:15       ` 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=20170804224419.30758-13-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.