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: 9164715 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 1A66560467 for ; Wed, 8 Jun 2016 13:49:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C6EF2824F for ; Wed, 8 Jun 2016 13:49:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0138E282DC; Wed, 8 Jun 2016 13:49:45 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A480526B4A for ; Wed, 8 Jun 2016 13:49:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754986AbcFHNta (ORCPT ); Wed, 8 Jun 2016 09:49:30 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:51303 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754215AbcFHNs0 (ORCPT ); Wed, 8 Jun 2016 09:48:26 -0400 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>; 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 Cc: rogerq@ti.com, Peter Chen , "Ivan T. Ivanov" , balbi@ti.com, kishon@ti.com, Bartlomiej Zolnierkiewicz 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= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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,