Commit d6049144 authored by Archit Taneja's avatar Archit Taneja Committed by Tomi Valkeinen

OMAP: DSS2: DSI: Represent L4 and VP as sources of VC instead of modes

The enum type dsi_vc_mode is a bit misleading as L4 slave port and video port
are sources to VC rather than the mode of operation. Rename then enum type and
its members. Merge dsi_vc_config_vp() and dsi_vc_config_l4() into a single
function called dsi_vc_config_source() which takes dsi_vc_source enum as an
extra argument.
Signed-off-by: default avatarArchit Taneja <archit@ti.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 7a7c48f9
...@@ -217,9 +217,9 @@ enum fifo_size { ...@@ -217,9 +217,9 @@ enum fifo_size {
DSI_FIFO_SIZE_128 = 4, DSI_FIFO_SIZE_128 = 4,
}; };
enum dsi_vc_mode { enum dsi_vc_source {
DSI_VC_MODE_L4 = 0, DSI_VC_SOURCE_L4 = 0,
DSI_VC_MODE_VP, DSI_VC_SOURCE_VP,
}; };
enum dsi_lane { enum dsi_lane {
...@@ -272,7 +272,7 @@ struct dsi_data { ...@@ -272,7 +272,7 @@ struct dsi_data {
struct regulator *vdds_dsi_reg; struct regulator *vdds_dsi_reg;
struct { struct {
enum dsi_vc_mode mode; enum dsi_vc_source source;
struct omap_dss_device *dssdev; struct omap_dss_device *dssdev;
enum fifo_size fifo_size; enum fifo_size fifo_size;
int vc_id; int vc_id;
...@@ -2672,10 +2672,10 @@ static int dsi_sync_vc(struct platform_device *dsidev, int channel) ...@@ -2672,10 +2672,10 @@ static int dsi_sync_vc(struct platform_device *dsidev, int channel)
if (!dsi_vc_is_enabled(dsidev, channel)) if (!dsi_vc_is_enabled(dsidev, channel))
return 0; return 0;
switch (dsi->vc[channel].mode) { switch (dsi->vc[channel].source) {
case DSI_VC_MODE_VP: case DSI_VC_SOURCE_VP:
return dsi_sync_vc_vp(dsidev, channel); return dsi_sync_vc_vp(dsidev, channel);
case DSI_VC_MODE_L4: case DSI_VC_SOURCE_L4:
return dsi_sync_vc_l4(dsidev, channel); return dsi_sync_vc_l4(dsidev, channel);
default: default:
BUG(); BUG();
...@@ -2729,43 +2729,12 @@ static void dsi_vc_initial_config(struct platform_device *dsidev, int channel) ...@@ -2729,43 +2729,12 @@ static void dsi_vc_initial_config(struct platform_device *dsidev, int channel)
dsi_write_reg(dsidev, DSI_VC_CTRL(channel), r); dsi_write_reg(dsidev, DSI_VC_CTRL(channel), r);
} }
static int dsi_vc_config_l4(struct platform_device *dsidev, int channel) static int dsi_vc_config_source(struct platform_device *dsidev, int channel,
enum dsi_vc_source source)
{ {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
if (dsi->vc[channel].mode == DSI_VC_MODE_L4) if (dsi->vc[channel].source == source)
return 0;
DSSDBGF("%d", channel);
dsi_sync_vc(dsidev, channel);
dsi_vc_enable(dsidev, channel, 0);
/* VC_BUSY */
if (wait_for_bit_change(dsidev, DSI_VC_CTRL(channel), 15, 0) != 0) {
DSSERR("vc(%d) busy when trying to config for L4\n", channel);
return -EIO;
}
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 0, 1, 1); /* SOURCE, 0 = L4 */
/* DCS_CMD_ENABLE */
if (dss_has_feature(FEAT_DSI_DCS_CMD_CONFIG_VC))
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 0, 30, 30);
dsi_vc_enable(dsidev, channel, 1);
dsi->vc[channel].mode = DSI_VC_MODE_L4;
return 0;
}
static int dsi_vc_config_vp(struct platform_device *dsidev, int channel)
{
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
if (dsi->vc[channel].mode == DSI_VC_MODE_VP)
return 0; return 0;
DSSDBGF("%d", channel); DSSDBGF("%d", channel);
...@@ -2780,21 +2749,22 @@ static int dsi_vc_config_vp(struct platform_device *dsidev, int channel) ...@@ -2780,21 +2749,22 @@ static int dsi_vc_config_vp(struct platform_device *dsidev, int channel)
return -EIO; return -EIO;
} }
/* SOURCE, 1 = video port */ /* SOURCE, 0 = L4, 1 = video port */
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 1, 1); REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), source, 1, 1);
/* DCS_CMD_ENABLE */ /* DCS_CMD_ENABLE */
if (dss_has_feature(FEAT_DSI_DCS_CMD_CONFIG_VC)) if (dss_has_feature(FEAT_DSI_DCS_CMD_CONFIG_VC)) {
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 30, 30); bool enable = source == DSI_VC_SOURCE_VP;
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 30, 30);
}
dsi_vc_enable(dsidev, channel, 1); dsi_vc_enable(dsidev, channel, 1);
dsi->vc[channel].mode = DSI_VC_MODE_VP; dsi->vc[channel].source = source;
return 0; return 0;
} }
void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
bool enable) bool enable)
{ {
...@@ -3010,7 +2980,7 @@ static int dsi_vc_send_long(struct platform_device *dsidev, int channel, ...@@ -3010,7 +2980,7 @@ static int dsi_vc_send_long(struct platform_device *dsidev, int channel,
return -EINVAL; return -EINVAL;
} }
dsi_vc_config_l4(dsidev, channel); dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_L4);
dsi_vc_write_long_header(dsidev, channel, data_type, len, ecc); dsi_vc_write_long_header(dsidev, channel, data_type, len, ecc);
...@@ -3069,7 +3039,7 @@ static int dsi_vc_send_short(struct platform_device *dsidev, int channel, ...@@ -3069,7 +3039,7 @@ static int dsi_vc_send_short(struct platform_device *dsidev, int channel,
channel, channel,
data_type, data & 0xff, (data >> 8) & 0xff); data_type, data & 0xff, (data >> 8) & 0xff);
dsi_vc_config_l4(dsidev, channel); dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_L4);
if (FLD_GET(dsi_read_reg(dsidev, DSI_VC_CTRL(channel)), 16, 16)) { if (FLD_GET(dsi_read_reg(dsidev, DSI_VC_CTRL(channel)), 16, 16)) {
DSSERR("ERROR FIFO FULL, aborting transfer\n"); DSSERR("ERROR FIFO FULL, aborting transfer\n");
...@@ -3657,7 +3627,7 @@ static void dsi_update_screen_dispc(struct omap_dss_device *dssdev, ...@@ -3657,7 +3627,7 @@ static void dsi_update_screen_dispc(struct omap_dss_device *dssdev,
DSSDBG("dsi_update_screen_dispc(%d,%d %dx%d)\n", DSSDBG("dsi_update_screen_dispc(%d,%d %dx%d)\n",
x, y, w, h); x, y, w, h);
dsi_vc_config_vp(dsidev, channel); dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_VP);
bytespp = dssdev->ctrl.pixel_size / 8; bytespp = dssdev->ctrl.pixel_size / 8;
bytespl = w * bytespp; bytespl = w * bytespp;
...@@ -4383,7 +4353,7 @@ static int omap_dsihw_probe(struct platform_device *dsidev) ...@@ -4383,7 +4353,7 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
/* DSI VCs initialization */ /* DSI VCs initialization */
for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) { for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
dsi->vc[i].mode = DSI_VC_MODE_L4; dsi->vc[i].source = DSI_VC_SOURCE_L4;
dsi->vc[i].dssdev = NULL; dsi->vc[i].dssdev = NULL;
dsi->vc[i].vc_id = 0; dsi->vc[i].vc_id = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment