linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 0/5] input: pxa27x-keypad: enhancement and device tree support
@ 2013-06-18  3:56 Chao Xie
  2013-06-18  3:56 ` [PATCH V3 1/5] input: pxa27x-keypad: use matrix_keymap for matrix keyes Chao Xie
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Chao Xie @ 2013-06-18  3:56 UTC (permalink / raw)
  To: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail
  Cc: Chao Xie

The patches include 2 parts
1. use matrix_keypad for matrix keyes support
2. add device tree support for pxa27x-keypad

V2->V1:
Do not copy the members from pdata. For device tree support,
directly allocate the pdata structure.

V3->V2
add matrix_keypad changes for all boards using pxa27x-keypad
under mach-pxa.
The patch "arm: pxa: use matrix_keymap for all boards" is new.
The patch "arm: mmp: use matrix_keymap for all boards" merges
previous changes for aspenite and teton_bga.
All other patches are not modified.

Chao Xie (5):
  input: pxa27x-keypad: use matrix_keymap for matrix keyes
  arm: mmp: use matrix_keymap for all boards
  arm: pxa: use matrix_keymap for all boards
  input: pxa27x-keypad: remove the unused members at platform data
  input: pxa27x-keypad: add device tree support

 .../devicetree/bindings/input/pxa27x-keypad.txt    |   60 +++++
 arch/arm/mach-mmp/aspenite.c                       |   10 +-
 arch/arm/mach-mmp/teton_bga.c                      |   10 +-
 arch/arm/mach-pxa/em-x270.c                        |   20 +-
 arch/arm/mach-pxa/ezx.c                            |   60 +++--
 arch/arm/mach-pxa/littleton.c                      |   10 +-
 arch/arm/mach-pxa/mainstone.c                      |   10 +-
 arch/arm/mach-pxa/mioa701.c                        |   11 +-
 arch/arm/mach-pxa/palmld.c                         |   10 +-
 arch/arm/mach-pxa/palmt5.c                         |   10 +-
 arch/arm/mach-pxa/palmtreo.c                       |   23 ++-
 arch/arm/mach-pxa/palmtx.c                         |   10 +-
 arch/arm/mach-pxa/palmz72.c                        |   10 +-
 arch/arm/mach-pxa/tavorevb.c                       |   10 +-
 arch/arm/mach-pxa/z2.c                             |   10 +-
 arch/arm/mach-pxa/zylonite.c                       |   10 +-
 drivers/input/keyboard/Kconfig                     |    1 +
 drivers/input/keyboard/pxa27x_keypad.c             |  266 ++++++++++++++++++--
 include/linux/platform_data/keypad-pxa27x.h        |    3 +-
 19 files changed, 468 insertions(+), 86 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/pxa27x-keypad.txt

-- 
1.7.4.1


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

* [PATCH V3 1/5] input: pxa27x-keypad: use matrix_keymap for matrix keyes
  2013-06-18  3:56 [PATCH V3 0/5] input: pxa27x-keypad: enhancement and device tree support Chao Xie
@ 2013-06-18  3:56 ` Chao Xie
  2013-06-22 15:24   ` Mike Dunn
  2013-06-18  3:56 ` [PATCH V3 2/5] arm: mmp: use matrix_keymap for all boards Chao Xie
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Chao Xie @ 2013-06-18  3:56 UTC (permalink / raw)
  To: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail
  Cc: Chao Xie

pxa27x-keypad includes matrix keyes. Make use of matrix_keymap
for the matrix keyes.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 drivers/input/keyboard/Kconfig              |    1 +
 drivers/input/keyboard/pxa27x_keypad.c      |   36 +++++++++++++++++---------
 include/linux/platform_data/keypad-pxa27x.h |    1 +
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 37c3666..706e11b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -451,6 +451,7 @@ config KEYBOARD_OPENCORES
 config KEYBOARD_PXA27x
 	tristate "PXA27x/PXA3xx keypad support"
 	depends on PXA27x || PXA3xx || ARCH_MMP
+	select INPUT_MATRIXKMAP
 	help
 	  Enable support for PXA27x/PXA3xx keypad controller.
 
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index b674e7a..947d657 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -118,25 +118,29 @@ struct pxa27x_keypad {
 	unsigned int direct_key_mask;
 };
 
-static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
+static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
 {
 	struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
 	struct input_dev *input_dev = keypad->input_dev;
 	unsigned short keycode;
-	int i;
+	int ret, i;
+	const struct matrix_keymap_data *keymap_data =
+				pdata ? pdata->matrix_keymap_data : NULL;
 
-	for (i = 0; i < pdata->matrix_key_map_size; i++) {
-		unsigned int key = pdata->matrix_key_map[i];
-		unsigned int row = KEY_ROW(key);
-		unsigned int col = KEY_COL(key);
-		unsigned int scancode = MATRIX_SCAN_CODE(row, col,
-							 MATRIX_ROW_SHIFT);
+	ret = matrix_keypad_build_keymap(keymap_data, NULL,
+					 pdata->matrix_key_rows,
+					 pdata->matrix_key_cols,
+					 keypad->keycodes, input_dev);
+	if (ret)
+		return ret;
 
-		keycode = KEY_VAL(key);
-		keypad->keycodes[scancode] = keycode;
-		__set_bit(keycode, input_dev->keybit);
-	}
+	/*
+	 * The keycodes may not only includes matrix key but also the direct
+	 * key or rotary key.
+	 */
+	input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
 
+	/* For direct key. */
 	for (i = 0; i < pdata->direct_key_num; i++) {
 		keycode = pdata->direct_key_map[i];
 		keypad->keycodes[MAX_MATRIX_KEY_NUM + i] = keycode;
@@ -178,6 +182,8 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
 	}
 
 	__clear_bit(KEY_RESERVED, input_dev->keybit);
+
+	return 0;
 }
 
 static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad)
@@ -555,7 +561,11 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
 	input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
 	input_set_capability(input_dev, EV_MSC, MSC_SCAN);
 
-	pxa27x_keypad_build_keycode(keypad);
+	error  = pxa27x_keypad_build_keycode(keypad);
+	if (error) {
+		dev_err(&pdev->dev, "failed to build keycode\n");
+		goto failed_put_clk;
+	}
 
 	if ((pdata->enable_rotary0 && keypad->rotary_rel_code[0] != -1) ||
 	    (pdata->enable_rotary1 && keypad->rotary_rel_code[1] != -1)) {
diff --git a/include/linux/platform_data/keypad-pxa27x.h b/include/linux/platform_data/keypad-pxa27x.h
index 5ce8d5e6..0db423b 100644
--- a/include/linux/platform_data/keypad-pxa27x.h
+++ b/include/linux/platform_data/keypad-pxa27x.h
@@ -36,6 +36,7 @@
 struct pxa27x_keypad_platform_data {
 
 	/* code map for the matrix keys */
+	const struct matrix_keymap_data *matrix_keymap_data;
 	unsigned int	matrix_key_rows;
 	unsigned int	matrix_key_cols;
 	unsigned int	*matrix_key_map;
-- 
1.7.4.1


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

* [PATCH V3 2/5] arm: mmp: use matrix_keymap for all boards
  2013-06-18  3:56 [PATCH V3 0/5] input: pxa27x-keypad: enhancement and device tree support Chao Xie
  2013-06-18  3:56 ` [PATCH V3 1/5] input: pxa27x-keypad: use matrix_keymap for matrix keyes Chao Xie
@ 2013-06-18  3:56 ` Chao Xie
  2013-06-18  3:56 ` [PATCH V3 3/5] arm: pxa: " Chao Xie
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Chao Xie @ 2013-06-18  3:56 UTC (permalink / raw)
  To: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail
  Cc: Chao Xie

Compile passed for the configuration

pxa168_defconfig
  aspenite.c(MACH_ASPENITE), teton_bgs.c(MACH_TENTON_BGA)

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 arch/arm/mach-mmp/aspenite.c  |   10 +++++++---
 arch/arm/mach-mmp/teton_bga.c |   10 +++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 9f64d56..1e23346 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -205,7 +205,7 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
 	.invert_pixclock	= 0,
 };
 
-static unsigned int aspenite_matrix_key_map[] = {
+static const unsigned int aspenite_matrix_key_map[] = {
 	KEY(0, 6, KEY_UP),	/* SW 4 */
 	KEY(0, 7, KEY_DOWN),	/* SW 5 */
 	KEY(1, 6, KEY_LEFT),	/* SW 6 */
@@ -214,11 +214,15 @@ static unsigned int aspenite_matrix_key_map[] = {
 	KEY(4, 7, KEY_ESC),	/* SW 9 */
 };
 
+static struct matrix_keymap_data aspenite_matrix_keymap_data = {
+	.keymap			= aspenite_matrix_key_map,
+	.keymap_size		= ARRAY_SIZE(aspenite_matrix_key_map),
+};
+
 static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
 	.matrix_key_rows	= 5,
 	.matrix_key_cols	= 8,
-	.matrix_key_map		= aspenite_matrix_key_map,
-	.matrix_key_map_size	= ARRAY_SIZE(aspenite_matrix_key_map),
+	.matrix_keymap_data	= &aspenite_matrix_keymap_data,
 	.debounce_interval	= 30,
 };
 
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
index 8609967..2021769 100644
--- a/arch/arm/mach-mmp/teton_bga.c
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -49,18 +49,22 @@ static unsigned long teton_bga_pin_config[] __initdata = {
 	GPIO78_GPIO,
 };
 
-static unsigned int teton_bga_matrix_key_map[] = {
+static const unsigned int teton_bga_matrix_key_map[] = {
 	KEY(0, 6, KEY_ESC),
 	KEY(0, 7, KEY_ENTER),
 	KEY(1, 6, KEY_LEFT),
 	KEY(1, 7, KEY_RIGHT),
 };
 
+static struct matrix_keymap_data teton_bga_matrix_keymap_data = {
+	.keymap			= teton_bga_matrix_key_map,
+	.keymap_size		= ARRAY_SIZE(teton_bga_matrix_key_map),
+};
+
 static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
 	.matrix_key_rows        = 2,
 	.matrix_key_cols        = 8,
-	.matrix_key_map         = teton_bga_matrix_key_map,
-	.matrix_key_map_size    = ARRAY_SIZE(teton_bga_matrix_key_map),
+	.matrix_keymap_data	= &teton_bga_matrix_keymap_data,
 	.debounce_interval      = 30,
 };
 
-- 
1.7.4.1


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

* [PATCH V3 3/5] arm: pxa: use matrix_keymap for all boards
  2013-06-18  3:56 [PATCH V3 0/5] input: pxa27x-keypad: enhancement and device tree support Chao Xie
  2013-06-18  3:56 ` [PATCH V3 1/5] input: pxa27x-keypad: use matrix_keymap for matrix keyes Chao Xie
  2013-06-18  3:56 ` [PATCH V3 2/5] arm: mmp: use matrix_keymap for all boards Chao Xie
@ 2013-06-18  3:56 ` Chao Xie
  2013-06-18 14:02   ` Arnd Bergmann
  2013-06-22 15:26   ` Mike Dunn
  2013-06-18  3:56 ` [PATCH V3 4/5] input: pxa27x-keypad: remove the unused members at platform data Chao Xie
  2013-06-18  3:56 ` [PATCH V3 5/5] input: pxa27x-keypad: add device tree support Chao Xie
  4 siblings, 2 replies; 15+ messages in thread
From: Chao Xie @ 2013-06-18  3:56 UTC (permalink / raw)
  To: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail
  Cc: Chao Xie

Compile passed for configurations

em_x270_defconfig
  em_x270x.c(MACH_EM_X270, MACH_EXEDA)

ezx_defconfig
  ezx.c(MACH_EZX_A780, MACH_EZX_E680, MACH_EZX_A1200,
        MACH_EZX_A910, MACH_EZX_E6, MACH_EZX_E2)

palmz72_defconfig
  palmld.c(MACH_PALMLD), palmtreo.c(PALM_TREO),
  palmtx.c(MACH_PALMTX), palmz72.c(MACH_PALMZ72),
  palmt5.c(MACH_PALMT5)

pxa3xx_defconfig
  littleton.c(MACH_LITTLETON), tarvorevb.c(MACH_TAVOREVB),
  zylonite.c(MACH_ZYLONITE320), mioa701.c(MACH_MIOA701),
  z2.c(MACH_ZIPIT2)

mainstone_defconfig
  maintone.c(MACH_MAINSTONE)

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 arch/arm/mach-pxa/em-x270.c   |   20 +++++++++----
 arch/arm/mach-pxa/ezx.c       |   60 ++++++++++++++++++++++++++++------------
 arch/arm/mach-pxa/littleton.c |   10 +++++--
 arch/arm/mach-pxa/mainstone.c |   10 +++++--
 arch/arm/mach-pxa/mioa701.c   |   11 +++++--
 arch/arm/mach-pxa/palmld.c    |   10 +++++--
 arch/arm/mach-pxa/palmt5.c    |   10 +++++--
 arch/arm/mach-pxa/palmtreo.c  |   23 ++++++++++-----
 arch/arm/mach-pxa/palmtx.c    |   10 +++++--
 arch/arm/mach-pxa/palmz72.c   |   10 +++++--
 arch/arm/mach-pxa/tavorevb.c  |   10 +++++--
 arch/arm/mach-pxa/z2.c        |   10 +++++--
 arch/arm/mach-pxa/zylonite.c  |   10 +++++--
 13 files changed, 142 insertions(+), 62 deletions(-)

diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 446563a..f6726bb 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -833,21 +833,25 @@ static inline void em_x270_init_ac97(void) {}
 #endif
 
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int em_x270_module_matrix_keys[] = {
+static const unsigned int em_x270_module_matrix_keys[] = {
 	KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
 	KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
 	KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
 };
 
+static struct matrix_keymap_data em_x270_matrix_keymap_data = {
+	.keymap			= em_x270_module_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(em_x270_module_matrix_keys),
+};
+
 struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
 	/* code map for the matrix keys */
 	.matrix_key_rows	= 3,
 	.matrix_key_cols	= 3,
-	.matrix_key_map		= em_x270_module_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(em_x270_module_matrix_keys),
+	.matrix_keymap_data	= &em_x270_matrix_keymap_data,
 };
 
-static unsigned int em_x270_exeda_matrix_keys[] = {
+static const unsigned int em_x270_exeda_matrix_keys[] = {
 	KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
 	KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
 	KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
@@ -889,12 +893,16 @@ static unsigned int em_x270_exeda_matrix_keys[] = {
 	KEY(7, 6, 0), KEY(7, 7, 0),
 };
 
+static struct matrix_keymap_data em_x270_exeda_matrix_keymap_data = {
+	.keymap			= em_x270_exeda_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(em_x270_exeda_matrix_keys),
+};
+
 struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
 	/* code map for the matrix keys */
 	.matrix_key_rows	= 8,
 	.matrix_key_cols	= 8,
-	.matrix_key_map		= em_x270_exeda_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(em_x270_exeda_matrix_keys),
+	.matrix_keymap_data	= &em_x270_exeda_matrix_keymap_data,
 };
 
 static void __init em_x270_init_keypad(void)
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index dca1070..fe2eb83 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -392,7 +392,7 @@ static unsigned long e6_pin_config[] __initdata = {
 
 /* KEYPAD */
 #ifdef CONFIG_MACH_EZX_A780
-static unsigned int a780_key_map[] = {
+static const unsigned int a780_key_map[] = {
 	KEY(0, 0, KEY_SEND),
 	KEY(0, 1, KEY_BACK),
 	KEY(0, 2, KEY_END),
@@ -424,11 +424,15 @@ static unsigned int a780_key_map[] = {
 	KEY(4, 4, KEY_DOWN),
 };
 
+static struct matrix_keymap_data a780_matrix_keymap_data = {
+	.keymap			= a780_key_map,
+	.keymap_size		= ARRAY_SIZE(a780_key_map),
+};
+
 static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
 	.matrix_key_rows = 5,
 	.matrix_key_cols = 5,
-	.matrix_key_map = a780_key_map,
-	.matrix_key_map_size = ARRAY_SIZE(a780_key_map),
+	.matrix_keymap_data = &a780_matrix_keymap_data,
 
 	.direct_key_map = { KEY_CAMERA },
 	.direct_key_num = 1,
@@ -438,7 +442,7 @@ static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
 #endif /* CONFIG_MACH_EZX_A780 */
 
 #ifdef CONFIG_MACH_EZX_E680
-static unsigned int e680_key_map[] = {
+static const unsigned int e680_key_map[] = {
 	KEY(0, 0, KEY_UP),
 	KEY(0, 1, KEY_RIGHT),
 	KEY(0, 2, KEY_RESERVED),
@@ -455,11 +459,15 @@ static unsigned int e680_key_map[] = {
 	KEY(2, 3, KEY_KPENTER),
 };
 
+static struct matrix_keymap_data e680_matrix_keymap_data = {
+	.keymap			= e680_key_map,
+	.keymap_size		= ARRAY_SIZE(e680_key_map),
+};
+
 static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
 	.matrix_key_rows = 3,
 	.matrix_key_cols = 4,
-	.matrix_key_map = e680_key_map,
-	.matrix_key_map_size = ARRAY_SIZE(e680_key_map),
+	.matrix_keymap_data = &e680_matrix_keymap_data,
 
 	.direct_key_map = {
 		KEY_CAMERA,
@@ -476,7 +484,7 @@ static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
 #endif /* CONFIG_MACH_EZX_E680 */
 
 #ifdef CONFIG_MACH_EZX_A1200
-static unsigned int a1200_key_map[] = {
+static const unsigned int a1200_key_map[] = {
 	KEY(0, 0, KEY_RESERVED),
 	KEY(0, 1, KEY_RIGHT),
 	KEY(0, 2, KEY_PAGEDOWN),
@@ -513,18 +521,22 @@ static unsigned int a1200_key_map[] = {
 	KEY(4, 5, KEY_RESERVED),
 };
 
+static struct matrix_keymap_data a1200_matrix_keymap_data = {
+	.keymap			= a1200_key_map,
+	.keymap_size		= ARRAY_SIZE(a1200_key_map),
+};
+
 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
 	.matrix_key_rows = 5,
 	.matrix_key_cols = 6,
-	.matrix_key_map = a1200_key_map,
-	.matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
+	.matrix_keymap_data = &a1200_matrix_keymap_data,
 
 	.debounce_interval = 30,
 };
 #endif /* CONFIG_MACH_EZX_A1200 */
 
 #ifdef CONFIG_MACH_EZX_E6
-static unsigned int e6_key_map[] = {
+static const unsigned int e6_key_map[] = {
 	KEY(0, 0, KEY_RESERVED),
 	KEY(0, 1, KEY_RIGHT),
 	KEY(0, 2, KEY_PAGEDOWN),
@@ -561,18 +573,22 @@ static unsigned int e6_key_map[] = {
 	KEY(4, 5, KEY_PREVIOUSSONG),
 };
 
+static struct matrix_keymap_data e6_keymap_data = {
+	.keymap			= e6_key_map,
+	.keymap_size		= ARRAY_SIZE(e6_key_map),
+};
+
 static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
 	.matrix_key_rows = 5,
 	.matrix_key_cols = 6,
-	.matrix_key_map = e6_key_map,
-	.matrix_key_map_size = ARRAY_SIZE(e6_key_map),
+	.matrix_keymap_data = &e6_keymap_data,
 
 	.debounce_interval = 30,
 };
 #endif /* CONFIG_MACH_EZX_E6 */
 
 #ifdef CONFIG_MACH_EZX_A910
-static unsigned int a910_key_map[] = {
+static const unsigned int a910_key_map[] = {
 	KEY(0, 0, KEY_NUMERIC_6),
 	KEY(0, 1, KEY_RIGHT),
 	KEY(0, 2, KEY_PAGEDOWN),
@@ -609,18 +625,22 @@ static unsigned int a910_key_map[] = {
 	KEY(4, 5, KEY_RESERVED),
 };
 
+static struct matrix_keymap_data a910_matrix_keymap_data = {
+	.keymap			= a910_key_map,
+	.keymap_size		= ARRAY_SIZE(a910_key_map),
+};
+
 static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
 	.matrix_key_rows = 5,
 	.matrix_key_cols = 6,
-	.matrix_key_map = a910_key_map,
-	.matrix_key_map_size = ARRAY_SIZE(a910_key_map),
+	.matrix_keymap_data = &a910_matrix_keymap_data,
 
 	.debounce_interval = 30,
 };
 #endif /* CONFIG_MACH_EZX_A910 */
 
 #ifdef CONFIG_MACH_EZX_E2
-static unsigned int e2_key_map[] = {
+static const unsigned int e2_key_map[] = {
 	KEY(0, 0, KEY_NUMERIC_6),
 	KEY(0, 1, KEY_RIGHT),
 	KEY(0, 2, KEY_NUMERIC_9),
@@ -657,11 +677,15 @@ static unsigned int e2_key_map[] = {
 	KEY(4, 5, KEY_RESERVED),
 };
 
+static struct matrix_keymap_data e2_matrix_keymap_data = {
+	.keymap			= e2_key_map,
+	.keymap_size		= ARRAY_SIZE(e2_key_map),
+};
+
 static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
 	.matrix_key_rows = 5,
 	.matrix_key_cols = 6,
-	.matrix_key_map = e2_key_map,
-	.matrix_key_map_size = ARRAY_SIZE(e2_key_map),
+	.matrix_keymap_data = &e2_matrix_keymap_data,
 
 	.debounce_interval = 30,
 };
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index e848c46..5d66558 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -222,7 +222,7 @@ static inline void littleton_init_spi(void) {}
 #endif
 
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int littleton_matrix_key_map[] = {
+static const unsigned int littleton_matrix_key_map[] = {
 	/* KEY(row, col, key_code) */
 	KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
 	KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
@@ -249,11 +249,15 @@ static unsigned int littleton_matrix_key_map[] = {
 	KEY(3, 1, KEY_F23),	/* soft2 */
 };
 
+static struct matrix_keymap_data littleton_matrix_keymap_data = {
+	.keymap			= littleton_matrix_key_map,
+	.keymap_size		= ARRAY_SIZE(littleton_matrix_key_map),
+};
+
 static struct pxa27x_keypad_platform_data littleton_keypad_info = {
 	.matrix_key_rows	= 6,
 	.matrix_key_cols	= 5,
-	.matrix_key_map		= littleton_matrix_key_map,
-	.matrix_key_map_size	= ARRAY_SIZE(littleton_matrix_key_map),
+	.matrix_keymap_data	= &littleton_matrix_keymap_data,
 
 	.enable_rotary0		= 1,
 	.rotary0_up_key		= KEY_UP,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 7a12c1b..d2c6523 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -498,7 +498,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = {
 };
 
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int mainstone_matrix_keys[] = {
+static const unsigned int mainstone_matrix_keys[] = {
 	KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C),
 	KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F),
 	KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I),
@@ -527,11 +527,15 @@ static unsigned int mainstone_matrix_keys[] = {
 	KEY(4, 6, KEY_SELECT),
 };
 
+static struct matrix_keymap_data mainstone_matrix_keymap_data = {
+	.keymap			= mainstone_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(mainstone_matrix_keys),
+};
+
 struct pxa27x_keypad_platform_data mainstone_keypad_info = {
 	.matrix_key_rows	= 6,
 	.matrix_key_cols	= 7,
-	.matrix_key_map		= mainstone_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(mainstone_matrix_keys),
+	.matrix_keymap_data	= &mainstone_matrix_keymap_data,
 
 	.enable_rotary0		= 1,
 	.rotary0_up_key		= KEY_UP,
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index f8979b9..654b0ac 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -222,7 +222,7 @@ static struct pxafb_mach_info mioa701_pxafb_info = {
 /*
  * Keyboard configuration
  */
-static unsigned int mioa701_matrix_keys[] = {
+static const unsigned int mioa701_matrix_keys[] = {
 	KEY(0, 0, KEY_UP),
 	KEY(0, 1, KEY_RIGHT),
 	KEY(0, 2, KEY_MEDIA),
@@ -233,11 +233,16 @@ static unsigned int mioa701_matrix_keys[] = {
 	KEY(2, 1, KEY_PHONE),	/* Phone Green key */
 	KEY(2, 2, KEY_CAMERA)	/* Camera key */
 };
+
+static struct matrix_keymap_data mioa701_matrix_keymap_data = {
+	.keymap			= mioa701_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(mioa701_matrix_keys),
+};
+
 static struct pxa27x_keypad_platform_data mioa701_keypad_info = {
 	.matrix_key_rows = 3,
 	.matrix_key_cols = 3,
-	.matrix_key_map = mioa701_matrix_keys,
-	.matrix_key_map_size = ARRAY_SIZE(mioa701_matrix_keys),
+	.matrix_keymap_data = &mioa701_matrix_keymap_data,
 };
 
 /*
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 909b713..cf210b1 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -173,7 +173,7 @@ static inline void palmld_nor_init(void) {}
  * GPIO keyboard
  ******************************************************************************/
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int palmld_matrix_keys[] = {
+static const unsigned int palmld_matrix_keys[] = {
 	KEY(0, 1, KEY_F2),
 	KEY(0, 2, KEY_UP),
 
@@ -190,11 +190,15 @@ static unsigned int palmld_matrix_keys[] = {
 	KEY(3, 2, KEY_LEFT),
 };
 
+static struct matrix_keymap_data palmld_matrix_keymap_data = {
+	.keymap			= palmld_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(palmld_matrix_keys),
+};
+
 static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
 	.matrix_key_rows	= 4,
 	.matrix_key_cols	= 3,
-	.matrix_key_map		= palmld_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(palmld_matrix_keys),
+	.matrix_keymap_data	= &palmld_matrix_keymap_data,
 
 	.debounce_interval	= 30,
 };
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 5033fd0..3ed9b02 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -108,7 +108,7 @@ static unsigned long palmt5_pin_config[] __initdata = {
  * GPIO keyboard
  ******************************************************************************/
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int palmt5_matrix_keys[] = {
+static const unsigned int palmt5_matrix_keys[] = {
 	KEY(0, 0, KEY_POWER),
 	KEY(0, 1, KEY_F1),
 	KEY(0, 2, KEY_ENTER),
@@ -124,11 +124,15 @@ static unsigned int palmt5_matrix_keys[] = {
 	KEY(3, 2, KEY_LEFT),
 };
 
+static struct matrix_keymap_data palmt5_matrix_keymap_data = {
+	.keymap			= palmt5_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(palmt5_matrix_keys),
+};
+
 static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
 	.matrix_key_rows	= 4,
 	.matrix_key_cols	= 3,
-	.matrix_key_map		= palmt5_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(palmt5_matrix_keys),
+	.matrix_keymap_data	= &palmt5_matrix_keymap_data,
 
 	.debounce_interval	= 30,
 };
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index d82a50b..d8b937c 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -168,7 +168,7 @@ static unsigned long centro685_pin_config[] __initdata = {
  * GPIO keyboard
  ******************************************************************************/
 #if IS_ENABLED(CONFIG_KEYBOARD_PXA27x)
-static unsigned int treo680_matrix_keys[] = {
+static const unsigned int treo680_matrix_keys[] = {
 	KEY(0, 0, KEY_F8),		/* Red/Off/Power */
 	KEY(0, 1, KEY_LEFT),
 	KEY(0, 2, KEY_LEFTCTRL),	/* Alternate */
@@ -227,7 +227,7 @@ static unsigned int treo680_matrix_keys[] = {
 	KEY(7, 5, KEY_I),
 };
 
-static unsigned int centro_matrix_keys[] = {
+static const unsigned int centro_matrix_keys[] = {
 	KEY(0, 0, KEY_F9),		/* Home */
 	KEY(0, 1, KEY_LEFT),
 	KEY(0, 2, KEY_LEFTCTRL),	/* Alternate */
@@ -286,11 +286,20 @@ static unsigned int centro_matrix_keys[] = {
 	KEY(7, 5, KEY_I),
 };
 
+static struct matrix_keymap_data treo680_matrix_keymap_data = {
+	.keymap			= treo680_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(treo680_matrix_keys),
+};
+
+static struct matrix_keymap_data centro_matrix_keymap_data = {
+	.keymap			= centro_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(centro_matrix_keys),
+};
+
 static struct pxa27x_keypad_platform_data treo680_keypad_pdata = {
 	.matrix_key_rows	= 8,
 	.matrix_key_cols	= 7,
-	.matrix_key_map		= treo680_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(treo680_matrix_keys),
+	.matrix_keymap_data	= &treo680_matrix_keymap_data,
 	.direct_key_map		= { KEY_CONNECT },
 	.direct_key_num		= 1,
 
@@ -301,10 +310,8 @@ static void __init palmtreo_kpc_init(void)
 {
 	static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata;
 
-	if (machine_is_centro()) {
-		data->matrix_key_map = centro_matrix_keys;
-		data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys);
-	}
+	if (machine_is_centro())
+		data->matrix_keymap_data = &centro_matrix_keymap_data;
 
 	pxa_set_keypad_info(&treo680_keypad_pdata);
 }
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 627c93a..83f830d 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -176,7 +176,7 @@ static inline void palmtx_nor_init(void) {}
  * GPIO keyboard
  ******************************************************************************/
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int palmtx_matrix_keys[] = {
+static const unsigned int palmtx_matrix_keys[] = {
 	KEY(0, 0, KEY_POWER),
 	KEY(0, 1, KEY_F1),
 	KEY(0, 2, KEY_ENTER),
@@ -192,11 +192,15 @@ static unsigned int palmtx_matrix_keys[] = {
 	KEY(3, 2, KEY_LEFT),
 };
 
+static struct matrix_keymap_data palmtx_matrix_keymap_data = {
+	.keymap			= palmtx_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(palmtx_matrix_keys),
+};
+
 static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
 	.matrix_key_rows	= 4,
 	.matrix_key_cols	= 3,
-	.matrix_key_map		= palmtx_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(palmtx_matrix_keys),
+	.matrix_keymap_data	= &palmtx_matrix_keymap_data,
 
 	.debounce_interval	= 30,
 };
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 18b7fcd..1a35ddf 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -140,7 +140,7 @@ static unsigned long palmz72_pin_config[] __initdata = {
  * GPIO keyboard
  ******************************************************************************/
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int palmz72_matrix_keys[] = {
+static const unsigned int palmz72_matrix_keys[] = {
 	KEY(0, 0, KEY_POWER),
 	KEY(0, 1, KEY_F1),
 	KEY(0, 2, KEY_ENTER),
@@ -156,11 +156,15 @@ static unsigned int palmz72_matrix_keys[] = {
 	KEY(3, 2, KEY_LEFT),
 };
 
+static struct matrix_keymap_data almz72_matrix_keymap_data = {
+	.keymap			= palmz72_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(palmz72_matrix_keys),
+};
+
 static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
 	.matrix_key_rows	= 4,
 	.matrix_key_cols	= 3,
-	.matrix_key_map		= palmz72_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(palmz72_matrix_keys),
+	.matrix_keymap_data	= &almz72_matrix_keymap_data,
 
 	.debounce_interval	= 30,
 };
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index f55979c..4680efe 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -106,7 +106,7 @@ static struct platform_device smc91x_device = {
 };
 
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int tavorevb_matrix_key_map[] = {
+static const unsigned int tavorevb_matrix_key_map[] = {
 	/* KEY(row, col, key_code) */
 	KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C),
 	KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G),
@@ -147,11 +147,15 @@ static unsigned int tavorevb_matrix_key_map[] = {
 	KEY(3, 3, KEY_F23),	/* soft2 */
 };
 
+static struct matrix_keymap_data tavorevb_matrix_keymap_data = {
+	.keymap		= tavorevb_matrix_key_map,
+	.keymap_size	= ARRAY_SIZE(tavorevb_matrix_key_map),
+};
+
 static struct pxa27x_keypad_platform_data tavorevb_keypad_info = {
 	.matrix_key_rows	= 7,
 	.matrix_key_cols	= 7,
-	.matrix_key_map		= tavorevb_matrix_key_map,
-	.matrix_key_map_size	= ARRAY_SIZE(tavorevb_matrix_key_map),
+	.matrix_keymap_data	= &tavorevb_matrix_keymap_data,
 	.debounce_interval	= 30,
 };
 
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index 989903a..2513d8f 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -345,7 +345,7 @@ static inline void z2_leds_init(void) {}
  * GPIO keyboard
  ******************************************************************************/
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int z2_matrix_keys[] = {
+static const unsigned int z2_matrix_keys[] = {
 	KEY(0, 0, KEY_OPTION),
 	KEY(1, 0, KEY_UP),
 	KEY(2, 0, KEY_DOWN),
@@ -405,11 +405,15 @@ static unsigned int z2_matrix_keys[] = {
 	KEY(5, 7, KEY_DOT),
 };
 
+static struct matrix_keymap_data z2_matrix_keymap_data = {
+	.keymap			= z2_matrix_keys,
+	.keymap_size		= ARRAY_SIZE(z2_matrix_keys),
+};
+
 static struct pxa27x_keypad_platform_data z2_keypad_platform_data = {
 	.matrix_key_rows	= 7,
 	.matrix_key_cols	= 8,
-	.matrix_key_map		= z2_matrix_keys,
-	.matrix_key_map_size	= ARRAY_SIZE(z2_matrix_keys),
+	.matrix_keymap_data	= &z2_matrix_keymap_data,
 
 	.debounce_interval	= 30,
 };
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 1f00d65..36cf7cf 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -263,7 +263,7 @@ static inline void zylonite_init_mmc(void) {}
 #endif
 
 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static unsigned int zylonite_matrix_key_map[] = {
+static const unsigned int zylonite_matrix_key_map[] = {
 	/* KEY(row, col, key_code) */
 	KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
 	KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
@@ -306,11 +306,15 @@ static unsigned int zylonite_matrix_key_map[] = {
 	KEY(0, 3, KEY_AUX),	/* contact */
 };
 
+static struct matrix_keymap_data zylonite_matrix_keymap_data = {
+	.keymap			= zylonite_matrix_key_map,
+	.keymap_size		= ARRAY_SIZE(zylonite_matrix_key_map),
+};
+
 static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
 	.matrix_key_rows	= 8,
 	.matrix_key_cols	= 8,
-	.matrix_key_map		= zylonite_matrix_key_map,
-	.matrix_key_map_size	= ARRAY_SIZE(zylonite_matrix_key_map),
+	.matrix_keymap_data	= &zylonite_matrix_keymap_data,
 
 	.enable_rotary0		= 1,
 	.rotary0_up_key		= KEY_UP,
-- 
1.7.4.1


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

* [PATCH V3 4/5] input: pxa27x-keypad: remove the unused members at platform data
  2013-06-18  3:56 [PATCH V3 0/5] input: pxa27x-keypad: enhancement and device tree support Chao Xie
                   ` (2 preceding siblings ...)
  2013-06-18  3:56 ` [PATCH V3 3/5] arm: pxa: " Chao Xie
@ 2013-06-18  3:56 ` Chao Xie
  2013-06-18  3:56 ` [PATCH V3 5/5] input: pxa27x-keypad: add device tree support Chao Xie
  4 siblings, 0 replies; 15+ messages in thread
From: Chao Xie @ 2013-06-18  3:56 UTC (permalink / raw)
  To: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail
  Cc: Chao Xie

Now pxa27x-keypad make use matrix_keymap for matrix keyes, so
remove the unused members in platform data.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 include/linux/platform_data/keypad-pxa27x.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/linux/platform_data/keypad-pxa27x.h b/include/linux/platform_data/keypad-pxa27x.h
index 0db423b..2462556 100644
--- a/include/linux/platform_data/keypad-pxa27x.h
+++ b/include/linux/platform_data/keypad-pxa27x.h
@@ -39,8 +39,6 @@ struct pxa27x_keypad_platform_data {
 	const struct matrix_keymap_data *matrix_keymap_data;
 	unsigned int	matrix_key_rows;
 	unsigned int	matrix_key_cols;
-	unsigned int	*matrix_key_map;
-	int		matrix_key_map_size;
 
 	/* direct keys */
 	int		direct_key_num;
-- 
1.7.4.1


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

* [PATCH V3 5/5] input: pxa27x-keypad: add device tree support
  2013-06-18  3:56 [PATCH V3 0/5] input: pxa27x-keypad: enhancement and device tree support Chao Xie
                   ` (3 preceding siblings ...)
  2013-06-18  3:56 ` [PATCH V3 4/5] input: pxa27x-keypad: remove the unused members at platform data Chao Xie
@ 2013-06-18  3:56 ` Chao Xie
  2013-06-19  8:22   ` Marek Vasut
  4 siblings, 1 reply; 15+ messages in thread
From: Chao Xie @ 2013-06-18  3:56 UTC (permalink / raw)
  To: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail
  Cc: Chao Xie

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 .../devicetree/bindings/input/pxa27x-keypad.txt    |   60 +++++
 drivers/input/keyboard/pxa27x_keypad.c             |  232 +++++++++++++++++++-
 2 files changed, 288 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/pxa27x-keypad.txt

diff --git a/Documentation/devicetree/bindings/input/pxa27x-keypad.txt b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
new file mode 100644
index 0000000..f8674f7
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
@@ -0,0 +1,60 @@
+* Marvell PXA Keypad controller
+
+Required Properties
+- compatible : should be "marvell,pxa27x-keypad"
+- reg : Address and length of the register set for the device
+- interrupts : The interrupt for the keypad controller
+- marvell,debounce-interval : How long time the key will be
+  recognized when it is pressed. It is a u32 value, and bit[31:16]
+  is debounce interval for direct key and bit[15:0] is debounce
+  interval for matrix key. The value is in binary number of 2ms
+
+Optional Properties For Matrix Keyes
+Please refer to matrix-keymap.txt
+
+Optional Properties for Direct Keyes
+- marvell,direct-key-count : How many direct keyes are used.
+- marvell,direct-key-mask : The mask indicates which keyes
+  are used. If bit[X] of the mask is set, the direct key X
+  is used.
+- marvell,direct-key-low-active : Direct key status register
+  tells the level of pins that connects to the direct keyes.
+  When this property is set, it means that when the pin level
+  is low, the key is pressed(active).
+- marvell,direct-key-map : It is a u16 array. Each item indicates
+  the linux key-code for the direct key.
+
+Optional Properties For Rotary
+- marvell,rotary0 : It is a u32 value. Bit[31:16] is the
+  linux key-code for rotary up. Bit[15:0] is the linux key-code
+  for rotary down. It is for rotary 0.
+- marvell,rotary1 : Same as marvell,rotary0. It is for rotary 1.
+- marvell,rotary-rel-key : When rotary is used for relative axes
+  in the device, the value indicates the key-code for relative
+  axes measurement in the device. It is a u32 value. Bit[31:16]
+  is for rotary 1, and Bit[15:0] is for rotary 0.
+
+Examples:
+	keypad: keypad@d4012000 {
+		keypad,num-rows = <3>;
+		keypad,num-columns = <5>;
+		linux,keymap = <0x0000000e	/* KEY_BACKSPACE */
+				0x0001006b	/* KEY_END */
+				0x00020061	/* KEY_RIGHTCTRL */
+				0x0003000b	/* KEY_0 */
+				0x00040002	/* KEY_1 */
+				0x0100008b	/* KEY_MENU */
+				0x01010066	/* KEY_HOME */
+				0x010200e7	/* KEY_SEND */
+				0x01030009	/* KEY_8 */
+				0x0104000a	/* KEY_9 */
+				0x02000160	/* KEY_OK */
+				0x02010003	/* KEY_2 */
+				0x02020004	/* KEY_3 */
+				0x02030005	/* KEY_4 */
+				0x02040006>;	/* KEY_5 */
+		marvell,rotary0 = <0x006c0067>;	/* KEY_UP & KEY_DOWN */
+		marvell,direct-key-count = <1>;
+		marvell,direct-key-map = <0x001c>;
+		marvell,debounce-interval = <0x001e001e>;
+	};
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 947d657..16cf9a5 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -118,6 +118,217 @@ struct pxa27x_keypad {
 	unsigned int direct_key_mask;
 };
 
+static int pxa27x_keypad_matrix_key_parse_dt(struct pxa27x_keypad *keypad)
+{
+	int ret;
+	u32 rows, cols;
+	struct input_dev *input_dev = keypad->input_dev;
+	struct device *dev = input_dev->dev.parent;
+	struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
+
+	ret = matrix_keypad_parse_of_params(dev, &rows, &cols);
+	if (ret)
+		return ret;
+
+	if (rows > MAX_MATRIX_KEY_ROWS || cols > MAX_MATRIX_KEY_COLS) {
+		dev_err(dev, "rows or cols exceeds maximum value\n");
+		return -EINVAL;
+	}
+
+	pdata->matrix_key_rows = rows;
+	pdata->matrix_key_cols = cols;
+
+	ret = matrix_keypad_build_keymap(NULL, NULL,
+					 pdata->matrix_key_rows,
+					 pdata->matrix_key_cols,
+					 keypad->keycodes, input_dev);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int pxa27x_keypad_direct_key_parse_dt(struct pxa27x_keypad *keypad)
+{
+	const __be16 *prop;
+	unsigned short code;
+	int i, ret;
+	unsigned int proplen, size;
+	struct input_dev *input_dev = keypad->input_dev;
+	struct device *dev = input_dev->dev.parent;
+	struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
+	struct device_node *np = dev->of_node;
+
+	ret = of_property_read_u32(np, "marvell,direct-key-count",
+				   &pdata->direct_key_num);
+	if (ret) {
+		/*
+		 * If do not have marvel,direct-key-count defined,
+		 * it means direct key is not supported.
+		 */
+		if (ret == -EINVAL)
+			return 0;
+		return ret;
+	}
+	ret = of_property_read_u32(np, "marvell,direct-key-mask",
+				   &pdata->direct_key_mask);
+	if (ret && ret != -EINVAL)
+		return ret;
+	/*
+	 * If marvell,direct-key-mask is not defined, driver will use
+	 * default value. Default value is set when configure the keypad.
+	 */
+	else if (ret == -EINVAL)
+		pdata->direct_key_mask = 0;
+
+	pdata->direct_key_low_active = of_property_read_bool(np,
+					"marvell,direct-key-low-active");
+
+	prop = of_get_property(np, "marvell,direct-key-map", &proplen);
+	if (!prop)
+		return -EINVAL;
+
+	if (proplen % sizeof(u16))
+		return -EINVAL;
+
+	size = proplen / sizeof(u16);
+
+	/* Only MAX_DIRECT_KEY_NUM is accepted.*/
+	if (size > MAX_DIRECT_KEY_NUM)
+		return -EINVAL;
+
+	for (i = 0; i < size; i++) {
+		code = be16_to_cpup(prop + i);
+		keypad->keycodes[MAX_MATRIX_KEY_NUM + i] = code;
+		__set_bit(code, input_dev->keybit);
+	}
+
+	return 0;
+}
+
+static int pxa27x_keypad_rotary_parse_dt(struct pxa27x_keypad *keypad)
+{
+	const __be32 *prop;
+	int i, relkey_ret;
+	unsigned int code, proplen;
+	const char *rotaryname[2] = {
+			"marvell,rotary0", "marvell,rotary1"};
+	const char relkeyname[] = {"marvell,rotary-rel-key"};
+	struct input_dev *input_dev = keypad->input_dev;
+	struct device *dev = input_dev->dev.parent;
+	struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
+	struct device_node *np = dev->of_node;
+
+	relkey_ret = of_property_read_u32(np, relkeyname, &code);
+	/* if can read correct rotary key-code, we do not need this. */
+	if (relkey_ret == 0) {
+		unsigned short relcode;
+
+		/* rotary0 taks lower half, rotary1 taks upper half. */
+		relcode = code & 0xffff;
+		pdata->rotary0_rel_code = (code & 0xffff);
+		__set_bit(relcode, input_dev->relbit);
+
+		relcode = code >> 16;
+		pdata->rotary1_rel_code = relcode;
+		__set_bit(relcode, input_dev->relbit);
+	}
+
+	for (i = 0; i < 2; i++) {
+		prop = of_get_property(np, rotaryname[i], &proplen);
+		/*
+		 * If the prop is not set, it means keypad does not need
+		 * initialize the rotaryX.
+		 */
+		if (!prop)
+			continue;
+
+		code = be32_to_cpup(prop);
+		/*
+		 * Not all up/down key code are valid.
+		 * Now we depends on direct-rel-code.
+		 */
+		if ((!(code & 0xffff) || !(code >> 16)) && relkey_ret) {
+			return relkey_ret;
+		} else {
+			unsigned int n = MAX_MATRIX_KEY_NUM + (i << 1);
+			unsigned short keycode;
+
+			keycode = code & 0xffff;
+			keypad->keycodes[n] = keycode;
+			__set_bit(keycode, input_dev->keybit);
+
+			keycode = code >> 16;
+			keypad->keycodes[n + 1] = keycode;
+			__set_bit(keycode, input_dev->keybit);
+
+			if (i == 0)
+				pdata->rotary0_rel_code = -1;
+			else
+				pdata->rotary1_rel_code = -1;
+		}
+		if (i == 0)
+			pdata->enable_rotary0 = 1;
+		else
+			pdata->enable_rotary1 = 1;
+	}
+
+	keypad->rotary_rel_code[0] = pdata->rotary0_rel_code;
+	keypad->rotary_rel_code[1] = pdata->rotary1_rel_code;
+
+	return 0;
+}
+
+static int pxa27x_keypad_build_keycode_from_dt(struct pxa27x_keypad *keypad)
+{
+	int ret;
+	struct input_dev *input_dev = keypad->input_dev;
+	struct device *dev = input_dev->dev.parent;
+	struct device_node *np = dev->of_node;
+
+	if (!keypad->pdata) {
+		keypad->pdata = devm_kzalloc(dev, sizeof(*keypad->pdata),
+					     GFP_KERNEL);
+		if (!keypad->pdata) {
+			dev_err(dev, "failed to allocate memory for pdata\n");
+			return -ENOMEM;
+		}
+	}
+
+	ret = pxa27x_keypad_matrix_key_parse_dt(keypad);
+	if (ret) {
+		dev_err(dev, "failed to parse matrix key\n");
+		return ret;
+	}
+
+	ret = pxa27x_keypad_direct_key_parse_dt(keypad);
+	if (ret) {
+		dev_err(dev, "failed to parse direct key\n");
+		return ret;
+	}
+
+	ret = pxa27x_keypad_rotary_parse_dt(keypad);
+	if (ret) {
+		dev_err(dev, "failed to parse rotary key\n");
+		return ret;
+	}
+
+	ret = of_property_read_u32(np, "marvell,debounce-interval",
+				   &keypad->pdata->debounce_interval);
+	if (ret) {
+		dev_err(dev, "failed to parse debpunce-interval\n");
+		return ret;
+	}
+
+	/*
+	 * The keycodes may not only includes matrix key but also the direct
+	 * key or rotary key.
+	 */
+	input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
+
+	return 0;
+}
+
 static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
 {
 	struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
@@ -491,15 +702,15 @@ static const struct dev_pm_ops pxa27x_keypad_pm_ops = {
 static int pxa27x_keypad_probe(struct platform_device *pdev)
 {
 	struct pxa27x_keypad_platform_data *pdata = pdev->dev.platform_data;
+	struct device_node *np = pdev->dev.of_node;
 	struct pxa27x_keypad *keypad;
 	struct input_dev *input_dev;
 	struct resource *res;
 	int irq, error;
 
-	if (pdata == NULL) {
-		dev_err(&pdev->dev, "no platform data defined\n");
+	/* Driver need build keycode from device tree or pdata */
+	if (!np && !pdata)
 		return -EINVAL;
-	}
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
@@ -561,12 +772,18 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
 	input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
 	input_set_capability(input_dev, EV_MSC, MSC_SCAN);
 
-	error  = pxa27x_keypad_build_keycode(keypad);
+	if (np)
+		error = pxa27x_keypad_build_keycode_from_dt(keypad);
+	else
+		error  = pxa27x_keypad_build_keycode(keypad);
 	if (error) {
 		dev_err(&pdev->dev, "failed to build keycode\n");
 		goto failed_put_clk;
 	}
 
+	/* If device tree is supported, pdata will be allocated. */
+	pdata = keypad->pdata;
+
 	if ((pdata->enable_rotary0 && keypad->rotary_rel_code[0] != -1) ||
 	    (pdata->enable_rotary1 && keypad->rotary_rel_code[1] != -1)) {
 		input_dev->evbit[0] |= BIT_MASK(EV_REL);
@@ -627,11 +844,18 @@ static int pxa27x_keypad_remove(struct platform_device *pdev)
 /* work with hotplug and coldplug */
 MODULE_ALIAS("platform:pxa27x-keypad");
 
+static const struct of_device_id pxa27x_keypad_dt_match[] = {
+	{ .compatible = "marvell,pxa27x-keypad" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, pxa27x_keypad_dt_match);
+
 static struct platform_driver pxa27x_keypad_driver = {
 	.probe		= pxa27x_keypad_probe,
 	.remove		= pxa27x_keypad_remove,
 	.driver		= {
 		.name	= "pxa27x-keypad",
+		.of_match_table = of_match_ptr(pxa27x_keypad_dt_match),
 		.owner	= THIS_MODULE,
 #ifdef CONFIG_PM
 		.pm	= &pxa27x_keypad_pm_ops,
-- 
1.7.4.1


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

* Re: [PATCH V3 3/5] arm: pxa: use matrix_keymap for all boards
  2013-06-18  3:56 ` [PATCH V3 3/5] arm: pxa: " Chao Xie
@ 2013-06-18 14:02   ` Arnd Bergmann
  2013-06-22 15:26   ` Mike Dunn
  1 sibling, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2013-06-18 14:02 UTC (permalink / raw)
  To: Chao Xie
  Cc: dmitry.torokhov, eric.y.miao, haojian.zhuang, drwyrm, stefan,
	laforge, robert.jarzmik, marek.vasut, sleep_walker, slapin,
	linux-arm-kernel, linux-kernel, linux-input, xiechao.mail

On Tuesday 18 June 2013, Chao Xie wrote:
> Compile passed for configurations
> 
> em_x270_defconfig
>   em_x270x.c(MACH_EM_X270, MACH_EXEDA)
> 
> ezx_defconfig
>   ezx.c(MACH_EZX_A780, MACH_EZX_E680, MACH_EZX_A1200,
>         MACH_EZX_A910, MACH_EZX_E6, MACH_EZX_E2)
> 
> palmz72_defconfig
>   palmld.c(MACH_PALMLD), palmtreo.c(PALM_TREO),
>   palmtx.c(MACH_PALMTX), palmz72.c(MACH_PALMZ72),
>   palmt5.c(MACH_PALMT5)
> 
> pxa3xx_defconfig
>   littleton.c(MACH_LITTLETON), tarvorevb.c(MACH_TAVOREVB),
>   zylonite.c(MACH_ZYLONITE320), mioa701.c(MACH_MIOA701),
>   z2.c(MACH_ZIPIT2)
> 
> mainstone_defconfig
>   maintone.c(MACH_MAINSTONE)
> 
> Signed-off-by: Chao Xie <chao.xie@marvell.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

Thanks for the quick update.

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

* Re: [PATCH V3 5/5] input: pxa27x-keypad: add device tree support
  2013-06-18  3:56 ` [PATCH V3 5/5] input: pxa27x-keypad: add device tree support Chao Xie
@ 2013-06-19  8:22   ` Marek Vasut
  2013-06-19  8:38     ` Chao Xie
  0 siblings, 1 reply; 15+ messages in thread
From: Marek Vasut @ 2013-06-19  8:22 UTC (permalink / raw)
  To: Chao Xie
  Cc: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, sleep_walker, slapin,
	linux-arm-kernel, linux-kernel, linux-input, xiechao.mail

Dear Chao Xie,

> Signed-off-by: Chao Xie <chao.xie@marvell.com>
> ---
>  .../devicetree/bindings/input/pxa27x-keypad.txt    |   60 +++++
>  drivers/input/keyboard/pxa27x_keypad.c             |  232
> +++++++++++++++++++- 2 files changed, 288 insertions(+), 4 deletions(-)
>  create mode 100644
> Documentation/devicetree/bindings/input/pxa27x-keypad.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
> b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt new file mode
> 100644
> index 0000000..f8674f7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
> @@ -0,0 +1,60 @@
> +* Marvell PXA Keypad controller
> +
> +Required Properties
> +- compatible : should be "marvell,pxa27x-keypad"
> +- reg : Address and length of the register set for the device
> +- interrupts : The interrupt for the keypad controller
> +- marvell,debounce-interval : How long time the key will be

Is there no generic prop name for this debounce interval?

Best regards,
Marek Vasut

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

* Re: [PATCH V3 5/5] input: pxa27x-keypad: add device tree support
  2013-06-19  8:22   ` Marek Vasut
@ 2013-06-19  8:38     ` Chao Xie
  2013-06-19  9:25       ` Arnd Bergmann
  2013-06-19 11:13       ` Gerhard Sittig
  0 siblings, 2 replies; 15+ messages in thread
From: Chao Xie @ 2013-06-19  8:38 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Chao Xie, Dmitry Torokhov, Arnd Bergmann, Eric Miao,
	Haojian Zhuang, drwyrm, stefan, laforge, Robert Jarzmik,
	sleep_walker, slapin, linux-arm-kernel, linux-kernel,
	linux-input

On Wed, Jun 19, 2013 at 4:22 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Chao Xie,
>
>> Signed-off-by: Chao Xie <chao.xie@marvell.com>
>> ---
>>  .../devicetree/bindings/input/pxa27x-keypad.txt    |   60 +++++
>>  drivers/input/keyboard/pxa27x_keypad.c             |  232
>> +++++++++++++++++++- 2 files changed, 288 insertions(+), 4 deletions(-)
>>  create mode 100644
>> Documentation/devicetree/bindings/input/pxa27x-keypad.txt
>>
>> diff --git a/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
>> b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt new file mode
>> 100644
>> index 0000000..f8674f7
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
>> @@ -0,0 +1,60 @@
>> +* Marvell PXA Keypad controller
>> +
>> +Required Properties
>> +- compatible : should be "marvell,pxa27x-keypad"
>> +- reg : Address and length of the register set for the device
>> +- interrupts : The interrupt for the keypad controller
>> +- marvell,debounce-interval : How long time the key will be
>
> Is there no generic prop name for this debounce interval?
>
I searched at drivers/input and Documents.
Two drivers use "debounce-interval", gpio-keys.c and stmpe-keypad.c.
They describe the meanings of "debounce-interval" at its own document file.
Some other drivers uses "xxx,debounce-delay-ms" or "debounce-delay-ms"
So it seems that there is no generic prop name for this debounce interval.

> Best regards,
> Marek Vasut

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

* Re: [PATCH V3 5/5] input: pxa27x-keypad: add device tree support
  2013-06-19  8:38     ` Chao Xie
@ 2013-06-19  9:25       ` Arnd Bergmann
  2013-06-19 11:13       ` Gerhard Sittig
  1 sibling, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2013-06-19  9:25 UTC (permalink / raw)
  To: Chao Xie
  Cc: Marek Vasut, Chao Xie, Dmitry Torokhov, Eric Miao,
	Haojian Zhuang, drwyrm, stefan, laforge, Robert Jarzmik,
	sleep_walker, slapin, linux-arm-kernel, linux-kernel,
	linux-input

On Wednesday 19 June 2013 16:38:38 Chao Xie wrote:
> >> index 0000000..f8674f7
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
> >> @@ -0,0 +1,60 @@
> >> +* Marvell PXA Keypad controller
> >> +
> >> +Required Properties
> >> +- compatible : should be "marvell,pxa27x-keypad"
> >> +- reg : Address and length of the register set for the device
> >> +- interrupts : The interrupt for the keypad controller
> >> +- marvell,debounce-interval : How long time the key will be
> >
> > Is there no generic prop name for this debounce interval?
> >
> I searched at drivers/input and Documents.
> Two drivers use "debounce-interval", gpio-keys.c and stmpe-keypad.c.
> They describe the meanings of "debounce-interval" at its own document file.
> Some other drivers uses "xxx,debounce-delay-ms" or "debounce-delay-ms"
> So it seems that there is no generic prop name for this debounce interval.

I'd suggest using "debounce-interval" as in gpio-keys then, since that
is the most generic driver.

	Arnd

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

* Re: [PATCH V3 5/5] input: pxa27x-keypad: add device tree support
  2013-06-19  8:38     ` Chao Xie
  2013-06-19  9:25       ` Arnd Bergmann
@ 2013-06-19 11:13       ` Gerhard Sittig
  2013-06-20  2:01         ` Chao Xie
  1 sibling, 1 reply; 15+ messages in thread
From: Gerhard Sittig @ 2013-06-19 11:13 UTC (permalink / raw)
  To: Chao Xie
  Cc: Marek Vasut, stefan, Eric Miao, Arnd Bergmann, slapin,
	Dmitry Torokhov, linux-kernel, Haojian Zhuang, Chao Xie, laforge,
	linux-input, sleep_walker, Robert Jarzmik, drwyrm,
	linux-arm-kernel

On Wed, Jun 19, 2013 at 16:38 +0800, Chao Xie wrote:
> 
> On Wed, Jun 19, 2013 at 4:22 PM, Marek Vasut <marex@denx.de> wrote:
> >
> >> Signed-off-by: Chao Xie <chao.xie@marvell.com>
> >> [ ... ]
> >> +++ b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
> >> @@ -0,0 +1,60 @@
> >> +* Marvell PXA Keypad controller
> >> +
> >> +Required Properties
> >> +- compatible : should be "marvell,pxa27x-keypad"
> >> +- reg : Address and length of the register set for the device
> >> +- interrupts : The interrupt for the keypad controller
> >> +- marvell,debounce-interval : How long time the key will be
> >
> > Is there no generic prop name for this debounce interval?
> >
> I searched at drivers/input and Documents.
> Two drivers use "debounce-interval", gpio-keys.c and stmpe-keypad.c.
> They describe the meanings of "debounce-interval" at its own document file.
> Some other drivers uses "xxx,debounce-delay-ms" or "debounce-delay-ms"
> So it seems that there is no generic prop name for this debounce interval.

Actually there is, but under a different (more user friendly)
name:  See the 'debounce-delay-ms' property in
Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt
which gets referenced in the matrix_keypad_parse_dt() routine in
the drivers/input/keyboard/matrix_keypad.c source file.  Ah, your
last sentence mentions that fact.

But when you introduce DT support into an existing driver which
previously used platform data, then there is no problem with
backwards compatibility in .dts files.  So I suggest to go with
the "debounce-delay-ms" name since it better reflects to the .dts
author (hardware engineer) which unit the number is supposed to
be specified in.


Note that I've recently worked on extending the matrix keypad
input driver (doc improvements, software polling, binary encoded
column selection), but haven't submitted the patch series yet
since it's perfectly operational on the target which motivated
the extension but wasn't tested yet on any other platform or
matrix setup -- I currently lack access to an ARM based board
with either lots of accessible GPIOs to connect a matrix to, or
some matrix already built into the board, but more importantly
lack free resources for this very driver extension.

Alternatively I might send an RFC series since the current state
isn't good enough for v1.  Just ask if you'd like to test or
review what I have come up with so far (it builds but wasn't
run-tested).


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

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

* Re: [PATCH V3 5/5] input: pxa27x-keypad: add device tree support
  2013-06-19 11:13       ` Gerhard Sittig
@ 2013-06-20  2:01         ` Chao Xie
  2013-06-20  9:06           ` Arnd Bergmann
  0 siblings, 1 reply; 15+ messages in thread
From: Chao Xie @ 2013-06-20  2:01 UTC (permalink / raw)
  To: Chao Xie, Marek Vasut, stefan, Eric Miao, Arnd Bergmann, slapin,
	Dmitry Torokhov, linux-kernel, Haojian Zhuang, Chao Xie, laforge,
	linux-input, sleep_walker, Robert Jarzmik, drwyrm,
	linux-arm-kernel

On Wed, Jun 19, 2013 at 7:13 PM, Gerhard Sittig <gsi@denx.de> wrote:
> On Wed, Jun 19, 2013 at 16:38 +0800, Chao Xie wrote:
>>
>> On Wed, Jun 19, 2013 at 4:22 PM, Marek Vasut <marex@denx.de> wrote:
>> >
>> >> Signed-off-by: Chao Xie <chao.xie@marvell.com>
>> >> [ ... ]
>> >> +++ b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
>> >> @@ -0,0 +1,60 @@
>> >> +* Marvell PXA Keypad controller
>> >> +
>> >> +Required Properties
>> >> +- compatible : should be "marvell,pxa27x-keypad"
>> >> +- reg : Address and length of the register set for the device
>> >> +- interrupts : The interrupt for the keypad controller
>> >> +- marvell,debounce-interval : How long time the key will be
>> >
>> > Is there no generic prop name for this debounce interval?
>> >
>> I searched at drivers/input and Documents.
>> Two drivers use "debounce-interval", gpio-keys.c and stmpe-keypad.c.
>> They describe the meanings of "debounce-interval" at its own document file.
>> Some other drivers uses "xxx,debounce-delay-ms" or "debounce-delay-ms"
>> So it seems that there is no generic prop name for this debounce interval.
>
> Actually there is, but under a different (more user friendly)
> name:  See the 'debounce-delay-ms' property in
> Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt
> which gets referenced in the matrix_keypad_parse_dt() routine in
> the drivers/input/keyboard/matrix_keypad.c source file.  Ah, your
> last sentence mentions that fact.
>
> But when you introduce DT support into an existing driver which
> previously used platform data, then there is no problem with
> backwards compatibility in .dts files.  So I suggest to go with
> the "debounce-delay-ms" name since it better reflects to the .dts
> author (hardware engineer) which unit the number is supposed to
> be specified in.
>
So Arnd
What do you think? I am fine with either one.

>
> Note that I've recently worked on extending the matrix keypad
> input driver (doc improvements, software polling, binary encoded
> column selection), but haven't submitted the patch series yet
> since it's perfectly operational on the target which motivated
> the extension but wasn't tested yet on any other platform or
> matrix setup -- I currently lack access to an ARM based board
> with either lots of accessible GPIOs to connect a matrix to, or
> some matrix already built into the board, but more importantly
> lack free resources for this very driver extension.
>
> Alternatively I might send an RFC series since the current state
> isn't good enough for v1.  Just ask if you'd like to test or
> review what I have come up with so far (it builds but wasn't
> run-tested).
>
Sure, i can help you to test at PXA platform which is ARM based.

>
> virtually yours
> Gerhard Sittig
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

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

* Re: [PATCH V3 5/5] input: pxa27x-keypad: add device tree support
  2013-06-20  2:01         ` Chao Xie
@ 2013-06-20  9:06           ` Arnd Bergmann
  0 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2013-06-20  9:06 UTC (permalink / raw)
  To: Chao Xie
  Cc: Marek Vasut, stefan, Eric Miao, slapin, Dmitry Torokhov,
	linux-kernel, Haojian Zhuang, Chao Xie, laforge, linux-input,
	sleep_walker, Robert Jarzmik, drwyrm, linux-arm-kernel

On Thursday 20 June 2013, Chao Xie wrote:
> On Wed, Jun 19, 2013 at 7:13 PM, Gerhard Sittig <gsi@denx.de> wrote:
> > On Wed, Jun 19, 2013 at 16:38 +0800, Chao Xie wrote:
> >>
> >> On Wed, Jun 19, 2013 at 4:22 PM, Marek Vasut <marex@denx.de> wrote:
> >> >
> >> >> Signed-off-by: Chao Xie <chao.xie@marvell.com>
> >> >> [ ... ]
> >> >> +++ b/Documentation/devicetree/bindings/input/pxa27x-keypad.txt
> >> >> @@ -0,0 +1,60 @@
> >> >> +* Marvell PXA Keypad controller
> >> >> +
> >> >> +Required Properties
> >> >> +- compatible : should be "marvell,pxa27x-keypad"
> >> >> +- reg : Address and length of the register set for the device
> >> >> +- interrupts : The interrupt for the keypad controller
> >> >> +- marvell,debounce-interval : How long time the key will be
> >> >
> >> > Is there no generic prop name for this debounce interval?
> >> >
> >> I searched at drivers/input and Documents.
> >> Two drivers use "debounce-interval", gpio-keys.c and stmpe-keypad.c.
> >> They describe the meanings of "debounce-interval" at its own document file.
> >> Some other drivers uses "xxx,debounce-delay-ms" or "debounce-delay-ms"
> >> So it seems that there is no generic prop name for this debounce interval.
> >
> > Actually there is, but under a different (more user friendly)
> > name:  See the 'debounce-delay-ms' property in
> > Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt
> > which gets referenced in the matrix_keypad_parse_dt() routine in
> > the drivers/input/keyboard/matrix_keypad.c source file.  Ah, your
> > last sentence mentions that fact.
> >
> > But when you introduce DT support into an existing driver which
> > previously used platform data, then there is no problem with
> > backwards compatibility in .dts files.  So I suggest to go with
> > the "debounce-delay-ms" name since it better reflects to the .dts
> > author (hardware engineer) which unit the number is supposed to
> > be specified in.
> >
> So Arnd
> What do you think? I am fine with either one.

debounce-delay-ms

	Arnd

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

* Re: [PATCH V3 1/5] input: pxa27x-keypad: use matrix_keymap for matrix keyes
  2013-06-18  3:56 ` [PATCH V3 1/5] input: pxa27x-keypad: use matrix_keymap for matrix keyes Chao Xie
@ 2013-06-22 15:24   ` Mike Dunn
  0 siblings, 0 replies; 15+ messages in thread
From: Mike Dunn @ 2013-06-22 15:24 UTC (permalink / raw)
  To: Chao Xie
  Cc: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail

On 06/17/2013 08:56 PM, Chao Xie wrote:
> pxa27x-keypad includes matrix keyes. Make use of matrix_keymap
> for the matrix keyes.
> 
> Signed-off-by: Chao Xie <chao.xie@marvell.com>


Tested-by: Mike Dunn <mikedunn@newsguy.com>

On a palm treo 680

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

* Re: [PATCH V3 3/5] arm: pxa: use matrix_keymap for all boards
  2013-06-18  3:56 ` [PATCH V3 3/5] arm: pxa: " Chao Xie
  2013-06-18 14:02   ` Arnd Bergmann
@ 2013-06-22 15:26   ` Mike Dunn
  1 sibling, 0 replies; 15+ messages in thread
From: Mike Dunn @ 2013-06-22 15:26 UTC (permalink / raw)
  To: Chao Xie
  Cc: dmitry.torokhov, arnd, eric.y.miao, haojian.zhuang, drwyrm,
	stefan, laforge, robert.jarzmik, marek.vasut, sleep_walker,
	slapin, linux-arm-kernel, linux-kernel, linux-input,
	xiechao.mail

On 06/17/2013 08:56 PM, Chao Xie wrote:
> Compile passed for configurations
> 
> em_x270_defconfig
>   em_x270x.c(MACH_EM_X270, MACH_EXEDA)
> 
> ezx_defconfig
>   ezx.c(MACH_EZX_A780, MACH_EZX_E680, MACH_EZX_A1200,
>         MACH_EZX_A910, MACH_EZX_E6, MACH_EZX_E2)
> 
> palmz72_defconfig
>   palmld.c(MACH_PALMLD), palmtreo.c(PALM_TREO),
>   palmtx.c(MACH_PALMTX), palmz72.c(MACH_PALMZ72),
>   palmt5.c(MACH_PALMT5)
> 
> pxa3xx_defconfig
>   littleton.c(MACH_LITTLETON), tarvorevb.c(MACH_TAVOREVB),
>   zylonite.c(MACH_ZYLONITE320), mioa701.c(MACH_MIOA701),
>   z2.c(MACH_ZIPIT2)
> 
> mainstone_defconfig
>   maintone.c(MACH_MAINSTONE)
> 
> Signed-off-by: Chao Xie <chao.xie@marvell.com>


Tested-by: Mike Dunn <mikedunn@newsguy.com>

On a palm treo 680


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

end of thread, other threads:[~2013-06-22 15:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18  3:56 [PATCH V3 0/5] input: pxa27x-keypad: enhancement and device tree support Chao Xie
2013-06-18  3:56 ` [PATCH V3 1/5] input: pxa27x-keypad: use matrix_keymap for matrix keyes Chao Xie
2013-06-22 15:24   ` Mike Dunn
2013-06-18  3:56 ` [PATCH V3 2/5] arm: mmp: use matrix_keymap for all boards Chao Xie
2013-06-18  3:56 ` [PATCH V3 3/5] arm: pxa: " Chao Xie
2013-06-18 14:02   ` Arnd Bergmann
2013-06-22 15:26   ` Mike Dunn
2013-06-18  3:56 ` [PATCH V3 4/5] input: pxa27x-keypad: remove the unused members at platform data Chao Xie
2013-06-18  3:56 ` [PATCH V3 5/5] input: pxa27x-keypad: add device tree support Chao Xie
2013-06-19  8:22   ` Marek Vasut
2013-06-19  8:38     ` Chao Xie
2013-06-19  9:25       ` Arnd Bergmann
2013-06-19 11:13       ` Gerhard Sittig
2013-06-20  2:01         ` Chao Xie
2013-06-20  9:06           ` Arnd Bergmann

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