From patchwork Wed Jun 27 14:04:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jassi Brar X-Patchwork-Id: 9650 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E661723E42 for ; Wed, 27 Jun 2012 14:05:07 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id B7478A181F0 for ; Wed, 27 Jun 2012 14:05:07 +0000 (UTC) Received: by yenq6 with SMTP id q6so996642yen.11 for ; Wed, 27 Jun 2012 07:05:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=oSy0FncD0fuRpIzybZMIdJi7Z+dbW/G928UtoUHUUw4=; b=TSy/Ro+Lvt1n521lVZ6D9XGg0B2VIhqt1/uRBf0mUHTc6znRn9skDclrSaSOrw+KhK GI6vATGsKiPU4tCySoGmjUajLZKXt+cUCZhM4T86Iexs+qhBy01QcGAxR8MPZP1eLud7 J9m4bvOLRuVSk4oIR8hMUQvbMVfmFIgFz6uE1DNNE2E60nEHtFsQi4Y9ZrUM2RNIAV5v JLmqpLEZ646qi+v5HordO/EP1X4X089jq6we6Rbu96+VussEf+UaYNTNAFVLuC7nAJ07 C1tq0qoSKdao2bLBHjIi96+p/UpQ211B42VJbhLZRI7T/DCKjGSEtjQ5jJbKRmy9nj13 lxoQ== Received: by 10.50.203.39 with SMTP id kn7mr1658987igc.53.1340805906885; Wed, 27 Jun 2012 07:05:06 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp13239ibb; Wed, 27 Jun 2012 07:05:06 -0700 (PDT) Received: by 10.50.237.1 with SMTP id uy1mr1728007igc.18.1340805906384; Wed, 27 Jun 2012 07:05:06 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id ue4si20297282pbc.273.2012.06.27.07.05.06 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 07:05:06 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of jaswinder.singh@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of jaswinder.singh@linaro.org) smtp.mail=jaswinder.singh@linaro.org Received: by mail-pz0-f50.google.com with SMTP id h15so1716170dan.37 for ; Wed, 27 Jun 2012 07:05:06 -0700 (PDT) Received: by 10.68.200.104 with SMTP id jr8mr65816050pbc.9.1340805905987; Wed, 27 Jun 2012 07:05:05 -0700 (PDT) Received: from localhost.localdomain ([122.178.249.255]) by mx.google.com with ESMTPS id jv6sm15270701pbc.40.2012.06.27.07.05.01 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 07:05:04 -0700 (PDT) From: jaswinder.singh@linaro.org To: tomi.valkeinen@ti.com, mythripk@ti.com Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, andy.green@linaro.org, n-dechesne@ti.com, patches@linaro.org, Jassi Brar Subject: [PATCH 2/3] OMAPDSS: HDMI: Replace spinlock with mutex in hdmi_check_hpd_state Date: Wed, 27 Jun 2012 19:34:56 +0530 Message-Id: <1340805896-28731-1-git-send-email-jaswinder.singh@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQmzVO2uyuxM5x5ujgQeNpe7GxmV4PGzV9HstMRBobvqtWD09caP+iMOiKmsOCDYxD3Ax1Be From: Jassi Brar State change of HDMI PHY could potentially take many millisecs, we can do better by protecting things in hdmi_set_phy_pwr() with a mutex rather than a spin_lock_irqsave. Signed-off-by: Jassi Brar --- drivers/video/omap2/dss/hdmi.c | 1 + drivers/video/omap2/dss/ti_hdmi.h | 1 + drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 6 ++---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 8195c71..0738090 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -758,6 +758,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev) hdmi.ip_data.core_av_offset = HDMI_CORE_AV; hdmi.ip_data.pll_offset = HDMI_PLLCTRL; hdmi.ip_data.phy_offset = HDMI_PHY; + mutex_init(&hdmi.ip_data.lock); hdmi_panel_init(); diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h index d174ca1..cc292b8 100644 --- a/drivers/video/omap2/dss/ti_hdmi.h +++ b/drivers/video/omap2/dss/ti_hdmi.h @@ -177,6 +177,7 @@ struct hdmi_ip_data { /* ti_hdmi_4xxx_ip private data. These should be in a separate struct */ int hpd_gpio; + struct mutex lock; }; int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index 3fa3d98..04acca9 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c @@ -238,10 +238,8 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data) unsigned long flags; bool hpd; int r; - /* this should be in ti_hdmi_4xxx_ip private data */ - static DEFINE_SPINLOCK(phy_tx_lock); - spin_lock_irqsave(&phy_tx_lock, flags); + mutex_lock(&ip_data->lock); hpd = gpio_get_value(ip_data->hpd_gpio); @@ -257,7 +255,7 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data) } err: - spin_unlock_irqrestore(&phy_tx_lock, flags); + mutex_unlock(&ip_data->lock); return r; }