diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 00:48:19 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 00:48:19 +0100 |
commit | 9f67627a0fea99b080a190d2d24cc1e2634aa2f7 (patch) | |
tree | 24dcf714a8b502c7ef91086d9eb6164f68c7d52b /drivers/extcon/extcon-gpio.c | |
parent | Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/a... (diff) | |
parent | mei: limit the number of consecutive resets (diff) | |
download | linux-9f67627a0fea99b080a190d2d24cc1e2634aa2f7.tar.xz linux-9f67627a0fea99b080a190d2d24cc1e2634aa2f7.zip |
Merge tag 'char-misc-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver patches from Greg KH:
"Here's the big char/misc driver patches for 3.14-rc1.
Lots of little things, and a new "big" driver, genwqe. Full details
are in the shortlog"
* tag 'char-misc-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (90 commits)
mei: limit the number of consecutive resets
mei: revamp mei reset state machine
drivers/char: don't use module_init in non-modular ttyprintk.c
VMCI: fix error handling path when registering guest driver
extcon: gpio: Add power resume support
Documentation: HOWTO: Updates on subsystem trees, patchwork, -next (vs. -mm) in ko_KR
Documentation: HOWTO: update for 2.6.x -> 3.x versioning in ko_KR
Documentation: HOWTO: update stable address in ko_KR
Documentation: HOWTO: update LXR web link in ko_KR
char: nwbutton: open-code interruptible_sleep_on
mei: fix syntax in comments and debug output
mei: nfc: mei_nfc_free has to be called under lock
mei: use hbm idle state to prevent spurious resets
mei: do not run reset flow from the interrupt thread
misc: genwqe: fix return value check in genwqe_device_create()
GenWQE: Fix warnings for sparc
GenWQE: Fix compile problems for Alpha
Documentation/misc-devices/mei/mei-amt-version.c: remove unneeded call of mei_deinit()
GenWQE: Rework return code for flash-update ioctl
sgi-xp: open-code interruptible_sleep_on_timeout
...
Diffstat (limited to 'drivers/extcon/extcon-gpio.c')
-rw-r--r-- | drivers/extcon/extcon-gpio.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c index 7e0dff58e494..a63a6b21c9ad 100644 --- a/drivers/extcon/extcon-gpio.c +++ b/drivers/extcon/extcon-gpio.c @@ -40,6 +40,7 @@ struct gpio_extcon_data { int irq; struct delayed_work work; unsigned long debounce_jiffies; + bool check_on_resume; }; static void gpio_extcon_work(struct work_struct *work) @@ -103,8 +104,15 @@ static int gpio_extcon_probe(struct platform_device *pdev) extcon_data->gpio_active_low = pdata->gpio_active_low; extcon_data->state_on = pdata->state_on; extcon_data->state_off = pdata->state_off; + extcon_data->check_on_resume = pdata->check_on_resume; if (pdata->state_on && pdata->state_off) extcon_data->edev.print_state = extcon_gpio_print_state; + + ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN, + pdev->name); + if (ret < 0) + return ret; + if (pdata->debounce) { ret = gpio_set_debounce(extcon_data->gpio, pdata->debounce * 1000); @@ -117,11 +125,6 @@ static int gpio_extcon_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN, - pdev->name); - if (ret < 0) - goto err; - INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work); extcon_data->irq = gpio_to_irq(extcon_data->gpio); @@ -159,12 +162,31 @@ static int gpio_extcon_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume(struct device *dev) +{ + struct gpio_extcon_data *extcon_data; + + extcon_data = dev_get_drvdata(dev); + if (extcon_data->check_on_resume) + queue_delayed_work(system_power_efficient_wq, + &extcon_data->work, extcon_data->debounce_jiffies); + + return 0; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, gpio_extcon_resume) +}; + static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove, .driver = { .name = "extcon-gpio", .owner = THIS_MODULE, + .pm = &gpio_extcon_pm_ops, }, }; |