OMAP: DSS2: DSI: use ISR in send_bta_sync
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 2 Mar 2011 12:48:41 +0000 (14:48 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 15 Mar 2011 08:54:19 +0000 (14:24 +0530)
Remove bta_completion handling from the interrupt handler, and use ISR
support instead.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/dsi.c

index 8613ec4..18b7252 100644 (file)
@@ -249,7 +249,6 @@ static struct
 
        unsigned pll_locked;
 
-       struct completion bta_completion;
        void (*bta_callback)(void);
 
        spinlock_t irq_lock;
@@ -338,6 +337,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)
 {
@@ -641,8 +645,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();
                }
@@ -2263,33 +2265,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);
@@ -3670,8 +3676,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);