diff options
-rw-r--r-- | arch/arm/plat-omap/include/plat/display.h | 3 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 67 |
2 files changed, 65 insertions, 5 deletions
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h index 37658249e483..e81ca66dfbb4 100644 --- a/arch/arm/plat-omap/include/plat/display.h +++ b/arch/arm/plat-omap/include/plat/display.h | |||
@@ -562,6 +562,9 @@ int omap_dsi_update(struct omap_dss_device *dssdev, | |||
562 | int channel, | 562 | int channel, |
563 | u16 x, u16 y, u16 w, u16 h, | 563 | u16 x, u16 y, u16 w, u16 h, |
564 | void (*callback)(int, void *), void *data); | 564 | void (*callback)(int, void *), void *data); |
565 | int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); | ||
566 | int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); | ||
567 | void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); | ||
565 | 568 | ||
566 | int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); | 569 | int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); |
567 | void omapdss_dsi_display_disable(struct omap_dss_device *dssdev); | 570 | void omapdss_dsi_display_disable(struct omap_dss_device *dssdev); |
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 37ffbb6ecf69..fe3578bbff7d 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -233,6 +233,7 @@ static struct | |||
233 | enum dsi_vc_mode mode; | 233 | enum dsi_vc_mode mode; |
234 | struct omap_dss_device *dssdev; | 234 | struct omap_dss_device *dssdev; |
235 | enum fifo_size fifo_size; | 235 | enum fifo_size fifo_size; |
236 | int vc_id; | ||
236 | } vc[4]; | 237 | } vc[4]; |
237 | 238 | ||
238 | struct mutex lock; | 239 | struct mutex lock; |
@@ -1764,8 +1765,6 @@ static void dsi_vc_initial_config(int channel) | |||
1764 | r = FLD_MOD(r, 4, 23, 21); /* DMA_TX_REQ_NB = no dma */ | 1765 | r = FLD_MOD(r, 4, 23, 21); /* DMA_TX_REQ_NB = no dma */ |
1765 | 1766 | ||
1766 | dsi_write_reg(DSI_VC_CTRL(channel), r); | 1767 | dsi_write_reg(DSI_VC_CTRL(channel), r); |
1767 | |||
1768 | dsi.vc[channel].mode = DSI_VC_MODE_L4; | ||
1769 | } | 1768 | } |
1770 | 1769 | ||
1771 | static int dsi_vc_config_l4(int channel) | 1770 | static int dsi_vc_config_l4(int channel) |
@@ -1972,7 +1971,7 @@ static inline void dsi_vc_write_long_header(int channel, u8 data_type, | |||
1972 | 1971 | ||
1973 | WARN_ON(!dsi_bus_is_locked()); | 1972 | WARN_ON(!dsi_bus_is_locked()); |
1974 | 1973 | ||
1975 | data_id = data_type | channel << 6; | 1974 | data_id = data_type | dsi.vc[channel].vc_id << 6; |
1976 | 1975 | ||
1977 | val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) | | 1976 | val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) | |
1978 | FLD_VAL(ecc, 31, 24); | 1977 | FLD_VAL(ecc, 31, 24); |
@@ -2075,7 +2074,7 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) | |||
2075 | return -EINVAL; | 2074 | return -EINVAL; |
2076 | } | 2075 | } |
2077 | 2076 | ||
2078 | data_id = data_type | channel << 6; | 2077 | data_id = data_type | dsi.vc[channel].vc_id << 6; |
2079 | 2078 | ||
2080 | r = (data_id << 0) | (data << 8) | (ecc << 24); | 2079 | r = (data_id << 0) | (data << 8) | (ecc << 24); |
2081 | 2080 | ||
@@ -3250,6 +3249,57 @@ int dsi_init_display(struct omap_dss_device *dssdev) | |||
3250 | return 0; | 3249 | return 0; |
3251 | } | 3250 | } |
3252 | 3251 | ||
3252 | int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel) | ||
3253 | { | ||
3254 | int i; | ||
3255 | |||
3256 | for (i = 0; i < ARRAY_SIZE(dsi.vc); i++) { | ||
3257 | if (!dsi.vc[i].dssdev) { | ||
3258 | dsi.vc[i].dssdev = dssdev; | ||
3259 | *channel = i; | ||
3260 | return 0; | ||
3261 | } | ||
3262 | } | ||
3263 | |||
3264 | DSSERR("cannot get VC for display %s", dssdev->name); | ||
3265 | return -ENOSPC; | ||
3266 | } | ||
3267 | EXPORT_SYMBOL(omap_dsi_request_vc); | ||
3268 | |||
3269 | int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id) | ||
3270 | { | ||
3271 | if (vc_id < 0 || vc_id > 3) { | ||
3272 | DSSERR("VC ID out of range\n"); | ||
3273 | return -EINVAL; | ||
3274 | } | ||
3275 | |||
3276 | if (channel < 0 || channel > 3) { | ||
3277 | DSSERR("Virtual Channel out of range\n"); | ||
3278 | return -EINVAL; | ||
3279 | } | ||
3280 | |||
3281 | if (dsi.vc[channel].dssdev != dssdev) { | ||
3282 | DSSERR("Virtual Channel not allocated to display %s\n", | ||
3283 | dssdev->name); | ||
3284 | return -EINVAL; | ||
3285 | } | ||
3286 | |||
3287 | dsi.vc[channel].vc_id = vc_id; | ||
3288 | |||
3289 | return 0; | ||
3290 | } | ||
3291 | EXPORT_SYMBOL(omap_dsi_set_vc_id); | ||
3292 | |||
3293 | void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel) | ||
3294 | { | ||
3295 | if ((channel >= 0 && channel <= 3) && | ||
3296 | dsi.vc[channel].dssdev == dssdev) { | ||
3297 | dsi.vc[channel].dssdev = NULL; | ||
3298 | dsi.vc[channel].vc_id = 0; | ||
3299 | } | ||
3300 | } | ||
3301 | EXPORT_SYMBOL(omap_dsi_release_vc); | ||
3302 | |||
3253 | void dsi_wait_pll_hsdiv_dispc_active(void) | 3303 | void dsi_wait_pll_hsdiv_dispc_active(void) |
3254 | { | 3304 | { |
3255 | if (wait_for_bit_change(DSI_PLL_STATUS, 7, 1) != 1) | 3305 | if (wait_for_bit_change(DSI_PLL_STATUS, 7, 1) != 1) |
@@ -3269,7 +3319,7 @@ void dsi_wait_pll_hsdiv_dsi_active(void) | |||
3269 | static int dsi_init(struct platform_device *pdev) | 3319 | static int dsi_init(struct platform_device *pdev) |
3270 | { | 3320 | { |
3271 | u32 rev; | 3321 | u32 rev; |
3272 | int r; | 3322 | int r, i; |
3273 | struct resource *dsi_mem; | 3323 | struct resource *dsi_mem; |
3274 | 3324 | ||
3275 | spin_lock_init(&dsi.errors_lock); | 3325 | spin_lock_init(&dsi.errors_lock); |
@@ -3323,6 +3373,13 @@ static int dsi_init(struct platform_device *pdev) | |||
3323 | goto err2; | 3373 | goto err2; |
3324 | } | 3374 | } |
3325 | 3375 | ||
3376 | /* DSI VCs initialization */ | ||
3377 | for (i = 0; i < ARRAY_SIZE(dsi.vc); i++) { | ||
3378 | dsi.vc[i].mode = DSI_VC_MODE_L4; | ||
3379 | dsi.vc[i].dssdev = NULL; | ||
3380 | dsi.vc[i].vc_id = 0; | ||
3381 | } | ||
3382 | |||
3326 | enable_clocks(1); | 3383 | enable_clocks(1); |
3327 | 3384 | ||
3328 | rev = dsi_read_reg(DSI_REVISION); | 3385 | rev = dsi_read_reg(DSI_REVISION); |