History

Input: bfin_rotary - move pin lists into into platform data

Newer Blackfin boards use pinctrl API to manage pins and the legacy peripherial lists are not useful on them. Let's move pin lists into platform data so older boards can still use them and newer boards can use the modern API.

Sonic Zhang committed 11 years ago

Commit 5ea06991 parent 1ea74014 files · +33 −14Browse files

Unified · Split

4 files
  1. arch/blackfin/mach-bf527/boards/ad7160eval.c +8 −0
  2. arch/blackfin/mach-bf527/boards/ezkit.c +8 −0
  3. drivers/input/misc/bfin_rotary.c +16 −14
  4. include/linux/platform_data/bfin_rotary.h +1 −0
arch/blackfin/mach-bf527/boards/ad7160eval.c+8−0
@@ -668,6 +668,13 @@ static struct platform_device bfin_sport1_uart_device = { · 667 unmodified lines
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 = { · 2 unmodified lines
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[] = {
arch/blackfin/mach-bf527/boards/ezkit.c+8−0
@@ -1094,6 +1094,13 @@ static struct platform_device bfin_device_gpiokeys = { · 1093 unmodified lines
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 = { · 2 unmodified lines
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[] = {
drivers/input/misc/bfin_rotary.c+16−14
@@ -16,13 +16,6 @@ · 15 unmodified lines
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) · 61 unmodified lines
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) · 4 unmodified lines
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: · 78 unmodified lines
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) · 1 unmodified line
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
include/linux/platform_data/bfin_rotary.h+1−0
@@ -40,6 +40,7 @@ struct bfin_rotary_platform_data { · 39 unmodified lines
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 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t