From patchwork Mon Feb 8 15:57:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 77766 X-Patchwork-Delegate: tomi.valkeinen@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o18FtCEd011834 for ; Mon, 8 Feb 2010 15:55:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753525Ab0BHPzL (ORCPT ); Mon, 8 Feb 2010 10:55:11 -0500 Received: from smtp.nokia.com ([192.100.105.134]:45827 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753506Ab0BHPzK (ORCPT ); Mon, 8 Feb 2010 10:55:10 -0500 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o18Ft1vf015007; Mon, 8 Feb 2010 09:55:09 -0600 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 8 Feb 2010 17:55:03 +0200 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 8 Feb 2010 17:55:02 +0200 Received: from localhost.localdomain (esdhcp041210.research.nokia.com [172.21.41.210]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o18FsuKD017806; Mon, 8 Feb 2010 17:54:58 +0200 From: Tomi Valkeinen To: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Tomi Valkeinen Subject: [PATCH 01/17] OMAP: DSS2: DSI: change DSI bus_lock to semaphore Date: Mon, 8 Feb 2010 17:57:25 +0200 Message-Id: <1265644661-3694-2-git-send-email-tomi.valkeinen@nokia.com> X-Mailer: git-send-email 1.6.5 In-Reply-To: <1265644661-3694-1-git-send-email-tomi.valkeinen@nokia.com> References: <1265644661-3694-1-git-send-email-tomi.valkeinen@nokia.com> X-OriginalArrivalTime: 08 Feb 2010 15:55:03.0180 (UTC) FILETIME=[137BDCC0:01CAA8D7] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 08 Feb 2010 15:55:12 +0000 (UTC) different context, a work thread via irq. Signed-off-by: Tomi Valkeinen --- 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 4b85ed2..74df72b 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -227,7 +228,7 @@ static struct } vc[4]; struct mutex lock; - struct mutex bus_lock; + struct semaphore bus_lock; unsigned pll_locked; @@ -298,19 +299,19 @@ void dsi_restore_context(void) void dsi_bus_lock(void) { - mutex_lock(&dsi.bus_lock); + down(&dsi.bus_lock); } EXPORT_SYMBOL(dsi_bus_lock); void dsi_bus_unlock(void) { - mutex_unlock(&dsi.bus_lock); + up(&dsi.bus_lock); } EXPORT_SYMBOL(dsi_bus_unlock); static bool dsi_bus_is_locked(void) { - return mutex_is_locked(&dsi.bus_lock); + return dsi.bus_lock.count == 0; } static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum, @@ -3000,8 +3001,6 @@ static int dsi_update_thread(void *data) u16 x, y, w, h; while (1) { - bool sched; - wait_event_interruptible(dsi.waitqueue, dsi.update_mode == OMAP_DSS_UPDATE_AUTO || (dsi.update_mode == OMAP_DSS_UPDATE_MANUAL && @@ -3087,16 +3086,9 @@ static int dsi_update_thread(void *data) dsi_perf_show("L4"); } - sched = atomic_read(&dsi.bus_lock.count) < 0; - complete_all(&dsi.update_completion); dsi_bus_unlock(); - - /* XXX We need to give others chance to get the bus lock. Is - * there a better way for this? */ - if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO && sched) - schedule_timeout_interruptible(1); } DSSDBG("update thread exiting\n"); @@ -3796,7 +3788,7 @@ int dsi_init(struct platform_device *pdev) spin_lock_init(&dsi.update_lock); mutex_init(&dsi.lock); - mutex_init(&dsi.bus_lock); + sema_init(&dsi.bus_lock, 1); #ifdef DSI_CATCH_MISSING_TE init_timer(&dsi.te_timer);