Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1417455

[RFC v4 2/7] Revert "extcon: usb-gpio: switch to use pm wakeirq apis"

From Krzysztof Kozlowski <k.kozlowski@samsung.com>
Newsgroups linux.kernel
Subject [RFC v4 2/7] Revert "extcon: usb-gpio: switch to use pm wakeirq apis"
Date 2016-06-08 15:50 +0200
Message-ID <rHM1R-Pq-61@gated-at.bofh.it> (permalink)
References <rHM1P-Pq-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
-#include <linux/pm_wakeirq.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <linux/acpi.h>
@@ -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,
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v4 0/7] extcon: usb-gpio: fixes and improvements Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-08 15:50 +0200
  [RFC v4 2/7] Revert "extcon: usb-gpio: switch to use pm wakeirq apis" Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-08 15:50 +0200
    Re: [RFC v4 2/7] Revert "extcon: usb-gpio: switch to use pm wakeirq  apis" Roger Quadros <rogerq@ti.com> - 2016-06-09 10:10 +0200
      Re: [RFC v4 2/7] Revert  "extcon: usb-gpio: switch to use pm wakeirq apis" Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-09 10:20 +0200
        Re: [RFC v4 2/7] Revert "extcon: usb-gpio: switch to use pm wakeirq  apis" Roger Quadros <rogerq@ti.com> - 2016-06-09 10:30 +0200
  [RFC v4 6/7] ARM: exynos_defconfig: Enable EXTCON_USB_GPIO for Odroid  XU3 USB OTG Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-08 15:50 +0200
  [RFC v4 7/7] ARM: dts: exynos: Add extcon-usb-gpio node for Odroid XU3 Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-08 15:50 +0200
  [RFC v4 1/7] Documentation: extcon: usb-gpio: update usb-gpio binding  description Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-08 15:50 +0200
    Re: [RFC v4 1/7] Documentation: extcon: usb-gpio: update usb-gpio  binding description Rob Herring <robh@kernel.org> - 2016-06-10 16:10 +0200
  [RFC v4 3/7] extcon: Add raw VBUS and ID cable states Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-08 16:00 +0200
  [RFC v4 4/7] extcon: usb-gpio: Add support for VBUS detection Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-08 16:00 +0200
    Re: [RFC v4 4/7] extcon: usb-gpio: Add support for VBUS detection Roger Quadros <rogerq@ti.com> - 2016-06-09 10:40 +0200
      Re: [RFC v4 4/7] extcon: usb-gpio: Add support for VBUS detection Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-09 10:50 +0200
        Re: [RFC v4 4/7] extcon: usb-gpio: Add support for VBUS detection Roger Quadros <rogerq@ti.com> - 2016-06-09 14:20 +0200
      Re: [RFC v4 4/7] extcon: usb-gpio: Add support for VBUS detection Roger Quadros <rogerq@ti.com> - 2016-06-09 10:50 +0200
  Re: [RFC v4 0/7] extcon: usb-gpio: fixes and improvements Chanwoo Choi <cw00.choi@samsung.com> - 2016-06-09 10:40 +0200
    Re: [RFC v4 0/7] extcon: usb-gpio: fixes and improvements Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-09 10:40 +0200
      Re: [RFC v4 0/7] extcon: usb-gpio: fixes and improvements Chanwoo Choi <cw00.choi@samsung.com> - 2016-06-09 11:40 +0200

csiph-web