void MFS_reboot(void)
{
	MCSDL_VDD_SET_LOW();

	MCSDL_GPIO_SDA_SET_HIGH();
	MCSDL_GPIO_SDA_SET_OUTPUT(1);

	MCSDL_GPIO_SCL_SET_HIGH();
	MCSDL_GPIO_SCL_SET_OUTPUT(1);

	MCSDL_RESETB_SET_LOW();
	MCSDL_RESETB_SET_OUTPUT(1);

	MFS_ms_delay(25);

	MCSDL_VDD_SET_HIGH();

	MCSDL_RESETB_SET_HIGH();
	MCSDL_RESETB_SET_INPUT();
	MCSDL_GPIO_SCL_SET_INPUT();
	MCSDL_GPIO_SDA_SET_INPUT();

	MFS_ms_delay(25);
}
Пример #2
0
eMFSRet_t check_panel_type(unsigned char* paneltype)
{
	eMFSRet_t ret;
	unsigned char read_buffer, cnt = 0;
	printk(KERN_ERR "<MELFAS> Check Panel Type\n");

	do
	{
		if (cnt++ > 3)
			return MRET_PANEL_TYPE_ERROR;
		
		if (!melfas_fw_i2c_read(0x1F, &read_buffer, 1))
			return MRET_I2C_ERROR;

		*paneltype = read_buffer;
		MFS_ms_delay(5);
#ifdef CONFIG_TOUCHSCREEN_MELFAS_KYLE_G2
	}while(read_buffer != 0x46 && read_buffer != 0x4d && read_buffer != 0x58);
#else
	}while(read_buffer != 0x46 && read_buffer != 0x4d);
void MFS_TSP_reboot(void)
{
#ifdef CONFIG_MACH_KYLE_I
	MFS_ms_delay(50);
	ts_power_control(0);
	MFS_ms_delay(500);
	ts_power_control(1);
	MFS_ms_delay(300);
#else
	MFS_ms_delay(50);
	gpio_direction_output(TSP_PWR_LDO_GPIO, 0);
	MFS_ms_delay(1000);
	gpio_direction_output(TSP_PWR_LDO_GPIO, 1);
	MFS_ms_delay(300);
#endif
}
Пример #4
0
eMFSRet_t MFS_ISC_update(void)
{
	extern void ts_power_enable(int en);
	eMFSRet_t ret;
	unsigned char paneltype, tspcomp, setcomp, redownload = 0;
	int i;
	MFS_I2C_set_slave_addr(mfs_i2c_slave_addr);

ENTRANCE:

	MFS_ms_delay(50);

#ifdef CONFIG_MACH_KYLE_I
	buf =& MELFAS_binary;
#else
	ret= check_panel_type(&paneltype);
	if (ret != MRET_SUCCESS && !redownload)
	{
		MFS_TSP_reboot();
		if (mass_erase() != MRET_SUCCESS)
			goto MFS_ISC_UPDATE_FINISH;

#ifdef CONFIG_TOUCHSCREEN_MELFAS_KYLE_G2
		if (firmware_write(G2_BINARY) != MRET_SUCCESS)
			goto MFS_ISC_UPDATE_FINISH;			
#else
		if (firmware_write(G1F_BINARY) != MRET_SUCCESS)
			goto MFS_ISC_UPDATE_FINISH;
#endif

		MFS_TSP_reboot();
		if (enter_ISC_mode() != MRET_SUCCESS)
			goto MFS_ISC_UPDATE_FINISH;

#ifdef CONFIG_TOUCHSCREEN_MELFAS_KYLE_G2
		if (firmware_verify(G2_BINARY) != MRET_SUCCESS)
			goto MFS_ISC_UPDATE_FINISH;
#else
		if (firmware_verify(G1F_BINARY) != MRET_SUCCESS)
			goto MFS_ISC_UPDATE_FINISH;
#endif

		MFS_TSP_reboot();
		redownload = 1;
		goto ENTRANCE;
	}
	else if (ret != MRET_SUCCESS)
	{
		goto MFS_ISC_UPDATE_FINISH;
	}

	if(paneltype == 0x4d)
	{
		buf = &G1M_BINARY;
		printk(KERN_ERR "<MELFAS> buf_G1M\n");
	}
	else if(paneltype == 0x46)
	{
		buf =& G1F_BINARY;
		printk(KERN_ERR "<MELFAS> buf_G1F\n");
	}
#ifdef CONFIG_TOUCHSCREEN_MELFAS_KYLE_G2
	else if(paneltype == 0x58)
	{
		buf =& G2_BINARY;
		printk(KERN_ERR "<MELFAS> buf_G2\n");
		//goto MFS_ISC_UPDATE_FINISH;
	}
#endif
#endif

	// TSP HW Revision
	if( get_tsp_compatibility(&tspcomp) != MRET_SUCCESS)
		goto MFS_ISC_UPDATE_FINISH;


	printk(KERN_ERR "<MELFAS> paneltype=%c\n", paneltype);
	printk(KERN_ERR "<MELFAS> tspcomp=%x\n", tspcomp);
#if defined(CONFIG_TOUCHSCREEN_MELFAS_KYLE_G2)
	if((paneltype == 0x4d && tspcomp > 0x0E) 
		|| (paneltype == 0x46 && ( tspcomp < 0x0F || tspcomp > 0x14 )) 
		|| (paneltype == 0x58 && ( tspcomp < 0x15 || tspcomp > 0x19 )) )
#else
	if((paneltype == 0x4d && tspcomp > 0x0E) || (paneltype == 0x46 && tspcomp <= 0x0E))
#endif
		goto START_DOWNLOAD;

	get_main_compatibility(buf, &setcomp);

#ifdef CONFIG_MACH_KYLE_I
	setcomp = TSP_SET_COMP;
	printk(KERN_ERR "<MELFAS> setcomp=%x\n", setcomp);
	printk(KERN_ERR "<MELFAS> tspcomp=%x\n", tspcomp);
	if(tspcomp != setcomp){
		goto MFS_ISC_UPDATE_FINISH;		
	}
#else
#if defined(CONFIG_TOUCHSCREEN_MELFAS_KYLE_G2)
	if( paneltype == 0x58 )
	{
		setcomp = TSP_SET_COMP_G2;
		printk(KERN_ERR "<MELFAS> setcomp=%x\n", setcomp);
		printk(KERN_ERR "<MELFAS> tspcomp=%x\n", tspcomp);
		if(tspcomp != setcomp)
			goto MFS_ISC_UPDATE_FINISH;
	}
	else
#endif		
	{
		printk(KERN_ERR "<MELFAS> setcomp=%c\n", setcomp);
		printk(KERN_ERR "<MELFAS> tspcomp=%x\n", tspcomp);	
		if(tspcomp != (setcomp-55))
			goto MFS_ISC_UPDATE_FINISH;
	}
#endif

	if (check_firmware_version(0, buf) != MRET_SUCCESS)
		goto MFS_ISC_UPDATE_FINISH;

START_DOWNLOAD:
	if (mass_erase() != MRET_SUCCESS)
		goto MFS_ISC_UPDATE_FINISH;

	ret = firmware_write(buf);
	if (ret != MRET_SUCCESS)
		goto MFS_ISC_UPDATE_FINISH;

	MFS_TSP_reboot();
	printk(KERN_ERR "<MELFAS> TOUCH IC REBOOT!!!\n");
	
	if (enter_ISC_mode() != MRET_SUCCESS)
		goto MFS_ISC_UPDATE_FINISH;

	if (firmware_verify(buf) != MRET_SUCCESS)
		goto MFS_ISC_UPDATE_FINISH;

	printk(KERN_ERR "<MELFAS> FIRMWARE_UPDATE_FINISHED!!!\n\n");

MFS_ISC_UPDATE_FINISH:

	MFS_TSP_reboot();
	printk(KERN_ERR "<MELFAS> TOUCH IC REBOOT2!!!\n");
	check_firmware_version(1, buf);

	MFS_I2C_set_slave_addr(mfs_i2c_slave_addr);

	return ret;
}