From patchwork Mon Sep 14 11:16:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 7174661 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0F26BEEC1 for ; Mon, 14 Sep 2015 11:17:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23CB020642 for ; Mon, 14 Sep 2015 11:17:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3321D2047B for ; Mon, 14 Sep 2015 11:17:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZbRku-0008UD-Qt; Mon, 14 Sep 2015 11:17:04 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZbRkj-0008Dn-EL; Mon, 14 Sep 2015 11:16:53 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 13CEF75; Mon, 14 Sep 2015 04:16:42 -0700 (PDT) Received: from [10.1.207.150] (e103737-lin.cambridge.arm.com [10.1.207.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5AA33F318; Mon, 14 Sep 2015 04:16:25 -0700 (PDT) Subject: Re: [PATCH v4] pinctrl: mediatek: Implement wake handler and suspend resume To: maoguang meng References: <1439541486-22203-1-git-send-email-maoguang.meng@mediatek.com> <55DB4609.5040904@arm.com> <1441535972.22230.5.camel@mhfsdcap03> <55EEAA24.6080706@arm.com> <55EF11E6.7030307@arm.com> <1442051454.5661.12.camel@mhfsdcap03> From: Sudeep Holla Message-ID: <55F6AC87.4040301@arm.com> Date: Mon, 14 Sep 2015 12:16:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1442051454.5661.12.camel@mhfsdcap03> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150914_041653_509739_E5FE675C X-CRM114-Status: GOOD ( 14.27 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hongzhou Yang , Linus Walleij , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , Sudeep Holla , Matthias Brugger , =?UTF-8?B?WWluZ2pvZSBDaGVuICjpmbPoi7HmtLIp?= , "linux-arm-kernel@lists.infradead.org" Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 12/09/15 10:50, maoguang meng wrote: > hi Sudeep: > > I test flowlling your blow suggestions,but the system can not be woken. > > beacuse,mtk_eint_suspend will mask it.As we know if eint wakeup system > it must be unmasked before enter suspend flow. > > e.x > > static int __maybe_unused elan_suspend(struct device *dev) > { > struct i2c_client *client = to_i2c_client(dev); > struct elan_tp_data *data = i2c_get_clientdata(client); > int ret; > > /* > * We are taking the mutex to make sure sysfs operations are > * complete before we attempt to bring the device into low[er] > * power mode. > */ > ret = mutex_lock_interruptible(&data->sysfs_mutex); > if (ret) > return ret; > > disable_irq(client->irq); > > if (device_may_wakeup(dev)) { > ret = elan_sleep(data); > /* Enable wake from IRQ */ > data->irq_wake = (enable_irq_wake(client->irq) == 0); This is wrong assumption in the driver. enable_irq_wake doesn't implicitly enable the IRQ. So the disable_irq should be moved to else. And the resume patch also needs to be fixed accordingly, otherwise you may get unbalanced irq. But this should not be the reason for fixing the pinctrl suspend/resume. Regards, Sudeep --->8 diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index fa945304b9a5..7de26b04f45c 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1117,13 +1117,13 @@ static int __maybe_unused elan_suspend(struct device *dev) if (ret) return ret; - disable_irq(client->irq); - if (device_may_wakeup(dev)) { ret = elan_sleep(data); /* Enable wake from IRQ */ data->irq_wake = (enable_irq_wake(client->irq) == 0); } else { + disable_irq(client->irq); + ret = elan_disable_power(data); }