linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Barry Song <21cnbao@gmail.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	DL-SHA-WorkGroupLinux <workgroup.linux@csr.com>,
	Andy.Sun@csr.com
Subject: Re: [RFC PATCH] Input: gpio_keys - trigger input event if key is pressed in boot stage
Date: Wed, 20 May 2015 09:37:36 -0700	[thread overview]
Message-ID: <20150520163736.GA23809@dtor-ws> (raw)
In-Reply-To: <CAGsJ_4z-CZShfCQ2JNgOKX1dtfGksX+Naj++4tugPCriiY=ESg@mail.gmail.com>

Hi Barry,

On Wed, May 20, 2015 at 06:02:36PM +0800, Barry Song wrote:
> sometimes we press a key to boot, and the boot stage need to get this
> event.
> the current codes use edge trigger, so we have no chance to report
> the cold-touch event.
> but our user sceneries like Linux navigator does need it.

Input events that come before input device is opened (either by
userspace or by a kernel consumer) are ignored by input core and we
already call gpio_keys_report_state() from gpio_keys_open() so I do not
think this patch has any effect.

Thanks.

> 
> Signed-off-by: Barry Song <Baohua.Song@csr.com>
> ---
>  -RFC: for the moment, only an idea
> 
>  drivers/input/keyboard/gpio_keys.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c
> b/drivers/input/keyboard/gpio_keys.c
> index ddf4045..77fe0dd 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -766,6 +766,19 @@ static int gpio_keys_probe(struct platform_device *pdev)
> 
>      device_init_wakeup(&pdev->dev, wakeup);
> 
> +    /* if the key is pressed while system boot, force an interrupt */
> +    for (i = 0; i < pdata->nbuttons; i++) {
> +        const struct gpio_keys_button *button = &pdata->buttons[i];
> +        struct gpio_button_data *bdata = &ddata->data[i];
> +        int state;
> +
> +        if (gpio_is_valid(button->gpio)) {
> +            state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^
> button->active_low;
> +            if (state)
> +                gpio_keys_gpio_isr(bdata->irq, bdata);
> +        }
> +    }
> +
>      return 0;
> 
>  err_remove_group:
> -- 
> 1.9.1

-- 
Dmitry

  reply	other threads:[~2015-05-20 16:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 10:02 [RFC PATCH] Input: gpio_keys - trigger input event if key is pressed in boot stage Barry Song
2015-05-20 16:37 ` Dmitry Torokhov [this message]
2015-05-20 22:44   ` Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150520163736.GA23809@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=21cnbao@gmail.com \
    --cc=Andy.Sun@csr.com \
    --cc=linux-input@vger.kernel.org \
    --cc=workgroup.linux@csr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).