summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHarry Hong <hhong@nvidia.com>2013-08-28 16:32:42 +0900
committerGabby Lee <galee@nvidia.com>2013-08-29 05:30:05 -0700
commita6477db2ef36ac1662b539492e1f654858ee60ed (patch)
tree7558f3a509003577f8d8c4ead43f7de883d6fb7a /drivers
parentce4e23a2ea496a9932467718b435e9dad2f9642c (diff)
misc: ti-st: enable wakeup device
- enable st_host_wake device as wakeup device - set device_wakeup_enabe by default - don't freq irq if irq is not registered in this driver bug 1347948 Change-Id: Id8467cadc21270f73154e32711818111b8eb10c0 Signed-off-by: Harry Hong <hhong@nvidia.com> Reviewed-on: http://git-master/r/267128 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com> Reviewed-by: Gabby Lee <galee@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/ti-st/st_host_wake.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/misc/ti-st/st_host_wake.c b/drivers/misc/ti-st/st_host_wake.c
index 5f03d405d933..588e1e490680 100644
--- a/drivers/misc/ti-st/st_host_wake.c
+++ b/drivers/misc/ti-st/st_host_wake.c
@@ -44,6 +44,7 @@ struct st_host_wake_info {
struct regulator *vdd_3v3;
struct regulator *vdd_1v8;
unsigned int supp_proto_reg;
+ bool is_request_irq;
};
static unsigned long flags;
@@ -159,6 +160,7 @@ static int st_host_wake_probe(struct platform_device *pdev)
pr_warn("%s: regulator vddio_st_1v8 not available\n", __func__);
bsi->vdd_1v8 = NULL;
}
+ bsi->is_request_irq = 0;
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
"host_wake");
@@ -186,6 +188,7 @@ static int st_host_wake_probe(struct platform_device *pdev)
ret = request_irq(bsi->host_wake_irq, st_host_wake_isr,
IRQF_DISABLED | IRQF_TRIGGER_RISING,
"bluetooth hostwake", dev_id);
+ bsi->is_request_irq = 1;
}
if (ret < 0) {
pr_err("Couldn't acquire HOST_WAKE IRQ");
@@ -195,6 +198,8 @@ static int st_host_wake_probe(struct platform_device *pdev)
clear_bit(HOST_WAKE, &flags);
bsi->supp_proto_reg = 0;
+ device_init_wakeup(&pdev->dev, 1);
+
goto finish;
free_bsi:
@@ -207,7 +212,8 @@ static int st_host_wake_remove(struct platform_device *pdev)
{
pr_debug("%s", __func__);
- free_irq(bsi->host_wake_irq, dev_id);
+ if (bsi->is_request_irq)
+ free_irq(bsi->host_wake_irq, dev_id);
if (bsi->vdd_3v3)
regulator_put(bsi->vdd_3v3);
@@ -223,7 +229,8 @@ static int st_host_wake_resume(struct platform_device *pdev)
{
pr_info("%s", __func__);
- if (test_bit(HOST_WAKE, &flags) && test_bit(IRQ_WAKE, &flags)) {
+ if (test_bit(HOST_WAKE, &flags) && test_bit(IRQ_WAKE, &flags)
+ && device_may_wakeup(&pdev->dev)) {
pr_info("disable the host_wake irq");
disable_irq_wake(bsi->host_wake_irq);
clear_bit(IRQ_WAKE, &flags);
@@ -232,13 +239,15 @@ static int st_host_wake_resume(struct platform_device *pdev)
return 0;
}
-static int st_host_wake_suspend(void)
+static int st_host_wake_suspend(struct platform_device *pdev,
+ pm_message_t state)
{
int retval = 0;
pr_info("%s", __func__);
- if (test_bit(HOST_WAKE, &flags) && (!test_bit(IRQ_WAKE, &flags))) {
+ if (test_bit(HOST_WAKE, &flags) && (!test_bit(IRQ_WAKE, &flags))
+ && device_may_wakeup(&pdev->dev)) {
retval = enable_irq_wake(bsi->host_wake_irq);
if (retval < 0) {
pr_err("Failed to enable HOST_WAKE irq (%d)", retval);