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
668668 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
669669 #include <linux/platform_data/bfin_rotary.h>
670670
671+static const u16 per_cnt[] = {
672+ P_CNT_CUD,
673+ P_CNT_CDG,
674+ P_CNT_CZM,
675+ 0
676+};
677+
671678 static struct bfin_rotary_platform_data bfin_rotary_data = {
672679 /*.rotary_up_key = KEY_UP,*/
673680 /*.rotary_down_key = KEY_DOWN,*/
@@ -676,6 +683,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { · 2 unmodified lines
676683 .debounce = 10, /* 0..17 */
677684 .mode = ROT_QUAD_ENC | ROT_DEBE,
678685 .pm_wakeup = 1,
686+ .pin_list = per_cnt,
679687 };
680688
681689 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 = { · 1093 unmodified lines
10941094 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
10951095 #include <linux/platform_data/bfin_rotary.h>
10961096
1097+static const u16 per_cnt[] = {
1098+ P_CNT_CUD,
1099+ P_CNT_CDG,
1100+ P_CNT_CZM,
1101+ 0
1102+};
1103+
10971104 static struct bfin_rotary_platform_data bfin_rotary_data = {
10981105 /*.rotary_up_key = KEY_UP,*/
10991106 /*.rotary_down_key = KEY_DOWN,*/
@@ -1102,6 +1109,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = { · 2 unmodified lines
11021109 .debounce = 10, /* 0..17 */
11031110 .mode = ROT_QUAD_ENC | ROT_DEBE,
11041111 .pm_wakeup = 1,
1112+ .pin_list = per_cnt,
11051113 };
11061114
11071115 static struct resource bfin_rotary_resources[] = {
drivers/input/misc/bfin_rotary.c+16−14
@@ -16,13 +16,6 @@ · 15 unmodified lines
1616
1717 #include <asm/portmux.h>
1818
19−static const u16 per_cnt[] = {
20− P_CNT_CUD,
21− P_CNT_CDG,
22− P_CNT_CZM,
23− 0
24−};
25−
2619 struct bfin_rot {
2720 struct input_dev *input;
2821 int irq;
@@ -90,7 +83,8 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) · 61 unmodified lines
9083
9184 static int bfin_rotary_probe(struct platform_device *pdev)
9285 {
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);
9488 struct bfin_rot *rotary;
9589 struct input_dev *input;
9690 int error;
@@ -101,10 +95,13 @@ static int bfin_rotary_probe(struct platform_device *pdev) · 4 unmodified lines
10195 return -EINVAL;
10296 }
10397
104− error = peripheral_request_list(per_cnt, dev_name(&pdev->dev));
105− if (error) {
106− dev_err(&pdev->dev, "requesting peripherals failed\n");
107− return error;
98+ if (pdata->pin_list) {
99+ error = peripheral_request_list(pdata->pin_list,
100+ dev_name(&pdev->dev));
101+ if (error) {
102+ dev_err(&pdev->dev, "requesting peripherals failed\n");
103+ return error;
104+ }
108105 }
109106
110107 rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL);
@@ -189,13 +186,16 @@ out2: · 78 unmodified lines
189186 out1:
190187 input_free_device(input);
191188 kfree(rotary);
192− peripheral_free_list(per_cnt);
189+ if (pdata->pin_list)
190+ peripheral_free_list(pdata->pin_list);
193191
194192 return error;
195193 }
196194
197195 static int bfin_rotary_remove(struct platform_device *pdev)
198196 {
197+ const struct bfin_rotary_platform_data *pdata =
198+ dev_get_platdata(&pdev->dev);
199199 struct bfin_rot *rotary = platform_get_drvdata(pdev);
200200
201201 bfin_write_CNT_CONFIG(0);
@@ -203,7 +203,9 @@ static int bfin_rotary_remove(struct platform_device *pdev) · 1 unmodified line
203203
204204 free_irq(rotary->irq, rotary);
205205 input_unregister_device(rotary->input);
206− peripheral_free_list(per_cnt);
206+
207+ if (pdata->pin_list)
208+ peripheral_free_list(pdata->pin_list);
207209
208210 kfree(rotary);
209211
include/linux/platform_data/bfin_rotary.h+1−0
@@ -40,6 +40,7 @@ struct bfin_rotary_platform_data { · 39 unmodified lines
4040 unsigned short debounce; /* 0..17 */
4141 unsigned short mode;
4242 unsigned short pm_wakeup;
43+ unsigned short *pin_list;
4344 };
4445
4546 /* 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