Skip to content

Commit 861a644

Browse files
Miguel Aguilardtor
authored andcommitted
Input: davinci_keyscan - add device_enable method to platform data
Add a function pointer in the platform data of the DaVinci Keyscan driver called device_enable, in order to perform board specific actions when the device is initialized, like setup the PINMUX configuration. Signed-off-by: Miguel Aguilar <miguel.aguilar@ridgerun.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent 30a589f commit 861a644

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎arch/arm/mach-davinci/include/mach/keyscan.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum davinci_matrix_types {
2929
};
3030

3131
struct davinci_ks_platform_data {
32+
int (*device_enable)(struct device *dev);
3233
unsigned short *keymap;
3334
u32 keymapsize;
3435
u8 rep:1;

‎drivers/input/keyboard/davinci_keyscan.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
174174
struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
175175
int error, i;
176176

177+
if (pdata->device_enable) {
178+
error = pdata->device_enable(dev);
179+
if (error < 0) {
180+
dev_dbg(dev, "device enable function failed\n");
181+
return error;
182+
}
183+
}
184+
177185
if (!pdata->keymap) {
178186
dev_dbg(dev, "no keymap from pdata\n");
179187
return -EINVAL;

0 commit comments

Comments
 (0)