linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Input: mt6779-keypad - double keys support
@ 2022-07-26 12:56 Mattijs Korpershoek
  2022-07-26 12:56 ` [PATCH v2 1/7] MAINTAINERS: input: add mattijs for mt6779-keypad Mattijs Korpershoek
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Matthias Brugger, Mattijs Korpershoek,
	Dmitry Torokhov, Rob Herring
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

The MediaTek keypad controller has multiple operating modes:
* single key detection (currently implemented)
* double key detection

With double key detection, each (row,column) is a group that can detect
two keys in the key matrix.
This minimizes the overall pin counts for cost reduction.
However, pressing multiple keys in the same group will not be
detected properly.

On some boards, like mt8183-pumpkin, double key detection is used.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

---
Changes in v2:
- bindings: add matrix-keymap justification in commit message (Krzysztof)
- bindings: switch from double-keys(boolean) to keys-per-group(uint32) (Krzysztof)
- driver: add a function pointer for row/column calculation (Angelo)
- Link to v1: https://lore.kernel.org/r/20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com

---
Fabien Parent (2):
      arm64: dts: mediatek: mt8183: add keyboard node
      arm64: dts: mediatek: mt8183-pumpkin: add keypad support

Mattijs Korpershoek (5):
      MAINTAINERS: input: add mattijs for mt6779-keypad
      dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties
      dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group
      Input: mt6779-keypad - prepare double keys support with calc_row_col
      Input: mt6779-keypad - support double keys matrix

 .../bindings/input/mediatek,mt6779-keypad.yaml     |  8 ++++-
 MAINTAINERS                                        |  6 ++++
 arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts    | 21 +++++++++++
 arch/arm64/boot/dts/mediatek/mt8183.dtsi           |  9 +++++
 drivers/input/keyboard/mt6779-keypad.c             | 41 ++++++++++++++++++++--
 5 files changed, 82 insertions(+), 3 deletions(-)
---
base-commit: 668af1b6548837b44a2bfe65dcbae6b250adbf63
change-id: 20220720-mt8183-keypad-20aa77106ff0

Best regards,
-- 
Mattijs Korpershoek <mkorpershoek@baylibre.com>

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

* [PATCH v2 1/7] MAINTAINERS: input: add mattijs for mt6779-keypad
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
@ 2022-07-26 12:56 ` Mattijs Korpershoek
  2022-07-26 12:56 ` [PATCH v2 2/7] dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties Mattijs Korpershoek
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

As stated in [1]:
Fengping has no longer interest and time to maintain this driver so he
agreed to transfer maintainership over to me.

Add a dedicated maintainer entry as well for the driver to make sure
that I can help with patch reviews.

[1] https://lore.kernel.org/r/20220421140255.2781505-1-mkorpershoek@baylibre.com

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

diff --git a/MAINTAINERS b/MAINTAINERS
index 1de6a8fbf0a8..f2f0696caf6a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12805,6 +12805,12 @@ S:	Supported
 F:	Documentation/devicetree/bindings/media/mediatek-jpeg-*.yaml
 F:	drivers/media/platform/mediatek/jpeg/
 
+MEDIATEK KEYPAD DRIVER
+M:	Mattijs Korpershoek <mkorpershoek@baylibre.com>
+S:	Supported
+F:	Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
+F:	drivers/input/keyboard/mt6779-keypad.c
+
 MEDIATEK MDP DRIVER
 M:	Minghsiu Tsai <minghsiu.tsai@mediatek.com>
 M:	Houlong Wei <houlong.wei@mediatek.com>

-- 
b4 0.10.0-dev-78725

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

* [PATCH v2 2/7] dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
  2022-07-26 12:56 ` [PATCH v2 1/7] MAINTAINERS: input: add mattijs for mt6779-keypad Mattijs Korpershoek
@ 2022-07-26 12:56 ` Mattijs Korpershoek
  2022-07-27 10:27   ` Krzysztof Kozlowski
  2022-07-26 12:56 ` [PATCH v2 3/7] dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group Mattijs Korpershoek
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

writing-bindings.rst states:
> - If schema includes other schema (e.g. /schemas/i2c/i2c-controller.yaml) use
>   "unevaluatedProperties:false". In other cases, usually use
>   "additionalProperties:false".

All 3 properties from matrix-keymap.yaml are valid for the MediaTek keypad:
* keypad,num-rows and keypad,num-cols configure the KP_SEL register
* linux,keymap represents the (at most) 8x8 hardware matrix

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

diff --git a/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml b/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
index 03ebd2665d07..ca8ae40a73f7 100644
--- a/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
+++ b/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
@@ -56,7 +56,7 @@ required:
   - clocks
   - clock-names
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |

-- 
b4 0.10.0-dev-78725

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

* [PATCH v2 3/7] dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
  2022-07-26 12:56 ` [PATCH v2 1/7] MAINTAINERS: input: add mattijs for mt6779-keypad Mattijs Korpershoek
  2022-07-26 12:56 ` [PATCH v2 2/7] dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties Mattijs Korpershoek
@ 2022-07-26 12:56 ` Mattijs Korpershoek
  2022-07-27 10:27   ` Krzysztof Kozlowski
  2022-07-26 12:56 ` [PATCH v2 4/7] Input: mt6779-keypad - prepare double keys support with calc_row_col Mattijs Korpershoek
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

The MediaTek keypad has 2 modes of detecting key events:
* single key: each (row, column) can detect one key
* double key: each (row, column) is a group of 2 keys

With double key, two keys are physically wired to one (row, column) pin.
These keys are in the same "group".

Multiple keys in the same group reduces the number of pins which
minimizes cost.

Add a keys-per-group property to describe this.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

diff --git a/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml b/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
index ca8ae40a73f7..387d0448ff77 100644
--- a/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
+++ b/Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
@@ -49,6 +49,12 @@ properties:
     maximum: 256
     default: 16
 
+  mediatek,keys-per-group:
+    description: each (row, column) group has multiple keys
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 1
+    maximum: 2
+
 required:
   - compatible
   - reg

-- 
b4 0.10.0-dev-78725

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

* [PATCH v2 4/7] Input: mt6779-keypad - prepare double keys support with calc_row_col
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
                   ` (2 preceding siblings ...)
  2022-07-26 12:56 ` [PATCH v2 3/7] dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group Mattijs Korpershoek
@ 2022-07-26 12:56 ` Mattijs Korpershoek
  2022-07-27  7:34   ` AngeloGioacchino Del Regno
  2022-07-26 12:56 ` [PATCH v2 5/7] Input: mt6779-keypad - support double keys matrix Mattijs Korpershoek
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

The MediaTek keypad can operate in two modes: single key or double key.
The driver only supports single key mode. In double key mode, the
row/column calculation based on the key is different.

Add a calc_row_col function pointer which will be different based on
single/double key mode.

No functional change.

Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

diff --git a/drivers/input/keyboard/mt6779-keypad.c b/drivers/input/keyboard/mt6779-keypad.c
index bf447bf598fb..39c931974bde 100644
--- a/drivers/input/keyboard/mt6779-keypad.c
+++ b/drivers/input/keyboard/mt6779-keypad.c
@@ -31,6 +31,7 @@ struct mt6779_keypad {
 	struct clk *clk;
 	u32 n_rows;
 	u32 n_cols;
+	void (*calc_row_col)(unsigned int key, unsigned int *row, unsigned int *col);
 	DECLARE_BITMAP(keymap_state, MTK_KPD_NUM_BITS);
 };
 
@@ -67,8 +68,7 @@ static irqreturn_t mt6779_keypad_irq_handler(int irq, void *dev_id)
 			continue;
 
 		key = bit_nr / 32 * 16 + bit_nr % 32;
-		row = key / 9;
-		col = key % 9;
+		keypad->calc_row_col(key, &row, &col);
 
 		scancode = MATRIX_SCAN_CODE(row, col, row_shift);
 		/* 1: not pressed, 0: pressed */
@@ -94,6 +94,14 @@ static void mt6779_keypad_clk_disable(void *data)
 	clk_disable_unprepare(data);
 }
 
+static void mt6779_keypad_calc_row_col_single(unsigned int key,
+					      unsigned int *row,
+					      unsigned int *col)
+{
+	*row = key / 9;
+	*col = key % 9;
+}
+
 static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
 {
 	struct mt6779_keypad *keypad;
@@ -148,6 +156,8 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	keypad->calc_row_col = mt6779_keypad_calc_row_col_single;
+
 	wakeup = device_property_read_bool(&pdev->dev, "wakeup-source");
 
 	dev_dbg(&pdev->dev, "n_row=%d n_col=%d debounce=%d\n",

-- 
b4 0.10.0-dev-78725

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

* [PATCH v2 5/7] Input: mt6779-keypad - support double keys matrix
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
                   ` (3 preceding siblings ...)
  2022-07-26 12:56 ` [PATCH v2 4/7] Input: mt6779-keypad - prepare double keys support with calc_row_col Mattijs Korpershoek
@ 2022-07-26 12:56 ` Mattijs Korpershoek
  2022-07-27  7:34   ` AngeloGioacchino Del Regno
  2022-07-26 12:56 ` [PATCH v2 6/7] arm64: dts: mediatek: mt8183: add keyboard node Mattijs Korpershoek
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

MediaTek keypad has 2 modes of detecting key events:
- single key: each (row, column) can detect one key
- double key: each (row, column) is a group of 2 keys

Double key support exists to minimize cost, since it reduces the number
of pins required for physical keys.

Double key is configured by setting BIT(0) of the KP_SEL register.

Enable double key matrix support based on the mediatek,keys-per-group
device tree property.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

diff --git a/drivers/input/keyboard/mt6779-keypad.c b/drivers/input/keyboard/mt6779-keypad.c
index 39c931974bde..f70b02396de4 100644
--- a/drivers/input/keyboard/mt6779-keypad.c
+++ b/drivers/input/keyboard/mt6779-keypad.c
@@ -18,6 +18,7 @@
 #define MTK_KPD_DEBOUNCE_MASK	GENMASK(13, 0)
 #define MTK_KPD_DEBOUNCE_MAX_MS	256
 #define MTK_KPD_SEL		0x0020
+#define MTK_KPD_SEL_DOUBLE_KP_MODE	BIT(0)
 #define MTK_KPD_SEL_COL	GENMASK(15, 10)
 #define MTK_KPD_SEL_ROW	GENMASK(9, 4)
 #define MTK_KPD_SEL_COLMASK(c)	GENMASK((c) + 9, 10)
@@ -102,12 +103,21 @@ static void mt6779_keypad_calc_row_col_single(unsigned int key,
 	*col = key % 9;
 }
 
+static void mt6779_keypad_calc_row_col_double(unsigned int key,
+					      unsigned int *row,
+					      unsigned int *col)
+{
+	*row = key / 13;
+	*col = (key % 13) / 2;
+}
+
 static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
 {
 	struct mt6779_keypad *keypad;
 	void __iomem *base;
 	int irq;
 	u32 debounce;
+	u32 keys_per_group;
 	bool wakeup;
 	int error;
 
@@ -156,7 +166,20 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	keypad->calc_row_col = mt6779_keypad_calc_row_col_single;
+	if (device_property_read_u32(&pdev->dev, "mediatek,keys-per-group", &keys_per_group))
+		keys_per_group = 1;
+
+	switch (keys_per_group) {
+	case 1:
+		keypad->calc_row_col = mt6779_keypad_calc_row_col_single;
+		break;
+	case 2:
+		keypad->calc_row_col = mt6779_keypad_calc_row_col_double;
+		break;
+	default:
+		dev_err(&pdev->dev, "Invalid keys-per-group: %d\n", keys_per_group);
+		return -EINVAL;
+	}
 
 	wakeup = device_property_read_bool(&pdev->dev, "wakeup-source");
 
@@ -176,6 +199,10 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
 	regmap_write(keypad->regmap, MTK_KPD_DEBOUNCE,
 		     (debounce * (1 << 5)) & MTK_KPD_DEBOUNCE_MASK);
 
+	if (keys_per_group == 2)
+		regmap_update_bits(keypad->regmap, MTK_KPD_SEL,
+				   MTK_KPD_SEL_DOUBLE_KP_MODE, MTK_KPD_SEL_DOUBLE_KP_MODE);
+
 	regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_ROW,
 			   MTK_KPD_SEL_ROWMASK(keypad->n_rows));
 	regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_COL,

-- 
b4 0.10.0-dev-78725

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

* [PATCH v2 6/7] arm64: dts: mediatek: mt8183: add keyboard node
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
                   ` (4 preceding siblings ...)
  2022-07-26 12:56 ` [PATCH v2 5/7] Input: mt6779-keypad - support double keys matrix Mattijs Korpershoek
@ 2022-07-26 12:56 ` Mattijs Korpershoek
  2022-07-26 12:56 ` [PATCH v2 7/7] arm64: dts: mediatek: mt8183-pumpkin: add keypad support Mattijs Korpershoek
  2022-08-10 22:53 ` [PATCH v2 0/7] Input: mt6779-keypad - double keys support Dmitry Torokhov
  7 siblings, 0 replies; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

From: Fabien Parent <fparent@baylibre.com>

MT8183 has an on-SoC keyboard controller commonly used for volume
up/down buttons.

List it in the SoC dts so that boards can enable/use it.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index 9d32871973a2..9d8fdebaabe3 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -943,6 +943,15 @@ pwrap: pwrap@1000d000 {
 			clock-names = "spi", "wrap";
 		};
 
+		keyboard: keyboard@10010000 {
+			compatible = "mediatek,mt6779-keypad";
+			reg = <0 0x10010000 0 0x1000>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_EDGE_FALLING>;
+			clocks = <&clk26m>;
+			clock-names = "kpd";
+			status = "disabled";
+		};
+
 		scp: scp@10500000 {
 			compatible = "mediatek,mt8183-scp";
 			reg = <0 0x10500000 0 0x80000>,

-- 
b4 0.10.0-dev-78725

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

* [PATCH v2 7/7] arm64: dts: mediatek: mt8183-pumpkin: add keypad support
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
                   ` (5 preceding siblings ...)
  2022-07-26 12:56 ` [PATCH v2 6/7] arm64: dts: mediatek: mt8183: add keyboard node Mattijs Korpershoek
@ 2022-07-26 12:56 ` Mattijs Korpershoek
  2022-08-10 22:53 ` [PATCH v2 0/7] Input: mt6779-keypad - double keys support Dmitry Torokhov
  7 siblings, 0 replies; 14+ messages in thread
From: Mattijs Korpershoek @ 2022-07-26 12:56 UTC (permalink / raw)
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

From: Fabien Parent <fparent@baylibre.com>

Add device-tree bindings for the keypad driver on the MT8183 Pumpkin
board.

The MT8183 Pumpkin board has 2 buttons connected using: KPROW0,
KPROW1 and KPCOL0.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

diff --git a/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts b/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts
index 530e0c9ce0c9..a1d01639df30 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts
@@ -7,6 +7,7 @@
 /dts-v1/;
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include "mt8183.dtsi"
 #include "mt6358.dtsi"
 
@@ -122,6 +123,18 @@ &i2c6 {
 	clock-frequency = <100000>;
 };
 
+&keyboard {
+	pinctrl-names = "default";
+	pinctrl-0 = <&keyboard_pins>;
+	status = "okay";
+	linux,keymap = <MATRIX_KEY(0x00, 0x00, KEY_VOLUMEDOWN)
+			MATRIX_KEY(0x01, 0x00, KEY_VOLUMEUP)>;
+	keypad,num-rows = <2>;
+	keypad,num-columns = <1>;
+	debounce-delay-ms = <32>;
+	mediatek,keys-per-group = <2>;
+};
+
 &mmc0 {
 	status = "okay";
 	pinctrl-names = "default", "state_uhs";
@@ -226,6 +239,14 @@ pins_cmd_dat {
 		};
 	};
 
+	keyboard_pins: keyboard {
+		pins_keyboard {
+			pinmux = <PINMUX_GPIO91__FUNC_KPROW1>,
+				 <PINMUX_GPIO92__FUNC_KPROW0>,
+				 <PINMUX_GPIO93__FUNC_KPCOL0>;
+		};
+	};
+
 	mmc0_pins_default: mmc0-pins-default {
 		pins_cmd_dat {
 			pinmux = <PINMUX_GPIO123__FUNC_MSDC0_DAT0>,

-- 
b4 0.10.0-dev-78725

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

* Re: [PATCH v2 4/7] Input: mt6779-keypad - prepare double keys support with calc_row_col
  2022-07-26 12:56 ` [PATCH v2 4/7] Input: mt6779-keypad - prepare double keys support with calc_row_col Mattijs Korpershoek
@ 2022-07-27  7:34   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-07-27  7:34 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: linux-arm-kernel, Fabien Parent, linux-mediatek, devicetree,
	linux-kernel, linux-input, Fabien Parent

Il 26/07/22 14:56, Mattijs Korpershoek ha scritto:
> The MediaTek keypad can operate in two modes: single key or double key.
> The driver only supports single key mode. In double key mode, the
> row/column calculation based on the key is different.
> 
> Add a calc_row_col function pointer which will be different based on
> single/double key mode.
> 
> No functional change.
> 
> Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


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

* Re: [PATCH v2 5/7] Input: mt6779-keypad - support double keys matrix
  2022-07-26 12:56 ` [PATCH v2 5/7] Input: mt6779-keypad - support double keys matrix Mattijs Korpershoek
@ 2022-07-27  7:34   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 14+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-07-27  7:34 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: linux-arm-kernel, Fabien Parent, linux-mediatek, devicetree,
	linux-kernel, linux-input, Fabien Parent

Il 26/07/22 14:56, Mattijs Korpershoek ha scritto:
> MediaTek keypad has 2 modes of detecting key events:
> - single key: each (row, column) can detect one key
> - double key: each (row, column) is a group of 2 keys
> 
> Double key support exists to minimize cost, since it reduces the number
> of pins required for physical keys.
> 
> Double key is configured by setting BIT(0) of the KP_SEL register.
> 
> Enable double key matrix support based on the mediatek,keys-per-group
> device tree property.
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


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

* Re: [PATCH v2 2/7] dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties
  2022-07-26 12:56 ` [PATCH v2 2/7] dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties Mattijs Korpershoek
@ 2022-07-27 10:27   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-07-27 10:27 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

On 26/07/2022 14:56, Mattijs Korpershoek wrote:
> writing-bindings.rst states:
>> - If schema includes other schema (e.g. /schemas/i2c/i2c-controller.yaml) use
>>   "unevaluatedProperties:false". In other cases, usually use
>>   "additionalProperties:false".
> 
> All 3 properties from matrix-keymap.yaml are valid for the MediaTek keypad:
> * keypad,num-rows and keypad,num-cols configure the KP_SEL register
> * linux,keymap represents the (at most) 8x8 hardware matrix
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

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

* Re: [PATCH v2 3/7] dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group
  2022-07-26 12:56 ` [PATCH v2 3/7] dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group Mattijs Korpershoek
@ 2022-07-27 10:27   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-07-27 10:27 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

On 26/07/2022 14:56, Mattijs Korpershoek wrote:
> The MediaTek keypad has 2 modes of detecting key events:
> * single key: each (row, column) can detect one key
> * double key: each (row, column) is a group of 2 keys
> 
> With double key, two keys are physically wired to one (row, column) pin.
> These keys are in the same "group".
> 
> Multiple keys in the same group reduces the number of pins which
> minimizes cost.
> 
> Add a keys-per-group property to describe this.
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

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

* Re: [PATCH v2 0/7] Input: mt6779-keypad - double keys support
  2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
                   ` (6 preceding siblings ...)
  2022-07-26 12:56 ` [PATCH v2 7/7] arm64: dts: mediatek: mt8183-pumpkin: add keypad support Mattijs Korpershoek
@ 2022-08-10 22:53 ` Dmitry Torokhov
  2022-08-24 13:55   ` Matthias Brugger
  7 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2022-08-10 22:53 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: Krzysztof Kozlowski, Matthias Brugger, Rob Herring,
	linux-arm-kernel, AngeloGioacchino Del Regno, Fabien Parent,
	linux-mediatek, devicetree, linux-kernel, linux-input,
	Fabien Parent

On Tue, Jul 26, 2022 at 02:56:05PM +0200, Mattijs Korpershoek wrote:
> The MediaTek keypad controller has multiple operating modes:
> * single key detection (currently implemented)
> * double key detection
> 
> With double key detection, each (row,column) is a group that can detect
> two keys in the key matrix.
> This minimizes the overall pin counts for cost reduction.
> However, pressing multiple keys in the same group will not be
> detected properly.
> 
> On some boards, like mt8183-pumpkin, double key detection is used.
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

Applied patches 1 through 5 (leaving dts patches out), thank you.

> 
> ---
> Changes in v2:
> - bindings: add matrix-keymap justification in commit message (Krzysztof)
> - bindings: switch from double-keys(boolean) to keys-per-group(uint32) (Krzysztof)
> - driver: add a function pointer for row/column calculation (Angelo)
> - Link to v1: https://lore.kernel.org/r/20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com
> 
> ---
> Fabien Parent (2):
>       arm64: dts: mediatek: mt8183: add keyboard node
>       arm64: dts: mediatek: mt8183-pumpkin: add keypad support
> 
> Mattijs Korpershoek (5):
>       MAINTAINERS: input: add mattijs for mt6779-keypad
>       dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties
>       dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group
>       Input: mt6779-keypad - prepare double keys support with calc_row_col
>       Input: mt6779-keypad - support double keys matrix
> 
>  .../bindings/input/mediatek,mt6779-keypad.yaml     |  8 ++++-
>  MAINTAINERS                                        |  6 ++++
>  arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts    | 21 +++++++++++
>  arch/arm64/boot/dts/mediatek/mt8183.dtsi           |  9 +++++
>  drivers/input/keyboard/mt6779-keypad.c             | 41 ++++++++++++++++++++--
>  5 files changed, 82 insertions(+), 3 deletions(-)
> ---
> base-commit: 668af1b6548837b44a2bfe65dcbae6b250adbf63
> change-id: 20220720-mt8183-keypad-20aa77106ff0
> 
> Best regards,
> -- 
> Mattijs Korpershoek <mkorpershoek@baylibre.com>

-- 
Dmitry

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

* Re: [PATCH v2 0/7] Input: mt6779-keypad - double keys support
  2022-08-10 22:53 ` [PATCH v2 0/7] Input: mt6779-keypad - double keys support Dmitry Torokhov
@ 2022-08-24 13:55   ` Matthias Brugger
  0 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2022-08-24 13:55 UTC (permalink / raw)
  To: Dmitry Torokhov, Mattijs Korpershoek
  Cc: Krzysztof Kozlowski, Rob Herring, linux-arm-kernel,
	AngeloGioacchino Del Regno, Fabien Parent, linux-mediatek,
	devicetree, linux-kernel, linux-input, Fabien Parent



On 11/08/2022 00:53, Dmitry Torokhov wrote:
> On Tue, Jul 26, 2022 at 02:56:05PM +0200, Mattijs Korpershoek wrote:
>> The MediaTek keypad controller has multiple operating modes:
>> * single key detection (currently implemented)
>> * double key detection
>>
>> With double key detection, each (row,column) is a group that can detect
>> two keys in the key matrix.
>> This minimizes the overall pin counts for cost reduction.
>> However, pressing multiple keys in the same group will not be
>> detected properly.
>>
>> On some boards, like mt8183-pumpkin, double key detection is used.
>>
>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> 
> Applied patches 1 through 5 (leaving dts patches out), thank you.
> 

Applied 6 and 7 now. Thanks!

>>
>> ---
>> Changes in v2:
>> - bindings: add matrix-keymap justification in commit message (Krzysztof)
>> - bindings: switch from double-keys(boolean) to keys-per-group(uint32) (Krzysztof)
>> - driver: add a function pointer for row/column calculation (Angelo)
>> - Link to v1: https://lore.kernel.org/r/20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com
>>
>> ---
>> Fabien Parent (2):
>>        arm64: dts: mediatek: mt8183: add keyboard node
>>        arm64: dts: mediatek: mt8183-pumpkin: add keypad support
>>
>> Mattijs Korpershoek (5):
>>        MAINTAINERS: input: add mattijs for mt6779-keypad
>>        dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties
>>        dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group
>>        Input: mt6779-keypad - prepare double keys support with calc_row_col
>>        Input: mt6779-keypad - support double keys matrix
>>
>>   .../bindings/input/mediatek,mt6779-keypad.yaml     |  8 ++++-
>>   MAINTAINERS                                        |  6 ++++
>>   arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts    | 21 +++++++++++
>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi           |  9 +++++
>>   drivers/input/keyboard/mt6779-keypad.c             | 41 ++++++++++++++++++++--
>>   5 files changed, 82 insertions(+), 3 deletions(-)
>> ---
>> base-commit: 668af1b6548837b44a2bfe65dcbae6b250adbf63
>> change-id: 20220720-mt8183-keypad-20aa77106ff0
>>
>> Best regards,
>> -- 
>> Mattijs Korpershoek <mkorpershoek@baylibre.com>
> 

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

end of thread, other threads:[~2022-08-24 13:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 12:56 [PATCH v2 0/7] Input: mt6779-keypad - double keys support Mattijs Korpershoek
2022-07-26 12:56 ` [PATCH v2 1/7] MAINTAINERS: input: add mattijs for mt6779-keypad Mattijs Korpershoek
2022-07-26 12:56 ` [PATCH v2 2/7] dt-bindings: mediatek,mt6779-keypad: use unevaluatedProperties Mattijs Korpershoek
2022-07-27 10:27   ` Krzysztof Kozlowski
2022-07-26 12:56 ` [PATCH v2 3/7] dt-bindings: mediatek,mt6779-keypad: add mediatek,keys-per-group Mattijs Korpershoek
2022-07-27 10:27   ` Krzysztof Kozlowski
2022-07-26 12:56 ` [PATCH v2 4/7] Input: mt6779-keypad - prepare double keys support with calc_row_col Mattijs Korpershoek
2022-07-27  7:34   ` AngeloGioacchino Del Regno
2022-07-26 12:56 ` [PATCH v2 5/7] Input: mt6779-keypad - support double keys matrix Mattijs Korpershoek
2022-07-27  7:34   ` AngeloGioacchino Del Regno
2022-07-26 12:56 ` [PATCH v2 6/7] arm64: dts: mediatek: mt8183: add keyboard node Mattijs Korpershoek
2022-07-26 12:56 ` [PATCH v2 7/7] arm64: dts: mediatek: mt8183-pumpkin: add keypad support Mattijs Korpershoek
2022-08-10 22:53 ` [PATCH v2 0/7] Input: mt6779-keypad - double keys support Dmitry Torokhov
2022-08-24 13:55   ` Matthias Brugger

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