bfin_rotary: Move peripheral pinmux definition into platform data of bf527
Subsystems (2)
PATCH v4 2/3 bfin_rotary: Move peripheral pinmux definition into platform data of bf527
From: Sonic Zhang <[email protected]>
v3-changes:
- Pinctrl API is used to set up counter pinmux on bf548 and bf609. Pinmux list is use less on bf548 and bf609.
v4-changes:
- Forgot to replace per_cnt with pdata->pin_list in bfin_rotary_probe().
Signed-off-by Sonic Zhang <[email protected]>
--- arch/blackfin/mach-bf527/boards/ad7160eval.c | 8 ++++++++ arch/blackfin/mach-bf527/boards/ezkit.c | 8 ++++++++ drivers/input/misc/bfin_rotary.c | 14 ++++---------- include/linux/platform_data/bfin_rotary.h | 1 + 4 files changed, 21 insertions(+), 10 deletions(-)
arch/blackfin/mach-bf527/boards/ad7160eval.c +8 -0
@@ -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[] = {
arch/blackfin/mach-bf527/boards/ezkit.c +8 -0
@@ -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[] = {
drivers/input/misc/bfin_rotary.c +4 -10
@@ -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;
@@ -190,13 +183,14 @@ out2: out1:input_free_device (input);kfree (rotary); -peripheral_free_list (per_cnt); +peripheral_free_list (pdata->pin_list);return error; }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);
include/linux/platform_data/bfin_rotary.h +1 -0
@@ -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 */
Signature · 1 line
1.7.9.5