diff mbox

[1/2] input: cros_ec_keyb: Report wakeup events

Message ID 1490867450-31765-2-git-send-email-jeffy.chen@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeffy Chen March 30, 2017, 9:50 a.m. UTC
Report wakeup events when process events.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

 drivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Dmitry Torokhov April 1, 2017, 5:12 p.m. UTC | #1
Hi Jeffy,

On Thu, Mar 30, 2017 at 05:50:49PM +0800, Jeffy Chen wrote:
> Report wakeup events when process events.
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> ---
> 
>  drivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index 6a250d6..a93d55f 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -286,6 +286,9 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
>  		return NOTIFY_DONE;
>  	}
>  
> +	if (device_may_wakeup(ckdev->dev))
> +		pm_wakeup_event(ckdev->dev, 0);
> +
>  	return NOTIFY_OK;
>  }
>  
> @@ -632,6 +635,12 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> +	err = device_init_wakeup(dev, 1);

In the other patch you are adding "wakeup-source" to the DT binding, but
here you mark all EC deices as wakeup sources. You need to use
device_property_read_bool(dev, "wakeup-source") and use the result in
call to device_init_wakeup().

> +	if (err) {
> +		dev_err(dev, "cannot init wakeup: %d\n", err);
> +		return err;
> +	}
> +
>  	return 0;
>  }
>  

Thanks.
Dmitry Torokhov April 1, 2017, 5:14 p.m. UTC | #2
On Sat, Apr 01, 2017 at 10:12:37AM -0700, Dmitry Torokhov wrote:
> Hi Jeffy,
> 
> On Thu, Mar 30, 2017 at 05:50:49PM +0800, Jeffy Chen wrote:
> > Report wakeup events when process events.
> > 
> > Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> > ---
> > 
> >  drivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> > index 6a250d6..a93d55f 100644
> > --- a/drivers/input/keyboard/cros_ec_keyb.c
> > +++ b/drivers/input/keyboard/cros_ec_keyb.c
> > @@ -286,6 +286,9 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
> >  		return NOTIFY_DONE;
> >  	}
> >  
> > +	if (device_may_wakeup(ckdev->dev))
> > +		pm_wakeup_event(ckdev->dev, 0);
> > +
> >  	return NOTIFY_OK;
> >  }
> >  
> > @@ -632,6 +635,12 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
> >  		return err;
> >  	}
> >  
> > +	err = device_init_wakeup(dev, 1);
> 
> In the other patch you are adding "wakeup-source" to the DT binding, but
> here you mark all EC deices as wakeup sources. You need to use
> device_property_read_bool(dev, "wakeup-source") and use the result in
> call to device_init_wakeup().

And please also update device tree binding doc for the driver.

> 
> > +	if (err) {
> > +		dev_err(dev, "cannot init wakeup: %d\n", err);
> > +		return err;
> > +	}
> > +
> >  	return 0;
> >  }
> >  
> 
> Thanks.
> 
> -- 
> Dmitry
Jeffy Chen April 2, 2017, 12:10 a.m. UTC | #3
Hi Dmitry,

On 04/02/2017 01:14 AM, Dmitry Torokhov wrote:
> On Sat, Apr 01, 2017 at 10:12:37AM -0700, Dmitry Torokhov wrote:
>> Hi Jeffy,
>>
>> On Thu, Mar 30, 2017 at 05:50:49PM +0800, Jeffy Chen wrote:
>>> Report wakeup events when process events.
>>>
>>> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
>>> ---
>>>
>>>   drivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
>>> index 6a250d6..a93d55f 100644
>>> --- a/drivers/input/keyboard/cros_ec_keyb.c
>>> +++ b/drivers/input/keyboard/cros_ec_keyb.c
>>> @@ -286,6 +286,9 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
>>>   		return NOTIFY_DONE;
>>>   	}
>>>
>>> +	if (device_may_wakeup(ckdev->dev))
>>> +		pm_wakeup_event(ckdev->dev, 0);
>>> +
>>>   	return NOTIFY_OK;
>>>   }
>>>
>>> @@ -632,6 +635,12 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
>>>   		return err;
>>>   	}
>>>
>>> +	err = device_init_wakeup(dev, 1);
>>
>> In the other patch you are adding "wakeup-source" to the DT binding, but
>> here you mark all EC deices as wakeup sources. You need to use
>> device_property_read_bool(dev, "wakeup-source") and use the result in
>> call to device_init_wakeup().
>
> And please also update device tree binding doc for the driver.
>
oops, sorry, i thought that dts property is needed to enable a wakeup 
source...but obviously it's not, only gpio-keys requires that.

so the dts patch is not needed, will remove in next version, thanx.
>>
>>> +	if (err) {
>>> +		dev_err(dev, "cannot init wakeup: %d\n", err);
>>> +		return err;
>>> +	}
>>> +
>>>   	return 0;
>>>   }
>>>
>>
>> Thanks.
>>
>> --
>> Dmitry
>


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index 6a250d6..a93d55f 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -286,6 +286,9 @@  static int cros_ec_keyb_work(struct notifier_block *nb,
 		return NOTIFY_DONE;
 	}
 
+	if (device_may_wakeup(ckdev->dev))
+		pm_wakeup_event(ckdev->dev, 0);
+
 	return NOTIFY_OK;
 }
 
@@ -632,6 +635,12 @@  static int cros_ec_keyb_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	err = device_init_wakeup(dev, 1);
+	if (err) {
+		dev_err(dev, "cannot init wakeup: %d\n", err);
+		return err;
+	}
+
 	return 0;
 }