linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] MT6358 PMIC button support
@ 2021-05-06 15:37 Mattijs Korpershoek
  2021-05-06 15:37 ` [PATCH 1/3] Input: mtk-pmic-keys - use get_irq_byname() instead of index Mattijs Korpershoek
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mattijs Korpershoek @ 2021-05-06 15:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger
  Cc: Fabien Parent, linux-input, devicetree, linux-kernel,
	Mattijs Korpershoek, linux-arm-kernel, linux-mediatek

The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.

The interrupt logic is a little different than other PMICs from the
same family:
* for MT6323 and MT6397, we have one interrupt source per button
* for MT6358, we have two interrupts lines per button: the press and
* release interrupts are distinct sources.

Initially, this series contained both mfd and input patches.
To simplify maintainance and review the original series [1] has
been splitted

This series depends on [2]

[1] https://lore.kernel.org/linux-mediatek/87tunpw339.fsf@baylibre.com/
[2] https://lore.kernel.org/linux-mediatek/20210506094116.638527-1-mkorpershoek@baylibre.com/T/#m5c76f061c2158587b7190a13abbf2094b0c050bf

Mattijs Korpershoek (3):
  Input: mtk-pmic-keys - use get_irq_byname() instead of index
  dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
  Input: mtk-pmic-keys - add support for MT6358

 .../bindings/input/mtk-pmic-keys.txt          |  5 +-
 drivers/input/keyboard/mtk-pmic-keys.c        | 56 +++++++++++++++++--
 2 files changed, 56 insertions(+), 5 deletions(-)

-- 
2.27.0


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

* [PATCH 1/3] Input: mtk-pmic-keys - use get_irq_byname() instead of index
  2021-05-06 15:37 [PATCH 0/3] MT6358 PMIC button support Mattijs Korpershoek
@ 2021-05-06 15:37 ` Mattijs Korpershoek
  2021-05-06 15:37 ` [PATCH 2/3] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition Mattijs Korpershoek
  2021-05-06 15:37 ` [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
  2 siblings, 0 replies; 7+ messages in thread
From: Mattijs Korpershoek @ 2021-05-06 15:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger
  Cc: Fabien Parent, linux-input, devicetree, linux-kernel,
	Mattijs Korpershoek, linux-arm-kernel, linux-mediatek

Some pmics of the mt6397 family (such as MT6358), have two IRQs per
physical key: one for press event, another for release event.

The mtk-pmic-keys driver assumes that each key only has one
IRQ. The key index and the RES_IRQ resource index have a 1/1 mapping.

This won't work for MT6358, as we have multiple resources (2) for one key.

To prepare mtk-pmic-keys to support MT6358, retrieve IRQs by name
instead of by index.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 drivers/input/keyboard/mtk-pmic-keys.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 62391d6c7da6..d1abf95d5701 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -241,6 +241,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
 	unsigned int keycount;
 	struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
 	struct device_node *node = pdev->dev.of_node, *child;
+	static const char *const irqnames[] = { "powerkey", "homekey" };
 	struct mtk_pmic_keys *keys;
 	const struct mtk_pmic_regs *mtk_pmic_regs;
 	struct input_dev *input_dev;
@@ -268,7 +269,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
 	input_dev->id.version = 0x0001;
 
 	keycount = of_get_available_child_count(node);
-	if (keycount > MTK_PMIC_MAX_KEY_COUNT) {
+	if (keycount > MTK_PMIC_MAX_KEY_COUNT ||
+	    keycount > ARRAY_SIZE(irqnames)) {
 		dev_err(keys->dev, "too many keys defined (%d)\n", keycount);
 		return -EINVAL;
 	}
@@ -276,7 +278,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
 	for_each_child_of_node(node, child) {
 		keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index];
 
-		keys->keys[index].irq = platform_get_irq(pdev, index);
+		keys->keys[index].irq =
+			platform_get_irq_byname(pdev, irqnames[index]);
 		if (keys->keys[index].irq < 0) {
 			of_node_put(child);
 			return keys->keys[index].irq;
-- 
2.27.0


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

* [PATCH 2/3] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
  2021-05-06 15:37 [PATCH 0/3] MT6358 PMIC button support Mattijs Korpershoek
  2021-05-06 15:37 ` [PATCH 1/3] Input: mtk-pmic-keys - use get_irq_byname() instead of index Mattijs Korpershoek
@ 2021-05-06 15:37 ` Mattijs Korpershoek
  2021-05-06 15:37 ` [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
  2 siblings, 0 replies; 7+ messages in thread
From: Mattijs Korpershoek @ 2021-05-06 15:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger, Rob Herring
  Cc: Fabien Parent, linux-input, devicetree, linux-kernel,
	Mattijs Korpershoek, Rob Herring, linux-arm-kernel,
	linux-mediatek

Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs.

MT6358 is a little different since it used separate IRQs for the
release key (_r) event

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
index 535d92885372..9d00f2a8e13a 100644
--- a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
+++ b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
@@ -9,7 +9,10 @@ For MT6397/MT6323 MFD bindings see:
 Documentation/devicetree/bindings/mfd/mt6397.txt
 
 Required properties:
-- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys"
+- compatible: Should be one of:
+	- "mediatek,mt6397-keys"
+	- "mediatek,mt6323-keys"
+	- "mediatek,mt6358-keys"
 - linux,keycodes: See Documentation/devicetree/bindings/input/input.yaml
 
 Optional Properties:
-- 
2.27.0


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

* [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358
  2021-05-06 15:37 [PATCH 0/3] MT6358 PMIC button support Mattijs Korpershoek
  2021-05-06 15:37 ` [PATCH 1/3] Input: mtk-pmic-keys - use get_irq_byname() instead of index Mattijs Korpershoek
  2021-05-06 15:37 ` [PATCH 2/3] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition Mattijs Korpershoek
@ 2021-05-06 15:37 ` Mattijs Korpershoek
  2021-05-06 18:42   ` kernel test robot
  2021-05-06 19:41   ` kernel test robot
  2 siblings, 2 replies; 7+ messages in thread
From: Mattijs Korpershoek @ 2021-05-06 15:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger
  Cc: Fabien Parent, linux-input, devicetree, linux-kernel,
	Mattijs Korpershoek, linux-arm-kernel, linux-mediatek

MT6358 pmic keys behave differently than mt6397 and mt6323: there are
two interrupts per key: one for press, the other one for release (_r)

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
 drivers/input/keyboard/mtk-pmic-keys.c | 49 ++++++++++++++++++++++++--
 1 file changed, 47 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index d1abf95d5701..5496a7020104 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -9,6 +9,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/mfd/mt6323/registers.h>
+#include <linux/mfd/mt6358/registers.h>
 #include <linux/mfd/mt6397/core.h>
 #include <linux/mfd/mt6397/registers.h>
 #include <linux/module.h>
@@ -74,11 +75,22 @@ static const struct mtk_pmic_regs mt6323_regs = {
 	.pmic_rst_reg = MT6323_TOP_RST_MISC,
 };
 
+static const struct mtk_pmic_regs mt6358_regs = {
+	.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+		0x2, MT6358_PSC_TOP_INT_CON0, 0x5),
+	.keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+		0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
+	.pmic_rst_reg = MT6358_TOP_RST_MISC,
+};
+
 struct mtk_pmic_keys_info {
 	struct mtk_pmic_keys *keys;
 	const struct mtk_pmic_keys_regs *regs;
 	unsigned int keycode;
 	int irq;
+	int irq_r; /* optional: release irq if different */
 	bool wakeup:1;
 };
 
@@ -188,6 +200,19 @@ static int mtk_pmic_key_setup(struct mtk_pmic_keys *keys,
 		return ret;
 	}
 
+	if (info->irq_r > 0) {
+		ret = devm_request_threaded_irq(
+			keys->dev, info->irq_r, NULL,
+			mtk_pmic_keys_irq_handler_thread,
+			IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mtk-pmic-keys",
+			info);
+		if (ret) {
+			dev_err(keys->dev, "Failed to request IRQ_r: %d: %d\n",
+				info->irq, ret);
+			return ret;
+		}
+	}
+
 	input_set_capability(keys->input_dev, EV_KEY, info->keycode);
 
 	return 0;
@@ -199,8 +224,11 @@ static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev)
 	int index;
 
 	for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
-		if (keys->keys[index].wakeup)
+		if (keys->keys[index].wakeup) {
 			enable_irq_wake(keys->keys[index].irq);
+			if (keys->keys[index].irq_r > 0)
+				enable_irq_wake(keys->keys[index].irq_r);
+		}
 	}
 
 	return 0;
@@ -212,8 +240,11 @@ static int __maybe_unused mtk_pmic_keys_resume(struct device *dev)
 	int index;
 
 	for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
-		if (keys->keys[index].wakeup)
+		if (keys->keys[index].wakeup) {
 			disable_irq_wake(keys->keys[index].irq);
+			if (keys->keys[index].irq_r > 0)
+				disable_irq_wake(keys->keys[index].irq_r);
+		}
 	}
 
 	return 0;
@@ -229,6 +260,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
 	}, {
 		.compatible = "mediatek,mt6323-keys",
 		.data = &mt6323_regs,
+	}, {
+		.compatible = "mediatek,mt6358-keys",
+		.data = &mt6358_regs,
 	}, {
 		/* sentinel */
 	}
@@ -242,6 +276,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
 	struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
 	struct device_node *node = pdev->dev.of_node, *child;
 	static const char *const irqnames[] = { "powerkey", "homekey" };
+	static const char *const irqnames_r[] = { "powerkey_r", "homekey_r" };
 	struct mtk_pmic_keys *keys;
 	const struct mtk_pmic_regs *mtk_pmic_regs;
 	struct input_dev *input_dev;
@@ -285,6 +320,16 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
 			return keys->keys[index].irq;
 		}
 
+		if (of_device_is_compatible(node, "mediatek,mt6358-keys")) {
+			keys->keys[index].irq_r = platform_get_irq_byname(
+				pdev, irqnames_r[index]);
+
+			if (keys->keys[index].irq_r < 0) {
+				of_node_put(child);
+				return keys->keys[index].irq_r;
+			}
+		}
+
 		error = of_property_read_u32(child,
 			"linux,keycodes", &keys->keys[index].keycode);
 		if (error) {
-- 
2.27.0


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

* Re: [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358
  2021-05-06 15:37 ` [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
@ 2021-05-06 18:42   ` kernel test robot
  2021-05-06 19:41   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-05-06 18:42 UTC (permalink / raw)
  To: Mattijs Korpershoek, Dmitry Torokhov, Matthias Brugger
  Cc: kbuild-all, Fabien Parent, linux-input, devicetree, linux-kernel,
	Mattijs Korpershoek, linux-arm-kernel, linux-mediatek

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

Hi Mattijs,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on input/next]
[also build test ERROR on v5.12 next-20210506]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mattijs-Korpershoek/MT6358-PMIC-button-support/20210506-234207
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/504339f7cba56983b5e2530aaa498ae829a50587
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mattijs-Korpershoek/MT6358-PMIC-button-support/20210506-234207
        git checkout 504339f7cba56983b5e2530aaa498ae829a50587
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/input/keyboard/mtk-pmic-keys.c:80:22: error: 'MT6358_TOPSTATUS' undeclared here (not in a function); did you mean 'MT6397_OCSTATUS2'?
      80 |   MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
         |                      ^~~~~~~~~~~~~~~~
   drivers/input/keyboard/mtk-pmic-keys.c:47:14: note: in definition of macro 'MTK_PMIC_KEYS_REGS'
      47 |  .deb_reg  = _deb_reg,  \
         |              ^~~~~~~~
>> drivers/input/keyboard/mtk-pmic-keys.c:85:18: error: 'MT6358_TOP_RST_MISC' undeclared here (not in a function); did you mean 'MT6397_TOP_RST_MISC'?
      85 |  .pmic_rst_reg = MT6358_TOP_RST_MISC,
         |                  ^~~~~~~~~~~~~~~~~~~
         |                  MT6397_TOP_RST_MISC


vim +80 drivers/input/keyboard/mtk-pmic-keys.c

    77	
    78	static const struct mtk_pmic_regs mt6358_regs = {
    79		.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
  > 80			MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
    81			0x2, MT6358_PSC_TOP_INT_CON0, 0x5),
    82		.keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
    83			MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
    84			0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
  > 85		.pmic_rst_reg = MT6358_TOP_RST_MISC,
    86	};
    87	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63877 bytes --]

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

* Re: [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358
  2021-05-06 15:37 ` [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
  2021-05-06 18:42   ` kernel test robot
@ 2021-05-06 19:41   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-05-06 19:41 UTC (permalink / raw)
  To: Mattijs Korpershoek, Dmitry Torokhov, Matthias Brugger
  Cc: kbuild-all, clang-built-linux, Fabien Parent, linux-input,
	devicetree, linux-kernel, Mattijs Korpershoek, linux-arm-kernel,
	linux-mediatek

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

Hi Mattijs,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on input/next]
[also build test ERROR on v5.12 next-20210506]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mattijs-Korpershoek/MT6358-PMIC-button-support/20210506-234207
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: powerpc-randconfig-r005-20210506 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/504339f7cba56983b5e2530aaa498ae829a50587
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mattijs-Korpershoek/MT6358-PMIC-button-support/20210506-234207
        git checkout 504339f7cba56983b5e2530aaa498ae829a50587
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   __do_insb
   ^
   arch/powerpc/include/asm/io.h:556:56: note: expanded from macro '__do_insb'
   #define __do_insb(p, b, n)      readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/input/keyboard/mtk-pmic-keys.c:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:208:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/input/keyboard/mtk-pmic-keys.c:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:210:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/input/keyboard/mtk-pmic-keys.c:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:212:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/input/keyboard/mtk-pmic-keys.c:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:214:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/input/keyboard/mtk-pmic-keys.c:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:216:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> drivers/input/keyboard/mtk-pmic-keys.c:80:22: error: use of undeclared identifier 'MT6358_TOPSTATUS'
                   MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
                                      ^
   drivers/input/keyboard/mtk-pmic-keys.c:83:22: error: use of undeclared identifier 'MT6358_TOPSTATUS'
                   MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
                                      ^
>> drivers/input/keyboard/mtk-pmic-keys.c:85:18: error: use of undeclared identifier 'MT6358_TOP_RST_MISC'
           .pmic_rst_reg = MT6358_TOP_RST_MISC,
                           ^
   12 warnings and 3 errors generated.


vim +/MT6358_TOPSTATUS +80 drivers/input/keyboard/mtk-pmic-keys.c

    77	
    78	static const struct mtk_pmic_regs mt6358_regs = {
    79		.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
  > 80			MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
    81			0x2, MT6358_PSC_TOP_INT_CON0, 0x5),
    82		.keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
    83			MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
    84			0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
  > 85		.pmic_rst_reg = MT6358_TOP_RST_MISC,
    86	};
    87	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33629 bytes --]

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

* [PATCH 0/3] MT6358 PMIC button support
@ 2021-05-06  9:41 Mattijs Korpershoek
  0 siblings, 0 replies; 7+ messages in thread
From: Mattijs Korpershoek @ 2021-05-06  9:41 UTC (permalink / raw)
  To: Lee Jones, Matthias Brugger
  Cc: Fabien Parent, linux-arm-kernel, linux-mediatek, linux-kernel,
	Mattijs Korpershoek

The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.

The interrupt logic is a little different than other PMICs from the
same family:
* for MT6323 and MT6397, we have one interrupt source per button
* for MT6358, we have two interrupts lines per button: the press and
* release interrupts are distinct sources.

This series depends on [1]

[1] https://lore.kernel.org/linux-arm-kernel/20210429143811.2030717-1-mkorpershoek@baylibre.com/

Mattijs Korpershoek (3):
  mfd: mt6397: add mt6358 register definitions for power key
  mfd: mt6397: keys: use named IRQs instead of index
  mfd: mt6397: add PMIC keys for MT6358

 drivers/mfd/mt6397-core.c            | 20 ++++++++++++++++----
 include/linux/mfd/mt6358/registers.h |  2 ++
 2 files changed, 18 insertions(+), 4 deletions(-)

-- 
2.27.0


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

end of thread, other threads:[~2021-05-06 19:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 15:37 [PATCH 0/3] MT6358 PMIC button support Mattijs Korpershoek
2021-05-06 15:37 ` [PATCH 1/3] Input: mtk-pmic-keys - use get_irq_byname() instead of index Mattijs Korpershoek
2021-05-06 15:37 ` [PATCH 2/3] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition Mattijs Korpershoek
2021-05-06 15:37 ` [PATCH 3/3] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
2021-05-06 18:42   ` kernel test robot
2021-05-06 19:41   ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-05-06  9:41 [PATCH 0/3] MT6358 PMIC button support Mattijs Korpershoek

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