aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/mach-bf527/boards/ad7160eval.c8
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c8
-rw-r--r--drivers/input/misc/bfin_rotary.c30
-rw-r--r--include/linux/platform_data/bfin_rotary.h1
4 files changed, 33 insertions, 14 deletions
diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c
index beb011b6d2b3..029a0506b669 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 = {
668#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 668#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
669#include <linux/platform_data/bfin_rotary.h> 669#include <linux/platform_data/bfin_rotary.h>
670 670
671static const u16 per_cnt[] = {
672 P_CNT_CUD,
673 P_CNT_CDG,
674 P_CNT_CZM,
675 0
676};
677
671static struct bfin_rotary_platform_data bfin_rotary_data = { 678static struct bfin_rotary_platform_data bfin_rotary_data = {
672 /*.rotary_up_key = KEY_UP,*/ 679 /*.rotary_up_key = KEY_UP,*/
673 /*.rotary_down_key = KEY_DOWN,*/ 680 /*.rotary_down_key = KEY_DOWN,*/
@@ -676,6 +683,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
676 .debounce = 10, /* 0..17 */ 683 .debounce = 10, /* 0..17 */
677 .mode = ROT_QUAD_ENC | ROT_DEBE, 684 .mode = ROT_QUAD_ENC | ROT_DEBE,
678 .pm_wakeup = 1, 685 .pm_wakeup = 1,
686 .pin_list = per_cnt,
679}; 687};
680 688
681static struct resource bfin_rotary_resources[] = { 689static struct resource bfin_rotary_resources[] = {
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 728cda469952..cc80c5ba9f67 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 = {
1094#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY) 1094#if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
1095#include <linux/platform_data/bfin_rotary.h> 1095#include <linux/platform_data/bfin_rotary.h>
1096 1096
1097static const u16 per_cnt[] = {
1098 P_CNT_CUD,
1099 P_CNT_CDG,
1100 P_CNT_CZM,
1101 0
1102};
1103
1097static struct bfin_rotary_platform_data bfin_rotary_data = { 1104static struct bfin_rotary_platform_data bfin_rotary_data = {
1098 /*.rotary_up_key = KEY_UP,*/ 1105 /*.rotary_up_key = KEY_UP,*/
1099 /*.rotary_down_key = KEY_DOWN,*/ 1106 /*.rotary_down_key = KEY_DOWN,*/
@@ -1102,6 +1109,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
1102 .debounce = 10, /* 0..17 */ 1109 .debounce = 10, /* 0..17 */
1103 .mode = ROT_QUAD_ENC | ROT_DEBE, 1110 .mode = ROT_QUAD_ENC | ROT_DEBE,
1104 .pm_wakeup = 1, 1111 .pm_wakeup = 1,
1112 .pin_list = per_cnt,
1105}; 1113};
1106 1114
1107static struct resource bfin_rotary_resources[] = { 1115static struct resource bfin_rotary_resources[] = {
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index 35ead69521a0..8312b29ab18d 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -16,13 +16,6 @@
16 16
17#include <asm/portmux.h> 17#include <asm/portmux.h>
18 18
19static const u16 per_cnt[] = {
20 P_CNT_CUD,
21 P_CNT_CDG,
22 P_CNT_CZM,
23 0
24};
25
26struct bfin_rot { 19struct bfin_rot {
27 struct input_dev *input; 20 struct input_dev *input;
28 int irq; 21 int irq;
@@ -90,7 +83,8 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
90 83
91static int bfin_rotary_probe(struct platform_device *pdev) 84static int bfin_rotary_probe(struct platform_device *pdev)
92{ 85{
93 struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); 86 const struct bfin_rotary_platform_data *pdata =
87 dev_get_platdata(&pdev->dev);
94 struct bfin_rot *rotary; 88 struct bfin_rot *rotary;
95 struct input_dev *input; 89 struct input_dev *input;
96 int error; 90 int error;
@@ -101,10 +95,13 @@ static int bfin_rotary_probe(struct platform_device *pdev)
101 return -EINVAL; 95 return -EINVAL;
102 } 96 }
103 97
104 error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); 98 if (pdata->pin_list) {
105 if (error) { 99 error = peripheral_request_list(pdata->pin_list,
106 dev_err(&pdev->dev, "requesting peripherals failed\n"); 100 dev_name(&pdev->dev));
107 return error; 101 if (error) {
102 dev_err(&pdev->dev, "requesting peripherals failed\n");
103 return error;
104 }
108 } 105 }
109 106
110 rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); 107 rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL);
@@ -189,13 +186,16 @@ out2:
189out1: 186out1:
190 input_free_device(input); 187 input_free_device(input);
191 kfree(rotary); 188 kfree(rotary);
192 peripheral_free_list(per_cnt); 189 if (pdata->pin_list)
190 peripheral_free_list(pdata->pin_list);
193 191
194 return error; 192 return error;
195} 193}
196 194
197static int bfin_rotary_remove(struct platform_device *pdev) 195static int bfin_rotary_remove(struct platform_device *pdev)
198{ 196{
197 const struct bfin_rotary_platform_data *pdata =
198 dev_get_platdata(&pdev->dev);
199 struct bfin_rot *rotary = platform_get_drvdata(pdev); 199 struct bfin_rot *rotary = platform_get_drvdata(pdev);
200 200
201 bfin_write_CNT_CONFIG(0); 201 bfin_write_CNT_CONFIG(0);
@@ -203,7 +203,9 @@ static int bfin_rotary_remove(struct platform_device *pdev)
203 203
204 free_irq(rotary->irq, rotary); 204 free_irq(rotary->irq, rotary);
205 input_unregister_device(rotary->input); 205 input_unregister_device(rotary->input);
206 peripheral_free_list(per_cnt); 206
207 if (pdata->pin_list)
208 peripheral_free_list(pdata->pin_list);
207 209
208 kfree(rotary); 210 kfree(rotary);
209 211
diff --git a/include/linux/platform_data/bfin_rotary.h b/include/linux/platform_data/bfin_rotary.h
index 8895a750c70c..98829370fee2 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 {
40 unsigned short debounce; /* 0..17 */ 40 unsigned short debounce; /* 0..17 */
41 unsigned short mode; 41 unsigned short mode;
42 unsigned short pm_wakeup; 42 unsigned short pm_wakeup;
43 unsigned short *pin_list;
43}; 44};
44 45
45/* CNT_CONFIG bitmasks */ 46/* CNT_CONFIG bitmasks */