提交 9ecd9684 编写于 作者: T Tomi Valkeinen

OMAP: DSS2: DSI: change dsi_vc_config_l4/vp()

Change dsi_vc_config_l4/vp() to loop for the VC_BUSY flag to change, and
return an error if it fails.

Busy looping is bad, but there's no interrupt that can be used for all the
cases where VC can be busy. So the caller should first try to make sure
that the VC is not busy, if possible, and then call dsi_vc_config_l4/vp().

Most notable case when the caller cannot be sure if the VC is busy is
after frame has been sent. Usually DSI buffers have been emptied until we
need to reconfig the VC, but in some rare cases the VC can still be busy,
and this patch will handle that case.
Signed-off-by: NTomi Valkeinen <tomi.valkeinen@nokia.com>
上级 d7370104
...@@ -1743,42 +1743,52 @@ static void dsi_vc_initial_config(int channel) ...@@ -1743,42 +1743,52 @@ static void dsi_vc_initial_config(int channel)
dsi.vc[channel].mode = DSI_VC_MODE_L4; dsi.vc[channel].mode = DSI_VC_MODE_L4;
} }
static void dsi_vc_config_l4(int channel) static int dsi_vc_config_l4(int channel)
{ {
if (dsi.vc[channel].mode == DSI_VC_MODE_L4) if (dsi.vc[channel].mode == DSI_VC_MODE_L4)
return; return 0;
DSSDBGF("%d", channel); DSSDBGF("%d", channel);
dsi_vc_enable(channel, 0); dsi_vc_enable(channel, 0);
if (REG_GET(DSI_VC_CTRL(channel), 15, 15)) /* VC_BUSY */ /* VC_BUSY */
if (wait_for_bit_change(DSI_VC_CTRL(channel), 15, 0) != 0) {
DSSERR("vc(%d) busy when trying to config for L4\n", channel); DSSERR("vc(%d) busy when trying to config for L4\n", channel);
return -EIO;
}
REG_FLD_MOD(DSI_VC_CTRL(channel), 0, 1, 1); /* SOURCE, 0 = L4 */ REG_FLD_MOD(DSI_VC_CTRL(channel), 0, 1, 1); /* SOURCE, 0 = L4 */
dsi_vc_enable(channel, 1); dsi_vc_enable(channel, 1);
dsi.vc[channel].mode = DSI_VC_MODE_L4; dsi.vc[channel].mode = DSI_VC_MODE_L4;
return 0;
} }
static void dsi_vc_config_vp(int channel) static int dsi_vc_config_vp(int channel)
{ {
if (dsi.vc[channel].mode == DSI_VC_MODE_VP) if (dsi.vc[channel].mode == DSI_VC_MODE_VP)
return; return 0;
DSSDBGF("%d", channel); DSSDBGF("%d", channel);
dsi_vc_enable(channel, 0); dsi_vc_enable(channel, 0);
if (REG_GET(DSI_VC_CTRL(channel), 15, 15)) /* VC_BUSY */ /* VC_BUSY */
if (wait_for_bit_change(DSI_VC_CTRL(channel), 15, 0) != 0) {
DSSERR("vc(%d) busy when trying to config for VP\n", channel); DSSERR("vc(%d) busy when trying to config for VP\n", channel);
return -EIO;
}
REG_FLD_MOD(DSI_VC_CTRL(channel), 1, 1, 1); /* SOURCE, 1 = video port */ REG_FLD_MOD(DSI_VC_CTRL(channel), 1, 1, 1); /* SOURCE, 1 = video port */
dsi_vc_enable(channel, 1); dsi_vc_enable(channel, 1);
dsi.vc[channel].mode = DSI_VC_MODE_VP; dsi.vc[channel].mode = DSI_VC_MODE_VP;
return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册