* [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path @ 2015-01-14 8:54 Sonic Zhang 2015-01-14 8:54 ` [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data Sonic Zhang ` (5 more replies) 0 siblings, 6 replies; 14+ messages in thread From: Sonic Zhang @ 2015-01-14 8:54 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang From: Sonic Zhang <sonic.zhang@analog.com> The platform data definition of the rotary driver should be generic for all architectures. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> --- arch/blackfin/mach-bf527/boards/ad7160eval.c | 2 +- arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- arch/blackfin/mach-bf548/boards/ezkit.c | 2 +- arch/blackfin/mach-bf609/boards/ezkit.c | 2 +- drivers/input/misc/bfin_rotary.c | 2 +- .../linux/platform_data}/bfin_rotary.h | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename {arch/blackfin/include/asm => include/linux/platform_data}/bfin_rotary.h (100%) diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c index 9501bd8..beb011b 100644 --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c @@ -666,7 +666,7 @@ static struct platform_device bfin_sport1_uart_device = { #endif #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) -#include <asm/bfin_rotary.h> +#include <linux/platform_data/bfin_rotary.h> static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index d64f565..728cda4 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c @@ -1092,7 +1092,7 @@ static struct platform_device bfin_device_gpiokeys = { #endif #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) -#include <asm/bfin_rotary.h> +#include <linux/platform_data/bfin_rotary.h> static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 1fe7ff2..8f70f83 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c @@ -159,7 +159,7 @@ static struct platform_device bf54x_kpad_device = { #endif #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) -#include <asm/bfin_rotary.h> +#include <linux/platform_data/bfin_rotary.h> static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c index e2c0b02..f9dc64d 100644 --- a/arch/blackfin/mach-bf609/boards/ezkit.c +++ b/arch/blackfin/mach-bf609/boards/ezkit.c @@ -75,7 +75,7 @@ static struct platform_device bfin_isp1760_device = { #endif #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) -#include <asm/bfin_rotary.h> +#include <linux/platform_data/bfin_rotary.h> static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c index e69d9bc..8f6c7cd 100644 --- a/drivers/input/misc/bfin_rotary.c +++ b/drivers/input/misc/bfin_rotary.c @@ -12,9 +12,9 @@ #include <linux/platform_device.h> #include <linux/input.h> #include <linux/slab.h> +#include <linux/platform_data/bfin_rotary.h> #include <asm/portmux.h> -#include <asm/bfin_rotary.h> static const u16 per_cnt[] = { P_CNT_CUD, diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h similarity index 100% rename from arch/blackfin/include/asm/bfin_rotary.h rename to include/linux/platform_data/bfin_rotary.h -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data 2015-01-14 8:54 [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang @ 2015-01-14 8:54 ` Sonic Zhang 2015-02-04 1:22 ` Dmitry Torokhov 2015-01-14 8:54 ` [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function Sonic Zhang ` (4 subsequent siblings) 5 siblings, 1 reply; 14+ messages in thread From: Sonic Zhang @ 2015-01-14 8:54 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang From: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> --- arch/blackfin/mach-bf527/boards/ad7160eval.c | 8 ++++++++ arch/blackfin/mach-bf527/boards/ezkit.c | 8 ++++++++ arch/blackfin/mach-bf548/boards/ezkit.c | 8 ++++++++ arch/blackfin/mach-bf609/boards/ezkit.c | 8 ++++++++ drivers/input/misc/bfin_rotary.c | 12 +++--------- include/linux/platform_data/bfin_rotary.h | 1 + 6 files changed, 36 insertions(+), 9 deletions(-) diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c index beb011b..029a050 100644 --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c @@ -668,6 +668,13 @@ static struct platform_device bfin_sport1_uart_device = { #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #include <linux/platform_data/bfin_rotary.h> +static const u16 per_cnt[] = { + P_CNT_CUD, + P_CNT_CDG, + P_CNT_CZM, + 0 +}; + static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ /*.rotary_down_key = KEY_DOWN,*/ @@ -676,6 +683,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { .debounce = 10, /* 0..17 */ .mode = ROT_QUAD_ENC | ROT_DEBE, .pm_wakeup = 1, + .pin_list = per_cnt, }; static struct resource bfin_rotary_resources[] = { diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index 728cda4..cc80c5b 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c @@ -1094,6 +1094,13 @@ static struct platform_device bfin_device_gpiokeys = { #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #include <linux/platform_data/bfin_rotary.h> +static const u16 per_cnt[] = { + P_CNT_CUD, + P_CNT_CDG, + P_CNT_CZM, + 0 +}; + static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ /*.rotary_down_key = KEY_DOWN,*/ @@ -1102,6 +1109,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { .debounce = 10, /* 0..17 */ .mode = ROT_QUAD_ENC | ROT_DEBE, .pm_wakeup = 1, + .pin_list = per_cnt, }; static struct resource bfin_rotary_resources[] = { diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 8f70f83..0b68781 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c @@ -161,6 +161,13 @@ static struct platform_device bf54x_kpad_device = { #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #include <linux/platform_data/bfin_rotary.h> +static const u16 per_cnt[] = { + P_CNT_CUD, + P_CNT_CDG, + P_CNT_CZM, + 0 +}; + static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ /*.rotary_down_key = KEY_DOWN,*/ @@ -169,6 +176,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { .debounce = 10, /* 0..17 */ .mode = ROT_QUAD_ENC | ROT_DEBE, .pm_wakeup = 1, + .pin_list = per_cnt, }; static struct resource bfin_rotary_resources[] = { diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c index f9dc64d..4ac72c6 100644 --- a/arch/blackfin/mach-bf609/boards/ezkit.c +++ b/arch/blackfin/mach-bf609/boards/ezkit.c @@ -77,6 +77,13 @@ static struct platform_device bfin_isp1760_device = { #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) #include <linux/platform_data/bfin_rotary.h> +static const u16 per_cnt[] = { + P_CNT_CUD, + P_CNT_CDG, + P_CNT_CZM, + 0 +}; + static struct bfin_rotary_platform_data bfin_rotary_data = { /*.rotary_up_key = KEY_UP,*/ /*.rotary_down_key = KEY_DOWN,*/ @@ -84,6 +91,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { .rotary_button_key = KEY_ENTER, .debounce = 10, /* 0..17 */ .mode = ROT_QUAD_ENC | ROT_DEBE, + .pin_list = per_cnt, }; static struct resource bfin_rotary_resources[] = { diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c index 8f6c7cd..dd62fc9 100644 --- a/drivers/input/misc/bfin_rotary.c +++ b/drivers/input/misc/bfin_rotary.c @@ -16,13 +16,6 @@ #include <asm/portmux.h> -static const u16 per_cnt[] = { - P_CNT_CUD, - P_CNT_CDG, - P_CNT_CZM, - 0 -}; - struct bfin_rot { struct input_dev *input; int irq; @@ -102,7 +95,7 @@ static int bfin_rotary_probe(struct platform_device *pdev) return -EINVAL; } - error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); + error = peripheral_request_list(pdata->pin_list, dev_name(&pdev->dev)); if (error) { dev_err(&pdev->dev, "requesting peripherals failed\n"); return error; @@ -197,6 +190,7 @@ out1: static int bfin_rotary_remove(struct platform_device *pdev) { + struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); struct bfin_rot *rotary = platform_get_drvdata(pdev); bfin_write_CNT_CONFIG(0); @@ -204,7 +198,7 @@ static int bfin_rotary_remove(struct platform_device *pdev) free_irq(rotary->irq, pdev); input_unregister_device(rotary->input); - peripheral_free_list(per_cnt); + peripheral_free_list(pdata->pin_list); kfree(rotary); diff --git a/include/linux/platform_data/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h index 8895a75..9882937 100644 --- a/include/linux/platform_data/bfin_rotary.h +++ b/include/linux/platform_data/bfin_rotary.h @@ -40,6 +40,7 @@ struct bfin_rotary_platform_data { unsigned short debounce; /* 0..17 */ unsigned short mode; unsigned short pm_wakeup; + unsigned short *pin_list; }; /* CNT_CONFIG bitmasks */ -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data 2015-01-14 8:54 ` [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data Sonic Zhang @ 2015-02-04 1:22 ` Dmitry Torokhov 2015-02-04 6:28 ` Sonic Zhang 0 siblings, 1 reply; 14+ messages in thread From: Dmitry Torokhov @ 2015-02-04 1:22 UTC (permalink / raw) To: Sonic Zhang Cc: linux-input, Michael Hennerich, adi-buildroot-devel, Sonic Zhang On Wed, Jan 14, 2015 at 04:54:13PM +0800, Sonic Zhang wrote: > From: Sonic Zhang <sonic.zhang@analog.com> > Please tell me why this is needed. Also, should not this be converted to pinctrl infrastructure or I misunderstand what it does? Thanks. > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> > --- > arch/blackfin/mach-bf527/boards/ad7160eval.c | 8 ++++++++ > arch/blackfin/mach-bf527/boards/ezkit.c | 8 ++++++++ > arch/blackfin/mach-bf548/boards/ezkit.c | 8 ++++++++ > arch/blackfin/mach-bf609/boards/ezkit.c | 8 ++++++++ > drivers/input/misc/bfin_rotary.c | 12 +++--------- > include/linux/platform_data/bfin_rotary.h | 1 + > 6 files changed, 36 insertions(+), 9 deletions(-) > > diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c > index beb011b..029a050 100644 > --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c > +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c > @@ -668,6 +668,13 @@ static struct platform_device bfin_sport1_uart_device = { > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > #include <linux/platform_data/bfin_rotary.h> > > +static const u16 per_cnt[] = { > + P_CNT_CUD, > + P_CNT_CDG, > + P_CNT_CZM, > + 0 > +}; > + > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > /*.rotary_down_key = KEY_DOWN,*/ > @@ -676,6 +683,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > .debounce = 10, /* 0..17 */ > .mode = ROT_QUAD_ENC | ROT_DEBE, > .pm_wakeup = 1, > + .pin_list = per_cnt, > }; > > static struct resource bfin_rotary_resources[] = { > diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c > index 728cda4..cc80c5b 100644 > --- a/arch/blackfin/mach-bf527/boards/ezkit.c > +++ b/arch/blackfin/mach-bf527/boards/ezkit.c > @@ -1094,6 +1094,13 @@ static struct platform_device bfin_device_gpiokeys = { > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > #include <linux/platform_data/bfin_rotary.h> > > +static const u16 per_cnt[] = { > + P_CNT_CUD, > + P_CNT_CDG, > + P_CNT_CZM, > + 0 > +}; > + > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > /*.rotary_down_key = KEY_DOWN,*/ > @@ -1102,6 +1109,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > .debounce = 10, /* 0..17 */ > .mode = ROT_QUAD_ENC | ROT_DEBE, > .pm_wakeup = 1, > + .pin_list = per_cnt, > }; > > static struct resource bfin_rotary_resources[] = { > diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c > index 8f70f83..0b68781 100644 > --- a/arch/blackfin/mach-bf548/boards/ezkit.c > +++ b/arch/blackfin/mach-bf548/boards/ezkit.c > @@ -161,6 +161,13 @@ static struct platform_device bf54x_kpad_device = { > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > #include <linux/platform_data/bfin_rotary.h> > > +static const u16 per_cnt[] = { > + P_CNT_CUD, > + P_CNT_CDG, > + P_CNT_CZM, > + 0 > +}; > + > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > /*.rotary_down_key = KEY_DOWN,*/ > @@ -169,6 +176,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > .debounce = 10, /* 0..17 */ > .mode = ROT_QUAD_ENC | ROT_DEBE, > .pm_wakeup = 1, > + .pin_list = per_cnt, > }; > > static struct resource bfin_rotary_resources[] = { > diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c > index f9dc64d..4ac72c6 100644 > --- a/arch/blackfin/mach-bf609/boards/ezkit.c > +++ b/arch/blackfin/mach-bf609/boards/ezkit.c > @@ -77,6 +77,13 @@ static struct platform_device bfin_isp1760_device = { > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > #include <linux/platform_data/bfin_rotary.h> > > +static const u16 per_cnt[] = { > + P_CNT_CUD, > + P_CNT_CDG, > + P_CNT_CZM, > + 0 > +}; > + > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > /*.rotary_down_key = KEY_DOWN,*/ > @@ -84,6 +91,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > .rotary_button_key = KEY_ENTER, > .debounce = 10, /* 0..17 */ > .mode = ROT_QUAD_ENC | ROT_DEBE, > + .pin_list = per_cnt, > }; > > static struct resource bfin_rotary_resources[] = { > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c > index 8f6c7cd..dd62fc9 100644 > --- a/drivers/input/misc/bfin_rotary.c > +++ b/drivers/input/misc/bfin_rotary.c > @@ -16,13 +16,6 @@ > > #include <asm/portmux.h> > > -static const u16 per_cnt[] = { > - P_CNT_CUD, > - P_CNT_CDG, > - P_CNT_CZM, > - 0 > -}; > - > struct bfin_rot { > struct input_dev *input; > int irq; > @@ -102,7 +95,7 @@ static int bfin_rotary_probe(struct platform_device *pdev) > return -EINVAL; > } > > - error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); > + error = peripheral_request_list(pdata->pin_list, dev_name(&pdev->dev)); > if (error) { > dev_err(&pdev->dev, "requesting peripherals failed\n"); > return error; > @@ -197,6 +190,7 @@ out1: > > static int bfin_rotary_remove(struct platform_device *pdev) > { > + struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > bfin_write_CNT_CONFIG(0); > @@ -204,7 +198,7 @@ static int bfin_rotary_remove(struct platform_device *pdev) > > free_irq(rotary->irq, pdev); > input_unregister_device(rotary->input); > - peripheral_free_list(per_cnt); > + peripheral_free_list(pdata->pin_list); > > kfree(rotary); > > diff --git a/include/linux/platform_data/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h > index 8895a75..9882937 100644 > --- a/include/linux/platform_data/bfin_rotary.h > +++ b/include/linux/platform_data/bfin_rotary.h > @@ -40,6 +40,7 @@ struct bfin_rotary_platform_data { > unsigned short debounce; /* 0..17 */ > unsigned short mode; > unsigned short pm_wakeup; > + unsigned short *pin_list; > }; > > /* CNT_CONFIG bitmasks */ > -- > 1.7.9.5 > -- Dmitry ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data 2015-02-04 1:22 ` Dmitry Torokhov @ 2015-02-04 6:28 ` Sonic Zhang 0 siblings, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-02-04 6:28 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input, Michael Hennerich, adi-buildroot-devel, Sonic Zhang Hi Dmitry, On Wed, Feb 4, 2015 at 9:22 AM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On Wed, Jan 14, 2015 at 04:54:13PM +0800, Sonic Zhang wrote: >> From: Sonic Zhang <sonic.zhang@analog.com> >> > > Please tell me why this is needed. Also, should not this be converted to > pinctrl infrastructure or I misunderstand what it does? > There is no pinctrl driver for generic BF5xx processors. BF5xx machine code still use the legacy peripheral_request_list() and peripheral_free_list() API defined in Blackfin archtecture. While BF609 and BF548 has turned to a new pinctrl-adi driver, because they have a new pinmux and gpio device. Now, the same rotary driver should deal with both legacy pinmux API and new pinctrl API. So, I move the board specific pinmux list to platform data. Actually, the lists are useless for bf548 and bf609. I will send a new patch to remove them as well. Regards, > >> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> >> --- >> arch/blackfin/mach-bf527/boards/ad7160eval.c | 8 ++++++++ >> arch/blackfin/mach-bf527/boards/ezkit.c | 8 ++++++++ >> arch/blackfin/mach-bf548/boards/ezkit.c | 8 ++++++++ >> arch/blackfin/mach-bf609/boards/ezkit.c | 8 ++++++++ >> drivers/input/misc/bfin_rotary.c | 12 +++--------- >> include/linux/platform_data/bfin_rotary.h | 1 + >> 6 files changed, 36 insertions(+), 9 deletions(-) >> >> diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c >> index beb011b..029a050 100644 >> --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c >> +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c >> @@ -668,6 +668,13 @@ static struct platform_device bfin_sport1_uart_device = { >> #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) >> #include <linux/platform_data/bfin_rotary.h> >> >> +static const u16 per_cnt[] = { >> + P_CNT_CUD, >> + P_CNT_CDG, >> + P_CNT_CZM, >> + 0 >> +}; >> + >> static struct bfin_rotary_platform_data bfin_rotary_data = { >> /*.rotary_up_key = KEY_UP,*/ >> /*.rotary_down_key = KEY_DOWN,*/ >> @@ -676,6 +683,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { >> .debounce = 10, /* 0..17 */ >> .mode = ROT_QUAD_ENC | ROT_DEBE, >> .pm_wakeup = 1, >> + .pin_list = per_cnt, >> }; >> >> static struct resource bfin_rotary_resources[] = { >> diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c >> index 728cda4..cc80c5b 100644 >> --- a/arch/blackfin/mach-bf527/boards/ezkit.c >> +++ b/arch/blackfin/mach-bf527/boards/ezkit.c >> @@ -1094,6 +1094,13 @@ static struct platform_device bfin_device_gpiokeys = { >> #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) >> #include <linux/platform_data/bfin_rotary.h> >> >> +static const u16 per_cnt[] = { >> + P_CNT_CUD, >> + P_CNT_CDG, >> + P_CNT_CZM, >> + 0 >> +}; >> + >> static struct bfin_rotary_platform_data bfin_rotary_data = { >> /*.rotary_up_key = KEY_UP,*/ >> /*.rotary_down_key = KEY_DOWN,*/ >> @@ -1102,6 +1109,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { >> .debounce = 10, /* 0..17 */ >> .mode = ROT_QUAD_ENC | ROT_DEBE, >> .pm_wakeup = 1, >> + .pin_list = per_cnt, >> }; >> >> static struct resource bfin_rotary_resources[] = { >> diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c >> index 8f70f83..0b68781 100644 >> --- a/arch/blackfin/mach-bf548/boards/ezkit.c >> +++ b/arch/blackfin/mach-bf548/boards/ezkit.c >> @@ -161,6 +161,13 @@ static struct platform_device bf54x_kpad_device = { >> #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) >> #include <linux/platform_data/bfin_rotary.h> >> >> +static const u16 per_cnt[] = { >> + P_CNT_CUD, >> + P_CNT_CDG, >> + P_CNT_CZM, >> + 0 >> +}; >> + >> static struct bfin_rotary_platform_data bfin_rotary_data = { >> /*.rotary_up_key = KEY_UP,*/ >> /*.rotary_down_key = KEY_DOWN,*/ >> @@ -169,6 +176,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { >> .debounce = 10, /* 0..17 */ >> .mode = ROT_QUAD_ENC | ROT_DEBE, >> .pm_wakeup = 1, >> + .pin_list = per_cnt, >> }; >> >> static struct resource bfin_rotary_resources[] = { >> diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c >> index f9dc64d..4ac72c6 100644 >> --- a/arch/blackfin/mach-bf609/boards/ezkit.c >> +++ b/arch/blackfin/mach-bf609/boards/ezkit.c >> @@ -77,6 +77,13 @@ static struct platform_device bfin_isp1760_device = { >> #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) >> #include <linux/platform_data/bfin_rotary.h> >> >> +static const u16 per_cnt[] = { >> + P_CNT_CUD, >> + P_CNT_CDG, >> + P_CNT_CZM, >> + 0 >> +}; >> + >> static struct bfin_rotary_platform_data bfin_rotary_data = { >> /*.rotary_up_key = KEY_UP,*/ >> /*.rotary_down_key = KEY_DOWN,*/ >> @@ -84,6 +91,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { >> .rotary_button_key = KEY_ENTER, >> .debounce = 10, /* 0..17 */ >> .mode = ROT_QUAD_ENC | ROT_DEBE, >> + .pin_list = per_cnt, >> }; >> >> static struct resource bfin_rotary_resources[] = { >> diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c >> index 8f6c7cd..dd62fc9 100644 >> --- a/drivers/input/misc/bfin_rotary.c >> +++ b/drivers/input/misc/bfin_rotary.c >> @@ -16,13 +16,6 @@ >> >> #include <asm/portmux.h> >> >> -static const u16 per_cnt[] = { >> - P_CNT_CUD, >> - P_CNT_CDG, >> - P_CNT_CZM, >> - 0 >> -}; >> - >> struct bfin_rot { >> struct input_dev *input; >> int irq; >> @@ -102,7 +95,7 @@ static int bfin_rotary_probe(struct platform_device *pdev) >> return -EINVAL; >> } >> >> - error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); >> + error = peripheral_request_list(pdata->pin_list, dev_name(&pdev->dev)); >> if (error) { >> dev_err(&pdev->dev, "requesting peripherals failed\n"); >> return error; >> @@ -197,6 +190,7 @@ out1: >> >> static int bfin_rotary_remove(struct platform_device *pdev) >> { >> + struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); >> struct bfin_rot *rotary = platform_get_drvdata(pdev); >> >> bfin_write_CNT_CONFIG(0); >> @@ -204,7 +198,7 @@ static int bfin_rotary_remove(struct platform_device *pdev) >> >> free_irq(rotary->irq, pdev); >> input_unregister_device(rotary->input); >> - peripheral_free_list(per_cnt); >> + peripheral_free_list(pdata->pin_list); >> >> kfree(rotary); >> >> diff --git a/include/linux/platform_data/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h >> index 8895a75..9882937 100644 >> --- a/include/linux/platform_data/bfin_rotary.h >> +++ b/include/linux/platform_data/bfin_rotary.h >> @@ -40,6 +40,7 @@ struct bfin_rotary_platform_data { >> unsigned short debounce; /* 0..17 */ >> unsigned short mode; >> unsigned short pm_wakeup; >> + unsigned short *pin_list; >> }; >> >> /* CNT_CONFIG bitmasks */ >> -- >> 1.7.9.5 >> > > -- > Dmitry ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function 2015-01-14 8:54 [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang 2015-01-14 8:54 ` [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data Sonic Zhang @ 2015-01-14 8:54 ` Sonic Zhang 2015-01-22 6:26 ` Sonic Zhang ` (2 more replies) 2015-01-22 6:25 ` [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang ` (3 subsequent siblings) 5 siblings, 3 replies; 14+ messages in thread From: Sonic Zhang @ 2015-01-14 8:54 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang From: Sonic Zhang <sonic.zhang@analog.com> - use readw and writew to access rotary MMRs - remap rotary register physical address into kernel space in probe v2-changes: - replace kzalloc with devm_kzalloc - replace request_irq with devm_request_irq - remove memory free and irq free from the device remove function Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> --- arch/blackfin/mach-bf527/boards/ad7160eval.c | 5 ++ arch/blackfin/mach-bf527/boards/ezkit.c | 5 ++ arch/blackfin/mach-bf548/boards/ezkit.c | 5 ++ arch/blackfin/mach-bf609/boards/ezkit.c | 5 ++ drivers/input/misc/bfin_rotary.c | 113 +++++++++++++++----------- 5 files changed, 87 insertions(+), 46 deletions(-) diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c index 029a050..68f2a8a 100644 --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c @@ -688,6 +688,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { static struct resource bfin_rotary_resources[] = { { + .start = CNT_CONFIG, + .end = CNT_CONFIG + 0xff, + .flags = IORESOURCE_MEM, + }, + { .start = IRQ_CNT, .end = IRQ_CNT, .flags = IORESOURCE_IRQ, diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index cc80c5b..d4219e8 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c @@ -1114,6 +1114,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { static struct resource bfin_rotary_resources[] = { { + .start = CNT_CONFIG, + .end = CNT_CONFIG + 0xff, + .flags = IORESOURCE_MEM, + }, + { .start = IRQ_CNT, .end = IRQ_CNT, .flags = IORESOURCE_IRQ, diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 0b68781..aaee1af 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c @@ -181,6 +181,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { static struct resource bfin_rotary_resources[] = { { + .start = CNT_CONFIG, + .end = CNT_CONFIG + 0xff, + .flags = IORESOURCE_MEM, + }, + { .start = IRQ_CNT, .end = IRQ_CNT, .flags = IORESOURCE_IRQ, diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c index 4ac72c6..57ce0a8 100644 --- a/arch/blackfin/mach-bf609/boards/ezkit.c +++ b/arch/blackfin/mach-bf609/boards/ezkit.c @@ -96,6 +96,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { static struct resource bfin_rotary_resources[] = { { + .start = CNT_CONFIG, + .end = CNT_CONFIG + 0xff, + .flags = IORESOURCE_MEM, + }, + { .start = IRQ_CNT, .end = IRQ_CNT, .flags = IORESOURCE_IRQ, diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c index dd62fc9..83a69bc 100644 --- a/drivers/input/misc/bfin_rotary.c +++ b/drivers/input/misc/bfin_rotary.c @@ -7,6 +7,7 @@ #include <linux/module.h> #include <linux/interrupt.h> +#include <linux/io.h> #include <linux/irq.h> #include <linux/pm.h> #include <linux/platform_device.h> @@ -16,8 +17,18 @@ #include <asm/portmux.h> +#define CNT_CONFIG_OFF 0 /* CNT Config Offset */ +#define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */ +#define CNT_STATUS_OFF 8 /* CNT Status Offset */ +#define CNT_COMMAND_OFF 12 /* CNT Command Offset */ +#define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */ +#define CNT_COUNTER_OFF 20 /* CNT Counter Offset */ +#define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */ +#define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */ + struct bfin_rot { struct input_dev *input; + void __iomem *base; int irq; unsigned int up_key; unsigned int down_key; @@ -56,14 +67,14 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) struct bfin_rot *rotary = platform_get_drvdata(pdev); int delta; - switch (bfin_read_CNT_STATUS()) { + switch (readw(rotary->base + CNT_STATUS_OFF)) { case ICII: break; case UCII: case DCII: - delta = bfin_read_CNT_COUNTER(); + delta = readl(rotary->base + CNT_COUNTER_OFF); if (delta) report_rotary_event(rotary, delta); break; @@ -76,19 +87,46 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) break; } - bfin_write_CNT_COMMAND(W1LCNT_ZERO); /* Clear COUNTER */ - bfin_write_CNT_STATUS(-1); /* Clear STATUS */ + writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */ + writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */ return IRQ_HANDLED; } static int bfin_rotary_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); struct bfin_rot *rotary; + struct resource *res; struct input_dev *input; int error; + rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL); + if (!rotary) { + dev_err(dev, "fail to malloc bfin_rot\n"); + return -ENOMEM; + } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + rotary->base = devm_ioremap_resource(dev, res); + if (IS_ERR(rotary->base)) + return PTR_ERR(rotary->base); + + rotary->irq = platform_get_irq(pdev, 0); + if (rotary->irq < 0) { + dev_err(dev, "No rotary IRQ specified\n"); + return -ENOENT; + } + + error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, + 0, dev_name(&pdev->dev), pdev); + if (error) { + dev_err(dev, "unable to claim irq %d; error %d\n", + rotary->irq, error); + return error; + } + /* Basic validation */ if ((pdata->rotary_up_key && !pdata->rotary_down_key) || (!pdata->rotary_up_key && pdata->rotary_down_key)) { @@ -97,15 +135,14 @@ static int bfin_rotary_probe(struct platform_device *pdev) error = peripheral_request_list(pdata->pin_list, dev_name(&pdev->dev)); if (error) { - dev_err(&pdev->dev, "requesting peripherals failed\n"); + dev_err(dev, "requesting peripherals failed\n"); return error; } - rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); input = input_allocate_device(); - if (!rotary || !input) { + if (!input) { error = -ENOMEM; - goto out1; + goto out; } rotary->input = input; @@ -115,10 +152,6 @@ static int bfin_rotary_probe(struct platform_device *pdev) rotary->button_key = pdata->rotary_button_key; rotary->rel_code = pdata->rotary_rel_code; - error = rotary->irq = platform_get_irq(pdev, 0); - if (error < 0) - goto out1; - input->name = pdev->name; input->phys = "bfin-rotary/input0"; input->dev.parent = &pdev->dev; @@ -144,45 +177,36 @@ static int bfin_rotary_probe(struct platform_device *pdev) __set_bit(rotary->button_key, input->keybit); } - error = request_irq(rotary->irq, bfin_rotary_isr, - 0, dev_name(&pdev->dev), pdev); - if (error) { - dev_err(&pdev->dev, - "unable to claim irq %d; error %d\n", - rotary->irq, error); - goto out1; - } - error = input_register_device(input); if (error) { - dev_err(&pdev->dev, - "unable to register input device (%d)\n", error); - goto out2; + dev_err(dev, "unable to register input device (%d)\n", error); + goto out; } if (pdata->rotary_button_key) - bfin_write_CNT_IMASK(CZMIE); + writew(CZMIE, rotary->base + CNT_IMASK_OFF); if (pdata->mode & ROT_DEBE) - bfin_write_CNT_DEBOUNCE(pdata->debounce & DPRESCALE); + writew(pdata->debounce & DPRESCALE, + rotary->base + CNT_DEBOUNCE_OFF); if (pdata->mode) - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | - (pdata->mode & ~CNTE)); + writew(readw(rotary->base + CNT_CONFIG_OFF) | + (pdata->mode & ~CNTE), + rotary->base + CNT_CONFIG_OFF); - bfin_write_CNT_IMASK(bfin_read_CNT_IMASK() | UCIE | DCIE); - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | CNTE); + writew(readw(rotary->base + CNT_IMASK_OFF) | UCIE | DCIE, + rotary->base + CNT_IMASK_OFF); + writew(readw(rotary->base + CNT_CONFIG_OFF) | CNTE, + rotary->base + CNT_CONFIG_OFF); platform_set_drvdata(pdev, rotary); device_init_wakeup(&pdev->dev, 1); return 0; -out2: - free_irq(rotary->irq, pdev); -out1: +out: input_free_device(input); - kfree(rotary); peripheral_free_list(per_cnt); return error; @@ -193,15 +217,12 @@ static int bfin_rotary_remove(struct platform_device *pdev) struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); struct bfin_rot *rotary = platform_get_drvdata(pdev); - bfin_write_CNT_CONFIG(0); - bfin_write_CNT_IMASK(0); + writew(0, rotary->base + CNT_CONFIG_OFF); + writew(0, rotary->base + CNT_IMASK_OFF); - free_irq(rotary->irq, pdev); input_unregister_device(rotary->input); peripheral_free_list(pdata->pin_list); - kfree(rotary); - return 0; } @@ -211,9 +232,9 @@ static int bfin_rotary_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct bfin_rot *rotary = platform_get_drvdata(pdev); - rotary->cnt_config = bfin_read_CNT_CONFIG(); - rotary->cnt_imask = bfin_read_CNT_IMASK(); - rotary->cnt_debounce = bfin_read_CNT_DEBOUNCE(); + rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF); + rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF); + rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF); if (device_may_wakeup(&pdev->dev)) enable_irq_wake(rotary->irq); @@ -226,15 +247,15 @@ static int bfin_rotary_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct bfin_rot *rotary = platform_get_drvdata(pdev); - bfin_write_CNT_DEBOUNCE(rotary->cnt_debounce); - bfin_write_CNT_IMASK(rotary->cnt_imask); - bfin_write_CNT_CONFIG(rotary->cnt_config & ~CNTE); + writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF); + writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF); + writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF); if (device_may_wakeup(&pdev->dev)) disable_irq_wake(rotary->irq); if (rotary->cnt_config & CNTE) - bfin_write_CNT_CONFIG(rotary->cnt_config); + writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF); return 0; } -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function 2015-01-14 8:54 ` [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function Sonic Zhang @ 2015-01-22 6:26 ` Sonic Zhang 2015-01-29 9:35 ` Sonic Zhang 2015-02-04 1:24 ` Dmitry Torokhov 2 siblings, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-01-22 6:26 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang PING On Wed, Jan 14, 2015 at 4:54 PM, Sonic Zhang <sonic.adi@gmail.com> wrote: > From: Sonic Zhang <sonic.zhang@analog.com> > > - use readw and writew to access rotary MMRs > - remap rotary register physical address into kernel space in probe > > v2-changes: > - replace kzalloc with devm_kzalloc > - replace request_irq with devm_request_irq > - remove memory free and irq free from the device remove function > > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> > --- > arch/blackfin/mach-bf527/boards/ad7160eval.c | 5 ++ > arch/blackfin/mach-bf527/boards/ezkit.c | 5 ++ > arch/blackfin/mach-bf548/boards/ezkit.c | 5 ++ > arch/blackfin/mach-bf609/boards/ezkit.c | 5 ++ > drivers/input/misc/bfin_rotary.c | 113 +++++++++++++++----------- > 5 files changed, 87 insertions(+), 46 deletions(-) > > diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c > index 029a050..68f2a8a 100644 > --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c > +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c > @@ -688,6 +688,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c > index cc80c5b..d4219e8 100644 > --- a/arch/blackfin/mach-bf527/boards/ezkit.c > +++ b/arch/blackfin/mach-bf527/boards/ezkit.c > @@ -1114,6 +1114,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c > index 0b68781..aaee1af 100644 > --- a/arch/blackfin/mach-bf548/boards/ezkit.c > +++ b/arch/blackfin/mach-bf548/boards/ezkit.c > @@ -181,6 +181,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c > index 4ac72c6..57ce0a8 100644 > --- a/arch/blackfin/mach-bf609/boards/ezkit.c > +++ b/arch/blackfin/mach-bf609/boards/ezkit.c > @@ -96,6 +96,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c > index dd62fc9..83a69bc 100644 > --- a/drivers/input/misc/bfin_rotary.c > +++ b/drivers/input/misc/bfin_rotary.c > @@ -7,6 +7,7 @@ > > #include <linux/module.h> > #include <linux/interrupt.h> > +#include <linux/io.h> > #include <linux/irq.h> > #include <linux/pm.h> > #include <linux/platform_device.h> > @@ -16,8 +17,18 @@ > > #include <asm/portmux.h> > > +#define CNT_CONFIG_OFF 0 /* CNT Config Offset */ > +#define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */ > +#define CNT_STATUS_OFF 8 /* CNT Status Offset */ > +#define CNT_COMMAND_OFF 12 /* CNT Command Offset */ > +#define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */ > +#define CNT_COUNTER_OFF 20 /* CNT Counter Offset */ > +#define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */ > +#define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */ > + > struct bfin_rot { > struct input_dev *input; > + void __iomem *base; > int irq; > unsigned int up_key; > unsigned int down_key; > @@ -56,14 +67,14 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) > struct bfin_rot *rotary = platform_get_drvdata(pdev); > int delta; > > - switch (bfin_read_CNT_STATUS()) { > + switch (readw(rotary->base + CNT_STATUS_OFF)) { > > case ICII: > break; > > case UCII: > case DCII: > - delta = bfin_read_CNT_COUNTER(); > + delta = readl(rotary->base + CNT_COUNTER_OFF); > if (delta) > report_rotary_event(rotary, delta); > break; > @@ -76,19 +87,46 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) > break; > } > > - bfin_write_CNT_COMMAND(W1LCNT_ZERO); /* Clear COUNTER */ > - bfin_write_CNT_STATUS(-1); /* Clear STATUS */ > + writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */ > + writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */ > > return IRQ_HANDLED; > } > > static int bfin_rotary_probe(struct platform_device *pdev) > { > + struct device *dev = &pdev->dev; > struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); > struct bfin_rot *rotary; > + struct resource *res; > struct input_dev *input; > int error; > > + rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL); > + if (!rotary) { > + dev_err(dev, "fail to malloc bfin_rot\n"); > + return -ENOMEM; > + } > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + rotary->base = devm_ioremap_resource(dev, res); > + if (IS_ERR(rotary->base)) > + return PTR_ERR(rotary->base); > + > + rotary->irq = platform_get_irq(pdev, 0); > + if (rotary->irq < 0) { > + dev_err(dev, "No rotary IRQ specified\n"); > + return -ENOENT; > + } > + > + error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, > + 0, dev_name(&pdev->dev), pdev); > + if (error) { > + dev_err(dev, "unable to claim irq %d; error %d\n", > + rotary->irq, error); > + return error; > + } > + > /* Basic validation */ > if ((pdata->rotary_up_key && !pdata->rotary_down_key) || > (!pdata->rotary_up_key && pdata->rotary_down_key)) { > @@ -97,15 +135,14 @@ static int bfin_rotary_probe(struct platform_device *pdev) > > error = peripheral_request_list(pdata->pin_list, dev_name(&pdev->dev)); > if (error) { > - dev_err(&pdev->dev, "requesting peripherals failed\n"); > + dev_err(dev, "requesting peripherals failed\n"); > return error; > } > > - rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); > input = input_allocate_device(); > - if (!rotary || !input) { > + if (!input) { > error = -ENOMEM; > - goto out1; > + goto out; > } > > rotary->input = input; > @@ -115,10 +152,6 @@ static int bfin_rotary_probe(struct platform_device *pdev) > rotary->button_key = pdata->rotary_button_key; > rotary->rel_code = pdata->rotary_rel_code; > > - error = rotary->irq = platform_get_irq(pdev, 0); > - if (error < 0) > - goto out1; > - > input->name = pdev->name; > input->phys = "bfin-rotary/input0"; > input->dev.parent = &pdev->dev; > @@ -144,45 +177,36 @@ static int bfin_rotary_probe(struct platform_device *pdev) > __set_bit(rotary->button_key, input->keybit); > } > > - error = request_irq(rotary->irq, bfin_rotary_isr, > - 0, dev_name(&pdev->dev), pdev); > - if (error) { > - dev_err(&pdev->dev, > - "unable to claim irq %d; error %d\n", > - rotary->irq, error); > - goto out1; > - } > - > error = input_register_device(input); > if (error) { > - dev_err(&pdev->dev, > - "unable to register input device (%d)\n", error); > - goto out2; > + dev_err(dev, "unable to register input device (%d)\n", error); > + goto out; > } > > if (pdata->rotary_button_key) > - bfin_write_CNT_IMASK(CZMIE); > + writew(CZMIE, rotary->base + CNT_IMASK_OFF); > > if (pdata->mode & ROT_DEBE) > - bfin_write_CNT_DEBOUNCE(pdata->debounce & DPRESCALE); > + writew(pdata->debounce & DPRESCALE, > + rotary->base + CNT_DEBOUNCE_OFF); > > if (pdata->mode) > - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | > - (pdata->mode & ~CNTE)); > + writew(readw(rotary->base + CNT_CONFIG_OFF) | > + (pdata->mode & ~CNTE), > + rotary->base + CNT_CONFIG_OFF); > > - bfin_write_CNT_IMASK(bfin_read_CNT_IMASK() | UCIE | DCIE); > - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | CNTE); > + writew(readw(rotary->base + CNT_IMASK_OFF) | UCIE | DCIE, > + rotary->base + CNT_IMASK_OFF); > + writew(readw(rotary->base + CNT_CONFIG_OFF) | CNTE, > + rotary->base + CNT_CONFIG_OFF); > > platform_set_drvdata(pdev, rotary); > device_init_wakeup(&pdev->dev, 1); > > return 0; > > -out2: > - free_irq(rotary->irq, pdev); > -out1: > +out: > input_free_device(input); > - kfree(rotary); > peripheral_free_list(per_cnt); > > return error; > @@ -193,15 +217,12 @@ static int bfin_rotary_remove(struct platform_device *pdev) > struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - bfin_write_CNT_CONFIG(0); > - bfin_write_CNT_IMASK(0); > + writew(0, rotary->base + CNT_CONFIG_OFF); > + writew(0, rotary->base + CNT_IMASK_OFF); > > - free_irq(rotary->irq, pdev); > input_unregister_device(rotary->input); > peripheral_free_list(pdata->pin_list); > > - kfree(rotary); > - > return 0; > } > > @@ -211,9 +232,9 @@ static int bfin_rotary_suspend(struct device *dev) > struct platform_device *pdev = to_platform_device(dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - rotary->cnt_config = bfin_read_CNT_CONFIG(); > - rotary->cnt_imask = bfin_read_CNT_IMASK(); > - rotary->cnt_debounce = bfin_read_CNT_DEBOUNCE(); > + rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF); > + rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF); > + rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF); > > if (device_may_wakeup(&pdev->dev)) > enable_irq_wake(rotary->irq); > @@ -226,15 +247,15 @@ static int bfin_rotary_resume(struct device *dev) > struct platform_device *pdev = to_platform_device(dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - bfin_write_CNT_DEBOUNCE(rotary->cnt_debounce); > - bfin_write_CNT_IMASK(rotary->cnt_imask); > - bfin_write_CNT_CONFIG(rotary->cnt_config & ~CNTE); > + writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF); > + writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF); > + writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF); > > if (device_may_wakeup(&pdev->dev)) > disable_irq_wake(rotary->irq); > > if (rotary->cnt_config & CNTE) > - bfin_write_CNT_CONFIG(rotary->cnt_config); > + writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF); > > return 0; > } > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function 2015-01-14 8:54 ` [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function Sonic Zhang 2015-01-22 6:26 ` Sonic Zhang @ 2015-01-29 9:35 ` Sonic Zhang 2015-02-04 1:24 ` Dmitry Torokhov 2 siblings, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-01-29 9:35 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang Ping again. On Wed, Jan 14, 2015 at 4:54 PM, Sonic Zhang <sonic.adi@gmail.com> wrote: > From: Sonic Zhang <sonic.zhang@analog.com> > > - use readw and writew to access rotary MMRs > - remap rotary register physical address into kernel space in probe > > v2-changes: > - replace kzalloc with devm_kzalloc > - replace request_irq with devm_request_irq > - remove memory free and irq free from the device remove function > > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> > --- > arch/blackfin/mach-bf527/boards/ad7160eval.c | 5 ++ > arch/blackfin/mach-bf527/boards/ezkit.c | 5 ++ > arch/blackfin/mach-bf548/boards/ezkit.c | 5 ++ > arch/blackfin/mach-bf609/boards/ezkit.c | 5 ++ > drivers/input/misc/bfin_rotary.c | 113 +++++++++++++++----------- > 5 files changed, 87 insertions(+), 46 deletions(-) > > diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c > index 029a050..68f2a8a 100644 > --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c > +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c > @@ -688,6 +688,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c > index cc80c5b..d4219e8 100644 > --- a/arch/blackfin/mach-bf527/boards/ezkit.c > +++ b/arch/blackfin/mach-bf527/boards/ezkit.c > @@ -1114,6 +1114,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c > index 0b68781..aaee1af 100644 > --- a/arch/blackfin/mach-bf548/boards/ezkit.c > +++ b/arch/blackfin/mach-bf548/boards/ezkit.c > @@ -181,6 +181,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c > index 4ac72c6..57ce0a8 100644 > --- a/arch/blackfin/mach-bf609/boards/ezkit.c > +++ b/arch/blackfin/mach-bf609/boards/ezkit.c > @@ -96,6 +96,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c > index dd62fc9..83a69bc 100644 > --- a/drivers/input/misc/bfin_rotary.c > +++ b/drivers/input/misc/bfin_rotary.c > @@ -7,6 +7,7 @@ > > #include <linux/module.h> > #include <linux/interrupt.h> > +#include <linux/io.h> > #include <linux/irq.h> > #include <linux/pm.h> > #include <linux/platform_device.h> > @@ -16,8 +17,18 @@ > > #include <asm/portmux.h> > > +#define CNT_CONFIG_OFF 0 /* CNT Config Offset */ > +#define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */ > +#define CNT_STATUS_OFF 8 /* CNT Status Offset */ > +#define CNT_COMMAND_OFF 12 /* CNT Command Offset */ > +#define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */ > +#define CNT_COUNTER_OFF 20 /* CNT Counter Offset */ > +#define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */ > +#define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */ > + > struct bfin_rot { > struct input_dev *input; > + void __iomem *base; > int irq; > unsigned int up_key; > unsigned int down_key; > @@ -56,14 +67,14 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) > struct bfin_rot *rotary = platform_get_drvdata(pdev); > int delta; > > - switch (bfin_read_CNT_STATUS()) { > + switch (readw(rotary->base + CNT_STATUS_OFF)) { > > case ICII: > break; > > case UCII: > case DCII: > - delta = bfin_read_CNT_COUNTER(); > + delta = readl(rotary->base + CNT_COUNTER_OFF); > if (delta) > report_rotary_event(rotary, delta); > break; > @@ -76,19 +87,46 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) > break; > } > > - bfin_write_CNT_COMMAND(W1LCNT_ZERO); /* Clear COUNTER */ > - bfin_write_CNT_STATUS(-1); /* Clear STATUS */ > + writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */ > + writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */ > > return IRQ_HANDLED; > } > > static int bfin_rotary_probe(struct platform_device *pdev) > { > + struct device *dev = &pdev->dev; > struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); > struct bfin_rot *rotary; > + struct resource *res; > struct input_dev *input; > int error; > > + rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL); > + if (!rotary) { > + dev_err(dev, "fail to malloc bfin_rot\n"); > + return -ENOMEM; > + } > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + rotary->base = devm_ioremap_resource(dev, res); > + if (IS_ERR(rotary->base)) > + return PTR_ERR(rotary->base); > + > + rotary->irq = platform_get_irq(pdev, 0); > + if (rotary->irq < 0) { > + dev_err(dev, "No rotary IRQ specified\n"); > + return -ENOENT; > + } > + > + error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, > + 0, dev_name(&pdev->dev), pdev); > + if (error) { > + dev_err(dev, "unable to claim irq %d; error %d\n", > + rotary->irq, error); > + return error; > + } > + > /* Basic validation */ > if ((pdata->rotary_up_key && !pdata->rotary_down_key) || > (!pdata->rotary_up_key && pdata->rotary_down_key)) { > @@ -97,15 +135,14 @@ static int bfin_rotary_probe(struct platform_device *pdev) > > error = peripheral_request_list(pdata->pin_list, dev_name(&pdev->dev)); > if (error) { > - dev_err(&pdev->dev, "requesting peripherals failed\n"); > + dev_err(dev, "requesting peripherals failed\n"); > return error; > } > > - rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); > input = input_allocate_device(); > - if (!rotary || !input) { > + if (!input) { > error = -ENOMEM; > - goto out1; > + goto out; > } > > rotary->input = input; > @@ -115,10 +152,6 @@ static int bfin_rotary_probe(struct platform_device *pdev) > rotary->button_key = pdata->rotary_button_key; > rotary->rel_code = pdata->rotary_rel_code; > > - error = rotary->irq = platform_get_irq(pdev, 0); > - if (error < 0) > - goto out1; > - > input->name = pdev->name; > input->phys = "bfin-rotary/input0"; > input->dev.parent = &pdev->dev; > @@ -144,45 +177,36 @@ static int bfin_rotary_probe(struct platform_device *pdev) > __set_bit(rotary->button_key, input->keybit); > } > > - error = request_irq(rotary->irq, bfin_rotary_isr, > - 0, dev_name(&pdev->dev), pdev); > - if (error) { > - dev_err(&pdev->dev, > - "unable to claim irq %d; error %d\n", > - rotary->irq, error); > - goto out1; > - } > - > error = input_register_device(input); > if (error) { > - dev_err(&pdev->dev, > - "unable to register input device (%d)\n", error); > - goto out2; > + dev_err(dev, "unable to register input device (%d)\n", error); > + goto out; > } > > if (pdata->rotary_button_key) > - bfin_write_CNT_IMASK(CZMIE); > + writew(CZMIE, rotary->base + CNT_IMASK_OFF); > > if (pdata->mode & ROT_DEBE) > - bfin_write_CNT_DEBOUNCE(pdata->debounce & DPRESCALE); > + writew(pdata->debounce & DPRESCALE, > + rotary->base + CNT_DEBOUNCE_OFF); > > if (pdata->mode) > - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | > - (pdata->mode & ~CNTE)); > + writew(readw(rotary->base + CNT_CONFIG_OFF) | > + (pdata->mode & ~CNTE), > + rotary->base + CNT_CONFIG_OFF); > > - bfin_write_CNT_IMASK(bfin_read_CNT_IMASK() | UCIE | DCIE); > - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | CNTE); > + writew(readw(rotary->base + CNT_IMASK_OFF) | UCIE | DCIE, > + rotary->base + CNT_IMASK_OFF); > + writew(readw(rotary->base + CNT_CONFIG_OFF) | CNTE, > + rotary->base + CNT_CONFIG_OFF); > > platform_set_drvdata(pdev, rotary); > device_init_wakeup(&pdev->dev, 1); > > return 0; > > -out2: > - free_irq(rotary->irq, pdev); > -out1: > +out: > input_free_device(input); > - kfree(rotary); > peripheral_free_list(per_cnt); > > return error; > @@ -193,15 +217,12 @@ static int bfin_rotary_remove(struct platform_device *pdev) > struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - bfin_write_CNT_CONFIG(0); > - bfin_write_CNT_IMASK(0); > + writew(0, rotary->base + CNT_CONFIG_OFF); > + writew(0, rotary->base + CNT_IMASK_OFF); > > - free_irq(rotary->irq, pdev); > input_unregister_device(rotary->input); > peripheral_free_list(pdata->pin_list); > > - kfree(rotary); > - > return 0; > } > > @@ -211,9 +232,9 @@ static int bfin_rotary_suspend(struct device *dev) > struct platform_device *pdev = to_platform_device(dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - rotary->cnt_config = bfin_read_CNT_CONFIG(); > - rotary->cnt_imask = bfin_read_CNT_IMASK(); > - rotary->cnt_debounce = bfin_read_CNT_DEBOUNCE(); > + rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF); > + rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF); > + rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF); > > if (device_may_wakeup(&pdev->dev)) > enable_irq_wake(rotary->irq); > @@ -226,15 +247,15 @@ static int bfin_rotary_resume(struct device *dev) > struct platform_device *pdev = to_platform_device(dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - bfin_write_CNT_DEBOUNCE(rotary->cnt_debounce); > - bfin_write_CNT_IMASK(rotary->cnt_imask); > - bfin_write_CNT_CONFIG(rotary->cnt_config & ~CNTE); > + writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF); > + writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF); > + writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF); > > if (device_may_wakeup(&pdev->dev)) > disable_irq_wake(rotary->irq); > > if (rotary->cnt_config & CNTE) > - bfin_write_CNT_CONFIG(rotary->cnt_config); > + writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF); > > return 0; > } > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function 2015-01-14 8:54 ` [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function Sonic Zhang 2015-01-22 6:26 ` Sonic Zhang 2015-01-29 9:35 ` Sonic Zhang @ 2015-02-04 1:24 ` Dmitry Torokhov 2015-02-04 6:31 ` Sonic Zhang 2015-02-04 7:23 ` Sonic Zhang 2 siblings, 2 replies; 14+ messages in thread From: Dmitry Torokhov @ 2015-02-04 1:24 UTC (permalink / raw) To: Sonic Zhang Cc: linux-input, Michael Hennerich, adi-buildroot-devel, Sonic Zhang On Wed, Jan 14, 2015 at 04:54:14PM +0800, Sonic Zhang wrote: > From: Sonic Zhang <sonic.zhang@analog.com> > > - use readw and writew to access rotary MMRs > - remap rotary register physical address into kernel space in probe > > v2-changes: > - replace kzalloc with devm_kzalloc > - replace request_irq with devm_request_irq > - remove memory free and irq free from the device remove function This needs to be split in 2 as these are 2 separate changes - using generic IO accessors and converting to use managed resources. By the way, you can also use devm_input_allocate_device() and not need free/unregister it. Thanks. > > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> > --- > arch/blackfin/mach-bf527/boards/ad7160eval.c | 5 ++ > arch/blackfin/mach-bf527/boards/ezkit.c | 5 ++ > arch/blackfin/mach-bf548/boards/ezkit.c | 5 ++ > arch/blackfin/mach-bf609/boards/ezkit.c | 5 ++ > drivers/input/misc/bfin_rotary.c | 113 +++++++++++++++----------- > 5 files changed, 87 insertions(+), 46 deletions(-) > > diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c > index 029a050..68f2a8a 100644 > --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c > +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c > @@ -688,6 +688,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c > index cc80c5b..d4219e8 100644 > --- a/arch/blackfin/mach-bf527/boards/ezkit.c > +++ b/arch/blackfin/mach-bf527/boards/ezkit.c > @@ -1114,6 +1114,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c > index 0b68781..aaee1af 100644 > --- a/arch/blackfin/mach-bf548/boards/ezkit.c > +++ b/arch/blackfin/mach-bf548/boards/ezkit.c > @@ -181,6 +181,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c > index 4ac72c6..57ce0a8 100644 > --- a/arch/blackfin/mach-bf609/boards/ezkit.c > +++ b/arch/blackfin/mach-bf609/boards/ezkit.c > @@ -96,6 +96,11 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { > > static struct resource bfin_rotary_resources[] = { > { > + .start = CNT_CONFIG, > + .end = CNT_CONFIG + 0xff, > + .flags = IORESOURCE_MEM, > + }, > + { > .start = IRQ_CNT, > .end = IRQ_CNT, > .flags = IORESOURCE_IRQ, > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c > index dd62fc9..83a69bc 100644 > --- a/drivers/input/misc/bfin_rotary.c > +++ b/drivers/input/misc/bfin_rotary.c > @@ -7,6 +7,7 @@ > > #include <linux/module.h> > #include <linux/interrupt.h> > +#include <linux/io.h> > #include <linux/irq.h> > #include <linux/pm.h> > #include <linux/platform_device.h> > @@ -16,8 +17,18 @@ > > #include <asm/portmux.h> > > +#define CNT_CONFIG_OFF 0 /* CNT Config Offset */ > +#define CNT_IMASK_OFF 4 /* CNT Interrupt Mask Offset */ > +#define CNT_STATUS_OFF 8 /* CNT Status Offset */ > +#define CNT_COMMAND_OFF 12 /* CNT Command Offset */ > +#define CNT_DEBOUNCE_OFF 16 /* CNT Debounce Offset */ > +#define CNT_COUNTER_OFF 20 /* CNT Counter Offset */ > +#define CNT_MAX_OFF 24 /* CNT Maximum Count Offset */ > +#define CNT_MIN_OFF 28 /* CNT Minimum Count Offset */ > + > struct bfin_rot { > struct input_dev *input; > + void __iomem *base; > int irq; > unsigned int up_key; > unsigned int down_key; > @@ -56,14 +67,14 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) > struct bfin_rot *rotary = platform_get_drvdata(pdev); > int delta; > > - switch (bfin_read_CNT_STATUS()) { > + switch (readw(rotary->base + CNT_STATUS_OFF)) { > > case ICII: > break; > > case UCII: > case DCII: > - delta = bfin_read_CNT_COUNTER(); > + delta = readl(rotary->base + CNT_COUNTER_OFF); > if (delta) > report_rotary_event(rotary, delta); > break; > @@ -76,19 +87,46 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) > break; > } > > - bfin_write_CNT_COMMAND(W1LCNT_ZERO); /* Clear COUNTER */ > - bfin_write_CNT_STATUS(-1); /* Clear STATUS */ > + writew(W1LCNT_ZERO, rotary->base + CNT_COMMAND_OFF); /* Clear COUNTER */ > + writew(-1, rotary->base + CNT_STATUS_OFF); /* Clear STATUS */ > > return IRQ_HANDLED; > } > > static int bfin_rotary_probe(struct platform_device *pdev) > { > + struct device *dev = &pdev->dev; > struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); > struct bfin_rot *rotary; > + struct resource *res; > struct input_dev *input; > int error; > > + rotary = devm_kzalloc(dev, sizeof(struct bfin_rot), GFP_KERNEL); > + if (!rotary) { > + dev_err(dev, "fail to malloc bfin_rot\n"); > + return -ENOMEM; > + } > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + rotary->base = devm_ioremap_resource(dev, res); > + if (IS_ERR(rotary->base)) > + return PTR_ERR(rotary->base); > + > + rotary->irq = platform_get_irq(pdev, 0); > + if (rotary->irq < 0) { > + dev_err(dev, "No rotary IRQ specified\n"); > + return -ENOENT; > + } > + > + error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, > + 0, dev_name(&pdev->dev), pdev); > + if (error) { > + dev_err(dev, "unable to claim irq %d; error %d\n", > + rotary->irq, error); > + return error; > + } > + > /* Basic validation */ > if ((pdata->rotary_up_key && !pdata->rotary_down_key) || > (!pdata->rotary_up_key && pdata->rotary_down_key)) { > @@ -97,15 +135,14 @@ static int bfin_rotary_probe(struct platform_device *pdev) > > error = peripheral_request_list(pdata->pin_list, dev_name(&pdev->dev)); > if (error) { > - dev_err(&pdev->dev, "requesting peripherals failed\n"); > + dev_err(dev, "requesting peripherals failed\n"); > return error; > } > > - rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); > input = input_allocate_device(); > - if (!rotary || !input) { > + if (!input) { > error = -ENOMEM; > - goto out1; > + goto out; > } > > rotary->input = input; > @@ -115,10 +152,6 @@ static int bfin_rotary_probe(struct platform_device *pdev) > rotary->button_key = pdata->rotary_button_key; > rotary->rel_code = pdata->rotary_rel_code; > > - error = rotary->irq = platform_get_irq(pdev, 0); > - if (error < 0) > - goto out1; > - > input->name = pdev->name; > input->phys = "bfin-rotary/input0"; > input->dev.parent = &pdev->dev; > @@ -144,45 +177,36 @@ static int bfin_rotary_probe(struct platform_device *pdev) > __set_bit(rotary->button_key, input->keybit); > } > > - error = request_irq(rotary->irq, bfin_rotary_isr, > - 0, dev_name(&pdev->dev), pdev); > - if (error) { > - dev_err(&pdev->dev, > - "unable to claim irq %d; error %d\n", > - rotary->irq, error); > - goto out1; > - } > - > error = input_register_device(input); > if (error) { > - dev_err(&pdev->dev, > - "unable to register input device (%d)\n", error); > - goto out2; > + dev_err(dev, "unable to register input device (%d)\n", error); > + goto out; > } > > if (pdata->rotary_button_key) > - bfin_write_CNT_IMASK(CZMIE); > + writew(CZMIE, rotary->base + CNT_IMASK_OFF); > > if (pdata->mode & ROT_DEBE) > - bfin_write_CNT_DEBOUNCE(pdata->debounce & DPRESCALE); > + writew(pdata->debounce & DPRESCALE, > + rotary->base + CNT_DEBOUNCE_OFF); > > if (pdata->mode) > - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | > - (pdata->mode & ~CNTE)); > + writew(readw(rotary->base + CNT_CONFIG_OFF) | > + (pdata->mode & ~CNTE), > + rotary->base + CNT_CONFIG_OFF); > > - bfin_write_CNT_IMASK(bfin_read_CNT_IMASK() | UCIE | DCIE); > - bfin_write_CNT_CONFIG(bfin_read_CNT_CONFIG() | CNTE); > + writew(readw(rotary->base + CNT_IMASK_OFF) | UCIE | DCIE, > + rotary->base + CNT_IMASK_OFF); > + writew(readw(rotary->base + CNT_CONFIG_OFF) | CNTE, > + rotary->base + CNT_CONFIG_OFF); > > platform_set_drvdata(pdev, rotary); > device_init_wakeup(&pdev->dev, 1); > > return 0; > > -out2: > - free_irq(rotary->irq, pdev); > -out1: > +out: > input_free_device(input); > - kfree(rotary); > peripheral_free_list(per_cnt); > > return error; > @@ -193,15 +217,12 @@ static int bfin_rotary_remove(struct platform_device *pdev) > struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - bfin_write_CNT_CONFIG(0); > - bfin_write_CNT_IMASK(0); > + writew(0, rotary->base + CNT_CONFIG_OFF); > + writew(0, rotary->base + CNT_IMASK_OFF); > > - free_irq(rotary->irq, pdev); > input_unregister_device(rotary->input); > peripheral_free_list(pdata->pin_list); > > - kfree(rotary); > - > return 0; > } > > @@ -211,9 +232,9 @@ static int bfin_rotary_suspend(struct device *dev) > struct platform_device *pdev = to_platform_device(dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - rotary->cnt_config = bfin_read_CNT_CONFIG(); > - rotary->cnt_imask = bfin_read_CNT_IMASK(); > - rotary->cnt_debounce = bfin_read_CNT_DEBOUNCE(); > + rotary->cnt_config = readw(rotary->base + CNT_CONFIG_OFF); > + rotary->cnt_imask = readw(rotary->base + CNT_IMASK_OFF); > + rotary->cnt_debounce = readw(rotary->base + CNT_DEBOUNCE_OFF); > > if (device_may_wakeup(&pdev->dev)) > enable_irq_wake(rotary->irq); > @@ -226,15 +247,15 @@ static int bfin_rotary_resume(struct device *dev) > struct platform_device *pdev = to_platform_device(dev); > struct bfin_rot *rotary = platform_get_drvdata(pdev); > > - bfin_write_CNT_DEBOUNCE(rotary->cnt_debounce); > - bfin_write_CNT_IMASK(rotary->cnt_imask); > - bfin_write_CNT_CONFIG(rotary->cnt_config & ~CNTE); > + writew(rotary->cnt_debounce, rotary->base + CNT_DEBOUNCE_OFF); > + writew(rotary->cnt_imask, rotary->base + CNT_IMASK_OFF); > + writew(rotary->cnt_config & ~CNTE, rotary->base + CNT_CONFIG_OFF); > > if (device_may_wakeup(&pdev->dev)) > disable_irq_wake(rotary->irq); > > if (rotary->cnt_config & CNTE) > - bfin_write_CNT_CONFIG(rotary->cnt_config); > + writew(rotary->cnt_config, rotary->base + CNT_CONFIG_OFF); > > return 0; > } > -- > 1.7.9.5 > -- Dmitry ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function 2015-02-04 1:24 ` Dmitry Torokhov @ 2015-02-04 6:31 ` Sonic Zhang 2015-02-04 7:23 ` Sonic Zhang 1 sibling, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-02-04 6:31 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input, Michael Hennerich, adi-buildroot-devel, Sonic Zhang Hi Dmitry, On Wed, Feb 4, 2015 at 9:24 AM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On Wed, Jan 14, 2015 at 04:54:14PM +0800, Sonic Zhang wrote: >> From: Sonic Zhang <sonic.zhang@analog.com> >> >> - use readw and writew to access rotary MMRs >> - remap rotary register physical address into kernel space in probe >> >> v2-changes: >> - replace kzalloc with devm_kzalloc >> - replace request_irq with devm_request_irq >> - remove memory free and irq free from the device remove function > > This needs to be split in 2 as these are 2 separate changes - using > generic IO accessors and converting to use managed resources. > > By the way, you can also use devm_input_allocate_device() and not need > free/unregister it. > OK. I will separate this patch and send out new ones. Thanks, Sonic ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function 2015-02-04 1:24 ` Dmitry Torokhov 2015-02-04 6:31 ` Sonic Zhang @ 2015-02-04 7:23 ` Sonic Zhang 1 sibling, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-02-04 7:23 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input, Michael Hennerich, adi-buildroot-devel, Sonic Zhang Hi Dmitry, On Wed, Feb 4, 2015 at 9:24 AM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On Wed, Jan 14, 2015 at 04:54:14PM +0800, Sonic Zhang wrote: >> From: Sonic Zhang <sonic.zhang@analog.com> >> >> - use readw and writew to access rotary MMRs >> - remap rotary register physical address into kernel space in probe >> >> v2-changes: >> - replace kzalloc with devm_kzalloc >> - replace request_irq with devm_request_irq >> - remove memory free and irq free from the device remove function > > This needs to be split in 2 as these are 2 separate changes - using > generic IO accessors and converting to use managed resources. > > By the way, you can also use devm_input_allocate_device() and not need > free/unregister it. > OK. I will separate this patch and send out new ones. Thanks, Sonic ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path 2015-01-14 8:54 [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang 2015-01-14 8:54 ` [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data Sonic Zhang 2015-01-14 8:54 ` [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function Sonic Zhang @ 2015-01-22 6:25 ` Sonic Zhang 2015-01-29 9:35 ` Sonic Zhang ` (2 subsequent siblings) 5 siblings, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-01-22 6:25 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang PING On Wed, Jan 14, 2015 at 4:54 PM, Sonic Zhang <sonic.adi@gmail.com> wrote: > From: Sonic Zhang <sonic.zhang@analog.com> > > The platform data definition of the rotary driver should be generic for all architectures. > > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> > --- > arch/blackfin/mach-bf527/boards/ad7160eval.c | 2 +- > arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- > arch/blackfin/mach-bf548/boards/ezkit.c | 2 +- > arch/blackfin/mach-bf609/boards/ezkit.c | 2 +- > drivers/input/misc/bfin_rotary.c | 2 +- > .../linux/platform_data}/bfin_rotary.h | 0 > 6 files changed, 5 insertions(+), 5 deletions(-) > rename {arch/blackfin/include/asm => include/linux/platform_data}/bfin_rotary.h (100%) > > diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c > index 9501bd8..beb011b 100644 > --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c > +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c > @@ -666,7 +666,7 @@ static struct platform_device bfin_sport1_uart_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c > index d64f565..728cda4 100644 > --- a/arch/blackfin/mach-bf527/boards/ezkit.c > +++ b/arch/blackfin/mach-bf527/boards/ezkit.c > @@ -1092,7 +1092,7 @@ static struct platform_device bfin_device_gpiokeys = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c > index 1fe7ff2..8f70f83 100644 > --- a/arch/blackfin/mach-bf548/boards/ezkit.c > +++ b/arch/blackfin/mach-bf548/boards/ezkit.c > @@ -159,7 +159,7 @@ static struct platform_device bf54x_kpad_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c > index e2c0b02..f9dc64d 100644 > --- a/arch/blackfin/mach-bf609/boards/ezkit.c > +++ b/arch/blackfin/mach-bf609/boards/ezkit.c > @@ -75,7 +75,7 @@ static struct platform_device bfin_isp1760_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c > index e69d9bc..8f6c7cd 100644 > --- a/drivers/input/misc/bfin_rotary.c > +++ b/drivers/input/misc/bfin_rotary.c > @@ -12,9 +12,9 @@ > #include <linux/platform_device.h> > #include <linux/input.h> > #include <linux/slab.h> > +#include <linux/platform_data/bfin_rotary.h> > > #include <asm/portmux.h> > -#include <asm/bfin_rotary.h> > > static const u16 per_cnt[] = { > P_CNT_CUD, > diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h > similarity index 100% > rename from arch/blackfin/include/asm/bfin_rotary.h > rename to include/linux/platform_data/bfin_rotary.h > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path 2015-01-14 8:54 [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang ` (2 preceding siblings ...) 2015-01-22 6:25 ` [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang @ 2015-01-29 9:35 ` Sonic Zhang 2015-02-02 6:52 ` Sonic Zhang 2015-02-04 1:20 ` Dmitry Torokhov 5 siblings, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-01-29 9:35 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang Ping again On Wed, Jan 14, 2015 at 4:54 PM, Sonic Zhang <sonic.adi@gmail.com> wrote: > From: Sonic Zhang <sonic.zhang@analog.com> > > The platform data definition of the rotary driver should be generic for all architectures. > > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> > --- > arch/blackfin/mach-bf527/boards/ad7160eval.c | 2 +- > arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- > arch/blackfin/mach-bf548/boards/ezkit.c | 2 +- > arch/blackfin/mach-bf609/boards/ezkit.c | 2 +- > drivers/input/misc/bfin_rotary.c | 2 +- > .../linux/platform_data}/bfin_rotary.h | 0 > 6 files changed, 5 insertions(+), 5 deletions(-) > rename {arch/blackfin/include/asm => include/linux/platform_data}/bfin_rotary.h (100%) > > diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c > index 9501bd8..beb011b 100644 > --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c > +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c > @@ -666,7 +666,7 @@ static struct platform_device bfin_sport1_uart_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c > index d64f565..728cda4 100644 > --- a/arch/blackfin/mach-bf527/boards/ezkit.c > +++ b/arch/blackfin/mach-bf527/boards/ezkit.c > @@ -1092,7 +1092,7 @@ static struct platform_device bfin_device_gpiokeys = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c > index 1fe7ff2..8f70f83 100644 > --- a/arch/blackfin/mach-bf548/boards/ezkit.c > +++ b/arch/blackfin/mach-bf548/boards/ezkit.c > @@ -159,7 +159,7 @@ static struct platform_device bf54x_kpad_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c > index e2c0b02..f9dc64d 100644 > --- a/arch/blackfin/mach-bf609/boards/ezkit.c > +++ b/arch/blackfin/mach-bf609/boards/ezkit.c > @@ -75,7 +75,7 @@ static struct platform_device bfin_isp1760_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c > index e69d9bc..8f6c7cd 100644 > --- a/drivers/input/misc/bfin_rotary.c > +++ b/drivers/input/misc/bfin_rotary.c > @@ -12,9 +12,9 @@ > #include <linux/platform_device.h> > #include <linux/input.h> > #include <linux/slab.h> > +#include <linux/platform_data/bfin_rotary.h> > > #include <asm/portmux.h> > -#include <asm/bfin_rotary.h> > > static const u16 per_cnt[] = { > P_CNT_CUD, > diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h > similarity index 100% > rename from arch/blackfin/include/asm/bfin_rotary.h > rename to include/linux/platform_data/bfin_rotary.h > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path 2015-01-14 8:54 [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang ` (3 preceding siblings ...) 2015-01-29 9:35 ` Sonic Zhang @ 2015-02-02 6:52 ` Sonic Zhang 2015-02-04 1:20 ` Dmitry Torokhov 5 siblings, 0 replies; 14+ messages in thread From: Sonic Zhang @ 2015-02-02 6:52 UTC (permalink / raw) To: Dmitry Torokhov, linux-input Cc: Michael Hennerich, adi-buildroot-devel, Sonic Zhang Hi Dmitry, Could you review and merge these 3 patches for bfin_rotary? Thanks, Sonic ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path 2015-01-14 8:54 [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang ` (4 preceding siblings ...) 2015-02-02 6:52 ` Sonic Zhang @ 2015-02-04 1:20 ` Dmitry Torokhov 5 siblings, 0 replies; 14+ messages in thread From: Dmitry Torokhov @ 2015-02-04 1:20 UTC (permalink / raw) To: Sonic Zhang Cc: linux-input, Michael Hennerich, adi-buildroot-devel, Sonic Zhang On Wed, Jan 14, 2015 at 04:54:12PM +0800, Sonic Zhang wrote: > From: Sonic Zhang <sonic.zhang@analog.com> > > The platform data definition of the rotary driver should be generic for all architectures. > > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Applied, thank you. > --- > arch/blackfin/mach-bf527/boards/ad7160eval.c | 2 +- > arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- > arch/blackfin/mach-bf548/boards/ezkit.c | 2 +- > arch/blackfin/mach-bf609/boards/ezkit.c | 2 +- > drivers/input/misc/bfin_rotary.c | 2 +- > .../linux/platform_data}/bfin_rotary.h | 0 > 6 files changed, 5 insertions(+), 5 deletions(-) > rename {arch/blackfin/include/asm => include/linux/platform_data}/bfin_rotary.h (100%) > > diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c > index 9501bd8..beb011b 100644 > --- a/arch/blackfin/mach-bf527/boards/ad7160eval.c > +++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c > @@ -666,7 +666,7 @@ static struct platform_device bfin_sport1_uart_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c > index d64f565..728cda4 100644 > --- a/arch/blackfin/mach-bf527/boards/ezkit.c > +++ b/arch/blackfin/mach-bf527/boards/ezkit.c > @@ -1092,7 +1092,7 @@ static struct platform_device bfin_device_gpiokeys = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c > index 1fe7ff2..8f70f83 100644 > --- a/arch/blackfin/mach-bf548/boards/ezkit.c > +++ b/arch/blackfin/mach-bf548/boards/ezkit.c > @@ -159,7 +159,7 @@ static struct platform_device bf54x_kpad_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c > index e2c0b02..f9dc64d 100644 > --- a/arch/blackfin/mach-bf609/boards/ezkit.c > +++ b/arch/blackfin/mach-bf609/boards/ezkit.c > @@ -75,7 +75,7 @@ static struct platform_device bfin_isp1760_device = { > #endif > > #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) > -#include <asm/bfin_rotary.h> > +#include <linux/platform_data/bfin_rotary.h> > > static struct bfin_rotary_platform_data bfin_rotary_data = { > /*.rotary_up_key = KEY_UP,*/ > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c > index e69d9bc..8f6c7cd 100644 > --- a/drivers/input/misc/bfin_rotary.c > +++ b/drivers/input/misc/bfin_rotary.c > @@ -12,9 +12,9 @@ > #include <linux/platform_device.h> > #include <linux/input.h> > #include <linux/slab.h> > +#include <linux/platform_data/bfin_rotary.h> > > #include <asm/portmux.h> > -#include <asm/bfin_rotary.h> > > static const u16 per_cnt[] = { > P_CNT_CUD, > diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h > similarity index 100% > rename from arch/blackfin/include/asm/bfin_rotary.h > rename to include/linux/platform_data/bfin_rotary.h > -- > 1.7.9.5 > -- Dmitry ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-02-04 7:23 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-01-14 8:54 [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang 2015-01-14 8:54 ` [PATCH v2 2/3] bfin_rotary: Move peripheral pinmux definition into platform data Sonic Zhang 2015-02-04 1:22 ` Dmitry Torokhov 2015-02-04 6:28 ` Sonic Zhang 2015-01-14 8:54 ` [PATCH v2 3/3] bfin_rotary: replace bfin specific MMR function with generic IO function Sonic Zhang 2015-01-22 6:26 ` Sonic Zhang 2015-01-29 9:35 ` Sonic Zhang 2015-02-04 1:24 ` Dmitry Torokhov 2015-02-04 6:31 ` Sonic Zhang 2015-02-04 7:23 ` Sonic Zhang 2015-01-22 6:25 ` [PATCH v2 1/3] bfin_rotary: move rotary platform header definition to linux platform_data head path Sonic Zhang 2015-01-29 9:35 ` Sonic Zhang 2015-02-02 6:52 ` Sonic Zhang 2015-02-04 1:20 ` Dmitry Torokhov
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.