From patchwork Wed Jun 8 13:48:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9164761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E78A760572 for ; Wed, 8 Jun 2016 13:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6004282DC for ; Wed, 8 Jun 2016 13:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB0A528306; Wed, 8 Jun 2016 13:56:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 2DE0E282DC for ; Wed, 8 Jun 2016 13:56:24 +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 1bAdxH-0007iB-0T; Wed, 08 Jun 2016 13:55:35 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAdqe-00008h-Rd for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2016 13:48:45 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O8G001XIH0KNB30@mailout4.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2016 14:48:20 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-90-5758222427a9 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 9F.7D.05254.42228575; Wed, 8 Jun 2016 14:48:20 +0100 (BST) Received: from AMDC2174.DIGITAL.local ([106.120.53.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O8G00M68H0F9I60@eusync1.samsung.com>; Wed, 08 Jun 2016 14:48:20 +0100 (BST) From: Krzysztof Kozlowski To: MyungJoo Ham , Chanwoo Choi , Rob Herring , Mark Rutland , Kukjin Kim , Krzysztof Kozlowski , Marek Szyprowski , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [RFC v4 2/7] Revert "extcon: usb-gpio: switch to use pm wakeirq apis" Date: Wed, 08 Jun 2016 15:48:01 +0200 Message-id: <1465393686-16644-3-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1465393686-16644-1-git-send-email-k.kozlowski@samsung.com> References: <1465393686-16644-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xy7oqShHhBvOX6FlsnLGe1eLg/XqL 61+es1rMP3KO1eLZxIeMFq9fGFr0P37NbHHhaQ+bxabH11gtLu+aw2Yx4/w+Jou1R+6yWyy9 fpHJ4nbjCjaLY7P/Mlm07j3CbtHzSMtB0GPNvDWMHv8O9zN5bFrVyeaxeUm9x6b905g9+ras YvQ4fmM7k8fnTXIBHFFcNimpOZllqUX6dglcGZ+mHmMvmCNQcXPlTJYGxl28XYycHBICJhJP PqxigbDFJC7cW8/WxcjFISSwlFHi7P+HLBBOI5PEk+P72EGq2ASMJTYvXwJWJSKwiFnieGcP E4jDLLCNUeJG7w/mLkYODmEBP4lnjy1ATBYBVYnV39VBenkF3CVe3rsJtU1O4uSxyawgNqeA h8TF7csYQWwhoJrfnyeyTGDkXcDIsIpRNLU0uaA4KT3XUK84Mbe4NC9dLzk/dxMjJKC/7GBc fMzqEKMAB6MSD6+CYXi4EGtiWXFl7iFGCQ5mJRFeHZmIcCHelMTKqtSi/Pii0pzU4kOM0hws SuK8c3e9DxESSE8sSc1OTS1ILYLJMnFwSjUwcurEMeiUfz3yp9yJfSb3gp+rb5jvCcuLWW68 e4NMk3Zs+E/eKvEH3xsuldebF8qvmrTSZfVDI90XX/ftKGY4rb3tD9sDkdP7gxQlPEQ+nxB/ P13kzCPfYOXsw9WGPOphip/mXI2ZsOeL57nTIb/yVmxfcZO3WuwAr2uvbV5sZccCbYGPvjst lViKMxINtZiLihMBlVq7WWQCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_064845_049105_998C4C99 X-CRM114-Status: GOOD ( 18.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartlomiej Zolnierkiewicz , balbi@ti.com, kishon@ti.com, Peter Chen , "Ivan T. Ivanov" , rogerq@ti.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 8106e404174253639731cc30a44f5b3ab764c5b7. When using PM wakeirq API only one wakeup IRQ can be set. However the driver will support also VBUS GPIO so we need two wakeup interrupts. --- drivers/extcon/extcon-usb-gpio.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c index 2512660dc4b9..a36aab007022 100644 --- a/drivers/extcon/extcon-usb-gpio.c +++ b/drivers/extcon/extcon-usb-gpio.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -143,8 +142,7 @@ static int usb_extcon_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, info); - device_init_wakeup(dev, true); - dev_pm_set_wake_irq(dev, info->id_irq); + device_init_wakeup(dev, 1); /* Perform initial detection */ usb_extcon_detect_cable(&info->wq_detcable.work); @@ -158,9 +156,6 @@ static int usb_extcon_remove(struct platform_device *pdev) cancel_delayed_work_sync(&info->wq_detcable); - dev_pm_clear_wake_irq(&pdev->dev); - device_init_wakeup(&pdev->dev, false); - return 0; } @@ -170,6 +165,12 @@ static int usb_extcon_suspend(struct device *dev) struct usb_extcon_info *info = dev_get_drvdata(dev); int ret = 0; + if (device_may_wakeup(dev)) { + ret = enable_irq_wake(info->id_irq); + if (ret) + return ret; + } + /* * We don't want to process any IRQs after this point * as GPIOs used behind I2C subsystem might not be @@ -185,6 +186,12 @@ static int usb_extcon_resume(struct device *dev) struct usb_extcon_info *info = dev_get_drvdata(dev); int ret = 0; + if (device_may_wakeup(dev)) { + ret = disable_irq_wake(info->id_irq); + if (ret) + return ret; + } + enable_irq(info->id_irq); if (!device_may_wakeup(dev)) queue_delayed_work(system_power_efficient_wq,