All of lore.kernel.org
 help / color / mirror / Atom feed
From: Archit Taneja <archit@ti.com>
To: tomi.valkeinen@ti.com
Cc: linux-omap@vger.kernel.org, Archit Taneja <archit@ti.com>
Subject: [PATCH 6/9] OMAP: DSS2: DSI: Pass pointer to struct to packet_sent_handler isrs
Date: Wed,  4 May 2011 13:08:21 +0530	[thread overview]
Message-ID: <1304494704-7285-7-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1304494704-7285-1-git-send-email-archit@ti.com>

dsi_packet_sent_handler_vp() and dsi_packet_sent_handler_l4() currently
receive the completion parameter as their argument. This is not sufficient
information to differentiate between DSI1 and DSI2 platform devices.

Pass the struct "dsi_packet_sent_handler_data" to the packet_sent_handler
isrs, these contain the platform_device pointer of the DSI device and the
pointer to the completion struct.

Signed-off-by: Archit Taneja <archit@ti.com>
---
 drivers/video/omap2/dss/dsi.c |   43 +++++++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 627869e..a8478be 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -330,6 +330,11 @@ struct dsi_data {
 	unsigned scp_clk_refcount;
 };
 
+struct dsi_packet_sent_handler_data {
+	struct platform_device *dsidev;
+	struct completion *completion;
+};
+
 static struct platform_device *dsi_pdev_map[MAX_NUM_DSI];
 
 #ifdef DEBUG
@@ -2382,27 +2387,28 @@ static bool dsi_vc_is_enabled(struct platform_device *dsidev, int channel)
 
 static void dsi_packet_sent_handler_vp(void *data, u32 mask)
 {
-	struct platform_device *dsidev = dsi_get_dsi_device_module(0);
-	struct dsi_data *dsi = dsi_get_dsi_data(dsidev);
+	struct dsi_packet_sent_handler_data *vp_data =
+		(struct dsi_packet_sent_handler_data *) data;
+	struct dsi_data *dsi = dsi_get_dsi_data(vp_data->dsidev);
 	const int channel = dsi->update_channel;
 	u8 bit = dsi->te_enabled ? 30 : 31;
 
-	if (REG_GET(dsidev, DSI_VC_TE(channel), bit, bit) == 0)
-		complete((struct completion *)data);
+	if (REG_GET(vp_data->dsidev, DSI_VC_TE(channel), bit, bit) == 0)
+		complete(vp_data->completion);
 }
 
 static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel)
 {
 	struct dsi_data *dsi = dsi_get_dsi_data(dsidev);
+	DECLARE_COMPLETION_ONSTACK(completion);
+	struct dsi_packet_sent_handler_data vp_data = { dsidev, &completion };
 	int r = 0;
 	u8 bit;
 
-	DECLARE_COMPLETION_ONSTACK(completion);
-
 	bit = dsi->te_enabled ? 30 : 31;
 
 	r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp,
-		&completion, DSI_VC_IRQ_PACKET_SENT);
+		&vp_data, DSI_VC_IRQ_PACKET_SENT);
 	if (r)
 		goto err0;
 
@@ -2417,34 +2423,35 @@ static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel)
 	}
 
 	dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp,
-		&completion, DSI_VC_IRQ_PACKET_SENT);
+		&vp_data, DSI_VC_IRQ_PACKET_SENT);
 
 	return 0;
 err1:
 	dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp,
-		&completion, DSI_VC_IRQ_PACKET_SENT);
+		&vp_data, DSI_VC_IRQ_PACKET_SENT);
 err0:
 	return r;
 }
 
 static void dsi_packet_sent_handler_l4(void *data, u32 mask)
 {
-	struct platform_device *dsidev = dsi_get_dsi_device_module(0);
-	struct dsi_data *dsi = dsi_get_dsi_data(dsidev);
+	struct dsi_packet_sent_handler_data *l4_data =
+		(struct dsi_packet_sent_handler_data *) data;
+	struct dsi_data *dsi = dsi_get_dsi_data(l4_data->dsidev);
 	const int channel = dsi->update_channel;
 
-	if (REG_GET(dsidev, DSI_VC_CTRL(channel), 5, 5) == 0)
-		complete((struct completion *)data);
+	if (REG_GET(l4_data->dsidev, DSI_VC_CTRL(channel), 5, 5) == 0)
+		complete(l4_data->completion);
 }
 
 static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel)
 {
-	int r = 0;
-
 	DECLARE_COMPLETION_ONSTACK(completion);
+	struct dsi_packet_sent_handler_data l4_data = { dsidev, &completion };
+	int r = 0;
 
 	r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4,
-		&completion, DSI_VC_IRQ_PACKET_SENT);
+		&l4_data, DSI_VC_IRQ_PACKET_SENT);
 	if (r)
 		goto err0;
 
@@ -2459,12 +2466,12 @@ static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel)
 	}
 
 	dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4,
-		&completion, DSI_VC_IRQ_PACKET_SENT);
+		&l4_data, DSI_VC_IRQ_PACKET_SENT);
 
 	return 0;
 err1:
 	dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4,
-		&completion, DSI_VC_IRQ_PACKET_SENT);
+		&l4_data, DSI_VC_IRQ_PACKET_SENT);
 err0:
 	return r;
 }
-- 
1.7.1


  parent reply	other threads:[~2011-05-04  7:33 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04  7:38 [PATCH 0/9] MAP: DSS2: DSI2 for secondary lcd panel on OMAP4 Archit Taneja
2011-05-04  7:38 ` [PATCH 1/9] OMAP: DSS2: Change DSI platform device name from "omapdss_dsi1" to "omapdss_dsi" Archit Taneja
2011-05-04  9:40   ` Tony Lindgren
2011-05-04 10:53     ` Tomi Valkeinen
2011-05-04 11:21       ` Tomi Valkeinen
2011-05-04 12:11         ` Archit Taneja
2011-05-04 12:17       ` Tony Lindgren
2011-05-05 11:36     ` Tomi Valkeinen
2011-05-05 11:50       ` Tony Lindgren
2011-05-05 11:58         ` Tomi Valkeinen
2011-05-05 13:03         ` Tomi Valkeinen
2011-05-05 13:02       ` Mark Brown
2011-05-09 15:34         ` Tomi Valkeinen
2011-05-09 19:19           ` Mark Brown
2011-05-10 12:30             ` Tomi Valkeinen
2011-05-10 13:47               ` Mark Brown
2011-05-11  9:23                 ` Tomi Valkeinen
2011-05-11 12:12                   ` Mark Brown
2011-06-07 11:44                     ` Tomi Valkeinen
2011-06-07 12:08                       ` Mark Brown
2011-06-07 13:11     ` Tomi Valkeinen
2011-06-13  9:54       ` Tomi Valkeinen
2011-06-13 13:27       ` Tony Lindgren
2011-05-04  7:38 ` [PATCH 2/9] OMAP: DSS2: DSI: Add extra omap_dss_device argument in functions exported by dsi Archit Taneja
2011-05-04  7:38 ` [PATCH 3/9] OMAP: DSS2: Remove omap_dss_device argument from dsi_pll_init() Archit Taneja
2011-05-04  7:38 ` [PATCH 4/9] OMAP: DSS2: Pass platform_device as an argument in dsi functions Archit Taneja
2011-05-04  7:38 ` [PATCH 5/9] OMAP: DSS2: DSI: Use platform_device pointer to get dsi data Archit Taneja
2011-05-04  7:38 ` Archit Taneja [this message]
2011-05-04  7:38 ` [PATCH 7/9] OMAP4: DSS2: DSI: Changes for DSI2 on OMAP4 Archit Taneja
2011-05-04  7:38 ` [PATCH 8/9] OMAP: DSS2: DSI: Build a platform device instance for DSI2 Archit Taneja
2011-05-04  7:38 ` [PATCH 9/9] OMAP: DSS2: Taal: Use device name in backlight_device_register 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=1304494704-7285-7-git-send-email-archit@ti.com \
    --to=archit@ti.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.