Commit f36a06e7 authored by Tomi Valkeinen's avatar Tomi Valkeinen

OMAP: DSS2: DSI: use ISR in send_bta_sync

Remove bta_completion handling from the interrupt handler, and use ISR
support instead.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 4ae2dddd
...@@ -249,7 +249,6 @@ static struct ...@@ -249,7 +249,6 @@ static struct
unsigned pll_locked; unsigned pll_locked;
struct completion bta_completion;
void (*bta_callback)(void); void (*bta_callback)(void);
spinlock_t irq_lock; spinlock_t irq_lock;
...@@ -338,6 +337,11 @@ static bool dsi_bus_is_locked(void) ...@@ -338,6 +337,11 @@ static bool dsi_bus_is_locked(void)
return dsi.bus_lock.count == 0; 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, static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum,
int value) int value)
{ {
...@@ -641,8 +645,6 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg) ...@@ -641,8 +645,6 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
continue; continue;
if (vcstatus[i] & DSI_VC_IRQ_BTA) { if (vcstatus[i] & DSI_VC_IRQ_BTA) {
complete(&dsi.bta_completion);
if (dsi.bta_callback) if (dsi.bta_callback)
dsi.bta_callback(); dsi.bta_callback();
} }
...@@ -2263,33 +2265,37 @@ static int dsi_vc_send_bta(int channel) ...@@ -2263,33 +2265,37 @@ static int dsi_vc_send_bta(int channel)
int dsi_vc_send_bta_sync(int channel) int dsi_vc_send_bta_sync(int channel)
{ {
DECLARE_COMPLETION_ONSTACK(completion);
int r = 0; int r = 0;
u32 err; u32 err;
INIT_COMPLETION(dsi.bta_completion); r = dsi_register_isr_vc(channel, dsi_completion_handler,
&completion, DSI_VC_IRQ_BTA);
dsi_vc_enable_bta_irq(channel); if (r)
goto err0;
r = dsi_vc_send_bta(channel); r = dsi_vc_send_bta(channel);
if (r) 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) { msecs_to_jiffies(500)) == 0) {
DSSERR("Failed to receive BTA\n"); DSSERR("Failed to receive BTA\n");
r = -EIO; r = -EIO;
goto err; goto err1;
} }
err = dsi_get_errors(); err = dsi_get_errors();
if (err) { if (err) {
DSSERR("Error while sending BTA: %x\n", err); DSSERR("Error while sending BTA: %x\n", err);
r = -EIO; 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; return r;
} }
EXPORT_SYMBOL(dsi_vc_send_bta_sync); EXPORT_SYMBOL(dsi_vc_send_bta_sync);
...@@ -3670,8 +3676,6 @@ static int dsi_init(struct platform_device *pdev) ...@@ -3670,8 +3676,6 @@ static int dsi_init(struct platform_device *pdev)
dsi.irq_stats.last_reset = jiffies; dsi.irq_stats.last_reset = jiffies;
#endif #endif
init_completion(&dsi.bta_completion);
mutex_init(&dsi.lock); mutex_init(&dsi.lock);
sema_init(&dsi.bus_lock, 1); sema_init(&dsi.bus_lock, 1);
......
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