aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/dsi.c
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-08-13 04:47:30 -0400
committerArchit Taneja <archit@ti.com>2012-08-13 06:14:39 -0400
commite67458a831e280d346c87d22eed87e3e8697e077 (patch)
tree684a11d9a7e9d5664141601cbfb7aafb46af790e /drivers/video/omap2/dss/dsi.c
parentbdcae3cc39e8232eca81504a2ff9c60f4cc8f22d (diff)
OMAPDSS: DSI: Maintain own copy of timings in driver data
The DSI driver currently relies on the timings in omap_dss_device struct to configure the DISPC and DSI blocks accordingly. This makes the DSI interface driver dependent on the omap_dss_device struct. Make the DSI driver data maintain it's own timings field. A DSI video mode panel driver is expected to call omapdss_dsi_set_timings() to set these timings before the panel is enabled. Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/dsi.c')
-rw-r--r--drivers/video/omap2/dss/dsi.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index b07e8864f82f..4787e469131b 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -333,6 +333,7 @@ struct dsi_data {
333 unsigned scp_clk_refcount; 333 unsigned scp_clk_refcount;
334 334
335 struct dss_lcd_mgr_config mgr_config; 335 struct dss_lcd_mgr_config mgr_config;
336 struct omap_video_timings timings;
336}; 337};
337 338
338struct dsi_packet_sent_handler_data { 339struct dsi_packet_sent_handler_data {
@@ -3610,9 +3611,10 @@ static void dsi_config_vp_num_line_buffers(struct omap_dss_device *dssdev)
3610 int num_line_buffers; 3611 int num_line_buffers;
3611 3612
3612 if (dssdev->panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) { 3613 if (dssdev->panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) {
3614 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
3613 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); 3615 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
3614 unsigned line_buf_size = dsi_get_line_buf_size(dsidev); 3616 unsigned line_buf_size = dsi_get_line_buf_size(dsidev);
3615 struct omap_video_timings *timings = &dssdev->panel.timings; 3617 struct omap_video_timings *timings = &dsi->timings;
3616 /* 3618 /*
3617 * Don't use line buffers if width is greater than the video 3619 * Don't use line buffers if width is greater than the video
3618 * port's line buffer size 3620 * port's line buffer size
@@ -3741,7 +3743,7 @@ static void dsi_config_cmd_mode_interleaving(struct omap_dss_device *dssdev)
3741 int ddr_clk_pre, ddr_clk_post, enter_hs_mode_lat, exit_hs_mode_lat; 3743 int ddr_clk_pre, ddr_clk_post, enter_hs_mode_lat, exit_hs_mode_lat;
3742 int tclk_trail, ths_exit, exiths_clk; 3744 int tclk_trail, ths_exit, exiths_clk;
3743 bool ddr_alwon; 3745 bool ddr_alwon;
3744 struct omap_video_timings *timings = &dssdev->panel.timings; 3746 struct omap_video_timings *timings = &dsi->timings;
3745 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); 3747 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
3746 int ndl = dsi->num_lanes_used - 1; 3748 int ndl = dsi->num_lanes_used - 1;
3747 int dsi_fclk_hsdiv = dssdev->clocks.dsi.regm_dsi + 1; 3749 int dsi_fclk_hsdiv = dssdev->clocks.dsi.regm_dsi + 1;
@@ -3994,7 +3996,7 @@ static void dsi_proto_timings(struct omap_dss_device *dssdev)
3994 int vbp = dssdev->panel.dsi_vm_data.vbp; 3996 int vbp = dssdev->panel.dsi_vm_data.vbp;
3995 int window_sync = dssdev->panel.dsi_vm_data.window_sync; 3997 int window_sync = dssdev->panel.dsi_vm_data.window_sync;
3996 bool hsync_end = dssdev->panel.dsi_vm_data.vp_hsync_end; 3998 bool hsync_end = dssdev->panel.dsi_vm_data.vp_hsync_end;
3997 struct omap_video_timings *timings = &dssdev->panel.timings; 3999 struct omap_video_timings *timings = &dsi->timings;
3998 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); 4000 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
3999 int tl, t_he, width_bytes; 4001 int tl, t_he, width_bytes;
4000 4002
@@ -4103,6 +4105,7 @@ EXPORT_SYMBOL(omapdss_dsi_configure_pins);
4103int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) 4105int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
4104{ 4106{
4105 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4107 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4108 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4106 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); 4109 int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
4107 u8 data_type; 4110 u8 data_type;
4108 u16 word_count; 4111 u16 word_count;
@@ -4133,7 +4136,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
4133 /* MODE, 1 = video mode */ 4136 /* MODE, 1 = video mode */
4134 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4); 4137 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4);
4135 4138
4136 word_count = DIV_ROUND_UP(dssdev->panel.timings.x_res * bpp, 8); 4139 word_count = DIV_ROUND_UP(dsi->timings.x_res * bpp, 8);
4137 4140
4138 dsi_vc_write_long_header(dsidev, channel, data_type, 4141 dsi_vc_write_long_header(dsidev, channel, data_type,
4139 word_count, 0); 4142 word_count, 0);
@@ -4367,7 +4370,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
4367{ 4370{
4368 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4371 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4369 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 4372 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4370 struct omap_video_timings timings;
4371 int r; 4373 int r;
4372 u32 irq = 0; 4374 u32 irq = 0;
4373 4375
@@ -4376,14 +4378,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
4376 4378
4377 dssdev->driver->get_resolution(dssdev, &dw, &dh); 4379 dssdev->driver->get_resolution(dssdev, &dw, &dh);
4378 4380
4379 timings.x_res = dw; 4381 dsi->timings.x_res = dw;
4380 timings.y_res = dh; 4382 dsi->timings.y_res = dh;
4381 timings.hsw = 1; 4383 dsi->timings.hsw = 1;
4382 timings.hfp = 1; 4384 dsi->timings.hfp = 1;
4383 timings.hbp = 1; 4385 dsi->timings.hbp = 1;
4384 timings.vsw = 1; 4386 dsi->timings.vsw = 1;
4385 timings.vfp = 0; 4387 dsi->timings.vfp = 0;
4386 timings.vbp = 0; 4388 dsi->timings.vbp = 0;
4387 4389
4388 irq = dispc_mgr_get_framedone_irq(dssdev->manager->id); 4390 irq = dispc_mgr_get_framedone_irq(dssdev->manager->id);
4389 4391
@@ -4397,8 +4399,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
4397 dsi->mgr_config.stallmode = true; 4399 dsi->mgr_config.stallmode = true;
4398 dsi->mgr_config.fifohandcheck = true; 4400 dsi->mgr_config.fifohandcheck = true;
4399 } else { 4401 } else {
4400 timings = dssdev->panel.timings;
4401
4402 dsi->mgr_config.stallmode = false; 4402 dsi->mgr_config.stallmode = false;
4403 dsi->mgr_config.fifohandcheck = false; 4403 dsi->mgr_config.fifohandcheck = false;
4404 } 4404 }
@@ -4407,14 +4407,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
4407 * override interlace, logic level and edge related parameters in 4407 * override interlace, logic level and edge related parameters in
4408 * omap_video_timings with default values 4408 * omap_video_timings with default values
4409 */ 4409 */
4410 timings.interlace = false; 4410 dsi->timings.interlace = false;
4411 timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH; 4411 dsi->timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
4412 timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH; 4412 dsi->timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
4413 timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE; 4413 dsi->timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
4414 timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH; 4414 dsi->timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH;
4415 timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; 4415 dsi->timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
4416 4416
4417 dss_mgr_set_timings(dssdev->manager, &timings); 4417 dss_mgr_set_timings(dssdev->manager, &dsi->timings);
4418 4418
4419 r = dsi_configure_dispc_clocks(dssdev); 4419 r = dsi_configure_dispc_clocks(dssdev);
4420 if (r) 4420 if (r)
@@ -4653,6 +4653,20 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
4653} 4653}
4654EXPORT_SYMBOL(omapdss_dsi_enable_te); 4654EXPORT_SYMBOL(omapdss_dsi_enable_te);
4655 4655
4656void omapdss_dsi_set_timings(struct omap_dss_device *dssdev,
4657 struct omap_video_timings *timings)
4658{
4659 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4660 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4661
4662 mutex_lock(&dsi->lock);
4663
4664 dsi->timings = *timings;
4665
4666 mutex_unlock(&dsi->lock);
4667}
4668EXPORT_SYMBOL(omapdss_dsi_set_timings);
4669
4656static int __init dsi_init_display(struct omap_dss_device *dssdev) 4670static int __init dsi_init_display(struct omap_dss_device *dssdev)
4657{ 4671{
4658 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4672 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);