linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <archit@ti.com>
To: tomi.valkeinen@ti.com
Cc: linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
	Archit Taneja <archit@ti.com>
Subject: [PATCH v2 03/13] OMAPDSS: DSI: Maintain own copy of timings in driver data
Date: Thu, 09 Aug 2012 11:56:11 +0000	[thread overview]
Message-ID: <1344512989-4071-4-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1344512989-4071-1-git-send-email-archit@ti.com>

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>
---
 drivers/video/omap2/dss/dsi.c |   58 +++++++++++++++++++++++++----------------
 include/video/omapdss.h       |    2 ++
 2 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 27c27c4..815b606 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -333,6 +333,7 @@ struct dsi_data {
 	unsigned scp_clk_refcount;
 
 	struct dss_lcd_mgr_config mgr_config;
+	struct omap_video_timings timings;
 };
 
 struct dsi_packet_sent_handler_data {
@@ -3607,9 +3608,10 @@ static void dsi_config_vp_num_line_buffers(struct omap_dss_device *dssdev)
 	int num_line_buffers;
 
 	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);
 		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
 		 * port's line buffer size
@@ -3738,7 +3740,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 tclk_trail, ths_exit, exiths_clk;
 	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 ndl = dsi->num_lanes_used - 1;
 	const struct omapdss_clock_config *clks;
@@ -3996,7 +3998,7 @@ static void dsi_proto_timings(struct omap_dss_device *dssdev)
 		int vbp = dssdev->panel.dsi_vm_data.vbp;
 		int window_sync = dssdev->panel.dsi_vm_data.window_sync;
 		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 tl, t_he, width_bytes;
 
@@ -4105,6 +4107,7 @@ EXPORT_SYMBOL(omapdss_dsi_configure_pins);
 int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
 	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);
 	u8 data_type;
 	u16 word_count;
@@ -4135,7 +4138,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 		/* MODE, 1 = video mode */
 		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,
 				word_count, 0);
@@ -4370,7 +4373,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
 {
 	struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
 	struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
-	struct omap_video_timings timings;
 	const struct omapdss_clock_config *clks;
 	int r, lcd_id;
 	u32 irq = 0;
@@ -4380,14 +4382,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
 
 		dssdev->driver->get_resolution(dssdev, &dw, &dh);
 
-		timings.x_res = dw;
-		timings.y_res = dh;
-		timings.hsw = 1;
-		timings.hfp = 1;
-		timings.hbp = 1;
-		timings.vsw = 1;
-		timings.vfp = 0;
-		timings.vbp = 0;
+		dsi->timings.x_res = dw;
+		dsi->timings.y_res = dh;
+		dsi->timings.hsw = 1;
+		dsi->timings.hfp = 1;
+		dsi->timings.hbp = 1;
+		dsi->timings.vsw = 1;
+		dsi->timings.vfp = 0;
+		dsi->timings.vbp = 0;
 
 		irq = dispc_mgr_get_framedone_irq(dssdev->manager->id);
 
@@ -4401,8 +4403,6 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
 		dsi->mgr_config.stallmode = true;
 		dsi->mgr_config.fifohandcheck = true;
 	} else {
-		timings = dssdev->panel.timings;
-
 		dsi->mgr_config.stallmode = false;
 		dsi->mgr_config.fifohandcheck = false;
 	}
@@ -4411,14 +4411,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
 	 * override interlace, logic level and edge related parameters in
 	 * omap_video_timings with default values
 	 */
-	timings.interlace = false;
-	timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
-	timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
-	timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
-	timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH;
-	timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
+	dsi->timings.interlace = false;
+	dsi->timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
+	dsi->timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH;
+	dsi->timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
+	dsi->timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH;
+	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);
 
 	switch (dssdev->manager->id) {
 	case OMAP_DSS_CHANNEL_LCD:
@@ -4688,6 +4688,20 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
 }
 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)
 {
 	struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index ebf2ebd..a2cd133 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -736,6 +736,8 @@ int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
 void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
 		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,
 		void (*callback)(int, void *), void *data);
-- 
1.7.9.5


  parent reply	other threads:[~2012-08-09 11:56 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 10:43 [RFC 00/17] OMAPDSS: Change way of passing timings from panel driver to interface Archit Taneja
2012-08-01 10:43 ` [RFC 01/17] OMAPDSS: APPLY: Constify timings argument in dss_mgr_set_timings Archit Taneja
2012-08-01 10:43 ` [RFC 02/17] OMAPDSS: DPI: Remove omap_dss_device arguments in dpi_set_dsi_clk/dpi_set_dispc_clk Archit Taneja
2012-08-01 10:43 ` [RFC 03/17] OMAPDSS: HDMI: Remove omap_dss_device argument from hdmi_compute_pll Archit Taneja
2012-08-01 10:43 ` [RFC 04/17] OMAPDSS: DPI: Add locking for DPI interface Archit Taneja
2012-08-01 10:43 ` [RFC 05/17] OMAPDSS: DPI: Maintain our own timings field in driver data Archit Taneja
2012-08-01 10:43 ` [RFC 06/17] OMAPDSS: DPI displays: Take care of panel timings in the driver itself Archit Taneja
2012-08-01 10:43 ` [RFC 07/17] OMAPDSS: Displays: Add locking in generic DPI panel driver Archit Taneja
2012-08-01 10:43 ` [RFC 08/17] OMAPDSS: DSI: Maintain own copy of timings in driver data Archit Taneja
2012-08-07 14:07   ` Tomi Valkeinen
2012-08-08  6:09     ` Archit Taneja
2012-08-08  6:15       ` Tomi Valkeinen
2012-08-08  6:41         ` Archit Taneja
2012-08-08  7:10           ` Tomi Valkeinen
2012-08-08  8:06             ` Archit Taneja
2012-08-01 10:43 ` [RFC 09/17] OMAPDSS: HDMI: Use our own omap_video_timings field when setting interface timings Archit Taneja
2012-08-01 10:43 ` [RFC 10/17] OMAPDSS: HDMI: Add a get_timing function for HDMI interface Archit Taneja
2012-08-01 10:43 ` [RFC 11/17] OMAPDSS: HDMI: Add locking for hdmi interface get/set timing functions Archit Taneja
2012-08-01 10:43 ` [RFC 12/17] OMAPDSS: SDI: Create a separate function for timing/clock configurations Archit Taneja
2012-08-01 10:43 ` [RFC 13/17] OMAPDSS: SDI: Create a function to set timings Archit Taneja
2012-08-07 14:20   ` Tomi Valkeinen
2012-08-08  6:10     ` Archit Taneja
2012-08-01 10:43 ` [RFC 14/17] OMAPDSS: SDI: Maintain our own timings field in driver data Archit Taneja
2012-08-01 10:43 ` [RFC 15/17] OMAPDSS: VENC: Split VENC into interface and panel driver Archit Taneja
2012-08-01 10:43 ` [RFC 16/17] OMAPDSS: VENC: Maintain our own timings field in driver data Archit Taneja
2012-08-01 10:43 ` [RFC 17/17] OMAPDSS: VENC: Add a get_timing function for VENC interface Archit Taneja
2012-08-01 10:47 ` [RFC 00/17] OMAPDSS: Change way of passing timings from panel driver to interface Archit Taneja
2012-08-07 14:32 ` Tomi Valkeinen
2012-08-08  6:17   ` Archit Taneja
2012-08-08  6:25     ` Tomi Valkeinen
2012-08-08  6:59       ` Archit Taneja
2012-08-08  7:27         ` Tomi Valkeinen
2012-08-08  8:11           ` Archit Taneja
2012-08-08  8:13             ` Tomi Valkeinen
2012-08-08  8:50               ` Archit Taneja
2012-08-08  8:48                 ` Tomi Valkeinen
2012-08-08  9:36                   ` Archit Taneja
2012-08-09 11:55 ` [PATCH v2 00/13] " Archit Taneja
2012-08-09 11:56   ` [PATCH v2 01/13] OMAPDSS: DPI: Maintain our own timings field in driver data Archit Taneja
2012-08-09 11:56   ` [PATCH v2 02/13] OMAPDSS: DPI displays: Take care of panel timings in the driver itself Archit Taneja
2012-08-09 11:56   ` Archit Taneja [this message]
2012-08-09 11:56   ` [PATCH v2 04/13] OMAPDSS: DSI: Add function to set panel size for command mode panels Archit Taneja
2012-08-09 11:56   ` [PATCH v2 05/13] OMAPDSS: DSI: Update manager timings on a manual update Archit Taneja
2012-08-09 11:56   ` [PATCH v2 06/13] OMAPDSS: HDMI: Use our own omap_video_timings field when setting interface timings Archit Taneja
2012-08-09 11:56   ` [PATCH v2 07/13] OMAPDSS: HDMI: Add a get_timing function for HDMI interface Archit Taneja
2012-08-14 13:02     ` Tomi Valkeinen
2012-08-14 13:27       ` Archit Taneja
2012-08-14 14:10         ` Tomi Valkeinen
2012-08-14 17:28           ` Archit Taneja
2012-08-09 11:56   ` [PATCH v2 08/13] OMAPDSS: HDMI: Add locking for hdmi interface get/set timing functions Archit Taneja
2012-08-09 11:56   ` [PATCH v2 09/13] OMAPDSS: SDI: Create a function to set timings Archit Taneja
2012-08-14 13:44     ` Tomi Valkeinen
2012-08-14 17:08       ` Archit Taneja
2012-08-14 17:33         ` Tomi Valkeinen
2012-08-14 19:20           ` Archit Taneja
2012-08-15  6:43             ` Tomi Valkeinen
2012-08-14 19:26         ` Rob Clark
2012-08-09 11:56   ` [PATCH v2 10/13] OMAPDSS: SDI: Maintain our own timings field in driver data Archit Taneja
2012-08-09 11:56   ` [PATCH v2 11/13] OMAPDSS: VENC: Split VENC into interface and panel driver Archit Taneja
2012-08-09 11:56   ` [PATCH v2 12/13] OMAPDSS: VENC: Maintain our own timings field in driver data Archit Taneja
2012-08-09 11:56   ` [PATCH v2 13/13] OMAPDSS: VENC: Add a get_timing function for VENC interface Archit Taneja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344512989-4071-4-git-send-email-archit@ti.com \
    --to=archit@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).