diff options
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 8613ec489410..18b72521ee7e 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -249,7 +249,6 @@ static struct | |||
249 | 249 | ||
250 | unsigned pll_locked; | 250 | unsigned pll_locked; |
251 | 251 | ||
252 | struct completion bta_completion; | ||
253 | void (*bta_callback)(void); | 252 | void (*bta_callback)(void); |
254 | 253 | ||
255 | spinlock_t irq_lock; | 254 | spinlock_t irq_lock; |
@@ -338,6 +337,11 @@ static bool dsi_bus_is_locked(void) | |||
338 | return dsi.bus_lock.count == 0; | 337 | return dsi.bus_lock.count == 0; |
339 | } | 338 | } |
340 | 339 | ||
340 | static void dsi_completion_handler(void *data, u32 mask) | ||
341 | { | ||
342 | complete((struct completion *)data); | ||
343 | } | ||
344 | |||
341 | static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum, | 345 | static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum, |
342 | int value) | 346 | int value) |
343 | { | 347 | { |
@@ -641,8 +645,6 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg) | |||
641 | continue; | 645 | continue; |
642 | 646 | ||
643 | if (vcstatus[i] & DSI_VC_IRQ_BTA) { | 647 | if (vcstatus[i] & DSI_VC_IRQ_BTA) { |
644 | complete(&dsi.bta_completion); | ||
645 | |||
646 | if (dsi.bta_callback) | 648 | if (dsi.bta_callback) |
647 | dsi.bta_callback(); | 649 | dsi.bta_callback(); |
648 | } | 650 | } |
@@ -2263,33 +2265,37 @@ static int dsi_vc_send_bta(int channel) | |||
2263 | 2265 | ||
2264 | int dsi_vc_send_bta_sync(int channel) | 2266 | int dsi_vc_send_bta_sync(int channel) |
2265 | { | 2267 | { |
2268 | DECLARE_COMPLETION_ONSTACK(completion); | ||
2266 | int r = 0; | 2269 | int r = 0; |
2267 | u32 err; | 2270 | u32 err; |
2268 | 2271 | ||
2269 | INIT_COMPLETION(dsi.bta_completion); | 2272 | r = dsi_register_isr_vc(channel, dsi_completion_handler, |
2270 | 2273 | &completion, DSI_VC_IRQ_BTA); | |
2271 | dsi_vc_enable_bta_irq(channel); | 2274 | if (r) |
2275 | goto err0; | ||
2272 | 2276 | ||
2273 | r = dsi_vc_send_bta(channel); | 2277 | r = dsi_vc_send_bta(channel); |
2274 | if (r) | 2278 | if (r) |
2275 | goto err; | 2279 | goto err1; |
2276 | 2280 | ||
2277 | if (wait_for_completion_timeout(&dsi.bta_completion, | 2281 | if (wait_for_completion_timeout(&completion, |
2278 | msecs_to_jiffies(500)) == 0) { | 2282 | msecs_to_jiffies(500)) == 0) { |
2279 | DSSERR("Failed to receive BTA\n"); | 2283 | DSSERR("Failed to receive BTA\n"); |
2280 | r = -EIO; | 2284 | r = -EIO; |
2281 | goto err; | 2285 | goto err1; |
2282 | } | 2286 | } |
2283 | 2287 | ||
2284 | err = dsi_get_errors(); | 2288 | err = dsi_get_errors(); |
2285 | if (err) { | 2289 | if (err) { |
2286 | DSSERR("Error while sending BTA: %x\n", err); | 2290 | DSSERR("Error while sending BTA: %x\n", err); |
2287 | r = -EIO; | 2291 | r = -EIO; |
2288 | goto err; | 2292 | goto err1; |
2289 | } | 2293 | } |
2290 | err: | ||
2291 | dsi_vc_disable_bta_irq(channel); | ||
2292 | 2294 | ||
2295 | err1: | ||
2296 | dsi_unregister_isr_vc(channel, dsi_completion_handler, | ||
2297 | &completion, DSI_VC_IRQ_BTA); | ||
2298 | err0: | ||
2293 | return r; | 2299 | return r; |
2294 | } | 2300 | } |
2295 | EXPORT_SYMBOL(dsi_vc_send_bta_sync); | 2301 | EXPORT_SYMBOL(dsi_vc_send_bta_sync); |
@@ -3670,8 +3676,6 @@ static int dsi_init(struct platform_device *pdev) | |||
3670 | dsi.irq_stats.last_reset = jiffies; | 3676 | dsi.irq_stats.last_reset = jiffies; |
3671 | #endif | 3677 | #endif |
3672 | 3678 | ||
3673 | init_completion(&dsi.bta_completion); | ||
3674 | |||
3675 | mutex_init(&dsi.lock); | 3679 | mutex_init(&dsi.lock); |
3676 | sema_init(&dsi.bus_lock, 1); | 3680 | sema_init(&dsi.bus_lock, 1); |
3677 | 3681 | ||