Skip to content

Commit 890ba82

Browse files
committed
Input: spear-keyboard - drop support for platform data
There are no in-kernel users of spear kbd_platform_data in the kernel, and the driver supports configuration via device tree, so drop support of static platform data and move properties parsing from OF-specific methods to generic ones. Link: https://lore.kernel.org/r/vppjxui76im26uamznx7evm5lmbe3d6v3oxsa7mqyytykh4zm6@nhlf33v3hp6g Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent ca734f5 commit 890ba82

2 files changed

Lines changed: 15 additions & 220 deletions

File tree

drivers/input/keyboard/spear-keyboard.c

Lines changed: 15 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/errno.h>
1515
#include <linux/interrupt.h>
1616
#include <linux/input.h>
17+
#include <linux/input/matrix_keypad.h>
1718
#include <linux/io.h>
1819
#include <linux/irq.h>
1920
#include <linux/kernel.h>
@@ -22,7 +23,6 @@
2223
#include <linux/platform_device.h>
2324
#include <linux/slab.h>
2425
#include <linux/types.h>
25-
#include <linux/platform_data/keyboard-spear.h>
2626

2727
/* Keyboard Registers */
2828
#define MODE_CTL_REG 0x00
@@ -56,13 +56,12 @@ struct spear_kbd {
5656
void __iomem *io_base;
5757
struct clk *clk;
5858
unsigned int irq;
59-
unsigned int mode;
60-
unsigned int suspended_rate;
59+
u32 mode;
60+
u32 suspended_rate;
61+
u32 mode_ctl_reg;
6162
unsigned short last_key;
6263
unsigned short keycodes[NUM_ROWS * NUM_COLS];
63-
bool rep;
6464
bool irq_wake_enabled;
65-
u32 mode_ctl_reg;
6665
};
6766

6867
static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
@@ -143,46 +142,8 @@ static void spear_kbd_close(struct input_dev *dev)
143142
kbd->last_key = KEY_RESERVED;
144143
}
145144

146-
#ifdef CONFIG_OF
147-
static int spear_kbd_parse_dt(struct platform_device *pdev,
148-
struct spear_kbd *kbd)
149-
{
150-
struct device_node *np = pdev->dev.of_node;
151-
int error;
152-
u32 val, suspended_rate;
153-
154-
if (!np) {
155-
dev_err(&pdev->dev, "Missing DT data\n");
156-
return -EINVAL;
157-
}
158-
159-
if (of_property_read_bool(np, "autorepeat"))
160-
kbd->rep = true;
161-
162-
if (of_property_read_u32(np, "suspended_rate", &suspended_rate))
163-
kbd->suspended_rate = suspended_rate;
164-
165-
error = of_property_read_u32(np, "st,mode", &val);
166-
if (error) {
167-
dev_err(&pdev->dev, "DT: Invalid or missing mode\n");
168-
return error;
169-
}
170-
171-
kbd->mode = val;
172-
return 0;
173-
}
174-
#else
175-
static inline int spear_kbd_parse_dt(struct platform_device *pdev,
176-
struct spear_kbd *kbd)
177-
{
178-
return -ENOSYS;
179-
}
180-
#endif
181-
182145
static int spear_kbd_probe(struct platform_device *pdev)
183146
{
184-
struct kbd_platform_data *pdata = dev_get_platdata(&pdev->dev);
185-
const struct matrix_keymap_data *keymap = pdata ? pdata->keymap : NULL;
186147
struct spear_kbd *kbd;
187148
struct input_dev *input_dev;
188149
int irq;
@@ -198,6 +159,14 @@ static int spear_kbd_probe(struct platform_device *pdev)
198159
return -ENOMEM;
199160
}
200161

162+
error = device_property_read_u32(&pdev->dev, "st,mode", &kbd->mode);
163+
if (error) {
164+
dev_err(&pdev->dev, "Invalid or missing mode\n");
165+
return error;
166+
}
167+
168+
device_property_read_u32(&pdev->dev, "suspended_rate", &kbd->suspended_rate);
169+
201170
input_dev = devm_input_allocate_device(&pdev->dev);
202171
if (!input_dev) {
203172
dev_err(&pdev->dev, "unable to allocate input device\n");
@@ -207,16 +176,6 @@ static int spear_kbd_probe(struct platform_device *pdev)
207176
kbd->input = input_dev;
208177
kbd->irq = irq;
209178

210-
if (!pdata) {
211-
error = spear_kbd_parse_dt(pdev, kbd);
212-
if (error)
213-
return error;
214-
} else {
215-
kbd->mode = pdata->mode;
216-
kbd->rep = pdata->rep;
217-
kbd->suspended_rate = pdata->suspended_rate;
218-
}
219-
220179
kbd->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
221180
if (IS_ERR(kbd->io_base))
222181
return PTR_ERR(kbd->io_base);
@@ -234,21 +193,21 @@ static int spear_kbd_probe(struct platform_device *pdev)
234193
input_dev->open = spear_kbd_open;
235194
input_dev->close = spear_kbd_close;
236195

237-
error = matrix_keypad_build_keymap(keymap, NULL, NUM_ROWS, NUM_COLS,
196+
error = matrix_keypad_build_keymap(NULL, NULL, NUM_ROWS, NUM_COLS,
238197
kbd->keycodes, input_dev);
239198
if (error) {
240199
dev_err(&pdev->dev, "Failed to build keymap\n");
241200
return error;
242201
}
243202

244-
if (kbd->rep)
203+
if (device_property_read_bool(&pdev->dev, "autorepeat"))
245204
__set_bit(EV_REP, input_dev->evbit);
246205
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
247206

248207
input_set_drvdata(input_dev, kbd);
249208

250209
error = devm_request_irq(&pdev->dev, irq, spear_kbd_interrupt, 0,
251-
"keyboard", kbd);
210+
"keyboard", kbd);
252211
if (error) {
253212
dev_err(&pdev->dev, "request_irq failed\n");
254213
return error;

include/linux/platform_data/keyboard-spear.h

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)