A few changes to pxa27x_keypad
Subsystems (5)
Dmitry Torokhov
maintainerHi Eric,
I made a few adjustments to the pxa27x_keypad driver and was wondering if you would be able to give it a sping and check if I broke it or not.
Thanks!
Signature · 18 lines
Dmitry Input: pxa27x_keypad - remove extra clk_disable From: Dmitry Torokhov <[email protected]> clk_disable() in remove method is not needed since we already have clk_disable in pxa27x_keypad_close(). Also make sure the driver uses resource_size() and helpers from include/input/matrix_keypad.h Signed-off-by: Dmitry Torokhov <[email protected]> --- arch/arm/mach-pxa/include/mach/pxa27x_keypad.h | 3 +- drivers/input/keyboard/pxa27x_keypad.c | 43 +++++++++++------------- 2 files changed, 21 insertions(+), 25 deletions(-)
arch/arm/mach-pxa/include/mach/pxa27x_keypad.h +1 -2
@@ -2,6 +2,7 @@#define __ASM_ARCH_PXA27x_KEYPAD_H#include <linux/input.h> +#include <linux/input/matrix_keypad.h> #define MAX_MATRIX_KEY_ROWS (8)#define MAX_MATRIX_KEY_COLS (8)
@@ -51,8 +52,6 @@ struct pxa27x_keypad_platform_data { unsigned int debounce_interval; }; -#define KEY (row, col, val) (((row) << 28) | ((col) << 24) | (val)) -extern void pxa_set_keypad_info (struct pxa27x_keypad_platform_data *info);#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
drivers/input/keyboard/pxa27x_keypad.c +20 -23
116 lines not on this page · raw message
Mike Rapoport
Tested-byHi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.
Apparently not :)
Quoted 177 lines
Thanks!
Signature · 18 lines
Dmitry Input: pxa27x_keypad - remove extra clk_disable From: Dmitry Torokhov <[email protected]> clk_disable() in remove method is not needed since we already have clk_disable in pxa27x_keypad_close(). Also make sure the driver uses resource_size() and helpers from include/input/matrix_keypad.h Signed-off-by: Dmitry Torokhov <[email protected]> --- arch/arm/mach-pxa/include/mach/pxa27x_keypad.h | 3 +- drivers/input/keyboard/pxa27x_keypad.c | 43 +++++++++++------------- 2 files changed, 21 insertions(+), 25 deletions(-)arch/arm/mach-pxa/include/mach/pxa27x_keypad.h +1
-2@@ -2,6 +2,7 @@#define __ASM_ARCH_PXA27x_KEYPAD_H#include <linux/input.h> +#include <linux/input/matrix_keypad.h> #define MAX_MATRIX_KEY_ROWS (8)#define MAX_MATRIX_KEY_COLS (8)@@ -51,8 +52,6 @@ struct pxa27x_keypad_platform_data { unsigned int debounce_interval; }; -#define KEY (row, col, val) (((row) << 28) | ((col) << 24) | (val)) -extern void pxa_set_keypad_info (struct pxa27x_keypad_platform_data *info);#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */ drivers/input/keyboard/pxa27x_keypad.c +20
-24@@ -25,6 +25,7 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/err.h> +#include <linux/input/matrix_keypad.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> @@ -107,7 +108,7 @@ struct pxa27x_keypad {int irq;/* matrix key code map */ -unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM ]; +unsigned short matrix_keycodes[MAX_MATRIX_KEY_NUM ];/* state row bits of each column scan */ uint32_t matrix_key_state[MAX_MATRIX_KEY_COLS ];@@ -124,21 +125,21 @@ static void 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 int *key;int i; - key = &pdata->matrix_key_map[0 ]; -for (i =0 ; i < pdata->matrix_key_map_size; i++, key++) { -int row = ((*key) >>28 ) &0xf ; -int col = ((*key) >>24 ) &0xf ; -int code = (*key) &0xffffff ; +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 short code =KEY_VAL (key); keypad->matrix_keycodes[(row <<3 ) + col] = code; -set_bit (code, input_dev->keybit); +__set_bit (code, input_dev->keybit); } +__clear_bit (KEY_RESERVED , input_dev->keybit);for (i =0 ; i < pdata->direct_key_num; i++) -set_bit (pdata->direct_key_map[i], input_dev->keybit); +__set_bit (pdata->direct_key_map[i], input_dev->keybit); keypad->rotary_up_key[0 ] = pdata->rotary0_up_key; keypad->rotary_up_key[1 ] = pdata->rotary1_up_key;@@ -149,18 +150,18 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)if (pdata->enable_rotary0) {if (pdata->rotary0_up_key && pdata->rotary0_down_key) { -set_bit (pdata->rotary0_up_key, input_dev->keybit); -set_bit (pdata->rotary0_down_key, input_dev->keybit); +__set_bit (pdata->rotary0_up_key, input_dev->keybit); +__set_bit (pdata->rotary0_down_key, input_dev->keybit); }else -set_bit (pdata->rotary0_rel_code, input_dev->relbit); +__set_bit (pdata->rotary0_rel_code, input_dev->relbit); }if (pdata->enable_rotary1) {if (pdata->rotary1_up_key && pdata->rotary1_down_key) { -set_bit (pdata->rotary1_up_key, input_dev->keybit); -set_bit (pdata->rotary1_down_key, input_dev->keybit); +__set_bit (pdata->rotary1_up_key, input_dev->keybit); +__set_bit (pdata->rotary1_down_key, input_dev->keybit); }else -set_bit (pdata->rotary1_rel_code, input_dev->relbit); +__set_bit (pdata->rotary1_rel_code, input_dev->relbit); } }@@ -425,8 +426,6 @@ static int pxa27x_keypad_resume(struct platform_device *pdev)#define pxa27x_keypad_resume NULL#endif -#define res_size (res) ((res)->end - (res)->start + 1) -static int __devinit pxa27x_keypad_probe (struct platform_device *pdev) {struct pxa27x_keypad *keypad;@@ -461,14 +460,14 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) goto failed_free; } - res =request_mem_region (res->start,res_size (res), pdev->name); + res =request_mem_region (res->start,resource_size (res), pdev->name);if (res ==NULL ) {dev_err (&pdev->dev,"failed to request I/O memory\n" ); error = -EBUSY ; goto failed_free; } - keypad->mmio_base =ioremap (res->start,res_size (res)); + keypad->mmio_base =ioremap (res->start,resource_size (res));if (keypad->mmio_base ==NULL ) {dev_err (&pdev->dev,"failed to remap I/O memory\n" ); error = -ENXIO ;@@ -540,7 +539,7 @@ failed_put_clk: failed_free_io:iounmap (keypad->mmio_base); failed_free_mem: -release_mem_region (res->start,res_size (res)); +release_mem_region (res->start,resource_size (res)); failed_free:kfree (keypad);return error;@@ -552,8 +551,6 @@ static int __devexit pxa27x_keypad_remove(struct platform_device *pdev)struct resource *res;free_irq (keypad->irq, pdev); - -clk_disable (keypad->clk);clk_put (keypad->clk);input_unregister_device (keypad->input_dev);@@ -562,7 +559,7 @@ static int __devexit pxa27x_keypad_remove(struct platform_device *pdev)iounmap (keypad->mmio_base); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -release_mem_region (res->start,res_size (res)); +release_mem_region (res->start,resource_size (res));platform_set_drvdata (pdev,NULL );kfree (keypad); --To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sincerely yours, Mike.
Dmitry Torokhov
maintainerQuoted 11 lines · Mike Rapoport
Hi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.Apparently not :)
Tested-by Mike Rapoport <[email protected]>
Cool, thanks for testing. I have another one for you then ;)
TIA!
Signature · 10 lines
Dmitry Input: pxa27x_keypad - switch to using dev_pm_ops Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/keyboard/pxa27x_keypad.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/input/keyboard/pxa27x_keypad.c +12 -5
@@ -389,8 +389,9 @@ static void pxa27x_keypad_close(struct input_dev *dev) }#ifdef CONFIG_PM -static int pxa27x_keypad_suspend (struct platform_device *pdev,pm_message_t state) +static int pxa27x_keypad_suspend (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct pxa27x_keypad *keypad =platform_get_drvdata (pdev);clk_disable (keypad->clk);
@@ -401,8 +402,9 @@ static int pxa27x_keypad_suspend(struct platform_device *pdev, pm_message_t statreturn 0 ; } -static int pxa27x_keypad_resume (struct platform_device *pdev) +static int pxa27x_keypad_resume (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct pxa27x_keypad *keypad =platform_get_drvdata (pdev);struct input_dev *input_dev = keypad->input_dev;
@@ -421,9 +423,11 @@ static int pxa27x_keypad_resume(struct platform_device *pdev) return 0; } -#else -#define pxa27x_keypad_suspend NULL -#define pxa27x_keypad_resume NULL + +static const struct dev_pm_ops pxa27x_keypad_pm_ops = { + .suspend = pxa27x_keypad_suspend, + .resume = pxa27x_keypad_resume, +};#endif static int __devinit pxa27x_keypad_probe (struct platform_device *pdev)
@@ -577,6 +581,9 @@ static struct platform_driver pxa27x_keypad_driver = { .driver = { .name = "pxa27x-keypad", .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &pxa27x_keypad_pm_ops, +#endif }, };
Dmitry Torokhov
maintainerQuoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Mike Rapoport
Hi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.
Quoted 8 lines
Quoted 3 lines
Apparently not :)
Tested-by Mike Rapoport <[email protected]>Cool, thanks for testing. I have another one for you then ;)
TIA!
Umm.. this one is hopefully better...
Input: pxa27x_keypad - switch to using dev_pm_ops
---
drivers/input/keyboard/pxa27x_keypad.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-)
drivers/input/keyboard/pxa27x_keypad.c +12 -7
@@ -389,8 +389,9 @@ static void pxa27x_keypad_close(struct input_dev *dev) }#ifdef CONFIG_PM -static int pxa27x_keypad_suspend (struct platform_device *pdev,pm_message_t state) +static int pxa27x_keypad_suspend (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct pxa27x_keypad *keypad =platform_get_drvdata (pdev);clk_disable (keypad->clk);
@@ -401,8 +402,9 @@ static int pxa27x_keypad_suspend(struct platform_device *pdev, pm_message_t statreturn 0 ; } -static int pxa27x_keypad_resume (struct platform_device *pdev) +static int pxa27x_keypad_resume (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct pxa27x_keypad *keypad =platform_get_drvdata (pdev);struct input_dev *input_dev = keypad->input_dev;
@@ -421,9 +423,11 @@ static int pxa27x_keypad_resume(struct platform_device *pdev) return 0; } -#else -#define pxa27x_keypad_suspend NULL -#define pxa27x_keypad_resume NULL + +static const struct dev_pm_ops pxa27x_keypad_pm_ops = { + .suspend = pxa27x_keypad_suspend, + .resume = pxa27x_keypad_resume, +};#endif static int __devinit pxa27x_keypad_probe (struct platform_device *pdev)
@@ -572,11 +576,12 @@ MODULE_ALIAS("platform:pxa27x-keypad");static struct platform_driver pxa27x_keypad_driver = { .probe = pxa27x_keypad_probe, .remove =__devexit_p (pxa27x_keypad_remove), - .suspend = pxa27x_keypad_suspend, - .resume = pxa27x_keypad_resume, .driver = { .name ="pxa27x-keypad" , .owner =THIS_MODULE , +#ifdef CONFIG_PM + .pm = &pxa27x_keypad_pm_ops, +#endif }, };
Dmitry Torokhov
maintainerQuoted 14 lines · Dmitry Torokhov
Quoted 13 lines · Dmitry Torokhov
Quoted 11 lines · Mike Rapoport
Hi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.Apparently not :)
Tested-by Mike Rapoport <[email protected]>
Quoted 7 lines
Quoted 4 lines
Cool, thanks for testing. I have another one for you then ;)
TIA!
Umm.. this one is hopefully better...
And another one implementing keymap manipulation.
Signature · 11 lines
Dmitry Input: pxa27x_keypad - allow modifying keymap from userspace Signed-off-by: Dmitry Torokhov <[email protected]> --- arch/arm/mach-pxa/include/mach/pxa27x_keypad.h | 3 drivers/input/keyboard/pxa27x_keypad.c | 168 +++++++++++++----------- 2 files changed, 90 insertions(+), 81 deletions(-)
arch/arm/mach-pxa/include/mach/pxa27x_keypad.h +2 -1
@@ -6,6 +6,7 @@#define MAX_MATRIX_KEY_ROWS (8)#define MAX_MATRIX_KEY_COLS (8) +#define MAX_DIRECT_KEY_NUM (8)/* pxa3xx keypad platform specific parameters *
@@ -34,7 +35,7 @@ struct pxa27x_keypad_platform_data {/* direct keys */ int direct_key_num; -unsigned int direct_key_map[8 ]; +unsigned int direct_key_map[MAX_DIRECT_KEY_NUM ];/* rotary encoders 0 */ int enable_rotary0;
drivers/input/keyboard/pxa27x_keypad.c +88 -80
334 lines not on this page · raw message
Mike Rapoport
Acked-byQuoted 14 lines · Dmitry Torokhov
Quoted 13 lines · Dmitry Torokhov
Quoted 10 lines · Mike Rapoport
Hi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.Apparently not :)
Tested-by Mike Rapoport <[email protected]>Cool, thanks for testing. I have another one for you then ;)
Quoted 8 lines
Quoted 2 lines
TIA!
Umm.. this one is hopefully better...
Input:
pxa27x_keypad- switch to usingdev_pm_opsSigned-off-by Dmitry Torokhov <[email protected]>
I've got this with 2.6.31-rc3
CC drivers/input/keyboard/pxa27x_keypad.odrivers/input/keyboard/pxa27x_keypad.c:591: warning: initialization discards qualifiers from pointer target type
Except that
Quoted 67 lines
---
drivers/input/keyboard/pxa27x_keypad.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-)drivers/input/keyboard/pxa27x_keypad.c +12
-8@@ -389,8 +389,9 @@ static void pxa27x_keypad_close(struct input_dev *dev) }#ifdef CONFIG_PM -static int pxa27x_keypad_suspend (struct platform_device *pdev,pm_message_t state) +static int pxa27x_keypad_suspend (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct pxa27x_keypad *keypad =platform_get_drvdata (pdev);clk_disable (keypad->clk);@@ -401,8 +402,9 @@ static int pxa27x_keypad_suspend(struct platform_device *pdev, pm_message_t statreturn 0 ; } -static int pxa27x_keypad_resume (struct platform_device *pdev) +static int pxa27x_keypad_resume (struct device *dev) { +struct platform_device *pdev =to_platform_device (dev);struct pxa27x_keypad *keypad =platform_get_drvdata (pdev);struct input_dev *input_dev = keypad->input_dev;@@ -421,9 +423,11 @@ static int pxa27x_keypad_resume(struct platform_device *pdev) return 0; } -#else -#define pxa27x_keypad_suspend NULL -#define pxa27x_keypad_resume NULL + +static const struct dev_pm_ops pxa27x_keypad_pm_ops = { + .suspend = pxa27x_keypad_suspend, + .resume = pxa27x_keypad_resume, +};#endif static int __devinit pxa27x_keypad_probe (struct platform_device *pdev)@@ -572,11 +576,12 @@ MODULE_ALIAS("platform:pxa27x-keypad");static struct platform_driver pxa27x_keypad_driver = { .probe = pxa27x_keypad_probe, .remove =__devexit_p (pxa27x_keypad_remove), - .suspend = pxa27x_keypad_suspend, - .resume = pxa27x_keypad_resume, .driver = { .name ="pxa27x-keypad" , .owner =THIS_MODULE , +#ifdef CONFIG_PM + .pm = &pxa27x_keypad_pm_ops, +#endif }, }; --To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sincerely yours, Mike.
Dmitry Torokhov
maintainerQuoted 22 lines · Mike Rapoport
Quoted 19 lines · Dmitry Torokhov
Quoted 6 lines · Dmitry Torokhov
Quoted 5 lines · Mike Rapoport
Hi Dmitry,
Quoted 2 lines · Dmitry Torokhov
Hi Eric,
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.Apparently not :)
Tested-by Mike Rapoport <[email protected]>Cool, thanks for testing. I have another one for you then ;)
TIA!
Umm.. this one is hopefully better...
Quoted 9 lines
Quoted 3 lines
Input:
pxa27x_keypad- switch to usingdev_pm_opsSigned-off-by Dmitry Torokhov <[email protected]>I've got this with 2.6.31-rc3
CCdrivers/input/keyboard/pxa27x_keypad.odrivers/input/keyboard/pxa27x_keypad.c:591: warning: initialization discards qualifiers from pointer target type
Ah, yes... it needs my patch constifying the pm pointer that Rafael picked up. Thank you for testing.
Signature · 1 line
Dmitry
Dmitry Torokhov
maintainerQuoted 17 lines · Dmitry Torokhov
Quoted 16 lines · Dmitry Torokhov
Quoted 15 lines · Dmitry Torokhov
Quoted 11 lines · Mike Rapoport
Hi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.Apparently not :)
Tested-by Mike Rapoport <[email protected]>Cool, thanks for testing. I have another one for you then ;)
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
TIA!
Umm.. this one is hopefully better...
And another one implementing keymap manipulation.
*ping* Any chance you could try this one out for me? Pretty please...
Signature · 1 line
Dmitry
Eric Miao
Acked-byQuoted 21 lines · Dmitry Torokhov
Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Dmitry Torokhov
Quoted 17 lines · Dmitry Torokhov
Quoted 11 lines · Mike Rapoport
Hi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.Apparently not :)
Tested-by Mike Rapoport <[email protected]>Cool, thanks for testing. I have another one for you then ;)
TIA!
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Umm.. this one is hopefully better...
And another one implementing keymap manipulation.
*ping* Any chance you could try this one out for me? Pretty please...
Hi Dmitry,
Mike has already tested this, and I tested this again on my Littleton/pxa3xx, it works pretty good, and the change looks quite OK, so if you need my Ack, here it goes:
Dmitry Torokhov
maintainerQuoted 29 lines · Eric Miao
Quoted 27 lines · Dmitry Torokhov
Quoted 25 lines · Dmitry Torokhov
Quoted 14 lines · Dmitry Torokhov
Quoted 13 lines · Dmitry Torokhov
Quoted 11 lines · Mike Rapoport
Hi Dmitry,
Quoted 4 lines · Dmitry Torokhov
Hi Eric,
I made a few adjustments to the
pxa27x_keypaddriver and was wondering if you would be able to give it a sping and check if I broke it or not.Apparently not :)
Tested-by Mike Rapoport <[email protected]>Quoted 7 lines
Quoted 4 lines
Cool, thanks for testing. I have another one for you then ;)
TIA!
Umm.. this one is hopefully better...
And another one implementing keymap manipulation.
Quoted 6 lines
Quoted 2 lines
*ping* Any chance you could try this one out for me? Pretty please...
Hi Dmitry,
Mike has already tested this,
Ah, my bad then... I understood that he only tested dev_pm_ops conversion (the first patch) and not both.
Quoted 5 lines
and I tested this again on my Littleton/pxa3xx,
it works pretty good, and the change looks quite OK, so if you need my Ack, here it goes:Acked-by Eric Miao <[email protected]>
Thank you, much appreciated.
Signature · 1 line
Dmitry