Refactored board files
authorGerman Monroy <german.monroy@intel.com>
Fri, 13 Apr 2012 20:30:32 +0000 (13:30 -0700)
committerbuildbot <buildbot@intel.com>
Sat, 14 Apr 2012 07:10:41 +0000 (00:10 -0700)
BZ:28671

Board files for different platforms have lot of common code, hence
to avoid code duplication we have re-factored the current board
file structure into following.

For each device we have created a separate platform_*device_name*.c,h
files.

platform_*device_name*.c - Contains device init and helper
   functions.
platform_*device_name*.h - Contains extern declaration of init
   function.

Compilation of these platform files is controlled using corresponding
driver CONFIG options.

To use these devices, In board files we will have to just include the
header file and add reference to the device init function in the
device_id structure.

Change-Id: Id8b80d41fd8253b624bf46ef72e41f4a4bb7238d
Signed-off-by: sathyanarayanan kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
Signed-off-by: German Monroy <german.monroy@intel.com>
Reviewed-on: http://android.intel.com:8080/43334
Reviewed-by: Yang, Fei <fei.yang@intel.com>
Tested-by: Yang, Fei <fei.yang@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
111 files changed:
arch/x86/include/asm/intel-mid.h
arch/x86/platform/intel-mid/Makefile
arch/x86/platform/intel-mid/board-blackbay.c
arch/x86/platform/intel-mid/board-ctp.c
arch/x86/platform/intel-mid/board-redridge.c
arch/x86/platform/intel-mid/device_libs/Makefile [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_a1026.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_a1026.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_apds990x.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_apds990x.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_bq24192.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_bq24192.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_btwilink.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_btwilink.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_camera.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_camera.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_clvs_audio.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_clvs_audio.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_cyttsp.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_cyttsp.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ektf2136.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ektf2136.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_emc1403.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_emc1403.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_hmc5883.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_hmc5883.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_hsi_modem.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_hsi_modem.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_hsu.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_hsu.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_i2c_gpio.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_i2c_gpio.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ipc.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ipc.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_kpd_led.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_kpd_led.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_kpd_led_gpio.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_kpd_led_gpio.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_l3g4200d.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_l3g4200d.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lis331.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lis331.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lis3dh.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lis3dh.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lm3554.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lm3554.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lsm303.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_lsm303.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ltr502als.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ltr502als.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max11871.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max11871.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max17042.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max17042.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max3111.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max3111.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max7315.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_max7315.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mid_pwm.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mid_pwm.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mpu3050.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ms5607.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ms5607.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_adc.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_adc.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_audio.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_battery.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mt9e013.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mt9e013.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mt9m114.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mt9m114.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mxt224.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mxt224.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mxt_ts.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_mxt_ts.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ov8830.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_ov8830.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_pmic_audio.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_pmic_audio.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_pn544.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_pn544.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_s3202.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_s3202.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_smb347.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_smb347.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_switch_mid.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_switch_mid.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_tc35876x.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_tca6416.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_tca6416.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_usb_otg.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_usb_otg.h [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_wl12xx.c [new file with mode: 0644]
arch/x86/platform/intel-mid/device_libs/platform_wl12xx.h [new file with mode: 0644]
arch/x86/platform/intel-mid/intel-mid.c

index 6cc6d7a..0ce7463 100644 (file)
@@ -228,5 +228,5 @@ static inline enum intel_mrfl_sim_type intel_mrfl_identify_sim(void)
 #else /* !CONFIG_X86_MRFLD */
 #define intel_mrfl_identify_sim()      (0)
 #endif /* !CONFIG_X86_MRFLD */
-
+#define INTEL_MID_IRQ_OFFSET 0x100
 #endif /* _ASM_X86_INTEL_MID_H */
index 1cd8531..738bc0b 100644 (file)
@@ -1,21 +1,28 @@
 CFLAGS_mfld-pmu.o        := -Werror
 
+# platform configuration for board devices
+obj-y                                  += device_libs/
+
 # INTEL-MID specific files
-obj-$(CONFIG_X86_INTEL_MID)    += intel_mid_vrtc.o
+obj-$(CONFIG_X86_INTEL_MID)            += intel_mid_vrtc.o
 obj-$(CONFIG_EARLY_PRINTK_INTEL_MID)   += early_printk_intel_mid.o
-obj-$(CONFIG_X86_INTEL_MID)    += intel-mid.o
+obj-$(CONFIG_X86_INTEL_MID)            += intel-mid.o
+
 # MRST specific files
-obj-$(CONFIG_X86_MRST)         += mrst.o
-obj-$(CONFIG_X86_MRST)         += mrst-pmu.o
+obj-$(CONFIG_X86_MRST)                 += mrst.o
+obj-$(CONFIG_X86_MRST)                 += mrst-pmu.o
+
 # MFLD specific files
-obj-$(CONFIG_X86_MDFLD)                += mfld.o
-obj-$(CONFIG_INTEL_MID_MDFLD_POWER)            += mfld-pmu.o
+obj-$(CONFIG_X86_MDFLD)                        += mfld.o
+obj-$(CONFIG_INTEL_MID_MDFLD_POWER)    += mfld-pmu.o
+obj-$(CONFIG_SERIAL_MFD_HSU)           += mfld-hsu.o
+
 # MRFL specific file
-obj-$(CONFIG_X86_MRFLD)                += mrfl.o
+obj-$(CONFIG_X86_MRFLD)                        += mrfl.o
+
 # BOARD files
-obj-$(CONFIG_BOARD_MFLD_BLACKBAY)              += board-blackbay.o
+obj-$(CONFIG_BOARD_MFLD_BLACKBAY)      += board-blackbay.o
 obj-$(CONFIG_BOARD_REDRIDGE)           += board-redridge.o
 obj-$(CONFIG_BOARD_CTP)                        += board-ctp.o
 obj-$(CONFIG_BOARD_MRFLD_VP)           += board-vp.o
 obj-$(CONFIG_BOARD_MRFLD_HVP)          += board-hvp.o
-obj-$(CONFIG_SERIAL_MFD_HSU)   += mfld-hsu.o
index 00d57cb..1666fc2 100644 (file)
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
-#include <linux/scatterlist.h>
 #include <linux/sfi.h>
-#include <linux/intel_pmic_gpio.h>
 #include <linux/lnw_gpio.h>
-#include <linux/spi/spi.h>
-#include <linux/cyttsp.h>
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
-#include <linux/power_supply.h>
-#include <linux/power/max17042_battery.h>
-#include <linux/power/intel_mdf_battery.h>
-#include <linux/nfc/pn544.h>
-#include <linux/skbuff.h>
-#include <linux/ti_wilink_st.h>
-#include <linux/gpio.h>
-#include <linux/gpio_keys.h>
-#include <linux/input.h>
-#include <linux/platform_device.h>
-#include <linux/ipc_device.h>
-#include <linux/mfd/intel_msic.h>
-#include <linux/irq.h>
-#include <linux/module.h>
-#include <linux/intel_mid_pm.h>
-#include <linux/input/lis3dh.h>
-#include <linux/usb/penwell_otg.h>
-#include <linux/hsi/hsi.h>
-#include <linux/hsi/intel_mid_hsi.h>
-#include <linux/wl12xx.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-#include <linux/atmel_mxt224.h>
-#include <linux/a1026.h>
-#include <linux/input/lis3dh.h>
-#include <linux/ms5607.h>
-#include <linux/i2c-gpio.h>
-#include <linux/max11871.h>
-#include <linux/i2c/apds990x.h>
-
-
-#include <linux/atomisp_platform.h>
-#include <media/v4l2-subdev.h>
-
-#include <linux/mmc/core.h>
-#include <linux/mmc/card.h>
-#include <linux/blkdev.h>
-
-#include <asm/setup.h>
-#include <asm/mpspec_def.h>
-#include <asm/hw_irq.h>
-#include <asm/apic.h>
-#include <asm/io_apic.h>
-#include <asm/intel-mid.h>
-#include <asm/mrst-vrtc.h>
-#include <asm/io.h>
-#include <asm/i8259.h>
-#include <asm/intel_scu_ipc.h>
-#include <asm/intel_kpd_gpio_led.h>
-#include <asm/apb_timer.h>
-#include <asm/intel_mid_gpadc.h>
-#include <asm/intel_mid_pwm.h>
-#include <asm/reboot.h>
-
-/* the offset for the mapping of global gpio pin to irq */
-#define MRST_IRQ_OFFSET 0x100
-
-enum ipc_dev_type {
-       IPC_DEV_PMIC_GPIO,
-       IPC_DEV_PMIC_AUDIO,
-       IPC_DEV_MSIC_ADC,
-       IPC_DEV_MSIC_BATTERY,
-       IPC_DEV_MSIC_GPIO,
-       IPC_DEV_MSIC_AUDIO,
-       IPC_DEV_MSIC_POWER_BTN,
-       IPC_DEV_MSIC_OCD,
-
-       IPC_DEV_NUM,
-};
-
-static enum ipc_dev_type current_ipcdev;
-static DEFINE_MUTEX(ipc_dev_lock);
-
-static struct resource pmic_gpio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource pmic_audio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_adc_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_battery_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_gpio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_audio_resources[] __initdata = {
-       {
-               .name  = "IRQ",
-               .flags = IORESOURCE_IRQ,
-       },
-       {
-               .name  = "IRQ_BASE",
-               .flags = IORESOURCE_MEM,
-               .start = MSIC_IRQ_STATUS_OCAUDIO,
-               .end   = MSIC_IRQ_STATUS_ACCDET,
-       },
-};
-
-static struct resource msic_power_btn_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_ocd_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-struct intel_ipc_dev_res {
-       const char *name;
-       int num_resources;
-       struct resource *resources;
-};
-
-static struct intel_ipc_dev_res ipc_dev_res[IPC_DEV_NUM] __initdata = {
-       [IPC_DEV_PMIC_GPIO]             = {
-               .name                   = "pmic_gpio",
-               .num_resources          = ARRAY_SIZE(pmic_gpio_resources),
-               .resources              = pmic_gpio_resources,
-       },
-       [IPC_DEV_PMIC_AUDIO]            = {
-               .name                   = "pmic_audio",
-               .num_resources          = ARRAY_SIZE(pmic_audio_resources),
-               .resources              = pmic_audio_resources,
-       },
-       [IPC_DEV_MSIC_ADC]              = {
-               .name                   = "msic_adc",
-               .num_resources          = ARRAY_SIZE(msic_adc_resources),
-               .resources              = msic_adc_resources,
-       },
-       [IPC_DEV_MSIC_BATTERY]          = {
-               .name                   = "msic_battery",
-               .num_resources          = ARRAY_SIZE(msic_battery_resources),
-               .resources              = msic_battery_resources,
-       },
-       [IPC_DEV_MSIC_GPIO]             = {
-               .name                   = "msic_gpio",
-               .num_resources          = ARRAY_SIZE(msic_gpio_resources),
-               .resources              = msic_gpio_resources,
-       },
-       [IPC_DEV_MSIC_AUDIO]            = {
-               .name                   = "msic_audio",
-               .num_resources          = ARRAY_SIZE(msic_audio_resources),
-               .resources              = msic_audio_resources,
-       },
-       [IPC_DEV_MSIC_POWER_BTN]        = {
-               .name                   = "msic_power_btn",
-               .num_resources          = ARRAY_SIZE(msic_power_btn_resources),
-               .resources              = msic_power_btn_resources,
-       },
-       [IPC_DEV_MSIC_OCD]              = {
-               .name                   = "msic_ocd",
-               .num_resources          = ARRAY_SIZE(msic_ocd_resources),
-               .resources              = msic_ocd_resources,
-       },
-};
-
-/* this should be called with the holding of ipc_dev_lock */
-static void handle_ipc_irq_res(enum ipc_dev_type type, int irq)
-{
-       struct resource *res = &ipc_dev_res[type].resources[0];
-
-       if (res->flags & IORESOURCE_IRQ)
-               res->start = irq;
-
-       current_ipcdev = type;
-}
-
-static void __init *pmic_gpio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
-       int gpio_base = get_gpio_by_name("pmic_gpio_base");
-
-       if (gpio_base == -1)
-               gpio_base = 64;
-       pmic_gpio_pdata.gpio_base = gpio_base;
-       pmic_gpio_pdata.irq_base = gpio_base + MRST_IRQ_OFFSET;
-       pmic_gpio_pdata.gpiointr = 0xffffeff8;
-
-       handle_ipc_irq_res(IPC_DEV_PMIC_GPIO, entry->irq);
-
-       return &pmic_gpio_pdata;
-}
-
-static void __init *pmic_audio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_PMIC_AUDIO, entry->irq);
-       return NULL;
-}
-
-static void __init *max3111_platform_data(void *info)
-{
-       struct spi_board_info *spi_info = info;
-       int intr = get_gpio_by_name("max3111_int");
-
-       spi_info->mode = SPI_MODE_0;
-       if (intr == -1)
-               return NULL;
-       spi_info->irq = intr + MRST_IRQ_OFFSET;
-       return NULL;
-}
-
-/* we have multiple max7315 on the board ... */
-#define MAX7315_NUM 2
-static void __init *max7315_platform_data(void *info)
-{
-       static struct pca953x_platform_data max7315_pdata[MAX7315_NUM];
-       static int nr;
-       struct pca953x_platform_data *max7315 = &max7315_pdata[nr];
-       struct i2c_board_info *i2c_info = info;
-       int gpio_base, intr;
-       char base_pin_name[SFI_NAME_LEN + 1];
-       char intr_pin_name[SFI_NAME_LEN + 1];
-
-       if (nr >= MAX7315_NUM) {
-               pr_err("too many max7315s, we only support %d\n",
-                               MAX7315_NUM);
-               return NULL;
-       }
-       /* we have several max7315 on the board, we only need load several
-        * instances of the same pca953x driver to cover them
-        */
-       strcpy(i2c_info->type, "max7315");
-       if (nr++) {
-               snprintf(base_pin_name, sizeof(base_pin_name), \
-                                                       "max7315_%d_base", nr);
-               snprintf(intr_pin_name, sizeof(intr_pin_name), \
-                                                       "max7315_%d_int", nr);
-       } else {
-               strcpy(base_pin_name, "max7315_base");
-               strcpy(intr_pin_name, "max7315_int");
-       }
-
-       gpio_base = get_gpio_by_name(base_pin_name);
-       intr = get_gpio_by_name(intr_pin_name);
-
-       if (gpio_base == -1)
-               return NULL;
-       max7315->gpio_base = gpio_base;
-       if (intr != -1) {
-               i2c_info->irq = intr + MRST_IRQ_OFFSET;
-               max7315->irq_base = gpio_base + MRST_IRQ_OFFSET;
-       } else {
-               i2c_info->irq = -1;
-               max7315->irq_base = -1;
-       }
-       return max7315;
-}
-
-static void *tca6416_platform_data(void *info)
-{
-       static struct pca953x_platform_data tca6416;
-       struct i2c_board_info *i2c_info = info;
-       int gpio_base, intr;
-       char base_pin_name[SFI_NAME_LEN + 1];
-       char intr_pin_name[SFI_NAME_LEN + 1];
-
-       strcpy(i2c_info->type, "tca6416");
-       strcpy(base_pin_name, "tca6416_base");
-       strcpy(intr_pin_name, "tca6416_int");
-
-       gpio_base = get_gpio_by_name(base_pin_name);
-       intr = get_gpio_by_name(intr_pin_name);
-
-       if (gpio_base == -1)
-               return NULL;
-       tca6416.gpio_base = gpio_base;
-       if (intr != -1) {
-               i2c_info->irq = intr + MRST_IRQ_OFFSET;
-               tca6416.irq_base = gpio_base + MRST_IRQ_OFFSET;
-       } else {
-               i2c_info->irq = -1;
-               tca6416.irq_base = -1;
-       }
-       return &tca6416;
-}
-
-static void *mpu3050_platform_data(void *info)
-{
-       struct i2c_board_info *i2c_info = info;
-       int intr = get_gpio_by_name("mpu3050_int");
-
-       if (intr == -1)
-               return NULL;
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-       return NULL;
-}
-
-static void *lsm303dlhc_accel_platform_data(void *info)
-{
-       static struct lis3dh_acc_platform_data accel;
-
-       accel.poll_interval = 200;
-       accel.negate_x = 1;
-       accel.negate_y = 0;
-       accel.negate_z = 0;
-       accel.axis_map_x = 0;
-       accel.axis_map_y = 1;
-       accel.axis_map_z = 2;
-       accel.gpio_int1 = get_gpio_by_name("accel_int");
-       accel.gpio_int2 = get_gpio_by_name("accel_2");
-       accel.model = MODEL_LSM303DLHC;
-
-       return &accel;
-}
-
-static void *ektf2136_spi_platform_data(void *info)
-{
-       static int dummy;
-       struct spi_board_info *spi_info = info;
-       int intr = get_gpio_by_name("ts_int");
-
-       if (intr == -1)
-               return NULL;
-       spi_info->irq = intr + MRST_IRQ_OFFSET;
-
-       /* we return a dummy pdata */
-       return &dummy;
-}
-
-static void __init *emc1403_platform_data(void *info)
-{
-       static short intr2nd_pdata;
-       struct i2c_board_info *i2c_info = info;
-       int intr = get_gpio_by_name("thermal_int");
-       int intr2nd = get_gpio_by_name("thermal_alert");
-
-       if (intr == -1 || intr2nd == -1)
-               return NULL;
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-       intr2nd_pdata = intr2nd + MRST_IRQ_OFFSET;
-
-       return &intr2nd_pdata;
-}
-
-static void __init *lis331dl_platform_data(void *info)
-{
-       static short intr2nd_pdata;
-       struct i2c_board_info *i2c_info = info;
-       int intr = get_gpio_by_name("accel_int");
-       int intr2nd = get_gpio_by_name("accel_2");
-
-       if (intr == -1 || intr2nd == -1)
-               return NULL;
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-       intr2nd_pdata = intr2nd + MRST_IRQ_OFFSET;
-
-       return &intr2nd_pdata;
-}
-
-/* MFLD NFC controller (PN544) platform init */
-#define NFC_HOST_INT_GPIO               "NFC-intr"
-#define NFC_ENABLE_GPIO                 "NFC-enable"
-#define NFC_FW_RESET_GPIO               "NFC-reset"
-
-static unsigned int nfc_host_int_gpio, nfc_enable_gpio, nfc_fw_reset_gpio;
-
-static int pn544_nfc_request_resources(struct i2c_client *client)
-{
-       int ret;
-
-       ret = gpio_request(nfc_host_int_gpio, NFC_HOST_INT_GPIO);
-       if (ret) {
-               dev_err(&client->dev, "Request NFC INT GPIO fails %d\n", ret);
-               return -1;
-       }
-
-       ret = gpio_direction_input(nfc_host_int_gpio);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_int;
-       }
-
-       ret = gpio_request(nfc_enable_gpio, NFC_ENABLE_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                       "Request for NFC Enable GPIO fails %d\n", ret);
-               goto err_int;
-       }
-
-       ret = gpio_direction_output(nfc_enable_gpio, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_enable;
-       }
-
-       ret = gpio_request(nfc_fw_reset_gpio, NFC_FW_RESET_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                       "Request for NFC FW Reset GPIO fails %d\n", ret);
-               goto err_enable;
-       }
-
-       ret = gpio_direction_output(nfc_fw_reset_gpio, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_fw;
-       }
-
-       return 0;
-err_fw:
-       gpio_free(nfc_fw_reset_gpio);
-err_enable:
-       gpio_free(nfc_enable_gpio);
-err_int:
-       gpio_free(nfc_host_int_gpio);
-       return -1;
-}
-
-void *pn544_platform_data(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *) info;
-       static struct pn544_i2c_platform_data mfld_pn544_nfc_platform_data;
-
-       memset(&mfld_pn544_nfc_platform_data, 0x00,
-               sizeof(struct pn544_i2c_platform_data));
-
-       nfc_host_int_gpio = get_gpio_by_name(NFC_HOST_INT_GPIO);
-       if (nfc_host_int_gpio == -1)
-               return NULL;
-       nfc_enable_gpio = get_gpio_by_name(NFC_ENABLE_GPIO);
-       if (nfc_enable_gpio  == -1)
-               return NULL;
-       nfc_fw_reset_gpio = get_gpio_by_name(NFC_FW_RESET_GPIO);
-       if (nfc_fw_reset_gpio == -1)
-               return NULL;
-
-       mfld_pn544_nfc_platform_data.irq_gpio = nfc_host_int_gpio;
-       mfld_pn544_nfc_platform_data.ven_gpio = nfc_enable_gpio;
-       mfld_pn544_nfc_platform_data.firm_gpio = nfc_fw_reset_gpio;
-
-       i2c_info->irq = nfc_host_int_gpio + MRST_IRQ_OFFSET;
-       mfld_pn544_nfc_platform_data.request_resources =
-               pn544_nfc_request_resources;
-
-       return &mfld_pn544_nfc_platform_data;
-}
-
-/* MFLD iCDK touchscreen data */
-#define CYTTSP_GPIO_PIN 0x3E
-static int cyttsp_init(int on)
-{
-       int ret;
-
-       if (on) {
-               ret = gpio_request(CYTTSP_GPIO_PIN, "cyttsp_irq");
-               if (ret < 0) {
-                       pr_err("%s: gpio request failed\n", __func__);
-                       return ret;
-               }
-
-               ret = gpio_direction_input(CYTTSP_GPIO_PIN);
-               if (ret < 0) {
-                       pr_err("%s: gpio direction config failed\n", __func__);
-                       gpio_free(CYTTSP_GPIO_PIN);
-                       return ret;
-               }
-       } else {
-               gpio_free(CYTTSP_GPIO_PIN);
-       }
-       return 0;
-}
-
-static void *cyttsp_platform_data(void *info)
-{
-       static struct cyttsp_platform_data cyttsp_pdata = {
-               .init = cyttsp_init,
-               .mt_sync = input_mt_sync,
-               .maxx = 480,
-               .maxy = 864,
-               .flags = 0,
-               .gen = CY_GEN3,
-               .use_st = 0,
-               .use_mt = 1,
-               .use_trk_id = 0,
-               .use_hndshk = 1,
-               .use_timer = 0,
-               .use_sleep = 1,
-               .use_gestures = 0,
-               .act_intrvl = CY_ACT_INTRVL_DFLT,
-               .tch_tmout = CY_TCH_TMOUT_DFLT,
-               .lp_intrvl = CY_LP_INTRVL_DFLT / 2,
-               .name = CY_I2C_NAME,
-               .irq_gpio = CYTTSP_GPIO_PIN,
-       };
-
-       return &cyttsp_pdata;
-}
-
-static void __init *no_platform_data(void *info)
-{
-       return NULL;
-}
-
-static void *msic_adc_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_mid_gpadc_platform_data pdata;
-       pdata.intr = 0xffff7fc0;
-
-       handle_ipc_irq_res(IPC_DEV_MSIC_ADC, entry->irq);
-
-       return &pdata;
-}
-
-
-static void *hsi_modem_platform_data(void *data)
-{
-       int rst_out = get_gpio_by_name("ifx_mdm_rst_out");
-       int pwr_on = get_gpio_by_name("ifx_mdm_pwr_on");
-       int rst_pmu = get_gpio_by_name("ifx_mdm_rst_pmu");
-       int fcdp_rb = get_gpio_by_name("modem-gpio2");
-
-       static const char hsi_char_name[]       = "hsi_char";
-       static const char hsi_ffl_name[]        = "hsi-ffl";
-
-       static struct hsi_board_info hsi_info[2] = {
-               [0] = {
-                       .name = hsi_char_name,
-                       .hsi_id = 0,
-                       .port = 0,
-                       .archdata = NULL,
-                       .tx_cfg.speed = 200000, /* tx clock, kHz */
-                       .tx_cfg.channels = 8,
-                       .tx_cfg.mode = HSI_MODE_FRAME,
-                       .tx_cfg.arb_mode = HSI_ARB_RR,
-                       .rx_cfg.flow = HSI_FLOW_SYNC,
-                       .rx_cfg.mode = HSI_MODE_FRAME,
-                       .rx_cfg.channels = 8
-               },
-               [1] = {
-                       .name = hsi_ffl_name,
-                       .hsi_id = 0,
-                       .port = 0,
-                       .archdata = NULL,
-                       .tx_cfg.speed = 100000, /* tx clock, kHz */
-                       .tx_cfg.channels = 8,
-                       .tx_cfg.mode = HSI_MODE_FRAME,
-                       .tx_cfg.arb_mode = HSI_ARB_RR,
-                       .rx_cfg.flow = HSI_FLOW_SYNC,
-                       .rx_cfg.mode = HSI_MODE_FRAME,
-                       .rx_cfg.channels = 8
-               }
-       };
-
-       static struct hsi_mid_platform_data mid_info = {
-               .tx_dma_channels[0] = -1,
-               .tx_dma_channels[1] = 5,
-               .tx_dma_channels[2] = -1,
-               .tx_dma_channels[3] = -1,
-               .tx_dma_channels[4] = -1,
-               .tx_dma_channels[5] = -1,
-               .tx_dma_channels[6] = -1,
-               .tx_dma_channels[7] = -1,
-               .tx_fifo_sizes[0] = -1,
-               .tx_fifo_sizes[1] = 1024,
-               .tx_fifo_sizes[2] = -1,
-               .tx_fifo_sizes[3] = -1,
-               .tx_fifo_sizes[4] = -1,
-               .tx_fifo_sizes[5] = -1,
-               .tx_fifo_sizes[6] = -1,
-               .tx_fifo_sizes[7] = -1,
-               .rx_dma_channels[0] = -1,
-               .rx_dma_channels[1] = 1,
-               .rx_dma_channels[2] = -1,
-               .rx_dma_channels[3] = -1,
-               .rx_dma_channels[4] = -1,
-               .rx_dma_channels[5] = -1,
-               .rx_dma_channels[6] = -1,
-               .rx_dma_channels[7] = -1,
-               .rx_fifo_sizes[0] = -1,
-               .rx_fifo_sizes[1] = 1024,
-               .rx_fifo_sizes[2] = -1,
-               .rx_fifo_sizes[3] = -1,
-               .rx_fifo_sizes[4] = -1,
-               .rx_fifo_sizes[5] = -1,
-               .rx_fifo_sizes[6] = -1,
-               .rx_fifo_sizes[7] = -1,
-       };
-
-       printk(KERN_INFO "HSI platform data setup\n");
-
-       printk(KERN_INFO "HSI mdm GPIOs %d, %d, %d, %d\n",
-               rst_out, pwr_on, rst_pmu, fcdp_rb);
-
-       mid_info.gpio_mdm_rst_out = rst_out;
-       mid_info.gpio_mdm_pwr_on = pwr_on;
-       mid_info.gpio_mdm_rst_bbn = rst_pmu;
-       mid_info.gpio_fcdp_rb = fcdp_rb;
-
-       hsi_info[0].platform_data = (void *)&mid_info;
-       hsi_info[1].platform_data = (void *)&mid_info;
-
-       return &hsi_info[0];
-}
-
-static void *msic_battery_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_MSIC_BATTERY, entry->irq);
-       return NULL;
-}
-
-static void *msic_gpio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_msic_gpio_pdata pdata;
-
-       int gpio = get_gpio_by_name("msic_gpio_base");
-       if (gpio < 0)
-               return NULL;
-
-       pdata.gpio_base = gpio;
-       handle_ipc_irq_res(IPC_DEV_MSIC_GPIO, entry->irq);
-
-       return &pdata;
-}
-
-void max17042_i2c_reset_workaround(void)
-{
-/* toggle clock pin of I2C-1 to recover devices from abnormal status.
- * currently, only max17042 on I2C-1 needs such workaround */
-#define I2C_1_GPIO_PIN 27
-       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_GPIO);
-       gpio_direction_output(I2C_1_GPIO_PIN, 0);
-       gpio_set_value(I2C_1_GPIO_PIN, 1);
-       udelay(10);
-       gpio_set_value(I2C_1_GPIO_PIN, 0);
-       udelay(10);
-       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_ALT_1);
-#undef I2C_1_GPIO_PIN 27
-}
-EXPORT_SYMBOL(max17042_i2c_reset_workaround);
-
-static bool msic_battery_check(void)
-{
-       if (get_oem0_table() == NULL) {
-               pr_info("invalid battery detected\n");
-               return false;
-       } else {
-               pr_info("valid battery detected\n");
-               return true;
-       }
-       return false;
-}
-
-
-static void *max170XX_platform_data(void *info)
-{
-       static struct max17042_platform_data platform_data;
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
-       int intr = get_gpio_by_name("max_fg_alert");
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-
-       if (msic_battery_check()) {
-               platform_data.enable_current_sense = true;
-               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
-       } else {
-               platform_data.enable_current_sense = false;
-               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
-       }
-
-       platform_data.is_init_done = 0;
-       platform_data.reset_i2c_lines = max17042_i2c_reset_workaround;
-
-       platform_data.current_sense_enabled =
-           intel_msic_is_current_sense_enabled;
-       platform_data.battery_present = intel_msic_check_battery_present;
-       platform_data.battery_health = intel_msic_check_battery_health;
-       platform_data.battery_status = intel_msic_check_battery_status;
-       platform_data.battery_pack_temp = intel_msic_get_battery_pack_temp;
-       platform_data.save_config_data = intel_msic_save_config_data;
-       platform_data.restore_config_data = intel_msic_restore_config_data;
-
-       platform_data.is_cap_shutdown_enabled =
-                                       intel_msic_is_capacity_shutdown_en;
-       platform_data.is_volt_shutdown_enabled = intel_msic_is_volt_shutdown_en;
-       platform_data.is_lowbatt_shutdown_enabled =
-                                       intel_msic_is_lowbatt_shutdown_en;
-       platform_data.get_vmin_threshold = intel_msic_get_vsys_min;
-
-       return &platform_data;
-}
-
-static void *msic_audio_platform_data(void *info)
-{
-       int ret;
-       struct platform_device *pdev;
-       struct sfi_device_table_entry *entry = info;
-
-       pdev = platform_device_alloc("sst-platform", -1);
-       if (!pdev) {
-               pr_err("failed to allocate audio platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add audio platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       pdev = platform_device_alloc("hdmi-audio", -1);
-       if (!pdev) {
-               pr_err("failed to allocate hdmi-audio platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add hdmi-audio platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       pdev = platform_device_alloc("sn95031", -1);
-       if (!pdev) {
-               pr_err("failed to allocate sn95031 platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add sn95031 platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       if (strncmp(entry->name, "msic_audio", 16) == 0)
-               handle_ipc_irq_res(IPC_DEV_MSIC_AUDIO, entry->irq);
-
-       return NULL;
-}
-
-static void *msic_power_btn_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_MSIC_POWER_BTN, entry->irq);
-       return NULL;
-}
-
-static void *msic_ocd_platform_data(void *info)
-{
-       int gpio;
-       static struct intel_msic_ocd_pdata pdata;
-
-       gpio = get_gpio_by_name("ocd_gpio");
-       if (gpio < 0)
-               return NULL;
-
-       pdata.gpio = gpio;
-
-       handle_ipc_irq_res(IPC_DEV_MSIC_OCD, gpio + MRST_IRQ_OFFSET);
-
-       return &pdata;
-}
-
-/* MFLD iCDK camera sensor GPIOs */
-
-#define GP_CAMERA_0_POWER_DOWN         "cam0_vcm_2p8"
-#define GP_CAMERA_1_POWER_DOWN         "camera_1_power"
-#define GP_CAMERA_0_RESET              "camera_0_reset"
-#define GP_CAMERA_1_RESET              "camera_1_reset"
-/* Need modify sensor driver's platform data structure to eliminate static */
-static int gp_camera0_reset;
-static int gp_camera0_power_down;
-static int gp_camera1_reset;
-static int gp_camera1_power_down;
-static int camera_vprog1_on;
-
-/*
- * One-time gpio initialization.
- * @name: gpio name: coded in SFI table
- * @gpio: gpio pin number (bypass @name)
- * @dir: GPIOF_DIR_IN or GPIOF_DIR_OUT
- * @value: if dir = GPIOF_DIR_OUT, this is the init value for output pin
- * if dir = GPIOF_DIR_IN, this argument is ignored
- * return: a positive pin number if succeeds, otherwise a negative value
- */
-static int camera_sensor_gpio(int gpio, char *name, int dir, int value)
-{
-       int ret, pin;
-
-       if (gpio == -1) {
-               pin = get_gpio_by_name(name);
-               if (pin == -1) {
-                       pr_err("%s: failed to get gpio(name: %s)\n",
-                                               __func__, name);
-                       return -EINVAL;
-               }
-       } else {
-               pin = gpio;
-       }
-
-       ret = gpio_request(pin, name);
-       if (ret) {
-               pr_err("%s: failed to request gpio(pin %d)\n", __func__, pin);
-               return -EINVAL;
-       }
-
-       if (dir == GPIOF_DIR_OUT)
-               ret = gpio_direction_output(pin, value);
-       else
-               ret = gpio_direction_input(pin);
-
-       if (ret) {
-               pr_err("%s: failed to set gpio(pin %d) direction\n",
-                                                       __func__, pin);
-               gpio_free(pin);
-       }
-
-       return ret ? ret : pin;
-}
-
-/*
- * Configure MIPI CSI physical parameters.
- * @port: ATOMISP_CAMERA_PORT_PRIMARY or ATOMISP_CAMERA_PORT_SECONDARY
- * @lanes: for ATOMISP_CAMERA_PORT_PRIMARY, there could be 2 or 4 lanes
- * for ATOMISP_CAMERA_PORT_SECONDARY, there is only one lane.
- * @format: MIPI CSI pixel format, see include/linux/atomisp_platform.h
- * @bayer_order: MIPI CSI bayer order, see include/linux/atomisp_platform.h
- */
-static int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
-                       u32 lanes, u32 format, u32 bayer_order, int flag)
-{
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
-       struct camera_mipi_info *csi = NULL;
-
-       if (flag) {
-               csi = kzalloc(sizeof(*csi), GFP_KERNEL);
-               if (!csi) {
-                       dev_err(&client->dev, "out of memory\n");
-                       return -ENOMEM;
-               }
-               csi->port = port;
-               csi->num_lanes = lanes;
-               csi->input_format = format;
-               csi->raw_bayer_order = bayer_order;
-               v4l2_set_subdev_hostdata(sd, (void *)csi);
-       } else {
-               csi = v4l2_get_subdev_hostdata(sd);
-               kfree(csi);
-       }
-
-       return 0;
-}
-
-
-/*
- * MFLD PR2 primary camera sensor - MT9E013 platform data
- */
-static int mt9e013_gpio_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera0_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_0_RESET,
-                                        GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera0_reset = ret;
-       }
-
-       if (flag) {
-               gpio_set_value(gp_camera0_reset, 0);
-               msleep(20);
-               gpio_set_value(gp_camera0_reset, 1);
-       } else {
-               gpio_set_value(gp_camera0_reset, 0);
-       }
-
-       return 0;
-}
-
-static int mt9e013_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       static const unsigned int clock_khz = 19200;
-       return intel_scu_ipc_osc_clk(OSC_CLK_CAM0, flag ? clock_khz : 0);
-}
-
-static int mt9e013_power_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera0_power_down < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_0_POWER_DOWN,
-                                        GPIOF_DIR_OUT, 1);
-               /*
-                * on some HW, this pin is not a connected pin,
-                * while on others, this indeed is avaiable.
-                * so just operate it when available and continue
-                * if it is failed.
-                */
-               if (ret < 0)
-                       pr_debug("%s not available.", GP_CAMERA_0_POWER_DOWN);
-               gp_camera0_power_down = ret;
-       }
-
-       if (flag) {
-               if (gp_camera0_power_down >= 0)
-                       gpio_set_value(gp_camera0_power_down, 1);
-               if (!camera_vprog1_on) {
-                       camera_vprog1_on = 1;
-                       intel_scu_ipc_msic_vprog1(1);
-               }
-       } else {
-               if (camera_vprog1_on) {
-                       camera_vprog1_on = 0;
-                       intel_scu_ipc_msic_vprog1(0);
-               }
-               if (gp_camera0_power_down >= 0)
-                       gpio_set_value(gp_camera0_power_down, 0);
-       }
-
-       return 0;
-}
-static int mt9e013_pixel_rate(void)
-{
-       return (board_id == MFLD_BID_LEX) ? 96 : 153;
-}
-static int mt9e013_csi_configure(struct v4l2_subdev *sd, int flag)
-{
-       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_PRIMARY, 2,
-               ATOMISP_INPUT_FORMAT_RAW_10, atomisp_bayer_order_grbg, flag);
-}
-
-static struct camera_sensor_platform_data mt9e013_sensor_platform_data = {
-       .gpio_ctrl      = mt9e013_gpio_ctrl,
-       .flisclk_ctrl   = mt9e013_flisclk_ctrl,
-       .power_ctrl     = mt9e013_power_ctrl,
-       .csi_cfg        = mt9e013_csi_configure,
-       .pixel_rate     = mt9e013_pixel_rate,
-};
-
-static void *mt9e013_platform_data_init(void *info)
-{
-       gp_camera0_reset = -1;
-       gp_camera0_power_down = -1;
-
-       return &mt9e013_sensor_platform_data;
-}
-
-/*
- * MFLD PR2 secondary camera sensor - MT9M114 platform data
- */
-static int mt9m114_gpio_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera1_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_1_RESET,
-                                        GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera1_reset = ret;
-       }
-
-       if (flag)
-               gpio_set_value(gp_camera1_reset, 1);
-       else
-               gpio_set_value(gp_camera1_reset, 0);
-
-       return 0;
-}
-
-static int mt9m114_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       static const unsigned int clock_khz = 19200;
-       return intel_scu_ipc_osc_clk(OSC_CLK_CAM1, flag ? clock_khz : 0);
-}
-
-static int mt9e013_reset;
-static int mt9m114_power_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       /* Note here, there maybe a workaround to avoid I2C SDA issue */
-       if (gp_camera1_power_down < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_1_POWER_DOWN,
-                                       GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera1_power_down = ret;
-       }
-
-       if (gp_camera1_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_1_RESET,
-                                        GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera1_reset = ret;
-       }
-
-       if (flag) {
-               if (!mt9e013_reset) {
-                       mt9e013_power_ctrl(sd, 1);
-                       mt9e013_gpio_ctrl(sd, 0);
-                       mt9e013_gpio_ctrl(sd, 1);
-                       mt9e013_gpio_ctrl(sd, 0);
-                       mt9e013_power_ctrl(sd, 0);
-                       mt9e013_reset = 1;
-               }
-
-               gpio_set_value(gp_camera1_reset, 0);
-               if (!camera_vprog1_on) {
-                       camera_vprog1_on = 1;
-                       intel_scu_ipc_msic_vprog1(1);
-               }
-               gpio_set_value(gp_camera1_power_down, 1);
-       } else {
-               if (camera_vprog1_on) {
-                       camera_vprog1_on = 0;
-                       intel_scu_ipc_msic_vprog1(0);
-               }
-               gpio_set_value(gp_camera1_power_down, 0);
-
-               mt9e013_reset = 0;
-       }
-
-       return 0;
-}
-
-static int mt9m114_csi_configure(struct v4l2_subdev *sd, int flag)
-{
-       /* soc sensor, there is no raw bayer order (set to -1) */
-       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_SECONDARY, 1,
-               ATOMISP_INPUT_FORMAT_YUV422_8, -1, flag);
-}
-
-static struct camera_sensor_platform_data mt9m114_sensor_platform_data = {
-       .gpio_ctrl      = mt9m114_gpio_ctrl,
-       .flisclk_ctrl   = mt9m114_flisclk_ctrl,
-       .power_ctrl     = mt9m114_power_ctrl,
-       .csi_cfg        = mt9m114_csi_configure,
-};
-
-static void *mt9m114_platform_data_init(void *info)
-{
-       gp_camera1_reset = -1;
-       gp_camera1_power_down = -1;
-
-       return &mt9m114_sensor_platform_data;
-}
-
-static void *lm3554_platform_data_init(void *info)
-{
-       static struct camera_flash_platform_data lm3554_platform_data;
-       void *ret = &lm3554_platform_data;
-
-       lm3554_platform_data.gpio_reset  = get_gpio_by_name("GP_FLASH_RESET");
-       lm3554_platform_data.gpio_strobe = get_gpio_by_name("GP_FLASH_STROBE");
-       lm3554_platform_data.gpio_torch  = get_gpio_by_name("GP_FLASH_TORCH");
-
-       if (lm3554_platform_data.gpio_reset == -1) {
-               pr_err("%s: Unable to find GP_FLASH_RESET\n", __func__);
-               ret = NULL;
-       }
-       if (lm3554_platform_data.gpio_strobe == -1) {
-               pr_err("%s: Unable to find GP_FLASH_STROBE\n", __func__);
-               ret = NULL;
-       }
-       if (lm3554_platform_data.gpio_torch == -1) {
-               pr_err("%s: Unable to find GP_FLASH_TORCH\n", __func__);
-               ret = NULL;
-       }
-
-       return ret;
-}
-
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
-static struct wl12xx_platform_data mid_wifi_control = {
-       .board_ref_clock = 1,
-       .irq = 2,
-       .board_tcxo_clock = 1,
-       .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
-};
-
-static struct regulator_consumer_supply wl12xx_vmmc3_supply = {
-       .supply         = "vmmc",
-       .dev_name       = "0000:00:00.0", /*default value*/
-};
-
-static struct regulator_init_data wl12xx_vmmc3 = {
-       .constraints = {
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies = &wl12xx_vmmc3_supply,
-};
-
-static struct fixed_voltage_config wl12xx_vwlan = {
-       .supply_name            = "vwl1271",
-       .microvolts             = 1800000,
-       .gpio                   = 75,
-       .startup_delay          = 70000,
-       .enable_high            = 1,
-       .enabled_at_boot        = 0,
-       .init_data              = &wl12xx_vmmc3,
-};
-
-static struct platform_device wl12xx_vwlan_device = {
-       .name           = "reg-fixed-voltage",
-       .id             = 1,
-       .dev = {
-               .platform_data  = &wl12xx_vwlan,
-       },
-};
-
-#define WL12XX_SFI_GPIO_IRQ_NAME "WLAN-interrupt"
-#define WL12XX_SFI_GPIO_ENABLE_NAME "WLAN-enable"
-#define ICDK_BOARD_REF_CLK 26000000
-#define NCDK_BOARD_REF_CLK 38400000
-
-void __init wl12xx_platform_data_init_post_scu(void *info)
-{
-       struct sd_board_info *sd_info = info;
-       int wifi_irq_gpio;
-       int err;
-
-       /*Get GPIO numbers from the SFI table*/
-       wifi_irq_gpio = get_gpio_by_name(WL12XX_SFI_GPIO_IRQ_NAME);
-       if (wifi_irq_gpio == -1) {
-               pr_err("%s: Unable to find WLAN-interrupt GPIO in the SFI table\n",
-                               __func__);
-               return;
-       }
-       err = gpio_request(wifi_irq_gpio, "wl12xx");
-       if (err < 0) {
-               pr_err("%s: Unable to request GPIO\n", __func__);
-               return;
-       }
-       err = gpio_direction_input(wifi_irq_gpio);
-       if (err < 0) {
-               pr_err("%s: Unable to set GPIO direction\n", __func__);
-               return;
-       }
-       mid_wifi_control.irq = gpio_to_irq(wifi_irq_gpio);
-       if (mid_wifi_control.irq < 0) {
-               pr_err("%s:Error gpio_to_irq:%d->%d\n", __func__, wifi_irq_gpio,
-                      mid_wifi_control.irq);
-               return;
-       }
-       /* Set our board_ref_clock from SFI SD board info */
-       if (sd_info->board_ref_clock == ICDK_BOARD_REF_CLK)
-               /*iCDK board*/
-               /*26Mhz TCXO clock ref*/
-               mid_wifi_control.board_ref_clock = 1;
-       else if (sd_info->board_ref_clock == NCDK_BOARD_REF_CLK)
-               /*nCDK board*/
-               /*38,4Mhz TCXO clock ref*/
-               mid_wifi_control.board_ref_clock = 2;
-
-       err = wl12xx_set_platform_data(&mid_wifi_control);
-       if (err < 0)
-               pr_err("error setting wl12xx data\n");
-
-       /* this is the fake regulator that mmc stack use to power of the
-          wifi sdio card via runtime_pm apis */
-       wl12xx_vwlan.gpio = get_gpio_by_name(WL12XX_SFI_GPIO_ENABLE_NAME);
-       if (wl12xx_vwlan.gpio == -1) {
-               pr_err("%s: Unable to find WLAN-enable GPIO in the SFI table\n",
-                      __func__);
-               return;
-       }
-       /* format vmmc reg address from sfi table */
-       sprintf((char *)wl12xx_vmmc3_supply.dev_name, "0000:00:%02x.%01x",
-               (sd_info->addr)>>8, sd_info->addr&0xFF);
-
-       err = platform_device_register(&wl12xx_vwlan_device);
-       if (err < 0)
-               pr_err("error platform_device_register\n");
-
-       sdhci_pci_request_regulators();
-}
-
-void __init *wl12xx_platform_data_init(void *info)
-{
-       struct sd_board_info *sd_info;
-
-       sd_info = kmemdup(info, sizeof(*sd_info), GFP_KERNEL);
-       if (!sd_info) {
-               pr_err("MRST: fail to alloc mem for delayed wl12xx dev\n");
-               return NULL;
-       }
-       intel_delayed_device_register(sd_info,
-                                     wl12xx_platform_data_init_post_scu);
-
-       return &mid_wifi_control;
-}
-#else
-void *wl12xx_platform_data_init(void *info)
-{
-       return NULL;
-}
-#endif
-
-void *atmel_mxt224_platform_data_init(void *info)
-{
-       static struct mxt_platform_data mxt_pdata;
-
-       mxt_pdata.numtouch       = 10;
-       mxt_pdata.max_x          = 1023;
-       mxt_pdata.max_y          = 975;
-       mxt_pdata.orientation    = MXT_MSGB_T9_ORIENT_HORZ_FLIP;
-       mxt_pdata.reset          = get_gpio_by_name("ts_rst");
-       mxt_pdata.irq            = get_gpio_by_name("ts_int");
-
-       return &mxt_pdata;
-}
-
-#define AUDIENCE_WAKEUP_GPIO               "audience-wakeup"
-#define AUDIENCE_RESET_GPIO                 "audience-reset"
-static int audience_request_resources(struct i2c_client *client)
-{
-       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
-               client->dev.platform_data;
-       int ret;
-
-       pr_debug("Audience: request ressource audience\n");
-       if (!pdata)
-               return -1;
-       ret = gpio_request(pdata->gpio_a1026_wakeup, AUDIENCE_WAKEUP_GPIO);
-       if (ret) {
-               dev_err(&client->dev, "Request AUDIENCE WAKEUP GPIO %d fails %d\n",
-                       pdata->gpio_a1026_wakeup, ret);
-               return -1;
-       }
-       ret = gpio_direction_output(pdata->gpio_a1026_wakeup, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_wake;
-       }
-
-       ret = gpio_request(pdata->gpio_a1026_reset, AUDIENCE_RESET_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                               "Request for Audience reset GPIO %d fails %d\n",
-                                       pdata->gpio_a1026_reset, ret);
-               goto err_wake;
-       }
-       ret = gpio_direction_output(pdata->gpio_a1026_reset, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_reset;
-       }
-       sprintf(pdata->firmware_name, "%s", "vpimg_es305b.bin");
-
-       return 0;
-err_reset:
-       gpio_free(pdata->gpio_a1026_reset);
-err_wake:
-       gpio_free(pdata->gpio_a1026_wakeup);
-       return -1;
-}
-
-static void audience_free_resources(struct i2c_client *client)
-{
-       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
-               &client->dev.platform_data;
-
-       gpio_free(pdata->gpio_a1026_wakeup);
-       gpio_free(pdata->gpio_a1026_reset);
-}
-
-static void audience_wake_up(bool state)
-{
-       int wakeup_gpio;
-
-       wakeup_gpio = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
-       if (wakeup_gpio == -1) {
-               pr_err("%s invalid wakeup gpio", __func__);
-               return;
-       }
-       gpio_set_value(wakeup_gpio, state);
-       pr_debug("Audience: WAKE UP %d\n", state);
-}
-
-static void audience_reset(bool state)
-{
-       int reset_gpio;
-
-       reset_gpio = get_gpio_by_name(AUDIENCE_RESET_GPIO);
-       if (reset_gpio == -1) {
-               pr_err("%s invalid reset gpio", __func__);
-               return;
-       }
-       gpio_set_value(reset_gpio, state);
-       pr_debug("Audience: RESET %d\n", state);
-}
-
-void *audience_platform_data_init(void *info)
-{
-       static struct a1026_platform_data pdata;
-
-       pdata.gpio_a1026_wakeup = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
-       pdata.gpio_a1026_reset = get_gpio_by_name(AUDIENCE_RESET_GPIO);
-       pdata.request_resources = audience_request_resources;
-       pdata.free_resources    = audience_free_resources;
-       pdata.wakeup                    = audience_wake_up;
-       pdata.reset                     = audience_reset;
-
-       return &pdata;
-}
-
-void *lis3dh_pdata_init(void *info)
-{
-       static struct lis3dh_acc_platform_data lis3dh_pdata;
-
-       lis3dh_pdata.poll_interval = 200;
-       lis3dh_pdata.negate_x = 1;
-       lis3dh_pdata.negate_y = 0;
-       lis3dh_pdata.negate_z = 0;
-       lis3dh_pdata.axis_map_x = 0;
-       lis3dh_pdata.axis_map_y = 1;
-       lis3dh_pdata.axis_map_z = 2;
-       lis3dh_pdata.gpio_int1 = 60;
-       lis3dh_pdata.gpio_int2 = 61;
+#include <linux/input.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/platform_device.h>
+#include <linux/ipc_device.h>
+#include <linux/i2c-gpio.h>
 
-       return &lis3dh_pdata;
+#include <asm/intel-mid.h>
+#include <asm/intel_mid_pwm.h>
 
-}
 
-void *ms5607_platform_data_init(void *info)
-{
-       static struct ms5607_platform_data baro_pdata;
+/*
+ * IPC devices
+ */
 
-       baro_pdata.poll_interval = 100;
-       baro_pdata.min_interval  = 0;
+#include "device_libs/platform_ipc.h"
+#include "device_libs/platform_pmic_gpio.h"
+#include "device_libs/platform_pmic_audio.h"
+#include "device_libs/platform_msic_adc.h"
+#include "device_libs/platform_msic_battery.h"
+#include "device_libs/platform_msic_gpio.h"
+#include "device_libs/platform_msic_audio.h"
+#include "device_libs/platform_msic_power_btn.h"
+#include "device_libs/platform_msic_ocd.h"
 
-       return &baro_pdata;
-};
+/*
+ * I2C devices
+ */
 
-void *compass_pdata_init(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+#include "device_libs/platform_max7315.h"
+#include "device_libs/platform_tca6416.h"
+#include "device_libs/platform_mpu3050.h"
+#include "device_libs/platform_lsm303.h"
+#include "device_libs/platform_emc1403.h"
+#include "device_libs/platform_lis331.h"
+#include "device_libs/platform_pn544.h"
+#include "device_libs/platform_cyttsp.h"
+#include "device_libs/platform_max17042.h"
+#include "device_libs/platform_camera.h"
+#include "device_libs/platform_mt9e013.h"
+#include "device_libs/platform_mt9m114.h"
+#include "device_libs/platform_mxt224.h"
+#include "device_libs/platform_a1026.h"
+#include "device_libs/platform_lis3dh.h"
+#include "device_libs/platform_ms5607.h"
+#include "device_libs/platform_mpu3050.h"
+#include "device_libs/platform_ltr502als.h"
+#include "device_libs/platform_hmc5883.h"
+#include "device_libs/platform_max11871.h"
+#include "device_libs/platform_apds990x.h"
+#include "device_libs/platform_lm3554.h"
 
-       i2c_info->irq = 0xff;
-       return NULL;
-}
+/*
+ * SPI devices
+ */
 
-void *gyro_pdata_init(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+#include "device_libs/platform_max3111.h"
+#include "device_libs/platform_ektf2136.h"
 
-       i2c_info->irq = get_gpio_by_name("gyro_int");
+/*
+ * HSI devices
+ */
 
-       return NULL;
-}
+#include "device_libs/platform_hsi_modem.h"
 
-void *baro_pdata_init(void *info)
-{
-       static struct ms5607_platform_data baro_pdata;
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+/*
+ * WIFI devices
+ */
 
-       i2c_info->irq = 0xff;
+#include "device_libs/platform_wl12xx.h"
 
-       baro_pdata.poll_interval = 100;
-       baro_pdata.min_interval  = 0;
+/*
+ * Bluetooth devices
+ */
 
-       return &baro_pdata;
-}
+#include "device_libs/platform_btwilink.h"
 
-void *als_pdata_init(void *info)
+static void __init *no_platform_data(void *info)
 {
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
-
-       i2c_info->irq = get_gpio_by_name("AL-intr");
-
        return NULL;
 }
 
-static const struct intel_v4l2_subdev_id v4l2_ids_mfld[] = {
+const struct intel_v4l2_subdev_id v4l2_ids[] = {
        {"mt9e013", RAW_CAMERA, ATOMISP_CAMERA_PORT_PRIMARY},
        {"mt9m114", SOC_CAMERA, ATOMISP_CAMERA_PORT_SECONDARY},
        {"lm3554", LED_FLASH, -1},
        {},
 };
 
-static const struct intel_v4l2_subdev_id *get_v4l2_ids(int *n_subdev)
-{
-       if (n_subdev)
-               *n_subdev = ARRAY_SIZE(v4l2_ids_mfld);
-       return v4l2_ids_mfld;
-}
-
-static struct atomisp_platform_data *v4l2_subdev_table_head;
-
-void intel_ignore_i2c_device_register(struct sfi_device_table_entry *pentry,
-                                       struct devs_id *dev)
-{
-       struct i2c_board_info i2c_info;
-       struct i2c_board_info *idev = &i2c_info;
-       int bus = pentry->host_num;
-       void *pdata = NULL;
-       int n_subdev;
-       const struct intel_v4l2_subdev_id *vdev = get_v4l2_ids(&n_subdev);
-       struct intel_v4l2_subdev_i2c_board_info *info;
-       static struct intel_v4l2_subdev_table *subdev_table;
-       enum intel_v4l2_subdev_type type = 0;
-       enum atomisp_camera_port port;
-       static int i;
-
-       memset(&i2c_info, 0, sizeof(i2c_info));
-       strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
-       i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
-       i2c_info.addr = pentry->addr;
-       pr_info("I2C bus = %d, name = %16.16s, "
-               "irq = 0x%2x, addr = 0x%x\n",
-               pentry->host_num,
-               i2c_info.type,
-               i2c_info.irq,
-               i2c_info.addr);
-       pdata = dev->get_platform_data(&i2c_info);
-       i2c_info.platform_data = pdata;
-
-
-       while (vdev->name[0]) {
-               if (!strncmp(vdev->name, idev->type, 16)) {
-                       /* compare name */
-                       type = vdev->type;
-                       port = vdev->port;
-                       break;
-               }
-               vdev++;
-       }
-
-       if (!type) /* not found */
-               return;
-
-       info = kzalloc(sizeof(struct intel_v4l2_subdev_i2c_board_info),
-                      GFP_KERNEL);
-       if (!info) {
-               pr_err("MRST: fail to alloc mem for ignored i2c dev %s\n",
-                      idev->type);
-               return;
-       }
-
-       info->i2c_adapter_id = bus;
-       /* set platform data */
-       memcpy(&info->board_info, idev, sizeof(*idev));
-
-       if (v4l2_subdev_table_head == NULL) {
-               subdev_table = kzalloc(sizeof(struct intel_v4l2_subdev_table)
-                       * n_subdev, GFP_KERNEL);
-
-               if (!subdev_table) {
-                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
-                              idev->type);
-                       kfree(info);
-                       return;
-               }
-
-               v4l2_subdev_table_head = kzalloc(
-                       sizeof(struct atomisp_platform_data), GFP_KERNEL);
-               if (!v4l2_subdev_table_head) {
-                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
-                              idev->type);
-                       kfree(info);
-                       kfree(subdev_table);
-                       return;
-               }
-               v4l2_subdev_table_head->subdevs = subdev_table;
-       }
-
-       memcpy(&subdev_table[i].v4l2_subdev, info, sizeof(*info));
-       subdev_table[i].type = type;
-       subdev_table[i].port = port;
-       i++;
-       kfree(info);
-       return;
-}
-
-const struct atomisp_platform_data *intel_get_v4l2_subdev_table(void)
-{
-       if (v4l2_subdev_table_head)
-               return v4l2_subdev_table_head;
-       else {
-               pr_err("MRST: no camera device in the SFI table\n");
-               return NULL;
-       }
-}
-EXPORT_SYMBOL_GPL(intel_get_v4l2_subdev_table);
-
-void blackbay_ipc_device_handler(struct sfi_device_table_entry *pentry,
-                               struct devs_id *dev)
-{
-       int res_num;
-       struct resource *res;
-       struct ipc_device *ipcdev;
-       void *pdata = NULL;
-
-       pr_info("IPC bus = %d, name = %16.16s, "
-               "irq = 0x%2x\n", pentry->host_num, pentry->name, pentry->irq);
-
-       mutex_lock(&ipc_dev_lock);
-
-       pdata = dev->get_platform_data(pentry);
-
-       ipcdev = ipc_device_alloc(pentry->name, -1);
-       if (ipcdev == NULL) {
-               pr_err("out of memory for SFI platform device '%s'.\n",
-                               pentry->name);
-               return;
-       }
-
-       res = ipc_dev_res[current_ipcdev].resources;
-       res_num = ipc_dev_res[current_ipcdev].num_resources;
-       ipc_device_add_resources(ipcdev, res, res_num);
-
-       ipcdev->dev.platform_data = pdata;
-       ipc_device_add_to_list(ipcdev);
-
-       mutex_unlock(&ipc_dev_lock);
-}
-
-static struct max11871_platform_data max11871_pdata = {
-       .version = 0x101,
-       .abs_x_min = 0,
-       .abs_x_max = 320,
-       .abs_y_min = 4,
-       .abs_y_max = 484,
-       .abs_z_min = 0,
-       .abs_z_max = 255,
-       .irq_flags = IRQF_TRIGGER_FALLING,
-};
-
-static int max11871_power(int on)
-{
-       if (on) {
-               gpio_set_value(max11871_pdata.gpio_rst, 1);
-               msleep(40);
-       } else {
-               gpio_set_value(max11871_pdata.gpio_rst, 0);
-               msleep(20);
-       }
-
-       return 0;
-}
-
-static int max11871_board_init(void)
-{
-       int ret = 0;
-       int gpio = max11871_pdata.gpio_irq;
-
-       ret = gpio_request(gpio, "max11871_irq");
-       if (ret < 0) {
-               pr_err("%s: failed to request GPIO %d\n", __func__, gpio);
-               return ret;
-       }
-       return gpio_direction_input(gpio);
-}
-
-static ssize_t max11871_virtual_keys_show(struct kobject *obj,
-                               struct kobj_attribute *attr, char *buf)
-{
-       /*
-        * virtual key format: version:code:centerX:centerY:width:height
-        * version must be 0x01, coordinate uses display unit
-        * (GI display size is 320 * 480), not raw touch unit
-        */
-
-       return sprintf(buf,
-                       "0x01:" __stringify(KEY_BACK) ":40:520:60:60:"
-                       "0x01:" __stringify(KEY_HOME) ":120:520:60:60:"
-                       "0x01:" __stringify(KEY_SEARCH) ":200:520:60:60:"
-                       "0x01:" __stringify(KEY_MENU) ":280:520:60:60\n");
-}
-
-static struct kobj_attribute max11871_virtual_keys_attr = {
-       .attr = {
-               .name = "virtualkeys.max11871_touchscreen_0",
-               .mode = S_IRUGO,
-       },
-       .show = max11871_virtual_keys_show,
-};
-
-void *max11871_platform_data_init(void *info)
-{
-       struct i2c_board_info *i2c_info = info;
-
-       intel_mid_create_property(&max11871_virtual_keys_attr.attr);
-
-       max11871_pdata.platform_hw_init = max11871_board_init,
-       max11871_pdata.power = max11871_power,
-       max11871_pdata.i2c_addr = i2c_info->addr;
-       max11871_pdata.gpio_irq = get_gpio_by_name("ts_int");
-       max11871_pdata.gpio_rst = get_gpio_by_name("ts_rst");
-
-       return &max11871_pdata;
-}
-
-void *apds990x_platform_data_init(void *info)
-{
-       static struct apds990x_platform_data platform_data = {
-               .pdrive = 0,
-               .ppcount = 1,
-       };
-       platform_data.gpio_number = get_gpio_by_name("AL-intr");
-
-       return &platform_data;
-}
-
 struct devs_id __initconst device_ids[] = {
        {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data, NULL},
        {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data,
-                                       &blackbay_ipc_device_handler},
-       {"cy8ctma340", SFI_DEV_TYPE_I2C, 1, &cyttsp_platform_data, NULL},
+                                       &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, &pmic_audio_platform_data,
-                                       &blackbay_ipc_device_handler},
        {"pn544", SFI_DEV_TYPE_I2C, 0, &pn544_platform_data, NULL},
        {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data, NULL},
-       {"ektf2136_spi", SFI_DEV_TYPE_SPI, 0, &ektf2136_spi_platform_data,
-                                               NULL},
        {"msic_adc", SFI_DEV_TYPE_IPC, 1, &msic_adc_platform_data,
-                                       &blackbay_ipc_device_handler},
-       {"max17050", SFI_DEV_TYPE_I2C, 1, &max170XX_platform_data, NULL},
-       {"max17042", SFI_DEV_TYPE_I2C, 1, &max170XX_platform_data, NULL},
+                                       &ipc_device_handler},
+       {"max17050", SFI_DEV_TYPE_I2C, 1, &max17042_platform_data, NULL},
+       {"max17042", SFI_DEV_TYPE_I2C, 1, &max17042_platform_data, NULL},
        {"hsi_ifx_modem", SFI_DEV_TYPE_HSI, 0, &hsi_modem_platform_data, NULL},
-       {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data_init,
-                                               NULL},
+       {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data, NULL},
        /* MSIC subdevices */
        {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
 
        /*
         * I2C devices for camera image subsystem which will not be load into
         * I2C core while initialize
         */
-       {"lm3554", SFI_DEV_TYPE_I2C, 0, &lm3554_platform_data_init,
+       {"lm3554", SFI_DEV_TYPE_I2C, 0, &lm3554_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"mt9e013", SFI_DEV_TYPE_I2C, 0, &mt9e013_platform_data_init,
+       {"mt9e013", SFI_DEV_TYPE_I2C, 0, &mt9e013_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"mt9m114", SFI_DEV_TYPE_I2C, 0, &mt9m114_platform_data_init,
+       {"mt9m114", SFI_DEV_TYPE_I2C, 0, &mt9m114_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"mxt224", SFI_DEV_TYPE_I2C, 0, &atmel_mxt224_platform_data_init, NULL},
-       {"max11871", SFI_DEV_TYPE_I2C, 0, &max11871_platform_data_init},
-       {"audience_es305", SFI_DEV_TYPE_I2C, 0, &audience_platform_data_init,
+       {"mxt224", SFI_DEV_TYPE_I2C, 0, &mxt224_platform_data, NULL},
+       {"max11871", SFI_DEV_TYPE_I2C, 0, &max11871_platform_data},
+       {"audience_es305", SFI_DEV_TYPE_I2C, 0, &audience_platform_data,
                                                NULL},
-       {"accel", SFI_DEV_TYPE_I2C, 0, &lis3dh_pdata_init, NULL},
-       {"compass", SFI_DEV_TYPE_I2C, 0, &compass_pdata_init, NULL},
-       {"gyro", SFI_DEV_TYPE_I2C, 0, &gyro_pdata_init, NULL},
-       {"baro", SFI_DEV_TYPE_I2C, 0, &baro_pdata_init, NULL},
-       {"als", SFI_DEV_TYPE_I2C, 0, &als_pdata_init, NULL},
+       {"accel", SFI_DEV_TYPE_I2C, 0, &lis3dh_platform_data, NULL},
+       {"compass", SFI_DEV_TYPE_I2C, 0, &hmc5883_platform_data, NULL},
+       {"gyro", SFI_DEV_TYPE_I2C, 0, &gyro_platform_data, NULL},
+       {"baro", SFI_DEV_TYPE_I2C, 0, &ms5607_platform_data, NULL},
+       {"als", SFI_DEV_TYPE_I2C, 0, &ltr502als_platform_data, NULL},
        {"cs42l73", SFI_DEV_TYPE_I2C, 1, &no_platform_data, NULL},
-
-       {"apds990x", SFI_DEV_TYPE_I2C, 0, &apds990x_platform_data_init},
+       {"apds990x", SFI_DEV_TYPE_I2C, 0, &apds990x_platform_data},
        {"lsm303dl", SFI_DEV_TYPE_I2C, 0, &lsm303dlhc_accel_platform_data},
-       {"lsm303cmp", SFI_DEV_TYPE_I2C, 0, &no_platform_data},
+       {"lsm303cmp", SFI_DEV_TYPE_I2C, 0, &no_platform_data, NULL},
        {},
 };
 
@@ -1766,351 +209,3 @@ int __init board_proc_init(void)
 }
 
 early_initcall(board_proc_init);
-
-/*
- * we will search these buttons in SFI GPIO table (by name)
- * and register them dynamically. Please add all possible
- * buttons here, we will shrink them if no GPIO found.
- */
-static struct gpio_keys_button gpio_button[] = {
-       {KEY_POWER,             -1, 1, "power_btn",     EV_KEY, 0, 3000},
-       {KEY_PROG1,             -1, 1, "prog_btn1",     EV_KEY, 0, 20},
-       {KEY_PROG2,             -1, 1, "prog_btn2",     EV_KEY, 0, 20},
-       {SW_LID,                -1, 1, "lid_switch",    EV_SW,  0, 20},
-       {KEY_VOLUMEUP,          -1, 1, "vol_up",        EV_KEY, 0, 20},
-       {KEY_VOLUMEDOWN,        -1, 1, "vol_down",      EV_KEY, 0, 20},
-       {KEY_CAMERA,            -1, 1, "camera_full",   EV_KEY, 0, 20},
-       {KEY_CAMERA_FOCUS,      -1, 1, "camera_half",   EV_KEY, 0, 20},
-       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw1",        EV_SW,  0, 20},
-       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw2",        EV_SW,  0, 20},
-       {KEY_CAMERA,            -1, 1, "cam_capture",   EV_KEY, 0, 20},
-       {KEY_CAMERA_FOCUS,      -1, 1, "cam_focus",     EV_KEY, 0, 20},
-};
-
-static struct gpio_keys_platform_data mrst_gpio_keys = {
-       .buttons        = gpio_button,
-       .rep            = 1,
-       .nbuttons       = -1, /* will fill it after search */
-};
-
-static struct platform_device pb_device = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = &mrst_gpio_keys,
-       },
-};
-
-#ifdef CONFIG_SWITCH_MID
-static struct platform_device switch_device = {
-       .name           = "switch-mid",
-       .id             = -1,
-};
-#endif
-
-
-#if defined(CONFIG_TI_ST) || defined(CONFIG_TI_ST_MODULE)
-
-/* KIM related */
-static int mrst_kim_suspend(struct platform_device *pdev, pm_message_t state)
-{
-       return 0;
-}
-static int mrst_kim_resume(struct platform_device *pdev)
-{
-       return 0;
-}
-
-static struct ti_st_plat_data kim_pdata = {
-       .nshutdown_gpio = -1,/* BT, FM, GPS gpios */
-       .flow_cntrl     = 1,            /* flow control flag */
-       .suspend        = mrst_kim_suspend,
-       .resume         = mrst_kim_resume,
-};
-
-static struct platform_device linux_kim_device = {
-       .name           = "kim", /* named after init manager for ST */
-       .id             = -1,
-       .dev.platform_data = &kim_pdata,
-};
-
-/* BT WILINK related */
-static int mrst_bt_enable(void)
-{
-       return 0;
-}
-static int mrst_bt_disable(void)
-{
-       return 0;
-}
-
-static struct ti_st_plat_data bt_pdata = {
-       .chip_enable    = mrst_bt_enable,
-       .chip_disable   = mrst_bt_disable,
-};
-
-static struct platform_device linux_bt_device = {
-       .name           = "btwilink", /* named after init manager for ST */
-       .id             = -1,
-       .dev.platform_data = &bt_pdata,
-};
-static int __init bluetooth_init(void)
-{
-       unsigned int UART_index;
-       long unsigned int UART_baud_rate;
-       int error_reg;
-
-       /* KIM INIT */
-       /* Get the GPIO number from the SFI table
-          if FM gpio is not provided then BT-reset line is
-          also used to enable FM
-       */
-       kim_pdata.nshutdown_gpio = get_gpio_by_name("BT-reset");
-       if (kim_pdata.nshutdown_gpio == -1)
-               return -ENODEV;
-
-       /* Get Share Transport uart settings */
-       /* TODO : add SFI table parsing and one SFI entry for this settings */
-       UART_index = 0;
-       UART_baud_rate = 3500000;
-
-       /* Share Transport uart settings */
-       sprintf((char *)kim_pdata.dev_name, "/dev/ttyMFD%u", UART_index);
-       kim_pdata.baud_rate = UART_baud_rate;
-
-       pr_info("%s: Setting platform_data with UART device name:%s and "
-                       "UART baud rate:%lu.\n",
-                       __func__, kim_pdata.dev_name, kim_pdata.baud_rate);
-
-       error_reg = platform_device_register(&linux_kim_device);
-       if (error_reg < 0) {
-               pr_err("platform_device_register for kim failed\n");
-               goto exit_on_error;
-       }
-
-       /* BT WILINK INIT */
-       error_reg = platform_device_register(&linux_bt_device);
-       if (error_reg < 0)
-               pr_err("platform_device_register for btwilink failed\n");
-exit_on_error:
-       return error_reg;
-
-}
-device_initcall(bluetooth_init);
-
-#endif
-
-/*
- * Shrink the non-existent buttons, register the gpio button
- * device if there is some
- */
-static int __init pb_keys_init(void)
-{
-       struct gpio_keys_button *gb = gpio_button;
-       int i, num, good = 0;
-
-       num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
-       for (i = 0; i < num; i++) {
-               gb[i].gpio = get_gpio_by_name(gb[i].desc);
-               if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_CLOVERVIEW &&
-                        (!strcmp(gb[i].desc, "vol_up")))
-                       gb[i].gpio = 30;
-               if (gb[i].gpio == -1)
-                       continue;
-
-               if (i != good)
-                       gb[good] = gb[i];
-               good++;
-       }
-
-       if (good) {
-               mrst_gpio_keys.nbuttons = good;
-               return platform_device_register(&pb_device);
-       }
-       return 0;
-}
-late_initcall(pb_keys_init);
-
-#define EMMC_BLK_NAME  "mmcblk0rpmb"
-static int emmc_match(struct device *dev, void *data)
-{
-       if (strcmp(dev_name(dev), data) == 0)
-               return 1;
-       return 0;
-}
-int mmc_blk_rpmb_req_handle(struct mmc_ioc_rpmb_req *req)
-{
-       struct device *emmc = NULL;
-
-       if (!req)
-               return -EINVAL;
-
-       emmc = class_find_device(&block_class, NULL, EMMC_BLK_NAME, emmc_match);
-       if (!emmc) {
-               pr_err("%s: eMMC card is not registered yet. Try it later\n",
-                               __func__);
-               return -ENODEV;
-       }
-
-       return mmc_rpmb_req_handle(emmc, req);
-}
-EXPORT_SYMBOL_GPL(mmc_blk_rpmb_req_handle);
-
-static int hdmi_i2c_workaround(void)
-{
-       int ret;
-       struct platform_device *pdev;
-       struct i2c_gpio_platform_data *pdata;
-
-       /*
-        * Hard code a gpio controller platform device to take over
-        * the two gpio pins used to be controlled by i2c bus 3.
-        * This is to support HDMI EDID extension block read, which
-        * is not supported by the current i2c controller, so we use
-        * GPIO pin the simulate an i2c bus.
-        */
-       pdev = platform_device_alloc("i2c-gpio", 8);
-       if (!pdev) {
-               pr_err("i2c-gpio: failed to alloc platform device\n");
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       pdata = kzalloc(sizeof(struct i2c_gpio_platform_data), GFP_KERNEL);
-       if (!pdata) {
-               pr_err("i2c-gpio: failed to alloc platform data\n");
-               kfree(pdev);
-               ret = -ENOMEM;
-               goto out;
-       }
-       pdata->scl_pin = 35 + 96;
-       pdata->sda_pin = 36 + 96;
-       pdata->sda_is_open_drain = 0;
-       pdata->scl_is_open_drain = 0;
-       pdev->dev.platform_data = pdata;
-
-       platform_device_add(pdev);
-
-       lnw_gpio_set_alt(pdata->sda_pin, LNW_GPIO);
-       lnw_gpio_set_alt(pdata->scl_pin, LNW_GPIO);
-
-out:
-       return ret;
-}
-rootfs_initcall(hdmi_i2c_workaround);
-
-#ifdef CONFIG_MID_PWM
-static int __init intel_mid_pwm_init(void)
-{
-       int ret, i;
-       struct ipc_board_info board_info;
-       static struct intel_mid_pwm_platform_data mid_pwm_pdata;
-
-       for (i = 0; i < PWM_NUM; i++) {
-               mid_pwm_pdata.reg_clkdiv0[i] = MSIC_REG_PWM0CLKDIV0 + i * 2;
-               mid_pwm_pdata.reg_clkdiv1[i] = MSIC_REG_PWM0CLKDIV1 + i * 2;
-               mid_pwm_pdata.reg_dutycyc[i] = MSIC_REG_PWM0DUTYCYCLE + i;
-       }
-
-       memset(&board_info, 0, sizeof(board_info));
-       strncpy(board_info.name, "intel_mid_pwm", 16);
-       board_info.bus_id = IPC_SCU;
-       board_info.id = -1;
-       board_info.platform_data = &mid_pwm_pdata;
-
-       ret = ipc_new_device(&board_info);
-       if (ret) {
-               pr_err("failed to create ipc device: intel_mid_pwm\n");
-               return -1;
-       }
-
-       return 0;
-}
-fs_initcall(intel_mid_pwm_init);
-#endif
-
-#ifdef CONFIG_LEDS_INTEL_KPD
-static int __init intel_kpd_led_init(void)
-{
-       int ret;
-       struct ipc_board_info board_info;
-
-       memset(&board_info, 0, sizeof(board_info));
-       strncpy(board_info.name, "intel_kpd_led", 16);
-       board_info.bus_id = IPC_SCU;
-       board_info.id = -1;
-
-       ret = ipc_new_device(&board_info);
-       if (ret) {
-               pr_err("failed to create ipc device: intel_kpd_led\n");
-               return -1;
-       }
-
-       return 0;
-}
-fs_initcall(intel_kpd_led_init);
-#endif
-
-#ifdef CONFIG_LEDS_INTEL_KPD_GPIO
-static int __init intel_kpd_gpio_led_init(void)
-{
-       int ret;
-       struct platform_device *pdev;
-       static struct intel_kpd_gpio_led_pdata pdata;
-
-       pdev = platform_device_alloc("intel_kpd_led", -1);
-       if (!pdev) {
-               pr_err("Failed to create platform device: intel_kpd_led\n");
-               return -ENOMEM;
-       }
-
-       /* Revert me:
-        * Using hard coding here, will revert after
-        * IAFW support for KPD LED GPIO is available
-        */
-       ret = get_gpio_by_name("intel_kpd_led");
-       if (ret == -1) {
-               pr_err("Failed to get KPD LED gpio pin from SFI table\n");
-               pdata.gpio = 133; /* hard coding */
-       } else
-               pdata.gpio = ret;
-
-       pdev->dev.platform_data = &pdata;
-
-       return platform_device_add(pdev);
-}
-device_initcall(intel_kpd_gpio_led_init);
-#endif
-
-static int __init intel_msic_thermal_init(void)
-{
-       int ret;
-       struct ipc_board_info board_info;
-
-       memset(&board_info, 0, sizeof(board_info));
-       strncpy(board_info.name, "msic_thermal", 16);
-       board_info.bus_id = IPC_SCU;
-       board_info.id = -1;
-
-       ret = ipc_new_device(&board_info);
-       if (ret) {
-               pr_err("failed to create ipc device: msic_thermal\n");
-               return -1;
-       }
-
-       return 0;
-}
-fs_initcall(intel_msic_thermal_init);
-
-
-#ifdef CONFIG_SWITCH_MID
-static int __init switch_mid_init(void)
-{
-       int err;
-       err = platform_device_register(&switch_device);
-       if (err < 0)
-               pr_err("Fail to register switch-mid platform device.\n");
-       return 0;
-}
-device_initcall(switch_mid_init);
-#endif
index 1356cff..bdbcc54 100644 (file)
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
-#include <linux/scatterlist.h>
 #include <linux/sfi.h>
-#include <linux/intel_pmic_gpio.h>
 #include <linux/lnw_gpio.h>
-#include <linux/spi/spi.h>
-#include <linux/cyttsp.h>
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
-#include <linux/power_supply.h>
-#include <linux/power/max17042_battery.h>
-#include <linux/power/bq24192_charger.h>
-#include <linux/nfc/pn544.h>
-#include <linux/skbuff.h>
-#include <linux/ti_wilink_st.h>
+#include <linux/input.h>
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
-#include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/ipc_device.h>
-#include <linux/mfd/intel_msic.h>
-#include <linux/irq.h>
-#include <linux/module.h>
-#include <linux/intel_mid_pm.h>
-#include <linux/input/lis3dh.h>
-#include <linux/usb/penwell_otg.h>
-#include <linux/hsi/hsi.h>
-#include <linux/hsi/intel_mid_hsi.h>
-#include <linux/input/l3g4200d_poll.h>
-#include <linux/wl12xx.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-#include <linux/atmel_mxt224.h>
-#include <linux/a1026.h>
-#include <linux/input/lis3dh.h>
-#include <linux/ms5607.h>
-#include <linux/i2c/apds990x.h>
 #include <linux/i2c-gpio.h>
-#include <linux/synaptics_i2c_rmi4.h>
-
-
-#include <linux/atomisp_platform.h>
-#include <media/v4l2-subdev.h>
 
-#include <linux/mmc/core.h>
-#include <linux/mmc/card.h>
-#include <linux/blkdev.h>
-
-#include <asm/setup.h>
-#include <asm/mpspec_def.h>
-#include <asm/hw_irq.h>
-#include <asm/apic.h>
-#include <asm/io_apic.h>
 #include <asm/intel-mid.h>
-#include <asm/mrst-vrtc.h>
-#include <asm/io.h>
-#include <asm/i8259.h>
-#include <asm/intel_scu_ipc.h>
-#include <asm/apb_timer.h>
-#include <asm/intel_mid_gpadc.h>
 #include <asm/intel_mid_pwm.h>
-#include <asm/reboot.h>
-#include <asm/intel_mid_hsu.h>
-
-/* the offset for the mapping of global gpio pin to irq */
-#define MRST_IRQ_OFFSET 0x100
-
-enum ipc_dev_type {
-       IPC_DEV_PMIC_GPIO,
-       IPC_DEV_PMIC_AUDIO,
-       IPC_DEV_MSIC_ADC,
-       IPC_DEV_MSIC_BATTERY,
-       IPC_DEV_MSIC_GPIO,
-       IPC_DEV_MSIC_AUDIO,
-       IPC_DEV_MSIC_POWER_BTN,
-       IPC_DEV_MSIC_OCD,
-
-       IPC_DEV_NUM,
-};
-
-static enum ipc_dev_type current_ipcdev;
-static DEFINE_MUTEX(ipc_dev_lock);
-
-static struct resource pmic_gpio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource pmic_audio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_adc_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_battery_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_gpio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_audio_resources[] __initdata = {
-       {
-               .name  = "IRQ",
-               .flags = IORESOURCE_IRQ,
-       },
-       {
-               .name  = "IRQ_BASE",
-               .flags = IORESOURCE_MEM,
-               .start = MSIC_IRQ_STATUS_OCAUDIO,
-               .end   = MSIC_IRQ_STATUS_ACCDET,
-       },
-};
-
-static struct resource msic_power_btn_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_ocd_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-struct intel_ipc_dev_res {
-       const char *name;
-       int num_resources;
-       struct resource *resources;
-};
-
-static struct intel_ipc_dev_res ipc_dev_res[IPC_DEV_NUM] __initdata = {
-       [IPC_DEV_PMIC_GPIO]             = {
-               .name                   = "pmic_gpio",
-               .num_resources          = ARRAY_SIZE(pmic_gpio_resources),
-               .resources              = pmic_gpio_resources,
-       },
-       [IPC_DEV_PMIC_AUDIO]            = {
-               .name                   = "pmic_audio",
-               .num_resources          = ARRAY_SIZE(pmic_audio_resources),
-               .resources              = pmic_audio_resources,
-       },
-       [IPC_DEV_MSIC_ADC]              = {
-               .name                   = "msic_adc",
-               .num_resources          = ARRAY_SIZE(msic_adc_resources),
-               .resources              = msic_adc_resources,
-       },
-       [IPC_DEV_MSIC_BATTERY]          = {
-               .name                   = "msic_battery",
-               .num_resources          = ARRAY_SIZE(msic_battery_resources),
-               .resources              = msic_battery_resources,
-       },
-       [IPC_DEV_MSIC_GPIO]             = {
-               .name                   = "msic_gpio",
-               .num_resources          = ARRAY_SIZE(msic_gpio_resources),
-               .resources              = msic_gpio_resources,
-       },
-       [IPC_DEV_MSIC_AUDIO]            = {
-               .name                   = "msic_audio",
-               .num_resources          = ARRAY_SIZE(msic_audio_resources),
-               .resources              = msic_audio_resources,
-       },
-       [IPC_DEV_MSIC_POWER_BTN]        = {
-               .name                   = "msic_power_btn",
-               .num_resources          = ARRAY_SIZE(msic_power_btn_resources),
-               .resources              = msic_power_btn_resources,
-       },
-       [IPC_DEV_MSIC_OCD]              = {
-               .name                   = "msic_ocd",
-               .num_resources          = ARRAY_SIZE(msic_ocd_resources),
-               .resources              = msic_ocd_resources,
-       },
-};
-
-/* this should be called with the holding of ipc_dev_lock */
-static void handle_ipc_irq_res(enum ipc_dev_type type, int irq)
-{
-       struct resource *res = &ipc_dev_res[type].resources[0];
-
-       if (res->flags & IORESOURCE_IRQ)
-               res->start = irq;
-
-       current_ipcdev = type;
-}
-
-static void __init *pmic_gpio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
-       int gpio_base = get_gpio_by_name("pmic_gpio_base");
-
-       if (gpio_base == -1)
-               gpio_base = 64;
-       pmic_gpio_pdata.gpio_base = gpio_base;
-       pmic_gpio_pdata.irq_base = gpio_base + MRST_IRQ_OFFSET;
-       pmic_gpio_pdata.gpiointr = 0xffffeff8;
-
-       handle_ipc_irq_res(IPC_DEV_PMIC_GPIO, entry->irq);
-
-       return &pmic_gpio_pdata;
-}
-
-static void __init *pmic_audio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_PMIC_AUDIO, entry->irq);
-       return NULL;
-}
-
-static void __init *max3111_platform_data(void *info)
-{
-       struct spi_board_info *spi_info = info;
-       int intr = get_gpio_by_name("max3111_int");
-
-       spi_info->mode = SPI_MODE_0;
-       if (intr == -1)
-               return NULL;
-       spi_info->irq = intr + MRST_IRQ_OFFSET;
-       return NULL;
-}
-
-static void *tca6416_platform_data(void *info)
-{
-       static struct pca953x_platform_data tca6416;
-       struct i2c_board_info *i2c_info = info;
-       int gpio_base, intr;
-       char base_pin_name[SFI_NAME_LEN + 1];
-       char intr_pin_name[SFI_NAME_LEN + 1];
-
-       strcpy(i2c_info->type, "tca6416");
-       strcpy(base_pin_name, "tca6416_base");
-       strcpy(intr_pin_name, "tca6416_int");
-
-       gpio_base = get_gpio_by_name(base_pin_name);
-       intr = get_gpio_by_name(intr_pin_name);
-
-       if (gpio_base == -1)
-               return NULL;
-       tca6416.gpio_base = gpio_base;
-       if (intr != -1) {
-               i2c_info->irq = intr + MRST_IRQ_OFFSET;
-               tca6416.irq_base = gpio_base + MRST_IRQ_OFFSET;
-       } else {
-               i2c_info->irq = -1;
-               tca6416.irq_base = -1;
-       }
-       return &tca6416;
-}
-
-static void *lsm303dlhc_accel_platform_data(void *info)
-{
-       static struct lis3dh_acc_platform_data accel;
-
-       accel.poll_interval = 200;
-       accel.negate_x = 1;
-       accel.negate_y = 0;
-       accel.negate_z = 0;
-       accel.axis_map_x = 0;
-       accel.axis_map_y = 1;
-       accel.axis_map_z = 2;
-       accel.gpio_int1 = get_gpio_by_name("accel_int");
-       accel.gpio_int2 = get_gpio_by_name("accel_2");
-       accel.model = MODEL_LSM303DLHC;
-
-       return &accel;
-}
-
-void *apds990x_platform_data_init(void *info)
-{
-       static struct apds990x_platform_data platform_data = {
-               .pdrive = 0,
-               .ppcount = 1,
-       };
-       platform_data.gpio_number = get_gpio_by_name("AL-intr");
-
-       return &platform_data;
-}
-
-/* VV board only */
-static void __init *emc1403_platform_data(void *info)
-{
-       static short intr2nd_pdata;
-       struct i2c_board_info *i2c_info = info;
-       int intr = get_gpio_by_name("thermal_int");
-       int intr2nd = get_gpio_by_name("thermal_alert");
-
-       if (intr == -1 || intr2nd == -1)
-               return NULL;
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-       intr2nd_pdata = intr2nd + MRST_IRQ_OFFSET;
-
-       return &intr2nd_pdata;
-}
-
-static void __init *l3g4200d_platform_data(void *info)
-{
-       static struct l3g4200d_gyr_platform_data l3g4200d_pdata;
-
-       l3g4200d_pdata.fs_range = L3G4200D_GYR_FS_2000DPS;
-       l3g4200d_pdata.poll_interval = 200;
-       l3g4200d_pdata.negate_x = 0;
-       l3g4200d_pdata.negate_y = 0;
-       l3g4200d_pdata.negate_z = 0;
-       l3g4200d_pdata.axis_map_x = 0;
-       l3g4200d_pdata.axis_map_y = 1;
-       l3g4200d_pdata.axis_map_z = 2;
-
-       return &l3g4200d_pdata;
-}
-
-/* MFLD NFC controller (PN544) platform init */
-#define NFC_HOST_INT_GPIO               "NFC-intr"
-#define NFC_ENABLE_GPIO                 "NFC-enable"
-#define NFC_FW_RESET_GPIO               "NFC-reset"
-
-static unsigned int nfc_host_int_gpio, nfc_enable_gpio, nfc_fw_reset_gpio;
-
-static int pn544_nfc_request_resources(struct i2c_client *client)
-{
-       int ret;
-
-       ret = gpio_request(nfc_host_int_gpio, NFC_HOST_INT_GPIO);
-       if (ret) {
-               dev_err(&client->dev, "Request NFC INT GPIO fails %d\n", ret);
-               return -1;
-       }
-
-       ret = gpio_direction_input(nfc_host_int_gpio);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_int;
-       }
-
-       ret = gpio_request(nfc_enable_gpio, NFC_ENABLE_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                       "Request for NFC Enable GPIO fails %d\n", ret);
-               goto err_int;
-       }
-
-       ret = gpio_direction_output(nfc_enable_gpio, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_enable;
-       }
-
-       ret = gpio_request(nfc_fw_reset_gpio, NFC_FW_RESET_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                       "Request for NFC FW Reset GPIO fails %d\n", ret);
-               goto err_enable;
-       }
-
-       ret = gpio_direction_output(nfc_fw_reset_gpio, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_fw;
-       }
-
-       return 0;
-err_fw:
-       gpio_free(nfc_fw_reset_gpio);
-err_enable:
-       gpio_free(nfc_enable_gpio);
-err_int:
-       gpio_free(nfc_host_int_gpio);
-       return -1;
-}
-
-void *pn544_platform_data(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *) info;
-       static struct pn544_i2c_platform_data mfld_pn544_nfc_platform_data;
-
-       memset(&mfld_pn544_nfc_platform_data, 0x00,
-               sizeof(struct pn544_i2c_platform_data));
-
-       nfc_host_int_gpio = get_gpio_by_name(NFC_HOST_INT_GPIO);
-       if (nfc_host_int_gpio == -1)
-               return NULL;
-       nfc_enable_gpio = get_gpio_by_name(NFC_ENABLE_GPIO);
-       if (nfc_enable_gpio  == -1)
-               return NULL;
-       nfc_fw_reset_gpio = get_gpio_by_name(NFC_FW_RESET_GPIO);
-       if (nfc_fw_reset_gpio == -1)
-               return NULL;
-
-       mfld_pn544_nfc_platform_data.irq_gpio = nfc_host_int_gpio;
-       mfld_pn544_nfc_platform_data.ven_gpio = nfc_enable_gpio;
-       mfld_pn544_nfc_platform_data.firm_gpio = nfc_fw_reset_gpio;
-
-       i2c_info->irq = nfc_host_int_gpio + MRST_IRQ_OFFSET;
-       mfld_pn544_nfc_platform_data.request_resources =
-               pn544_nfc_request_resources;
-
-       return &mfld_pn544_nfc_platform_data;
-}
-
-static void __init *no_platform_data(void *info)
-{
-       return NULL;
-}
-
-static void *msic_adc_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_mid_gpadc_platform_data pdata;
-       pdata.intr = 0xffff7fc0;
-
-       handle_ipc_irq_res(IPC_DEV_MSIC_ADC, entry->irq);
-
-       return &pdata;
-}
-
-static void *hsi_modem_platform_data(void *data)
-{
-       int rst_out = get_gpio_by_name("ifx_mdm_rst_out");
-       int pwr_on = get_gpio_by_name("ifx_mdm_pwr_on");
-       int rst_pmu = get_gpio_by_name("ifx_mdm_rst_pmu");
-       int fcdp_rb = get_gpio_by_name("modem-gpio2");
-
-       static const char hsi_char_name[]       = "hsi_char";
-#if defined(CONFIG_HSI_FFL_TTY)
-       static const char hsi_ffl_name[]        = "hsi-ffl";
-#elif defined(CONFIG_HSI_DLP)
-       static const char hsi_dlp_name[]        = "hsi-dlp";
-#endif
-
-#if ((defined CONFIG_HSI_FFL_TTY) && (defined CONFIG_HSI_DLP))
-#error "Only define one of HSI_FFL_TTY or HSI_DLP"
-#elif (defined(CONFIG_HSI_FFL_TTY) || defined(CONFIG_HSI_DLP))
-#define HSI_CLIENT_CNT 2
-#else
-#define HSI_CLIENT_CNT 1
-#endif
-
-       static struct hsi_board_info hsi_info[HSI_CLIENT_CNT] = {
-               [0] = {
-                       .name = hsi_char_name,
-                       .hsi_id = 0,
-                       .port = 0,
-                       .archdata = NULL,
-                       .tx_cfg.speed = 200000, /* tx clock, kHz */
-                       .tx_cfg.channels = 8,
-                       .tx_cfg.mode = HSI_MODE_FRAME,
-                       .tx_cfg.arb_mode = HSI_ARB_RR,
-                       .rx_cfg.flow = HSI_FLOW_SYNC,
-                       .rx_cfg.mode = HSI_MODE_FRAME,
-                       .rx_cfg.channels = 8
-               },
-#if defined(CONFIG_HSI_FFL_TTY)
-               [1] = {
-                       .name = hsi_ffl_name,
-                       .hsi_id = 0,
-                       .port = 0,
-                       .archdata = NULL,
-                       .tx_cfg.speed = 100000, /* tx clock, kHz */
-                       .tx_cfg.channels = 8,
-                       .tx_cfg.mode = HSI_MODE_FRAME,
-                       .tx_cfg.arb_mode = HSI_ARB_RR,
-                       .rx_cfg.flow = HSI_FLOW_SYNC,
-                       .rx_cfg.mode = HSI_MODE_FRAME,
-                       .rx_cfg.channels = 8
-               }
-#elif defined(CONFIG_HSI_DLP)
-               [1] = {
-                       .name = hsi_dlp_name,
-                       .hsi_id = 0,
-                       .port = 0,
-                       .archdata = NULL,
-                       .tx_cfg.speed = 100000, /* tx clock, kHz */
-                       .tx_cfg.channels = 8,
-                       .tx_cfg.mode = HSI_MODE_FRAME,
-                       .tx_cfg.arb_mode = HSI_ARB_RR,
-                       .rx_cfg.flow = HSI_FLOW_SYNC,
-                       .rx_cfg.mode = HSI_MODE_FRAME,
-                       .rx_cfg.channels = 8
-               }
-#endif
-       };
-
-#if defined(CONFIG_HSI_FFL_TTY)
-       static struct hsi_mid_platform_data mid_info = {
-               .tx_dma_channels[0] = -1,
-               .tx_dma_channels[1] = 5,
-               .tx_dma_channels[2] = -1,
-               .tx_dma_channels[3] = -1,
-               .tx_dma_channels[4] = -1,
-               .tx_dma_channels[5] = -1,
-               .tx_dma_channels[6] = -1,
-               .tx_dma_channels[7] = -1,
-               .tx_sg_entries[0] = 1,
-               .tx_sg_entries[1] = 1,
-               .tx_sg_entries[2] = 1,
-               .tx_sg_entries[3] = 1,
-               .tx_sg_entries[4] = 1,
-               .tx_sg_entries[5] = 1,
-               .tx_sg_entries[6] = 1,
-               .tx_sg_entries[7] = 1,
-               .tx_fifo_sizes[0] = -1,
-               .tx_fifo_sizes[1] = 1024,
-               .tx_fifo_sizes[2] = -1,
-               .tx_fifo_sizes[3] = -1,
-               .tx_fifo_sizes[4] = -1,
-               .tx_fifo_sizes[5] = -1,
-               .tx_fifo_sizes[6] = -1,
-               .tx_fifo_sizes[7] = -1,
-               .rx_dma_channels[0] = -1,
-               .rx_dma_channels[1] = 1,
-               .rx_dma_channels[2] = -1,
-               .rx_dma_channels[3] = -1,
-               .rx_dma_channels[4] = -1,
-               .rx_dma_channels[5] = -1,
-               .rx_dma_channels[6] = -1,
-               .rx_dma_channels[7] = -1,
-               .rx_sg_entries[0] = 1,
-               .rx_sg_entries[1] = 1,
-               .rx_sg_entries[2] = 1,
-               .rx_sg_entries[3] = 1,
-               .rx_sg_entries[4] = 1,
-               .rx_sg_entries[5] = 1,
-               .rx_sg_entries[6] = 1,
-               .rx_sg_entries[7] = 1,
-               .rx_fifo_sizes[0] = -1,
-               .rx_fifo_sizes[1] = 1024,
-               .rx_fifo_sizes[2] = -1,
-               .rx_fifo_sizes[3] = -1,
-               .rx_fifo_sizes[4] = -1,
-               .rx_fifo_sizes[5] = -1,
-               .rx_fifo_sizes[6] = -1,
-               .rx_fifo_sizes[7] = -1,
-       };
-
-#elif defined(CONFIG_HSI_DLP)
-       static struct hsi_mid_platform_data mid_info = {
-               .tx_dma_channels[0] = -1,
-               .tx_dma_channels[1] = 0,
-               .tx_dma_channels[2] = 1,
-               .tx_dma_channels[3] = 2,
-               .tx_dma_channels[4] = 3,
-               .tx_dma_channels[5] = -1,
-               .tx_dma_channels[6] = -1,
-               .tx_dma_channels[7] = -1,
-               .tx_sg_entries[0] = 1,
-               .tx_sg_entries[1] = 1,
-               .tx_sg_entries[2] = 64,
-               .tx_sg_entries[3] = 64,
-               .tx_sg_entries[4] = 64,
-               .tx_sg_entries[5] = 1,
-               .tx_sg_entries[6] = 1,
-               .tx_sg_entries[7] = 1,
-               .tx_fifo_sizes[0] = 128,
-               .tx_fifo_sizes[1] = 128,
-               .tx_fifo_sizes[2] = 256,
-               .tx_fifo_sizes[3] = 256,
-               .tx_fifo_sizes[4] = 256,
-               .tx_fifo_sizes[5] = -1,
-               .tx_fifo_sizes[6] = -1,
-               .tx_fifo_sizes[7] = -1,
-               .rx_dma_channels[0] = -1,
-               .rx_dma_channels[1] = 4,
-               .rx_dma_channels[2] = 5,
-               .rx_dma_channels[3] = 6,
-               .rx_dma_channels[4] = 7,
-               .rx_dma_channels[5] = -1,
-               .rx_dma_channels[6] = -1,
-               .rx_dma_channels[7] = -1,
-               .rx_sg_entries[0] = 1,
-               .rx_sg_entries[1] = 1,
-               .rx_sg_entries[2] = 1,
-               .rx_sg_entries[3] = 1,
-               .rx_sg_entries[4] = 1,
-               .rx_sg_entries[5] = 1,
-               .rx_sg_entries[6] = 1,
-               .rx_sg_entries[7] = 1,
-               .rx_fifo_sizes[0] = 128,
-               .rx_fifo_sizes[1] = 128,
-               .rx_fifo_sizes[2] = 256,
-               .rx_fifo_sizes[3] = 256,
-               .rx_fifo_sizes[4] = 256,
-               .rx_fifo_sizes[5] = -1,
-               .rx_fifo_sizes[6] = -1,
-               .rx_fifo_sizes[7] = -1,
-       };
-#endif
-
-       printk(KERN_INFO "HSI mdm GPIOs rst_out:%d,"
-                       " pwr_on:%d, rst_bbn:%d, fcdp_rb:%d\n",
-               rst_out, pwr_on, rst_pmu, fcdp_rb);
-
-       mid_info.gpio_mdm_rst_out = rst_out;
-       mid_info.gpio_mdm_pwr_on = pwr_on;
-       mid_info.gpio_mdm_rst_bbn = rst_pmu;
-       mid_info.gpio_fcdp_rb = fcdp_rb;
-
-       hsi_info[0].platform_data = (void *)&mid_info;
-       hsi_info[1].platform_data = (void *)&mid_info;
-
-       return &hsi_info[0];
-}
-
-static void *msic_battery_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_MSIC_BATTERY, entry->irq);
-       return NULL;
-
-}
-
-static void *msic_gpio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_msic_gpio_pdata pdata;
-
-       int gpio = get_gpio_by_name("msic_gpio_base");
-       if (gpio < 0)
-               return NULL;
-
-       pdata.gpio_base = gpio;
-       handle_ipc_irq_res(IPC_DEV_MSIC_GPIO, entry->irq);
-
-       return &pdata;
-}
-
-void max17042_i2c_reset_workaround(void)
-{
-/* toggle clock pin of I2C-1 to recover devices from abnormal status.
- * currently, only max17042 on I2C-1 needs such workaround */
-#define I2C_1_GPIO_PIN 27
-       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_GPIO);
-       gpio_direction_output(I2C_1_GPIO_PIN, 0);
-       gpio_set_value(I2C_1_GPIO_PIN, 1);
-       udelay(10);
-       gpio_set_value(I2C_1_GPIO_PIN, 0);
-       udelay(10);
-       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_ALT_1);
-#undef I2C_1_GPIO_PIN 27
-}
-EXPORT_SYMBOL(max17042_i2c_reset_workaround);
-
-static bool msic_battery_check(void)
-{
-       if (get_oem0_table() == NULL) {
-               pr_info("invalid battery detected\n");
-               return false;
-       } else {
-               pr_info("valid battery detected\n");
-               return true;
-       }
-       return false;
-}
-
-
-static void *max17042_platform_data(void *info)
-{
-       static struct max17042_platform_data platform_data;
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
-       int intr = get_gpio_by_name("max17042");
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-
-       if (msic_battery_check()) {
-               platform_data.enable_current_sense = true;
-               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
-       } else {
-               platform_data.enable_current_sense = false;
-               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
-       }
-
-       platform_data.is_init_done = 0;
-       platform_data.reset_i2c_lines = max17042_i2c_reset_workaround;
-
-#ifdef CONFIG_CHARGER_BQ24192
-       platform_data.battery_status = bq24192_query_battery_status;
-#endif
-
-       return &platform_data;
-}
-
-static void *bq24192_platform_data(void *info)
-{
-       static struct bq24192_platform_data platform_data;
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
-
-       platform_data.slave_mode = 0;
-       return &platform_data;
-}
-
-static void *clvcs_audio_platform_data(void *info)
-{
-       struct platform_device *pdev;
-       int ret;
-
-       pdev = platform_device_alloc("sst-platform", -1);
-       if (!pdev) {
-               pr_err("failed to allocate audio platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add audio platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       pdev = platform_device_alloc("intel_mid_vibra", -1);
-       if (!pdev) {
-               pr_err("failed to allocate audio vibra device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add audio vibra device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       pdev = platform_device_alloc("hdmi-audio", -1);
-       if (!pdev) {
-               pr_err("failed to allocate hdmi-audio platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add hdmi-audio platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       return NULL;
-}
-
-static void *msic_power_btn_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_MSIC_POWER_BTN, entry->irq);
-       return NULL;
-
-}
-
-static void *msic_ocd_platform_data(void *info)
-{
-       int gpio;
-       static struct intel_msic_ocd_pdata pdata;
-
-       gpio = get_gpio_by_name("ocd_gpio");
-       if (gpio < 0)
-               return NULL;
-
-       pdata.gpio = gpio;
-
-       handle_ipc_irq_res(IPC_DEV_MSIC_OCD, gpio + MRST_IRQ_OFFSET);
-
-       return &pdata;
-}
-
-/* camera sensor GPIOs */
-
-#define GP_CAMERA_0_POWER_DOWN         "cam0_vcm_2p8"
-#define GP_CAMERA_1_POWER_DOWN         "camera_1_power"
-#define GP_CAMERA_0_RESET              "camera_0_reset"
-#define GP_CAMERA_1_RESET              "camera_1_reset"
-/* Need modify sensor driver's platform data structure to eliminate static */
-static int gp_camera0_reset;
-static int gp_camera0_power_down;
-static int gp_camera1_reset;
-static int gp_camera1_power_down;
-static int camera_vprog1_on;
 
 /*
- * One-time gpio initialization.
- * @name: gpio name: coded in SFI table
- * @gpio: gpio pin number (bypass @name)
- * @dir: GPIOF_DIR_IN or GPIOF_DIR_OUT
- * @value: if dir = GPIOF_DIR_OUT, this is the init value for output pin
- * if dir = GPIOF_DIR_IN, this argument is ignored
- * return: a positive pin number if succeeds, otherwise a negative value
+ * IPC devices
  */
-static int camera_sensor_gpio(int gpio, char *name, int dir, int value)
-{
-       int ret, pin;
 
-       if (gpio == -1) {
-               pin = get_gpio_by_name(name);
-               if (pin == -1) {
-                       pr_err("%s: failed to get gpio(name: %s)\n",
-                                               __func__, name);
-                       return -EINVAL;
-               }
-       } else {
-               pin = gpio;
-       }
-
-       ret = gpio_request(pin, name);
-       if (ret) {
-               pr_err("%s: failed to request gpio(pin %d)\n", __func__, pin);
-               return -EINVAL;
-       }
-
-       if (dir == GPIOF_DIR_OUT)
-               ret = gpio_direction_output(pin, value);
-       else
-               ret = gpio_direction_input(pin);
-
-       if (ret) {
-               pr_err("%s: failed to set gpio(pin %d) direction\n",
-                                                       __func__, pin);
-               gpio_free(pin);
-       }
-
-       return ret ? ret : pin;
-}
+#include "device_libs/platform_ipc.h"
+#include "device_libs/platform_pmic_gpio.h"
+#include "device_libs/platform_pmic_audio.h"
+#include "device_libs/platform_msic_adc.h"
+#include "device_libs/platform_msic_gpio.h"
+#include "device_libs/platform_clvs_audio.h"
+#include "device_libs/platform_msic_power_btn.h"
+#include "device_libs/platform_msic_ocd.h"
 
 /*
- * Configure MIPI CSI physical parameters.
- * @port: ATOMISP_CAMERA_PORT_PRIMARY or ATOMISP_CAMERA_PORT_SECONDARY
- * @lanes: for ATOMISP_CAMERA_PORT_PRIMARY, there could be 2 or 4 lanes
- * for ATOMISP_CAMERA_PORT_SECONDARY, there is only one lane.
- * @format: MIPI CSI pixel format, see include/linux/atomisp_platform.h
- * @bayer_order: MIPI CSI bayer order, see include/linux/atomisp_platform.h
+ * I2C devices
  */
-static int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
-                       u32 lanes, u32 format, u32 bayer_order, int flag)
-{
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
-       struct camera_mipi_info *csi = NULL;
-
-       if (flag) {
-               csi = kzalloc(sizeof(*csi), GFP_KERNEL);
-               if (!csi) {
-                       dev_err(&client->dev, "out of memory\n");
-                       return -ENOMEM;
-               }
-               csi->port = port;
-               csi->num_lanes = lanes;
-               csi->input_format = format;
-               csi->raw_bayer_order = bayer_order;
-               v4l2_set_subdev_hostdata(sd, (void *)csi);
-       } else {
-               csi = v4l2_get_subdev_hostdata(sd);
-               kfree(csi);
-       }
-
-       return 0;
-}
-
-static int mt9m114_gpio_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
 
-       if (gp_camera1_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_1_RESET,
-                                        GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera1_reset = ret;
-       }
-
-       if (flag) {
-               gpio_set_value(gp_camera1_reset, 0);
-               msleep(60);
-               gpio_set_value(gp_camera1_reset, 1);
-       } else {
-               gpio_set_value(gp_camera1_reset, 0);
-       }
-
-       return 0;
-}
-
-static int mt9m114_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       static const unsigned int clock_khz = 19200;
-       return intel_scu_ipc_osc_clk(OSC_CLK_CAM1, flag ? clock_khz : 0);
-}
-
-static int mt9m114_power_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       if (flag) {
-               if (!camera_vprog1_on) {
-                       camera_vprog1_on = 1;
-                       intel_scu_ipc_msic_vprog1(1);
-               }
-       } else {
-               if (camera_vprog1_on) {
-                       camera_vprog1_on = 0;
-                       intel_scu_ipc_msic_vprog1(0);
-               }
-       }
+#include "device_libs/platform_lsm303.h"
+#include "device_libs/platform_apds990x.h"
+#include "device_libs/platform_l3g4200d.h"
+#include "device_libs/platform_pn544.h"
+#include "device_libs/platform_bq24192.h"
+#include "device_libs/platform_camera.h"
+#include "device_libs/platform_mt9m114.h"
+#include "device_libs/platform_ov8830.h"
+#include "device_libs/platform_mxt224.h"
+#include "device_libs/platform_a1026.h"
+#include "device_libs/platform_lis3dh.h"
+#include "device_libs/platform_s3202.h"
+#include "device_libs/platform_max17042.h"
+#include "device_libs/platform_lm3554.h"
 
-       return 0;
-}
-
-static int mt9m114_csi_configure(struct v4l2_subdev *sd, int flag)
-{
-       /* soc sensor, there is no raw bayer order (set to -1) */
-       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_SECONDARY, 1,
-               ATOMISP_INPUT_FORMAT_YUV422_8, -1, flag);
-}
-
-static struct camera_sensor_platform_data mt9m114_sensor_platform_data = {
-       .gpio_ctrl      = mt9m114_gpio_ctrl,
-       .flisclk_ctrl   = mt9m114_flisclk_ctrl,
-       .power_ctrl     = mt9m114_power_ctrl,
-       .csi_cfg        = mt9m114_csi_configure,
-};
-
-static void *mt9m114_platform_data_init(void *info)
-{
-       gp_camera1_reset = -1;
-       gp_camera1_power_down = -1;
-
-       return &mt9m114_sensor_platform_data;
-}
-
-static void *lm3554_platform_data_init(void *info)
-{
-       static struct camera_flash_platform_data lm3554_platform_data;
-       void *ret = &lm3554_platform_data;
-
-       lm3554_platform_data.gpio_reset  = get_gpio_by_name("GP_FLASH_RESET");
-       lm3554_platform_data.gpio_strobe = get_gpio_by_name("GP_FLASH_STROBE");
-       lm3554_platform_data.gpio_torch  = get_gpio_by_name("GP_FLASH_TORCH");
-
-       if (lm3554_platform_data.gpio_reset == -1) {
-               pr_err("%s: Unable to find GP_FLASH_RESET\n", __func__);
-               ret = NULL;
-       }
-       if (lm3554_platform_data.gpio_strobe == -1) {
-               pr_err("%s: Unable to find GP_FLASH_STROBE\n", __func__);
-               ret = NULL;
-       }
-       if (lm3554_platform_data.gpio_torch == -1) {
-               pr_err("%s: Unable to find GP_FLASH_TORCH\n", __func__);
-               ret = NULL;
-       }
-
-       return ret;
-}
-
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
-static struct wl12xx_platform_data mid_wifi_control = {
-       .board_ref_clock = 1,
-       .irq = 2,
-       .board_tcxo_clock = 1,
-       .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
-};
-
-static struct regulator_consumer_supply wl12xx_vmmc3_supply = {
-       .supply         = "vmmc",
-       .dev_name       = "0000:00:00.0", /*default value*/
-};
-
-static struct regulator_init_data wl12xx_vmmc3 = {
-       .constraints = {
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies = &wl12xx_vmmc3_supply,
-};
-
-static struct fixed_voltage_config wl12xx_vwlan = {
-       .supply_name            = "vwl1271",
-       .microvolts             = 1800000,
-       .gpio                   = 75,
-       .startup_delay          = 70000,
-       .enable_high            = 1,
-       .enabled_at_boot        = 0,
-       .init_data              = &wl12xx_vmmc3,
-};
-
-static struct platform_device wl12xx_vwlan_device = {
-       .name           = "reg-fixed-voltage",
-       .id             = 1,
-       .dev = {
-               .platform_data  = &wl12xx_vwlan,
-       },
-};
-
-#define WL12XX_SFI_GPIO_IRQ_NAME "WLAN-interrupt"
-#define WL12XX_SFI_GPIO_ENABLE_NAME "WLAN-enable"
-#define ICDK_BOARD_REF_CLK 26000000
-#define NCDK_BOARD_REF_CLK 38400000
+/*
+ * SPI devices
+ */
 
-void __init wl12xx_platform_data_init_post_scu(void *info)
-{
-       struct sd_board_info *sd_info = info;
-       int wifi_irq_gpio;
-       int err;
+#include "device_libs/platform_max3111.h"
 
-       /*Get GPIO numbers from the SFI table*/
-       wifi_irq_gpio = get_gpio_by_name(WL12XX_SFI_GPIO_IRQ_NAME);
-       if (wifi_irq_gpio == -1) {
-               pr_err("%s: Unable to find WLAN-interrupt GPIO in the SFI table\n",
-                               __func__);
-               return;
-       }
-       err = gpio_request(wifi_irq_gpio, "wl12xx");
-       if (err < 0) {
-               pr_err("%s: Unable to request GPIO\n", __func__);
-               return;
-       }
-       err = gpio_direction_input(wifi_irq_gpio);
-       if (err < 0) {
-               pr_err("%s: Unable to set GPIO direction\n", __func__);
-               return;
-       }
-       mid_wifi_control.irq = gpio_to_irq(wifi_irq_gpio);
-       if (mid_wifi_control.irq < 0) {
-               pr_err("%s:Error gpio_to_irq:%d->%d\n", __func__, wifi_irq_gpio,
-                      mid_wifi_control.irq);
-               return;
-       }
-       /* Set our board_ref_clock from SFI SD board info */
-       if (sd_info->board_ref_clock == ICDK_BOARD_REF_CLK)
-               /*iCDK board*/
-               /*26Mhz TCXO clock ref*/
-               mid_wifi_control.board_ref_clock = 1;
-       else if (sd_info->board_ref_clock == NCDK_BOARD_REF_CLK)
-               /*nCDK board*/
-               /*38,4Mhz TCXO clock ref*/
-               mid_wifi_control.board_ref_clock = 2;
-
-       err = wl12xx_set_platform_data(&mid_wifi_control);
-       if (err < 0)
-               pr_err("error setting wl12xx data\n");
+/*
+ * HSI devices
+ */
 
-       /* this is the fake regulator that mmc stack use to power of the
-          wifi sdio card via runtime_pm apis */
-       wl12xx_vwlan.gpio = get_gpio_by_name(WL12XX_SFI_GPIO_ENABLE_NAME);
-       if (wl12xx_vwlan.gpio == -1) {
-               pr_err("%s: Unable to find WLAN-enable GPIO in the SFI table\n",
-                      __func__);
-               return;
-       }
-       /* format vmmc reg address from sfi table */
-       sprintf((char *)wl12xx_vmmc3_supply.dev_name, "0000:00:%02x.%01x",
-               (sd_info->addr)>>8, sd_info->addr&0xFF);
+#include "device_libs/platform_hsi_modem.h"
 
-       err = platform_device_register(&wl12xx_vwlan_device);
-       if (err < 0)
-               pr_err("error platform_device_register\n");
+/*
+ * WIFI devices
+ */
 
-       sdhci_pci_request_regulators();
-}
+#include "device_libs/platform_wl12xx.h"
 
-void __init *wl12xx_platform_data_init(void *info)
-{
-       struct sd_board_info *sd_info;
+/*
+ * Bluetooth devices
+ */
 
-       sd_info = kmemdup(info, sizeof(*sd_info), GFP_KERNEL);
-       if (!sd_info) {
-               pr_err("MRST: fail to alloc mem for delayed wl12xx dev\n");
-               return NULL;
-       }
-       intel_delayed_device_register(sd_info,
-                                     wl12xx_platform_data_init_post_scu);
+#include "device_libs/platform_btwilink.h"
 
-       return &mid_wifi_control;
-}
-#else
-void *wl12xx_platform_data_init(void *info)
+static void __init *no_platform_data(void *info)
 {
        return NULL;
 }
-#endif
-
-void *atmel_mxt224_platform_data_init(void *info)
-{
-       static struct mxt_platform_data mxt_pdata;
-
-       mxt_pdata.numtouch       = 10;
-       mxt_pdata.max_x          = 1023;
-       mxt_pdata.max_y          = 975;
-       mxt_pdata.orientation    = MXT_MSGB_T9_ORIENT_HORZ_FLIP;
-       mxt_pdata.reset          = get_gpio_by_name("ts_rst");
-       mxt_pdata.irq            = get_gpio_by_name("ts_int");
-
-       return &mxt_pdata;
-}
-
-#define AUDIENCE_WAKEUP_GPIO               "audience-wakeup"
-#define AUDIENCE_RESET_GPIO                 "audience-reset"
-static int audience_request_resources(struct i2c_client *client)
-{
-       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
-               client->dev.platform_data;
-       int ret;
-
-       pr_debug("Audience: request ressource audience\n");
-       if (!pdata)
-               return -1;
-       ret = gpio_request(pdata->gpio_a1026_wakeup, AUDIENCE_WAKEUP_GPIO);
-       if (ret) {
-               dev_err(&client->dev, "Request AUDIENCE WAKEUP GPIO %d fails %d\n",
-                       pdata->gpio_a1026_wakeup, ret);
-               return -1;
-       }
-       ret = gpio_direction_output(pdata->gpio_a1026_wakeup, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_wake;
-       }
-
-       ret = gpio_request(pdata->gpio_a1026_reset, AUDIENCE_RESET_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                               "Request for Audience reset GPIO %d fails %d\n",
-                                       pdata->gpio_a1026_reset, ret);
-               goto err_wake;
-       }
-       ret = gpio_direction_output(pdata->gpio_a1026_reset, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_reset;
-       }
-       sprintf(pdata->firmware_name, "%s", "vpimg_es305b.bin");
-
-       return 0;
-err_reset:
-       gpio_free(pdata->gpio_a1026_reset);
-err_wake:
-       gpio_free(pdata->gpio_a1026_wakeup);
-       return -1;
-}
 
-static void audience_free_resources(struct i2c_client *client)
-{
-       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
-               &client->dev.platform_data;
-
-       gpio_free(pdata->gpio_a1026_wakeup);
-       gpio_free(pdata->gpio_a1026_reset);
-}
-
-static void audience_wake_up(bool state)
-{
-       int wakeup_gpio;
-
-       wakeup_gpio = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
-       if (wakeup_gpio == -1) {
-               pr_err("%s invalid wakeup gpio", __func__);
-               return;
-       }
-       gpio_set_value(wakeup_gpio, state);
-       pr_debug("Audience: WAKE UP %d\n", state);
-}
-
-static void audience_reset(bool state)
-{
-       int reset_gpio;
-
-       reset_gpio = get_gpio_by_name(AUDIENCE_RESET_GPIO);
-       if (reset_gpio == -1) {
-               pr_err("%s invalid reset gpio", __func__);
-               return;
-       }
-       gpio_set_value(reset_gpio, state);
-       pr_debug("Audience: RESET %d\n", state);
-}
-
-void *audience_platform_data_init(void *info)
-{
-       static struct a1026_platform_data pdata;
-
-       pdata.gpio_a1026_wakeup = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
-       pdata.gpio_a1026_reset = get_gpio_by_name(AUDIENCE_RESET_GPIO);
-       pdata.request_resources = audience_request_resources;
-       pdata.free_resources    = audience_free_resources;
-       pdata.wakeup                    = audience_wake_up;
-       pdata.reset                     = audience_reset;
-
-       return &pdata;
-}
-
-void *lis3dh_pdata_init(void *info)
-{
-       static struct lis3dh_acc_platform_data lis3dh_pdata;
-
-       lis3dh_pdata.poll_interval = 200;
-       lis3dh_pdata.negate_x = 1;
-       lis3dh_pdata.negate_y = 0;
-       lis3dh_pdata.negate_z = 0;
-       lis3dh_pdata.axis_map_x = 0;
-       lis3dh_pdata.axis_map_y = 1;
-       lis3dh_pdata.axis_map_z = 2;
-       lis3dh_pdata.gpio_int1 = 60;
-       lis3dh_pdata.gpio_int2 = 61;
-
-       return &lis3dh_pdata;
-
-}
-
-static const struct intel_v4l2_subdev_id v4l2_ids_clv[] = {
+const struct intel_v4l2_subdev_id v4l2_ids[] = {
        {"ov8830", RAW_CAMERA, ATOMISP_CAMERA_PORT_PRIMARY},
        {"mt9m114", SOC_CAMERA, ATOMISP_CAMERA_PORT_SECONDARY},
        {"lm3554", LED_FLASH, -1},
        {},
 };
 
-static const struct intel_v4l2_subdev_id *get_v4l2_ids(int *n_subdev)
-{
-       if (n_subdev)
-               *n_subdev = ARRAY_SIZE(v4l2_ids_clv);
-       return v4l2_ids_clv;
-}
-
-static struct atomisp_platform_data *v4l2_subdev_table_head;
-
-void intel_ignore_i2c_device_register(struct sfi_device_table_entry *pentry,
-                                       struct devs_id *dev)
-{
-       struct i2c_board_info i2c_info;
-       struct i2c_board_info *idev = &i2c_info;
-       int bus = pentry->host_num;
-       void *pdata = NULL;
-       int n_subdev;
-       const struct intel_v4l2_subdev_id *vdev = get_v4l2_ids(&n_subdev);
-       struct intel_v4l2_subdev_i2c_board_info *info;
-       static struct intel_v4l2_subdev_table *subdev_table;
-       enum intel_v4l2_subdev_type type = 0;
-       enum atomisp_camera_port port;
-       static int i;
-
-       memset(&i2c_info, 0, sizeof(i2c_info));
-       strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
-       i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
-       i2c_info.addr = pentry->addr;
-       pr_info("I2C bus = %d, name = %16.16s, "
-               "irq = 0x%2x, addr = 0x%x\n",
-               pentry->host_num,
-               i2c_info.type,
-               i2c_info.irq,
-               i2c_info.addr);
-       pdata = dev->get_platform_data(&i2c_info);
-       i2c_info.platform_data = pdata;
-
-
-       while (vdev->name[0]) {
-               if (!strncmp(vdev->name, idev->type, 16)) {
-                       /* compare name */
-                       type = vdev->type;
-                       port = vdev->port;
-                       break;
-               }
-               vdev++;
-       }
-
-       if (!type) /* not found */
-               return;
-
-       info = kzalloc(sizeof(struct intel_v4l2_subdev_i2c_board_info),
-                      GFP_KERNEL);
-       if (!info) {
-               pr_err("MRST: fail to alloc mem for ignored i2c dev %s\n",
-                      idev->type);
-               return;
-       }
-
-       info->i2c_adapter_id = bus;
-       /* set platform data */
-       memcpy(&info->board_info, idev, sizeof(*idev));
-
-       if (v4l2_subdev_table_head == NULL) {
-               subdev_table = kzalloc(sizeof(struct intel_v4l2_subdev_table)
-                       * n_subdev, GFP_KERNEL);
-
-               if (!subdev_table) {
-                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
-                              idev->type);
-                       kfree(info);
-                       return;
-               }
-
-               v4l2_subdev_table_head = kzalloc(
-                       sizeof(struct atomisp_platform_data), GFP_KERNEL);
-               if (!v4l2_subdev_table_head) {
-                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
-                              idev->type);
-                       kfree(info);
-                       kfree(subdev_table);
-                       return;
-               }
-               v4l2_subdev_table_head->subdevs = subdev_table;
-       }
-
-       memcpy(&subdev_table[i].v4l2_subdev, info, sizeof(*info));
-       subdev_table[i].type = type;
-       subdev_table[i].port = port;
-       i++;
-       kfree(info);
-       return;
-}
-
-const struct atomisp_platform_data *intel_get_v4l2_subdev_table(void)
-{
-       if (v4l2_subdev_table_head)
-               return v4l2_subdev_table_head;
-       else {
-               pr_err("MRST: no camera device in the SFI table\n");
-               return NULL;
-       }
-}
-EXPORT_SYMBOL_GPL(intel_get_v4l2_subdev_table);
-
-void ctp_ipc_device_handler(struct sfi_device_table_entry *pentry,
-                               struct devs_id *dev)
-{
-       int res_num;
-       struct resource *res;
-       struct ipc_device *ipcdev;
-       void *pdata = NULL;
-
-       pr_info("IPC bus = %d, name = %16.16s, "
-               "irq = 0x%2x\n", pentry->host_num, pentry->name, pentry->irq);
-
-       mutex_lock(&ipc_dev_lock);
-
-       pdata = dev->get_platform_data(pentry);
-
-       ipcdev = ipc_device_alloc(pentry->name, -1);
-       if (ipcdev == NULL) {
-               pr_err("out of memory for SFI platform device '%s'.\n",
-                               pentry->name);
-               return;
-       }
-
-       res = ipc_dev_res[current_ipcdev].resources;
-       res_num = ipc_dev_res[current_ipcdev].num_resources;
-       ipc_device_add_resources(ipcdev, res, res_num);
-
-       ipcdev->dev.platform_data = pdata;
-       ipc_device_add_to_list(ipcdev);
-
-       mutex_unlock(&ipc_dev_lock);
-}
-
-/*
- * CLV PR0 primary camera sensor - OV8830 platform data
- */
-
-static int ov8830_gpio_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera0_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_0_RESET,
-                                       GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera0_reset = ret;
-       }
-
-       if (flag) {
-               gpio_set_value(gp_camera0_reset, 0);
-               msleep(20);
-               gpio_set_value(gp_camera0_reset, 1);
-       } else {
-               gpio_set_value(gp_camera0_reset, 0);
-       }
-
-       return 0;
-}
-
-static int ov8830_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       static const unsigned int clock_khz = 19200;
-       return intel_scu_ipc_osc_clk(OSC_CLK_CAM0, flag ? clock_khz : 0);
-}
-
-static int ov8830_power_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       if (flag) {
-               if (!camera_vprog1_on) {
-                       camera_vprog1_on = 1;
-                       intel_scu_ipc_msic_vprog1(1);
-               }
-       } else {
-               if (camera_vprog1_on) {
-                       camera_vprog1_on = 0;
-                       intel_scu_ipc_msic_vprog1(0);
-               }
-       }
-
-       return 0;
-}
-
-static int ov8830_csi_configure(struct v4l2_subdev *sd, int flag)
-{
-       static const int LANES = 4;
-       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_PRIMARY, LANES,
-               ATOMISP_INPUT_FORMAT_RAW_10, atomisp_bayer_order_bggr, flag);
-}
-
-static struct camera_sensor_platform_data ov8830_sensor_platform_data = {
-       .gpio_ctrl      = ov8830_gpio_ctrl,
-       .flisclk_ctrl   = ov8830_flisclk_ctrl,
-       .power_ctrl     = ov8830_power_ctrl,
-       .csi_cfg        = ov8830_csi_configure,
-};
-
-void *ov8830_platform_data_init(void *info)
-{
-       gp_camera0_reset = -1;
-       gp_camera0_power_down = -1;
-
-       return &ov8830_sensor_platform_data;
-}
-
-void *s3202_platform_data_init(void *info)
-{
-       static struct rmi4_platform_data s3202_platform_data = {
-               .irq_type = IRQ_TYPE_EDGE_FALLING | IRQF_ONESHOT,
-               .swap_axes = true,
-       };
-       s3202_platform_data.int_gpio_number = get_gpio_by_name("ts_int");
-       s3202_platform_data.rst_gpio_number = get_gpio_by_name("ts_rst");
-
-       return &s3202_platform_data;
-}
-
 struct devs_id __initconst device_ids[] = {
        {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data, NULL},
        {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data,
-                                       &ctp_ipc_device_handler},
+                                       &ipc_device_handler},
        {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data, NULL},
 
-       /* I/O expander */
-       {"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data, NULL},
-       {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data, NULL},
-
        /* MSIC subdevices */
        {"msic_adc", SFI_DEV_TYPE_IPC, 1, &msic_adc_platform_data,
-                                       &ctp_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data,
-                                       &ctp_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data,
-                                       &ctp_ipc_device_handler},
-       {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data,
-                                       &ctp_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data,
-                                       &ctp_ipc_device_handler},
+                                       &ipc_device_handler},
 
        /* Fuel Gauge and charger */
        {"max17042", SFI_DEV_TYPE_I2C, 1, &max17042_platform_data, NULL},
        {"bq24192", SFI_DEV_TYPE_I2C, 1, &bq24192_platform_data},
 
        /* Audio */
-       {"clvcs_audio", SFI_DEV_TYPE_IPC, 1, &clvcs_audio_platform_data,
+       {"clvcs_audio", SFI_DEV_TYPE_IPC, 1, &clvs_audio_platform_data,
                                             NULL},
        {"cs42l73", SFI_DEV_TYPE_I2C, 1, &no_platform_data, NULL},
-       {"audience_es305", SFI_DEV_TYPE_I2C, 0, &audience_platform_data_init,
+       {"audience_es305", SFI_DEV_TYPE_I2C, 0, &audience_platform_data,
                                                NULL},
 
        /* Modem and Wifi */
        {"hsi_ifx_modem", SFI_DEV_TYPE_HSI, 0, &hsi_modem_platform_data, NULL},
-       {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data_init,
+       {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data,
                                                NULL},
        /*
         * Camera Sensors and LED Flash.
         * I2C devices for camera image subsystem which will not be load into
         * I2C core while initialize
         */
-       {"lm3554", SFI_DEV_TYPE_I2C, 0, &lm3554_platform_data_init,
+       {"lm3554", SFI_DEV_TYPE_I2C, 0, &lm3554_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"mt9m114", SFI_DEV_TYPE_I2C, 0, &mt9m114_platform_data_init,
+       {"mt9m114", SFI_DEV_TYPE_I2C, 0, &mt9m114_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"ov8830", SFI_DEV_TYPE_I2C, 0, &ov8830_platform_data_init,
+       {"ov8830", SFI_DEV_TYPE_I2C, 0, &ov8830_platform_data,
                                        &intel_ignore_i2c_device_register},
 
        /* Touch Screen */
-       {"mxt224", SFI_DEV_TYPE_I2C, 0, &atmel_mxt224_platform_data_init, NULL},
-       {"synaptics_3202", SFI_DEV_TYPE_I2C, 0, &s3202_platform_data_init},
+       {"mxt224", SFI_DEV_TYPE_I2C, 0, &mxt224_platform_data, NULL},
+       {"synaptics_3202", SFI_DEV_TYPE_I2C, 0, &s3202_platform_data},
 
        /* NFC */
        {"pn544", SFI_DEV_TYPE_I2C, 0, &pn544_platform_data, NULL},
 
        /* Sensors */
-       {"apds990x", SFI_DEV_TYPE_I2C, 0, &apds990x_platform_data_init},
+       {"apds990x", SFI_DEV_TYPE_I2C, 0, &apds990x_platform_data},
        {"lsm303dl", SFI_DEV_TYPE_I2C, 0, &lsm303dlhc_accel_platform_data},
        {"lsm303cmp", SFI_DEV_TYPE_I2C, 0, &no_platform_data},
        {"l3g4200d", SFI_DEV_TYPE_I2C, 0, &l3g4200d_platform_data},
@@ -1562,405 +201,3 @@ int __init board_proc_init(void)
 }
 
 early_initcall(board_proc_init);
-
-/*
- * we will search these buttons in SFI GPIO table (by name)
- * and register them dynamically. Please add all possible
- * buttons here, we will shrink them if no GPIO found.
- */
-static struct gpio_keys_button gpio_button[] = {
-       {KEY_POWER,             -1, 1, "power_btn",     EV_KEY, 0, 3000},
-       {KEY_PROG1,             -1, 1, "prog_btn1",     EV_KEY, 0, 20},
-       {KEY_PROG2,             -1, 1, "prog_btn2",     EV_KEY, 0, 20},
-       {SW_LID,                -1, 1, "lid_switch",    EV_SW,  0, 20},
-       {KEY_VOLUMEUP,          -1, 1, "vol_up",        EV_KEY, 0, 20},
-       {KEY_VOLUMEDOWN,        -1, 1, "vol_down",      EV_KEY, 0, 20},
-       {KEY_CAMERA,            -1, 1, "camera_full",   EV_KEY, 0, 20},
-       {KEY_CAMERA_FOCUS,      -1, 1, "camera_half",   EV_KEY, 0, 20},
-       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw1",        EV_SW,  0, 20},
-       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw2",        EV_SW,  0, 20},
-       {KEY_CAMERA,            -1, 1, "cam_capture",   EV_KEY, 0, 20},
-       {KEY_CAMERA_FOCUS,      -1, 1, "cam_focus",     EV_KEY, 0, 20},
-};
-
-static struct gpio_keys_platform_data mrst_gpio_keys = {
-       .buttons        = gpio_button,
-       .rep            = 1,
-       .nbuttons       = -1, /* will fill it after search */
-};
-
-static struct platform_device pb_device = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = &mrst_gpio_keys,
-       },
-};
-
-#ifdef CONFIG_SWITCH_MID
-static struct platform_device switch_device = {
-       .name           = "switch-mid",
-       .id             = -1,
-};
-#endif
-
-
-#if defined(CONFIG_TI_ST) || defined(CONFIG_TI_ST_MODULE)
-
-/* KIM related */
-static int mrst_kim_suspend(struct platform_device *pdev, pm_message_t state)
-{
-       return 0;
-}
-static int mrst_kim_resume(struct platform_device *pdev)
-{
-       return 0;
-}
-
-static struct ti_st_plat_data kim_pdata = {
-       .nshutdown_gpio = -1,/* BT, FM, GPS gpios */
-       .flow_cntrl     = 1,            /* flow control flag */
-       .suspend        = mrst_kim_suspend,
-       .resume         = mrst_kim_resume,
-};
-
-static struct platform_device linux_kim_device = {
-       .name           = "kim", /* named after init manager for ST */
-       .id             = -1,
-       .dev.platform_data = &kim_pdata,
-};
-
-/* BT WILINK related */
-static int mrst_bt_enable(struct platform_device *pdev)
-{
-       return 0;
-}
-static int mrst_bt_disable(struct platform_device *pdev)
-{
-       return 0;
-}
-
-static struct ti_st_plat_data bt_pdata = {
-       .chip_enable    = mrst_bt_enable,
-       .chip_disable   = mrst_bt_disable,
-};
-
-static struct platform_device linux_bt_device = {
-       .name           = "btwilink", /* named after init manager for ST */
-       .id             = -1,
-       .dev.platform_data = &bt_pdata,
-};
-static int __init bluetooth_init(void)
-{
-       unsigned int UART_index;
-       long unsigned int UART_baud_rate;
-       int error_reg;
-
-       /* KIM INIT */
-       /* Get the GPIO number from the SFI table
-          if FM gpio is not provided then BT-reset line is
-          also used to enable FM
-       */
-       kim_pdata.nshutdown_gpio = get_gpio_by_name("BT-reset");
-       if (kim_pdata.nshutdown_gpio == -1)
-               return -ENODEV;
-
-       /* Get Share Transport uart settings */
-       /* TODO : add SFI table parsing and one SFI entry for this settings */
-       UART_index = 0;
-       UART_baud_rate = 3500000;
-
-       /* Share Transport uart settings */
-       sprintf((char *)kim_pdata.dev_name, "/dev/ttyMFD%u", UART_index);
-       kim_pdata.baud_rate = UART_baud_rate;
-
-       pr_info("%s: Setting platform_data with UART device name:%s and "
-                       "UART baud rate:%lu.\n",
-                       __func__, kim_pdata.dev_name, kim_pdata.baud_rate);
-
-       error_reg = platform_device_register(&linux_kim_device);
-       if (error_reg < 0) {
-               pr_err("platform_device_register for kim failed\n");
-               goto exit_on_error;
-       }
-
-       /* BT WILINK INIT */
-       error_reg = platform_device_register(&linux_bt_device);
-       if (error_reg < 0)
-               pr_err("platform_device_register for btwilink failed\n");
-exit_on_error:
-       return error_reg;
-
-}
-device_initcall(bluetooth_init);
-
-#endif
-
-void *cloverview_usb_otg_get_pdata(void)
-{
-       struct cloverview_usb_otg_pdata *pdata;
-
-       if (__intel_mid_cpu_chip != INTEL_MID_CPU_CHIP_CLOVERVIEW)
-               return NULL;
-
-       pdata = (struct cloverview_usb_otg_pdata *)
-                               kmalloc(sizeof(*pdata), GFP_KERNEL);
-       if (!pdata) {
-               pr_err("%s: out of memory.\n", __func__);
-               goto failed1;
-       }
-       pdata->gpio_cs = get_gpio_by_name("usb_otg_phy_cs");
-       if (pdata->gpio_cs == -1) {
-               pr_err("%s: No gpio pin for 'usb_otg_phy_cs'\n", __func__);
-               goto failed2;
-       }
-       pdata->gpio_reset = get_gpio_by_name("usb_otg_phy_rst");
-       if (pdata->gpio_reset == -1) {
-               pr_err("%s: No gpio pin for 'usb_otg_phy_rst'\n", __func__);
-               goto failed2;
-       }
-       pr_info("%s: CS pin: gpio %d, Reset pin: gpio %d\n", __func__,
-                        pdata->gpio_cs, pdata->gpio_reset);
-       return pdata;
-
-failed2:
-       kfree(pdata);
-failed1:
-       return NULL;
-}
-EXPORT_SYMBOL_GPL(cloverview_usb_otg_get_pdata);
-
-/*
- * Shrink the non-existent buttons, register the gpio button
- * device if there is some
- */
-static int __init pb_keys_init(void)
-{
-       struct gpio_keys_button *gb = gpio_button;
-       int i, num, good = 0;
-
-       num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
-       for (i = 0; i < num; i++) {
-               gb[i].gpio = get_gpio_by_name(gb[i].desc);
-               if (gb[i].gpio == -1)
-                       continue;
-
-               if (i != good)
-                       gb[good] = gb[i];
-               good++;
-       }
-
-       if (good) {
-               mrst_gpio_keys.nbuttons = good;
-               return platform_device_register(&pb_device);
-       }
-       return 0;
-}
-late_initcall(pb_keys_init);
-
-#define EMMC_BLK_NAME  "mmcblk0rpmb"
-static int emmc_match(struct device *dev, void *data)
-{
-       if (strcmp(dev_name(dev), data) == 0)
-               return 1;
-       return 0;
-}
-int mmc_blk_rpmb_req_handle(struct mmc_ioc_rpmb_req *req)
-{
-       struct device *emmc = NULL;
-
-       if (!req)
-               return -EINVAL;
-
-       emmc = class_find_device(&block_class, NULL, EMMC_BLK_NAME, emmc_match);
-       if (!emmc) {
-               pr_err("%s: eMMC card is not registered yet. Try it later\n",
-                               __func__);
-               return -ENODEV;
-       }
-
-       return mmc_rpmb_req_handle(emmc, req);
-}
-EXPORT_SYMBOL_GPL(mmc_blk_rpmb_req_handle);
-
-static int hdmi_i2c_workaround(void)
-{
-       int ret;
-       struct platform_device *pdev;
-       struct i2c_gpio_platform_data *pdata;
-
-       /*
-        * Hard code a gpio controller platform device to take over
-        * the two gpio pins used to be controlled by i2c bus 3.
-        * This is to support HDMI EDID extension block read, which
-        * is not supported by the current i2c controller, so we use
-        * GPIO pin the simulate an i2c bus.
-        */
-       pdev = platform_device_alloc("i2c-gpio", 8);
-       if (!pdev) {
-               pr_err("i2c-gpio: failed to alloc platform device\n");
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       pdata = kzalloc(sizeof(struct i2c_gpio_platform_data), GFP_KERNEL);
-       if (!pdata) {
-               pr_err("i2c-gpio: failed to alloc platform data\n");
-               kfree(pdev);
-               ret = -ENOMEM;
-               goto out;
-       }
-       pdata->scl_pin = 35 + 96;
-       pdata->sda_pin = 36 + 96;
-       pdata->sda_is_open_drain = 0;
-       pdata->scl_is_open_drain = 0;
-       pdev->dev.platform_data = pdata;
-
-       platform_device_add(pdev);
-
-       lnw_gpio_set_alt(pdata->sda_pin, LNW_GPIO);
-       lnw_gpio_set_alt(pdata->scl_pin, LNW_GPIO);
-
-out:
-       return ret;
-}
-rootfs_initcall(hdmi_i2c_workaround);
-
-#ifdef CONFIG_MID_PWM
-static int __init intel_mid_pwm_init(void)
-{
-       int ret, i;
-       struct ipc_board_info board_info;
-       static struct intel_mid_pwm_platform_data mid_pwm_pdata;
-
-       for (i = 0; i < PWM_NUM; i++) {
-               mid_pwm_pdata.reg_clkdiv0[i] = MSIC_REG_PWM0CLKDIV0 + i * 2;
-               mid_pwm_pdata.reg_clkdiv1[i] = MSIC_REG_PWM0CLKDIV1 + i * 2;
-               mid_pwm_pdata.reg_dutycyc[i] = MSIC_REG_PWM0DUTYCYCLE + i;
-       }
-
-       memset(&board_info, 0, sizeof(board_info));
-       strncpy(board_info.name, "intel_mid_pwm", 16);
-       board_info.bus_id = IPC_SCU;
-       board_info.id = -1;
-       board_info.platform_data = &mid_pwm_pdata;
-
-       ret = ipc_new_device(&board_info);
-       if (ret) {
-               pr_err("failed to create ipc device: intel_mid_pwm\n");
-               return -1;
-       }
-
-       return 0;
-}
-fs_initcall(intel_mid_pwm_init);
-#endif
-
-#ifdef CONFIG_LEDS_INTEL_KPD
-static int __init intel_kpd_led_init(void)
-{
-       int ret;
-       struct ipc_board_info board_info;
-
-       memset(&board_info, 0, sizeof(board_info));
-       strncpy(board_info.name, "intel_kpd_led", 16);
-       board_info.bus_id = IPC_SCU;
-       board_info.id = -1;
-
-       ret = ipc_new_device(&board_info);
-       if (ret) {
-               pr_err("failed to create ipc device: intel_kpd_led\n");
-               return -1;
-       }
-
-       return 0;
-}
-fs_initcall(intel_kpd_led_init);
-#endif
-
-static int __init intel_msic_thermal_init(void)
-{
-       int ret;
-       struct ipc_board_info board_info;
-
-       memset(&board_info, 0, sizeof(board_info));
-       strncpy(board_info.name, "msic_thermal", 16);
-       board_info.bus_id = IPC_SCU;
-       board_info.id = -1;
-
-       ret = ipc_new_device(&board_info);
-       if (ret) {
-               pr_err("failed to create ipc device: msic_thermal\n");
-               return -1;
-       }
-
-       return 0;
-}
-fs_initcall(intel_msic_thermal_init);
-
-#ifdef CONFIG_SWITCH_MID
-static int __init switch_mid_init(void)
-{
-       int err;
-       err = platform_device_register(&switch_device);
-       if (err < 0)
-               pr_err("Fail to register switch-mid platform device.\n");
-       return 0;
-}
-device_initcall(switch_mid_init);
-#endif
-
-#ifdef CONFIG_SERIAL_MFD_HSU
-static struct mfld_hsu_info ctp_hsu_info[] = {
-       [0] = {
-               .id = 0,
-               .name = "hsu0",
-               .wake_gpio = 42,
-               .cts_gpio = 96+28,
-               .cts_alt = 1,
-               .rts_gpio = 96+29,
-               .rts_alt = 1,
-       },
-       [1] = {
-               .id = 1,
-               .name = "hsu1",
-               .wake_gpio = 64,
-               .rx_gpio = 64,
-               .rx_alt = 1,
-               .tx_gpio = 65,
-               .tx_alt = 1,
-               .cts_gpio = 68,
-               .cts_alt = 1,
-               .rts_gpio = 66,
-               .rts_alt = 2,
-       },
-       [2] = {
-               .id = 2,
-               .name = "hsu2",
-               .wake_gpio = 67,
-               .rx_gpio = 67,
-               .rx_alt = 1,
-       },
-       [3] = {
-               .id = 1,
-               .name = "hsu3",
-               .wake_gpio = 96+30,
-               .rx_gpio = 96+30,
-               .rx_alt = 1,
-               .tx_gpio = 96+31,
-               .tx_alt = 1,
-               .cts_gpio = 96+33,
-               .cts_alt = 1,
-               .rts_gpio = 96+32,
-               .rts_alt = 2,
-       },
-
-};
-
-static int __init ctp_hsu_init(void)
-{
-       platform_hsu_info = ctp_hsu_info;
-       return 0;
-}
-device_initcall(ctp_hsu_init);
-#endif
index 8ecd2a8..08f7660 100644 (file)
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
-#include <linux/scatterlist.h>
 #include <linux/sfi.h>
-#include <linux/intel_pmic_gpio.h>
 #include <linux/lnw_gpio.h>
-#include <linux/spi/spi.h>
-#include <linux/cyttsp.h>
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
-#include <linux/power_supply.h>
-#include <linux/power/max17042_battery.h>
-#include <linux/power/smb347-charger.h>
-#include <linux/power/intel_mdf_battery.h>
-#include <linux/nfc/pn544.h>
-#include <linux/skbuff.h>
-#include <linux/ti_wilink_st.h>
-#include <linux/gpio.h>
-#include <linux/gpio_keys.h>
-#include <linux/input.h>
-#include <linux/platform_device.h>
-#include <linux/ipc_device.h>
-#include <linux/mfd/intel_msic.h>
-#include <linux/irq.h>
-#include <linux/module.h>
-#include <linux/intel_mid_pm.h>
-#include <linux/usb/penwell_otg.h>
-#include <linux/hsi/hsi.h>
-#include <linux/hsi/intel_mid_hsi.h>
-#include <linux/wl12xx.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-#include <linux/a1026.h>
-#include <linux/input/lis3dh.h>
-#include <linux/ms5607.h>
-#include <linux/i2c-gpio.h>
-#include <linux/rmi_i2c.h>
-#include <linux/i2c/tc35876x.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/i2c/atmel_mxt_ts.h>
-
-#include <linux/atomisp_platform.h>
-#include <media/v4l2-subdev.h>
-
-#include <linux/mmc/core.h>
-#include <linux/mmc/card.h>
-#include <linux/blkdev.h>
-
-#include <asm/setup.h>
-#include <asm/mpspec_def.h>
-#include <asm/hw_irq.h>
-#include <asm/apic.h>
-#include <asm/io_apic.h>
-#include <asm/intel-mid.h>
-#include <asm/mrst-vrtc.h>
-#include <asm/io.h>
-#include <asm/i8259.h>
-#include <asm/intel_scu_ipc.h>
-#include <asm/apb_timer.h>
-#include <asm/intel_mid_gpadc.h>
-#include <asm/reboot.h>
-
-/* the offset for the mapping of global gpio pin to irq */
-#define MRST_IRQ_OFFSET 0x100
-
-enum ipc_dev_type {
-       IPC_DEV_PMIC_GPIO,
-       IPC_DEV_PMIC_AUDIO,
-       IPC_DEV_MSIC_ADC,
-       IPC_DEV_MSIC_BATTERY,
-       IPC_DEV_MSIC_GPIO,
-       IPC_DEV_MSIC_AUDIO,
-       IPC_DEV_MSIC_POWER_BTN,
-       IPC_DEV_MSIC_OCD,
-
-       IPC_DEV_NUM,
-};
-
-static __initdata enum ipc_dev_type current_ipcdev;
-static __initdata DEFINE_MUTEX(ipc_dev_lock);
-
-static struct resource pmic_gpio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource pmic_audio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_adc_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_battery_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_gpio_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_audio_resources[] __initdata = {
-       {
-               .name  = "IRQ",
-               .flags = IORESOURCE_IRQ,
-       },
-       {
-               .name  = "IRQ_BASE",
-               .flags = IORESOURCE_MEM,
-               .start = MSIC_IRQ_STATUS_OCAUDIO,
-               .end   = MSIC_IRQ_STATUS_ACCDET,
-       },
-};
-
-static struct resource msic_power_btn_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource msic_ocd_resources[] __initdata = {
-       {
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-struct intel_ipc_dev_res {
-       const char *name;
-       int num_resources;
-       struct resource *resources;
-};
-
-static struct intel_ipc_dev_res ipc_dev_res[IPC_DEV_NUM] __initdata = {
-       [IPC_DEV_PMIC_GPIO]             = {
-               .name                   = "pmic_gpio",
-               .num_resources          = ARRAY_SIZE(pmic_gpio_resources),
-               .resources              = pmic_gpio_resources,
-       },
-       [IPC_DEV_PMIC_AUDIO]            = {
-               .name                   = "pmic_audio",
-               .num_resources          = ARRAY_SIZE(pmic_audio_resources),
-               .resources              = pmic_audio_resources,
-       },
-       [IPC_DEV_MSIC_ADC]              = {
-               .name                   = "msic_adc",
-               .num_resources          = ARRAY_SIZE(msic_adc_resources),
-               .resources              = msic_adc_resources,
-       },
-       [IPC_DEV_MSIC_BATTERY]          = {
-               .name                   = "msic_battery",
-               .num_resources          = ARRAY_SIZE(msic_battery_resources),
-               .resources              = msic_battery_resources,
-       },
-       [IPC_DEV_MSIC_GPIO]             = {
-               .name                   = "msic_gpio",
-               .num_resources          = ARRAY_SIZE(msic_gpio_resources),
-               .resources              = msic_gpio_resources,
-       },
-       [IPC_DEV_MSIC_AUDIO]            = {
-               .name                   = "msic_audio",
-               .num_resources          = ARRAY_SIZE(msic_audio_resources),
-               .resources              = msic_audio_resources,
-       },
-       [IPC_DEV_MSIC_POWER_BTN]        = {
-               .name                   = "msic_power_btn",
-               .num_resources          = ARRAY_SIZE(msic_power_btn_resources),
-               .resources              = msic_power_btn_resources,
-       },
-       [IPC_DEV_MSIC_OCD]              = {
-               .name                   = "msic_ocd",
-               .num_resources          = ARRAY_SIZE(msic_ocd_resources),
-               .resources              = msic_ocd_resources,
-       },
-};
-
-/* this should be called with the holding of ipc_dev_lock */
-static void handle_ipc_irq_res(enum ipc_dev_type type, int irq)
-{
-       struct resource *res = &ipc_dev_res[type].resources[0];
-
-       if (res->flags & IORESOURCE_IRQ)
-               res->start = irq;
-
-       current_ipcdev = type;
-}
-
-static void __init *pmic_gpio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
-       int gpio_base = get_gpio_by_name("pmic_gpio_base");
-
-       if (gpio_base == -1)
-               gpio_base = 64;
-       pmic_gpio_pdata.gpio_base = gpio_base;
-       pmic_gpio_pdata.irq_base = gpio_base + MRST_IRQ_OFFSET;
-       pmic_gpio_pdata.gpiointr = 0xffffeff8;
-
-       handle_ipc_irq_res(IPC_DEV_PMIC_GPIO, entry->irq);
-
-       return &pmic_gpio_pdata;
-}
-
-static void __init *pmic_audio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_PMIC_AUDIO, entry->irq);
-       return NULL;
-}
-
-static void __init *max3111_platform_data(void *info)
-{
-       struct spi_board_info *spi_info = info;
-       int intr = get_gpio_by_name("max3111_int");
-
-       spi_info->mode = SPI_MODE_0;
-       if (intr == -1)
-               return NULL;
-       spi_info->irq = intr + MRST_IRQ_OFFSET;
-       return NULL;
-}
-
-/* we have multiple max7315 on the board ... */
-#define MAX7315_NUM 2
-static void __init *max7315_platform_data(void *info)
-{
-       static struct pca953x_platform_data max7315_pdata[MAX7315_NUM];
-       static int nr;
-       struct pca953x_platform_data *max7315 = &max7315_pdata[nr];
-       struct i2c_board_info *i2c_info = info;
-       int gpio_base, intr;
-       char base_pin_name[SFI_NAME_LEN + 1];
-       char intr_pin_name[SFI_NAME_LEN + 1];
-
-       if (nr == MAX7315_NUM) {
-               pr_err("too many max7315s, we only support %d\n",
-                               MAX7315_NUM);
-               return NULL;
-       }
-       /* we have several max7315 on the board, we only need load several
-        * instances of the same pca953x driver to cover them
-        */
-       strcpy(i2c_info->type, "max7315");
-       if (nr++) {
-               sprintf(base_pin_name, "max7315_%d_base", nr);
-               sprintf(intr_pin_name, "max7315_%d_int", nr);
-       } else {
-               strcpy(base_pin_name, "max7315_base");
-               strcpy(intr_pin_name, "max7315_int");
-       }
-
-       gpio_base = get_gpio_by_name(base_pin_name);
-       intr = get_gpio_by_name(intr_pin_name);
-
-       if (gpio_base == -1)
-               return NULL;
-       max7315->gpio_base = gpio_base;
-       if (intr != -1) {
-               i2c_info->irq = intr + MRST_IRQ_OFFSET;
-               max7315->irq_base = gpio_base + MRST_IRQ_OFFSET;
-       } else {
-               i2c_info->irq = -1;
-               max7315->irq_base = -1;
-       }
-       return max7315;
-}
-
-static void *tca6416_platform_data(void *info)
-{
-       static struct pca953x_platform_data tca6416;
-       struct i2c_board_info *i2c_info = info;
-       int gpio_base, intr;
-       char base_pin_name[SFI_NAME_LEN + 1];
-       char intr_pin_name[SFI_NAME_LEN + 1];
-
-       strcpy(i2c_info->type, "tca6416");
-       strcpy(base_pin_name, "tca6416_base");
-       strcpy(intr_pin_name, "tca6416_int");
-
-       gpio_base = get_gpio_by_name(base_pin_name);
-       intr = get_gpio_by_name(intr_pin_name);
-
-       if (gpio_base == -1)
-               return NULL;
-       tca6416.gpio_base = gpio_base;
-       if (intr != -1) {
-               i2c_info->irq = intr + MRST_IRQ_OFFSET;
-               tca6416.irq_base = gpio_base + MRST_IRQ_OFFSET;
-       } else {
-               i2c_info->irq = -1;
-               tca6416.irq_base = -1;
-       }
-       return &tca6416;
-}
-
-static void *mpu3050_platform_data(void *info)
-{
-       struct i2c_board_info *i2c_info = info;
-       int intr = get_gpio_by_name("mpu3050_int");
-
-       if (intr == -1)
-               return NULL;
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-       return NULL;
-}
-
-static void *ektf2136_spi_platform_data(void *info)
-{
-       static int dummy;
-       struct spi_board_info *spi_info = info;
-       int intr = get_gpio_by_name("ts_int");
-
-       if (intr == -1)
-               return NULL;
-       spi_info->irq = intr + MRST_IRQ_OFFSET;
-
-       /* we return a dummy pdata */
-       return &dummy;
-}
-
-static void __init *emc1403_platform_data(void *info)
-{
-       static short intr2nd_pdata;
-       struct i2c_board_info *i2c_info = info;
-       int intr = get_gpio_by_name("thermal_int");
-       int intr2nd = get_gpio_by_name("thermal_alert");
-
-       if (intr == -1 || intr2nd == -1)
-               return NULL;
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-       intr2nd_pdata = intr2nd + MRST_IRQ_OFFSET;
-
-       return &intr2nd_pdata;
-}
-
-static void __init *lis331dl_platform_data(void *info)
-{
-       static short intr2nd_pdata;
-       struct i2c_board_info *i2c_info = info;
-       int intr = get_gpio_by_name("accel_int");
-       int intr2nd = get_gpio_by_name("accel_2");
-
-       if (intr == -1 || intr2nd == -1)
-               return NULL;
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-       intr2nd_pdata = intr2nd + MRST_IRQ_OFFSET;
-
-       return &intr2nd_pdata;
-}
-
-/* MFLD NFC controller (PN544) platform init */
-#define NFC_HOST_INT_GPIO               "NFC-intr"
-#define NFC_ENABLE_GPIO                 "NFC-enable"
-#define NFC_FW_RESET_GPIO               "NFC-reset"
-
-static unsigned int nfc_host_int_gpio, nfc_enable_gpio, nfc_fw_reset_gpio;
-
-static int pn544_nfc_request_resources(struct i2c_client *client)
-{
-       int ret;
-
-       ret = gpio_request(nfc_host_int_gpio, NFC_HOST_INT_GPIO);
-       if (ret) {
-               dev_err(&client->dev, "Request NFC INT GPIO fails %d\n", ret);
-               return -1;
-       }
-
-       ret = gpio_direction_input(nfc_host_int_gpio);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_int;
-       }
-
-       ret = gpio_request(nfc_enable_gpio, NFC_ENABLE_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                       "Request for NFC Enable GPIO fails %d\n", ret);
-               goto err_int;
-       }
-
-       ret = gpio_direction_output(nfc_enable_gpio, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_enable;
-       }
-
-       ret = gpio_request(nfc_fw_reset_gpio, NFC_FW_RESET_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                       "Request for NFC FW Reset GPIO fails %d\n", ret);
-               goto err_enable;
-       }
-
-       ret = gpio_direction_output(nfc_fw_reset_gpio, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_fw;
-       }
-
-       return 0;
-err_fw:
-       gpio_free(nfc_fw_reset_gpio);
-err_enable:
-       gpio_free(nfc_enable_gpio);
-err_int:
-       gpio_free(nfc_host_int_gpio);
-       return -1;
-}
-
-void *pn544_platform_data(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *) info;
-       static struct pn544_i2c_platform_data mfld_pn544_nfc_platform_data;
-
-       memset(&mfld_pn544_nfc_platform_data, 0x00,
-               sizeof(struct pn544_i2c_platform_data));
-
-       nfc_host_int_gpio = get_gpio_by_name(NFC_HOST_INT_GPIO);
-       if (nfc_host_int_gpio == -1)
-               return NULL;
-       nfc_enable_gpio = get_gpio_by_name(NFC_ENABLE_GPIO);
-       if (nfc_enable_gpio  == -1)
-               return NULL;
-       nfc_fw_reset_gpio = get_gpio_by_name(NFC_FW_RESET_GPIO);
-       if (nfc_fw_reset_gpio == -1)
-               return NULL;
-
-       mfld_pn544_nfc_platform_data.irq_gpio = nfc_host_int_gpio;
-       mfld_pn544_nfc_platform_data.ven_gpio = nfc_enable_gpio;
-       mfld_pn544_nfc_platform_data.firm_gpio = nfc_fw_reset_gpio;
-
-       i2c_info->irq = nfc_host_int_gpio + MRST_IRQ_OFFSET;
-       mfld_pn544_nfc_platform_data.request_resources =
-               pn544_nfc_request_resources;
-
-       return &mfld_pn544_nfc_platform_data;
-}
-
-/* MFLD iCDK touchscreen data */
-#define CYTTSP_GPIO_PIN 0x3E
-static int cyttsp_init(int on)
-{
-       int ret;
-
-       if (on) {
-               ret = gpio_request(CYTTSP_GPIO_PIN, "cyttsp_irq");
-               if (ret < 0) {
-                       pr_err("%s: gpio request failed\n", __func__);
-                       return ret;
-               }
-
-               ret = gpio_direction_input(CYTTSP_GPIO_PIN);
-               if (ret < 0) {
-                       pr_err("%s: gpio direction config failed\n", __func__);
-                       gpio_free(CYTTSP_GPIO_PIN);
-                       return ret;
-               }
-       } else {
-               gpio_free(CYTTSP_GPIO_PIN);
-       }
-       return 0;
-}
-
-static void *cyttsp_platform_data(void *info)
-{
-       static struct cyttsp_platform_data cyttsp_pdata = {
-               .init = cyttsp_init,
-               .mt_sync = input_mt_sync,
-               .maxx = 479,
-               .maxy = 853,
-               .flags = 0,
-               .gen = CY_GEN3,
-               .use_st = 0,
-               .use_mt = 1,
-               .use_trk_id = 0,
-               .use_hndshk = 1,
-               .use_timer = 0,
-               .use_sleep = 1,
-               .use_gestures = 0,
-               .act_intrvl = CY_ACT_INTRVL_DFLT,
-               .tch_tmout = CY_TCH_TMOUT_DFLT,
-               .lp_intrvl = CY_LP_INTRVL_DFLT / 2,
-               .name = CY_I2C_NAME,
-               .irq_gpio = CYTTSP_GPIO_PIN,
-       };
-
-       return &cyttsp_pdata;
-}
-
-static void __init *no_platform_data(void *info)
-{
-       return NULL;
-}
-
-static void *msic_adc_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_mid_gpadc_platform_data pdata;
-       pdata.intr = 0xffff7fc0;
-
-       handle_ipc_irq_res(IPC_DEV_MSIC_ADC, entry->irq);
-
-       return &pdata;
-}
-
-static void *hsi_modem_platform_data(void *data)
-{
-       int rst_out = get_gpio_by_name("ifx_mdm_rst_out");
-       int pwr_on = get_gpio_by_name("ifx_mdm_pwr_on");
-       int rst_pmu = get_gpio_by_name("ifx_mdm_rst_pmu");
-       int fcdp_rb = get_gpio_by_name("modem-gpio2");
-
-       static const char hsi_char_name[]       = "hsi_char";
-       static const char hsi_ffl_name[]        = "hsi-ffl";
-
-       static struct hsi_board_info hsi_info[2] = {
-               [0] = {
-                       .name = hsi_char_name,
-                       .hsi_id = 0,
-                       .port = 0,
-                       .archdata = NULL,
-                       .tx_cfg.speed = 200000, /* tx clock, kHz */
-                       .tx_cfg.channels = 8,
-                       .tx_cfg.mode = HSI_MODE_FRAME,
-                       .tx_cfg.arb_mode = HSI_ARB_RR,
-                       .rx_cfg.flow = HSI_FLOW_SYNC,
-                       .rx_cfg.mode = HSI_MODE_FRAME,
-                       .rx_cfg.channels = 8
-               },
-               [1] = {
-                       .name = hsi_ffl_name,
-                       .hsi_id = 0,
-                       .port = 0,
-                       .archdata = NULL,
-                       .tx_cfg.speed = 100000, /* tx clock, kHz */
-                       .tx_cfg.channels = 8,
-                       .tx_cfg.mode = HSI_MODE_FRAME,
-                       .tx_cfg.arb_mode = HSI_ARB_RR,
-                       .rx_cfg.flow = HSI_FLOW_SYNC,
-                       .rx_cfg.mode = HSI_MODE_FRAME,
-                       .rx_cfg.channels = 8
-               }
-       };
-
-       static struct hsi_mid_platform_data mid_info = {
-               .tx_dma_channels[0] = -1,
-               .tx_dma_channels[1] = 5,
-               .tx_dma_channels[2] = -1,
-               .tx_dma_channels[3] = -1,
-               .tx_dma_channels[4] = -1,
-               .tx_dma_channels[5] = -1,
-               .tx_dma_channels[6] = -1,
-               .tx_dma_channels[7] = -1,
-               .tx_fifo_sizes[0] = -1,
-               .tx_fifo_sizes[1] = 1024,
-               .tx_fifo_sizes[2] = -1,
-               .tx_fifo_sizes[3] = -1,
-               .tx_fifo_sizes[4] = -1,
-               .tx_fifo_sizes[5] = -1,
-               .tx_fifo_sizes[6] = -1,
-               .tx_fifo_sizes[7] = -1,
-               .rx_dma_channels[0] = -1,
-               .rx_dma_channels[1] = 1,
-               .rx_dma_channels[2] = -1,
-               .rx_dma_channels[3] = -1,
-               .rx_dma_channels[4] = -1,
-               .rx_dma_channels[5] = -1,
-               .rx_dma_channels[6] = -1,
-               .rx_dma_channels[7] = -1,
-               .rx_fifo_sizes[0] = -1,
-               .rx_fifo_sizes[1] = 1024,
-               .rx_fifo_sizes[2] = -1,
-               .rx_fifo_sizes[3] = -1,
-               .rx_fifo_sizes[4] = -1,
-               .rx_fifo_sizes[5] = -1,
-               .rx_fifo_sizes[6] = -1,
-               .rx_fifo_sizes[7] = -1,
-       };
-
-       printk(KERN_INFO "HSI platform data setup\n");
-
-       printk(KERN_INFO "HSI mdm GPIOs %d, %d, %d, %d\n",
-               rst_out, pwr_on, rst_pmu, fcdp_rb);
-
-       mid_info.gpio_mdm_rst_out = rst_out;
-       mid_info.gpio_mdm_pwr_on = pwr_on;
-       mid_info.gpio_mdm_rst_bbn = rst_pmu;
-       mid_info.gpio_fcdp_rb = fcdp_rb;
-
-       hsi_info[0].platform_data = (void *)&mid_info;
-       hsi_info[1].platform_data = (void *)&mid_info;
-
-       return &hsi_info[0];
-}
-
-static void *msic_battery_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_MSIC_BATTERY, entry->irq);
-       return NULL;
-}
-
-static void *msic_gpio_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       static struct intel_msic_gpio_pdata pdata;
-
-       int gpio = get_gpio_by_name("msic_gpio_base");
-       if (gpio < 0)
-               return NULL;
-
-       pdata.gpio_base = gpio;
-       handle_ipc_irq_res(IPC_DEV_MSIC_GPIO, entry->irq);
-
-       return &pdata;
-}
-
-void max17042_i2c_reset_workaround(void)
-{
-/* toggle clock pin of I2C-1 to recover devices from abnormal status.
- * currently, only max17042 on I2C-1 needs such workaround */
-#define I2C_1_GPIO_PIN 27
-       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_GPIO);
-       gpio_direction_output(I2C_1_GPIO_PIN, 0);
-       gpio_set_value(I2C_1_GPIO_PIN, 1);
-       udelay(10);
-       gpio_set_value(I2C_1_GPIO_PIN, 0);
-       udelay(10);
-       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_ALT_1);
-#undef I2C_1_GPIO_PIN 27
-}
-EXPORT_SYMBOL(max17042_i2c_reset_workaround);
-
-static bool msic_battery_check(void)
-{
-       if (get_oem0_table() == NULL) {
-               pr_info("invalid battery detected\n");
-               return false;
-       } else {
-               pr_info("valid battery detected\n");
-               return true;
-       }
-       return false;
-}
-
-#define UMIP_REF_FG_TBL                        0x806   /* 2 bytes */
-#define BATT_FG_TBL_BODY               14      /* 144 bytes */
-/**
- * mfld_fg_restore_config_data - restore config data
- * @name : Power Supply name
- * @data : config data output pointer
- * @len : length of config data
- *
- */
-int mfld_fg_restore_config_data(const char *name, void *data, int len)
-{
-       int mip_offset, ret;
-
-       /* Read the fuel gauge config data from umip */
-       mip_offset = UMIP_REF_FG_TBL + BATT_FG_TBL_BODY;
-       ret = intel_scu_ipc_read_mip((u8 *)data, len, mip_offset, 0);
-
-       return ret;
-}
-EXPORT_SYMBOL(mfld_fg_restore_config_data);
-
-/**
- * mfld_fg_save_config_data - save config data
- * @name : Power Supply name
- * @data : config data input pointer
- * @len : length of config data
- *
- */
-int mfld_fg_save_config_data(const char *name, void *data, int len)
-{
-       int mip_offset, ret;
-
-       /* write the fuel gauge config data to umip */
-       mip_offset = UMIP_REF_FG_TBL + BATT_FG_TBL_BODY;
-       ret = intel_scu_ipc_write_umip((u8 *)data, len, mip_offset);
-
-       return ret;
-}
-EXPORT_SYMBOL(mfld_fg_save_config_data);
-
-static void *max17042_platform_data(void *info)
-{
-       static struct max17042_platform_data platform_data;
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
-       int intr = get_gpio_by_name("max_fg_alert");
-
-       i2c_info->irq = intr + MRST_IRQ_OFFSET;
-
-       if (msic_battery_check()) {
-               platform_data.enable_current_sense = true;
-               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
-       } else {
-               platform_data.enable_current_sense = false;
-               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
-       }
-
-       platform_data.is_init_done = 0;
-       platform_data.reset_i2c_lines = max17042_i2c_reset_workaround;
-       platform_data.enable_current_sense = true;
-       platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
-       platform_data.restore_config_data = mfld_fg_restore_config_data;
-       platform_data.save_config_data = mfld_fg_save_config_data;
-
-#ifdef CONFIG_CHARGER_SMB347
-       platform_data.battery_status = smb347_get_charging_status;
-#endif
-
-       return &platform_data;
-}
-
-#define SMB347_IRQ_GPIO                52
-
-static struct smb347_charger_platform_data smb347_pdata = {
-       .battery_info   = {
-               .name                   = "UP110005",
-               .technology             = POWER_SUPPLY_TECHNOLOGY_LIPO,
-               .voltage_max_design     = 3700000,
-               .voltage_min_design     = 3000000,
-               .charge_full_design     = 6894000,
-       },
-       .max_charge_current             = 3360000,
-       .max_charge_voltage             = 4200000,
-       .otg_uvlo_voltage               = 3300000,
-       .chip_temp_threshold            = 120,
-       .soft_cold_temp_limit           = 5,
-       .soft_hot_temp_limit            = 50,
-       .hard_cold_temp_limit           = 5,
-       .hard_hot_temp_limit            = 55,
-       .suspend_on_hard_temp_limit     = true,
-       .soft_temp_limit_compensation   = SMB347_SOFT_TEMP_COMPENSATE_CURRENT
-                                       | SMB347_SOFT_TEMP_COMPENSATE_VOLTAGE,
-       .charge_current_compensation    = 900000,
-       .use_mains                      = true,
-       .enable_control                 = SMB347_CHG_ENABLE_PIN_ACTIVE_LOW,
-       .otg_control                    = SMB347_OTG_CONTROL_DISABLED,
-       .irq_gpio                       = SMB347_IRQ_GPIO,
-};
-
-static void *smb347_platform_data(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
-
-       return &smb347_pdata;
-}
-
-static void *msic_audio_platform_data(void *info)
-{
-       int ret;
-       struct platform_device *pdev;
-       struct sfi_device_table_entry *entry = info;
-
-       pdev = platform_device_alloc("sst-platform", -1);
-       if (!pdev) {
-               pr_err("failed to allocate audio platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add audio platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       pdev = platform_device_alloc("hdmi-audio", -1);
-       if (!pdev) {
-               pr_err("failed to allocate hdmi-audio platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add hdmi-audio platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       pdev = platform_device_alloc("sn95031", -1);
-       if (!pdev) {
-               pr_err("failed to allocate sn95031 platform device\n");
-               return NULL;
-       }
-
-       ret = platform_device_add(pdev);
-       if (ret) {
-               pr_err("failed to add sn95031 platform device\n");
-               platform_device_put(pdev);
-               return NULL;
-       }
-
-       if (strncmp(entry->name, "msic_audio", 16) == 0)
-               handle_ipc_irq_res(IPC_DEV_MSIC_AUDIO, entry->irq);
-
-       return NULL;
-}
-
-static void *msic_power_btn_platform_data(void *info)
-{
-       struct sfi_device_table_entry *entry = info;
-       handle_ipc_irq_res(IPC_DEV_MSIC_POWER_BTN, entry->irq);
-       return NULL;
-}
-
-static void *msic_ocd_platform_data(void *info)
-{
-       int gpio;
-       static struct intel_msic_ocd_pdata pdata;
-
-       gpio = get_gpio_by_name("ocd_gpio");
-       if (gpio < 0)
-               return NULL;
-
-       pdata.gpio = gpio;
-
-       handle_ipc_irq_res(IPC_DEV_MSIC_OCD, gpio + MRST_IRQ_OFFSET);
-
-       return &pdata;
-}
-
-/* MFLD iCDK camera sensor GPIOs */
-
-#define GP_CAMERA_0_POWER_DOWN         "cam0_vcm_2p8"
-#define GP_CAMERA_1_POWER_DOWN         "camera_1_power"
-#define GP_CAMERA_0_RESET              "camera_0_reset"
-#define GP_CAMERA_1_RESET              "camera_1_reset"
-/* Need modify sensor driver's platform data structure to eliminate static */
-static int gp_camera0_reset;
-static int gp_camera0_power_down;
-static int gp_camera1_reset;
-static int gp_camera1_power_down;
-static int camera_vprog1_on;
-
-/*
- * One-time gpio initialization.
- * @name: gpio name: coded in SFI table
- * @gpio: gpio pin number (bypass @name)
- * @dir: GPIOF_DIR_IN or GPIOF_DIR_OUT
- * @value: if dir = GPIOF_DIR_OUT, this is the init value for output pin
- * if dir = GPIOF_DIR_IN, this argument is ignored
- * return: a positive pin number if succeeds, otherwise a negative value
- */
-static int camera_sensor_gpio(int gpio, char *name, int dir, int value)
-{
-       pr_err("%s: GPIO:%d, Name:%s, Dir:%d, Value:%d", __func__, gpio, name, dir, value);
-       int ret, pin;
-
-       if (gpio == -1) {
-               pin = get_gpio_by_name(name);
-               if (pin == -1) {
-                       pr_err("%s: failed to get gpio(name: %s)\n",
-                                               __func__, name);
-                       return -EINVAL;
-               }
-       } else {
-               pin = gpio;
-       }
-
-       ret = gpio_request(pin, name);
-       if (ret) {
-               pr_err("%s: failed to request gpio(pin %d)\n", __func__, pin);
-               return -EINVAL;
-       }
-
-       if (dir == GPIOF_DIR_OUT)
-               ret = gpio_direction_output(pin, value);
-       else
-               ret = gpio_direction_input(pin);
-
-       if (ret) {
-               pr_err("%s: failed to set gpio(pin %d) direction\n",
-                                                       __func__, pin);
-               gpio_free(pin);
-       }
-
-       return ret ? ret : pin;
-}
-
-/*
- * Configure MIPI CSI physical parameters.
- * @port: ATOMISP_CAMERA_PORT_PRIMARY or ATOMISP_CAMERA_PORT_SECONDARY
- * @lanes: for ATOMISP_CAMERA_PORT_PRIMARY, there could be 2 or 4 lanes
- * for ATOMISP_CAMERA_PORT_SECONDARY, there is only one lane.
- * @format: MIPI CSI pixel format, see include/linux/atomisp_platform.h
- * @bayer_order: MIPI CSI bayer order, see include/linux/atomisp_platform.h
- */
-static int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
-                       u32 lanes, u32 format, u32 bayer_order, int flag)
-{
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
-       struct camera_mipi_info *csi = NULL;
-
-       if (flag) {
-               csi = kzalloc(sizeof(*csi), GFP_KERNEL);
-               if (!csi) {
-                       dev_err(&client->dev, "out of memory\n");
-                       return -ENOMEM;
-               }
-               csi->port = port;
-               csi->num_lanes = lanes;
-               csi->input_format = format;
-               csi->raw_bayer_order = bayer_order;
-               v4l2_set_subdev_hostdata(sd, (void *)csi);
-       } else {
-               csi = v4l2_get_subdev_hostdata(sd);
-               kfree(csi);
-       }
-
-       return 0;
-}
-
-
-/*
- * MFLD PR2 primary camera sensor - MT9E013 platform data
- */
-static int mt9e013_gpio_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera0_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_0_RESET,
-                                        GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera0_reset = ret;
-       }
-
-       if (flag) {
-               gpio_set_value(gp_camera0_reset, 0);
-               msleep(20);
-               gpio_set_value(gp_camera0_reset, 1);
-       } else {
-               gpio_set_value(gp_camera0_reset, 0);
-       }
-
-       return 0;
-}
-
-static int mt9e013_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       static const unsigned int clock_khz = 19200;
-       return intel_scu_ipc_osc_clk(OSC_CLK_CAM0, flag ? clock_khz : 0);
-}
-
-static int mt9e013_power_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera0_power_down < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_0_POWER_DOWN,
-                                        GPIOF_DIR_OUT, 1);
-               /*
-                * on some HW, this pin is not a connected pin,
-                * while on others, this indeed is avaiable.
-                * so just operate it when available and continue
-                * if it is failed.
-                */
-               if (ret < 0)
-                       pr_debug("%s not available.", GP_CAMERA_0_POWER_DOWN);
-               gp_camera0_power_down = ret;
-       }
-
-       if (flag) {
-               if (gp_camera0_power_down >= 0)
-                       gpio_set_value(gp_camera0_power_down, 1);
-               if (!camera_vprog1_on) {
-                       camera_vprog1_on = 1;
-                       intel_scu_ipc_msic_vprog1(1);
-               }
-       } else {
-               if (camera_vprog1_on) {
-                       camera_vprog1_on = 0;
-                       intel_scu_ipc_msic_vprog1(0);
-               }
-               if (gp_camera0_power_down >= 0)
-                       gpio_set_value(gp_camera0_power_down, 0);
-       }
-
-       return 0;
-}
-
-static int mt9e013_csi_configure(struct v4l2_subdev *sd, int flag)
-{
-       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_PRIMARY, 2,
-               ATOMISP_INPUT_FORMAT_RAW_10, atomisp_bayer_order_grbg, flag);
-}
-
-static struct camera_sensor_platform_data mt9e013_sensor_platform_data = {
-       .gpio_ctrl      = mt9e013_gpio_ctrl,
-       .flisclk_ctrl   = mt9e013_flisclk_ctrl,
-       .power_ctrl     = mt9e013_power_ctrl,
-       .csi_cfg        = mt9e013_csi_configure,
-};
-
-static void *mt9e013_platform_data_init(void *info)
-{
-       gp_camera0_reset = -1;
-       gp_camera0_power_down = -1;
-
-       return &mt9e013_sensor_platform_data;
-}
-
-/*
- * MFLD PR2 secondary camera sensor - MT9M114 platform data
- */
-static int mt9m114_gpio_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera1_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_1_RESET,
-                                        GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera1_reset = ret;
-       }
-
-       if (flag)
-               gpio_set_value(gp_camera1_reset, 1);
-       else
-               gpio_set_value(gp_camera1_reset, 0);
-
-       return 0;
-}
-
-static int mt9m114_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       static const unsigned int clock_khz = 19200;
-       return intel_scu_ipc_osc_clk(OSC_CLK_CAM1, flag ? clock_khz : 0);
-}
-
-static int mt9e013_reset;
-
-static int mt9m114_power_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       /* With the DV10 documentation states that this gpio pin might not
-        * be a valid for this board (as it is for the PRx Medfield phones)
-        * We'll just test to see if it can be set, otherwise just ignore
-        * and move on.
-        */
-       if (gp_camera1_power_down < 0)
-               gp_camera1_power_down = camera_sensor_gpio(-1,
-                                GP_CAMERA_1_POWER_DOWN, GPIOF_DIR_OUT, 1);
-
-       if (gp_camera1_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_1_RESET,
-                                        GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera1_reset = ret;
-       }
-
-       if (flag) {
-               if (!mt9e013_reset) {
-                       mt9e013_power_ctrl(sd, 1);
-                       mt9e013_gpio_ctrl(sd, 0);
-                       mt9e013_gpio_ctrl(sd, 1);
-                       mt9e013_gpio_ctrl(sd, 0);
-                       mt9e013_power_ctrl(sd, 0);
-                       mt9e013_reset = 1;
-               }
-                gpio_direction_output(gp_camera1_reset, 0);
-               gpio_set_value(gp_camera1_reset, 0);
-               if (!camera_vprog1_on) {
-                       camera_vprog1_on = 1;
-                       intel_scu_ipc_msic_vprog1(1);
-               }
-               if (gp_camera1_power_down >= 0)
-                       gpio_set_value(gp_camera1_power_down, 1);
-       } else {
-               if (camera_vprog1_on) {
-                       camera_vprog1_on = 0;
-                       intel_scu_ipc_msic_vprog1(0);
-               }
-               if (gp_camera1_power_down >= 0)
-                       gpio_set_value(gp_camera1_power_down, 0);
-
-               mt9e013_reset = 0;
-       }
-
-       return 0;
-}
-
-static int mt9m114_csi_configure(struct v4l2_subdev *sd, int flag)
-{
-       /* soc sensor, there is no raw bayer order (set to -1) */
-       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_SECONDARY, 1,
-               ATOMISP_INPUT_FORMAT_YUV422_8, -1, flag);
-}
-
-static struct camera_sensor_platform_data mt9m114_sensor_platform_data = {
-       .gpio_ctrl      = mt9m114_gpio_ctrl,
-       .flisclk_ctrl   = mt9m114_flisclk_ctrl,
-       .power_ctrl     = mt9m114_power_ctrl,
-       .csi_cfg        = mt9m114_csi_configure,
-};
-
-static void *mt9m114_platform_data_init(void *info)
-{
-       gp_camera1_reset = -1;
-       gp_camera1_power_down = -1;
-
-       return &mt9m114_sensor_platform_data;
-}
-
-static void *lm3554_platform_data_init(void *info)
-{
-       static struct camera_flash_platform_data lm3554_platform_data;
-       void *ret = &lm3554_platform_data;
-
-       lm3554_platform_data.gpio_reset  = get_gpio_by_name("GP_FLASH_RESET");
-       lm3554_platform_data.gpio_strobe = get_gpio_by_name("GP_FLASH_STROBE");
-       lm3554_platform_data.gpio_torch  = get_gpio_by_name("GP_FLASH_TORCH");
-
-       if (lm3554_platform_data.gpio_reset == -1) {
-               pr_err("%s: Unable to find GP_FLASH_RESET\n", __func__);
-               ret = NULL;
-       }
-       if (lm3554_platform_data.gpio_strobe == -1) {
-               pr_err("%s: Unable to find GP_FLASH_STROBE\n", __func__);
-               ret = NULL;
-       }
-       if (lm3554_platform_data.gpio_torch == -1) {
-               pr_err("%s: Unable to find GP_FLASH_TORCH\n", __func__);
-               ret = NULL;
-       }
-
-       return ret;
-}
-
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
-static struct wl12xx_platform_data mid_wifi_control = {
-       .board_ref_clock = 1,
-       .irq = 2,
-       .board_tcxo_clock = 1,
-       .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
-};
-
-static struct regulator_consumer_supply wl12xx_vmmc3_supply = {
-       .supply         = "vmmc",
-       .dev_name       = "0000:00:00.0", /*default value*/
-};
-
-static struct regulator_init_data wl12xx_vmmc3 = {
-       .constraints = {
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies = &wl12xx_vmmc3_supply,
-};
-
-static struct fixed_voltage_config wl12xx_vwlan = {
-       .supply_name            = "vwl1271",
-       .microvolts             = 1800000,
-       .gpio                   = 75,
-       .startup_delay          = 70000,
-       .enable_high            = 1,
-       .enabled_at_boot        = 0,
-       .init_data              = &wl12xx_vmmc3,
-};
-
-static struct platform_device wl12xx_vwlan_device = {
-       .name           = "reg-fixed-voltage",
-       .id             = 1,
-       .dev = {
-               .platform_data  = &wl12xx_vwlan,
-       },
-};
-
-#define WL12XX_SFI_GPIO_IRQ_NAME "WLAN-interrupt"
-#define WL12XX_SFI_GPIO_ENABLE_NAME "WLAN-enable"
-#define ICDK_BOARD_REF_CLK 26000000
-#define NCDK_BOARD_REF_CLK 38400000
-
-void __init wl12xx_platform_data_init_post_scu(void *info)
-{
-       struct sd_board_info *sd_info = info;
-       int wifi_irq_gpio;
-       int err;
-
-       /*Get GPIO numbers from the SFI table*/
-       wifi_irq_gpio = get_gpio_by_name(WL12XX_SFI_GPIO_IRQ_NAME);
-       if (wifi_irq_gpio == -1) {
-               pr_err("%s: Unable to find WLAN-interrupt GPIO in the SFI table\n",
-                               __func__);
-               return;
-       }
-       err = gpio_request(wifi_irq_gpio, "wl12xx");
-       if (err < 0) {
-               pr_err("%s: Unable to request GPIO\n", __func__);
-               return;
-       }
-       err = gpio_direction_input(wifi_irq_gpio);
-       if (err < 0) {
-               pr_err("%s: Unable to set GPIO direction\n", __func__);
-               return;
-       }
-       mid_wifi_control.irq = gpio_to_irq(wifi_irq_gpio);
-       if (mid_wifi_control.irq < 0) {
-               pr_err("%s:Error gpio_to_irq:%d->%d\n", __func__, wifi_irq_gpio,
-                      mid_wifi_control.irq);
-               return;
-       }
-       /* Set our board_ref_clock from SFI SD board info */
-       if (sd_info->board_ref_clock == ICDK_BOARD_REF_CLK)
-               /*iCDK board*/
-               /*26Mhz TCXO clock ref*/
-               mid_wifi_control.board_ref_clock = 1;
-       else if (sd_info->board_ref_clock == NCDK_BOARD_REF_CLK)
-               /*nCDK board*/
-               /*38,4Mhz TCXO clock ref*/
-               mid_wifi_control.board_ref_clock = 2;
-
-       err = wl12xx_set_platform_data(&mid_wifi_control);
-       if (err < 0)
-               pr_err("error setting wl12xx data\n");
-
-       /* this is the fake regulator that mmc stack use to power of the
-          wifi sdio card via runtime_pm apis */
-       wl12xx_vwlan.gpio = get_gpio_by_name(WL12XX_SFI_GPIO_ENABLE_NAME);
-       if (wl12xx_vwlan.gpio == -1) {
-               pr_err("%s: Unable to find WLAN-enable GPIO in the SFI table\n",
-                      __func__);
-               return;
-       }
-       /* format vmmc reg address from sfi table */
-       sprintf((char *)wl12xx_vmmc3_supply.dev_name, "0000:00:%02x.%01x",
-               (sd_info->addr)>>8, sd_info->addr&0xFF);
-
-       err = platform_device_register(&wl12xx_vwlan_device);
-       if (err < 0)
-               pr_err("error platform_device_register\n");
-
-       sdhci_pci_request_regulators();
-}
-
-void __init *wl12xx_platform_data_init(void *info)
-{
-       struct sd_board_info *sd_info;
-
-       sd_info = kmemdup(info, sizeof(*sd_info), GFP_KERNEL);
-       if (!sd_info) {
-               pr_err("MRST: fail to alloc mem for delayed wl12xx dev\n");
-               return NULL;
-       }
-       intel_delayed_device_register(sd_info,
-                                     wl12xx_platform_data_init_post_scu);
-
-       return &mid_wifi_control;
-}
-#else
-void *wl12xx_platform_data_init(void *info)
-{
-       return NULL;
-}
-#endif
-
-#define TOUCH_RESET_GPIO 129
-#define TOUCH_IRQ_GPIO   62
-
-/* Atmel mxt toucscreen platform setup*/
-static int atmel_mxt_init_platform_hw(struct i2c_client *client)
-{
-       int rc;
-       int reset_gpio, int_gpio;
-
-       reset_gpio = TOUCH_RESET_GPIO;
-       int_gpio = TOUCH_IRQ_GPIO;
-
-       /* init interrupt gpio */
-       rc = gpio_request(int_gpio, "mxt_ts_intr");
-       if (rc < 0)
-               return rc;
-
-       rc = gpio_direction_input(int_gpio);
-       if (rc < 0)
-               goto err_int;
-
-       /* init reset gpio */
-       rc = gpio_request(reset_gpio, "mxt_ts_rst");
-       if (rc < 0)
-               goto err_int;
-
-       rc = gpio_direction_output(reset_gpio, 1);
-       if (rc < 0)
-               goto err_reset;
-
-       /* reset the chip */
-       gpio_set_value(reset_gpio, 1);
-       msleep(20);
-       gpio_set_value(reset_gpio, 0);
-       msleep(20);
-       gpio_set_value(reset_gpio, 1);
-       msleep(100);
-
-       /*
-        * HACK: depending on which touchpanel is used the mxt1386 controller
-        * may be at i2c address 0x4d instead of the default 0x4c stated in SFI
-        * table. Probe for chip by sending a i2c message and wait for ACK.
-        * (writing 0x00 will prepare chip for reading chip family id)
-        */
-
-       rc = i2c_smbus_write_byte_data(client, 0, 0);
-       if (rc < 0) {
-               /* retry */
-               msleep(60);
-               rc = i2c_smbus_write_byte_data(client, 0, 0);
-               if (rc < 0) {
-                       if (client->addr == 0x4c)
-                               client->addr = 0x4d;
-                       else if (client->addr == 0x4d)
-                               client->addr = 0x4c;
-               }
-       }
-
-       return 0;
-
-err_reset:
-       gpio_free(reset_gpio);
-err_int:
-       pr_err("mxt touchscreen: configuring reset or int gpio failed\n");
-       gpio_free(int_gpio);
-
-       return rc;
-}
-
-void *mxt_platform_data_init(void *info)
-{
-       struct i2c_board_info *i2c_info = info;
-       static struct mxt_platform_data mxt_pdata = {
-               .irqflags       = IRQF_TRIGGER_FALLING,
-               .init_platform_hw = atmel_mxt_init_platform_hw,
-       };
-
-       i2c_info->irq = TOUCH_IRQ_GPIO + MRST_IRQ_OFFSET;
-       return &mxt_pdata;
-}
-
-#define AUDIENCE_WAKEUP_GPIO               "audience-wakeup"
-#define AUDIENCE_RESET_GPIO                 "audience-reset"
-static int audience_request_resources(struct i2c_client *client)
-{
-       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
-               client->dev.platform_data;
-       int ret;
-
-       pr_debug("Audience: request ressource audience\n");
-       if (!pdata)
-               return -1;
-       ret = gpio_request(pdata->gpio_a1026_wakeup, AUDIENCE_WAKEUP_GPIO);
-       if (ret) {
-               dev_err(&client->dev, "Request AUDIENCE WAKEUP GPIO %d fails %d\n",
-                       pdata->gpio_a1026_wakeup, ret);
-               return -1;
-       }
-       ret = gpio_direction_output(pdata->gpio_a1026_wakeup, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_wake;
-       }
-
-       ret = gpio_request(pdata->gpio_a1026_reset, AUDIENCE_RESET_GPIO);
-       if (ret) {
-               dev_err(&client->dev,
-                               "Request for Audience reset GPIO %d fails %d\n",
-                                       pdata->gpio_a1026_reset, ret);
-               goto err_wake;
-       }
-       ret = gpio_direction_output(pdata->gpio_a1026_reset, 0);
-       if (ret) {
-               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
-               goto err_reset;
-       }
-       sprintf(pdata->firmware_name, "%s", "vpimg_es305b.bin");
-
-       return 0;
-err_reset:
-       gpio_free(pdata->gpio_a1026_reset);
-err_wake:
-       gpio_free(pdata->gpio_a1026_wakeup);
-       return -1;
-}
-
-static void audience_free_resources(struct i2c_client *client)
-{
-       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
-               &client->dev.platform_data;
-
-       gpio_free(pdata->gpio_a1026_wakeup);
-       gpio_free(pdata->gpio_a1026_reset);
-}
-
-static void audience_wake_up(bool state)
-{
-       int wakeup_gpio;
-
-       wakeup_gpio = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
-       if (wakeup_gpio == -1) {
-               pr_err("%s invalid wakeup gpio", __func__);
-               return;
-       }
-       gpio_set_value(wakeup_gpio, state);
-       pr_debug("Audience: WAKE UP %d\n", state);
-}
-
-static void audience_reset(bool state)
-{
-       int reset_gpio;
-
-       reset_gpio = get_gpio_by_name(AUDIENCE_RESET_GPIO);
-       if (reset_gpio == -1) {
-               pr_err("%s invalid reset gpio", __func__);
-               return;
-       }
-       gpio_set_value(reset_gpio, state);
-       pr_debug("Audience: RESET %d\n", state);
-}
-
-void *audience_platform_data_init(void *info)
-{
-       static struct a1026_platform_data pdata;
-
-       pdata.gpio_a1026_wakeup = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
-       pdata.gpio_a1026_reset = get_gpio_by_name(AUDIENCE_RESET_GPIO);
-       pdata.request_resources = audience_request_resources;
-       pdata.free_resources    = audience_free_resources;
-       pdata.wakeup                    = audience_wake_up;
-       pdata.reset                     = audience_reset;
-
-       return &pdata;
-}
-
-void *lis3dh_pdata_init(void *info)
-{
-       static struct lis3dh_acc_platform_data lis3dh_pdata;
-
-       lis3dh_pdata.poll_interval = 200;
-       lis3dh_pdata.negate_x = 1;
-       lis3dh_pdata.negate_y = 0;
-       lis3dh_pdata.negate_z = 0;
-       lis3dh_pdata.axis_map_x = 0;
-       lis3dh_pdata.axis_map_y = 1;
-       lis3dh_pdata.axis_map_z = 2;
-       lis3dh_pdata.gpio_int1 = 60;
-       lis3dh_pdata.gpio_int2 = 61;
-
-       return &lis3dh_pdata;
+#include <linux/input.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/platform_device.h>
+#include <linux/ipc_device.h>
+#include <linux/i2c-gpio.h>
 
-}
+#include <asm/intel-mid.h>
+#include <asm/intel_mid_pwm.h>
+#include <asm/intel_scu_ipc.h>
 
-void *ms5607_platform_data_init(void *info)
-{
-       static struct ms5607_platform_data baro_pdata;
+/*
+ * IPC devices
+ */
 
-       baro_pdata.poll_interval = 100;
-       baro_pdata.min_interval  = 0;
+#include "device_libs/platform_ipc.h"
+#include "device_libs/platform_pmic_gpio.h"
+#include "device_libs/platform_msic_adc.h"
+#include "device_libs/platform_msic_gpio.h"
+#include "device_libs/platform_msic_audio.h"
+#include "device_libs/platform_msic_power_btn.h"
+#include "device_libs/platform_msic_ocd.h"
 
-       return &baro_pdata;
-};
+/*
+ * I2C devices
+ */
 
-void *compass_pdata_init(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+#include "device_libs/platform_mpu3050.h"
+#include "device_libs/platform_lis331.h"
+#include "device_libs/platform_pn544.h"
+#include "device_libs/platform_max17042.h"
+#include "device_libs/platform_smb347.h"
+#include "device_libs/platform_camera.h"
+#include "device_libs/platform_mt9e013.h"
+#include "device_libs/platform_mt9m114.h"
+#include "device_libs/platform_mxt_ts.h"
+#include "device_libs/platform_a1026.h"
+#include "device_libs/platform_lis3dh.h"
+#include "device_libs/platform_hmc5883.h"
+#include "device_libs/platform_ms5607.h"
+#include "device_libs/platform_mpu3050.h"
+#include "device_libs/platform_ltr502als.h"
+#include "device_libs/platform_tc35876x.h"
+#include "device_libs/platform_lm3554.h"
 
-       i2c_info->irq = 0xff;
-       return NULL;
-}
+/*
+ * SPI devices
+ */
 
-void *gyro_pdata_init(void *info)
-{
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+#include "device_libs/platform_max3111.h"
 
-       i2c_info->irq = get_gpio_by_name("gyro_int");
+/*
+ * HSI devices
+ */
 
-       return NULL;
-}
+#include "device_libs/platform_hsi_modem.h"
 
-void *bara_pdata_init(void *info)
-{
-       static struct ms5607_platform_data baro_pdata;
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+/*
+ * WIFI devices
+ */
 
-       i2c_info->irq = 0xff;
+#include "device_libs/platform_wl12xx.h"
 
-       baro_pdata.poll_interval = 100;
-       baro_pdata.min_interval  = 0;
+/*
+ * Bluetooth devices
+ */
 
-       return &baro_pdata;
-}
+#include "device_libs/platform_btwilink.h"
 
-void *als_pdata_init(void *info)
+static void __init *no_platform_data(void *info)
 {
-       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
-
-       i2c_info->irq = get_gpio_by_name("AL-intr");
-
        return NULL;
 }
 
-static const struct intel_v4l2_subdev_id v4l2_ids_mfld[] = {
+const struct intel_v4l2_subdev_id v4l2_ids[] = {
        {"mt9e013", RAW_CAMERA, ATOMISP_CAMERA_PORT_PRIMARY},
        {"mt9m114", SOC_CAMERA, ATOMISP_CAMERA_PORT_SECONDARY},
        {"lm3554", LED_FLASH, -1},
        {},
 };
-static const struct intel_v4l2_subdev_id v4l2_ids_clv[] = {
-       {"ov8830", RAW_CAMERA, ATOMISP_CAMERA_PORT_PRIMARY},
-       {"mt9m114", SOC_CAMERA, ATOMISP_CAMERA_PORT_SECONDARY},
-       {"lm3554", LED_FLASH, -1},
-       {},
-};
-
-static const struct intel_v4l2_subdev_id *get_v4l2_ids(int *n_subdev)
-{
-       if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_CLOVERVIEW) {
-               if (n_subdev)
-                       *n_subdev = ARRAY_SIZE(v4l2_ids_clv);
-               return v4l2_ids_clv;
-       } else {
-               if (n_subdev)
-                       *n_subdev = ARRAY_SIZE(v4l2_ids_mfld);
-               return v4l2_ids_mfld;
-       }
-}
-
-static struct atomisp_platform_data *v4l2_subdev_table_head;
-
-void intel_ignore_i2c_device_register(struct sfi_device_table_entry *pentry,
-                                       struct devs_id *dev)
-{
-       struct i2c_board_info i2c_info;
-       struct i2c_board_info *idev = &i2c_info;
-       int bus = pentry->host_num;
-       void *pdata = NULL;
-       int n_subdev;
-       const struct intel_v4l2_subdev_id *vdev = get_v4l2_ids(&n_subdev);
-       struct intel_v4l2_subdev_i2c_board_info *info;
-       static struct intel_v4l2_subdev_table *subdev_table;
-       enum intel_v4l2_subdev_type type = 0;
-       enum atomisp_camera_port port;
-       static int i;
-
-       memset(&i2c_info, 0, sizeof(i2c_info));
-       strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
-       i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
-       i2c_info.addr = pentry->addr;
-       pr_info("I2C bus = %d, name = %16.16s, "
-               "irq = 0x%2x, addr = 0x%x\n",
-               pentry->host_num,
-               i2c_info.type,
-               i2c_info.irq,
-               i2c_info.addr);
-       pdata = dev->get_platform_data(&i2c_info);
-       i2c_info.platform_data = pdata;
-
-
-       while (vdev->name[0]) {
-               if (!strncmp(vdev->name, idev->type, 16)) {
-                       /* compare name */
-                       type = vdev->type;
-                       port = vdev->port;
-                       break;
-               }
-               vdev++;
-       }
-
-       if (!type) /* not found */
-               return;
-
-       info = kzalloc(sizeof(struct intel_v4l2_subdev_i2c_board_info),
-                      GFP_KERNEL);
-       if (!info) {
-               pr_err("MRST: fail to alloc mem for ignored i2c dev %s\n",
-                      idev->type);
-               return;
-       }
-
-       info->i2c_adapter_id = bus;
-       /* set platform data */
-       memcpy(&info->board_info, idev, sizeof(*idev));
-
-       if (v4l2_subdev_table_head == NULL) {
-               subdev_table = kzalloc(sizeof(struct intel_v4l2_subdev_table)
-                       * n_subdev, GFP_KERNEL);
-
-               if (!subdev_table) {
-                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
-                              idev->type);
-                       kfree(info);
-                       return;
-               }
-
-               v4l2_subdev_table_head = kzalloc(
-                       sizeof(struct atomisp_platform_data), GFP_KERNEL);
-               if (!v4l2_subdev_table_head) {
-                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
-                              idev->type);
-                       kfree(info);
-                       kfree(subdev_table);
-                       return;
-               }
-               v4l2_subdev_table_head->subdevs = subdev_table;
-       }
-
-       memcpy(&subdev_table[i].v4l2_subdev, info, sizeof(*info));
-       subdev_table[i].type = type;
-       subdev_table[i].port = port;
-       i++;
-       kfree(info);
-       return;
-}
-
-const struct atomisp_platform_data *intel_get_v4l2_subdev_table(void)
-{
-       if (v4l2_subdev_table_head)
-               return v4l2_subdev_table_head;
-       else {
-               pr_err("MRST: no camera device in the SFI table\n");
-               return NULL;
-       }
-}
-EXPORT_SYMBOL_GPL(intel_get_v4l2_subdev_table);
-
-void blackbay_ipc_device_handler(struct sfi_device_table_entry *pentry,
-               struct devs_id *dev)
-{
-       int res_num;
-       struct resource *res;
-       struct ipc_device *ipcdev;
-       void *pdata = NULL;
-
-       pr_info("IPC bus = %d, name = %16.16s, "
-               "irq = 0x%2x\n", pentry->host_num, pentry->name, pentry->irq);
-
-       mutex_lock(&ipc_dev_lock);
-
-       pdata = dev->get_platform_data(pentry);
-
-       ipcdev = ipc_device_alloc(pentry->name, -1);
-       if (ipcdev == NULL) {
-               pr_err("out of memory for SFI platform device '%s'.\n",
-                               pentry->name);
-               return;
-       }
-
-       res = ipc_dev_res[current_ipcdev].resources;
-       res_num = ipc_dev_res[current_ipcdev].num_resources;
-       ipc_device_add_resources(ipcdev, res, res_num);
-
-       ipcdev->dev.platform_data = pdata;
-       ipc_device_add_to_list(ipcdev);
-
-       mutex_unlock(&ipc_dev_lock);
-}
-
-/*
- * CLV PR0 primary camera sensor - OV8830 platform data
- */
-
-static int ov8830_gpio_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       int ret;
-
-       if (gp_camera0_reset < 0) {
-               ret = camera_sensor_gpio(-1, GP_CAMERA_0_RESET,
-                                       GPIOF_DIR_OUT, 1);
-               if (ret < 0)
-                       return ret;
-               gp_camera0_reset = ret;
-       }
-
-       if (flag) {
-               gpio_set_value(gp_camera0_reset, 0);
-               msleep(20);
-               gpio_set_value(gp_camera0_reset, 1);
-       } else {
-               gpio_set_value(gp_camera0_reset, 0);
-       }
-
-       return 0;
-}
-
-static int ov8830_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       static const unsigned int clock_khz = 19200;
-       return intel_scu_ipc_osc_clk(OSC_CLK_CAM0, flag ? clock_khz : 0);
-}
-
-static int ov8830_power_ctrl(struct v4l2_subdev *sd, int flag)
-{
-       if (flag) {
-               if (!camera_vprog1_on) {
-                       camera_vprog1_on = 1;
-                       intel_scu_ipc_msic_vprog1(1);
-               }
-       } else {
-               if (camera_vprog1_on) {
-                       camera_vprog1_on = 0;
-                       intel_scu_ipc_msic_vprog1(0);
-               }
-       }
-
-       return 0;
-}
-
-static int ov8830_csi_configure(struct v4l2_subdev *sd, int flag)
-{
-       static const int LANES = 4;
-       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_PRIMARY, LANES,
-               ATOMISP_INPUT_FORMAT_RAW_10, atomisp_bayer_order_bggr, flag);
-}
-
-static struct camera_sensor_platform_data ov8830_sensor_platform_data = {
-       .gpio_ctrl      = ov8830_gpio_ctrl,
-       .flisclk_ctrl   = ov8830_flisclk_ctrl,
-       .power_ctrl     = ov8830_power_ctrl,
-       .csi_cfg        = ov8830_csi_configure,
-};
-
-void *ov8830_platform_data_init(void *info)
-{
-       gp_camera0_reset = -1;
-       gp_camera0_power_down = -1;
-
-       return &ov8830_sensor_platform_data;
-}
-
-
-static struct rmi_f11_functiondata synaptics_f11_data = {
-       .swap_axes = true,
-};
-
-static unsigned char synaptic_keys[31] = {1, 2, 3, 4,};
-                       /* {KEY_BACK,KEY_MENU,KEY_HOME,KEY_SEARCH,} */
-
-static struct rmi_button_map synaptics_button_map = {
-       .nbuttons = 31,
-       .map = synaptic_keys,
-};
-static struct rmi_f19_functiondata  synaptics_f19_data = {
-       .button_map = &synaptics_button_map,
-};
-
-#define RMI_F11_INDEX 0x11
-#define RMI_F19_INDEX 0x19
-
-static struct rmi_functiondata synaptics_functiondata[] = {
-       {
-               .function_index = RMI_F11_INDEX,
-               .data = &synaptics_f11_data,
-       },
-       {
-               .function_index = RMI_F19_INDEX,
-               .data = &synaptics_f19_data,
-       },
-};
-
-static struct rmi_functiondata_list synaptics_perfunctiondata = {
-       .count = ARRAY_SIZE(synaptics_functiondata),
-       .functiondata = synaptics_functiondata,
-};
-
-
-static struct rmi_sensordata s3202_sensordata = {
-       .perfunctiondata = &synaptics_perfunctiondata,
-};
-
-void *s3202_platform_data_init(void *info)
-{
-       struct i2c_board_info *i2c_info = info;
-       static struct rmi_i2c_platformdata s3202_platform_data = {
-               .delay_ms = 50,
-               .sensordata = &s3202_sensordata,
-       };
-
-       s3202_platform_data.i2c_address = i2c_info->addr;
-       s3202_sensordata.attn_gpio_number = get_gpio_by_name("ts_int");
-       s3202_sensordata.rst_gpio_number  = get_gpio_by_name("ts_rst");
-
-       return &s3202_platform_data;
-}
-/*tc35876x DSI_LVDS bridge chip and panel platform data*/
-static void *tc35876x_platform_data(void *data)
-{
-       static struct tc35876x_platform_data pdata;
-       pdata.gpio_bridge_reset = get_gpio_by_name("LCMB_RXEN");
-       pdata.gpio_panel_bl_en = get_gpio_by_name("6S6P_BL_EN");
-       pdata.gpio_panel_vadd = get_gpio_by_name("EN_VREG_LCD_V3P3");
-       return &pdata;
-}
 
 struct devs_id __initconst device_ids[] = {
        {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data, NULL},
        {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data,
-                                       &blackbay_ipc_device_handler},
-       {"cy8ctma340", SFI_DEV_TYPE_I2C, 1, &cyttsp_platform_data, NULL},
+                                       &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, &pmic_audio_platform_data,
-                                       &blackbay_ipc_device_handler},
        {"pn544", SFI_DEV_TYPE_I2C, 0, &pn544_platform_data, NULL},
        {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data, NULL},
-       {"ektf2136_spi", SFI_DEV_TYPE_SPI, 0, &ektf2136_spi_platform_data,
-                                               NULL},
        {"msic_adc", SFI_DEV_TYPE_IPC, 1, &msic_adc_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"max17042", SFI_DEV_TYPE_I2C, 1, &max17042_platform_data, NULL},
        {"smb347", SFI_DEV_TYPE_I2C, 1, &smb347_platform_data, NULL},
        {"hsi_ifx_modem", SFI_DEV_TYPE_HSI, 0, &hsi_modem_platform_data, NULL},
-       {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data_init,
+       {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data,
                                                NULL},
        /* MSIC subdevices */
-       {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data,
-                                       &blackbay_ipc_device_handler},
        {"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
        {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data,
-                                       &blackbay_ipc_device_handler},
+                                       &ipc_device_handler},
 
        /*
         * I2C devices for camera image subsystem which will not be load into
         * I2C core while initialize
         */
-       {"lm3554", SFI_DEV_TYPE_I2C, 0, &lm3554_platform_data_init,
+       {"lm3554", SFI_DEV_TYPE_I2C, 0, &lm3554_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"mt9e013", SFI_DEV_TYPE_I2C, 0, &mt9e013_platform_data_init,
+       {"mt9e013", SFI_DEV_TYPE_I2C, 0, &mt9e013_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"mt9m114", SFI_DEV_TYPE_I2C, 0, &mt9m114_platform_data_init,
+       {"mt9m114", SFI_DEV_TYPE_I2C, 0, &mt9m114_platform_data,
                                        &intel_ignore_i2c_device_register},
-       {"mxt1386", SFI_DEV_TYPE_I2C, 0, &mxt_platform_data_init, NULL},
-       {"mxt1386_wintek", SFI_DEV_TYPE_I2C, 0, &mxt_platform_data_init, NULL},
-       {"mxt1386_hanns", SFI_DEV_TYPE_I2C, 0, &mxt_platform_data_init, NULL},
-       {"audience_es305", SFI_DEV_TYPE_I2C, 0, &audience_platform_data_init,
+       {"mxt1386", SFI_DEV_TYPE_I2C, 0, &mxt_ts_platform_data, NULL},
+       {"mxt1386_wintek", SFI_DEV_TYPE_I2C, 0, &mxt_ts_platform_data, NULL},
+       {"mxt1386_hanns", SFI_DEV_TYPE_I2C, 0, &mxt_ts_platform_data, NULL},
+       {"audience_es305", SFI_DEV_TYPE_I2C, 0, &audience_platform_data,
                                                NULL},
-       {"accel", SFI_DEV_TYPE_I2C, 0, &lis3dh_pdata_init, NULL},
-       {"compass", SFI_DEV_TYPE_I2C, 0, &compass_pdata_init, NULL},
-       {"gyro", SFI_DEV_TYPE_I2C, 0, &gyro_pdata_init, NULL},
-       {"baro", SFI_DEV_TYPE_I2C, 0, &bara_pdata_init, NULL},
-       {"als", SFI_DEV_TYPE_I2C, 0, &als_pdata_init, NULL},
-       {"ov8830", SFI_DEV_TYPE_I2C, 0, &ov8830_platform_data_init},
-       {"synaptics_3202", SFI_DEV_TYPE_I2C, 0, &s3202_platform_data_init},
+       {"accel", SFI_DEV_TYPE_I2C, 0, &lis3dh_platform_data, NULL},
+       {"compass", SFI_DEV_TYPE_I2C, 0, &hmc5883_platform_data, NULL},
+       {"gyro", SFI_DEV_TYPE_I2C, 0, &gyro_platform_data, NULL},
+       {"baro", SFI_DEV_TYPE_I2C, 0, &ms5607_platform_data, NULL},
+       {"als", SFI_DEV_TYPE_I2C, 0, &ltr502als_platform_data, NULL},
        {"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data},
 
        {},
@@ -1938,345 +199,3 @@ int __init board_proc_init(void)
 }
 
 early_initcall(board_proc_init);
-
-/*
- * we will search these buttons in SFI GPIO table (by name)
- * and register them dynamically. Please add all possible
- * buttons here, we will shrink them if no GPIO found.
- */
-static struct gpio_keys_button gpio_button[] = {
-       {KEY_POWER,             -1, 1, "power_btn",     EV_KEY, 0, 3000},
-       {KEY_PROG1,             -1, 1, "prog_btn1",     EV_KEY, 0, 20},
-       {KEY_PROG2,             -1, 1, "prog_btn2",     EV_KEY, 0, 20},
-       {SW_LID,                -1, 1, "lid_switch",    EV_SW,  0, 20},
-       {KEY_VOLUMEUP,          -1, 1, "vol_up",        EV_KEY, 0, 20},
-       {KEY_VOLUMEDOWN,        -1, 1, "vol_down",      EV_KEY, 0, 20},
-       {KEY_CAMERA,            -1, 1, "camera_full",   EV_KEY, 0, 20},
-       {KEY_CAMERA_FOCUS,      -1, 1, "camera_half",   EV_KEY, 0, 20},
-       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw1",        EV_SW,  0, 20},
-       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw2",        EV_SW,  0, 20},
-       {KEY_CAMERA,            -1, 1, "cam_capture",   EV_KEY, 0, 20},
-       {KEY_CAMERA_FOCUS,      -1, 1, "cam_focus",     EV_KEY, 0, 20},
-};
-
-static struct gpio_keys_platform_data mrst_gpio_keys = {
-       .buttons        = gpio_button,
-       .rep            = 1,
-       .nbuttons       = -1, /* will fill it after search */
-};
-
-static struct platform_device pb_device = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = &mrst_gpio_keys,
-       },
-};
-
-#ifdef CONFIG_SWITCH_MID
-static struct platform_device switch_device = {
-       .name           = "switch-mid",
-       .id             = -1,
-};
-#endif
-
-
-#if defined(CONFIG_TI_ST) || defined(CONFIG_TI_ST_MODULE)
-
-/* KIM related */
-static int mrst_kim_suspend(struct platform_device *pdev, pm_message_t state)
-{
-       return 0;
-}
-static int mrst_kim_resume(struct platform_device *pdev)
-{
-       return 0;
-}
-
-static struct ti_st_plat_data kim_pdata = {
-       .nshutdown_gpio = -1,/* BT, FM, GPS gpios */
-       .flow_cntrl     = 1,            /* flow control flag */
-       .suspend        = mrst_kim_suspend,
-       .resume         = mrst_kim_resume,
-};
-
-static struct platform_device linux_kim_device = {
-       .name           = "kim", /* named after init manager for ST */
-       .id             = -1,
-       .dev.platform_data = &kim_pdata,
-};
-
-/* BT WILINK related */
-static int mrst_bt_enable(void)
-{
-       return 0;
-}
-static int mrst_bt_disable(void)
-{
-       return 0;
-}
-
-static struct ti_st_plat_data bt_pdata = {
-       .chip_enable    = mrst_bt_enable,
-       .chip_disable   = mrst_bt_disable,
-};
-
-static struct platform_device linux_bt_device = {
-       .name           = "btwilink", /* named after init manager for ST */
-       .id             = -1,
-       .dev.platform_data = &bt_pdata,
-};
-static int __init bluetooth_init(void)
-{
-       unsigned int UART_index;
-       long unsigned int UART_baud_rate;
-       int error_reg;
-
-       /* KIM INIT */
-       /* Get the GPIO number from the SFI table
-          if FM gpio is not provided then BT-reset line is
-          also used to enable FM
-       */
-       kim_pdata.nshutdown_gpio = get_gpio_by_name("BT-reset");
-       if (kim_pdata.nshutdown_gpio == -1)
-               return -ENODEV;
-
-       /* Get Share Transport uart settings */
-       /* TODO : add SFI table parsing and one SFI entry for this settings */
-       UART_index = 0;
-       UART_baud_rate = 3500000;
-
-       /* Share Transport uart settings */
-       sprintf((char *)kim_pdata.dev_name, "/dev/ttyMFD%u", UART_index);
-       kim_pdata.baud_rate = UART_baud_rate;
-
-       pr_info("%s: Setting platform_data with UART device name:%s and "
-                       "UART baud rate:%lu.\n",
-                       __func__, kim_pdata.dev_name, kim_pdata.baud_rate);
-
-       error_reg = platform_device_register(&linux_kim_device);
-       if (error_reg < 0) {
-               pr_err("platform_device_register for kim failed\n");
-               goto exit_on_error;
-       }
-
-       /* BT WILINK INIT */
-       error_reg = platform_device_register(&linux_bt_device);
-       if (error_reg < 0)
-               pr_err("platform_device_register for btwilink failed\n");
-exit_on_error:
-       return error_reg;
-
-}
-device_initcall(bluetooth_init);
-
-#endif
-
-void *cloverview_usb_otg_get_pdata(void)
-{
-       struct cloverview_usb_otg_pdata *pdata;
-
-       if (__intel_mid_cpu_chip != INTEL_MID_CPU_CHIP_CLOVERVIEW)
-               return NULL;
-
-       pdata = (struct cloverview_usb_otg_pdata *)
-                               kmalloc(sizeof(*pdata), GFP_KERNEL);
-       if (!pdata) {
-               pr_err("%s: out of memory.\n", __func__);
-               goto failed1;
-       }
-       pdata->gpio_cs = get_gpio_by_name("usb_otg_phy_cs");
-       if (pdata->gpio_cs == -1) {
-               pr_err("%s: No gpio pin for 'usb_otg_phy_cs'\n", __func__);
-               goto failed2;
-       }
-       pdata->gpio_reset = get_gpio_by_name("usb_otg_phy_reset");
-       if (pdata->gpio_reset == -1) {
-               pr_err("%s: No gpio pin for 'usb_otg_phy_reset'\n", __func__);
-               goto failed2;
-       }
-       pr_info("%s: CS pin: gpio %d, Reset pin: gpio %d\n", __func__,
-                        pdata->gpio_cs, pdata->gpio_reset);
-       return pdata;
-
-failed2:
-       kfree(pdata);
-failed1:
-       return NULL;
-}
-EXPORT_SYMBOL_GPL(cloverview_usb_otg_get_pdata);
-
-/*
- * Shrink the non-existent buttons, register the gpio button
- * device if there is some
- */
-static int __init pb_keys_init(void)
-{
-       struct gpio_keys_button *gb = gpio_button;
-       int i, num, good = 0;
-
-       num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
-       for (i = 0; i < num; i++) {
-               gb[i].gpio = get_gpio_by_name(gb[i].desc);
-               if (gb[i].gpio == -1)
-                       continue;
-
-               if (i != good)
-                       gb[good] = gb[i];
-               good++;
-       }
-
-       if (good) {
-               mrst_gpio_keys.nbuttons = good;
-               return platform_device_register(&pb_device);
-       }
-       return 0;
-}
-late_initcall(pb_keys_init);
-
-#define EMMC_BLK_NAME  "mmcblk0rpmb"
-static int emmc_match(struct device *dev, void *data)
-{
-       if (strcmp(dev_name(dev), data) == 0)
-               return 1;
-       return 0;
-}
-int mmc_blk_rpmb_req_handle(struct mmc_ioc_rpmb_req *req)
-{
-       struct device *emmc = NULL;
-
-       if (!req)
-               return -EINVAL;
-
-       emmc = class_find_device(&block_class, NULL, EMMC_BLK_NAME, emmc_match);
-       if (!emmc) {
-               pr_err("%s: eMMC card is not registered yet. Try it later\n",
-                               __func__);
-               return -ENODEV;
-       }
-
-       return mmc_rpmb_req_handle(emmc, req);
-}
-EXPORT_SYMBOL_GPL(mmc_blk_rpmb_req_handle);
-
-static int hdmi_i2c_workaround(void)
-{
-       int ret;
-       struct platform_device *pdev;
-       struct i2c_gpio_platform_data *pdata;
-
-       /*
-        * Hard code a gpio controller platform device to take over
-        * the two gpio pins used to be controlled by i2c bus 3.
-        * This is to support HDMI EDID extension block read, which
-        * is not supported by the current i2c controller, so we use
-        * GPIO pin the simulate an i2c bus.
-        */
-       pdev = platform_device_alloc("i2c-gpio", 8);
-       if (!pdev) {
-               pr_err("i2c-gpio: failed to alloc platform device\n");
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       pdata = kzalloc(sizeof(struct i2c_gpio_platform_data), GFP_KERNEL);
-       if (!pdata) {
-               pr_err("i2c-gpio: failed to alloc platform data\n");
-               kfree(pdev);
-               ret = -ENOMEM;
-               goto out;
-       }
-       pdata->scl_pin = 35 + 96;
-       pdata->sda_pin = 36 + 96;
-       pdata->sda_is_open_drain = 0;
-       pdata->scl_is_open_drain = 0;
-       pdev->dev.platform_data = pdata;
-
-       platform_device_add(pdev);
-
-       lnw_gpio_set_alt(pdata->sda_pin, LNW_GPIO);
-       lnw_gpio_set_alt(pdata->scl_pin, LNW_GPIO);
-
-out:
-       return ret;
-}
-rootfs_initcall(hdmi_i2c_workaround);
-
-#ifdef CONFIG_LEDS_INTEL_KPD
-static int __init intel_kpd_led_init(void)
-{
-       int ret;
-       struct ipc_board_info board_info;
-
-       memset(&board_info, 0, sizeof(board_info));
-       strncpy(board_info.name, "intel_kpd_led", 16);
-       board_info.bus_id = IPC_SCU;
-       board_info.id = -1;
-
-       ret = ipc_new_device(&board_info);
-       if (ret) {
-               pr_err("failed to create ipc device: intel_kpd_led\n");
-               return -1;
-       }
-
-       return 0;
-}
-fs_initcall(intel_kpd_led_init);
-#endif
-
-
-
-#ifdef CONFIG_SWITCH_MID
-static int __init switch_mid_init(void)
-{
-       int err;
-       err = platform_device_register(&switch_device);
-       if (err < 0)
-               pr_err("Fail to register switch-mid platform device.\n");
-       return 0;
-}
-device_initcall(switch_mid_init);
-#endif
-
-#define MT9M114_I2C_ADDR (0x90 >> 1)   /* i2c address, 0x90 or 0xBA */
-#define MT9M114_BUS      4             /* i2c bus number */
-
-struct sfi_device_table_entry mt9m114_pentry = {
-       .name           =       "mt9m114",
-       .host_num       =       MT9M114_BUS,
-       .irq            =       255,
-       .addr           =       MT9M114_I2C_ADDR,
-};
-#define OV8830_I2C_ADDR        (0x6C >> 1)     /* i2c address, 0x20 or 0x6C */
-#define OV8830_BUS     4               /* i2c bus number */
-
-struct sfi_device_table_entry ov8830_pentry = {
-       .name           =       "ov8830",
-       .host_num       =       OV8830_BUS,
-       .irq            =       255,
-       .addr           =       OV8830_I2C_ADDR,
-};
-static int __init blackbay_i2c_init(void)
-{
-       struct devs_id *dev = NULL;
-       if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_CLOVERVIEW) {
-               /* Add ov8830 driver for detection
-                * -- FIXME: remove as soon as ov8830 is defined in SFI table */
-               dev = get_device_id(SFI_DEV_TYPE_I2C, "ov8830");
-               if (dev != NULL)
-                       intel_ignore_i2c_device_register(&ov8830_pentry, dev);
-               else
-                       pr_err("Dev id is NULL for %s\n", "ov8830");
-
-               /* Add mt9m114 driver for detection
-                * -- FIXME: remove when the sensor is defined in SFI table */
-               dev = get_device_id(SFI_DEV_TYPE_I2C, "mt9m114");
-               if (dev != NULL)
-                       intel_ignore_i2c_device_register(&mt9m114_pentry, dev);
-               else
-                       pr_err("Dev id is NULL for %s\n", "mt9m114");
-       }
-
-       return 0;
-}
-device_initcall(blackbay_i2c_init);
diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile
new file mode 100644 (file)
index 0000000..f20da68
--- /dev/null
@@ -0,0 +1,68 @@
+# IPC Devices
+obj-y                                                  += platform_ipc.o
+obj-y                                                  += platform_msic_audio.o
+obj-y                                                  += platform_clvs_audio.o
+obj-y                                                  += platform_msic_gpio.o
+obj-y                                                  += platform_msic_ocd.o
+obj-$(CONFIG_MSIC_GPADC)                               += platform_msic_adc.o
+obj-$(CONFIG_BATTERY_INTEL_MDF)                                += platform_msic_battery.o
+obj-$(CONFIG_INTEL_MID_POWER_BUTTON)                   += platform_msic_power_btn.o
+obj-$(CONFIG_GPIO_INTEL_PMIC)                          += platform_pmic_gpio.o
+obj-$(CONFIG_MID_PWM)                                  += platform_mid_pwm.o
+obj-$(CONFIG_LEDS_INTEL_KPD)                           += platform_kpd_led.o
+obj-$(CONFIG_INTEL_MFLD_THERMAL)                       += platform_msic_thermal.o
+# I2C Devices
+obj-$(CONFIG_A1026)                                    += platform_a1026.o
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C)                   += platform_cyttsp.o
+obj-$(CONFIG_SENSORS_EMC1403)                          += platform_emc1403.o
+obj-$(CONFIG_SENSORS_HMC5883)                          += platform_hmc5883.o
+obj-$(CONFIG_SENSORS_LIS3DH_ACC)                       += platform_lis3dh.o
+obj-$(CONFIG_SENSORS_LTR502ALS)                                += platform_ltr502als.o
+obj-$(CONFIG_SENSORS_L3G4200D_POLL)                    += platform_l3g4200d.o
+obj-$(CONFIG_SENSORS_LSM303_MAG)                       += platform_lsm303.o
+obj-$(CONFIG_SENSORS_APDS990X)                         += platform_apds990x.o
+obj-$(CONFIG_TOUCHSCREEN_MAX11871)                     += platform_max11871.o
+ifdef CONFIG_BATTERY_MAX17042
+obj-$(CONFIG_BATTERY_MAX17042)                         += platform_max17042.o
+else
+obj-$(CONFIG_BATTERY_MAX17050)                         += platform_max17042.o
+endif
+obj-$(CONFIG_CHARGER_BQ24192)                          += platform_bq24192.o
+obj-$(CONFIG_GPIO_PCA953X)                             += platform_max7315.o
+obj-$(CONFIG_SENSORS_MPU3050)                          += platform_mpu3050.o
+obj-$(CONFIG_SENSORS_MS5607)                           += platform_ms5607.o
+obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT224)                 += platform_mxt224.o
+obj-$(subst m,y,$(CONFIG_TOUCHSCREEN_ATMEL_MXT))       += platform_mxt_ts.o
+ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C
+obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C)           += platform_s3202.o
+else
+obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4)           += platform_s3202.o
+endif
+obj-$(CONFIG_PN544_NFC)                                        += platform_pn544.o
+obj-$(CONFIG_GPIO_PCA953X)                             += platform_tca6416.o
+obj-$(CONFIG_SENSORS_LIS3LV02D)                                += platform_lis331.o
+obj-$(CONFIG_CHARGER_SMB347)                           += platform_smb347.o
+# Camera
+obj-$(subst m,y,$(CONFIG_VIDEO_ATOMISP))               += platform_camera.o
+ifdef CONFIG_VIDEO_ATOMISP
+obj-$(subst m,y,$(CONFIG_VIDEO_MT9E013))               += platform_mt9e013.o
+obj-$(subst m,y,$(CONFIG_VIDEO_MT9M114))               += platform_mt9m114.o
+obj-$(subst m,y,$(CONFIG_VIDEO_OV8830))                        += platform_ov8830.o
+obj-$(subst m,y,$(CONFIG_VIDEO_LM3554))                        += platform_lm3554.o
+endif
+# SPI Devices
+obj-$(CONFIG_SERIAL_MRST_MAX3110)                      += platform_max3111.o
+# HSI Devices
+obj-$(CONFIG_HSI_ARASAN)                               += platform_hsi_modem.o
+# Bluetooth
+obj-$(subst m,y,$(CONFIG_TI_ST))                       += platform_btwilink.o
+# WIFI
+obj-$(CONFIG_WL12XX_PLATFORM_DATA)                     += platform_wl12xx.o
+# MISC Devices
+obj-$(CONFIG_KEYBOARD_GPIO)                            += platform_gpio_keys.o
+obj-$(CONFIG_SWITCH_MID)                               += platform_switch_mid.o
+obj-$(CONFIG_I2C_GPIO)                                 += platform_i2c_gpio.o
+obj-$(CONFIG_SUPPORT_TOSHIBA_MIPI_LVDS_BRIDGE)         += platform_tc35876x.o
+obj-$(CONFIG_USB_PENWELL_OTG)                          += platform_usb_otg.o
+obj-$(CONFIG_SERIAL_MFD_HSU)                           += platform_hsu.o
+obj-$(CONFIG_LEDS_INTEL_KPD_GPIO)                      += platform_kpd_led_gpio.o
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_a1026.c b/arch/x86/platform/intel-mid/device_libs/platform_a1026.c
new file mode 100644 (file)
index 0000000..374600c
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * platform_a1026.c: a1026 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/a1026.h>
+#include <asm/intel-mid.h>
+#include "platform_a1026.h"
+
+static int audience_request_resources(struct i2c_client *client)
+{
+       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
+               client->dev.platform_data;
+       int ret;
+
+       pr_debug("Audience: request ressource audience\n");
+       if (!pdata)
+               return -1;
+       ret = gpio_request(pdata->gpio_a1026_wakeup, AUDIENCE_WAKEUP_GPIO);
+       if (ret) {
+               dev_err(&client->dev, "Request AUDIENCE WAKEUP GPIO %d fails %d\n",
+                       pdata->gpio_a1026_wakeup, ret);
+               return -1;
+       }
+       ret = gpio_direction_output(pdata->gpio_a1026_wakeup, 0);
+       if (ret) {
+               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
+               goto err_wake;
+       }
+
+       ret = gpio_request(pdata->gpio_a1026_reset, AUDIENCE_RESET_GPIO);
+       if (ret) {
+               dev_err(&client->dev,
+                               "Request for Audience reset GPIO %d fails %d\n",
+                                       pdata->gpio_a1026_reset, ret);
+               goto err_wake;
+       }
+       ret = gpio_direction_output(pdata->gpio_a1026_reset, 0);
+       if (ret) {
+               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
+               goto err_reset;
+       }
+       sprintf(pdata->firmware_name, "%s", "vpimg_es305b.bin");
+
+       return 0;
+err_reset:
+       gpio_free(pdata->gpio_a1026_reset);
+err_wake:
+       gpio_free(pdata->gpio_a1026_wakeup);
+       return -1;
+}
+
+static void audience_free_resources(struct i2c_client *client)
+{
+       struct a1026_platform_data *pdata = (struct a1026_platform_data *)
+               &client->dev.platform_data;
+
+       gpio_free(pdata->gpio_a1026_wakeup);
+       gpio_free(pdata->gpio_a1026_reset);
+}
+
+static void audience_wake_up(bool state)
+{
+       int wakeup_gpio;
+
+       wakeup_gpio = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
+       if (wakeup_gpio == -1) {
+               pr_err("%s invalid wakeup gpio", __func__);
+               return;
+       }
+       gpio_set_value(wakeup_gpio, state);
+       pr_debug("Audience: WAKE UP %d\n", state);
+}
+
+static void audience_reset(bool state)
+{
+       int reset_gpio;
+
+       reset_gpio = get_gpio_by_name(AUDIENCE_RESET_GPIO);
+       if (reset_gpio == -1) {
+               pr_err("%s invalid reset gpio", __func__);
+               return;
+       }
+       gpio_set_value(reset_gpio, state);
+       pr_debug("Audience: RESET %d\n", state);
+}
+
+void *audience_platform_data(void *info)
+{
+       static struct a1026_platform_data pdata;
+
+       pdata.gpio_a1026_wakeup = get_gpio_by_name(AUDIENCE_WAKEUP_GPIO);
+       pdata.gpio_a1026_reset = get_gpio_by_name(AUDIENCE_RESET_GPIO);
+       pdata.request_resources = audience_request_resources;
+       pdata.free_resources    = audience_free_resources;
+       pdata.wakeup                    = audience_wake_up;
+       pdata.reset                     = audience_reset;
+
+       return &pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_a1026.h b/arch/x86/platform/intel-mid/device_libs/platform_a1026.h
new file mode 100644 (file)
index 0000000..f01f880
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * platform_a1026.h: cyttsp platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_A1026_H_
+#define _PLATFORM_A1026_H_
+
+#define AUDIENCE_WAKEUP_GPIO               "audience-wakeup"
+#define AUDIENCE_RESET_GPIO                 "audience-reset"
+extern void *audience_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_apds990x.c b/arch/x86/platform/intel-mid/device_libs/platform_apds990x.c
new file mode 100644 (file)
index 0000000..e8af753
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * platform_apds990x.c: apds990x platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/i2c/apds990x.h>
+#include <asm/intel-mid.h>
+#include "platform_apds990x.h"
+
+void *apds990x_platform_data(void *info)
+{
+       static struct apds990x_platform_data platform_data = {
+               .pdrive = 0,
+               .ppcount = 1,
+       };
+       platform_data.gpio_number = get_gpio_by_name("AL-intr");
+
+       return &platform_data;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_apds990x.h b/arch/x86/platform/intel-mid/device_libs/platform_apds990x.h
new file mode 100644 (file)
index 0000000..be5540a
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_apds990x.h: apds990x platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_APDS990X_H_
+#define _PLATFORM_APDS990X_H_
+
+extern void *apds990x_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_bq24192.c b/arch/x86/platform/intel-mid/device_libs/platform_bq24192.c
new file mode 100644 (file)
index 0000000..36a864f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * platform_bq24192.c: bq24192 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/power/bq24192_charger.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_bq24192.h"
+
+void *bq24192_platform_data(void *info)
+{
+       static struct bq24192_platform_data platform_data;
+
+       platform_data.slave_mode = 0;
+       return &platform_data;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_bq24192.h b/arch/x86/platform/intel-mid/device_libs/platform_bq24192.h
new file mode 100644 (file)
index 0000000..dd5a7ba
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_bq24192.h: bq24192 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_BQ24192_H_
+#define _PLATFORM_BQ24192_H_
+
+extern void *bq24192_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_btwilink.c b/arch/x86/platform/intel-mid/device_libs/platform_btwilink.c
new file mode 100644 (file)
index 0000000..3a91cb4
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * platform_btwilink.c: btwilink platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/skbuff.h>
+#include <linux/lnw_gpio.h>
+#include <linux/ti_wilink_st.h>
+#include <asm/intel-mid.h>
+#include "platform_btwilink.h"
+
+/* KIM related */
+static int kim_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       return 0;
+}
+static int kim_resume(struct platform_device *pdev)
+{
+       return 0;
+}
+
+static struct ti_st_plat_data kim_pdata = {
+       .nshutdown_gpio = -1,/* BT, FM, GPS gpios */
+       .flow_cntrl     = 1,            /* flow control flag */
+       .suspend        = kim_suspend,
+       .resume         = kim_resume,
+};
+
+static struct platform_device linux_kim_device = {
+       .name           = "kim", /* named after init manager for ST */
+       .id             = -1,
+       .dev.platform_data = &kim_pdata,
+};
+
+/* BT WILINK related */
+static int bt_enable(void)
+{
+       return 0;
+}
+static int bt_disable(void)
+{
+       return 0;
+}
+
+static struct ti_st_plat_data bt_pdata = {
+       .chip_enable    = bt_enable,
+       .chip_disable   = bt_disable,
+};
+
+static struct platform_device linux_bt_device = {
+       .name           = "btwilink", /* named after init manager for ST */
+       .id             = -1,
+       .dev.platform_data = &bt_pdata,
+};
+static int __init bluetooth_init(void)
+{
+       unsigned int UART_index;
+       long unsigned int UART_baud_rate;
+       int error_reg;
+
+       /* KIM INIT */
+       /* Get the GPIO number from the SFI table
+          if FM gpio is not provided then BT-reset line is
+          also used to enable FM
+       */
+       kim_pdata.nshutdown_gpio = get_gpio_by_name("BT-reset");
+       if (kim_pdata.nshutdown_gpio == -1)
+               return -ENODEV;
+
+       /* Get Share Transport uart settings */
+       /* TODO : add SFI table parsing and one SFI entry for this settings */
+       UART_index = UART_PORT_INDEX;
+       UART_baud_rate = UART_BAUD_RATE;
+       /* Share Transport uart settings */
+       sprintf((char *)kim_pdata.dev_name, "/dev/ttyMFD%u", UART_index);
+       kim_pdata.baud_rate = UART_baud_rate;
+
+       pr_info("%s: Setting platform_data with UART device name:%s and "
+                       "UART baud rate:%lu.\n",
+                       __func__, kim_pdata.dev_name, kim_pdata.baud_rate);
+
+       error_reg = platform_device_register(&linux_kim_device);
+       if (error_reg < 0) {
+               pr_err("platform_device_register for kim failed\n");
+               goto exit_on_error;
+       }
+
+       /* BT WILINK INIT */
+       error_reg = platform_device_register(&linux_bt_device);
+       if (error_reg < 0)
+               pr_err("platform_device_register for btwilink failed\n");
+exit_on_error:
+       return error_reg;
+
+}
+device_initcall(bluetooth_init);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_btwilink.h b/arch/x86/platform/intel-mid/device_libs/platform_btwilink.h
new file mode 100644 (file)
index 0000000..19d6612
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_btwilink.h: btwilink platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_BTWILINK_H_
+#define _PLATFORM_BTWILINK_H_
+
+#define        UART_PORT_INDEX 0
+#define        UART_BAUD_RATE  3500000
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_camera.c b/arch/x86/platform/intel-mid/device_libs/platform_camera.c
new file mode 100644 (file)
index 0000000..0bb10ff
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * platform_camera.c: Camera platform library file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <linux/atomisp_platform.h>
+#include <media/v4l2-subdev.h>
+#include <asm/intel-mid.h>
+#include "platform_camera.h"
+
+/*
+ * One-time gpio initialization.
+ * @name: gpio name: coded in SFI table
+ * @gpio: gpio pin number (bypass @name)
+ * @dir: GPIOF_DIR_IN or GPIOF_DIR_OUT
+ * @value: if dir = GPIOF_DIR_OUT, this is the init value for output pin
+ * if dir = GPIOF_DIR_IN, this argument is ignored
+ * return: a positive pin number if succeeds, otherwise a negative value
+ */
+int camera_sensor_gpio(int gpio, char *name, int dir, int value)
+{
+       int ret, pin;
+
+       if (gpio == -1) {
+               pin = get_gpio_by_name(name);
+               if (pin == -1) {
+                       pr_err("%s: failed to get gpio(name: %s)\n",
+                                               __func__, name);
+                       return -EINVAL;
+               }
+       } else {
+               pin = gpio;
+       }
+
+       ret = gpio_request(pin, name);
+       if (ret) {
+               pr_err("%s: failed to request gpio(pin %d)\n", __func__, pin);
+               return -EINVAL;
+       }
+
+       if (dir == GPIOF_DIR_OUT)
+               ret = gpio_direction_output(pin, value);
+       else
+               ret = gpio_direction_input(pin);
+
+       if (ret) {
+               pr_err("%s: failed to set gpio(pin %d) direction\n",
+                                                       __func__, pin);
+               gpio_free(pin);
+       }
+
+       return ret ? ret : pin;
+}
+
+/*
+ * Configure MIPI CSI physical parameters.
+ * @port: ATOMISP_CAMERA_PORT_PRIMARY or ATOMISP_CAMERA_PORT_SECONDARY
+ * @lanes: for ATOMISP_CAMERA_PORT_PRIMARY, there could be 2 or 4 lanes
+ * for ATOMISP_CAMERA_PORT_SECONDARY, there is only one lane.
+ * @format: MIPI CSI pixel format, see include/linux/atomisp_platform.h
+ * @bayer_order: MIPI CSI bayer order, see include/linux/atomisp_platform.h
+ */
+int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
+                       u32 lanes, u32 format, u32 bayer_order, int flag)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       struct camera_mipi_info *csi = NULL;
+
+       if (flag) {
+               csi = kzalloc(sizeof(*csi), GFP_KERNEL);
+               if (!csi) {
+                       dev_err(&client->dev, "out of memory\n");
+                       return -ENOMEM;
+               }
+               csi->port = port;
+               csi->num_lanes = lanes;
+               csi->input_format = format;
+               csi->raw_bayer_order = bayer_order;
+               v4l2_set_subdev_hostdata(sd, (void *)csi);
+       } else {
+               csi = v4l2_get_subdev_hostdata(sd);
+               kfree(csi);
+       }
+
+       return 0;
+}
+static int no_v4l2_dev_ids(void)
+{
+       const struct intel_v4l2_subdev_id *v4l2_ids_ptr = v4l2_ids;
+       int no_v4l2_ids = 0;
+
+       while (v4l2_ids_ptr->name[0]) {
+               no_v4l2_ids++;
+               v4l2_ids_ptr++;
+       }
+
+       return no_v4l2_ids;
+}
+static const struct intel_v4l2_subdev_id *get_v4l2_ids(int *n_subdev)
+{
+       if (n_subdev && v4l2_ids)
+               *n_subdev = no_v4l2_dev_ids();
+       return v4l2_ids;
+}
+
+static struct atomisp_platform_data *v4l2_subdev_table_head;
+
+void intel_ignore_i2c_device_register(struct sfi_device_table_entry *pentry,
+                                       struct devs_id *dev)
+{
+       struct i2c_board_info i2c_info;
+       struct i2c_board_info *idev = &i2c_info;
+       int bus = pentry->host_num;
+       void *pdata = NULL;
+       int n_subdev;
+       const struct intel_v4l2_subdev_id *vdev = get_v4l2_ids(&n_subdev);
+       struct intel_v4l2_subdev_i2c_board_info *info;
+       static struct intel_v4l2_subdev_table *subdev_table;
+       enum intel_v4l2_subdev_type type = 0;
+       enum atomisp_camera_port port;
+       static int i;
+
+       if (vdev == NULL) {
+               pr_info("ERROR: camera vdev list is NULL\n");
+               return;
+       }
+
+       memset(&i2c_info, 0, sizeof(i2c_info));
+       strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
+       i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
+       i2c_info.addr = pentry->addr;
+       pr_info("I2C bus = %d, name = %16.16s, "
+               "irq = 0x%2x, addr = 0x%x\n",
+               pentry->host_num,
+               i2c_info.type,
+               i2c_info.irq,
+               i2c_info.addr);
+       pdata = dev->get_platform_data(&i2c_info);
+       i2c_info.platform_data = pdata;
+
+
+       while (vdev->name[0]) {
+               if (!strncmp(vdev->name, idev->type, 16)) {
+                       /* compare name */
+                       type = vdev->type;
+                       port = vdev->port;
+                       break;
+               }
+               vdev++;
+       }
+
+       if (!type) /* not found */
+               return;
+
+       info = kzalloc(sizeof(struct intel_v4l2_subdev_i2c_board_info),
+                      GFP_KERNEL);
+       if (!info) {
+               pr_err("MRST: fail to alloc mem for ignored i2c dev %s\n",
+                      idev->type);
+               return;
+       }
+
+       info->i2c_adapter_id = bus;
+       /* set platform data */
+       memcpy(&info->board_info, idev, sizeof(*idev));
+
+       if (v4l2_subdev_table_head == NULL) {
+               subdev_table = kzalloc(sizeof(struct intel_v4l2_subdev_table)
+                       * n_subdev, GFP_KERNEL);
+
+               if (!subdev_table) {
+                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
+                              idev->type);
+                       kfree(info);
+                       return;
+               }
+
+               v4l2_subdev_table_head = kzalloc(
+                       sizeof(struct atomisp_platform_data), GFP_KERNEL);
+               if (!v4l2_subdev_table_head) {
+                       pr_err("MRST: fail to alloc mem for v4l2_subdev_table %s\n",
+                              idev->type);
+                       kfree(info);
+                       kfree(subdev_table);
+                       return;
+               }
+               v4l2_subdev_table_head->subdevs = subdev_table;
+       }
+
+       memcpy(&subdev_table[i].v4l2_subdev, info, sizeof(*info));
+       subdev_table[i].type = type;
+       subdev_table[i].port = port;
+       i++;
+       kfree(info);
+       return;
+}
+
+const struct atomisp_platform_data *intel_get_v4l2_subdev_table(void)
+{
+       if (v4l2_subdev_table_head)
+               return v4l2_subdev_table_head;
+       else {
+               pr_err("MRST: no camera device in the SFI table\n");
+               return NULL;
+       }
+}
+EXPORT_SYMBOL_GPL(intel_get_v4l2_subdev_table);
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_camera.h b/arch/x86/platform/intel-mid/device_libs/platform_camera.h
new file mode 100644 (file)
index 0000000..fbcac13
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * platform_camera.h: CAMERA platform library header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_CAMERA_H_
+#define _PLATFORM_CAMERA_H_
+
+#include <linux/atomisp_platform.h>
+
+extern const struct intel_v4l2_subdev_id v4l2_ids[] __attribute__((weak));
+
+/* MFLD iCDK camera sensor GPIOs */
+
+#define GP_CAMERA_0_POWER_DOWN          "cam0_vcm_2p8"
+#define GP_CAMERA_1_POWER_DOWN          "camera_1_power"
+#define GP_CAMERA_0_RESET               "camera_0_reset"
+#define GP_CAMERA_1_RESET               "camera_1_reset"
+
+extern int camera_sensor_gpio(int gpio, char *name, int dir, int value);
+extern int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
+                       u32 lanes, u32 format, u32 bayer_order, int flag);
+extern void intel_ignore_i2c_device_register(
+                               struct sfi_device_table_entry *pentry,
+                               struct devs_id *dev
+                               ) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_clvs_audio.c b/arch/x86/platform/intel-mid/device_libs/platform_clvs_audio.c
new file mode 100644 (file)
index 0000000..50266db
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * platform_clvs_audio.c: CLVS audio platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/init.h>
+#include <linux/sfi.h>
+#include <linux/platform_device.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+#include "platform_clvs_audio.h"
+
+void *clvs_audio_platform_data(void *info)
+{
+       struct platform_device *pdev;
+       int ret;
+
+       pdev = platform_device_alloc("sst-platform", -1);
+       if (!pdev) {
+               pr_err("failed to allocate audio platform device\n");
+               return NULL;
+       }
+
+       ret = platform_device_add(pdev);
+       if (ret) {
+               pr_err("failed to add audio platform device\n");
+               platform_device_put(pdev);
+               return NULL;
+       }
+
+       pdev = platform_device_alloc("intel_mid_vibra", -1);
+       if (!pdev) {
+               pr_err("failed to allocate audio vibra device\n");
+               return NULL;
+       }
+
+       ret = platform_device_add(pdev);
+       if (ret) {
+               pr_err("failed to add audio vibra device\n");
+               platform_device_put(pdev);
+               return NULL;
+       }
+
+       pdev = platform_device_alloc("hdmi-audio", -1);
+       if (!pdev) {
+               pr_err("failed to allocate hdmi-audio platform device\n");
+               return NULL;
+       }
+
+       ret = platform_device_add(pdev);
+       if (ret) {
+               pr_err("failed to add hdmi-audio platform device\n");
+               platform_device_put(pdev);
+               return NULL;
+       }
+
+       return NULL;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_clvs_audio.h b/arch/x86/platform/intel-mid/device_libs/platform_clvs_audio.h
new file mode 100644 (file)
index 0000000..3130f03
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_clvs_audio.h: CLVS audio platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_CLVS_AUDIO_H_
+#define _PLATFORM_CLVS_AUDIO_H_
+
+extern void __init *clvs_audio_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_cyttsp.c b/arch/x86/platform/intel-mid/device_libs/platform_cyttsp.c
new file mode 100644 (file)
index 0000000..c9f04d0
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * platform_cyttsp.c: cyttsp platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/cyttsp.h>
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_cyttsp.h"
+
+static int cyttsp_init(int on)
+{
+       int ret;
+
+       if (on) {
+               ret = gpio_request(CYTTSP_GPIO_PIN, "cyttsp_irq");
+               if (ret < 0) {
+                       pr_err("%s: gpio request failed\n", __func__);
+                       return ret;
+               }
+
+               ret = gpio_direction_input(CYTTSP_GPIO_PIN);
+               if (ret < 0) {
+                       pr_err("%s: gpio direction config failed\n", __func__);
+                       gpio_free(CYTTSP_GPIO_PIN);
+                       return ret;
+               }
+       } else {
+               gpio_free(CYTTSP_GPIO_PIN);
+       }
+       return 0;
+}
+
+void *cyttsp_platform_data(void *info)
+{
+       static struct cyttsp_platform_data cyttsp_pdata = {
+               .init = cyttsp_init,
+               .mt_sync = input_mt_sync,
+               .maxx = 479,
+               .maxy = 853,
+               .flags = 0,
+               .gen = CY_GEN3,
+               .use_st = 0,
+               .use_mt = 1,
+               .use_trk_id = 0,
+               .use_hndshk = 1,
+               .use_timer = 0,
+               .use_sleep = 1,
+               .use_gestures = 0,
+               .act_intrvl = CY_ACT_INTRVL_DFLT,
+               .tch_tmout = CY_TCH_TMOUT_DFLT,
+               .lp_intrvl = CY_LP_INTRVL_DFLT / 2,
+               .name = CY_I2C_NAME,
+               .irq_gpio = CYTTSP_GPIO_PIN,
+       };
+
+       return &cyttsp_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_cyttsp.h b/arch/x86/platform/intel-mid/device_libs/platform_cyttsp.h
new file mode 100644 (file)
index 0000000..4bc4f62
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_cyttsp.h: cyttsp platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_CYTTSP_H_
+#define _PLATFORM_CYTTSP_H_
+
+#define CYTTSP_GPIO_PIN 0x3E
+extern void *cyttsp_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ektf2136.c b/arch/x86/platform/intel-mid/device_libs/platform_ektf2136.c
new file mode 100644 (file)
index 0000000..962122c
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * platform_ektf2136.c: ektf2136 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/spi/spi.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_ektf2136.h"
+
+
+void *ektf2136_platform_data(void *info)
+{
+       static int dummy;
+       struct spi_board_info *spi_info = info;
+       int intr = get_gpio_by_name("ts_int");
+
+       if (intr == -1)
+               return NULL;
+       spi_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+
+       /* we return a dummy pdata */
+       return &dummy;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ektf2136.h b/arch/x86/platform/intel-mid/device_libs/platform_ektf2136.h
new file mode 100644 (file)
index 0000000..123b66f
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_ektf2136.h: ektf2136 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_EKTF2136_H_
+#define _PLATFORM_EKTF2136_H_
+
+extern void *ektf2136_platform_data(void *info) __attribute__((weak));
+
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c b/arch/x86/platform/intel-mid/device_libs/platform_emc1403.c
new file mode 100644 (file)
index 0000000..12ebdee
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * platform_emc1403.c: emc1403 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_emc1403.h"
+
+void __init *emc1403_platform_data(void *info)
+{
+       static short intr2nd_pdata;
+       struct i2c_board_info *i2c_info = info;
+       int intr = get_gpio_by_name("thermal_int");
+       int intr2nd = get_gpio_by_name("thermal_alert");
+
+       if (intr == -1 || intr2nd == -1)
+               return NULL;
+
+       i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+       intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET;
+
+       return &intr2nd_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_emc1403.h b/arch/x86/platform/intel-mid/device_libs/platform_emc1403.h
new file mode 100644 (file)
index 0000000..0229438
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_emc1403.h: emc1403 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_EMC1403_H_
+#define _PLATFORM_EMC1403_H_
+
+extern void __init *emc1403_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
new file mode 100644 (file)
index 0000000..2c9a2f0
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * platform_gpio_keys.c: gpio_keys platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/input.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/platform_device.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_gpio_keys.h"
+
+/*
+ * we will search these buttons in SFI GPIO table (by name)
+ * and register them dynamically. Please add all possible
+ * buttons here, we will shrink them if no GPIO found.
+ */
+static struct gpio_keys_button gpio_button[] = {
+       {KEY_POWER,             -1, 1, "power_btn",     EV_KEY, 0, 3000},
+       {KEY_PROG1,             -1, 1, "prog_btn1",     EV_KEY, 0, 20},
+       {KEY_PROG2,             -1, 1, "prog_btn2",     EV_KEY, 0, 20},
+       {SW_LID,                -1, 1, "lid_switch",    EV_SW,  0, 20},
+       {KEY_VOLUMEUP,          -1, 1, "vol_up",        EV_KEY, 0, 20},
+       {KEY_VOLUMEDOWN,        -1, 1, "vol_down",      EV_KEY, 0, 20},
+       {KEY_CAMERA,            -1, 1, "camera_full",   EV_KEY, 0, 20},
+       {KEY_CAMERA_FOCUS,      -1, 1, "camera_half",   EV_KEY, 0, 20},
+       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw1",        EV_SW,  0, 20},
+       {SW_KEYPAD_SLIDE,       -1, 1, "MagSw2",        EV_SW,  0, 20},
+       {KEY_CAMERA,            -1, 1, "cam_capture",   EV_KEY, 0, 20},
+       {KEY_CAMERA_FOCUS,      -1, 1, "cam_focus",     EV_KEY, 0, 20},
+};
+
+static struct gpio_keys_platform_data gpio_keys = {
+       .buttons        = gpio_button,
+       .rep            = 1,
+       .nbuttons       = -1, /* will fill it after search */
+};
+
+static struct platform_device pb_device = {
+       .name           = DEVICE_NAME,
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &gpio_keys,
+       },
+};
+
+/*
+ * Shrink the non-existent buttons, register the gpio button
+ * device if there is some
+ */
+static int __init pb_keys_init(void)
+{
+       struct gpio_keys_button *gb = gpio_button;
+       int i, num, good = 0;
+
+       num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
+       for (i = 0; i < num; i++) {
+               gb[i].gpio = get_gpio_by_name(gb[i].desc);
+               if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_CLOVERVIEW &&
+                        (!strcmp(gb[i].desc, "vol_up")))
+                       gb[i].gpio = 30;
+               if (gb[i].gpio == -1)
+                       continue;
+
+               if (i != good)
+                       gb[good] = gb[i];
+               good++;
+       }
+
+       if (good) {
+               gpio_keys.nbuttons = good;
+               return platform_device_register(&pb_device);
+       }
+       return 0;
+}
+late_initcall(pb_keys_init);
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.h b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.h
new file mode 100644 (file)
index 0000000..5095329
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_gpio_keys.h: gpio_keys platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_GPIO_KEYS_H_
+#define _PLATFORM_GPIO_KEYS_H_
+
+#define DEVICE_NAME "gpio-keys"
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_hmc5883.c b/arch/x86/platform/intel-mid/device_libs/platform_hmc5883.c
new file mode 100644 (file)
index 0000000..eb120ef
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * platform_hmc5883.c: hmc5883 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_hmc5883.h"
+
+void *hmc5883_platform_data(void *info)
+{
+       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+
+       i2c_info->irq = 0xff;
+       return NULL;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_hmc5883.h b/arch/x86/platform/intel-mid/device_libs/platform_hmc5883.h
new file mode 100644 (file)
index 0000000..b8bb204
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_hmc5883.h: hmc5883 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_HMC5883_H_
+#define _PLATFORM_HMC5883_H_
+
+extern void *hmc5883_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_hsi_modem.c b/arch/x86/platform/intel-mid/device_libs/platform_hsi_modem.c
new file mode 100644 (file)
index 0000000..7dde630
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * platform_hsi.c: hsi platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/hsi/hsi.h>
+#include <linux/hsi/intel_mid_hsi.h>
+#include <asm/intel-mid.h>
+#include "platform_hsi_modem.h"
+
+void *hsi_modem_platform_data(void *data)
+{
+       int rst_out = get_gpio_by_name("ifx_mdm_rst_out");
+       int pwr_on = get_gpio_by_name("ifx_mdm_pwr_on");
+       int rst_pmu = get_gpio_by_name("ifx_mdm_rst_pmu");
+       int fcdp_rb = get_gpio_by_name("modem-gpio2");
+
+       static const char hsi_char_name[]       = "hsi_char";
+#if defined(CONFIG_HSI_FFL_TTY)
+       static const char hsi_ffl_name[]        = "hsi-ffl";
+#elif defined(CONFIG_HSI_DLP)
+       static const char hsi_dlp_name[]        = "hsi-dlp";
+#endif
+
+#if ((defined CONFIG_HSI_FFL_TTY) && (defined CONFIG_HSI_DLP))
+#error "Only define one of HSI_FFL_TTY or HSI_DLP"
+#elif (defined(CONFIG_HSI_FFL_TTY) || defined(CONFIG_HSI_DLP))
+#define HSI_CLIENT_CNT 2
+#else
+#define HSI_CLIENT_CNT 1
+#endif
+
+       static struct hsi_board_info hsi_info[HSI_CLIENT_CNT] = {
+               [0] = {
+                       .name = hsi_char_name,
+                       .hsi_id = 0,
+                       .port = 0,
+                       .archdata = NULL,
+                       .tx_cfg.speed = 200000, /* tx clock, kHz */
+                       .tx_cfg.channels = 8,
+                       .tx_cfg.mode = HSI_MODE_FRAME,
+                       .tx_cfg.arb_mode = HSI_ARB_RR,
+                       .rx_cfg.flow = HSI_FLOW_SYNC,
+                       .rx_cfg.mode = HSI_MODE_FRAME,
+                       .rx_cfg.channels = 8
+               },
+#if defined(CONFIG_HSI_FFL_TTY)
+               [1] = {
+                       .name = hsi_ffl_name,
+                       .hsi_id = 0,
+                       .port = 0,
+                       .archdata = NULL,
+                       .tx_cfg.speed = 100000, /* tx clock, kHz */
+                       .tx_cfg.channels = 8,
+                       .tx_cfg.mode = HSI_MODE_FRAME,
+                       .tx_cfg.arb_mode = HSI_ARB_RR,
+                       .rx_cfg.flow = HSI_FLOW_SYNC,
+                       .rx_cfg.mode = HSI_MODE_FRAME,
+                       .rx_cfg.channels = 8
+               }
+#elif defined(CONFIG_HSI_DLP)
+               [1] = {
+                       .name = hsi_dlp_name,
+                       .hsi_id = 0,
+                       .port = 0,
+                       .archdata = NULL,
+                       .tx_cfg.speed = 100000, /* tx clock, kHz */
+                       .tx_cfg.channels = 8,
+                       .tx_cfg.mode = HSI_MODE_FRAME,
+                       .tx_cfg.arb_mode = HSI_ARB_RR,
+                       .rx_cfg.flow = HSI_FLOW_SYNC,
+                       .rx_cfg.mode = HSI_MODE_FRAME,
+                       .rx_cfg.channels = 8
+               }
+#endif
+       };
+
+#if defined(CONFIG_HSI_FFL_TTY)
+       static struct hsi_mid_platform_data mid_info = {
+               .tx_dma_channels[0] = -1,
+               .tx_dma_channels[1] = 5,
+               .tx_dma_channels[2] = -1,
+               .tx_dma_channels[3] = -1,
+               .tx_dma_channels[4] = -1,
+               .tx_dma_channels[5] = -1,
+               .tx_dma_channels[6] = -1,
+               .tx_dma_channels[7] = -1,
+               .tx_sg_entries[0] = 1,
+               .tx_sg_entries[1] = 1,
+               .tx_sg_entries[2] = 1,
+               .tx_sg_entries[3] = 1,
+               .tx_sg_entries[4] = 1,
+               .tx_sg_entries[5] = 1,
+               .tx_sg_entries[6] = 1,
+               .tx_sg_entries[7] = 1,
+               .tx_fifo_sizes[0] = -1,
+               .tx_fifo_sizes[1] = 1024,
+               .tx_fifo_sizes[2] = -1,
+               .tx_fifo_sizes[3] = -1,
+               .tx_fifo_sizes[4] = -1,
+               .tx_fifo_sizes[5] = -1,
+               .tx_fifo_sizes[6] = -1,
+               .tx_fifo_sizes[7] = -1,
+               .rx_dma_channels[0] = -1,
+               .rx_dma_channels[1] = 1,
+               .rx_dma_channels[2] = -1,
+               .rx_dma_channels[3] = -1,
+               .rx_dma_channels[4] = -1,
+               .rx_dma_channels[5] = -1,
+               .rx_dma_channels[6] = -1,
+               .rx_dma_channels[7] = -1,
+               .rx_sg_entries[0] = 1,
+               .rx_sg_entries[1] = 1,
+               .rx_sg_entries[2] = 1,
+               .rx_sg_entries[3] = 1,
+               .rx_sg_entries[4] = 1,
+               .rx_sg_entries[5] = 1,
+               .rx_sg_entries[6] = 1,
+               .rx_sg_entries[7] = 1,
+               .rx_fifo_sizes[0] = -1,
+               .rx_fifo_sizes[1] = 1024,
+               .rx_fifo_sizes[2] = -1,
+               .rx_fifo_sizes[3] = -1,
+               .rx_fifo_sizes[4] = -1,
+               .rx_fifo_sizes[5] = -1,
+               .rx_fifo_sizes[6] = -1,
+               .rx_fifo_sizes[7] = -1,
+       };
+
+#elif defined(CONFIG_HSI_DLP)
+       static struct hsi_mid_platform_data mid_info = {
+               .tx_dma_channels[0] = -1,
+               .tx_dma_channels[1] = 0,
+               .tx_dma_channels[2] = 1,
+               .tx_dma_channels[3] = 2,
+               .tx_dma_channels[4] = 3,
+               .tx_dma_channels[5] = -1,
+               .tx_dma_channels[6] = -1,
+               .tx_dma_channels[7] = -1,
+               .tx_sg_entries[0] = 1,
+               .tx_sg_entries[1] = 1,
+               .tx_sg_entries[2] = 64,
+               .tx_sg_entries[3] = 64,
+               .tx_sg_entries[4] = 64,
+               .tx_sg_entries[5] = 1,
+               .tx_sg_entries[6] = 1,
+               .tx_sg_entries[7] = 1,
+               .tx_fifo_sizes[0] = 128,
+               .tx_fifo_sizes[1] = 128,
+               .tx_fifo_sizes[2] = 256,
+               .tx_fifo_sizes[3] = 256,
+               .tx_fifo_sizes[4] = 256,
+               .tx_fifo_sizes[5] = -1,
+               .tx_fifo_sizes[6] = -1,
+               .tx_fifo_sizes[7] = -1,
+               .rx_dma_channels[0] = -1,
+               .rx_dma_channels[1] = 4,
+               .rx_dma_channels[2] = 5,
+               .rx_dma_channels[3] = 6,
+               .rx_dma_channels[4] = 7,
+               .rx_dma_channels[5] = -1,
+               .rx_dma_channels[6] = -1,
+               .rx_dma_channels[7] = -1,
+               .rx_sg_entries[0] = 1,
+               .rx_sg_entries[1] = 1,
+               .rx_sg_entries[2] = 1,
+               .rx_sg_entries[3] = 1,
+               .rx_sg_entries[4] = 1,
+               .rx_sg_entries[5] = 1,
+               .rx_sg_entries[6] = 1,
+               .rx_sg_entries[7] = 1,
+               .rx_fifo_sizes[0] = 128,
+               .rx_fifo_sizes[1] = 128,
+               .rx_fifo_sizes[2] = 256,
+               .rx_fifo_sizes[3] = 256,
+               .rx_fifo_sizes[4] = 256,
+               .rx_fifo_sizes[5] = -1,
+               .rx_fifo_sizes[6] = -1,
+               .rx_fifo_sizes[7] = -1,
+       };
+#endif
+       printk(KERN_INFO "HSI platform data setup\n");
+
+       printk(KERN_INFO "HSI mdm GPIOs rst_out:%d,"
+                       " pwr_on:%d, rst_bbn:%d, fcdp_rb:%d\n",
+               rst_out, pwr_on, rst_pmu, fcdp_rb);
+
+       mid_info.gpio_mdm_rst_out = rst_out;
+       mid_info.gpio_mdm_pwr_on = pwr_on;
+       mid_info.gpio_mdm_rst_bbn = rst_pmu;
+       mid_info.gpio_fcdp_rb = fcdp_rb;
+
+       hsi_info[0].platform_data = (void *)&mid_info;
+       hsi_info[1].platform_data = (void *)&mid_info;
+
+       return &hsi_info[0];
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_hsi_modem.h b/arch/x86/platform/intel-mid/device_libs/platform_hsi_modem.h
new file mode 100644 (file)
index 0000000..fddfe69
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_hsi_modem.h: hsi platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_HSI_MODEM_H_
+#define _PLATFORM_HSI_MODEM_H_
+
+extern void *hsi_modem_platform_data(void *data) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_hsu.c b/arch/x86/platform/intel-mid/device_libs/platform_hsu.c
new file mode 100644 (file)
index 0000000..e788a6d
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * platform_hsu.c: hsu platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <asm/intel_mid_hsu.h>
+#include "platform_hsu.h"
+
+/* TODO: put non-ctp platform info here too or in its own device file */
+#ifdef CONFIG_BOARD_CTP
+static struct mfld_hsu_info ctp_hsu_info[] = {
+       [0] = {
+               .id = 0,
+               .name = DEVICE_NAME_0,
+               .wake_gpio = 42,
+               .cts_gpio = 96+28,
+               .cts_alt = 1,
+               .rts_gpio = 96+29,
+               .rts_alt = 1,
+       },
+       [1] = {
+               .id = 1,
+               .name = DEVICE_NAME_1,
+               .wake_gpio = 64,
+               .rx_gpio = 64,
+               .rx_alt = 1,
+               .tx_gpio = 65,
+               .tx_alt = 1,
+               .cts_gpio = 68,
+               .cts_alt = 1,
+               .rts_gpio = 66,
+               .rts_alt = 2,
+       },
+       [2] = {
+               .id = 2,
+               .name = DEVICE_NAME_2,
+               .wake_gpio = 67,
+               .rx_gpio = 67,
+               .rx_alt = 1,
+       },
+       [3] = {
+               .id = 1,
+               .name = DEVICE_NAME_3,
+               .wake_gpio = 96+30,
+               .rx_gpio = 96+30,
+               .rx_alt = 1,
+               .tx_gpio = 96+31,
+               .tx_alt = 1,
+               .cts_gpio = 96+33,
+               .cts_alt = 1,
+               .rts_gpio = 96+32,
+               .rts_alt = 2,
+       },
+
+};
+
+static int __init ctp_hsu_init(void)
+{
+       platform_hsu_info = ctp_hsu_info;
+       return 0;
+}
+device_initcall(ctp_hsu_init);
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_hsu.h b/arch/x86/platform/intel-mid/device_libs/platform_hsu.h
new file mode 100644 (file)
index 0000000..cdd577c
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * platform_hsu.h: hsu platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_HSU_H_
+#define _PLATFORM_HSU_H_
+
+#define DEVICE_NAME_0 "hsu0"
+#define DEVICE_NAME_1 "hsu1"
+#define DEVICE_NAME_2 "hsu2"
+#define DEVICE_NAME_3 "hsu3"
+
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_i2c_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_i2c_gpio.c
new file mode 100644 (file)
index 0000000..0a96605
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * platform_i2c_gpio.c: i2c_gpio platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/input.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/i2c-gpio.h>
+#include <linux/platform_device.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_i2c_gpio.h"
+
+static int hdmi_i2c_workaround(void)
+{
+       int ret;
+       struct platform_device *pdev;
+       struct i2c_gpio_platform_data *pdata;
+
+       /*
+        * Hard code a gpio controller platform device to take over
+        * the two gpio pins used to be controlled by i2c bus 3.
+        * This is to support HDMI EDID extension block read, which
+        * is not supported by the current i2c controller, so we use
+        * GPIO pin the simulate an i2c bus.
+        */
+       pdev = platform_device_alloc(DEVICE_NAME, 8);
+       if (!pdev) {
+               pr_err("i2c-gpio: failed to alloc platform device\n");
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       pdata = kzalloc(sizeof(struct i2c_gpio_platform_data), GFP_KERNEL);
+       if (!pdata) {
+               pr_err("i2c-gpio: failed to alloc platform data\n");
+               kfree(pdev);
+               ret = -ENOMEM;
+               goto out;
+       }
+       pdata->scl_pin = 35 + 96;
+       pdata->sda_pin = 36 + 96;
+       pdata->sda_is_open_drain = 0;
+       pdata->scl_is_open_drain = 0;
+       pdev->dev.platform_data = pdata;
+
+       platform_device_add(pdev);
+
+       lnw_gpio_set_alt(pdata->sda_pin, LNW_GPIO);
+       lnw_gpio_set_alt(pdata->scl_pin, LNW_GPIO);
+
+out:
+       return ret;
+}
+rootfs_initcall(hdmi_i2c_workaround);
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_i2c_gpio.h b/arch/x86/platform/intel-mid/device_libs/platform_i2c_gpio.h
new file mode 100644 (file)
index 0000000..66ddd62
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_i2c_gpio.h: i2c_gpio platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_I2C_GPIO_H_
+#define _PLATFORM_I2C_GPIO_H_
+
+#define DEVICE_NAME "i2c-gpio"
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ipc.c b/arch/x86/platform/intel-mid/device_libs/platform_ipc.c
new file mode 100644 (file)
index 0000000..348475b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * platform_ipc.c: IPC platform library file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/sfi.h>
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/ipc_device.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+
+static struct intel_ipc_dev_res *ipc_dev_res;
+
+static DEFINE_MUTEX(ipc_dev_lock);
+
+/* this should be called with the holding of ipc_dev_lock */
+void handle_ipc_irq_res(int irq, struct intel_ipc_dev_res *ipc_res)
+{
+       struct resource *res = ipc_res->resources;
+
+       if (res->flags & IORESOURCE_IRQ)
+               res->start = irq;
+
+       ipc_dev_res = ipc_res;
+}
+
+
+void ipc_device_handler(struct sfi_device_table_entry *pentry,
+                               struct devs_id *dev)
+{
+       int res_num;
+       struct resource *res;
+       struct ipc_device *ipcdev;
+       void *pdata = NULL;
+
+       pr_info("IPC bus = %d, name = %16.16s, "
+               "irq = 0x%2x\n", pentry->host_num, pentry->name, pentry->irq);
+
+       mutex_lock(&ipc_dev_lock);
+
+       pdata = dev->get_platform_data(pentry);
+
+       ipcdev = ipc_device_alloc(pentry->name, -1);
+       if (ipcdev == NULL) {
+               pr_err("out of memory for SFI platform device '%s'.\n",
+                               pentry->name);
+               return;
+       }
+
+       res = ipc_dev_res->resources;
+       res_num = ipc_dev_res->num_resources;
+       ipc_device_add_resources(ipcdev, res, res_num);
+
+       ipcdev->dev.platform_data = pdata;
+       ipc_device_add_to_list(ipcdev);
+
+       mutex_unlock(&ipc_dev_lock);
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ipc.h b/arch/x86/platform/intel-mid/device_libs/platform_ipc.h
new file mode 100644 (file)
index 0000000..505f025
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * platform_ipc.h: IPC platform library header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_IPC_H_
+#define _PLATFORM_IPC_H_
+
+enum ipc_dev_type {
+       IPC_DEV_PMIC_GPIO,
+       IPC_DEV_PMIC_AUDIO,
+       IPC_DEV_MSIC_ADC,
+       IPC_DEV_MSIC_BATTERY,
+       IPC_DEV_MSIC_GPIO,
+       IPC_DEV_MSIC_AUDIO,
+       IPC_DEV_MSIC_POWER_BTN,
+       IPC_DEV_MSIC_OCD,
+
+       IPC_DEV_NUM,
+};
+
+struct intel_ipc_dev_res {
+       const char *name;
+       int num_resources;
+       struct resource *resources;
+};
+
+extern void ipc_device_handler(struct sfi_device_table_entry *pentry,
+                       struct devs_id *dev) __attribute__((weak));
+
+extern void handle_ipc_irq_res(int irq,
+               struct intel_ipc_dev_res *ipc_res) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_kpd_led.c b/arch/x86/platform/intel-mid/device_libs/platform_kpd_led.c
new file mode 100644 (file)
index 0000000..ba73a39
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * platform_kpd_led.c: kpd_led platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/input.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/lnw_gpio.h>
+#include <linux/ipc_device.h>
+#include <asm/intel-mid.h>
+#include "platform_kpd_led.h"
+
+static int __init intel_kpd_led_init(void)
+{
+       int ret;
+       struct ipc_board_info board_info;
+
+       memset(&board_info, 0, sizeof(board_info));
+       strncpy(board_info.name, DEVICE_NAME, 16);
+       board_info.bus_id = IPC_SCU;
+       board_info.id = -1;
+
+       ret = ipc_new_device(&board_info);
+       if (ret) {
+               pr_err("failed to create ipc device: intel_kpd_led\n");
+               return -1;
+       }
+
+       return 0;
+}
+fs_initcall(intel_kpd_led_init);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_kpd_led.h b/arch/x86/platform/intel-mid/device_libs/platform_kpd_led.h
new file mode 100644 (file)
index 0000000..8122dbb
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_kpd_led.h: kpd_led platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_KPD_LED_H_
+#define _PLATFORM_KPD_LED_H_
+
+#define DEVICE_NAME "intel_kpd_led"
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_kpd_led_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_kpd_led_gpio.c
new file mode 100644 (file)
index 0000000..5993dd0
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * platform_kpd_led_gpio.c: kpd_led_gpio platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel_kpd_gpio_led.h>
+#include <asm/intel-mid.h>
+#include "platform_kpd_led_gpio.h"
+
+static int __init intel_kpd_gpio_led_init(void)
+{
+       int ret;
+       struct platform_device *pdev;
+       static struct intel_kpd_gpio_led_pdata pdata;
+
+       pdev = platform_device_alloc(DEVICE_NAME, -1);
+       if (!pdev) {
+               pr_err("Failed to create platform device: intel_kpd_led\n");
+               return -ENOMEM;
+       }
+
+       /* Revert me:
+        * Using hard coding here, will revert after
+        * IAFW support for KPD LED GPIO is available
+        */
+       ret = get_gpio_by_name("intel_kpd_led");
+       if (ret == -1) {
+               pr_err("Failed to get KPD LED gpio pin from SFI table\n");
+               pdata.gpio = 133; /* hard coding */
+       } else
+               pdata.gpio = ret;
+
+       pdev->dev.platform_data = &pdata;
+
+       return platform_device_add(pdev);
+}
+device_initcall(intel_kpd_gpio_led_init);
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_kpd_led_gpio.h b/arch/x86/platform/intel-mid/device_libs/platform_kpd_led_gpio.h
new file mode 100644 (file)
index 0000000..f850ce1
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_kpd_led_gpio.h: kpd_led_gpio platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_KPD_LED_GPIO_H_
+#define _PLATFORM_KPD_LED_GPIO_H_
+
+#define DEVICE_NAME "intel_kpd_led"
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_l3g4200d.c b/arch/x86/platform/intel-mid/device_libs/platform_l3g4200d.c
new file mode 100644 (file)
index 0000000..7d80f2f
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * platform_l3g4200d.c:  l3g4200d platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <linux/input/l3g4200d_poll.h>
+#include <asm/intel-mid.h>
+#include "platform_l3g4200d.h"
+
+void __init *l3g4200d_platform_data(void *info)
+{
+       static struct l3g4200d_gyr_platform_data l3g4200d_pdata;
+
+       l3g4200d_pdata.fs_range = L3G4200D_GYR_FS_2000DPS;
+       l3g4200d_pdata.poll_interval = 200;
+       l3g4200d_pdata.negate_x = 0;
+       l3g4200d_pdata.negate_y = 0;
+       l3g4200d_pdata.negate_z = 0;
+       l3g4200d_pdata.axis_map_x = 0;
+       l3g4200d_pdata.axis_map_y = 1;
+       l3g4200d_pdata.axis_map_z = 2;
+
+       return &l3g4200d_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_l3g4200d.h b/arch/x86/platform/intel-mid/device_libs/platform_l3g4200d.h
new file mode 100644 (file)
index 0000000..f66a5ee
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_l3g4200d.h: l3g4200d platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_L3G4200D_H_
+#define _PLATFORM_L3G4200D_H_
+
+extern void __init *l3g4200d_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lis331.c b/arch/x86/platform/intel-mid/device_libs/platform_lis331.c
new file mode 100644 (file)
index 0000000..05536ea
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * platform_lis331.c:  lis331 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_lis331.h"
+
+void __init *lis331dl_platform_data(void *info)
+{
+       static short intr2nd_pdata;
+       struct i2c_board_info *i2c_info = info;
+       int intr = get_gpio_by_name("accel_int");
+       int intr2nd = get_gpio_by_name("accel_2");
+
+       if (intr == -1 || intr2nd == -1)
+               return NULL;
+
+       i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+       intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET;
+
+       return &intr2nd_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lis331.h b/arch/x86/platform/intel-mid/device_libs/platform_lis331.h
new file mode 100644 (file)
index 0000000..37fbe0c
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_lis331.h: lis331 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_LIS331_H_
+#define _PLATFORM_LIS331_H_
+
+extern void __init *lis331dl_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lis3dh.c b/arch/x86/platform/intel-mid/device_libs/platform_lis3dh.c
new file mode 100644 (file)
index 0000000..4dcae97
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * platform_lis3dh.c: lis3dh platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include <linux/input/lis3dh.h>
+#include "platform_lis3dh.h"
+
+void *lis3dh_platform_data(void *info)
+{
+       static struct lis3dh_acc_platform_data lis3dh_pdata;
+
+       lis3dh_pdata.poll_interval = 200;
+       lis3dh_pdata.negate_x = 1;
+       lis3dh_pdata.negate_y = 0;
+       lis3dh_pdata.negate_z = 0;
+       lis3dh_pdata.axis_map_x = 0;
+       lis3dh_pdata.axis_map_y = 1;
+       lis3dh_pdata.axis_map_z = 2;
+       lis3dh_pdata.gpio_int1 = 60;
+       lis3dh_pdata.gpio_int2 = 61;
+
+       return &lis3dh_pdata;
+
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lis3dh.h b/arch/x86/platform/intel-mid/device_libs/platform_lis3dh.h
new file mode 100644 (file)
index 0000000..c464b0c
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_lis3dh.h: lis3dh platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_LIS3DH_H_
+#define _PLATFORM_LIS3DH_H_
+
+extern void *lis3dh_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lm3554.c b/arch/x86/platform/intel-mid/device_libs/platform_lm3554.c
new file mode 100644 (file)
index 0000000..dc6b83f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * platform_lm3554.c: lm3554 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/atomisp_platform.h>
+#include <asm/intel_scu_ipc.h>
+#include <asm/intel-mid.h>
+#include <media/v4l2-subdev.h>
+#include "platform_camera.h"
+#include "platform_lm3554.h"
+
+void *lm3554_platform_data(void *info)
+{
+       static struct camera_flash_platform_data lm3554_platform_data;
+       void *ret = &lm3554_platform_data;
+
+       lm3554_platform_data.gpio_reset  = get_gpio_by_name("GP_FLASH_RESET");
+       lm3554_platform_data.gpio_strobe = get_gpio_by_name("GP_FLASH_STROBE");
+       lm3554_platform_data.gpio_torch  = get_gpio_by_name("GP_FLASH_TORCH");
+
+       if (lm3554_platform_data.gpio_reset == -1) {
+               pr_err("%s: Unable to find GP_FLASH_RESET\n", __func__);
+               ret = NULL;
+       }
+       if (lm3554_platform_data.gpio_strobe == -1) {
+               pr_err("%s: Unable to find GP_FLASH_STROBE\n", __func__);
+               ret = NULL;
+       }
+       if (lm3554_platform_data.gpio_torch == -1) {
+               pr_err("%s: Unable to find GP_FLASH_TORCH\n", __func__);
+               ret = NULL;
+       }
+       return ret;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lm3554.h b/arch/x86/platform/intel-mid/device_libs/platform_lm3554.h
new file mode 100644 (file)
index 0000000..5e28920
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_lm3554.h: lm3554 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_LM3554_H_
+#define _PLATFORM_LM3554_H_
+
+extern void *lm3554_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lsm303.c b/arch/x86/platform/intel-mid/device_libs/platform_lsm303.c
new file mode 100644 (file)
index 0000000..db3d74b
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * platform_lsm303.c: lsm303 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <linux/input/lis3dh.h>
+#include <asm/intel-mid.h>
+#include "platform_lsm303.h"
+
+void *lsm303dlhc_accel_platform_data(void *info)
+{
+       static struct lis3dh_acc_platform_data accel;
+
+       accel.poll_interval = 200;
+       accel.negate_x = 1;
+       accel.negate_y = 0;
+       accel.negate_z = 0;
+       accel.axis_map_x = 0;
+       accel.axis_map_y = 1;
+       accel.axis_map_z = 2;
+       accel.gpio_int1 = get_gpio_by_name("accel_int");
+       accel.gpio_int2 = get_gpio_by_name("accel_2");
+       accel.model = MODEL_LSM303DLHC;
+
+       return &accel;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_lsm303.h b/arch/x86/platform/intel-mid/device_libs/platform_lsm303.h
new file mode 100644 (file)
index 0000000..6131921
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_lsm303.h: lsm303 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_LSM303_H_
+#define _PLATFORM_LSM303_H_
+
+extern void *lsm303dlhc_accel_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ltr502als.c b/arch/x86/platform/intel-mid/device_libs/platform_ltr502als.c
new file mode 100644 (file)
index 0000000..3868b81
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * platform_ltr502als.c: ltr502als platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_ltr502als.h"
+
+void *ltr502als_platform_data(void *info)
+{
+       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+
+       i2c_info->irq = get_gpio_by_name("AL-intr");
+
+       return NULL;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ltr502als.h b/arch/x86/platform/intel-mid/device_libs/platform_ltr502als.h
new file mode 100644 (file)
index 0000000..6ce0739
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_ltr502als.h: ltr502als platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_LTR502ALS_H_
+#define _PLATFORM_LTR502ALS_H_
+
+extern void *ltr502als_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max11871.c b/arch/x86/platform/intel-mid/device_libs/platform_max11871.c
new file mode 100644 (file)
index 0000000..ef06d2b
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * platform_max11871.c: max11871 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <linux/max11871.h>
+#include <linux/irq.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/input.h>
+#include <asm/intel-mid.h>
+#include "platform_max11871.h"
+
+
+static struct max11871_platform_data max11871_pdata = {
+       .version = 0x101,
+
+       .abs_x_min = 0,
+       .abs_x_max = 320,
+       .abs_y_min = 4,
+       .abs_y_max = 484,
+       .abs_z_min = 0,
+       .abs_z_max = 255,
+
+       .irq_flags = IRQF_TRIGGER_FALLING,
+};
+
+static int max11871_power(int on)
+{
+       if (on) {
+               gpio_set_value(max11871_pdata.gpio_rst, 1);
+               msleep(40);
+       } else {
+               gpio_set_value(max11871_pdata.gpio_rst, 0);
+               msleep(20);
+       }
+
+       return 0;
+}
+
+static int max11871_board_init(void)
+{
+       int ret = 0;
+       int gpio = max11871_pdata.gpio_irq;
+
+       ret = gpio_request(gpio, "max11871_irq");
+       if (ret < 0) {
+               pr_err("%s: failed to request GPIO %d\n", __func__, gpio);
+               return ret;
+       }
+       return gpio_direction_input(gpio);
+}
+
+static ssize_t max11871_virtual_keys_show(struct kobject *obj,
+                               struct kobj_attribute *attr, char *buf)
+{
+       /*
+        * virtual key format: version:code:centerX:centerY:width:height
+        * version must be 0x01, coordinate uses display unit
+        * (GI display size is 320 * 480), not raw touch unit
+        */
+
+       return sprintf(buf,
+                       "0x01:" __stringify(KEY_BACK) ":40:520:60:60:"
+                       "0x01:" __stringify(KEY_HOME) ":120:520:60:60:"
+                       "0x01:" __stringify(KEY_SEARCH) ":200:520:60:60:"
+                       "0x01:" __stringify(KEY_MENU) ":280:520:60:60\n");
+}
+
+static struct kobj_attribute max11871_virtual_keys_attr = {
+       .attr = {
+               .name = "virtualkeys.max11871_touchscreen_0",
+               .mode = S_IRUGO,
+       },
+       .show = max11871_virtual_keys_show,
+};
+
+
+void *max11871_platform_data(void *info)
+{
+       struct i2c_board_info *i2c_info = info;
+
+       intel_mid_create_property(&max11871_virtual_keys_attr.attr);
+
+       max11871_pdata.platform_hw_init = max11871_board_init,
+       max11871_pdata.power = max11871_power,
+       max11871_pdata.i2c_addr = i2c_info->addr;
+       max11871_pdata.gpio_irq = get_gpio_by_name("ts_int");
+       max11871_pdata.gpio_rst = get_gpio_by_name("ts_rst");
+
+       return &max11871_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max11871.h b/arch/x86/platform/intel-mid/device_libs/platform_max11871.h
new file mode 100644 (file)
index 0000000..4621234
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_max11871.h: max11871 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MAX11871_H_
+#define _PLATFORM_MAX11871_H_
+
+extern void *max11871_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max17042.c b/arch/x86/platform/intel-mid/device_libs/platform_max17042.c
new file mode 100644 (file)
index 0000000..ecf50e8
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * platform_max17042.c: max17042 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <linux/power_supply.h>
+#include <linux/power/max17042_battery.h>
+#include <linux/power/intel_mdf_battery.h>
+#include <linux/power/smb347-charger.h>
+#include <linux/power/bq24192_charger.h>
+#include <asm/intel-mid.h>
+#include <asm/delay.h>
+#include <asm/intel_scu_ipc.h>
+#include "platform_max17042.h"
+
+void max17042_i2c_reset_workaround(void)
+{
+/* toggle clock pin of I2C-1 to recover devices from abnormal status.
+ * currently, only max17042 on I2C-1 needs such workaround */
+#define I2C_1_GPIO_PIN 27
+       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_GPIO);
+       gpio_direction_output(I2C_1_GPIO_PIN, 0);
+       gpio_set_value(I2C_1_GPIO_PIN, 1);
+       udelay(10);
+       gpio_set_value(I2C_1_GPIO_PIN, 0);
+       udelay(10);
+       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_ALT_1);
+#undef I2C_1_GPIO_PIN
+}
+EXPORT_SYMBOL(max17042_i2c_reset_workaround);
+
+static bool msic_battery_check(void)
+{
+       if (get_oem0_table() == NULL) {
+               pr_info("invalid battery detected\n");
+               return false;
+       } else {
+               pr_info("valid battery detected\n");
+               return true;
+       }
+       return false;
+}
+
+
+#define UMIP_REF_FG_TBL                        0x806   /* 2 bytes */
+#define BATT_FG_TBL_BODY               14      /* 144 bytes */
+/**
+ * mfld_fg_restore_config_data - restore config data
+ * @name : Power Supply name
+ * @data : config data output pointer
+ * @len : length of config data
+ *
+ */
+int mfld_fg_restore_config_data(const char *name, void *data, int len)
+{
+       int mip_offset, ret;
+
+       /* Read the fuel gauge config data from umip */
+       mip_offset = UMIP_REF_FG_TBL + BATT_FG_TBL_BODY;
+       ret = intel_scu_ipc_read_mip((u8 *)data, len, mip_offset, 0);
+
+       return ret;
+}
+EXPORT_SYMBOL(mfld_fg_restore_config_data);
+
+/**
+ * mfld_fg_save_config_data - save config data
+ * @name : Power Supply name
+ * @data : config data input pointer
+ * @len : length of config data
+ *
+ */
+int mfld_fg_save_config_data(const char *name, void *data, int len)
+{
+       int mip_offset, ret;
+
+       /* write the fuel gauge config data to umip */
+       mip_offset = UMIP_REF_FG_TBL + BATT_FG_TBL_BODY;
+       ret = intel_scu_ipc_write_umip((u8 *)data, len, mip_offset);
+
+       return ret;
+}
+EXPORT_SYMBOL(mfld_fg_save_config_data);
+
+void *max17042_platform_data(void *info)
+{
+       static struct max17042_platform_data platform_data;
+       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+#ifdef CONFIG_BOARD_CTP /* TODO: get rid of this... */
+       int intr = get_gpio_by_name("max17042");
+#else
+       int intr = get_gpio_by_name("max_fg_alert");
+#endif
+
+       i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+
+       if (msic_battery_check()) {
+               platform_data.enable_current_sense = true;
+               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
+       } else {
+               platform_data.enable_current_sense = false;
+               platform_data.technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
+       }
+
+       platform_data.is_init_done = 0;
+       platform_data.reset_i2c_lines = max17042_i2c_reset_workaround;
+#ifdef CONFIG_BATTERY_INTEL_MDF /* blackbay, not redridge, not ctp */
+       platform_data.current_sense_enabled =
+               intel_msic_is_current_sense_enabled;
+       platform_data.battery_present = intel_msic_check_battery_present;
+       platform_data.battery_health = intel_msic_check_battery_health;
+       platform_data.battery_status = intel_msic_check_battery_status;
+       platform_data.battery_pack_temp = intel_msic_get_battery_pack_temp;
+       platform_data.save_config_data = intel_msic_save_config_data;
+       platform_data.restore_config_data = intel_msic_restore_config_data;
+
+       platform_data.is_cap_shutdown_enabled =
+                                       intel_msic_is_capacity_shutdown_en;
+       platform_data.is_volt_shutdown_enabled = intel_msic_is_volt_shutdown_en;
+       platform_data.is_lowbatt_shutdown_enabled =
+                                       intel_msic_is_lowbatt_shutdown_en;
+       platform_data.get_vmin_threshold = intel_msic_get_vsys_min;
+#endif
+#ifdef CONFIG_BOARD_REDRIDGE /* TODO: get rid of this */
+       platform_data.enable_current_sense = true;
+       platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
+       platform_data.restore_config_data = mfld_fg_restore_config_data;
+       platform_data.save_config_data = mfld_fg_save_config_data;
+#endif
+#ifdef CONFIG_CHARGER_SMB347 /* redridge dv10 */
+       platform_data.battery_status = smb347_get_charging_status;
+#endif
+#ifdef CONFIG_CHARGER_BQ24192 /* clovertrail */
+       platform_data.battery_status = bq24192_query_battery_status;
+#endif
+
+       return &platform_data;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max17042.h b/arch/x86/platform/intel-mid/device_libs/platform_max17042.h
new file mode 100644 (file)
index 0000000..e6ffdbb
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_max17042.h: max17042 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MAX17042_H_
+#define _PLATFORM_MAX17042_H_
+
+extern void *max17042_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max3111.c b/arch/x86/platform/intel-mid/device_libs/platform_max3111.c
new file mode 100644 (file)
index 0000000..65da2ee
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * platform_max3111.c: max3111 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/spi/spi.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_max3111.h"
+
+void __init *max3111_platform_data(void *info)
+{
+       struct spi_board_info *spi_info = info;
+       int intr = get_gpio_by_name("max3111_int");
+
+       spi_info->mode = SPI_MODE_0;
+       if (intr == -1)
+               return NULL;
+       spi_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+       return NULL;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max3111.h b/arch/x86/platform/intel-mid/device_libs/platform_max3111.h
new file mode 100644 (file)
index 0000000..b26b9aa
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_max3111.h: max3111 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MAX3111_H_
+#define _PLATFORM_MAX3111_H_
+
+extern void *max3111_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max7315.c b/arch/x86/platform/intel-mid/device_libs/platform_max7315.c
new file mode 100644 (file)
index 0000000..967fb4b
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * platform_max7315.c: max7315 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/i2c/pca953x.h>
+#include <asm/intel-mid.h>
+#include "platform_max7315.h"
+
+
+void __init *max7315_platform_data(void *info)
+{
+       static struct pca953x_platform_data max7315_pdata[MAX7315_NUM];
+       static int nr;
+       struct pca953x_platform_data *max7315 = &max7315_pdata[nr];
+       struct i2c_board_info *i2c_info = info;
+       int gpio_base, intr;
+       char base_pin_name[SFI_NAME_LEN + 1];
+       char intr_pin_name[SFI_NAME_LEN + 1];
+
+       if (nr >= MAX7315_NUM) {
+               pr_err("too many max7315s, we only support %d\n",
+                               MAX7315_NUM);
+               return NULL;
+       }
+       /* we have several max7315 on the board, we only need load several
+        * instances of the same pca953x driver to cover them
+        */
+       strcpy(i2c_info->type, "max7315");
+       if (nr++) {
+               snprintf(base_pin_name, sizeof(base_pin_name), \
+                                                       "max7315_%d_base", nr);
+               snprintf(intr_pin_name, sizeof(intr_pin_name), \
+                                                       "max7315_%d_int", nr);
+       } else {
+               strcpy(base_pin_name, "max7315_base");
+               strcpy(intr_pin_name, "max7315_int");
+       }
+
+       gpio_base = get_gpio_by_name(base_pin_name);
+       intr = get_gpio_by_name(intr_pin_name);
+
+       if (gpio_base == -1)
+               return NULL;
+       max7315->gpio_base = gpio_base;
+       if (intr != -1) {
+               i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+               max7315->irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
+       } else {
+               i2c_info->irq = -1;
+               max7315->irq_base = -1;
+       }
+       return max7315;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max7315.h b/arch/x86/platform/intel-mid/device_libs/platform_max7315.h
new file mode 100644 (file)
index 0000000..5589fbd
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_max7315.h: max7315 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MAX7315_H_
+#define _PLATFORM_MAX7315_H_
+
+extern void __init *max7315_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mid_pwm.c b/arch/x86/platform/intel-mid/device_libs/platform_mid_pwm.c
new file mode 100644 (file)
index 0000000..40e779b
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * platform_mid_pwm.c: mid_pwm platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/input.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/lnw_gpio.h>
+#include <linux/ipc_device.h>
+#include <asm/intel-mid.h>
+#include <asm/intel_mid_pwm.h>
+#include "platform_mid_pwm.h"
+
+static int __init intel_mid_pwm_init(void)
+{
+       int ret, i;
+       struct ipc_board_info board_info;
+       static struct intel_mid_pwm_platform_data mid_pwm_pdata;
+
+       for (i = 0; i < PWM_NUM; i++) {
+               mid_pwm_pdata.reg_clkdiv0[i] = MSIC_REG_PWM0CLKDIV0 + i * 2;
+               mid_pwm_pdata.reg_clkdiv1[i] = MSIC_REG_PWM0CLKDIV1 + i * 2;
+               mid_pwm_pdata.reg_dutycyc[i] = MSIC_REG_PWM0DUTYCYCLE + i;
+       }
+
+       memset(&board_info, 0, sizeof(board_info));
+       strncpy(board_info.name, DEVICE_NAME, 16);
+       board_info.bus_id = IPC_SCU;
+       board_info.id = -1;
+       board_info.platform_data = &mid_pwm_pdata;
+
+       ret = ipc_new_device(&board_info);
+       if (ret) {
+               pr_err("failed to create ipc device: intel_mid_pwm\n");
+               return -1;
+       }
+
+       return 0;
+}
+fs_initcall(intel_mid_pwm_init);
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mid_pwm.h b/arch/x86/platform/intel-mid/device_libs/platform_mid_pwm.h
new file mode 100644 (file)
index 0000000..398764a
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_mid_pwm.h: mid_pwm platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MID_PWM_H_
+#define _PLATFORM_MID_PWM_H_
+
+#define DEVICE_NAME "intel_mid_pwm"
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c b/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c
new file mode 100644 (file)
index 0000000..59a1155
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * platform_mpu3050.c: mpu3050 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_mpu3050.h"
+
+void *gyro_platform_data(void *info)
+{
+       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+
+       i2c_info->irq = get_gpio_by_name("gyro_int");
+
+       return NULL;
+}
+
+void *mpu3050_platform_data(void *info)
+{
+       struct i2c_board_info *i2c_info = info;
+       int intr = get_gpio_by_name("mpu3050_int");
+
+       if (intr == -1)
+               return NULL;
+
+       i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+       return NULL;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.h b/arch/x86/platform/intel-mid/device_libs/platform_mpu3050.h
new file mode 100644 (file)
index 0000000..837b432
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_mpu3050.h: mpu3050 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MPU3050_H_
+#define _PLATFORM_MPU3050_H_
+
+extern void *mpu3050_platform_data(void *info) __attribute__((weak));
+extern void *gyro_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ms5607.c b/arch/x86/platform/intel-mid/device_libs/platform_ms5607.c
new file mode 100644 (file)
index 0000000..9c7c980
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * platform_ms5607.c: ms5607 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include <linux/ms5607.h>
+#include "platform_ms5607.h"
+
+void *ms5607_platform_data(void *info)
+{
+       static struct ms5607_platform_data ms5607_pdata;
+       struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+
+       i2c_info->irq = 0xff;
+
+       ms5607_pdata.poll_interval = 100;
+       ms5607_pdata.min_interval  = 0;
+
+       return &ms5607_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ms5607.h b/arch/x86/platform/intel-mid/device_libs/platform_ms5607.h
new file mode 100644 (file)
index 0000000..8613bb6
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_ms5607.h: ms5607 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MS5607_H_
+#define _PLATFORM_MS5607_H_
+
+extern void *ms5607_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_adc.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_adc.c
new file mode 100644 (file)
index 0000000..78313c4
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * platform_msic_adc.c: MSIC ADC platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/init.h>
+#include <linux/sfi.h>
+#include <asm/intel-mid.h>
+#include <asm/intel_mid_gpadc.h>
+#include "platform_ipc.h"
+#include "platform_msic_adc.h"
+
+static struct resource msic_adc_resources[] __initdata = {
+       {
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct intel_ipc_dev_res ipc_msic_adc_res[] __initdata = {
+       {
+               .name                   = "msic_adc",
+               .num_resources          = ARRAY_SIZE(msic_adc_resources),
+               .resources              = msic_adc_resources,
+       },
+
+};
+
+void __init *msic_adc_platform_data(void *info)
+{
+       struct sfi_device_table_entry *entry = info;
+       static struct intel_mid_gpadc_platform_data msic_adc_pdata;
+       msic_adc_pdata.intr = 0xffff7fc0;
+
+       handle_ipc_irq_res(entry->irq, ipc_msic_adc_res);
+
+       return &msic_adc_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_adc.h b/arch/x86/platform/intel-mid/device_libs/platform_msic_adc.h
new file mode 100644 (file)
index 0000000..692faa9
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_msic_adc.h: MSIC ADC platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MSIC_ADC_H_
+#define _PLATFORM_MSIC_ADC_H_
+
+extern void __init *msic_adc_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c
new file mode 100644 (file)
index 0000000..d1b3f56
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * platform_msic_audio.c: MSIC audio platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/init.h>
+#include <linux/sfi.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/intel_msic.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+#include "platform_msic_audio.h"
+
+static struct resource msic_audio_resources[] __initdata = {
+       {
+               .name  = "IRQ",
+               .flags = IORESOURCE_IRQ,
+       },
+       {
+               .name  = "IRQ_BASE",
+               .flags = IORESOURCE_MEM,
+               .start = MSIC_IRQ_STATUS_OCAUDIO,
+               .end   = MSIC_IRQ_STATUS_ACCDET,
+       },
+};
+
+static struct intel_ipc_dev_res ipc_msic_audio_res[] __initdata = {
+       {
+               .name                   = "msic_audio",
+               .num_resources          = ARRAY_SIZE(msic_audio_resources),
+               .resources              = msic_audio_resources,
+       },
+
+};
+
+void *msic_audio_platform_data(void *info)
+{
+       int ret;
+       struct platform_device *pdev;
+       struct sfi_device_table_entry *entry = info;
+
+       pdev = platform_device_alloc("sst-platform", -1);
+       if (!pdev) {
+               pr_err("failed to allocate audio platform device\n");
+               return NULL;
+       }
+
+       ret = platform_device_add(pdev);
+       if (ret) {
+               pr_err("failed to add audio platform device\n");
+               platform_device_put(pdev);
+               return NULL;
+       }
+
+       pdev = platform_device_alloc("hdmi-audio", -1);
+       if (!pdev) {
+               pr_err("failed to allocate hdmi-audio platform device\n");
+               return NULL;
+       }
+
+       ret = platform_device_add(pdev);
+       if (ret) {
+               pr_err("failed to add hdmi-audio platform device\n");
+               platform_device_put(pdev);
+               return NULL;
+       }
+
+       pdev = platform_device_alloc("sn95031", -1);
+       if (!pdev) {
+               pr_err("failed to allocate sn95031 platform device\n");
+               return NULL;
+       }
+
+       ret = platform_device_add(pdev);
+       if (ret) {
+               pr_err("failed to add sn95031 platform device\n");
+               platform_device_put(pdev);
+               return NULL;
+       }
+
+       if (strncmp(entry->name, "msic_audio", 16) == 0)
+               handle_ipc_irq_res(entry->irq, ipc_msic_audio_res);
+
+       return NULL;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.h b/arch/x86/platform/intel-mid/device_libs/platform_msic_audio.h
new file mode 100644 (file)
index 0000000..1fca68f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_msic_audio.h: MSIC audio platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MSIC_AUDIO_H_
+#define _PLATFORM_MSIC_AUDIO_H_
+
+extern void __init *msic_audio_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c
new file mode 100644 (file)
index 0000000..25fda37
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * platform_msic_battery.c: MSIC battery platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/init.h>
+#include <linux/sfi.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+#include "platform_msic_battery.h"
+
+static struct resource msic_battery_resources[] __initdata = {
+       {
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct intel_ipc_dev_res ipc_msic_battery_res[] __initdata = {
+       {
+               .name                   = "msic_battery",
+               .num_resources          = ARRAY_SIZE(msic_battery_resources),
+               .resources              = msic_battery_resources,
+       },
+
+};
+
+void __init *msic_battery_platform_data(void *info)
+{
+       struct sfi_device_table_entry *entry = info;
+
+       handle_ipc_irq_res(entry->irq, ipc_msic_battery_res);
+
+       return NULL;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.h b/arch/x86/platform/intel-mid/device_libs/platform_msic_battery.h
new file mode 100644 (file)
index 0000000..9be705d
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_msic_battery.h: MSIC battery platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MSIC_BATTERY_H_
+#define _PLATFORM_MSIC_BATTERY_H_
+
+extern void __init *msic_battery_platform_data(void *info)
+                       __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c
new file mode 100644 (file)
index 0000000..90507ba
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * platform_msic_gpio.c: MSIC GPIO platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/sfi.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/mfd/intel_msic.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+#include "platform_msic_gpio.h"
+
+static struct resource msic_gpio_resources[] __initdata = {
+       {
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct intel_ipc_dev_res ipc_msic_gpio_res[] __initdata = {
+       {
+               .name                   = "msic_gpio",
+               .num_resources          = ARRAY_SIZE(msic_gpio_resources),
+               .resources              = msic_gpio_resources,
+       },
+
+};
+
+void __init *msic_gpio_platform_data(void *info)
+{
+       struct sfi_device_table_entry *entry = info;
+       static struct intel_msic_gpio_pdata msic_gpio_pdata;
+
+       int gpio = get_gpio_by_name("msic_gpio_base");
+
+       if (gpio < 0)
+               return NULL;
+
+       msic_gpio_pdata.gpio_base = gpio;
+       handle_ipc_irq_res(entry->irq, ipc_msic_gpio_res);
+
+       return &msic_gpio_pdata;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.h b/arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.h
new file mode 100644 (file)
index 0000000..88cd886
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_msic_gpio.h: MSIC GPIO platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MSIC_GPIO_H_
+#define _PLATFORM_MSIC_GPIO_H_
+
+extern void __init *msic_gpio_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c
new file mode 100644 (file)
index 0000000..a9ea3a7
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * platform_msic_ocd.c: MSIC OCD platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/sfi.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/mfd/intel_msic.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+#include "platform_msic_ocd.h"
+
+static struct resource msic_ocd_resources[] __initdata = {
+       {
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct intel_ipc_dev_res ipc_msic_ocd_res[] __initdata = {
+       {
+               .name                   = "msic_ocd",
+               .num_resources          = ARRAY_SIZE(msic_ocd_resources),
+               .resources              = msic_ocd_resources,
+       },
+
+};
+
+void __init *msic_ocd_platform_data(void *info)
+{
+       static struct intel_msic_ocd_pdata msic_ocd_pdata;
+       int gpio;
+
+       gpio = get_gpio_by_name("ocd_gpio");
+
+       if (gpio < 0)
+               return NULL;
+
+       msic_ocd_pdata.gpio = gpio;
+
+       handle_ipc_irq_res(gpio + INTEL_MID_IRQ_OFFSET, ipc_msic_ocd_res);
+
+       return &msic_ocd_pdata;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.h b/arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.h
new file mode 100644 (file)
index 0000000..7caa13b
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_msic_ocd.h: MSIC OCD platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MSIC_OCD_H_
+#define _PLATFORM_MSIC_OCD_H_
+
+extern void __init *msic_ocd_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c
new file mode 100644 (file)
index 0000000..ce91953
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * platform_msic_power_btn.c: MSIC power btn platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/sfi.h>
+#include <linux/init.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+#include "platform_msic_power_btn.h"
+
+static struct resource msic_power_btn_resources[] __initdata = {
+       {
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct intel_ipc_dev_res ipc_msic_power_btn_res[] __initdata = {
+       {
+               .name                   = "msic_power_btn",
+               .num_resources          = ARRAY_SIZE(msic_power_btn_resources),
+               .resources              = msic_power_btn_resources,
+       },
+
+};
+
+void __init *msic_power_btn_platform_data(void *info)
+{
+       struct sfi_device_table_entry *entry = info;
+
+       handle_ipc_irq_res(entry->irq, ipc_msic_power_btn_res);
+
+       return NULL;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.h b/arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.h
new file mode 100644 (file)
index 0000000..0fa8774
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_msic_power_btn.h: MSIC power btn platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MSIC_POWER_BTN_H_
+#define _PLATFORM_MSIC_POWER_BTN_H_
+
+extern void __init *msic_power_btn_platform_data(void *info)
+               __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c b/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c
new file mode 100644 (file)
index 0000000..6de3fd1
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * platform_misc_thermal.c: misc_thermal platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/input.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/ipc_device.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_msic_thermal.h"
+
+static int __init intel_msic_thermal_init(void)
+{
+       int ret;
+       struct ipc_board_info board_info;
+
+       memset(&board_info, 0, sizeof(board_info));
+       strncpy(board_info.name, DEVICE_NAME, 16);
+       board_info.bus_id = IPC_SCU;
+       board_info.id = -1;
+
+       ret = ipc_new_device(&board_info);
+       if (ret) {
+               pr_err("failed to create ipc device: msic_thermal\n");
+               return -1;
+       }
+
+       return 0;
+}
+fs_initcall(intel_msic_thermal_init);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.h b/arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.h
new file mode 100644 (file)
index 0000000..cd1d15e
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_misc_thermal.h: misc_thermal platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MISC_THERMAL_H_
+#define _PLATFORM_MISC_THERMAL_H_
+
+#define DEVICE_NAME "misc_thermal"
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mt9e013.c b/arch/x86/platform/intel-mid/device_libs/platform_mt9e013.c
new file mode 100644 (file)
index 0000000..79ebf44
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * platform_mt9e013.c: mt9e013 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/atomisp_platform.h>
+#include <asm/intel_scu_ipc.h>
+#include <asm/intel-mid.h>
+#include <media/v4l2-subdev.h>
+#include "platform_camera.h"
+#include "platform_mt9e013.h"
+
+static int camera_reset;
+static int camera_power_down;
+static int camera_vprog1_on;
+
+/*
+ * MFLD PR2 primary camera sensor - MT9E013 platform data
+ */
+static int mt9e013_gpio_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       int ret;
+
+       if (camera_reset < 0) {
+               ret = camera_sensor_gpio(-1, GP_CAMERA_0_RESET,
+                                        GPIOF_DIR_OUT, 1);
+               if (ret < 0)
+                       return ret;
+               camera_reset = ret;
+       }
+
+       if (flag) {
+               gpio_set_value(camera_reset, 0);
+               msleep(20);
+               gpio_set_value(camera_reset, 1);
+       } else {
+               gpio_set_value(camera_reset, 0);
+       }
+
+       return 0;
+}
+
+static int mt9e013_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       static const unsigned int clock_khz = 19200;
+       return intel_scu_ipc_osc_clk(OSC_CLK_CAM0, flag ? clock_khz : 0);
+}
+
+static int mt9e013_power_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       int ret;
+
+       if (camera_power_down < 0) {
+               ret = camera_sensor_gpio(-1, GP_CAMERA_0_POWER_DOWN,
+                                        GPIOF_DIR_OUT, 1);
+               /*
+                * on some HW, this pin is not a connected pin,
+                * while on others, this indeed is avaiable.
+                * so just operate it when available and continue
+                * if it is failed.
+                */
+               if (ret < 0)
+                       pr_debug("%s not available.", GP_CAMERA_0_POWER_DOWN);
+               camera_power_down = ret;
+       }
+
+       if (flag) {
+               if (camera_power_down >= 0)
+                       gpio_set_value(camera_power_down, 1);
+               if (!camera_vprog1_on) {
+                       camera_vprog1_on = 1;
+                       intel_scu_ipc_msic_vprog1(1);
+               }
+       } else {
+               if (camera_vprog1_on) {
+                       camera_vprog1_on = 0;
+                       intel_scu_ipc_msic_vprog1(0);
+               }
+               if (camera_power_down >= 0)
+                       gpio_set_value(camera_power_down, 0);
+       }
+
+       return 0;
+}
+
+static int mt9e013_pixel_rate(void)
+{
+       return (board_id == MFLD_BID_LEX) ? 96 : 153;
+}
+
+static int mt9e013_csi_configure(struct v4l2_subdev *sd, int flag)
+{
+       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_PRIMARY, 2,
+               ATOMISP_INPUT_FORMAT_RAW_10, atomisp_bayer_order_grbg, flag);
+}
+
+static struct camera_sensor_platform_data mt9e013_sensor_platform_data = {
+       .gpio_ctrl      = mt9e013_gpio_ctrl,
+       .flisclk_ctrl   = mt9e013_flisclk_ctrl,
+       .power_ctrl     = mt9e013_power_ctrl,
+       .csi_cfg        = mt9e013_csi_configure,
+       .pixel_rate     = mt9e013_pixel_rate,
+};
+
+
+void mt9e013_reset(struct v4l2_subdev *sd)
+{
+       mt9e013_power_ctrl(sd, 1);
+       mt9e013_gpio_ctrl(sd, 0);
+       mt9e013_gpio_ctrl(sd, 1);
+       mt9e013_gpio_ctrl(sd, 0);
+       mt9e013_power_ctrl(sd, 0);
+}
+
+void *mt9e013_platform_data(void *info)
+{
+       camera_reset = -1;
+       camera_power_down = -1;
+
+       return &mt9e013_sensor_platform_data;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mt9e013.h b/arch/x86/platform/intel-mid/device_libs/platform_mt9e013.h
new file mode 100644 (file)
index 0000000..0ad786f
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_mt9e013.h: mt9e013 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MT9E013_H_
+#define _PLATFORM_MT9E013_H_
+
+extern void *mt9e013_platform_data(void *info) __attribute__((weak));
+extern void mt9e013_reset(struct v4l2_subdev *sd) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mt9m114.c b/arch/x86/platform/intel-mid/device_libs/platform_mt9m114.c
new file mode 100644 (file)
index 0000000..3aba03b
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * platform_mt9m114.c: mt9m114 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/atomisp_platform.h>
+#include <asm/intel-mid.h>
+#include <asm/intel_scu_ipc.h>
+#include <media/v4l2-subdev.h>
+#include "platform_camera.h"
+#include "platform_mt9m114.h"
+#include "platform_mt9e013.h"
+
+static int camera_reset;
+static int camera_power_down;
+static int camera_vprog1_on;
+
+/*
+ * MFLD PR2 secondary camera sensor - MT9M114 platform data
+ */
+static int mt9m114_gpio_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       int ret;
+
+       if (camera_reset < 0) {
+               ret = camera_sensor_gpio(-1, GP_CAMERA_1_RESET,
+                                        GPIOF_DIR_OUT, 1);
+               if (ret < 0)
+                       return ret;
+               camera_reset = ret;
+       }
+
+       if (flag) {
+#ifdef CONFIG_BOARD_CTP
+               gpio_set_value(camera_reset, 0);
+               msleep(60);
+#endif
+               gpio_set_value(camera_reset, 1);
+       } else
+               gpio_set_value(camera_reset, 0);
+
+       return 0;
+}
+
+static int mt9m114_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       static const unsigned int clock_khz = 19200;
+       return intel_scu_ipc_osc_clk(OSC_CLK_CAM1, flag ? clock_khz : 0);
+}
+
+static int mt9e013_reset_value;
+static int mt9m114_power_ctrl(struct v4l2_subdev *sd, int flag)
+{
+#ifndef CONFIG_BOARD_CTP
+       int ret;
+
+       /* Note here, there maybe a workaround to avoid I2C SDA issue */
+       if (camera_power_down < 0) {
+               ret = camera_sensor_gpio(-1, GP_CAMERA_1_POWER_DOWN,
+                                       GPIOF_DIR_OUT, 1);
+#ifndef CONFIG_BOARD_REDRIDGE
+               if (ret < 0)
+                       return ret;
+#endif
+               camera_power_down = ret;
+       }
+
+       if (camera_reset < 0) {
+               ret = camera_sensor_gpio(-1, GP_CAMERA_1_RESET,
+                                        GPIOF_DIR_OUT, 1);
+               if (ret < 0)
+                       return ret;
+               camera_reset = ret;
+       }
+#endif
+       if (flag) {
+#ifndef CONFIG_BOARD_CTP
+               if (!mt9e013_reset_value) {
+                       if (mt9e013_reset)
+                               mt9e013_reset(sd);
+                       mt9e013_reset_value = 1;
+               }
+#ifdef CONFIG_BOARD_REDRIDGE
+               gpio_direction_output(camera_reset, 0);
+#endif
+               gpio_set_value(camera_reset, 0);
+#endif
+               if (!camera_vprog1_on) {
+                       camera_vprog1_on = 1;
+                       intel_scu_ipc_msic_vprog1(1);
+               }
+#ifndef CONFIG_BOARD_CTP
+#ifdef CONFIG_BOARD_REDRIDGE
+               if (camera_power_down >= 0)
+                       gpio_set_value(camera_power_down, 1);
+#else
+               gpio_set_value(camera_power_down, 1);
+#endif
+#endif
+       } else {
+               if (camera_vprog1_on) {
+                       camera_vprog1_on = 0;
+                       intel_scu_ipc_msic_vprog1(0);
+               }
+#ifndef CONFIG_BOARD_CTP
+#ifdef CONFIG_BOARD_REDRIDGE
+               if (camera_power_down >= 0)
+                       gpio_set_value(camera_power_down, 0);
+#else
+               gpio_set_value(camera_power_down, 0);
+#endif
+
+               mt9e013_reset_value = 0;
+#endif
+       }
+
+       return 0;
+}
+
+static int mt9m114_csi_configure(struct v4l2_subdev *sd, int flag)
+{
+       /* soc sensor, there is no raw bayer order (set to -1) */
+       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_SECONDARY, 1,
+               ATOMISP_INPUT_FORMAT_YUV422_8, -1, flag);
+}
+
+static struct camera_sensor_platform_data mt9m114_sensor_platform_data = {
+       .gpio_ctrl      = mt9m114_gpio_ctrl,
+       .flisclk_ctrl   = mt9m114_flisclk_ctrl,
+       .power_ctrl     = mt9m114_power_ctrl,
+       .csi_cfg        = mt9m114_csi_configure,
+};
+
+void *mt9m114_platform_data(void *info)
+{
+       camera_reset = -1;
+       camera_power_down = -1;
+
+       return &mt9m114_sensor_platform_data;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mt9m114.h b/arch/x86/platform/intel-mid/device_libs/platform_mt9m114.h
new file mode 100644 (file)
index 0000000..e9f51cf
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_mt9m114.h: mt9m114 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MT9M114_H_
+#define _PLATFORM_MT9M114_H_
+
+extern void *mt9m114_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mxt224.c b/arch/x86/platform/intel-mid/device_libs/platform_mxt224.c
new file mode 100644 (file)
index 0000000..f5ec0cc
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * platform_mxt224.c: mxt224 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include <linux/atmel_mxt224.h>
+#include "platform_mxt224.h"
+
+void *mxt224_platform_data(void *info)
+{
+       static struct mxt_platform_data mxt_pdata;
+
+       mxt_pdata.numtouch       = 10;
+       mxt_pdata.max_x          = 1023;
+       mxt_pdata.max_y          = 975;
+       mxt_pdata.orientation    = MXT_MSGB_T9_ORIENT_HORZ_FLIP;
+       mxt_pdata.reset          = get_gpio_by_name("ts_rst");
+       mxt_pdata.irq            = get_gpio_by_name("ts_int");
+
+       return &mxt_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mxt224.h b/arch/x86/platform/intel-mid/device_libs/platform_mxt224.h
new file mode 100644 (file)
index 0000000..85b1a26
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_mxt224.h: mxt224 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MXT224_H_
+#define _PLATFORM_MXT224_H_
+
+extern void *mxt224_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mxt_ts.c b/arch/x86/platform/intel-mid/device_libs/platform_mxt_ts.c
new file mode 100644 (file)
index 0000000..0dea3af
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * platform_mxt_ts.c: mxt_ts platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include <linux/i2c/atmel_mxt_ts.h>
+#include "platform_mxt_ts.h"
+
+
+/* Atmel mxt toucscreen platform setup*/
+static int atmel_mxt_init_platform_hw(struct i2c_client *client)
+{
+       int rc;
+       int reset_gpio, int_gpio;
+
+       reset_gpio = TOUCH_RESET_GPIO;
+       int_gpio = TOUCH_IRQ_GPIO;
+
+       /* init interrupt gpio */
+       rc = gpio_request(int_gpio, "mxt_ts_intr");
+       if (rc < 0)
+               return rc;
+
+       rc = gpio_direction_input(int_gpio);
+       if (rc < 0)
+               goto err_int;
+
+       /* init reset gpio */
+       rc = gpio_request(reset_gpio, "mxt_ts_rst");
+       if (rc < 0)
+               goto err_int;
+
+       rc = gpio_direction_output(reset_gpio, 1);
+       if (rc < 0)
+               goto err_reset;
+
+       /* reset the chip */
+       gpio_set_value(reset_gpio, 1);
+       msleep(20);
+       gpio_set_value(reset_gpio, 0);
+       msleep(20);
+       gpio_set_value(reset_gpio, 1);
+       msleep(100);
+       /*
+        * HACK: depending on which touchpanel is used the mxt1386 controller
+        * may be at i2c address 0x4d instead of the default 0x4c stated in SFI
+        * table. Probe for chip by sending a i2c message and wait for ACK.
+        * (writing 0x00 will prepare chip for reading chip family id)
+        */
+
+       rc = i2c_smbus_write_byte_data(client, 0, 0);
+       if (rc < 0) {
+               /* retry */
+               msleep(60);
+               rc = i2c_smbus_write_byte_data(client, 0, 0);
+               if (rc < 0) {
+                       if (client->addr == 0x4c)
+                               client->addr = 0x4d;
+                       else if (client->addr == 0x4d)
+                               client->addr = 0x4c;
+               }
+       }
+
+       return 0;
+
+err_reset:
+       gpio_free(reset_gpio);
+err_int:
+       pr_err("mxt touchscreen: configuring reset or int gpio failed\n");
+       gpio_free(int_gpio);
+
+       return rc;
+}
+
+void *mxt_ts_platform_data(void *info)
+{
+       struct i2c_board_info *i2c_info = info;
+       static struct mxt_platform_data mxt_pdata = {
+               .irqflags       = IRQF_TRIGGER_FALLING,
+               .init_platform_hw = atmel_mxt_init_platform_hw,
+       };
+
+       i2c_info->irq = TOUCH_IRQ_GPIO + INTEL_MID_IRQ_OFFSET;
+       return &mxt_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mxt_ts.h b/arch/x86/platform/intel-mid/device_libs/platform_mxt_ts.h
new file mode 100644 (file)
index 0000000..f470bd9
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * platform_mxt_ts.h: mxt_ts platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_MXT_TS_H_
+#define _PLATFORM_MXT_TS_H_
+
+#define TOUCH_RESET_GPIO 129
+#define TOUCH_IRQ_GPIO   62
+
+extern void *mxt_ts_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ov8830.c b/arch/x86/platform/intel-mid/device_libs/platform_ov8830.c
new file mode 100644 (file)
index 0000000..4561250
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * platform_ov8830.c: ov8830 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/atomisp_platform.h>
+#include <asm/intel_scu_ipc.h>
+#include <asm/intel-mid.h>
+#include <media/v4l2-subdev.h>
+#include "platform_camera.h"
+#include "platform_ov8830.h"
+
+
+static int camera_reset;
+static int camera_power_down;
+static int camera_vprog1_on;
+
+/*
+ * CLV PR0 primary camera sensor - OV8830 platform data
+ */
+
+static int ov8830_gpio_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       int ret;
+
+       if (camera_reset < 0) {
+               ret = camera_sensor_gpio(-1, GP_CAMERA_0_RESET,
+                                       GPIOF_DIR_OUT, 1);
+               if (ret < 0)
+                       return ret;
+               camera_reset = ret;
+       }
+
+       if (flag) {
+               gpio_set_value(camera_reset, 0);
+               msleep(20);
+               gpio_set_value(camera_reset, 1);
+       } else {
+               gpio_set_value(camera_reset, 0);
+       }
+
+       return 0;
+}
+
+static int ov8830_flisclk_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       static const unsigned int clock_khz = 19200;
+       return intel_scu_ipc_osc_clk(OSC_CLK_CAM0, flag ? clock_khz : 0);
+}
+
+static int ov8830_power_ctrl(struct v4l2_subdev *sd, int flag)
+{
+       if (flag) {
+               if (!camera_vprog1_on) {
+                       camera_vprog1_on = 1;
+                       intel_scu_ipc_msic_vprog1(1);
+               }
+       } else {
+               if (camera_vprog1_on) {
+                       camera_vprog1_on = 0;
+                       intel_scu_ipc_msic_vprog1(0);
+               }
+       }
+
+       return 0;
+}
+
+static int ov8830_csi_configure(struct v4l2_subdev *sd, int flag)
+{
+       static const int LANES = 4;
+       return camera_sensor_csi(sd, ATOMISP_CAMERA_PORT_PRIMARY, LANES,
+               ATOMISP_INPUT_FORMAT_RAW_10, atomisp_bayer_order_bggr, flag);
+}
+
+static struct camera_sensor_platform_data ov8830_sensor_platform_data = {
+       .gpio_ctrl      = ov8830_gpio_ctrl,
+       .flisclk_ctrl   = ov8830_flisclk_ctrl,
+       .power_ctrl     = ov8830_power_ctrl,
+       .csi_cfg        = ov8830_csi_configure,
+};
+
+void *ov8830_platform_data(void *info)
+{
+       camera_reset = -1;
+       camera_power_down = -1;
+
+       return &ov8830_sensor_platform_data;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ov8830.h b/arch/x86/platform/intel-mid/device_libs/platform_ov8830.h
new file mode 100644 (file)
index 0000000..3e8683f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_ov8830.h: ov8830 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_OV8830_H_
+#define _PLATFORM_OV8830_H_
+
+extern void *ov8830_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pmic_audio.c b/arch/x86/platform/intel-mid/device_libs/platform_pmic_audio.c
new file mode 100644 (file)
index 0000000..92e3832
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * platform_pmic_audio.c: PMIC AUDIO platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/sfi.h>
+#include <asm/intel-mid.h>
+#include "platform_ipc.h"
+#include "platform_pmic_audio.h"
+
+static struct resource pmic_audio_resources[] __initdata = {
+       {
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+
+static struct intel_ipc_dev_res ipc_pmic_audio_res[] __initdata = {
+       {
+               .name                   = "pmic_audio",
+               .num_resources          = ARRAY_SIZE(pmic_audio_resources),
+               .resources              = pmic_audio_resources,
+       },
+};
+
+void __init *pmic_audio_platform_data(void *info)
+{
+       struct sfi_device_table_entry *entry = info;
+       handle_ipc_irq_res(entry->irq, ipc_pmic_audio_res);
+       return NULL;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pmic_audio.h b/arch/x86/platform/intel-mid/device_libs/platform_pmic_audio.h
new file mode 100644 (file)
index 0000000..e05d1a8
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_pmic_audio.h: PMIC AUDIO platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_PMIC_AUDIO_H_
+#define _PLATFORM_PMIC_AUDIO_H_
+
+extern void __init *pmic_audio_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c b/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c
new file mode 100644 (file)
index 0000000..a44f4a3
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * platform_pmic_gpio.c: PMIC GPIO platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/scatterlist.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/sfi.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include <linux/intel_pmic_gpio.h>
+#include "platform_ipc.h"
+#include "platform_pmic_gpio.h"
+
+static struct resource pmic_gpio_resources[] __initdata = {
+       {
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct intel_ipc_dev_res ipc_pmic_gpio_res[] __initdata = {
+       {
+               .name                   = "pmic_gpio",
+               .num_resources          = ARRAY_SIZE(pmic_gpio_resources),
+               .resources              = pmic_gpio_resources,
+       },
+};
+
+void __init *pmic_gpio_platform_data(void *info)
+{
+       struct sfi_device_table_entry *entry = info;
+       static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
+       int gpio_base = get_gpio_by_name("pmic_gpio_base");
+
+       if (gpio_base == -1)
+               gpio_base = 64;
+       pmic_gpio_pdata.gpio_base = gpio_base;
+       pmic_gpio_pdata.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
+       pmic_gpio_pdata.gpiointr = 0xffffeff8;
+
+       handle_ipc_irq_res(entry->irq, ipc_pmic_gpio_res);
+
+       return &pmic_gpio_pdata;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.h b/arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.h
new file mode 100644 (file)
index 0000000..0bce0de
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_pmic_gpio.h: PMIC GPIO platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_PMIC_GPIO_H_
+#define _PLATFORM_PMIC_GPIO_H_
+
+extern void __init *pmic_gpio_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pn544.c b/arch/x86/platform/intel-mid/device_libs/platform_pn544.c
new file mode 100644 (file)
index 0000000..28a91f8
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * platform_pn544.c: pn544 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/nfc/pn544.h>
+#include <asm/intel-mid.h>
+#include "platform_pn544.h"
+
+
+static unsigned int nfc_host_int_gpio, nfc_enable_gpio, nfc_fw_reset_gpio;
+
+static int pn544_nfc_request_resources(struct i2c_client *client)
+{
+       int ret;
+
+       ret = gpio_request(nfc_host_int_gpio, NFC_HOST_INT_GPIO);
+       if (ret) {
+               dev_err(&client->dev, "Request NFC INT GPIO fails %d\n", ret);
+               return -1;
+       }
+
+       ret = gpio_direction_input(nfc_host_int_gpio);
+       if (ret) {
+               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
+               goto err_int;
+       }
+
+       ret = gpio_request(nfc_enable_gpio, NFC_ENABLE_GPIO);
+       if (ret) {
+               dev_err(&client->dev,
+                       "Request for NFC Enable GPIO fails %d\n", ret);
+               goto err_int;
+       }
+
+       ret = gpio_direction_output(nfc_enable_gpio, 0);
+       if (ret) {
+               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
+               goto err_enable;
+       }
+
+       ret = gpio_request(nfc_fw_reset_gpio, NFC_FW_RESET_GPIO);
+       if (ret) {
+               dev_err(&client->dev,
+                       "Request for NFC FW Reset GPIO fails %d\n", ret);
+               goto err_enable;
+       }
+
+       ret = gpio_direction_output(nfc_fw_reset_gpio, 0);
+       if (ret) {
+               dev_err(&client->dev, "Set GPIO Direction fails %d\n", ret);
+               goto err_fw;
+       }
+
+       return 0;
+err_fw:
+       gpio_free(nfc_fw_reset_gpio);
+err_enable:
+       gpio_free(nfc_enable_gpio);
+err_int:
+       gpio_free(nfc_host_int_gpio);
+       return -1;
+}
+
+void *pn544_platform_data(void *info)
+{
+       struct i2c_board_info *i2c_info = (struct i2c_board_info *) info;
+       static struct pn544_i2c_platform_data pn544_nfc_platform_data;
+
+       memset(&pn544_nfc_platform_data, 0x00,
+               sizeof(struct pn544_i2c_platform_data));
+
+       nfc_host_int_gpio = get_gpio_by_name(NFC_HOST_INT_GPIO);
+       if (nfc_host_int_gpio == -1)
+               return NULL;
+       nfc_enable_gpio = get_gpio_by_name(NFC_ENABLE_GPIO);
+       if (nfc_enable_gpio  == -1)
+               return NULL;
+       nfc_fw_reset_gpio = get_gpio_by_name(NFC_FW_RESET_GPIO);
+       if (nfc_fw_reset_gpio == -1)
+               return NULL;
+
+       pn544_nfc_platform_data.irq_gpio = nfc_host_int_gpio;
+       pn544_nfc_platform_data.ven_gpio = nfc_enable_gpio;
+       pn544_nfc_platform_data.firm_gpio = nfc_fw_reset_gpio;
+
+       i2c_info->irq = nfc_host_int_gpio + INTEL_MID_IRQ_OFFSET;
+       pn544_nfc_platform_data.request_resources =
+               pn544_nfc_request_resources;
+
+       return &pn544_nfc_platform_data;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_pn544.h b/arch/x86/platform/intel-mid/device_libs/platform_pn544.h
new file mode 100644 (file)
index 0000000..a5464e7
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * platform_pn544.h: pn544 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_PN544_H_
+#define _PLATFORM_PN544_H_
+
+/* MFLD NFC controller (PN544) platform init */
+#define NFC_HOST_INT_GPIO               "NFC-intr"
+#define NFC_ENABLE_GPIO                 "NFC-enable"
+#define NFC_FW_RESET_GPIO               "NFC-reset"
+extern void *pn544_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_s3202.c b/arch/x86/platform/intel-mid/device_libs/platform_s3202.c
new file mode 100644 (file)
index 0000000..399b384
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * platform_s3202.c: s3202 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/lnw_gpio.h>
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C
+#include <linux/rmi_i2c.h>
+#else
+#include <linux/synaptics_i2c_rmi4.h>
+#endif
+#include <asm/intel-mid.h>
+#include "platform_s3202.h"
+
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C
+static struct rmi_f11_functiondata synaptics_f11_data = {
+       .swap_axes = true,
+};
+
+static unsigned char synaptic_keys[31] = {1, 2, 3, 4,};
+                       /* {KEY_BACK,KEY_MENU,KEY_HOME,KEY_SEARCH,} */
+
+static struct rmi_button_map synaptics_button_map = {
+       .nbuttons = 31,
+       .map = synaptic_keys,
+};
+static struct rmi_f19_functiondata  synaptics_f19_data = {
+       .button_map = &synaptics_button_map,
+};
+
+static struct rmi_functiondata synaptics_functiondata[] = {
+       {
+               .function_index = RMI_F11_INDEX,
+               .data = &synaptics_f11_data,
+       },
+       {
+               .function_index = RMI_F19_INDEX,
+               .data = &synaptics_f19_data,
+       },
+};
+
+static struct rmi_functiondata_list synaptics_perfunctiondata = {
+       .count = ARRAY_SIZE(synaptics_functiondata),
+       .functiondata = synaptics_functiondata,
+};
+
+
+static struct rmi_sensordata s3202_sensordata = {
+       .perfunctiondata = &synaptics_perfunctiondata,
+};
+#endif
+
+void *s3202_platform_data(void *info)
+{
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C
+
+       struct i2c_board_info *i2c_info = info;
+       static struct rmi_i2c_platformdata s3202_platform_data = {
+               .delay_ms = 50,
+               .sensordata = &s3202_sensordata,
+       };
+
+       s3202_platform_data.i2c_address = i2c_info->addr;
+       s3202_sensordata.attn_gpio_number = get_gpio_by_name("ts_int");
+       s3202_sensordata.rst_gpio_number  = get_gpio_by_name("ts_rst");
+#else
+       static struct rmi4_platform_data s3202_platform_data = {
+               .irq_type = IRQ_TYPE_EDGE_FALLING | IRQF_ONESHOT,
+               .swap_axes = true,
+       };
+
+       s3202_platform_data.int_gpio_number = get_gpio_by_name("ts_int");
+       s3202_platform_data.rst_gpio_number = get_gpio_by_name("ts_rst");
+#endif
+       return &s3202_platform_data;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_s3202.h b/arch/x86/platform/intel-mid/device_libs/platform_s3202.h
new file mode 100644 (file)
index 0000000..8b31f6e
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * platform_s3202.h: s3202 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_S3202_H_
+#define _PLATFORM_S3202_H_
+
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C
+#define RMI_F11_INDEX 0x11
+#define RMI_F19_INDEX 0x19
+#endif
+
+extern void *s3202_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_smb347.c b/arch/x86/platform/intel-mid/device_libs/platform_smb347.c
new file mode 100644 (file)
index 0000000..e566732
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * platform_smb347.c: smb347 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/power/smb347-charger.h>
+#include <asm/intel-mid.h>
+#include "platform_smb347.h"
+
+static struct smb347_charger_platform_data smb347_pdata = {
+       .battery_info   = {
+               .name                   = "UP110005",
+               .technology             = POWER_SUPPLY_TECHNOLOGY_LIPO,
+               .voltage_max_design     = 3700000,
+               .voltage_min_design     = 3000000,
+               .charge_full_design     = 6894000,
+       },
+       .max_charge_current             = 3360000,
+       .max_charge_voltage             = 4200000,
+       .otg_uvlo_voltage               = 3300000,
+       .chip_temp_threshold            = 120,
+       .soft_cold_temp_limit           = 5,
+       .soft_hot_temp_limit            = 50,
+       .hard_cold_temp_limit           = 5,
+       .hard_hot_temp_limit            = 55,
+       .suspend_on_hard_temp_limit     = true,
+       .soft_temp_limit_compensation   = SMB347_SOFT_TEMP_COMPENSATE_CURRENT
+                                       | SMB347_SOFT_TEMP_COMPENSATE_VOLTAGE,
+       .charge_current_compensation    = 900000,
+       .use_mains                      = true,
+       .enable_control                 = SMB347_CHG_ENABLE_PIN_ACTIVE_LOW,
+       .otg_control                    = SMB347_OTG_CONTROL_DISABLED,
+       .irq_gpio                       = SMB347_IRQ_GPIO,
+};
+
+void *smb347_platform_data(void *info)
+{
+       return &smb347_pdata;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_smb347.h b/arch/x86/platform/intel-mid/device_libs/platform_smb347.h
new file mode 100644 (file)
index 0000000..9ee73ad
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * platform_smb347.h: smb347 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_SMB347_H_
+#define _PLATFORM_SMB347_H_
+
+#define SMB347_IRQ_GPIO                52
+extern void *smb347_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_switch_mid.c b/arch/x86/platform/intel-mid/device_libs/platform_switch_mid.c
new file mode 100644 (file)
index 0000000..96f9f87
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * platform_switch_mid.c: switch_mid platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/input.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/lnw_gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_switch_mid.h"
+
+static struct platform_device switch_device = {
+       .name           = DEVICE_NAME,
+       .id             = -1,
+};
+
+static int __init switch_mid_init(void)
+{
+       int err;
+       err = platform_device_register(&switch_device);
+       if (err < 0)
+               pr_err("Fail to register switch-mid platform device.\n");
+       return 0;
+}
+
+device_initcall(switch_mid_init);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_switch_mid.h b/arch/x86/platform/intel-mid/device_libs/platform_switch_mid.h
new file mode 100644 (file)
index 0000000..0f683bc
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_switch_mid.h: switch_mid platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_SWITCH_MID_H_
+#define _PLATFORM_SWITCH_MID_H_
+
+#define DEVICE_NAME "switch-mid"
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c b/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c
new file mode 100644 (file)
index 0000000..a4d1c8b
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * platform_tc35876x.c: tc35876x platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/i2c/tc35876x.h>
+#include <asm/intel-mid.h>
+#include "platform_tc35876x.h"
+
+/*tc35876x DSI_LVDS bridge chip and panel platform data*/
+void *tc35876x_platform_data(void *data)
+{
+       static struct tc35876x_platform_data pdata;
+       pdata.gpio_bridge_reset = get_gpio_by_name("LCMB_RXEN");
+       pdata.gpio_panel_bl_en = get_gpio_by_name("6S6P_BL_EN");
+       pdata.gpio_panel_vadd = get_gpio_by_name("EN_VREG_LCD_V3P3");
+       return &pdata;
+}
+
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.h b/arch/x86/platform/intel-mid/device_libs/platform_tc35876x.h
new file mode 100644 (file)
index 0000000..56a74eb
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_tc35876x.h: tc35876x platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_TC35876X_H_
+#define _PLATFORM_TC35876X_H_
+
+extern void *tc35876x_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c b/arch/x86/platform/intel-mid/device_libs/platform_tca6416.c
new file mode 100644 (file)
index 0000000..98a6cd1
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * platform_tca6416.c: tca6416 platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/i2c/pca953x.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <asm/intel-mid.h>
+#include "platform_tca6416.h"
+
+void *tca6416_platform_data(void *info)
+{
+       static struct pca953x_platform_data tca6416;
+       struct i2c_board_info *i2c_info = info;
+       int gpio_base, intr;
+       char base_pin_name[SFI_NAME_LEN + 1];
+       char intr_pin_name[SFI_NAME_LEN + 1];
+
+       strcpy(i2c_info->type, TCA6416_NAME);
+       strcpy(base_pin_name, TCA6416_BASE);
+       strcpy(intr_pin_name, TCA6416_INTR);
+
+       gpio_base = get_gpio_by_name(base_pin_name);
+       intr = get_gpio_by_name(intr_pin_name);
+
+       if (gpio_base == -1)
+               return NULL;
+       tca6416.gpio_base = gpio_base;
+       if (intr != -1) {
+               i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
+               tca6416.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
+       } else {
+               i2c_info->irq = -1;
+               tca6416.irq_base = -1;
+       }
+       return &tca6416;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_tca6416.h b/arch/x86/platform/intel-mid/device_libs/platform_tca6416.h
new file mode 100644 (file)
index 0000000..69802d6
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * platform_tca6416.h: tca6416 platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_TCA6416_H_
+#define _PLATFORM_TCA6416_H_
+
+#define TCA6416_NAME   "tca6416"
+#define TCA6416_BASE   "tca6416_base"
+#define TCA6416_INTR   "tca6416_int"
+
+extern void *tca6416_platform_data(void *info) __attribute__((weak));
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_usb_otg.c b/arch/x86/platform/intel-mid/device_libs/platform_usb_otg.c
new file mode 100644 (file)
index 0000000..3bf213f
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * platform_usb_otg.c: usb_otg platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/usb/penwell_otg.h>
+#include <asm/intel-mid.h>
+#include "platform_usb_otg.h"
+
+void *cloverview_usb_otg_get_pdata(void)
+{
+       struct cloverview_usb_otg_pdata *pdata;
+
+       pdata = (struct cloverview_usb_otg_pdata *)
+                               kmalloc(sizeof(*pdata), GFP_KERNEL);
+       if (!pdata) {
+               pr_err("%s: out of memory.\n", __func__);
+               goto failed1;
+       }
+       pdata->gpio_cs = get_gpio_by_name("usb_otg_phy_cs");
+       if (pdata->gpio_cs == -1) {
+               pr_err("%s: No gpio pin for 'usb_otg_phy_cs'\n", __func__);
+               goto failed2;
+       }
+       pdata->gpio_reset = get_gpio_by_name("usb_otg_phy_rst");
+       if (pdata->gpio_reset == -1) {
+               pr_err("%s: No gpio pin for 'usb_otg_phy_rst'\n", __func__);
+               goto failed2;
+       }
+       pr_info("%s: CS pin: gpio %d, Reset pin: gpio %d\n", __func__,
+                        pdata->gpio_cs, pdata->gpio_reset);
+       return pdata;
+
+failed2:
+       kfree(pdata);
+failed1:
+       return NULL;
+}
+EXPORT_SYMBOL_GPL(cloverview_usb_otg_get_pdata);
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_usb_otg.h b/arch/x86/platform/intel-mid/device_libs/platform_usb_otg.h
new file mode 100644 (file)
index 0000000..3dd6a6b
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * platform_usb_otg.h: USB otg platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_USB_OTG_H_
+#define _PLATFORM_USB_OTG_H_
+
+extern void *cloverview_usb_otg_get_pdata(void);
+#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_wl12xx.c b/arch/x86/platform/intel-mid/device_libs/platform_wl12xx.c
new file mode 100644 (file)
index 0000000..6015c81
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * platform_wl12xx.c: wl12xx platform data initilization file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/gpio.h>
+#include <linux/lnw_gpio.h>
+#include <linux/wl12xx.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <asm/intel-mid.h>
+#include "platform_wl12xx.h"
+
+static struct wl12xx_platform_data mid_wifi_control = {
+       .board_ref_clock = 1,
+       .irq = 2,
+       .board_tcxo_clock = 1,
+       .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
+};
+
+static struct regulator_consumer_supply wl12xx_vmmc3_supply = {
+       .supply         = "vmmc",
+       .dev_name       = "0000:00:00.0", /*default value*/
+};
+
+static struct regulator_init_data wl12xx_vmmc3 = {
+       .constraints = {
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+       },
+       .num_consumer_supplies  = 1,
+       .consumer_supplies = &wl12xx_vmmc3_supply,
+};
+
+static struct fixed_voltage_config wl12xx_vwlan = {
+       .supply_name            = "vwl1271",
+       .microvolts             = 1800000,
+       .gpio                   = 75,
+       .startup_delay          = 70000,
+       .enable_high            = 1,
+       .enabled_at_boot        = 0,
+       .init_data              = &wl12xx_vmmc3,
+};
+
+static struct platform_device wl12xx_vwlan_device = {
+       .name           = "reg-fixed-voltage",
+       .id             = 1,
+       .dev = {
+               .platform_data  = &wl12xx_vwlan,
+       },
+};
+
+void __init wl12xx_platform_data_init_post_scu(void *info)
+{
+       struct sd_board_info *sd_info = info;
+       int wifi_irq_gpio;
+       int err;
+
+       /*Get GPIO numbers from the SFI table*/
+       wifi_irq_gpio = get_gpio_by_name(WL12XX_SFI_GPIO_IRQ_NAME);
+       if (wifi_irq_gpio == -1) {
+               pr_err("%s: Unable to find WLAN-interrupt GPIO in the SFI table\n",
+                               __func__);
+               return;
+       }
+       err = gpio_request(wifi_irq_gpio, "wl12xx");
+       if (err < 0) {
+               pr_err("%s: Unable to request GPIO\n", __func__);
+               return;
+       }
+       err = gpio_direction_input(wifi_irq_gpio);
+       if (err < 0) {
+               pr_err("%s: Unable to set GPIO direction\n", __func__);
+               return;
+       }
+       mid_wifi_control.irq = gpio_to_irq(wifi_irq_gpio);
+       if (mid_wifi_control.irq < 0) {
+               pr_err("%s:Error gpio_to_irq:%d->%d\n", __func__, wifi_irq_gpio,
+                      mid_wifi_control.irq);
+               return;
+       }
+       /* Set our board_ref_clock from SFI SD board info */
+       if (sd_info->board_ref_clock == ICDK_BOARD_REF_CLK)
+               /*iCDK board*/
+               /*26Mhz TCXO clock ref*/
+               mid_wifi_control.board_ref_clock = 1;
+       else if (sd_info->board_ref_clock == NCDK_BOARD_REF_CLK)
+               /*nCDK board*/
+               /*38,4Mhz TCXO clock ref*/
+               mid_wifi_control.board_ref_clock = 2;
+
+       err = wl12xx_set_platform_data(&mid_wifi_control);
+       if (err < 0)
+               pr_err("error setting wl12xx data\n");
+
+       /* this is the fake regulator that mmc stack use to power of the
+          wifi sdio card via runtime_pm apis */
+       wl12xx_vwlan.gpio = get_gpio_by_name(WL12XX_SFI_GPIO_ENABLE_NAME);
+       if (wl12xx_vwlan.gpio == -1) {
+               pr_err("%s: Unable to find WLAN-enable GPIO in the SFI table\n",
+                      __func__);
+               return;
+       }
+       /* format vmmc reg address from sfi table */
+       sprintf((char *)wl12xx_vmmc3_supply.dev_name, "0000:00:%02x.%01x",
+               (sd_info->addr)>>8, sd_info->addr&0xFF);
+
+       err = platform_device_register(&wl12xx_vwlan_device);
+       if (err < 0)
+               pr_err("error platform_device_register\n");
+
+       sdhci_pci_request_regulators();
+}
+
+void __init *wl12xx_platform_data(void *info)
+{
+       struct sd_board_info *sd_info;
+
+       sd_info = kmemdup(info, sizeof(*sd_info), GFP_KERNEL);
+       if (!sd_info) {
+               pr_err("MRST: fail to alloc mem for delayed wl12xx dev\n");
+               return NULL;
+       }
+       intel_delayed_device_register(sd_info,
+                                     wl12xx_platform_data_init_post_scu);
+
+       return &mid_wifi_control;
+}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_wl12xx.h b/arch/x86/platform/intel-mid/device_libs/platform_wl12xx.h
new file mode 100644 (file)
index 0000000..909f697
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * platform_wl12xx.h: wl12xx platform data header file
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#ifndef _PLATFORM_WL12XX_H_
+#define _PLATFORM_WL12XX_H_
+
+#define WL12XX_SFI_GPIO_IRQ_NAME "WLAN-interrupt"
+#define WL12XX_SFI_GPIO_ENABLE_NAME "WLAN-enable"
+#define ICDK_BOARD_REF_CLK 26000000
+#define NCDK_BOARD_REF_CLK 38400000
+
+extern void __init *wl12xx_platform_data(void *info) __attribute__((weak));
+#endif
index 04b623a..fafdbef 100644 (file)
@@ -383,9 +383,9 @@ static int __init sfi_parse_gpio(struct sfi_table_header *table)
        memcpy(gpio_table, pentry, num * sizeof(*pentry));
        gpio_num_entry = num;
 
-       pr_debug("GPIO pin info:\n");
+       pr_info("GPIO pin info:\n");
        for (i = 0; i < num; i++, pentry++)
-               pr_debug("info[%2d]: controller = %16.16s, pin_name = %16.16s,"
+               pr_info("info[%2d]: controller = %16.16s, pin_name = %16.16s,"
                " pin = %d\n", i,
                        pentry->controller_name,
                        pentry->pin_name,
@@ -728,7 +728,7 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
 
                dev = get_device_id(pentry->type, pentry->name);
 
-               if (dev == NULL)
+               if ((dev == NULL) || (dev->get_platform_data == NULL))
                        continue;
 
                if (dev->device_handler) {