ac100 team mailing list archive
-
ac100 team
-
Mailing list archive
-
Message #00389
Re: [PATCH 1/2] Manage wake up Events
On Sunday 23 October 2011 04:13:31 Pierre-Hugues Husson wrote:
> Delete PM-related uncommented calls from nvec_kbd
> Make wakeup events configurable through
> /sys/module/nvec/parameters/wakeup_on_*
>
> Signed-off-by: Pierre-Hugues Husson <phhusson@xxxxxxxxx>
> ---
> drivers/staging/nvec/nvec.c | 42
> +++++++++++++++++++++++++++++++++++++++ drivers/staging/nvec/nvec_kbd.c |
> 5 +--
> 2 files changed, 44 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 52af8ec..758a558 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -795,6 +795,45 @@ static int __devexit tegra_nvec_remove(struct
> platform_device *pdev)
>
> #ifdef CONFIG_PM
>
> +static int wakeup_on_lid = 1;
> +static int wakeup_on_power_button = 1;
> +static int wakeup_on_any_key = 0;
> +static int wakeup_on_home_key = 1;
> +module_param(wakeup_on_lid, int, 0644);
> +module_param(wakeup_on_power_button, int, 0644);
> +module_param(wakeup_on_any_key, int, 0644);
> +module_param(wakeup_on_home_key, int, 0644);
> +
> +static void tegra_nvec_setup_wakeup_events(struct nvec_chip *nvec) {
> + {
> + //Resume on LID
please use C-style comments
> + char cmd[]={ 0x01, 0xFD, 0x01, 0x00, 0x00, 0x02, 0x00};
> + cmd[2]=!!wakeup_on_lid;
> + nvec_write_async(nvec, cmd, sizeof(cmd));
> + }
> +
> + {
> + //Resume on Power button
> + char cmd[]={ 0x01, 0xFD, 0x01, 0x00, 0x00, 0x01, 0x00};
> + cmd[2]=!!wakeup_on_power_button;
> + nvec_write_async(nvec, cmd, sizeof(cmd));
> + }
> +
> + {
> + //Resume on any key press
> + char cmd[]={ 0x05, 0x03, 0x01, 0x01};
> + cmd[2]=!!wakeup_on_any_key;
> + nvec_write_async(nvec, cmd, sizeof(cmd));
> + }
> +
> + {
> + //Resume on home key press
> + char cmd[]={ 0x05, 0x03, 0x01, 0x02};
> + cmd[2]=!!wakeup_on_home_key;
> + nvec_write_async(nvec, cmd, sizeof(cmd));
> + }
> +}
> +
> static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t
> state) {
> struct nvec_chip *nvec = platform_get_drvdata(pdev);
> @@ -803,12 +842,15 @@ static int tegra_nvec_suspend(struct platform_device
> *pdev, pm_message_t state) dev_dbg(nvec->dev, "suspending\n");
> nvec_write_async(nvec, "\x0d\x10\x59\x94", 4);
>
> + tegra_nvec_setup_wakeup_events(nvec);
> +
> /* keep these sync or you'll break suspend */
> msg = nvec_write_sync(nvec, EC_DISABLE_EVENT_REPORTING, 3);
> nvec_msg_free(nvec, msg);
> msg = nvec_write_sync(nvec, "\x04\x02", 2);
> nvec_msg_free(nvec, msg);
>
> +
> nvec_disable_i2c_slave(nvec);
>
> return 0;
I think this belongs to nvec_event.c (that's where the ac100 specific stuff goes
to).
> diff --git a/drivers/staging/nvec/nvec_kbd.c
> b/drivers/staging/nvec/nvec_kbd.c index a4ce5a7..c599f6e7 100644
> --- a/drivers/staging/nvec/nvec_kbd.c
> +++ b/drivers/staging/nvec/nvec_kbd.c
> @@ -140,10 +140,9 @@ static int __devinit nvec_kbd_probe(struct
> platform_device *pdev) /* Enable keyboard */
> nvec_write_async(nvec, "\x05\xf4", 2);
>
> - /* keyboard reset? */
> - nvec_write_async(nvec, "\x05\x03\x01\x01", 4);
> - nvec_write_async(nvec, "\x05\x04\x01", 3);
> + //Send 0xff (reset keyboard) on PS2 bus
again, C-style comments please
> nvec_write_async(nvec, "\x06\x01\xff\x03", 4);
> +
> /* FIXME
> wait until keyboard reset is finished
> or until we have a sync write */
Otherwise this looks nice ;-)
Marc
Follow ups
References