diff options
author | Archit Taneja <archit@ti.com> | 2011-08-30 06:18:23 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-09-30 09:16:27 -0400 |
commit | b850975cd8857d9f277466e2a3cca5ee28519c6b (patch) | |
tree | 96fe0749a324273b2b97a313a4de05fafb6df1e5 /drivers/video/omap2/dss/dsi.c | |
parent | 5c716a04ed1f5b8a3e1a8953b71f89441a70d1d4 (diff) |
OMAP: DSS2: DSI: Split dsi_vc_dcs_read() into 2 functions
Split dsi_vc_dcs_read() into the functions:
- dsi_vc_dcs_send_read_request(): This is responsible for sending the short
packet command with the read request.
- dsi_vc_dcs_read_rx_fifo(): This parses the DSI RX fifo of the given virtual
channel, identifies the type of data received, and fills a buffer with the data
provided by the panel.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/dsi.c')
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 82516471b64f..c26a91435e50 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -3196,25 +3196,34 @@ int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel, | |||
3196 | } | 3196 | } |
3197 | EXPORT_SYMBOL(dsi_vc_generic_write_2); | 3197 | EXPORT_SYMBOL(dsi_vc_generic_write_2); |
3198 | 3198 | ||
3199 | int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | 3199 | static int dsi_vc_dcs_send_read_request(struct omap_dss_device *dssdev, |
3200 | u8 *buf, int buflen) | 3200 | int channel, u8 dcs_cmd) |
3201 | { | 3201 | { |
3202 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 3202 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
3203 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 3203 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
3204 | u32 val; | ||
3205 | u8 dt; | ||
3206 | int r; | 3204 | int r; |
3207 | 3205 | ||
3208 | if (dsi->debug_read) | 3206 | if (dsi->debug_read) |
3209 | DSSDBG("dsi_vc_dcs_read(ch%d, dcs_cmd %x)\n", channel, dcs_cmd); | 3207 | DSSDBG("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n", |
3208 | channel, dcs_cmd); | ||
3210 | 3209 | ||
3211 | r = dsi_vc_send_short(dsidev, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0); | 3210 | r = dsi_vc_send_short(dsidev, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0); |
3212 | if (r) | 3211 | if (r) { |
3213 | goto err; | 3212 | DSSERR("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)" |
3213 | " failed\n", channel, dcs_cmd); | ||
3214 | return r; | ||
3215 | } | ||
3214 | 3216 | ||
3215 | r = dsi_vc_send_bta_sync(dssdev, channel); | 3217 | return 0; |
3216 | if (r) | 3218 | } |
3217 | goto err; | 3219 | |
3220 | static int dsi_vc_dcs_read_rx_fifo(struct platform_device *dsidev, int channel, | ||
3221 | u8 *buf, int buflen) | ||
3222 | { | ||
3223 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
3224 | u32 val; | ||
3225 | u8 dt; | ||
3226 | int r; | ||
3218 | 3227 | ||
3219 | /* RX_FIFO_NOT_EMPTY */ | 3228 | /* RX_FIFO_NOT_EMPTY */ |
3220 | if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20) == 0) { | 3229 | if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20) == 0) { |
@@ -3300,10 +3309,38 @@ int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | |||
3300 | 3309 | ||
3301 | BUG(); | 3310 | BUG(); |
3302 | err: | 3311 | err: |
3303 | DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", | 3312 | DSSERR("dsi_vc_dcs_read_rx_fifo(ch %d) failed\n", channel); |
3304 | channel, dcs_cmd); | 3313 | |
3305 | return r; | 3314 | return r; |
3315 | } | ||
3316 | |||
3317 | int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | ||
3318 | u8 *buf, int buflen) | ||
3319 | { | ||
3320 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | ||
3321 | int r; | ||
3322 | |||
3323 | r = dsi_vc_dcs_send_read_request(dssdev, channel, dcs_cmd); | ||
3324 | if (r) | ||
3325 | goto err; | ||
3306 | 3326 | ||
3327 | r = dsi_vc_send_bta_sync(dssdev, channel); | ||
3328 | if (r) | ||
3329 | goto err; | ||
3330 | |||
3331 | r = dsi_vc_dcs_read_rx_fifo(dsidev, channel, buf, buflen); | ||
3332 | if (r < 0) | ||
3333 | goto err; | ||
3334 | |||
3335 | if (r != buflen) { | ||
3336 | r = -EIO; | ||
3337 | goto err; | ||
3338 | } | ||
3339 | |||
3340 | return 0; | ||
3341 | err: | ||
3342 | DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd); | ||
3343 | return r; | ||
3307 | } | 3344 | } |
3308 | EXPORT_SYMBOL(dsi_vc_dcs_read); | 3345 | EXPORT_SYMBOL(dsi_vc_dcs_read); |
3309 | 3346 | ||