/* probe function is used for matching and initializing input device */
s32 /*__devinit*/ MsDrvInterfaceTouchDeviceProbe(struct i2c_client *pClient, const struct i2c_device_id *pDeviceId)
{
    s32 nRetVal = 0;

    DBG("*** %s() ***\n", __func__);

    DrvPlatformLyrInputDeviceInitialize(pClient);
  
    DrvPlatformLyrTouchDeviceRequestGPIO();
	
    DrvPlatformLyrTouchDeviceRegisterFingerTouchInterruptHandler();
	
#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
    DrvPlatformLyrTouchDeviceRegulatorPowerOn();
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON

    DrvPlatformLyrTouchDevicePowerOn();

    nRetVal = DrvMainTouchDeviceInitialize();
    if (nRetVal == -ENODEV)
    {
        DrvPlatformLyrTouchDeviceRemove(pClient);
        return nRetVal;
    }
#ifdef CONFIG_ENABLE_GESTURE_WAKEUP
#ifdef CONFIG_ENABLE_GESTURE_INFORMATION_MODE
    mstar_create_proc();
#endif
#endif


#if defined(CONFIG_FB)
    call_back_functions_init();
#endif

#ifndef CONFIG_UPDATE_FIRMWARE_BY_SW_ID
    DrvPlatformLyrEnableFingerTouchReport();
#endif	
    DBG("*** MStar touch driver registered ***\n");
//modify by pangle at 20150228 begin
#ifdef CONFIG_UPDATE_FIRMWARE_BY_SW_ID
	 program_over = 1;
#endif
//modify by pangle at 20150228 end
    return nRetVal;
}
/* probe function is used for matching and initializing input device */
s32 /*__devinit*/ MsDrvInterfaceTouchDeviceProbe(struct i2c_client *pClient,
		const struct i2c_device_id *pDeviceId)
{
	s32 nRetVal = 0;

	DBG("*** %s() ***\n", __func__);

#ifdef CONFIG_OF
	DrvPlatformLyrDts(pClient);
#endif

	DrvPlatformLyrInputDeviceInitialize(pClient);

	DrvPlatformLyrTouchDeviceRequestGPIO();

#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
	DrvPlatformLyrTouchDeviceRegulatorPowerOn();
#endif /* CONFIG_ENABLE_REGULATOR_POWER_ON */

	DrvPlatformLyrTouchDevicePowerOn();

	nRetVal = DrvMainTouchDeviceInitialize();
	if (nRetVal == -ENODEV) {
		DrvPlatformLyrTouchDeviceRemove(pClient);
		return nRetVal;
	}

	DrvPlatformLyrTouchDeviceRegisterFingerTouchInterruptHandler();

	DrvPlatformLyrTouchDeviceRegisterEarlySuspend();

#ifdef CONFIG_HIPAD_FIRMWARE_UPGRADE
	nRetVal = msg2238_create_fw_mdev(&mdev);
	if (nRetVal)
		fw_mdev_err("msg2238_create_fw_mdev ERROR = %d\n", nRetVal);
#endif

	DBG("*** MStar touch driver registered ***\n");

	return nRetVal;
}
/* probe function is used for matching and initializing input device */
s32 /*__devinit*/ MsDrvInterfaceTouchDeviceProbe(struct i2c_client *pClient, const struct i2c_device_id *pDeviceId)
{
    s32 nRetVal = 0;

    DBG("*** %s() ***\n", __func__);
  
    DrvPlatformLyrInputDeviceInitialize(pClient);
  
    DrvPlatformLyrTouchDeviceRequestGPIO();

#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
    DrvPlatformLyrTouchDeviceRegulatorPowerOn();
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON

    DrvPlatformLyrTouchDevicePowerOn();

	g_ChipType = DrvIcFwLyrGetChipType();
	
	 //if (g_ChipType != CHIP_TYPE_MSG21XX &&   // (0x01) 
         //     g_ChipType != CHIP_TYPE_MSG21XXA &&  // (0x02) 
        //      g_ChipType != CHIP_TYPE_MSG26XXM &&  // (0x03) 
         //     g_ChipType != CHIP_TYPE_MSG22XX)     // (0x7A) 
	if (g_ChipType != CHIP_TYPE_MSG22XX)     // (0x7A) 
	{
			return -1;
	}
    DrvMainTouchDeviceInitialize();

    DrvPlatformLyrTouchDeviceRegisterFingerTouchInterruptHandler();

    DrvPlatformLyrTouchDeviceRegisterEarlySuspend();

    DrvPlatformLyrTouchDeviceResetHw();

    DrvPlatformLyrEnableFingerTouchReport();

    DBG("*** MStar touch driver registered ***\n");
    
    return nRetVal;
}