linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Johannes Stezenbach <js@sig21.net>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] platform/x86: Add support for Dollar Cove TI power button
Date: Thu, 24 Aug 2017 12:20:04 +0300	[thread overview]
Message-ID: <CAHp75Vfsn+7ZZCdis_iOHk36TnZp-354ncetE=R+h7piBMx9Qg@mail.gmail.com> (raw)
In-Reply-To: <20170824081141.5018-3-tiwai@suse.de>

On Thu, Aug 24, 2017 at 11:11 AM, Takashi Iwai <tiwai@suse.de> wrote:
> This provides a new input driver for supporting the power button on
> Dollar Cove TI PMIC, found on Cherrytrail-based devices.
> The patch is based on the original work by Intel, found at:
>   https://github.com/01org/ProductionKernelQuilts
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=193891
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Are you going to submit it via MFD?

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
> v1->v2:
> * Move power-button driver to platform/x86, driver renames accordingly
> * Add missing wake-irq cleanup to power-button driver
>
>  drivers/platform/x86/Kconfig              |  8 +++
>  drivers/platform/x86/Makefile             |  1 +
>  drivers/platform/x86/intel_dc_ti_pwrbtn.c | 96 +++++++++++++++++++++++++++++++
>  3 files changed, 105 insertions(+)
>  create mode 100644 drivers/platform/x86/intel_dc_ti_pwrbtn.c
>
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 80b87954f6dd..25ab9f6ba533 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -1139,6 +1139,14 @@ config SILEAD_DMI
>           with the OS-image for the device. This option supplies the missing
>           information. Enable this for x86 tablets with Silead touchscreens.
>
> +config INTEL_DC_TI_PWRBTN
> +       tristate "Dollar Cove TI power button driver"
> +       depends on INTEL_SOC_PMIC_DC_TI
> +       depends on INPUT
> +       help
> +         Say Y here fi you want to have a power button driver for
> +         Dollar Cove TI PMIC.
> +
>  endif # X86_PLATFORM_DEVICES
>
>  config PMC_ATOM
> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
> index 91cec1751461..1ce5c18d249e 100644
> --- a/drivers/platform/x86/Makefile
> +++ b/drivers/platform/x86/Makefile
> @@ -83,3 +83,4 @@ obj-$(CONFIG_PMC_ATOM)                += pmc_atom.o
>  obj-$(CONFIG_MLX_PLATFORM)     += mlx-platform.o
>  obj-$(CONFIG_MLX_CPLD_PLATFORM)        += mlxcpld-hotplug.o
>  obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o
> +obj-$(CONFIG_INTEL_DC_TI_PWRBTN)       += intel_dc_ti_pwrbtn.o
> diff --git a/drivers/platform/x86/intel_dc_ti_pwrbtn.c b/drivers/platform/x86/intel_dc_ti_pwrbtn.c
> new file mode 100644
> index 000000000000..1a40f55699fb
> --- /dev/null
> +++ b/drivers/platform/x86/intel_dc_ti_pwrbtn.c
> @@ -0,0 +1,96 @@
> +/*
> + * Power-button driver for Dollar Cove TI PMIC
> + * Copyright (C) 2014 Intel Corp
> + * Copyright (c) 2017 Takashi Iwai <tiwai@suse.de>
> + */
> +
> +#include <linux/init.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/device.h>
> +#include <linux/mfd/intel_soc_pmic.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_wakeirq.h>
> +#include <linux/slab.h>
> +
> +#define DC_TI_SIRQ_REG         0x3
> +#define SIRQ_PWRBTN_REL                (1 << 0)
> +
> +static irqreturn_t dc_ti_pwrbtn_interrupt(int irq, void *dev_id)
> +{
> +       struct input_dev *input = dev_id;
> +       struct device *dev = input->dev.parent;
> +       struct regmap *regmap = dev_get_drvdata(dev);
> +       int state;
> +
> +       if (!regmap_read(regmap, DC_TI_SIRQ_REG, &state)) {
> +               dev_dbg(dev, "SIRQ_REG=0x%x\n", state);
> +               state &= SIRQ_PWRBTN_REL;
> +               input_event(input, EV_KEY, KEY_POWER, !state);
> +               input_sync(input);
> +       }
> +
> +       return IRQ_HANDLED;
> +}
> +
> +static int dc_ti_pwrbtn_probe(struct platform_device *pdev)
> +{
> +       struct device *dev = &pdev->dev;
> +       struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
> +       struct input_dev *input;
> +       int irq;
> +       int ret;
> +
> +       irq = platform_get_irq(pdev, 0);
> +       if (irq < 0)
> +               return -EINVAL;
> +       input = devm_input_allocate_device(dev);
> +       if (!input)
> +               return -ENOMEM;
> +       input->name = pdev->name;
> +       input->phys = "power-button/input0";
> +       input->id.bustype = BUS_HOST;
> +       input->dev.parent = dev;
> +       input_set_capability(input, EV_KEY, KEY_POWER);
> +       ret = input_register_device(input);
> +       if (ret)
> +               return ret;
> +
> +       dev_set_drvdata(dev, pmic->regmap);
> +
> +       ret = devm_request_threaded_irq(dev, irq, NULL, dc_ti_pwrbtn_interrupt,
> +                                       0, KBUILD_MODNAME, input);
> +       if (ret)
> +               return ret;
> +
> +       device_init_wakeup(dev, true);
> +       dev_pm_set_wake_irq(dev, irq);
> +       return 0;
> +}
> +
> +static int dc_ti_pwrbtn_remove(struct platform_device *pdev)
> +{
> +       dev_pm_clear_wake_irq(&pdev->dev);
> +       device_init_wakeup(&pdev->dev, false);
> +       return 0;
> +}
> +
> +static struct platform_device_id dc_ti_pwrbtn_id_table[] = {
> +       { .name = "dc_ti_pwrbtn" },
> +       {},
> +};
> +MODULE_DEVICE_TABLE(platform, dc_ti_pwrbtn_id_table);
> +
> +static struct platform_driver dc_ti_pwrbtn_driver = {
> +       .driver = {
> +               .name = KBUILD_MODNAME,
> +       },
> +       .probe  = dc_ti_pwrbtn_probe,
> +       .remove = dc_ti_pwrbtn_remove,
> +       .id_table = dc_ti_pwrbtn_id_table,
> +};
> +module_platform_driver(dc_ti_pwrbtn_driver);
> +
> +MODULE_DESCRIPTION("Power-button driver for Dollar Cove TI PMIC");
> +MODULE_LICENSE("GPL v2");
> --
> 2.14.0
>



-- 
With Best Regards,
Andy Shevchenko

  parent reply	other threads:[~2017-08-24  9:20 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  8:11 [PATCH v2 0/3] Dollar Cove TI PMIC support for Intel Cherry Trail Takashi Iwai
2017-08-24  8:11 ` [PATCH v2 1/3] mfd: Add support for Cherry Trail Dollar Cove TI PMIC Takashi Iwai
2017-08-24  9:03   ` Mika Westerberg
2017-08-24  9:17   ` Andy Shevchenko
2017-09-04 13:37   ` Lee Jones
2017-09-04 13:50     ` Takashi Iwai
2017-09-05  7:25       ` Lee Jones
2017-09-05  7:41         ` Takashi Iwai
2017-09-05  8:14           ` Lee Jones
2017-08-24  8:11 ` [PATCH v2 2/3] platform/x86: Add support for Dollar Cove TI power button Takashi Iwai
2017-08-24  9:07   ` Mika Westerberg
2017-08-24  9:20   ` Andy Shevchenko [this message]
2017-08-24  9:45     ` Takashi Iwai
2017-08-24 11:47       ` Andy Shevchenko
2017-09-07 11:41         ` [PATCH v5 1/3] mfd: Add support for Cherry Trail Dollar Cove TI PMIC Takashi Iwai
2017-09-07 12:28           ` Lee Jones
2017-09-07 12:48             ` Takashi Iwai
2017-09-07 13:00               ` Lee Jones
2017-09-07 13:30                 ` Takashi Iwai
2017-09-07 14:13                   ` Lee Jones
2017-08-24  8:11 ` [PATCH v2 3/3] ACPI / PMIC: Add opregion driver for Intel " Takashi Iwai
2017-08-24  9:14   ` Mika Westerberg
2017-08-24  9:40     ` Takashi Iwai
2017-08-24 10:03       ` Takashi Iwai
2017-08-24  9:23   ` Andy Shevchenko
2017-08-24  9:43     ` Takashi Iwai
2017-08-24  9:27 ` [PATCH v2 0/3] Dollar Cove TI PMIC support for Intel Cherry Trail Andy Shevchenko
2017-08-24  9:38   ` Takashi Iwai
2017-09-04 14:43 [PATCH v5 " Takashi Iwai
2017-09-04 14:43 ` [PATCH v5 1/3] mfd: Add support for Cherry Trail Dollar Cove TI PMIC Takashi Iwai
2017-09-05  7:24   ` Lee Jones
2017-09-05  7:46     ` Takashi Iwai
2017-09-05  8:00       ` Hans de Goede
2017-09-05  8:11         ` Lee Jones
2017-09-05  8:12         ` Takashi Iwai
2017-09-05  8:10       ` Lee Jones
2017-09-05  8:20         ` Takashi Iwai
2017-09-05  8:53           ` Lee Jones
2017-09-05  9:38             ` Takashi Iwai
2017-09-05 10:31               ` Rafael J. Wysocki
2017-09-06  7:58                 ` Lee Jones
2017-09-06 10:09                   ` Rafael J. Wysocki
2017-09-06 10:47                     ` Lee Jones
2017-09-06 10:52                       ` Lee Jones
2017-09-06 22:19                         ` Rafael J. Wysocki
2017-09-07  7:39                           ` Lee Jones
2017-09-07 10:52                             ` Rafael J. Wysocki
2017-09-07 11:07                               ` Mika Westerberg
2017-09-07 10:59                                 ` Rafael J. Wysocki
2017-09-07 11:13                                   ` Lee Jones
2017-09-06  7:54               ` Lee Jones
2017-09-06  8:23                 ` Takashi Iwai
2017-09-06  9:05                   ` Lee Jones
2017-09-06 10:06                     ` Takashi Iwai
2017-09-06 10:21                       ` Rafael J. Wysocki
2017-09-06 10:50                         ` Lee Jones
2017-09-06 10:40                       ` Lee Jones
2017-09-06 10:58                         ` Takashi Iwai
2017-09-06 11:01                           ` Rafael J. Wysocki
2017-09-06 13:51                             ` Lee Jones
2017-09-06 14:34                               ` Takashi Iwai
2017-09-06 14:54                                 ` Lee Jones
2017-09-06 15:02                                   ` Takashi Iwai
2017-09-05  8:54           ` Lee Jones
2017-09-07  9:32             ` Takashi Iwai
2017-09-07 10:53               ` Lee Jones
2017-09-07 10:59                 ` Rafael J. Wysocki
2017-09-07 11:17                   ` Lee Jones
2017-09-07 11:44                     ` Takashi Iwai
2017-09-07 12:24                       ` Lee Jones
2017-09-07 13:11                         ` Takashi Iwai
2017-09-07 13:22                           ` Lee Jones
2017-09-07  8:00   ` Lee Jones
2017-09-04 14:43 ` [PATCH v5 2/3] platform/x86: Add support for Dollar Cove TI power button Takashi Iwai
2017-09-04 14:43 ` [PATCH v5 3/3] ACPI / PMIC: Add opregion driver for Intel Dollar Cove TI PMIC Takashi Iwai
2017-09-07  8:00   ` Lee Jones

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='CAHp75Vfsn+7ZZCdis_iOHk36TnZp-354ncetE=R+h7piBMx9Qg@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=js@sig21.net \
    --cc=lee.jones@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tiwai@suse.de \
    /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).