If you needn't the wakeup event of gpio-charger, this patch can help.
Please set "gpio-charger,disable-wakeup" in gpio-charger node.
Chris Zhong (2):
dt-bindings: add disable-wakeup property for gpio-charger
power: gpio-charger: support disable the wakeup event
Documentation/devicetree/bindings/power_supply/gpio-charger.txt | 2 ++
drivers/power/gpio-charger.c | 5 ++++-
include/linux/power/gpio-charger.h | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
--
1.9.1
add disable-wakeup for gpio-charger, if you set this property, system
will not wakeup by gpio-charger.
Signed-off-by: Chris Zhong <[email protected]>
---
Documentation/devicetree/bindings/power_supply/gpio-charger.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
index adbb5dc..a46e9bc 100644
--- a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
+++ b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
@@ -4,6 +4,7 @@ Required properties :
- compatible : "gpio-charger"
- gpios : GPIO indicating the charger presence.
See GPIO binding in bindings/gpio/gpio.txt .
+ - gpio-charger,disable-wakeup : Boolean, charger does not wake-up the system.
- charger-type : power supply type, one of
unknown
battery
@@ -20,6 +21,7 @@ Example:
compatible = "gpio-charger";
charger-type = "usb-sdp";
gpios = <&gpf0 2 0 0 0>;
+ gpio-charger,disable-wakeup;
}
battery {
--
1.9.1
Support disable the wakeup event of gpio-charger by setting device tree.
Signed-off-by: Chris Zhong <[email protected]>
---
drivers/power/gpio-charger.c | 5 ++++-
include/linux/power/gpio-charger.h | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
index b7424c8..06ed22e 100644
--- a/drivers/power/gpio-charger.c
+++ b/drivers/power/gpio-charger.c
@@ -98,6 +98,9 @@ struct gpio_charger_platform_data *gpio_charger_parse_dt(struct device *dev)
pdata->gpio_active_low = !!(flags & OF_GPIO_ACTIVE_LOW);
+ pdata->wakeup = !of_get_property(np, "gpio-charger,disable-wakeup",
+ NULL);
+
pdata->type = POWER_SUPPLY_TYPE_UNKNOWN;
ret = of_property_read_string(np, "charger-type", &chargetype);
if (ret >= 0) {
@@ -198,7 +201,7 @@ static int gpio_charger_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, gpio_charger);
- device_init_wakeup(&pdev->dev, 1);
+ device_init_wakeup(&pdev->dev, pdata->wakeup);
return 0;
diff --git a/include/linux/power/gpio-charger.h b/include/linux/power/gpio-charger.h
index de1dfe0..a5fdef3 100644
--- a/include/linux/power/gpio-charger.h
+++ b/include/linux/power/gpio-charger.h
@@ -33,6 +33,7 @@ struct gpio_charger_platform_data {
int gpio;
int gpio_active_low;
+ int wakeup;
char **supplied_to;
size_t num_supplicants;
--
1.9.1
Hello,
2015-02-10 11:12 GMT+03:00 Chris Zhong <[email protected]>:
> Support disable the wakeup event of gpio-charger by setting device tree.
I have the feelink, that this should be a userspace setting, rather than
a kernel/device-tree policy. In the end, the device tree is a hardware
description
and a hardware is capable of waking up the device.
>
> Signed-off-by: Chris Zhong <[email protected]>
--
With best wishes
Dmitry
On 02/10/2015 04:42 PM, Dmitry Eremin-Solenikov wrote:
> Hello,
>
> 2015-02-10 11:12 GMT+03:00 Chris Zhong <[email protected]>:
>> Support disable the wakeup event of gpio-charger by setting device tree.
> I have the feelink, that this should be a userspace setting, rather than
> a kernel/device-tree policy. In the end, the device tree is a hardware
> description
> and a hardware is capable of waking up the device.
Ah, you are right, I think I should modify it in userspace.
Thank you.
>
>> Signed-off-by: Chris Zhong <[email protected]>
>
On Tue, Feb 10, 2015 at 08:12:24AM +0000, Chris Zhong wrote:
> add disable-wakeup for gpio-charger, if you set this property, system
> will not wakeup by gpio-charger.
>
> Signed-off-by: Chris Zhong <[email protected]>
> ---
>
> Documentation/devicetree/bindings/power_supply/gpio-charger.txt | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> index adbb5dc..a46e9bc 100644
> --- a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> +++ b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> @@ -4,6 +4,7 @@ Required properties :
> - compatible : "gpio-charger"
> - gpios : GPIO indicating the charger presence.
> See GPIO binding in bindings/gpio/gpio.txt .
> + - gpio-charger,disable-wakeup : Boolean, charger does not wake-up the system.
When would the system wake up otherwise?
Also, "gpio-charger" is not a vendor prefix.
Mark.
> - charger-type : power supply type, one of
> unknown
> battery
> @@ -20,6 +21,7 @@ Example:
> compatible = "gpio-charger";
> charger-type = "usb-sdp";
> gpios = <&gpf0 2 0 0 0>;
> + gpio-charger,disable-wakeup;
> }
>
> battery {
> --
> 1.9.1
>
>
Am Dienstag, 10. Februar 2015, 12:00:30 schrieb Mark Rutland:
> On Tue, Feb 10, 2015 at 08:12:24AM +0000, Chris Zhong wrote:
> > add disable-wakeup for gpio-charger, if you set this property, system
> > will not wakeup by gpio-charger.
> >
> > Signed-off-by: Chris Zhong <[email protected]>
> > ---
> >
> > Documentation/devicetree/bindings/power_supply/gpio-charger.txt | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> > b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt index
> > adbb5dc..a46e9bc 100644
> > --- a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> > +++ b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> >
> > @@ -4,6 +4,7 @@ Required properties :
> > - compatible : "gpio-charger"
> > - gpios : GPIO indicating the charger presence.
> >
> > See GPIO binding in bindings/gpio/gpio.txt .
> >
> > + - gpio-charger,disable-wakeup : Boolean, charger does not wake-up the
> > system.
> When would the system wake up otherwise?
a response for patch 2/2 suggested to move this to userspace (as deciding if
the charger should be a wakeup source is not a hardware property) and Chris
responded that he'll try to move it as suggested.
Heiko
On Tue, Feb 10, 2015 at 12:14:48PM +0000, Heiko Stübner wrote:
> Am Dienstag, 10. Februar 2015, 12:00:30 schrieb Mark Rutland:
> > On Tue, Feb 10, 2015 at 08:12:24AM +0000, Chris Zhong wrote:
> > > add disable-wakeup for gpio-charger, if you set this property, system
> > > will not wakeup by gpio-charger.
> > >
> > > Signed-off-by: Chris Zhong <[email protected]>
> > > ---
> > >
> > > Documentation/devicetree/bindings/power_supply/gpio-charger.txt | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> > > b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt index
> > > adbb5dc..a46e9bc 100644
> > > --- a/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> > > +++ b/Documentation/devicetree/bindings/power_supply/gpio-charger.txt
> > >
> > > @@ -4,6 +4,7 @@ Required properties :
> > > - compatible : "gpio-charger"
> > > - gpios : GPIO indicating the charger presence.
> > >
> > > See GPIO binding in bindings/gpio/gpio.txt .
> > >
> > > + - gpio-charger,disable-wakeup : Boolean, charger does not wake-up the
> > > system.
> > When would the system wake up otherwise?
>
> a response for patch 2/2 suggested to move this to userspace (as deciding if
> the charger should be a wakeup source is not a hardware property) and Chris
> responded that he'll try to move it as suggested.
Great, that matches what I was thinking.
Thanks for taking the time to say this on the DT patch.
Getting part of a series makes review far more painful :(
Thanks,
Mark.