drm: omapdrm: dpi: Replace OMAP SoC model checks with DSS model

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>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Laurent Pinchart 2017-08-05 01:43:56 +03:00 committed by Tomi Valkeinen
parent 7a143a4b11
commit b8dab2bddb
3 changed files with 45 additions and 37 deletions

View File

@ -39,6 +39,7 @@
struct dpi_data { struct dpi_data {
struct platform_device *pdev; struct platform_device *pdev;
enum dss_model dss_model;
struct regulator *vdds_dsi_reg; struct regulator *vdds_dsi_reg;
enum dss_clk_source clk_src; 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; 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 * 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 * would also be used for DISPC fclk. Meaning, when the DPI output is
* disabled, DISPC clock will be disabled, and TV out will stop. * disabled, DISPC clock will be disabled, and TV out will stop.
*/ */
switch (omapdss_get_version()) { switch (dpi->dss_model) {
case OMAPDSS_VER_OMAP24xx: case DSS_MODEL_OMAP2:
case OMAPDSS_VER_OMAP34xx_ES1: case DSS_MODEL_OMAP3:
case OMAPDSS_VER_OMAP34xx_ES3:
case OMAPDSS_VER_OMAP3630:
case OMAPDSS_VER_AM35xx:
case OMAPDSS_VER_AM43xx:
return DSS_CLK_SRC_FCK; return DSS_CLK_SRC_FCK;
case OMAPDSS_VER_OMAP4430_ES1: case DSS_MODEL_OMAP4:
case OMAPDSS_VER_OMAP4430_ES2:
case OMAPDSS_VER_OMAP4:
switch (channel) { switch (channel) {
case OMAP_DSS_CHANNEL_LCD: case OMAP_DSS_CHANNEL_LCD:
return DSS_CLK_SRC_PLL1_1; 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; return DSS_CLK_SRC_FCK;
} }
case OMAPDSS_VER_OMAP5: case DSS_MODEL_OMAP5:
switch (channel) { switch (channel) {
case OMAP_DSS_CHANNEL_LCD: case OMAP_DSS_CHANNEL_LCD:
return DSS_CLK_SRC_PLL1_1; 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; return DSS_CLK_SRC_FCK;
} }
case OMAPDSS_VER_DRA7xx: case DSS_MODEL_DRA7:
return dpi_get_clk_src_dra7xx(channel); return dpi_get_clk_src_dra7xx(channel);
default: default:
@ -597,7 +594,7 @@ static void dpi_init_pll(struct dpi_data *dpi)
if (dpi->pll) if (dpi->pll)
return; 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); pll = dss_pll_find_by_src(dpi->clk_src);
if (!pll) 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 * the channel in some more dynamic manner, or get the channel as a user
* parameter. * 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()) { switch (dpi->dss_model) {
case OMAPDSS_VER_OMAP24xx: case DSS_MODEL_OMAP2:
case OMAPDSS_VER_OMAP34xx_ES1: case DSS_MODEL_OMAP3:
case OMAPDSS_VER_OMAP34xx_ES3:
case OMAPDSS_VER_OMAP3630:
case OMAPDSS_VER_AM35xx:
case OMAPDSS_VER_AM43xx:
return OMAP_DSS_CHANNEL_LCD; return OMAP_DSS_CHANNEL_LCD;
case OMAPDSS_VER_DRA7xx: case DSS_MODEL_DRA7:
switch (port_num) { switch (port_num) {
case 2: case 2:
return OMAP_DSS_CHANNEL_LCD3; return OMAP_DSS_CHANNEL_LCD3;
@ -639,12 +632,10 @@ static enum omap_channel dpi_get_channel(int port_num)
return OMAP_DSS_CHANNEL_LCD; return OMAP_DSS_CHANNEL_LCD;
} }
case OMAPDSS_VER_OMAP4430_ES1: case DSS_MODEL_OMAP4:
case OMAPDSS_VER_OMAP4430_ES2:
case OMAPDSS_VER_OMAP4:
return OMAP_DSS_CHANNEL_LCD2; return OMAP_DSS_CHANNEL_LCD2;
case OMAPDSS_VER_OMAP5: case DSS_MODEL_OMAP5:
return OMAP_DSS_CHANNEL_LCD3; return OMAP_DSS_CHANNEL_LCD3;
default: default:
@ -709,10 +700,8 @@ static const struct omapdss_dpi_ops dpi_ops = {
.get_timings = dpi_get_timings, .get_timings = dpi_get_timings,
}; };
static void dpi_init_output_port(struct platform_device *pdev, static void dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
struct device_node *port)
{ {
struct dpi_data *dpi = port->data;
struct omap_dss_device *out = &dpi->output; struct omap_dss_device *out = &dpi->output;
int r; int r;
u32 port_num; u32 port_num;
@ -734,10 +723,10 @@ static void dpi_init_output_port(struct platform_device *pdev,
break; break;
} }
out->dev = &pdev->dev; out->dev = &dpi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_DPI; out->id = OMAP_DSS_OUTPUT_DPI;
out->output_type = OMAP_DISPLAY_TYPE_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->port_num = port_num;
out->ops.dpi = &dpi_ops; out->ops.dpi = &dpi_ops;
out->owner = THIS_MODULE; out->owner = THIS_MODULE;
@ -753,7 +742,8 @@ static void dpi_uninit_output_port(struct device_node *port)
omapdss_unregister_output(out); 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 dpi_data *dpi;
struct device_node *ep; struct device_node *ep;
@ -779,11 +769,12 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port)
of_node_put(ep); of_node_put(ep);
dpi->pdev = pdev; dpi->pdev = pdev;
dpi->dss_model = dss_model;
port->data = dpi; port->data = dpi;
mutex_init(&dpi->lock); mutex_init(&dpi->lock);
dpi_init_output_port(pdev, port); dpi_init_output_port(dpi, port);
dpi->port_initialized = true; dpi->port_initialized = true;

View File

@ -76,6 +76,7 @@ struct dss_ops {
}; };
struct dss_features { struct dss_features {
enum dss_model model;
u8 fck_div_max; u8 fck_div_max;
u8 dss_fck_multiplier; u8 dss_fck_multiplier;
const char *parent_clk_name; 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 = { 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 * 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. * 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 = { static const struct dss_features omap34xx_dss_feats = {
.model = DSS_MODEL_OMAP3,
.fck_div_max = 16, .fck_div_max = 16,
.dss_fck_multiplier = 2, .dss_fck_multiplier = 2,
.parent_clk_name = "dpll4_ck", .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 = { static const struct dss_features omap3630_dss_feats = {
.model = DSS_MODEL_OMAP3,
.fck_div_max = 32, .fck_div_max = 32,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll4_ck", .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 = { static const struct dss_features omap44xx_dss_feats = {
.model = DSS_MODEL_OMAP4,
.fck_div_max = 32, .fck_div_max = 32,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll_per_x2_ck", .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 = { static const struct dss_features omap54xx_dss_feats = {
.model = DSS_MODEL_OMAP5,
.fck_div_max = 64, .fck_div_max = 64,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll_per_x2_ck", .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 = { static const struct dss_features am43xx_dss_feats = {
.model = DSS_MODEL_OMAP3,
.fck_div_max = 0, .fck_div_max = 0,
.dss_fck_multiplier = 0, .dss_fck_multiplier = 0,
.parent_clk_name = NULL, .parent_clk_name = NULL,
@ -990,6 +997,7 @@ static const struct dss_features am43xx_dss_feats = {
}; };
static const struct dss_features dra7xx_dss_feats = { static const struct dss_features dra7xx_dss_feats = {
.model = DSS_MODEL_DRA7,
.fck_div_max = 64, .fck_div_max = 64,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll_per_x2_ck", .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]) { switch (dss.feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI: case OMAP_DISPLAY_TYPE_DPI:
dpi_init_port(pdev, port); dpi_init_port(pdev, port, dss.feat->model);
break; break;
case OMAP_DISPLAY_TYPE_SDI: case OMAP_DISPLAY_TYPE_SDI:
sdi_init_port(pdev, port); sdi_init_port(pdev, port);

View File

@ -72,6 +72,14 @@
#define FLD_MOD(orig, val, start, end) \ #define FLD_MOD(orig, val, start, end) \
(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(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 { enum dss_io_pad_mode {
DSS_IO_PAD_MODE_RESET, DSS_IO_PAD_MODE_RESET,
DSS_IO_PAD_MODE_RFBI, DSS_IO_PAD_MODE_RFBI,
@ -315,11 +323,12 @@ void dsi_irq_handler(void);
/* DPI */ /* DPI */
#ifdef CONFIG_OMAP2_DSS_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); void dpi_uninit_port(struct device_node *port);
#else #else
static inline int dpi_init_port(struct platform_device *pdev, 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; return 0;
} }