Commit 3fd79ae4 authored by Kuppuswamy Sathyanarayanan's avatar Kuppuswamy Sathyanarayanan Committed by H. Peter Anvin

intel_mid: Added custom device_handler support

This patch provides a means to add custom handler for
SFI devices. If you set device_handler as NULL in
device_id table standard SFI device handler will be used.
If its not NULL custom handler will be called.
Signed-off-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Link: http://lkml.kernel.org/r/1382049336-21316-8-git-send-email-david.a.cohen@linux.intel.comSigned-off-by: default avatarDavid Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 661b0107
...@@ -396,6 +396,9 @@ struct devs_id { ...@@ -396,6 +396,9 @@ struct devs_id {
u8 type; u8 type;
u8 delay; u8 delay;
void *(*get_platform_data)(void *info); void *(*get_platform_data)(void *info);
/* Custom handler for devices */
void (*device_handler)(struct sfi_device_table_entry *pentry,
struct devs_id *dev);
}; };
/* the offset for the mapping of global gpio pin to irq */ /* the offset for the mapping of global gpio pin to irq */
...@@ -690,28 +693,27 @@ static void *tc35876x_platform_data(void *data) ...@@ -690,28 +693,27 @@ static void *tc35876x_platform_data(void *data)
} }
static const struct devs_id __initconst device_ids[] = { static const struct devs_id __initconst device_ids[] = {
{"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data, NULL},
{"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data, NULL},
{"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data}, {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data, NULL},
{"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data}, {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data, NULL},
{"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, {"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data, NULL},
{"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data, NULL},
{"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data}, {"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data, NULL},
{"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data}, {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data, NULL},
{"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data, NULL},
{"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data, NULL},
{"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data}, {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data, NULL},
{"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data}, {"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data, NULL},
/* MSIC subdevices */ /* MSIC subdevices */
{"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data, NULL},
{"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data}, {"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data, NULL},
{"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data}, {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data, NULL},
{"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data}, {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data, NULL},
{"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data}, {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data, NULL},
{"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data}, {"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data, NULL},
{ 0 }
{},
}; };
#define MAX_IPCDEVS 24 #define MAX_IPCDEVS 24
...@@ -965,6 +967,9 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) ...@@ -965,6 +967,9 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
if ((dev == NULL) || (dev->get_platform_data == NULL)) if ((dev == NULL) || (dev->get_platform_data == NULL))
continue; continue;
if (dev->device_handler) {
dev->device_handler(pentry, dev);
} else {
switch (pentry->type) { switch (pentry->type) {
case SFI_DEV_TYPE_IPC: case SFI_DEV_TYPE_IPC:
sfi_handle_ipc_dev(pentry, dev); sfi_handle_ipc_dev(pentry, dev);
...@@ -978,7 +983,8 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) ...@@ -978,7 +983,8 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
case SFI_DEV_TYPE_UART: case SFI_DEV_TYPE_UART:
case SFI_DEV_TYPE_HSI: case SFI_DEV_TYPE_HSI:
default: default:
; break;
}
} }
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment