Skip to content

Commit de35996

Browse files
committed
Input: matrix_keypad - remove support for platform data
There are no more users of struct matrix_keypad_platform_data in the kernel, remove support for it from the driver. Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20240805014710.1961677-6-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 1b05a70 commit de35996

2 files changed

Lines changed: 3 additions & 119 deletions

File tree

drivers/input/keyboard/matrix_keypad.c

Lines changed: 3 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -271,55 +271,6 @@ static int matrix_keypad_resume(struct device *dev)
271271
static DEFINE_SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops,
272272
matrix_keypad_suspend, matrix_keypad_resume);
273273

274-
static int matrix_keypad_init_pdata_gpio(struct platform_device *pdev,
275-
const struct matrix_keypad_platform_data *pdata,
276-
struct matrix_keypad *keypad)
277-
{
278-
int i, err;
279-
280-
keypad->num_col_gpios = pdata->num_col_gpios;
281-
keypad->num_row_gpios = pdata->num_row_gpios;
282-
283-
/* initialized strobe lines as outputs, activated */
284-
for (i = 0; i < pdata->num_col_gpios; i++) {
285-
err = devm_gpio_request(&pdev->dev,
286-
pdata->col_gpios[i], "matrix_kbd_col");
287-
if (err) {
288-
dev_err(&pdev->dev,
289-
"failed to request GPIO%d for COL%d\n",
290-
pdata->col_gpios[i], i);
291-
return err;
292-
}
293-
294-
keypad->col_gpios[i] = gpio_to_desc(pdata->col_gpios[i]);
295-
296-
if (pdata->active_low ^ gpiod_is_active_low(keypad->col_gpios[i]))
297-
gpiod_toggle_active_low(keypad->col_gpios[i]);
298-
299-
gpiod_direction_output(keypad->col_gpios[i], 1);
300-
}
301-
302-
for (i = 0; i < pdata->num_row_gpios; i++) {
303-
err = devm_gpio_request(&pdev->dev,
304-
pdata->row_gpios[i], "matrix_kbd_row");
305-
if (err) {
306-
dev_err(&pdev->dev,
307-
"failed to request GPIO%d for ROW%d\n",
308-
pdata->row_gpios[i], i);
309-
return err;
310-
}
311-
312-
keypad->row_gpios[i] = gpio_to_desc(pdata->row_gpios[i]);
313-
314-
if (pdata->active_low ^ gpiod_is_active_low(keypad->row_gpios[i]))
315-
gpiod_toggle_active_low(keypad->row_gpios[i]);
316-
317-
gpiod_direction_input(keypad->row_gpios[i]);
318-
}
319-
320-
return 0;
321-
}
322-
323274
static int matrix_keypad_init_gpio(struct platform_device *pdev,
324275
struct matrix_keypad *keypad)
325276
{
@@ -420,11 +371,8 @@ static int matrix_keypad_setup_interrupts(struct platform_device *pdev,
420371

421372
static int matrix_keypad_probe(struct platform_device *pdev)
422373
{
423-
const struct matrix_keypad_platform_data *pdata =
424-
dev_get_platdata(&pdev->dev);
425374
struct matrix_keypad *keypad;
426375
struct input_dev *input_dev;
427-
bool autorepeat;
428376
bool wakeup;
429377
int err;
430378

@@ -448,16 +396,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
448396
device_property_read_u32(&pdev->dev, "col-scan-delay-us",
449397
&keypad->col_scan_delay_us);
450398

451-
if (pdata) {
452-
keypad->col_scan_delay_us = pdata->col_scan_delay_us;
453-
keypad->debounce_ms = pdata->debounce_ms;
454-
keypad->drive_inactive_cols = pdata->drive_inactive_cols;
455-
}
456-
457-
if (pdata)
458-
err = matrix_keypad_init_pdata_gpio(pdev, pdata, keypad);
459-
else
460-
err = matrix_keypad_init_gpio(pdev, keypad);
399+
err = matrix_keypad_init_gpio(pdev, keypad);
461400
if (err)
462401
return err;
463402

@@ -472,8 +411,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
472411
input_dev->open = matrix_keypad_start;
473412
input_dev->close = matrix_keypad_stop;
474413

475-
err = matrix_keypad_build_keymap(pdata ? pdata->keymap_data : NULL,
476-
NULL,
414+
err = matrix_keypad_build_keymap(NULL, NULL,
477415
keypad->num_row_gpios,
478416
keypad->num_col_gpios,
479417
NULL, input_dev);
@@ -482,11 +420,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
482420
return -ENOMEM;
483421
}
484422

485-
autorepeat = !device_property_read_bool(&pdev->dev,
486-
"linux,no-autorepeat");
487-
if (autorepeat && pdata->no_autorepeat)
488-
autorepeat = false;
489-
if (autorepeat)
423+
if (!device_property_read_bool(&pdev->dev, "linux,no-autorepeat"))
490424
__set_bit(EV_REP, input_dev->evbit);
491425

492426
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
@@ -499,8 +433,6 @@ static int matrix_keypad_probe(struct platform_device *pdev)
499433
wakeup = device_property_read_bool(&pdev->dev, "wakeup-source") ||
500434
/* legacy */
501435
device_property_read_bool(&pdev->dev, "linux,wakeup");
502-
if (!wakeup && pdata)
503-
wakeup = pdata->wakeup;
504436
device_init_wakeup(&pdev->dev, wakeup);
505437

506438
platform_set_drvdata(pdev, keypad);

include/linux/input/matrix_keypad.h

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -34,52 +34,6 @@ struct matrix_keymap_data {
3434
unsigned int keymap_size;
3535
};
3636

37-
/**
38-
* struct matrix_keypad_platform_data - platform-dependent keypad data
39-
* @keymap_data: pointer to &matrix_keymap_data
40-
* @row_gpios: pointer to array of gpio numbers representing rows
41-
* @col_gpios: pointer to array of gpio numbers reporesenting colums
42-
* @num_row_gpios: actual number of row gpios used by device
43-
* @num_col_gpios: actual number of col gpios used by device
44-
* @col_scan_delay_us: delay, measured in microseconds, that is
45-
* needed before we can keypad after activating column gpio
46-
* @debounce_ms: debounce interval in milliseconds
47-
* @clustered_irq: may be specified if interrupts of all row/column GPIOs
48-
* are bundled to one single irq
49-
* @clustered_irq_flags: flags that are needed for the clustered irq
50-
* @active_low: gpio polarity
51-
* @wakeup: controls whether the device should be set up as wakeup
52-
* source
53-
* @no_autorepeat: disable key autorepeat
54-
* @drive_inactive_cols: drive inactive columns during scan, rather than
55-
* making them inputs.
56-
*
57-
* This structure represents platform-specific data that use used by
58-
* matrix_keypad driver to perform proper initialization.
59-
*/
60-
struct matrix_keypad_platform_data {
61-
const struct matrix_keymap_data *keymap_data;
62-
63-
const unsigned int *row_gpios;
64-
const unsigned int *col_gpios;
65-
66-
unsigned int num_row_gpios;
67-
unsigned int num_col_gpios;
68-
69-
unsigned int col_scan_delay_us;
70-
71-
/* key debounce interval in milli-second */
72-
unsigned int debounce_ms;
73-
74-
unsigned int clustered_irq;
75-
unsigned int clustered_irq_flags;
76-
77-
bool active_low;
78-
bool wakeup;
79-
bool no_autorepeat;
80-
bool drive_inactive_cols;
81-
};
82-
8337
int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
8438
const char *keymap_name,
8539
unsigned int rows, unsigned int cols,
@@ -88,6 +42,4 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
8842
int matrix_keypad_parse_properties(struct device *dev,
8943
unsigned int *rows, unsigned int *cols);
9044

91-
#define matrix_keypad_parse_of_params matrix_keypad_parse_properties
92-
9345
#endif /* _MATRIX_KEYPAD_H */

0 commit comments

Comments
 (0)