mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
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>
This commit is contained in:
parent
1b05a70137
commit
de35996d4b
@ -271,55 +271,6 @@ static int matrix_keypad_resume(struct device *dev)
|
|||||||
static DEFINE_SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops,
|
static DEFINE_SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops,
|
||||||
matrix_keypad_suspend, matrix_keypad_resume);
|
matrix_keypad_suspend, matrix_keypad_resume);
|
||||||
|
|
||||||
static int matrix_keypad_init_pdata_gpio(struct platform_device *pdev,
|
|
||||||
const struct matrix_keypad_platform_data *pdata,
|
|
||||||
struct matrix_keypad *keypad)
|
|
||||||
{
|
|
||||||
int i, err;
|
|
||||||
|
|
||||||
keypad->num_col_gpios = pdata->num_col_gpios;
|
|
||||||
keypad->num_row_gpios = pdata->num_row_gpios;
|
|
||||||
|
|
||||||
/* initialized strobe lines as outputs, activated */
|
|
||||||
for (i = 0; i < pdata->num_col_gpios; i++) {
|
|
||||||
err = devm_gpio_request(&pdev->dev,
|
|
||||||
pdata->col_gpios[i], "matrix_kbd_col");
|
|
||||||
if (err) {
|
|
||||||
dev_err(&pdev->dev,
|
|
||||||
"failed to request GPIO%d for COL%d\n",
|
|
||||||
pdata->col_gpios[i], i);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
keypad->col_gpios[i] = gpio_to_desc(pdata->col_gpios[i]);
|
|
||||||
|
|
||||||
if (pdata->active_low ^ gpiod_is_active_low(keypad->col_gpios[i]))
|
|
||||||
gpiod_toggle_active_low(keypad->col_gpios[i]);
|
|
||||||
|
|
||||||
gpiod_direction_output(keypad->col_gpios[i], 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < pdata->num_row_gpios; i++) {
|
|
||||||
err = devm_gpio_request(&pdev->dev,
|
|
||||||
pdata->row_gpios[i], "matrix_kbd_row");
|
|
||||||
if (err) {
|
|
||||||
dev_err(&pdev->dev,
|
|
||||||
"failed to request GPIO%d for ROW%d\n",
|
|
||||||
pdata->row_gpios[i], i);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
keypad->row_gpios[i] = gpio_to_desc(pdata->row_gpios[i]);
|
|
||||||
|
|
||||||
if (pdata->active_low ^ gpiod_is_active_low(keypad->row_gpios[i]))
|
|
||||||
gpiod_toggle_active_low(keypad->row_gpios[i]);
|
|
||||||
|
|
||||||
gpiod_direction_input(keypad->row_gpios[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int matrix_keypad_init_gpio(struct platform_device *pdev,
|
static int matrix_keypad_init_gpio(struct platform_device *pdev,
|
||||||
struct matrix_keypad *keypad)
|
struct matrix_keypad *keypad)
|
||||||
{
|
{
|
||||||
@ -420,11 +371,8 @@ static int matrix_keypad_setup_interrupts(struct platform_device *pdev,
|
|||||||
|
|
||||||
static int matrix_keypad_probe(struct platform_device *pdev)
|
static int matrix_keypad_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct matrix_keypad_platform_data *pdata =
|
|
||||||
dev_get_platdata(&pdev->dev);
|
|
||||||
struct matrix_keypad *keypad;
|
struct matrix_keypad *keypad;
|
||||||
struct input_dev *input_dev;
|
struct input_dev *input_dev;
|
||||||
bool autorepeat;
|
|
||||||
bool wakeup;
|
bool wakeup;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -448,16 +396,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
device_property_read_u32(&pdev->dev, "col-scan-delay-us",
|
device_property_read_u32(&pdev->dev, "col-scan-delay-us",
|
||||||
&keypad->col_scan_delay_us);
|
&keypad->col_scan_delay_us);
|
||||||
|
|
||||||
if (pdata) {
|
err = matrix_keypad_init_gpio(pdev, keypad);
|
||||||
keypad->col_scan_delay_us = pdata->col_scan_delay_us;
|
|
||||||
keypad->debounce_ms = pdata->debounce_ms;
|
|
||||||
keypad->drive_inactive_cols = pdata->drive_inactive_cols;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pdata)
|
|
||||||
err = matrix_keypad_init_pdata_gpio(pdev, pdata, keypad);
|
|
||||||
else
|
|
||||||
err = matrix_keypad_init_gpio(pdev, keypad);
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -472,8 +411,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
input_dev->open = matrix_keypad_start;
|
input_dev->open = matrix_keypad_start;
|
||||||
input_dev->close = matrix_keypad_stop;
|
input_dev->close = matrix_keypad_stop;
|
||||||
|
|
||||||
err = matrix_keypad_build_keymap(pdata ? pdata->keymap_data : NULL,
|
err = matrix_keypad_build_keymap(NULL, NULL,
|
||||||
NULL,
|
|
||||||
keypad->num_row_gpios,
|
keypad->num_row_gpios,
|
||||||
keypad->num_col_gpios,
|
keypad->num_col_gpios,
|
||||||
NULL, input_dev);
|
NULL, input_dev);
|
||||||
@ -482,11 +420,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
autorepeat = !device_property_read_bool(&pdev->dev,
|
if (!device_property_read_bool(&pdev->dev, "linux,no-autorepeat"))
|
||||||
"linux,no-autorepeat");
|
|
||||||
if (autorepeat && pdata->no_autorepeat)
|
|
||||||
autorepeat = false;
|
|
||||||
if (autorepeat)
|
|
||||||
__set_bit(EV_REP, input_dev->evbit);
|
__set_bit(EV_REP, input_dev->evbit);
|
||||||
|
|
||||||
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
|
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
|
||||||
@ -499,8 +433,6 @@ static int matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
wakeup = device_property_read_bool(&pdev->dev, "wakeup-source") ||
|
wakeup = device_property_read_bool(&pdev->dev, "wakeup-source") ||
|
||||||
/* legacy */
|
/* legacy */
|
||||||
device_property_read_bool(&pdev->dev, "linux,wakeup");
|
device_property_read_bool(&pdev->dev, "linux,wakeup");
|
||||||
if (!wakeup && pdata)
|
|
||||||
wakeup = pdata->wakeup;
|
|
||||||
device_init_wakeup(&pdev->dev, wakeup);
|
device_init_wakeup(&pdev->dev, wakeup);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, keypad);
|
platform_set_drvdata(pdev, keypad);
|
||||||
|
@ -34,52 +34,6 @@ struct matrix_keymap_data {
|
|||||||
unsigned int keymap_size;
|
unsigned int keymap_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* struct matrix_keypad_platform_data - platform-dependent keypad data
|
|
||||||
* @keymap_data: pointer to &matrix_keymap_data
|
|
||||||
* @row_gpios: pointer to array of gpio numbers representing rows
|
|
||||||
* @col_gpios: pointer to array of gpio numbers reporesenting colums
|
|
||||||
* @num_row_gpios: actual number of row gpios used by device
|
|
||||||
* @num_col_gpios: actual number of col gpios used by device
|
|
||||||
* @col_scan_delay_us: delay, measured in microseconds, that is
|
|
||||||
* needed before we can keypad after activating column gpio
|
|
||||||
* @debounce_ms: debounce interval in milliseconds
|
|
||||||
* @clustered_irq: may be specified if interrupts of all row/column GPIOs
|
|
||||||
* are bundled to one single irq
|
|
||||||
* @clustered_irq_flags: flags that are needed for the clustered irq
|
|
||||||
* @active_low: gpio polarity
|
|
||||||
* @wakeup: controls whether the device should be set up as wakeup
|
|
||||||
* source
|
|
||||||
* @no_autorepeat: disable key autorepeat
|
|
||||||
* @drive_inactive_cols: drive inactive columns during scan, rather than
|
|
||||||
* making them inputs.
|
|
||||||
*
|
|
||||||
* This structure represents platform-specific data that use used by
|
|
||||||
* matrix_keypad driver to perform proper initialization.
|
|
||||||
*/
|
|
||||||
struct matrix_keypad_platform_data {
|
|
||||||
const struct matrix_keymap_data *keymap_data;
|
|
||||||
|
|
||||||
const unsigned int *row_gpios;
|
|
||||||
const unsigned int *col_gpios;
|
|
||||||
|
|
||||||
unsigned int num_row_gpios;
|
|
||||||
unsigned int num_col_gpios;
|
|
||||||
|
|
||||||
unsigned int col_scan_delay_us;
|
|
||||||
|
|
||||||
/* key debounce interval in milli-second */
|
|
||||||
unsigned int debounce_ms;
|
|
||||||
|
|
||||||
unsigned int clustered_irq;
|
|
||||||
unsigned int clustered_irq_flags;
|
|
||||||
|
|
||||||
bool active_low;
|
|
||||||
bool wakeup;
|
|
||||||
bool no_autorepeat;
|
|
||||||
bool drive_inactive_cols;
|
|
||||||
};
|
|
||||||
|
|
||||||
int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
|
int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
|
||||||
const char *keymap_name,
|
const char *keymap_name,
|
||||||
unsigned int rows, unsigned int cols,
|
unsigned int rows, unsigned int cols,
|
||||||
@ -88,6 +42,4 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
|
|||||||
int matrix_keypad_parse_properties(struct device *dev,
|
int matrix_keypad_parse_properties(struct device *dev,
|
||||||
unsigned int *rows, unsigned int *cols);
|
unsigned int *rows, unsigned int *cols);
|
||||||
|
|
||||||
#define matrix_keypad_parse_of_params matrix_keypad_parse_properties
|
|
||||||
|
|
||||||
#endif /* _MATRIX_KEYPAD_H */
|
#endif /* _MATRIX_KEYPAD_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user