Skip to content

Commit

Permalink
Input: tc3589x - localize platform data
Browse files Browse the repository at this point in the history
This driver can only get its platform data from the device tree, and all
platforms using it do that. Localize the platform data for the keypad. A
later patch will enforce the device tree / OF dependence.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Linus Walleij authored and Dmitry Torokhov committed Apr 4, 2015
1 parent bbdb38a commit 8b6f53c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 30 deletions.
33 changes: 26 additions & 7 deletions drivers/input/keyboard/tc3589x-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,28 @@
#define TC3589x_EVT_INT_CLR 0x2
#define TC3589x_KBD_INT_CLR 0x1

/**
* struct tc35893_keypad_platform_data - platform specific keypad data
* @keymap_data: matrix scan code table for keycodes
* @krow: mask for available rows, value is 0xFF
* @kcol: mask for available columns, value is 0xFF
* @debounce_period: platform specific debounce time
* @settle_time: platform specific settle down time
* @irqtype: type of interrupt, falling or rising edge
* @enable_wakeup: specifies if keypad event can wake up system from sleep
* @no_autorepeat: flag for auto repetition
*/
struct tc3589x_keypad_platform_data {
const struct matrix_keymap_data *keymap_data;
u8 krow;
u8 kcol;
u8 debounce_period;
u8 settle_time;
unsigned long irqtype;
bool enable_wakeup;
bool no_autorepeat;
};

/**
* struct tc_keypad - data structure used by keypad driver
* @tc3589x: pointer to tc35893
Expand Down Expand Up @@ -363,13 +385,10 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
const struct tc3589x_keypad_platform_data *plat;
int error, irq;

plat = tc3589x->pdata->keypad;
if (!plat) {
plat = tc3589x_keypad_of_probe(&pdev->dev);
if (IS_ERR(plat)) {
dev_err(&pdev->dev, "invalid keypad platform data\n");
return PTR_ERR(plat);
}
plat = tc3589x_keypad_of_probe(&pdev->dev);
if (IS_ERR(plat)) {
dev_err(&pdev->dev, "invalid keypad platform data\n");
return PTR_ERR(plat);
}

irq = platform_get_irq(pdev, 0);
Expand Down
23 changes: 0 additions & 23 deletions include/linux/mfd/tc3589x.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
#define TC_KPD_DEBOUNCE_PERIOD 0xA3
#define TC_KPD_SETTLE_TIME 0xA3

/**
* struct tc35893_platform_data - data structure for platform specific data
* @keymap_data: matrix scan code table for keycodes
* @krow: mask for available rows, value is 0xFF
* @kcol: mask for available columns, value is 0xFF
* @debounce_period: platform specific debounce time
* @settle_time: platform specific settle down time
* @irqtype: type of interrupt, falling or rising edge
* @enable_wakeup: specifies if keypad event can wake up system from sleep
* @no_autorepeat: flag for auto repetition
*/
struct tc3589x_keypad_platform_data {
const struct matrix_keymap_data *keymap_data;
u8 krow;
u8 kcol;
u8 debounce_period;
u8 settle_time;
unsigned long irqtype;
bool enable_wakeup;
bool no_autorepeat;
};

/**
* struct tc3589x_platform_data - TC3589x platform data
* @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
* @keypad: keypad-specific platform data
*/
struct tc3589x_platform_data {
unsigned int block;
const struct tc3589x_keypad_platform_data *keypad;
};

#endif

0 comments on commit 8b6f53c

Please sign in to comment.