diff options
| -rw-r--r-- | drivers/video/omap2/dss/dsi.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 928b5e44a3dd..53fc0f8cb1a0 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
| 28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
| 29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
| 30 | #include <linux/semaphore.h> | ||
| 30 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
| 31 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
| 32 | #include <linux/regulator/consumer.h> | 33 | #include <linux/regulator/consumer.h> |
| @@ -227,7 +228,7 @@ static struct | |||
| 227 | } vc[4]; | 228 | } vc[4]; |
| 228 | 229 | ||
| 229 | struct mutex lock; | 230 | struct mutex lock; |
| 230 | struct mutex bus_lock; | 231 | struct semaphore bus_lock; |
| 231 | 232 | ||
| 232 | unsigned pll_locked; | 233 | unsigned pll_locked; |
| 233 | 234 | ||
| @@ -298,19 +299,19 @@ void dsi_restore_context(void) | |||
| 298 | 299 | ||
| 299 | void dsi_bus_lock(void) | 300 | void dsi_bus_lock(void) |
| 300 | { | 301 | { |
| 301 | mutex_lock(&dsi.bus_lock); | 302 | down(&dsi.bus_lock); |
| 302 | } | 303 | } |
| 303 | EXPORT_SYMBOL(dsi_bus_lock); | 304 | EXPORT_SYMBOL(dsi_bus_lock); |
| 304 | 305 | ||
| 305 | void dsi_bus_unlock(void) | 306 | void dsi_bus_unlock(void) |
| 306 | { | 307 | { |
| 307 | mutex_unlock(&dsi.bus_lock); | 308 | up(&dsi.bus_lock); |
| 308 | } | 309 | } |
| 309 | EXPORT_SYMBOL(dsi_bus_unlock); | 310 | EXPORT_SYMBOL(dsi_bus_unlock); |
| 310 | 311 | ||
| 311 | static bool dsi_bus_is_locked(void) | 312 | static bool dsi_bus_is_locked(void) |
| 312 | { | 313 | { |
| 313 | return mutex_is_locked(&dsi.bus_lock); | 314 | return dsi.bus_lock.count == 0; |
| 314 | } | 315 | } |
| 315 | 316 | ||
| 316 | static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum, | 317 | static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum, |
| @@ -3002,8 +3003,6 @@ static int dsi_update_thread(void *data) | |||
| 3002 | u16 x, y, w, h; | 3003 | u16 x, y, w, h; |
| 3003 | 3004 | ||
| 3004 | while (1) { | 3005 | while (1) { |
| 3005 | bool sched; | ||
| 3006 | |||
| 3007 | wait_event_interruptible(dsi.waitqueue, | 3006 | wait_event_interruptible(dsi.waitqueue, |
| 3008 | dsi.update_mode == OMAP_DSS_UPDATE_AUTO || | 3007 | dsi.update_mode == OMAP_DSS_UPDATE_AUTO || |
| 3009 | (dsi.update_mode == OMAP_DSS_UPDATE_MANUAL && | 3008 | (dsi.update_mode == OMAP_DSS_UPDATE_MANUAL && |
| @@ -3089,16 +3088,9 @@ static int dsi_update_thread(void *data) | |||
| 3089 | dsi_perf_show("L4"); | 3088 | dsi_perf_show("L4"); |
| 3090 | } | 3089 | } |
| 3091 | 3090 | ||
| 3092 | sched = atomic_read(&dsi.bus_lock.count) < 0; | ||
| 3093 | |||
| 3094 | complete_all(&dsi.update_completion); | 3091 | complete_all(&dsi.update_completion); |
| 3095 | 3092 | ||
| 3096 | dsi_bus_unlock(); | 3093 | dsi_bus_unlock(); |
| 3097 | |||
| 3098 | /* XXX We need to give others chance to get the bus lock. Is | ||
| 3099 | * there a better way for this? */ | ||
| 3100 | if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO && sched) | ||
| 3101 | schedule_timeout_interruptible(1); | ||
| 3102 | } | 3094 | } |
| 3103 | 3095 | ||
| 3104 | DSSDBG("update thread exiting\n"); | 3096 | DSSDBG("update thread exiting\n"); |
| @@ -3798,7 +3790,7 @@ int dsi_init(struct platform_device *pdev) | |||
| 3798 | spin_lock_init(&dsi.update_lock); | 3790 | spin_lock_init(&dsi.update_lock); |
| 3799 | 3791 | ||
| 3800 | mutex_init(&dsi.lock); | 3792 | mutex_init(&dsi.lock); |
| 3801 | mutex_init(&dsi.bus_lock); | 3793 | sema_init(&dsi.bus_lock, 1); |
| 3802 | 3794 | ||
| 3803 | #ifdef DSI_CATCH_MISSING_TE | 3795 | #ifdef DSI_CATCH_MISSING_TE |
| 3804 | init_timer(&dsi.te_timer); | 3796 | init_timer(&dsi.te_timer); |
