diff mbox

[3/6] OMAP: DSS2: DSI: use ISR in send_bta_sync

Message ID 1299655288-7121-4-git-send-email-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Delegated to: Tomi Valkeinen
Headers show

Commit Message

Tomi Valkeinen March 9, 2011, 7:21 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 9aea9a7..a4d47dd 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -257,7 +257,6 @@  static struct
 
 	unsigned pll_locked;
 
-	struct completion bta_completion;
 	void (*bta_callback)(void);
 
 	spinlock_t irq_lock;
@@ -341,6 +340,11 @@  static bool dsi_bus_is_locked(void)
 	return dsi.bus_lock.count == 0;
 }
 
+static void dsi_completion_handler(void *data, u32 mask)
+{
+	complete((struct completion *)data);
+}
+
 static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum,
 		int value)
 {
@@ -642,8 +646,6 @@  static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
 			continue;
 
 		if (vcstatus[i] & DSI_VC_IRQ_BTA) {
-			complete(&dsi.bta_completion);
-
 			if (dsi.bta_callback)
 				dsi.bta_callback();
 		}
@@ -2251,33 +2253,37 @@  static int dsi_vc_send_bta(int channel)
 
 int dsi_vc_send_bta_sync(int channel)
 {
+	DECLARE_COMPLETION_ONSTACK(completion);
 	int r = 0;
 	u32 err;
 
-	INIT_COMPLETION(dsi.bta_completion);
-
-	dsi_vc_enable_bta_irq(channel);
+	r = dsi_register_isr_vc(channel, dsi_completion_handler,
+			&completion, DSI_VC_IRQ_BTA);
+	if (r)
+		goto err0;
 
 	r = dsi_vc_send_bta(channel);
 	if (r)
-		goto err;
+		goto err1;
 
-	if (wait_for_completion_timeout(&dsi.bta_completion,
+	if (wait_for_completion_timeout(&completion,
 				msecs_to_jiffies(500)) == 0) {
 		DSSERR("Failed to receive BTA\n");
 		r = -EIO;
-		goto err;
+		goto err1;
 	}
 
 	err = dsi_get_errors();
 	if (err) {
 		DSSERR("Error while sending BTA: %x\n", err);
 		r = -EIO;
-		goto err;
+		goto err1;
 	}
-err:
-	dsi_vc_disable_bta_irq(channel);
 
+err1:
+	dsi_unregister_isr_vc(channel, dsi_completion_handler,
+			&completion, DSI_VC_IRQ_BTA);
+err0:
 	return r;
 }
 EXPORT_SYMBOL(dsi_vc_send_bta_sync);
@@ -3647,8 +3653,6 @@  static int dsi_init(struct platform_device *pdev)
 	dsi.irq_stats.last_reset = jiffies;
 #endif
 
-	init_completion(&dsi.bta_completion);
-
 	mutex_init(&dsi.lock);
 	sema_init(&dsi.bus_lock, 1);