From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jianhong Chen <chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
tony.xie-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
w.egorov-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v6 09/12] Input: Add power key driver for Rockchip RK805 PMIC
Date: Mon, 19 Jun 2017 20:06:43 -0700 [thread overview]
Message-ID: <20170620030643.GG21379@dtor-ws> (raw)
In-Reply-To: <1496907027-27197-1-git-send-email-chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
On Thu, Jun 08, 2017 at 03:30:27PM +0800, Jianhong Chen wrote:
> From: chenjh <chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>
> This driver provides a input driver for the power
> key on the Rockchip RK805 PMIC.
>
> Signed-off-by: chenjh <chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
> drivers/input/misc/Kconfig | 6 +++
> drivers/input/misc/Makefile | 1 +
> drivers/input/misc/rk805-pwrkey.c | 111 ++++++++++++++++++++++++++++++++++++++
> 3 files changed, 118 insertions(+)
> create mode 100644 drivers/input/misc/rk805-pwrkey.c
>
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 5b6c522..72dc4f5 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -571,6 +571,12 @@ config INPUT_PWM_BEEPER
> To compile this driver as a module, choose M here: the module will be
> called pwm-beeper.
>
> +config INPUT_RK805_PWRKEY
> + tristate "Rockchip RK805 PMIC power key support"
> + depends on MFD_RK808
> + help
> + Select this option to enable power key driver for RK805.
> +
> config INPUT_GPIO_ROTARY_ENCODER
> tristate "Rotary encoders connected to GPIO pins"
> depends on GPIOLIB || COMPILE_TEST
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index b10523f..c27052a 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -63,6 +63,7 @@ obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o
> obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
> obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o
> obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
> +obj-$(CONFIG_INPUT_RK805_PWRKEY) += rk805-pwrkey.o
> obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
> obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o
> obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
> diff --git a/drivers/input/misc/rk805-pwrkey.c b/drivers/input/misc/rk805-pwrkey.c
> new file mode 100644
> index 0000000..188eed5
> --- /dev/null
> +++ b/drivers/input/misc/rk805-pwrkey.c
> @@ -0,0 +1,111 @@
> +/*
> + * Rockchip RK805 PMIC Power Key driver
> + *
> + * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
> + *
> + * Author: Chen Jianhong <chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + *
> + */
> +#include <linux/errno.h>
> +#include <linux/init.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +
> +static irqreturn_t pwrkey_fall_irq(int irq, void *_pwr)
> +{
> + struct input_dev *pwr = _pwr;
> +
> + input_report_key(pwr, KEY_POWER, 1);
> + input_sync(pwr);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t pwrkey_rise_irq(int irq, void *_pwr)
> +{
> + struct input_dev *pwr = _pwr;
> +
> + input_report_key(pwr, KEY_POWER, 0);
> + input_sync(pwr);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int rk805_pwrkey_probe(struct platform_device *pdev)
> +{
> + struct input_dev *pwr;
> + int fall_irq, rise_irq;
> + int err;
> +
> + pwr = devm_input_allocate_device(&pdev->dev);
> + if (!pwr) {
> + dev_err(&pdev->dev, "Can't allocate power button\n");
> + return -ENOMEM;
> + }
> +
> + pwr->name = "rk805 pwrkey";
> + pwr->phys = "rk805_pwrkey/input0";
> + pwr->dev.parent = &pdev->dev;
> + input_set_capability(pwr, EV_KEY, KEY_POWER);
> +
> + fall_irq = platform_get_irq(pdev, 0);
> + if (fall_irq < 0) {
> + dev_err(&pdev->dev, "Can't get fall irq: %d\n", fall_irq);
> + return fall_irq;
> + }
> +
> + rise_irq = platform_get_irq(pdev, 1);
> + if (rise_irq < 0) {
> + dev_err(&pdev->dev, "Can't get rise irq: %d\n", rise_irq);
> + return rise_irq;
> + }
> +
> + err = devm_request_threaded_irq(&pwr->dev, fall_irq, NULL,
> + pwrkey_fall_irq,
> + IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> + "rk805_pwrkey_fall", pwr);
I think you want devm_request_any_context_irq() here as your interrupt
handler does not need to sleep.
> + if (err < 0) {
> + dev_err(&pdev->dev, "Can't register fall irq: %d\n", err);
> + return err;
> + }
> +
> + err = devm_request_threaded_irq(&pwr->dev, rise_irq, NULL,
> + pwrkey_rise_irq,
> + IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> + "rk805_pwrkey_rise", pwr);
> + if (err < 0) {
> + dev_err(&pdev->dev, "Can't register rise irq: %d\n", err);
> + return err;
> + }
> +
> + err = input_register_device(pwr);
> + if (err) {
> + dev_err(&pdev->dev, "Can't register power button: %d\n", err);
> + return err;
> + }
> +
> + platform_set_drvdata(pdev, pwr);
> + device_init_wakeup(&pdev->dev, true);
> +
> + return 0;
> +}
> +
> +static struct platform_driver rk805_pwrkey_driver = {
> + .probe = rk805_pwrkey_probe,
> + .driver = {
> + .name = "rk805-pwrkey",
> + },
> +};
> +module_platform_driver(rk805_pwrkey_driver);
> +
> +MODULE_AUTHOR("Chen Jianghong <chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>");
> +MODULE_DESCRIPTION("RK805 PMIC Power Key driver");
> +MODULE_LICENSE("GPL v2");
> --
> 1.9.1
>
>
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jianhong Chen <chenjh@rock-chips.com>
Cc: gnurou@gmail.com, linus.walleij@linaro.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
huangtao@rock-chips.com, tony.xie@rock-chips.com,
zhangqing@rock-chips.com, devicetree@vger.kernel.org,
w.egorov@phytec.de, lgirdwood@gmail.com, broonie@kernel.org,
robh+dt@kernel.org, mark.rutland@arm.com,
linux-gpio@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH v6 09/12] Input: Add power key driver for Rockchip RK805 PMIC
Date: Mon, 19 Jun 2017 20:06:43 -0700 [thread overview]
Message-ID: <20170620030643.GG21379@dtor-ws> (raw)
In-Reply-To: <1496907027-27197-1-git-send-email-chenjh@rock-chips.com>
On Thu, Jun 08, 2017 at 03:30:27PM +0800, Jianhong Chen wrote:
> From: chenjh <chenjh@rock-chips.com>
>
> This driver provides a input driver for the power
> key on the Rockchip RK805 PMIC.
>
> Signed-off-by: chenjh <chenjh@rock-chips.com>
> ---
> drivers/input/misc/Kconfig | 6 +++
> drivers/input/misc/Makefile | 1 +
> drivers/input/misc/rk805-pwrkey.c | 111 ++++++++++++++++++++++++++++++++++++++
> 3 files changed, 118 insertions(+)
> create mode 100644 drivers/input/misc/rk805-pwrkey.c
>
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 5b6c522..72dc4f5 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -571,6 +571,12 @@ config INPUT_PWM_BEEPER
> To compile this driver as a module, choose M here: the module will be
> called pwm-beeper.
>
> +config INPUT_RK805_PWRKEY
> + tristate "Rockchip RK805 PMIC power key support"
> + depends on MFD_RK808
> + help
> + Select this option to enable power key driver for RK805.
> +
> config INPUT_GPIO_ROTARY_ENCODER
> tristate "Rotary encoders connected to GPIO pins"
> depends on GPIOLIB || COMPILE_TEST
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index b10523f..c27052a 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -63,6 +63,7 @@ obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o
> obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
> obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o
> obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
> +obj-$(CONFIG_INPUT_RK805_PWRKEY) += rk805-pwrkey.o
> obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
> obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o
> obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
> diff --git a/drivers/input/misc/rk805-pwrkey.c b/drivers/input/misc/rk805-pwrkey.c
> new file mode 100644
> index 0000000..188eed5
> --- /dev/null
> +++ b/drivers/input/misc/rk805-pwrkey.c
> @@ -0,0 +1,111 @@
> +/*
> + * Rockchip RK805 PMIC Power Key driver
> + *
> + * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
> + *
> + * Author: Chen Jianhong <chenjh@rock-chips.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + *
> + */
> +#include <linux/errno.h>
> +#include <linux/init.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +
> +static irqreturn_t pwrkey_fall_irq(int irq, void *_pwr)
> +{
> + struct input_dev *pwr = _pwr;
> +
> + input_report_key(pwr, KEY_POWER, 1);
> + input_sync(pwr);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t pwrkey_rise_irq(int irq, void *_pwr)
> +{
> + struct input_dev *pwr = _pwr;
> +
> + input_report_key(pwr, KEY_POWER, 0);
> + input_sync(pwr);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int rk805_pwrkey_probe(struct platform_device *pdev)
> +{
> + struct input_dev *pwr;
> + int fall_irq, rise_irq;
> + int err;
> +
> + pwr = devm_input_allocate_device(&pdev->dev);
> + if (!pwr) {
> + dev_err(&pdev->dev, "Can't allocate power button\n");
> + return -ENOMEM;
> + }
> +
> + pwr->name = "rk805 pwrkey";
> + pwr->phys = "rk805_pwrkey/input0";
> + pwr->dev.parent = &pdev->dev;
> + input_set_capability(pwr, EV_KEY, KEY_POWER);
> +
> + fall_irq = platform_get_irq(pdev, 0);
> + if (fall_irq < 0) {
> + dev_err(&pdev->dev, "Can't get fall irq: %d\n", fall_irq);
> + return fall_irq;
> + }
> +
> + rise_irq = platform_get_irq(pdev, 1);
> + if (rise_irq < 0) {
> + dev_err(&pdev->dev, "Can't get rise irq: %d\n", rise_irq);
> + return rise_irq;
> + }
> +
> + err = devm_request_threaded_irq(&pwr->dev, fall_irq, NULL,
> + pwrkey_fall_irq,
> + IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> + "rk805_pwrkey_fall", pwr);
I think you want devm_request_any_context_irq() here as your interrupt
handler does not need to sleep.
> + if (err < 0) {
> + dev_err(&pdev->dev, "Can't register fall irq: %d\n", err);
> + return err;
> + }
> +
> + err = devm_request_threaded_irq(&pwr->dev, rise_irq, NULL,
> + pwrkey_rise_irq,
> + IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> + "rk805_pwrkey_rise", pwr);
> + if (err < 0) {
> + dev_err(&pdev->dev, "Can't register rise irq: %d\n", err);
> + return err;
> + }
> +
> + err = input_register_device(pwr);
> + if (err) {
> + dev_err(&pdev->dev, "Can't register power button: %d\n", err);
> + return err;
> + }
> +
> + platform_set_drvdata(pdev, pwr);
> + device_init_wakeup(&pdev->dev, true);
> +
> + return 0;
> +}
> +
> +static struct platform_driver rk805_pwrkey_driver = {
> + .probe = rk805_pwrkey_probe,
> + .driver = {
> + .name = "rk805-pwrkey",
> + },
> +};
> +module_platform_driver(rk805_pwrkey_driver);
> +
> +MODULE_AUTHOR("Chen Jianghong <chenjh@rock-chips.com>");
> +MODULE_DESCRIPTION("RK805 PMIC Power Key driver");
> +MODULE_LICENSE("GPL v2");
> --
> 1.9.1
>
>
--
Dmitry
next prev parent reply other threads:[~2017-06-20 3:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 7:12 [PATCH v6 00/12] rk808: Add RK805 support Jianhong Chen
2017-06-08 7:12 ` [PATCH v6 01/12] mfd: rk808: fix up the chip id get failed Jianhong Chen
[not found] ` <1496905959-29202-1-git-send-email-chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-08 7:12 ` [PATCH v6 02/12] mfd: rk808: add rk805 regs addr and ID Jianhong Chen
2017-06-08 7:12 ` Jianhong Chen
2017-06-08 7:12 ` [PATCH v6 03/12] regulator: rk808: Add regulator driver for RK805 Jianhong Chen
2017-06-08 7:12 ` Jianhong Chen
[not found] ` <1496905959-29202-4-git-send-email-chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-08 11:11 ` Mark Brown
2017-06-08 11:11 ` Mark Brown
2017-06-08 7:28 ` [PATCH v6 06/12] rtc: Kconfig: Name RK805 in Kconfig for RTC_DRV_RK808 Jianhong Chen
2017-06-08 7:28 ` Jianhong Chen
2017-06-08 7:30 ` [PATCH v6 09/12] Input: Add power key driver for Rockchip RK805 PMIC Jianhong Chen
2017-06-08 7:30 ` Jianhong Chen
[not found] ` <1496907027-27197-1-git-send-email-chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-20 3:06 ` Dmitry Torokhov [this message]
2017-06-20 3:06 ` Dmitry Torokhov
2017-06-08 7:31 ` [PATCH v6 10/12] mfd: rk808: Add RK805 gpio support Jianhong Chen
2017-06-08 7:31 ` Jianhong Chen
2017-06-08 7:33 ` [PATCH v6 12/12] gpio: dt-bindings: add bindings for Rockchip RK805 PMIC Jianhong Chen
2017-06-08 7:33 ` Jianhong Chen
2017-06-09 11:30 ` Linus Walleij
2017-06-12 15:58 ` Rob Herring
2017-06-08 7:12 ` [PATCH v6 04/12] mfd: rk808: Add RK805 support Jianhong Chen
2017-06-08 7:27 ` [PATCH v6 05/12] clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808 Jianhong Chen
2017-06-08 7:28 ` [PATCH v6 07/12] mfd: dt-bindings: Add RK805 device tree bindings document Jianhong Chen
2017-06-08 19:27 ` Rob Herring
2017-06-08 7:30 ` [PATCH v6 08/12] gpio: Add GPIO driver for the RK805 PMIC Jianhong Chen
2017-06-09 11:37 ` Linus Walleij
2017-06-09 12:17 ` Heiko Stuebner
2017-06-14 12:11 ` Jianhong Chen
2017-06-29 10:29 ` Heiko Stübner
2017-07-21 2:00 ` Jianhong Chen
2017-07-21 8:12 ` Heiko Stuebner
2017-06-08 7:32 ` [PATCH v6 11/12] mfd: rk808: Add RK805 power key support Jianhong Chen
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=20170620030643.GG21379@dtor-ws \
--to=dmitry.torokhov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tony.xie-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=w.egorov-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org \
--cc=zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.