aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@nokia.com>2010-02-26 04:32:56 -0500
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-02-26 10:44:10 -0500
commit5d68e0326b146f28fbb8fe6375dd7d15ca929be7 (patch)
tree4190a41f4306e17bdbc1ff8146ad323f25b43265 /drivers
parent606847540079bd3e710f132724145c5785396dcb (diff)
OMAP: DSS2: DSI: add error prints
Add error printing for dsi_vc_dcs_write() and dsi_vc_dcs_read(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/omap2/dss/dsi.c47
1 files changed, 34 insertions, 13 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a9820206ca1e..3af207b2bde3 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -2081,10 +2081,16 @@ int dsi_vc_dcs_write(int channel, u8 *data, int len)
2081 2081
2082 r = dsi_vc_dcs_write_nosync(channel, data, len); 2082 r = dsi_vc_dcs_write_nosync(channel, data, len);
2083 if (r) 2083 if (r)
2084 return r; 2084 goto err;
2085 2085
2086 r = dsi_vc_send_bta_sync(channel); 2086 r = dsi_vc_send_bta_sync(channel);
2087 if (r)
2088 goto err;
2087 2089
2090 return 0;
2091err:
2092 DSSERR("dsi_vc_dcs_write(ch %d, cmd 0x%02x, len %d) failed\n",
2093 channel, data[0], len);
2088 return r; 2094 return r;
2089} 2095}
2090EXPORT_SYMBOL(dsi_vc_dcs_write); 2096EXPORT_SYMBOL(dsi_vc_dcs_write);
@@ -2115,16 +2121,17 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
2115 2121
2116 r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0); 2122 r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0);
2117 if (r) 2123 if (r)
2118 return r; 2124 goto err;
2119 2125
2120 r = dsi_vc_send_bta_sync(channel); 2126 r = dsi_vc_send_bta_sync(channel);
2121 if (r) 2127 if (r)
2122 return r; 2128 goto err;
2123 2129
2124 /* RX_FIFO_NOT_EMPTY */ 2130 /* RX_FIFO_NOT_EMPTY */
2125 if (REG_GET(DSI_VC_CTRL(channel), 20, 20) == 0) { 2131 if (REG_GET(DSI_VC_CTRL(channel), 20, 20) == 0) {
2126 DSSERR("RX fifo empty when trying to read.\n"); 2132 DSSERR("RX fifo empty when trying to read.\n");
2127 return -EIO; 2133 r = -EIO;
2134 goto err;
2128 } 2135 }
2129 2136
2130 val = dsi_read_reg(DSI_VC_SHORT_PACKET_HEADER(channel)); 2137 val = dsi_read_reg(DSI_VC_SHORT_PACKET_HEADER(channel));
@@ -2134,15 +2141,18 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
2134 if (dt == DSI_DT_RX_ACK_WITH_ERR) { 2141 if (dt == DSI_DT_RX_ACK_WITH_ERR) {
2135 u16 err = FLD_GET(val, 23, 8); 2142 u16 err = FLD_GET(val, 23, 8);
2136 dsi_show_rx_ack_with_err(err); 2143 dsi_show_rx_ack_with_err(err);
2137 return -EIO; 2144 r = -EIO;
2145 goto err;
2138 2146
2139 } else if (dt == DSI_DT_RX_SHORT_READ_1) { 2147 } else if (dt == DSI_DT_RX_SHORT_READ_1) {
2140 u8 data = FLD_GET(val, 15, 8); 2148 u8 data = FLD_GET(val, 15, 8);
2141 if (dsi.debug_read) 2149 if (dsi.debug_read)
2142 DSSDBG("\tDCS short response, 1 byte: %02x\n", data); 2150 DSSDBG("\tDCS short response, 1 byte: %02x\n", data);
2143 2151
2144 if (buflen < 1) 2152 if (buflen < 1) {
2145 return -EIO; 2153 r = -EIO;
2154 goto err;
2155 }
2146 2156
2147 buf[0] = data; 2157 buf[0] = data;
2148 2158
@@ -2152,8 +2162,10 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
2152 if (dsi.debug_read) 2162 if (dsi.debug_read)
2153 DSSDBG("\tDCS short response, 2 byte: %04x\n", data); 2163 DSSDBG("\tDCS short response, 2 byte: %04x\n", data);
2154 2164
2155 if (buflen < 2) 2165 if (buflen < 2) {
2156 return -EIO; 2166 r = -EIO;
2167 goto err;
2168 }
2157 2169
2158 buf[0] = data & 0xff; 2170 buf[0] = data & 0xff;
2159 buf[1] = (data >> 8) & 0xff; 2171 buf[1] = (data >> 8) & 0xff;
@@ -2165,8 +2177,10 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
2165 if (dsi.debug_read) 2177 if (dsi.debug_read)
2166 DSSDBG("\tDCS long response, len %d\n", len); 2178 DSSDBG("\tDCS long response, len %d\n", len);
2167 2179
2168 if (len > buflen) 2180 if (len > buflen) {
2169 return -EIO; 2181 r = -EIO;
2182 goto err;
2183 }
2170 2184
2171 /* two byte checksum ends the packet, not included in len */ 2185 /* two byte checksum ends the packet, not included in len */
2172 for (w = 0; w < len + 2;) { 2186 for (w = 0; w < len + 2;) {
@@ -2188,11 +2202,18 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
2188 } 2202 }
2189 2203
2190 return len; 2204 return len;
2191
2192 } else { 2205 } else {
2193 DSSERR("\tunknown datatype 0x%02x\n", dt); 2206 DSSERR("\tunknown datatype 0x%02x\n", dt);
2194 return -EIO; 2207 r = -EIO;
2208 goto err;
2195 } 2209 }
2210
2211 BUG();
2212err:
2213 DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n",
2214 channel, dcs_cmd);
2215 return r;
2216
2196} 2217}
2197EXPORT_SYMBOL(dsi_vc_dcs_read); 2218EXPORT_SYMBOL(dsi_vc_dcs_read);
2198 2219