Commit 1932811f authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

Input: matrix-keymap - uninline and prepare for device tree support



Change matrix-keymap helper to be out-of-line, like sparse keymap,
allow the helper perform basic keymap validation and return errors,
and prepare for device tree support.

Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent d0a3457d
Loading
Loading
Loading
Loading
+13 −4
Original line number Original line Diff line number Diff line
@@ -25,10 +25,6 @@ config INPUT


if INPUT
if INPUT


config INPUT_OF_MATRIX_KEYMAP
	depends on USE_OF
	bool

config INPUT_FF_MEMLESS
config INPUT_FF_MEMLESS
	tristate "Support for memoryless force-feedback devices"
	tristate "Support for memoryless force-feedback devices"
	help
	help
@@ -68,6 +64,19 @@ config INPUT_SPARSEKMAP
	  To compile this driver as a module, choose M here: the
	  To compile this driver as a module, choose M here: the
	  module will be called sparse-keymap.
	  module will be called sparse-keymap.


config INPUT_MATRIXKMAP
	tristate "Matrix keymap support library"
	help
	  Say Y here if you are using a driver for an input
	  device that uses matrix keymap. This option is only
	  useful for out-of-tree drivers since in-tree drivers
	  select it automatically.

	  If unsure, say N.

	  To compile this driver as a module, choose M here: the
	  module will be called matrix-keymap.

comment "Userland interfaces"
comment "Userland interfaces"


config INPUT_MOUSEDEV
config INPUT_MOUSEDEV
+1 −1
Original line number Original line Diff line number Diff line
@@ -10,6 +10,7 @@ input-core-y := input.o input-compat.o input-mt.o ff-core.o
obj-$(CONFIG_INPUT_FF_MEMLESS)	+= ff-memless.o
obj-$(CONFIG_INPUT_FF_MEMLESS)	+= ff-memless.o
obj-$(CONFIG_INPUT_POLLDEV)	+= input-polldev.o
obj-$(CONFIG_INPUT_POLLDEV)	+= input-polldev.o
obj-$(CONFIG_INPUT_SPARSEKMAP)	+= sparse-keymap.o
obj-$(CONFIG_INPUT_SPARSEKMAP)	+= sparse-keymap.o
obj-$(CONFIG_INPUT_MATRIXKMAP)	+= matrix-keymap.o


obj-$(CONFIG_INPUT_MOUSEDEV)	+= mousedev.o
obj-$(CONFIG_INPUT_MOUSEDEV)	+= mousedev.o
obj-$(CONFIG_INPUT_JOYDEV)	+= joydev.o
obj-$(CONFIG_INPUT_JOYDEV)	+= joydev.o
@@ -24,4 +25,3 @@ obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
obj-$(CONFIG_INPUT_MISC)	+= misc/
obj-$(CONFIG_INPUT_MISC)	+= misc/


obj-$(CONFIG_INPUT_APMPOWER)	+= apm-power.o
obj-$(CONFIG_INPUT_APMPOWER)	+= apm-power.o
obj-$(CONFIG_INPUT_OF_MATRIX_KEYMAP) += of_keymap.o
+17 −1
Original line number Original line Diff line number Diff line
@@ -166,6 +166,7 @@ config KEYBOARD_LKKBD
config KEYBOARD_EP93XX
config KEYBOARD_EP93XX
	tristate "EP93xx Matrix Keypad support"
	tristate "EP93xx Matrix Keypad support"
	depends on ARCH_EP93XX
	depends on ARCH_EP93XX
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here to enable the matrix keypad on the Cirrus EP93XX.
	  Say Y here to enable the matrix keypad on the Cirrus EP93XX.


@@ -224,6 +225,7 @@ config KEYBOARD_TCA6416
config KEYBOARD_TCA8418
config KEYBOARD_TCA8418
	tristate "TCA8418 Keypad Support"
	tristate "TCA8418 Keypad Support"
	depends on I2C
	depends on I2C
	select INPUT_MATRIXKMAP
	help
	help
	  This driver implements basic keypad functionality
	  This driver implements basic keypad functionality
	  for keys connected through TCA8418 keypad decoder.
	  for keys connected through TCA8418 keypad decoder.
@@ -240,6 +242,7 @@ config KEYBOARD_TCA8418
config KEYBOARD_MATRIX
config KEYBOARD_MATRIX
	tristate "GPIO driven matrix keypad support"
	tristate "GPIO driven matrix keypad support"
	depends on GENERIC_GPIO
	depends on GENERIC_GPIO
	select INPUT_MATRIXKMAP
	help
	help
	  Enable support for GPIO driven matrix keypad.
	  Enable support for GPIO driven matrix keypad.


@@ -312,6 +315,7 @@ config KEYBOARD_LM8323
config KEYBOARD_LM8333
config KEYBOARD_LM8333
	tristate "LM8333 keypad chip"
	tristate "LM8333 keypad chip"
	depends on I2C
	depends on I2C
	select INPUT_MATRIXKMAP
	help
	help
	  If you say yes here you get support for the National Semiconductor
	  If you say yes here you get support for the National Semiconductor
	  LM8333 keypad controller.
	  LM8333 keypad controller.
@@ -376,6 +380,7 @@ config KEYBOARD_MPR121
config KEYBOARD_IMX
config KEYBOARD_IMX
	tristate "IMX keypad support"
	tristate "IMX keypad support"
	depends on ARCH_MXC
	depends on ARCH_MXC
	select INPUT_MATRIXKMAP
	help
	help
	  Enable support for IMX keypad port.
	  Enable support for IMX keypad port.


@@ -394,6 +399,7 @@ config KEYBOARD_NEWTON
config KEYBOARD_NOMADIK
config KEYBOARD_NOMADIK
	tristate "ST-Ericsson Nomadik SKE keyboard"
	tristate "ST-Ericsson Nomadik SKE keyboard"
	depends on PLAT_NOMADIK
	depends on PLAT_NOMADIK
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use a keypad provided on the SKE controller
	  Say Y here if you want to use a keypad provided on the SKE controller
	  used on the Ux500 and Nomadik platforms
	  used on the Ux500 and Nomadik platforms
@@ -404,7 +410,7 @@ config KEYBOARD_NOMADIK
config KEYBOARD_TEGRA
config KEYBOARD_TEGRA
	tristate "NVIDIA Tegra internal matrix keyboard controller support"
	tristate "NVIDIA Tegra internal matrix keyboard controller support"
	depends on ARCH_TEGRA
	depends on ARCH_TEGRA
	select INPUT_OF_MATRIX_KEYMAP if USE_OF
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use a matrix keyboard connected directly
	  Say Y here if you want to use a matrix keyboard connected directly
	  to the internal keyboard controller on Tegra SoCs.
	  to the internal keyboard controller on Tegra SoCs.
@@ -442,6 +448,7 @@ config KEYBOARD_PXA930_ROTARY
config KEYBOARD_PMIC8XXX
config KEYBOARD_PMIC8XXX
	tristate "Qualcomm PMIC8XXX keypad support"
	tristate "Qualcomm PMIC8XXX keypad support"
	depends on MFD_PM8XXX
	depends on MFD_PM8XXX
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to enable the driver for the PMIC8XXX
	  Say Y here if you want to enable the driver for the PMIC8XXX
	  keypad provided as a reference design from Qualcomm. This is intended
	  keypad provided as a reference design from Qualcomm. This is intended
@@ -453,6 +460,7 @@ config KEYBOARD_PMIC8XXX
config KEYBOARD_SAMSUNG
config KEYBOARD_SAMSUNG
	tristate "Samsung keypad support"
	tristate "Samsung keypad support"
	depends on HAVE_CLK
	depends on HAVE_CLK
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use the keypad on your Samsung mobile
	  Say Y here if you want to use the keypad on your Samsung mobile
	  device.
	  device.
@@ -495,6 +503,7 @@ config KEYBOARD_SH_KEYSC
config KEYBOARD_STMPE
config KEYBOARD_STMPE
	tristate "STMPE keypad support"
	tristate "STMPE keypad support"
	depends on MFD_STMPE
	depends on MFD_STMPE
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use the keypad controller on STMPE I/O
	  Say Y here if you want to use the keypad controller on STMPE I/O
	  expanders.
	  expanders.
@@ -515,6 +524,7 @@ config KEYBOARD_DAVINCI
config KEYBOARD_OMAP
config KEYBOARD_OMAP
	tristate "TI OMAP keypad support"
	tristate "TI OMAP keypad support"
	depends on (ARCH_OMAP1 || ARCH_OMAP2)
	depends on (ARCH_OMAP1 || ARCH_OMAP2)
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use the OMAP keypad.
	  Say Y here if you want to use the OMAP keypad.


@@ -523,6 +533,7 @@ config KEYBOARD_OMAP


config KEYBOARD_OMAP4
config KEYBOARD_OMAP4
	tristate "TI OMAP4+ keypad support"
	tristate "TI OMAP4+ keypad support"
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use the OMAP4+ keypad.
	  Say Y here if you want to use the OMAP4+ keypad.


@@ -532,6 +543,7 @@ config KEYBOARD_OMAP4
config KEYBOARD_SPEAR
config KEYBOARD_SPEAR
	tristate "ST SPEAR keyboard support"
	tristate "ST SPEAR keyboard support"
	depends on PLAT_SPEAR
	depends on PLAT_SPEAR
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use the SPEAR keyboard.
	  Say Y here if you want to use the SPEAR keyboard.


@@ -541,6 +553,7 @@ config KEYBOARD_SPEAR
config KEYBOARD_TC3589X
config KEYBOARD_TC3589X
	tristate "TC3589X Keypad support"
	tristate "TC3589X Keypad support"
	depends on MFD_TC3589X
	depends on MFD_TC3589X
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use the keypad controller on
	  Say Y here if you want to use the keypad controller on
	  TC35892/3 I/O expander.
	  TC35892/3 I/O expander.
@@ -551,6 +564,7 @@ config KEYBOARD_TC3589X
config KEYBOARD_TNETV107X
config KEYBOARD_TNETV107X
	tristate "TI TNETV107X keypad support"
	tristate "TI TNETV107X keypad support"
	depends on ARCH_DAVINCI_TNETV107X
	depends on ARCH_DAVINCI_TNETV107X
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if you want to use the TNETV107X keypad.
	  Say Y here if you want to use the TNETV107X keypad.


@@ -560,6 +574,7 @@ config KEYBOARD_TNETV107X
config KEYBOARD_TWL4030
config KEYBOARD_TWL4030
	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
	depends on TWL4030_CORE
	depends on TWL4030_CORE
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here if your board use the keypad controller on
	  Say Y here if your board use the keypad controller on
	  TWL4030 family chips.  It's safe to say enable this
	  TWL4030 family chips.  It's safe to say enable this
@@ -583,6 +598,7 @@ config KEYBOARD_XTKBD
config KEYBOARD_W90P910
config KEYBOARD_W90P910
	tristate "W90P910 Matrix Keypad support"
	tristate "W90P910 Matrix Keypad support"
	depends on ARCH_W90X900
	depends on ARCH_W90X900
	select INPUT_MATRIXKMAP
	help
	help
	  Say Y here to enable the matrix keypad on evaluation board
	  Say Y here to enable the matrix keypad on evaluation board
	  based on W90P910.
	  based on W90P910.
+8 −10
Original line number Original line Diff line number Diff line
@@ -303,19 +303,16 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
	input_dev->open = ep93xx_keypad_open;
	input_dev->open = ep93xx_keypad_open;
	input_dev->close = ep93xx_keypad_close;
	input_dev->close = ep93xx_keypad_close;
	input_dev->dev.parent = &pdev->dev;
	input_dev->dev.parent = &pdev->dev;
	input_dev->keycode = keypad->keycodes;
	input_dev->keycodesize = sizeof(keypad->keycodes[0]);
	input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);


	input_set_drvdata(input_dev, keypad);
	err = matrix_keypad_build_keymap(keymap_data, NULL,
					 EP93XX_MATRIX_ROWS, EP93XX_MATRIX_COLS,
					 keypad->keycodes, input_dev);
	if (err)
		goto failed_free_dev;


	input_dev->evbit[0] = BIT_MASK(EV_KEY);
	if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT)
	if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT)
		input_dev->evbit[0] |= BIT_MASK(EV_REP);
		__set_bit(EV_REP, input_dev->evbit);

	input_set_drvdata(input_dev, keypad);
	matrix_keypad_build_keymap(keymap_data, 3,
				   input_dev->keycode, input_dev->keybit);
	platform_set_drvdata(pdev, keypad);


	err = request_irq(keypad->irq, ep93xx_keypad_irq_handler,
	err = request_irq(keypad->irq, ep93xx_keypad_irq_handler,
			  0, pdev->name, keypad);
			  0, pdev->name, keypad);
@@ -326,6 +323,7 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
	if (err)
	if (err)
		goto failed_free_irq;
		goto failed_free_irq;


	platform_set_drvdata(pdev, keypad);
	device_init_wakeup(&pdev->dev, 1);
	device_init_wakeup(&pdev->dev, 1);


	return 0;
	return 0;
+10 −7
Original line number Original line Diff line number Diff line
@@ -496,14 +496,17 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev)
	input_dev->dev.parent = &pdev->dev;
	input_dev->dev.parent = &pdev->dev;
	input_dev->open = imx_keypad_open;
	input_dev->open = imx_keypad_open;
	input_dev->close = imx_keypad_close;
	input_dev->close = imx_keypad_close;
	input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
	input_dev->keycode = keypad->keycodes;
	input_dev->keycodesize = sizeof(keypad->keycodes[0]);
	input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);


	matrix_keypad_build_keymap(keymap_data, MATRIX_ROW_SHIFT,
	error = matrix_keypad_build_keymap(keymap_data, NULL,
				keypad->keycodes, input_dev->keybit);
					   MAX_MATRIX_KEY_ROWS,
					   MAX_MATRIX_KEY_COLS,
					   keypad->keycodes, input_dev);
	if (error) {
		dev_err(&pdev->dev, "failed to build keymap\n");
		goto failed_clock_put;
	}


	__set_bit(EV_REP, input_dev->evbit);
	input_set_capability(input_dev, EV_MSC, MSC_SCAN);
	input_set_capability(input_dev, EV_MSC, MSC_SCAN);
	input_set_drvdata(input_dev, keypad);
	input_set_drvdata(input_dev, keypad);


Loading