Commit e67458a8 authored by Archit Taneja's avatar Archit Taneja

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: default avatarArchit Taneja <archit@ti.com>
parent bdcae3cc
...@@ -333,6 +333,7 @@ struct dsi_data { ...@@ -333,6 +333,7 @@ struct dsi_data {
unsigned scp_clk_refcount; unsigned scp_clk_refcount;
struct dss_lcd_mgr_config mgr_config; struct dss_lcd_mgr_config mgr_config;
struct omap_video_timings timings;
}; };
struct dsi_packet_sent_handler_data { struct dsi_packet_sent_handler_data {
...@@ -3610,9 +3611,10 @@ static void dsi_config_vp_num_line_buffers(struct omap_dss_device *dssdev) ...@@ -3610,9 +3611,10 @@ static void dsi_config_vp_num_line_buffers(struct omap_dss_device *dssdev)
int num_line_buffers; int num_line_buffers;
if (dssdev->panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) { if (dssdev->panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
unsigned line_buf_size = dsi_get_line_buf_size(dsidev); unsigned line_buf_size = dsi_get_line_buf_size(dsidev);
struct omap_video_timings *timings = &dssdev->panel.timings; struct omap_video_timings *timings = &dsi->timings;
/* /*
* Don't use line buffers if width is greater than the video * Don't use line buffers if width is greater than the video
* port's line buffer size * port's line buffer size
...@@ -3741,7 +3743,7 @@ static void dsi_config_cmd_mode_interleaving(struct omap_dss_device *dssdev) ...@@ -3741,7 +3743,7 @@ static void dsi_config_cmd_mode_interleaving(struct omap_dss_device *dssdev)
int ddr_clk_pre, ddr_clk_post, enter_hs_mode_lat, exit_hs_mode_lat; int ddr_clk_pre, ddr_clk_post, enter_hs_mode_lat, exit_hs_mode_lat;
int tclk_trail, ths_exit, exiths_clk; int tclk_trail, ths_exit, exiths_clk;
bool ddr_alwon; bool ddr_alwon;
struct omap_video_timings *timings = &dssdev->panel.timings; struct omap_video_timings *timings = &dsi->timings;
int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
int ndl = dsi->num_lanes_used - 1; int ndl = dsi->num_lanes_used - 1;
int dsi_fclk_hsdiv = dssdev->clocks.dsi.regm_dsi + 1; 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,7 +3996,7 @@ static void dsi_proto_timings(struct omap_dss_device *dssdev)
int vbp = dssdev->panel.dsi_vm_data.vbp; int vbp = dssdev->panel.dsi_vm_data.vbp;
int window_sync = dssdev->panel.dsi_vm_data.window_sync; int window_sync = dssdev->panel.dsi_vm_data.window_sync;
bool hsync_end = dssdev->panel.dsi_vm_data.vp_hsync_end; bool hsync_end = dssdev->panel.dsi_vm_data.vp_hsync_end;
struct omap_video_timings *timings = &dssdev->panel.timings; struct omap_video_timings *timings = &dsi->timings;
int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
int tl, t_he, width_bytes; int tl, t_he, width_bytes;
...@@ -4103,6 +4105,7 @@ EXPORT_SYMBOL(omapdss_dsi_configure_pins); ...@@ -4103,6 +4105,7 @@ EXPORT_SYMBOL(omapdss_dsi_configure_pins);
int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
{ {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); int bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
u8 data_type; u8 data_type;
u16 word_count; u16 word_count;
...@@ -4133,7 +4136,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) ...@@ -4133,7 +4136,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
/* MODE, 1 = video mode */ /* MODE, 1 = video mode */
REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4); REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4);
word_count = DIV_ROUND_UP(dssdev->panel.timings.x_res * bpp, 8); word_count = DIV_ROUND_UP(dsi->timings.x_res * bpp, 8);
dsi_vc_write_long_header(dsidev, channel, data_type, dsi_vc_write_long_header(dsidev, channel, data_type,
word_count, 0); word_count, 0);
...@@ -4367,7 +4370,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev) ...@@ -4367,7 +4370,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
{ {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
struct omap_video_timings timings;
int r; int r;
u32 irq = 0; u32 irq = 0;
...@@ -4376,14 +4378,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev) ...@@ -4376,14 +4378,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
dssdev->driver->get_resolution(dssdev, &dw, &dh); dssdev->driver->get_resolution(dssdev, &dw, &dh);
timings.x_res = dw; dsi->timings.x_res = dw;
timings.y_res = dh; dsi->timings.y_res = dh;
timings.hsw = 1; dsi->timings.hsw = 1;
timings.hfp = 1; dsi->timings.hfp = 1;
timings.hbp = 1; dsi->timings.hbp = 1;
timings.vsw = 1; dsi->timings.vsw = 1;
timings.vfp = 0; dsi->timings.vfp = 0;
timings.vbp = 0; dsi->timings.vbp = 0;
irq = dispc_mgr_get_framedone_irq(dssdev->manager->id); irq = dispc_mgr_get_framedone_irq(dssdev->manager->id);
...@@ -4397,8 +4399,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev) ...@@ -4397,8 +4399,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
dsi->mgr_config.stallmode = true; dsi->mgr_config.stallmode = true;
dsi->mgr_config.fifohandcheck = true; dsi->mgr_config.fifohandcheck = true;
} else { } else {
timings = dssdev->panel.timings;
dsi->mgr_config.stallmode = false; dsi->mgr_config.stallmode = false;
dsi->mgr_config.fifohandcheck = false; dsi->mgr_config.fifohandcheck = false;
} }
...@@ -4407,14 +4407,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev) ...@@ -4407,14 +4407,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
* override interlace, logic level and edge related parameters in * override interlace, logic level and edge related parameters in
* omap_video_timings with default values * omap_video_timings with default values
*/ */
timings.interlace = false; dsi->timings.interlace = false;
timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH; dsi->timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH; dsi->timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE; dsi->timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH; dsi->timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH;
timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; dsi->timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
dss_mgr_set_timings(dssdev->manager, &timings); dss_mgr_set_timings(dssdev->manager, &dsi->timings);
r = dsi_configure_dispc_clocks(dssdev); r = dsi_configure_dispc_clocks(dssdev);
if (r) if (r)
...@@ -4653,6 +4653,20 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) ...@@ -4653,6 +4653,20 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
} }
EXPORT_SYMBOL(omapdss_dsi_enable_te); EXPORT_SYMBOL(omapdss_dsi_enable_te);
void omapdss_dsi_set_timings(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
{
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
mutex_lock(&dsi->lock);
dsi->timings = *timings;
mutex_unlock(&dsi->lock);
}
EXPORT_SYMBOL(omapdss_dsi_set_timings);
static int __init dsi_init_display(struct omap_dss_device *dssdev) static int __init dsi_init_display(struct omap_dss_device *dssdev)
{ {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
......
...@@ -719,6 +719,8 @@ int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask, ...@@ -719,6 +719,8 @@ int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
bool enable); bool enable);
int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
void omapdss_dsi_set_timings(struct omap_dss_device *dssdev,
struct omap_video_timings *timings);
int omap_dsi_update(struct omap_dss_device *dssdev, int channel, int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
void (*callback)(int, void *), void *data); void (*callback)(int, void *), void *data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment