linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Hi655x powerkey support for HiKey (v3)
@ 2016-06-10  5:34 John Stultz
  2016-06-10  5:34 ` [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC John Stultz
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: John Stultz @ 2016-06-10  5:34 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Dmitry Torokhov, Rob Herring, Lee Jones,
	Jorge Ramirez-Ortiz, Feng Chen, Wei Xu, Guodong Xu

This patchset enables the pmic powerkey to function on HiKey.

New in v3:
* Integrated feedback from Lee Jones suggesting DT not be used
  to describe fixed functionality of the PMIC. Instead we use
  a mfd cell and mfd_add_device. This makes the patchset a bit
  shorter and I've dropped the DT reviewers.
* Reordered the patches so they make more sense.

Review and feedback are always appreciated!

thanks
-john


Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Cc: Feng Chen <puck.chen@hisilicon.com>
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>

John Stultz (2):
  mfd: hi655x-pmic: Fixup issue with un-acked interrupts
  mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver

Jorge Ramirez-Ortiz (1):
  drivers: input: powerkey for HISI 65xx SoC

 drivers/input/misc/Kconfig         |   9 +++
 drivers/input/misc/Makefile        |   1 +
 drivers/input/misc/hisi_powerkey.c | 149 +++++++++++++++++++++++++++++++++++++
 drivers/mfd/hi655x-pmic.c          |  38 ++++++++--
 4 files changed, 192 insertions(+), 5 deletions(-)
 create mode 100644 drivers/input/misc/hisi_powerkey.c

-- 
1.9.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC
  2016-06-10  5:34 [PATCH 0/3] Hi655x powerkey support for HiKey (v3) John Stultz
@ 2016-06-10  5:34 ` John Stultz
  2016-06-10  6:44   ` kbuild test robot
  2016-06-10  9:35   ` kbuild test robot
  2016-06-10  5:34 ` [PATCH 2/3] mfd: hi655x-pmic: Fixup issue with un-acked interrupts John Stultz
  2016-06-10  5:34 ` [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver John Stultz
  2 siblings, 2 replies; 9+ messages in thread
From: John Stultz @ 2016-06-10  5:34 UTC (permalink / raw)
  To: lkml
  Cc: Jorge Ramirez-Ortiz, Dmitry Torokhov, Rob Herring, Lee Jones,
	Feng Chen, Wei Xu, Guodong Xu, John Stultz

From: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>

This driver provides a input driver for the power button on the
HiSi 65xx SoC for boards like HiKey.

This driver was originally by Zhiliang Xue <xuezhiliang@huawei.com>
then basically rewritten by Jorge, but preserving the original
module author credits.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Cc: Feng Chen <puck.chen@hisilicon.com>
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
[jstultz: Reworked commit message, folded in other fixes/cleanups
from Jorge, implemented some larger cleanups suggested by DmitryT]
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2: Major rework integrating feedback from Dmitry.
v3: Dropped of_match compatible line since no longer using DT
    for this.

 drivers/input/misc/Kconfig         |   9 +++
 drivers/input/misc/Makefile        |   1 +
 drivers/input/misc/hisi_powerkey.c | 149 +++++++++++++++++++++++++++++++++++++
 3 files changed, 159 insertions(+)
 create mode 100644 drivers/input/misc/hisi_powerkey.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 1f2337a..07aacfc 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -796,4 +796,13 @@ config INPUT_DRV2667_HAPTICS
 	  To compile this driver as a module, choose M here: the
 	  module will be called drv2667-haptics.
 
+config HISI_POWERKEY
+	tristate "Hisilicon PMIC ONKEY support"
+	depends on ARCH_HISI || COMPILE_TEST
+	help
+	  Say Y to enable support for PMIC ONKEY.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called hisi_powerkey.
+
 endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 0357a08..f264777 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -75,3 +75,4 @@ obj-$(CONFIG_INPUT_WM831X_ON)		+= wm831x-on.o
 obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND)	+= xen-kbdfront.o
 obj-$(CONFIG_INPUT_YEALINK)		+= yealink.o
 obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR)	+= ideapad_slidebar.o
+obj-$(CONFIG_HISI_POWERKEY)		+= hisi_powerkey.o
diff --git a/drivers/input/misc/hisi_powerkey.c b/drivers/input/misc/hisi_powerkey.c
new file mode 100644
index 0000000..d3afebc
--- /dev/null
+++ b/drivers/input/misc/hisi_powerkey.c
@@ -0,0 +1,149 @@
+/*
+ * Hisilicon PMIC powerkey driver
+ *
+ * Copyright (C) 2013 Hisilicon Ltd.
+ * Copyright (C) 2015, 2016 Linaro Ltd.
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/reboot.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of_irq.h>
+#include <linux/input.h>
+#include <linux/slab.h>
+
+/* the held interrupt will trigger after 4 seconds */
+#define MAX_HELD_TIME	(4 * MSEC_PER_SEC)
+
+
+enum id_action { ID_PRESSED, ID_RELEASED, ID_HELD, ID_LAST };
+const char *const irq_names[ID_LAST] = {"down", "up", "hold 4s"};
+
+struct hi65xx_priv {
+	struct input_dev *input;
+};
+
+static irqreturn_t hi65xx_power_press_isr(int irq, void *q)
+{
+	struct hi65xx_priv *p = q;
+
+	pm_wakeup_event(p->input->dev.parent, MAX_HELD_TIME);
+	input_report_key(p->input, KEY_POWER, 1);
+	input_sync(p->input);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t hi65xx_power_release_isr(int irq, void *q)
+{
+	struct hi65xx_priv *p = q;
+
+	pm_wakeup_event(p->input->dev.parent, MAX_HELD_TIME);
+	input_report_key(p->input, KEY_POWER, 0);
+	input_sync(p->input);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t hi65xx_restart_toggle_isr(int irq, void *q)
+{
+	struct hi65xx_priv *p = q;
+	int value = test_bit(KEY_RESTART, p->input->key);
+
+	pm_wakeup_event(p->input->dev.parent, MAX_HELD_TIME);
+	input_report_key(p->input, KEY_RESTART, !value);
+	input_sync(p->input);
+
+	return IRQ_HANDLED;
+}
+
+irqreturn_t (*irq_handlers[ID_LAST])(int irq, void *q) = {
+	hi65xx_power_press_isr,
+	hi65xx_power_release_isr,
+	hi65xx_restart_toggle_isr,
+};
+
+static int hi65xx_powerkey_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct hi65xx_priv *priv;
+	int irq, i, ret;
+
+	priv = devm_kzalloc(dev, sizeof(struct hi65xx_priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->input = devm_input_allocate_device(&pdev->dev);
+	if (!priv->input) {
+		dev_err(&pdev->dev, "failed to allocate input device\n");
+		return -ENOMEM;
+	}
+
+	priv->input->phys = "hisi_on/input0";
+	priv->input->name = "HISI 65xx PowerOn Key";
+
+	input_set_capability(priv->input, EV_KEY, KEY_POWER);
+	input_set_capability(priv->input, EV_KEY, KEY_RESTART);
+
+	for (i = 0; i < ID_LAST; i++) {
+
+		irq = platform_get_irq_byname(pdev, irq_names[i]);
+		if (irq < 0) {
+			dev_err(dev, "couldn't get irq %s\n", irq_names[i]);
+			return irq;
+		}
+
+		ret = devm_request_any_context_irq(dev, irq,
+					irq_handlers[i], IRQF_ONESHOT,
+					irq_names[i], priv);
+		if (ret < 0) {
+			dev_err(dev, "couldn't get irq %s\n", irq_names[i]);
+			return ret;
+		}
+	}
+
+	ret = input_register_device(priv->input);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to register input device: %d\n",
+			ret);
+		return ret;
+	}
+
+	platform_set_drvdata(pdev, priv);
+	device_init_wakeup(&pdev->dev, 1);
+
+	return 0;
+}
+
+static int hi65xx_powerkey_remove(struct platform_device *pdev)
+{
+	device_init_wakeup(&pdev->dev, 0);
+	return 0;
+}
+
+MODULE_DEVICE_TABLE(of, hi65xx_powerkey_of_match);
+
+static struct platform_driver hi65xx_powerkey_driver = {
+	.driver = {
+		.name = "hi65xx-powerkey",
+	},
+	.probe = hi65xx_powerkey_probe,
+	.remove  = hi65xx_powerkey_remove,
+};
+
+module_platform_driver(hi65xx_powerkey_driver);
+
+MODULE_AUTHOR("Zhiliang Xue <xuezhiliang@huawei.com");
+MODULE_DESCRIPTION("Hisi PMIC Power key driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] mfd: hi655x-pmic: Fixup issue with un-acked interrupts
  2016-06-10  5:34 [PATCH 0/3] Hi655x powerkey support for HiKey (v3) John Stultz
  2016-06-10  5:34 ` [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC John Stultz
@ 2016-06-10  5:34 ` John Stultz
  2016-06-10  5:34 ` [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver John Stultz
  2 siblings, 0 replies; 9+ messages in thread
From: John Stultz @ 2016-06-10  5:34 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Dmitry Torokhov, Rob Herring, Lee Jones,
	Jorge Ramirez-Ortiz, Feng Chen, Wei Xu, Guodong Xu

While trying to get the powerkey to function, I found when
pressing the key, I would get infinitely repeating interrupts.

After digging around a bit, it seems we didn't set the ack_base
value for the regmap irqchip logic, so nothing was acking the
interrupt.

This patch adds the ack_base, which seems to make things work.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Cc: Feng Chen <puck.chen@hisilicon.com>
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/mfd/hi655x-pmic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c
index 05ddc78..68ab370 100644
--- a/drivers/mfd/hi655x-pmic.c
+++ b/drivers/mfd/hi655x-pmic.c
@@ -45,6 +45,7 @@ static const struct regmap_irq_chip hi655x_irq_chip = {
 	.num_regs = 1,
 	.num_irqs = ARRAY_SIZE(hi655x_irqs),
 	.status_base = HI655X_IRQ_STAT_BASE,
+	.ack_base = HI655X_IRQ_STAT_BASE,
 	.mask_base = HI655X_IRQ_MASK_BASE,
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver
  2016-06-10  5:34 [PATCH 0/3] Hi655x powerkey support for HiKey (v3) John Stultz
  2016-06-10  5:34 ` [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC John Stultz
  2016-06-10  5:34 ` [PATCH 2/3] mfd: hi655x-pmic: Fixup issue with un-acked interrupts John Stultz
@ 2016-06-10  5:34 ` John Stultz
  2016-06-10  7:32   ` Lee Jones
  2 siblings, 1 reply; 9+ messages in thread
From: John Stultz @ 2016-06-10  5:34 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Dmitry Torokhov, Rob Herring, Lee Jones,
	Jorge Ramirez-Ortiz, Feng Chen, Wei Xu, Guodong Xu

Wire up the powerkey driver functionality for the hi655x PMIC.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Cc: Feng Chen <puck.chen@hisilicon.com>
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/mfd/hi655x-pmic.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c
index 68ab370..f3f6bfe2 100644
--- a/drivers/mfd/hi655x-pmic.c
+++ b/drivers/mfd/hi655x-pmic.c
@@ -24,10 +24,6 @@
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 
-static const struct mfd_cell hi655x_pmic_devs[] = {
-	{ .name = "hi655x-regulator", },
-};
-
 static const struct regmap_irq hi655x_irqs[] = {
 	{ .reg_offset = 0, .mask = OTMP_D1R_INT },
 	{ .reg_offset = 0, .mask = VSYS_2P5_R_INT },
@@ -56,6 +52,36 @@ static struct regmap_config hi655x_regmap_config = {
 	.max_register = HI655X_BUS_ADDR(0xFFF),
 };
 
+static struct resource pwrkey_resources[] = {
+	{
+		.name	= "down",
+		.start	= 6,
+		.end	= 6,
+		.flags	= IORESOURCE_IRQ,
+	}, {
+		.name	= "up",
+		.start	= 5,
+		.end	= 5,
+		.flags	= IORESOURCE_IRQ,
+	}, {
+		.name	= "hold 4s",
+		.start	= 4,
+		.end	= 4,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static const struct mfd_cell hi655x_pmic_devs[] = {
+	{
+		.name		= "hi655x-regulator",
+	},
+	{
+		.name		= "hi65xx-powerkey",
+		.num_resources	= ARRAY_SIZE(pwrkey_resources),
+		.resources	= &pwrkey_resources[0],
+	},
+};
+
 static void hi655x_local_irq_clear(struct regmap *map)
 {
 	int i;
@@ -124,7 +150,8 @@ static int hi655x_pmic_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, pmic);
 
 	ret = mfd_add_devices(dev, PLATFORM_DEVID_AUTO, hi655x_pmic_devs,
-			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0, NULL);
+			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0,
+			      regmap_irq_get_domain(pmic->irq_data));
 	if (ret) {
 		dev_err(dev, "Failed to register device %d\n", ret);
 		regmap_del_irq_chip(gpio_to_irq(pmic->gpio), pmic->irq_data);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC
  2016-06-10  5:34 ` [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC John Stultz
@ 2016-06-10  6:44   ` kbuild test robot
  2016-06-10  7:09     ` John Stultz
  2016-06-10  9:35   ` kbuild test robot
  1 sibling, 1 reply; 9+ messages in thread
From: kbuild test robot @ 2016-06-10  6:44 UTC (permalink / raw)
  To: John Stultz
  Cc: kbuild-all, lkml, Jorge Ramirez-Ortiz, Dmitry Torokhov,
	Rob Herring, Lee Jones, Feng Chen, Wei Xu, Guodong Xu,
	John Stultz

[-- Attachment #1: Type: text/plain, Size: 5513 bytes --]

Hi,

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.7-rc2 next-20160609]
[cannot apply to input/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/John-Stultz/Hi655x-powerkey-support-for-HiKey-v3/20160610-133804
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/input/misc/hisi_powerkey.c:21:0:
>> drivers/input/misc/hisi_powerkey.c:135:25: error: 'hi65xx_powerkey_of_match' undeclared here (not in a function)
    MODULE_DEVICE_TABLE(of, hi65xx_powerkey_of_match);
                            ^
   include/linux/module.h:223:21: note: in definition of macro 'MODULE_DEVICE_TABLE'
    extern const typeof(name) __mod_##type##__##name##_device_table  \
                        ^~~~
>> include/linux/module.h:223:27: error: '__mod_of__hi65xx_powerkey_of_match_device_table' aliased to undefined symbol 'hi65xx_powerkey_of_match'
    extern const typeof(name) __mod_##type##__##name##_device_table  \
                              ^
>> drivers/input/misc/hisi_powerkey.c:135:1: note: in expansion of macro 'MODULE_DEVICE_TABLE'
    MODULE_DEVICE_TABLE(of, hi65xx_powerkey_of_match);
    ^~~~~~~~~~~~~~~~~~~

vim +/hi65xx_powerkey_of_match +135 drivers/input/misc/hisi_powerkey.c

    15	 */
    16	
    17	#include <linux/platform_device.h>
    18	#include <linux/interrupt.h>
    19	#include <linux/reboot.h>
    20	#include <linux/kernel.h>
  > 21	#include <linux/module.h>
    22	#include <linux/of_irq.h>
    23	#include <linux/input.h>
    24	#include <linux/slab.h>
    25	
    26	/* the held interrupt will trigger after 4 seconds */
    27	#define MAX_HELD_TIME	(4 * MSEC_PER_SEC)
    28	
    29	
    30	enum id_action { ID_PRESSED, ID_RELEASED, ID_HELD, ID_LAST };
    31	const char *const irq_names[ID_LAST] = {"down", "up", "hold 4s"};
    32	
    33	struct hi65xx_priv {
    34		struct input_dev *input;
    35	};
    36	
    37	static irqreturn_t hi65xx_power_press_isr(int irq, void *q)
    38	{
    39		struct hi65xx_priv *p = q;
    40	
    41		pm_wakeup_event(p->input->dev.parent, MAX_HELD_TIME);
    42		input_report_key(p->input, KEY_POWER, 1);
    43		input_sync(p->input);
    44	
    45		return IRQ_HANDLED;
    46	}
    47	
    48	static irqreturn_t hi65xx_power_release_isr(int irq, void *q)
    49	{
    50		struct hi65xx_priv *p = q;
    51	
    52		pm_wakeup_event(p->input->dev.parent, MAX_HELD_TIME);
    53		input_report_key(p->input, KEY_POWER, 0);
    54		input_sync(p->input);
    55	
    56		return IRQ_HANDLED;
    57	}
    58	
    59	static irqreturn_t hi65xx_restart_toggle_isr(int irq, void *q)
    60	{
    61		struct hi65xx_priv *p = q;
    62		int value = test_bit(KEY_RESTART, p->input->key);
    63	
    64		pm_wakeup_event(p->input->dev.parent, MAX_HELD_TIME);
    65		input_report_key(p->input, KEY_RESTART, !value);
    66		input_sync(p->input);
    67	
    68		return IRQ_HANDLED;
    69	}
    70	
    71	irqreturn_t (*irq_handlers[ID_LAST])(int irq, void *q) = {
    72		hi65xx_power_press_isr,
    73		hi65xx_power_release_isr,
    74		hi65xx_restart_toggle_isr,
    75	};
    76	
    77	static int hi65xx_powerkey_probe(struct platform_device *pdev)
    78	{
    79		struct device *dev = &pdev->dev;
    80		struct hi65xx_priv *priv;
    81		int irq, i, ret;
    82	
    83		priv = devm_kzalloc(dev, sizeof(struct hi65xx_priv), GFP_KERNEL);
    84		if (!priv)
    85			return -ENOMEM;
    86	
    87		priv->input = devm_input_allocate_device(&pdev->dev);
    88		if (!priv->input) {
    89			dev_err(&pdev->dev, "failed to allocate input device\n");
    90			return -ENOMEM;
    91		}
    92	
    93		priv->input->phys = "hisi_on/input0";
    94		priv->input->name = "HISI 65xx PowerOn Key";
    95	
    96		input_set_capability(priv->input, EV_KEY, KEY_POWER);
    97		input_set_capability(priv->input, EV_KEY, KEY_RESTART);
    98	
    99		for (i = 0; i < ID_LAST; i++) {
   100	
   101			irq = platform_get_irq_byname(pdev, irq_names[i]);
   102			if (irq < 0) {
   103				dev_err(dev, "couldn't get irq %s\n", irq_names[i]);
   104				return irq;
   105			}
   106	
   107			ret = devm_request_any_context_irq(dev, irq,
   108						irq_handlers[i], IRQF_ONESHOT,
   109						irq_names[i], priv);
   110			if (ret < 0) {
   111				dev_err(dev, "couldn't get irq %s\n", irq_names[i]);
   112				return ret;
   113			}
   114		}
   115	
   116		ret = input_register_device(priv->input);
   117		if (ret) {
   118			dev_err(&pdev->dev, "failed to register input device: %d\n",
   119				ret);
   120			return ret;
   121		}
   122	
   123		platform_set_drvdata(pdev, priv);
   124		device_init_wakeup(&pdev->dev, 1);
   125	
   126		return 0;
   127	}
   128	
   129	static int hi65xx_powerkey_remove(struct platform_device *pdev)
   130	{
   131		device_init_wakeup(&pdev->dev, 0);
   132		return 0;
   133	}
   134	
 > 135	MODULE_DEVICE_TABLE(of, hi65xx_powerkey_of_match);
   136	
   137	static struct platform_driver hi65xx_powerkey_driver = {
   138		.driver = {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 54457 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC
  2016-06-10  6:44   ` kbuild test robot
@ 2016-06-10  7:09     ` John Stultz
  0 siblings, 0 replies; 9+ messages in thread
From: John Stultz @ 2016-06-10  7:09 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, lkml, Jorge Ramirez-Ortiz, Dmitry Torokhov,
	Rob Herring, Lee Jones, Feng Chen, Wei Xu, Guodong Xu

On Thu, Jun 9, 2016 at 11:44 PM, kbuild test robot <lkp@intel.com> wrote:
> Hi,
>
> [auto build test ERROR on ljones-mfd/for-mfd-next]
> [also build test ERROR on v4.7-rc2 next-20160609]
> [cannot apply to input/next]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/John-Stultz/Hi655x-powerkey-support-for-HiKey-v3/20160610-133804
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
> config: i386-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
>
> All error/warnings (new ones prefixed by >>):
>
>    In file included from drivers/input/misc/hisi_powerkey.c:21:0:
>>> drivers/input/misc/hisi_powerkey.c:135:25: error: 'hi65xx_powerkey_of_match' undeclared here (not in a function)
>     MODULE_DEVICE_TABLE(of, hi65xx_powerkey_of_match);
>                             ^
>    include/linux/module.h:223:21: note: in definition of macro 'MODULE_DEVICE_TABLE'
>     extern const typeof(name) __mod_##type##__##name##_device_table  \
>                         ^~~~
>>> include/linux/module.h:223:27: error: '__mod_of__hi65xx_powerkey_of_match_device_table' aliased to undefined symbol 'hi65xx_powerkey_of_match'
>     extern const typeof(name) __mod_##type##__##name##_device_table  \
>                               ^
>>> drivers/input/misc/hisi_powerkey.c:135:1: note: in expansion of macro 'MODULE_DEVICE_TABLE'
>     MODULE_DEVICE_TABLE(of, hi65xx_powerkey_of_match);
>     ^~~~~~~~~~~~~~~~~~~

Yep. Sorry, I realized right after I sent this that I had left the
MODULE_DEVICE_TABLE entry in there. I've already yanked it in my tree
and will resubmit with the fix next week.

Please do let me know if you have any other feedback or issues in the meantime!

Apologies and Thanks!
-john

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver
  2016-06-10  5:34 ` [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver John Stultz
@ 2016-06-10  7:32   ` Lee Jones
  2016-06-10  7:36     ` John Stultz
  0 siblings, 1 reply; 9+ messages in thread
From: Lee Jones @ 2016-06-10  7:32 UTC (permalink / raw)
  To: John Stultz
  Cc: lkml, Dmitry Torokhov, Rob Herring, Jorge Ramirez-Ortiz,
	Feng Chen, Wei Xu, Guodong Xu

On Thu, 09 Jun 2016, John Stultz wrote:

> Wire up the powerkey driver functionality for the hi655x PMIC.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> Cc: Feng Chen <puck.chen@hisilicon.com>
> Cc: Wei Xu <xuwei5@hisilicon.com>
> Cc: Guodong Xu <guodong.xu@linaro.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  drivers/mfd/hi655x-pmic.c | 37 ++++++++++++++++++++++++++++++++-----
>  1 file changed, 32 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c
> index 68ab370..f3f6bfe2 100644
> --- a/drivers/mfd/hi655x-pmic.c
> +++ b/drivers/mfd/hi655x-pmic.c
> @@ -24,10 +24,6 @@
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  
> -static const struct mfd_cell hi655x_pmic_devs[] = {
> -	{ .name = "hi655x-regulator", },
> -};
> -
>  static const struct regmap_irq hi655x_irqs[] = {
>  	{ .reg_offset = 0, .mask = OTMP_D1R_INT },
>  	{ .reg_offset = 0, .mask = VSYS_2P5_R_INT },
> @@ -56,6 +52,36 @@ static struct regmap_config hi655x_regmap_config = {
>  	.max_register = HI655X_BUS_ADDR(0xFFF),
>  };
>  
> +static struct resource pwrkey_resources[] = {
> +	{
> +		.name	= "down",
> +		.start	= 6,
> +		.end	= 6,
> +		.flags	= IORESOURCE_IRQ,
> +	}, {
> +		.name	= "up",
> +		.start	= 5,
> +		.end	= 5,
> +		.flags	= IORESOURCE_IRQ,
> +	}, {
> +		.name	= "hold 4s",
> +		.start	= 4,
> +		.end	= 4,
> +		.flags	= IORESOURCE_IRQ,
> +	},
> +};

No idea what 4, 5 and 6 mean.  Please define them.

> +static const struct mfd_cell hi655x_pmic_devs[] = {
> +	{
> +		.name		= "hi655x-regulator",
> +	},
> +	{
> +		.name		= "hi65xx-powerkey",
> +		.num_resources	= ARRAY_SIZE(pwrkey_resources),
> +		.resources	= &pwrkey_resources[0],
> +	},
> +};

Nit: Place the -regulator entry at the bottom and turn it into a one
liner:

	{ .name		= "hi655x-regulator", },


>  static void hi655x_local_irq_clear(struct regmap *map)
>  {
>  	int i;
> @@ -124,7 +150,8 @@ static int hi655x_pmic_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, pmic);
>  
>  	ret = mfd_add_devices(dev, PLATFORM_DEVID_AUTO, hi655x_pmic_devs,
> -			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0, NULL);
> +			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0,
> +			      regmap_irq_get_domain(pmic->irq_data));
>  	if (ret) {
>  		dev_err(dev, "Failed to register device %d\n", ret);
>  		regmap_del_irq_chip(gpio_to_irq(pmic->gpio), pmic->irq_data);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver
  2016-06-10  7:32   ` Lee Jones
@ 2016-06-10  7:36     ` John Stultz
  0 siblings, 0 replies; 9+ messages in thread
From: John Stultz @ 2016-06-10  7:36 UTC (permalink / raw)
  To: Lee Jones
  Cc: lkml, Dmitry Torokhov, Rob Herring, Jorge Ramirez-Ortiz,
	Feng Chen, Wei Xu, Guodong Xu

On Fri, Jun 10, 2016 at 12:32 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On Thu, 09 Jun 2016, John Stultz wrote:
>
>> +static struct resource pwrkey_resources[] = {
>> +     {
>> +             .name   = "down",
>> +             .start  = 6,
>> +             .end    = 6,
>> +             .flags  = IORESOURCE_IRQ,
>> +     }, {
>> +             .name   = "up",
>> +             .start  = 5,
>> +             .end    = 5,
>> +             .flags  = IORESOURCE_IRQ,
>> +     }, {
>> +             .name   = "hold 4s",
>> +             .start  = 4,
>> +             .end    = 4,
>> +             .flags  = IORESOURCE_IRQ,
>> +     },
>> +};
>
> No idea what 4, 5 and 6 mean.  Please define them.

Fair enough. It already defines PWRON_D4SR_INT, PWRON_D20F_INT and
PWRON_D20R_INT, but those are unfortunately mask values. I'll add a
patch to rename those to be clearly mask values and generate them from
a proper define value as well.

>> +static const struct mfd_cell hi655x_pmic_devs[] = {
>> +     {
>> +             .name           = "hi655x-regulator",
>> +     },
>> +     {
>> +             .name           = "hi65xx-powerkey",
>> +             .num_resources  = ARRAY_SIZE(pwrkey_resources),
>> +             .resources      = &pwrkey_resources[0],
>> +     },
>> +};
>
> Nit: Place the -regulator entry at the bottom and turn it into a one
> liner:
>
>         { .name         = "hi655x-regulator", },

Sure.  Will do!

Thanks for the feedback!
-john

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC
  2016-06-10  5:34 ` [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC John Stultz
  2016-06-10  6:44   ` kbuild test robot
@ 2016-06-10  9:35   ` kbuild test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2016-06-10  9:35 UTC (permalink / raw)
  To: John Stultz
  Cc: kbuild-all, lkml, Jorge Ramirez-Ortiz, Dmitry Torokhov,
	Rob Herring, Lee Jones, Feng Chen, Wei Xu, Guodong Xu,
	John Stultz

[-- Attachment #1: Type: text/plain, Size: 1593 bytes --]

Hi,

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.7-rc2 next-20160609]
[cannot apply to input/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/John-Stultz/Hi655x-powerkey-support-for-HiKey-v3/20160610-133804
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=tile 

All errors (new ones prefixed by >>):

   drivers/input/misc/hisi_powerkey.c:135:1: error: 'hi65xx_powerkey_of_match' undeclared here (not in a function)
>> drivers/input/misc/hisi_powerkey.c:135:1: error: '__mod_of__hi65xx_powerkey_of_match_device_table' aliased to undefined symbol 'hi65xx_powerkey_of_match'

vim +135 drivers/input/misc/hisi_powerkey.c

   129	static int hi65xx_powerkey_remove(struct platform_device *pdev)
   130	{
   131		device_init_wakeup(&pdev->dev, 0);
   132		return 0;
   133	}
   134	
 > 135	MODULE_DEVICE_TABLE(of, hi65xx_powerkey_of_match);
   136	
   137	static struct platform_driver hi65xx_powerkey_driver = {
   138		.driver = {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 43873 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-06-10  9:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10  5:34 [PATCH 0/3] Hi655x powerkey support for HiKey (v3) John Stultz
2016-06-10  5:34 ` [PATCH 1/3] drivers: input: powerkey for HISI 65xx SoC John Stultz
2016-06-10  6:44   ` kbuild test robot
2016-06-10  7:09     ` John Stultz
2016-06-10  9:35   ` kbuild test robot
2016-06-10  5:34 ` [PATCH 2/3] mfd: hi655x-pmic: Fixup issue with un-acked interrupts John Stultz
2016-06-10  5:34 ` [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver John Stultz
2016-06-10  7:32   ` Lee Jones
2016-06-10  7:36     ` John Stultz

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).