[PATCH v1 08/13] intel_mid: Added custom handler for ipc devices
Added a custom handler for medfield based ipc devices and moved devs_id structure defintion to header file. Change-Id: Ib34d12e0f70da9b0890972d286072369bebf349d Signed-off-by: Sathyanarayanan Kuppuswamy --- arch/x86/include/asm/intel-mid.h| 15 ++ arch/x86/platform/intel-mid/intel-mid.c | 87 --- 2 files changed, 71 insertions(+), 31 deletions(-) diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h index beb7a5f..ad236ae 100644 --- a/arch/x86/include/asm/intel-mid.h +++ b/arch/x86/include/asm/intel-mid.h @@ -19,6 +19,21 @@ extern int sfi_mrtc_num; extern struct sfi_rtc_table_entry sfi_mrtc_array[]; /* + * Here defines the array of devices platform data that IAFW would export + * through SFI "DEVS" table, we use name and type to match the device and + * its platform data. + */ +struct devs_id { + char name[SFI_NAME_LEN + 1]; + u8 type; + u8 delay; + void *(*get_platform_data)(void *info); + /* Custom handler for devices */ + void (*device_handler)(struct sfi_device_table_entry *pentry, + struct devs_id *dev); +}; + +/* * Medfield is the follow-up of Moorestown, it combines two chip solution into * one. Other than that it also added always-on and constant tsc and lapic * timers. Medfield is the platform name, and the chip name is called Penwell diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c index f3abd75..1018ee8 100644 --- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c @@ -78,6 +78,8 @@ int sfi_mtimer_num; struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; EXPORT_SYMBOL_GPL(sfi_mrtc_array); int sfi_mrtc_num; +static void __init ipc_device_handler(struct sfi_device_table_entry *pentry, + struct devs_id *dev); static void intel_mid_power_off(void) { @@ -386,21 +388,6 @@ static int get_gpio_by_name(const char *name) return -1; } -/* - * Here defines the array of devices platform data that IAFW would export - * through SFI "DEVS" table, we use name and type to match the device and - * its platform data. - */ -struct devs_id { - char name[SFI_NAME_LEN + 1]; - u8 type; - u8 delay; - 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 */ #define INTEL_MID_IRQ_OFFSET 0x100 @@ -695,27 +682,32 @@ static void *tc35876x_platform_data(void *data) static const struct devs_id __initconst device_ids[] = { {"bma023", SFI_DEV_TYPE_I2C, 1, _platform_data, NULL}, {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, _gpio_platform_data, NULL}, - {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, _gpio_platform_data, NULL}, + {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, _gpio_platform_data, + _device_handler}, {"spi_max3111", SFI_DEV_TYPE_SPI, 0, _platform_data, NULL}, {"i2c_max7315", SFI_DEV_TYPE_I2C, 1, _platform_data, NULL}, {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, _platform_data, NULL}, {"tca6416", SFI_DEV_TYPE_I2C, 1, _platform_data, NULL}, {"emc1403", SFI_DEV_TYPE_I2C, 1, _platform_data, NULL}, {"i2c_accel", SFI_DEV_TYPE_I2C, 0, _platform_data, NULL}, - {"pmic_audio", SFI_DEV_TYPE_IPC, 1, _platform_data, NULL}, + {"pmic_audio", SFI_DEV_TYPE_IPC, 1, _platform_data, + _device_handler}, {"mpu3050", SFI_DEV_TYPE_I2C, 1, _platform_data, NULL}, {"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, _platform_data, NULL}, /* MSIC subdevices */ {"msic_battery", SFI_DEV_TYPE_IPC, 1, _battery_platform_data, - NULL}, - {"msic_gpio", SFI_DEV_TYPE_IPC, 1, _gpio_platform_data, NULL}, - {"msic_audio", SFI_DEV_TYPE_IPC, 1, _audio_platform_data, NULL}, + _device_handler}, + {"msic_gpio", SFI_DEV_TYPE_IPC, 1, _gpio_platform_data, + _device_handler}, + {"msic_audio", SFI_DEV_TYPE_IPC, 1, _audio_platform_data, + _device_handler}, {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, _power_btn_platform_data, - NULL}, - {"msic_ocd", SFI_DEV_TYPE_IPC, 1, _ocd_platform_data, NULL}, + _device_handler}, + {"msic_ocd", SFI_DEV_TYPE_IPC, 1, _ocd_platform_data, + _device_handler}, {"msic_thermal", SFI_DEV_TYPE_IPC, 1, _thermal_platform_data, - NULL}, + _device_handler}, {}, }; @@ -846,13 +838,6 @@ static void
[PATCH v1 08/13] intel_mid: Added custom handler for ipc devices
Added a custom handler for medfield based ipc devices and moved devs_id structure defintion to header file. Change-Id: Ib34d12e0f70da9b0890972d286072369bebf349d Signed-off-by: Sathyanarayanan Kuppuswamy sathyanarayanan.kuppusw...@intel.com --- arch/x86/include/asm/intel-mid.h| 15 ++ arch/x86/platform/intel-mid/intel-mid.c | 87 --- 2 files changed, 71 insertions(+), 31 deletions(-) diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h index beb7a5f..ad236ae 100644 --- a/arch/x86/include/asm/intel-mid.h +++ b/arch/x86/include/asm/intel-mid.h @@ -19,6 +19,21 @@ extern int sfi_mrtc_num; extern struct sfi_rtc_table_entry sfi_mrtc_array[]; /* + * Here defines the array of devices platform data that IAFW would export + * through SFI DEVS table, we use name and type to match the device and + * its platform data. + */ +struct devs_id { + char name[SFI_NAME_LEN + 1]; + u8 type; + u8 delay; + void *(*get_platform_data)(void *info); + /* Custom handler for devices */ + void (*device_handler)(struct sfi_device_table_entry *pentry, + struct devs_id *dev); +}; + +/* * Medfield is the follow-up of Moorestown, it combines two chip solution into * one. Other than that it also added always-on and constant tsc and lapic * timers. Medfield is the platform name, and the chip name is called Penwell diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c index f3abd75..1018ee8 100644 --- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c @@ -78,6 +78,8 @@ int sfi_mtimer_num; struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; EXPORT_SYMBOL_GPL(sfi_mrtc_array); int sfi_mrtc_num; +static void __init ipc_device_handler(struct sfi_device_table_entry *pentry, + struct devs_id *dev); static void intel_mid_power_off(void) { @@ -386,21 +388,6 @@ static int get_gpio_by_name(const char *name) return -1; } -/* - * Here defines the array of devices platform data that IAFW would export - * through SFI DEVS table, we use name and type to match the device and - * its platform data. - */ -struct devs_id { - char name[SFI_NAME_LEN + 1]; - u8 type; - u8 delay; - 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 */ #define INTEL_MID_IRQ_OFFSET 0x100 @@ -695,27 +682,32 @@ static void *tc35876x_platform_data(void *data) static const struct devs_id __initconst device_ids[] = { {bma023, SFI_DEV_TYPE_I2C, 1, no_platform_data, NULL}, {pmic_gpio, SFI_DEV_TYPE_SPI, 1, pmic_gpio_platform_data, NULL}, - {pmic_gpio, SFI_DEV_TYPE_IPC, 1, pmic_gpio_platform_data, NULL}, + {pmic_gpio, SFI_DEV_TYPE_IPC, 1, pmic_gpio_platform_data, + ipc_device_handler}, {spi_max3111, SFI_DEV_TYPE_SPI, 0, max3111_platform_data, NULL}, {i2c_max7315, SFI_DEV_TYPE_I2C, 1, max7315_platform_data, NULL}, {i2c_max7315_2, SFI_DEV_TYPE_I2C, 1, max7315_platform_data, NULL}, {tca6416, SFI_DEV_TYPE_I2C, 1, tca6416_platform_data, NULL}, {emc1403, SFI_DEV_TYPE_I2C, 1, emc1403_platform_data, NULL}, {i2c_accel, SFI_DEV_TYPE_I2C, 0, lis331dl_platform_data, NULL}, - {pmic_audio, SFI_DEV_TYPE_IPC, 1, no_platform_data, NULL}, + {pmic_audio, SFI_DEV_TYPE_IPC, 1, no_platform_data, + ipc_device_handler}, {mpu3050, SFI_DEV_TYPE_I2C, 1, mpu3050_platform_data, NULL}, {i2c_disp_brig, SFI_DEV_TYPE_I2C, 0, tc35876x_platform_data, NULL}, /* MSIC subdevices */ {msic_battery, SFI_DEV_TYPE_IPC, 1, msic_battery_platform_data, - NULL}, - {msic_gpio, SFI_DEV_TYPE_IPC, 1, msic_gpio_platform_data, NULL}, - {msic_audio, SFI_DEV_TYPE_IPC, 1, msic_audio_platform_data, NULL}, + ipc_device_handler}, + {msic_gpio, SFI_DEV_TYPE_IPC, 1, msic_gpio_platform_data, + ipc_device_handler}, + {msic_audio, SFI_DEV_TYPE_IPC, 1, msic_audio_platform_data, + ipc_device_handler}, {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, NULL}, + ipc_device_handler}, + {msic_ocd, SFI_DEV_TYPE_IPC, 1, msic_ocd_platform_data, + ipc_device_handler}, {msic_thermal, SFI_DEV_TYPE_IPC, 1, msic_thermal_platform_data, -