Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184882
b: refs/heads/master
c: 5d68e03
h: refs/heads/master
v: v3
  • Loading branch information
Tomi Valkeinen committed Feb 26, 2010
1 parent ad17f5d commit 4f6cd2a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 606847540079bd3e710f132724145c5785396dcb
refs/heads/master: 5d68e0326b146f28fbb8fe6375dd7d15ca929be7
47 changes: 34 additions & 13 deletions trunk/drivers/video/omap2/dss/dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2081,10 +2081,16 @@ int dsi_vc_dcs_write(int channel, u8 *data, int len)

r = dsi_vc_dcs_write_nosync(channel, data, len);
if (r)
return r;
goto err;

r = dsi_vc_send_bta_sync(channel);
if (r)
goto err;

return 0;
err:
DSSERR("dsi_vc_dcs_write(ch %d, cmd 0x%02x, len %d) failed\n",
channel, data[0], len);
return r;
}
EXPORT_SYMBOL(dsi_vc_dcs_write);
Expand Down Expand Up @@ -2115,16 +2121,17 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)

r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0);
if (r)
return r;
goto err;

r = dsi_vc_send_bta_sync(channel);
if (r)
return r;
goto err;

/* RX_FIFO_NOT_EMPTY */
if (REG_GET(DSI_VC_CTRL(channel), 20, 20) == 0) {
DSSERR("RX fifo empty when trying to read.\n");
return -EIO;
r = -EIO;
goto err;
}

val = dsi_read_reg(DSI_VC_SHORT_PACKET_HEADER(channel));
Expand All @@ -2134,15 +2141,18 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
if (dt == DSI_DT_RX_ACK_WITH_ERR) {
u16 err = FLD_GET(val, 23, 8);
dsi_show_rx_ack_with_err(err);
return -EIO;
r = -EIO;
goto err;

} else if (dt == DSI_DT_RX_SHORT_READ_1) {
u8 data = FLD_GET(val, 15, 8);
if (dsi.debug_read)
DSSDBG("\tDCS short response, 1 byte: %02x\n", data);

if (buflen < 1)
return -EIO;
if (buflen < 1) {
r = -EIO;
goto err;
}

buf[0] = data;

Expand All @@ -2152,8 +2162,10 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
if (dsi.debug_read)
DSSDBG("\tDCS short response, 2 byte: %04x\n", data);

if (buflen < 2)
return -EIO;
if (buflen < 2) {
r = -EIO;
goto err;
}

buf[0] = data & 0xff;
buf[1] = (data >> 8) & 0xff;
Expand All @@ -2165,8 +2177,10 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
if (dsi.debug_read)
DSSDBG("\tDCS long response, len %d\n", len);

if (len > buflen)
return -EIO;
if (len > buflen) {
r = -EIO;
goto err;
}

/* two byte checksum ends the packet, not included in len */
for (w = 0; w < len + 2;) {
Expand All @@ -2188,11 +2202,18 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
}

return len;

} else {
DSSERR("\tunknown datatype 0x%02x\n", dt);
return -EIO;
r = -EIO;
goto err;
}

BUG();
err:
DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n",
channel, dcs_cmd);
return r;

}
EXPORT_SYMBOL(dsi_vc_dcs_read);

Expand Down

0 comments on commit 4f6cd2a

Please sign in to comment.