* [PATCH V1] mfd: tps65910: Add wakeup support
@ 2012-01-20 11:09 Laxman Dewangan
[not found] ` <1327057770-6688-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Laxman Dewangan @ 2012-01-20 11:09 UTC (permalink / raw)
To: sameo-VuQAYsv1563Yd54FQh9/CA, jedu-kDsPt+C1G03kYMGBc/C6ZA,
lrg-kDsPt+C1G03kYMGBc/C6ZA,
broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
gg-kDsPt+C1G03kYMGBc/C6ZA, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
ldewangan-DDmLM1+adcrQT0dZR+AlfA
Adding wakeup support for PMIC device 65910. This can be
selected through the board specific platform data.
The wakeup should enabled if PMIC need to be configure for
waking up system through RTC or ONKEY.
Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
This patch will enable the wakeup functionality through
device tps65910/tps65911.
drivers/mfd/tps65910-irq.c | 9 +++++++++
drivers/mfd/tps65910.c | 1 +
include/linux/mfd/tps65910.h | 2 ++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/tps65910-irq.c b/drivers/mfd/tps65910-irq.c
index a56be93..8b6f423 100644
--- a/drivers/mfd/tps65910-irq.c
+++ b/drivers/mfd/tps65910-irq.c
@@ -210,6 +210,15 @@ int tps65910_irq_init(struct tps65910 *tps65910, int irq,
if (ret != 0)
dev_err(tps65910->dev, "Failed to request IRQ: %d\n", ret);
+ if (!ret && pdata->en_wakeup) {
+ device_init_wakeup(tps65910->dev, 1);
+ ret = enable_irq_wake(irq);
+ if (ret < 0)
+ dev_warn(tps65910->dev, "Can't enable IRQ as wake "
+ "source: %d\n", ret);
+ return 0;
+ }
+
return ret;
}
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 8517481..88e3dec 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -169,6 +169,7 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
init_data->irq = pmic_plat_data->irq;
init_data->irq_base = pmic_plat_data->irq_base;
+ init_data->en_wakeup = pmic_plat_data->en_wakeup;
tps65910_gpio_init(tps65910, pmic_plat_data->gpio_base);
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index d0cb12e..ba8eb6a 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -777,6 +777,7 @@ struct tps65910_board {
int gpio_base;
int irq;
int irq_base;
+ int en_wakeup;
int vmbch_threshold;
int vmbch2_threshold;
struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
@@ -813,6 +814,7 @@ struct tps65910 {
struct tps65910_platform_data {
int irq;
int irq_base;
+ int en_wakeup;
};
int tps65910_set_bits(struct tps65910 *tps65910, u8 reg, u8 mask);
--
1.7.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <1327057770-6688-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-01-20 12:51 ` Mark Brown
[not found] ` <20120120125152.GE18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-01-20 12:51 UTC (permalink / raw)
To: Laxman Dewangan
Cc: sameo-VuQAYsv1563Yd54FQh9/CA, jedu-kDsPt+C1G03kYMGBc/C6ZA,
lrg-kDsPt+C1G03kYMGBc/C6ZA, gg-kDsPt+C1G03kYMGBc/C6ZA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On Fri, Jan 20, 2012 at 04:39:30PM +0530, Laxman Dewangan wrote:
> Adding wakeup support for PMIC device 65910. This can be
> selected through the board specific platform data.
> The wakeup should enabled if PMIC need to be configure for
> waking up system through RTC or ONKEY.
Why the platform data? The power management infrastructure provides
control of this already.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <20120120125152.GE18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2012-01-20 13:00 ` Laxman Dewangan
[not found] ` <4F196568.1080503-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Laxman Dewangan @ 2012-01-20 13:00 UTC (permalink / raw)
To: Mark Brown
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Friday 20 January 2012 06:21 PM, Mark Brown wrote:
>
>> The wakeup should enabled if PMIC need to be configure for
>> waking up system through RTC or ONKEY.
> Why the platform data? The power management infrastructure provides
> control of this already.
I did not get how the wakeup enabled in power management infrastructure?
My understanding is that we need to call the two apis
device_wakeup_init() and
enable_irq_wake() for enabling the wakeup functionality.
Is there any other API which does the same and I need to call from the
core driver?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <4F196568.1080503-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-01-20 13:02 ` Mark Brown
[not found] ` <20120120130201.GF18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-01-20 13:02 UTC (permalink / raw)
To: Laxman Dewangan
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Fri, Jan 20, 2012 at 06:30:24PM +0530, Laxman Dewangan wrote:
> I did not get how the wakeup enabled in power management infrastructure?
> My understanding is that we need to call the two apis
> device_wakeup_init() and
> enable_irq_wake() for enabling the wakeup functionality.
> Is there any other API which does the same and I need to call from
> the core driver?
No, that's it - when you call those userspace will get control via sysfs
for turning on and off the wakeup support.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <20120120130201.GF18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2012-01-20 13:07 ` Laxman Dewangan
[not found] ` <4F19671E.7030003-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Laxman Dewangan @ 2012-01-20 13:07 UTC (permalink / raw)
To: Mark Brown
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Friday 20 January 2012 06:32 PM, Mark Brown wrote:
> On Fri, Jan 20, 2012 at 06:30:24PM +0530, Laxman Dewangan wrote:
>
>> I did not get how the wakeup enabled in power management infrastructure?
>> My understanding is that we need to call the two apis
>> device_wakeup_init() and
>> enable_irq_wake() for enabling the wakeup functionality.
>> Is there any other API which does the same and I need to call from
>> the core driver?
> No, that's it - when you call those userspace will get control via sysfs
> for turning on and off the wakeup support.
So should I call them in driver by default without taking parameter from
platform data?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <4F19671E.7030003-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-01-20 13:13 ` Mark Brown
[not found] ` <20120120131355.GG18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-01-20 13:13 UTC (permalink / raw)
To: Laxman Dewangan
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Fri, Jan 20, 2012 at 06:37:42PM +0530, Laxman Dewangan wrote:
> On Friday 20 January 2012 06:32 PM, Mark Brown wrote:
> >No, that's it - when you call those userspace will get control via sysfs
> >for turning on and off the wakeup support.
> So should I call them in driver by default without taking parameter
> from platform data?
That's the normal behaviour for drivers unless there's some specific
reason for doing something different. The choice may well depend on the
application software running on the system rather than the kernel.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <20120120131355.GG18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2012-01-21 8:10 ` Laxman Dewangan
2012-01-21 11:24 ` Laxman Dewangan
1 sibling, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-01-21 8:10 UTC (permalink / raw)
To: Mark Brown
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Friday 20 January 2012 06:43 PM, Mark Brown wrote:
> On Fri, Jan 20, 2012 at 06:37:42PM +0530, Laxman Dewangan wrote:
>
>>> No, that's it - when you call those userspace will get control via sysfs
>>> for turning on and off the wakeup support.
>> So should I call them in driver by default without taking parameter
>> from platform data?
> That's the normal behaviour for drivers unless there's some specific
> reason for doing something different. The choice may well depend on the
> application software running on the system rather than the kernel.
Ok, going through the details of documentation under
/sys/devices/.../power/wakeup files of
power/device.txt, i think following should be the change if we want to
control the wakeup control
through user sapce:
During initialization of device, we need to tell that device is wakeup
capable and hence we need to
call the: device_wakeup_init() and device_set_wakeup_capable(dev, true).
Then it exposes the required sysfs to userspace to select the wakeup
enable or not i.e. power/wakeup
to be written as enabled or disabled.
Based on user selection, the function device_may_wakeup() will return
true/false based on
power/wakeup enabled/disabled.
So before entering into the suspend, we need to check this function and
call enable_irq_wakeup() to
have the wakeup enabled actually in the soc. In resume we need to call
disable_irq_wake() again.
If this is correct approach then I can push the another patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <20120120131355.GG18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-01-21 8:10 ` Laxman Dewangan
@ 2012-01-21 11:24 ` Laxman Dewangan
[not found] ` <4F1AA084.9080502-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
1 sibling, 1 reply; 10+ messages in thread
From: Laxman Dewangan @ 2012-01-21 11:24 UTC (permalink / raw)
To: Mark Brown
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Resending as text formatting was not proper. Sorry for inconvenience..
On Friday 20 January 2012 06:43 PM, Mark Brown wrote:
> On Fri, Jan 20, 2012 at 06:37:42PM +0530, Laxman Dewangan wrote:
>>> No, that's it - when you call those userspace will get control via sysfs
>>> for turning on and off the wakeup support.
>> So should I call them in driver by default without taking parameter
>> from platform data?
> That's the normal behaviour for drivers unless there's some specific
> reason for doing something different. The choice may well depend on the
> application software running on the system rather than the kernel.
Going through the details of documentation under
/sys/devices/.../power/wakeup files of power/device.txt, I think
following should be the change if we want to control the wakeup control
through user sapce:
During initialization of device, we need to tell that device is wakeup
capable and hence we need to call the: device_wakeup_init() and
device_set_wakeup_capable(dev, true).
Then it exposes the required sysfs to userspace to select the wakeup
enable or not i.e. power/wakeup to be written as enabled or disabled.
Based on user selection, the function device_may_wakeup() will return
true/false based on power/wakeup enabled/disabled. So before entering
into the suspend, we need to check this function and call
enable_irq_wakeup() to have the wakeup enabled actually in the soc. In
resume we need to call disable_irq_wake() again.
If this is correct approach then I can push the another patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <4F1AA084.9080502-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-01-21 12:51 ` Mark Brown
[not found] ` <20120121125123.GB10206-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-01-21 12:51 UTC (permalink / raw)
To: Laxman Dewangan
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Sat, Jan 21, 2012 at 04:54:52PM +0530, Laxman Dewangan wrote:
> During initialization of device, we need to tell that device is
> wakeup capable and hence we need to call the: device_wakeup_init()
> and device_set_wakeup_capable(dev, true).
> Then it exposes the required sysfs to userspace to select the wakeup
> enable or not i.e. power/wakeup to be written as enabled or
> disabled.
> Based on user selection, the function device_may_wakeup() will
> return true/false based on power/wakeup enabled/disabled. So before
> entering into the suspend, we need to check this function and call
> enable_irq_wakeup() to have the wakeup enabled actually in the soc.
> In resume we need to call disable_irq_wake() again.
Yes, that sounds about right. You don't strictly need to worry about
the wake setup except when suspending but it tends to be easier to
implement that way.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH V1] mfd: tps65910: Add wakeup support
[not found] ` <20120121125123.GB10206-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2012-01-21 12:57 ` Laxman Dewangan
0 siblings, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-01-21 12:57 UTC (permalink / raw)
To: Mark Brown
Cc: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Saturday 21 January 2012 06:21 PM, Mark Brown wrote:
> On Sat, Jan 21, 2012 at 04:54:52PM +0530, Laxman Dewangan wrote:
>
>> During initialization of device, we need to tell that device is
>> wakeup capable and hence we need to call the: device_wakeup_init()
>> and device_set_wakeup_capable(dev, true).
>> Then it exposes the required sysfs to userspace to select the wakeup
>> enable or not i.e. power/wakeup to be written as enabled or
>> disabled.
>> Based on user selection, the function device_may_wakeup() will
>> return true/false based on power/wakeup enabled/disabled. So before
>> entering into the suspend, we need to check this function and call
>> enable_irq_wakeup() to have the wakeup enabled actually in the soc.
>> In resume we need to call disable_irq_wake() again.
> Yes, that sounds about right. You don't strictly need to worry about
> the wake setup except when suspending but it tends to be easier to
> implement that way.
Thanks, I will send another patch for implementing this way.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-01-21 12:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 11:09 [PATCH V1] mfd: tps65910: Add wakeup support Laxman Dewangan
[not found] ` <1327057770-6688-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-20 12:51 ` Mark Brown
[not found] ` <20120120125152.GE18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-01-20 13:00 ` Laxman Dewangan
[not found] ` <4F196568.1080503-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-20 13:02 ` Mark Brown
[not found] ` <20120120130201.GF18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-01-20 13:07 ` Laxman Dewangan
[not found] ` <4F19671E.7030003-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-20 13:13 ` Mark Brown
[not found] ` <20120120131355.GG18297-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-01-21 8:10 ` Laxman Dewangan
2012-01-21 11:24 ` Laxman Dewangan
[not found] ` <4F1AA084.9080502-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-21 12:51 ` Mark Brown
[not found] ` <20120121125123.GB10206-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-01-21 12:57 ` Laxman Dewangan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).