static int TestPreparation(struct synaptics_ts_data *ts)
{
	u8 data = 0;

	ReadChCount(ts);

	/*Turn off CBC.*/
	touch_i2c_read(ts->client, ANALOG_CONTROL_REG, 1, &data);
	data = data & 0xDF;
	touch_i2c_write(ts->client, ANALOG_CONTROL_REG, 1, &data);

	/*Apply ForceUpdate.*/
	touch_i2c_read(ts->client, ANALOG_COMMAND_REG, 1, &data);
	data = data | 0x04;
	touch_i2c_write(ts->client, ANALOG_COMMAND_REG, 1, &data);
	msleep(WAIT_TIME);

	/*Apply ForceCal.*/
	touch_i2c_read(ts->client, ANALOG_COMMAND_REG, 1, &data);
	data = data | 0x02;
	touch_i2c_write(ts->client, ANALOG_COMMAND_REG, 1, &data);
	msleep(WAIT_TIME);

	return NO_ERROR;
}
示例#2
0
void	touch_information_display(struct touch *ts)
{
#if 0
	printk("--------------------------------------------------------\n");
	printk("           TOUCH SCREEN INFORMATION\n");
	printk("--------------------------------------------------------\n");
#endif
	touch_wake_control(ts);
	if(touch_i2c_read(ts->client, REG_TS_FIRMWARE_ID, 1, &ts->fw_version) == 1)
		printk("LGD TOUCH F/W Version = %d.%02d\n", ts->fw_version/100, ts->fw_version%100);
#if 0		
	printk("TOUCH FINGRES MAX = %d\n", ts->pdata->max_fingers);
	printk("TOUCH ABS X MAX = %d, TOUCH ABS X MIN = %d\n", ts->pdata->abs_max_x, ts->pdata->abs_min_x);
	printk("TOUCH ABS Y MAX = %d, TOUCH ABS Y MIN = %d\n", ts->pdata->abs_max_y, ts->pdata->abs_min_y);

	if(ts->pdata->touch_max)
		printk("TOUCH MAJOR MAX = %d, TOUCH MAJOR MIN = %d\n", ts->pdata->touch_max, ts->pdata->touch_min);
	if(ts->pdata->width_max)
		printk("TOUCH WIDTH MAX = %d, TOUCH WIDTH MIN = %d\n", ts->pdata->width_max, ts->pdata->width_min);
	if(ts->pdata->id_max)		
		printk("TOUCH ID MAX = %d, TOUCH ID MIN = %d\n", ts->pdata->id_max, ts->pdata->id_min);
	else
		printk("TOUCH ID MAX = %d, TOUCH ID MIN = %d\n", ts->pdata->max_fingers, 0);

	if(ts->pdata->gpio_init)	
		printk("GPIO Early Init Function Implemented\n");
	if(ts->pdata->reset_gpio)	
		printk("H/W Reset Function Implemented\n");
	if(ts->pdata->wake_gpio)	
		printk("H/W Wake-up control Function Implemented\n");

	printk("--------------------------------------------------------\n");
#endif
}
static int ReadTRexShort(struct synaptics_ts_data *ts)
{
	unsigned char TRX_Short[7] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00};

	int MaxArrayLength = RxChNum * TxChNum * 2;
	int i, j = 0;
	int mask = 0x01;
	int value;	// Hardcode for Waikiki Test and it support up to 54 Tx
	int result = LGTC_SUCCESS;
	u8 buf[40] = {0};
	u8 cap_data[MaxArrayLength];

	touch_i2c_read(ts->client, REPORT_DATA_REG, MaxArrayLength, cap_data);

	WRITE_BUFFER(f54_wlog_buf, "TRex Short Test\n");

	for (i = 0; i < 7; i++) {
		int short_num = 0;

		value = cap_data[i];
		cap_data[i] = 0;

		for (j = 0; j < 8; j++) {
			if((value & mask) == 1) {
				cap_data[i] = cap_data[i] + (unsigned char)pow_func(2, (7 - j));
				short_num += sprintf(buf+short_num, "%d ", (i * 8 + (7 - j)));
			}

			value >>= 1;
		}

		WRITE_BUFFER(f54_wlog_buf, "TRex-TRex Short Test Data = %#x", cap_data[i]);

		if (short_num) {
			WRITE_BUFFER(f54_wlog_buf, " (Short TRx Number: ");
			WRITE_BUFFER(f54_wlog_buf, buf);
			WRITE_BUFFER(f54_wlog_buf, ")\n");
		}

		WRITE_BUFFER(f54_wlog_buf, "\n");
	}

	for(i = 0; i < 7; i++) {
		if(cap_data[i] != TRX_Short[i]) {
			result = LGTC_FAIL;
			break;
		}
	}

	if (result == LGTC_SUCCESS)
		WRITE_BUFFER(f54_wlog_buf, "\nTRex-TRex Short Test passed.\n\n");
	else
		WRITE_BUFFER(f54_wlog_buf, "\nTRex-TRex Short Test failed.\n\n");

	write_log(NULL, f54_wlog_buf);

	return result;
}
static int ReadHighResistance(struct synaptics_ts_data *ts)
{
	int MaxArrayLength = RxChNum * TxChNum * 2;
	int HighResistanceLowerLimit[3] = {-1000, -1000, -400};
	int HighResistanceUpperLimit[3] = {450, 450, 200};
	int maxRxpF, maxTxpF, minpF;
	int i = 0;
	int result = LGTC_SUCCESS;
	u8 cap_data[MaxArrayLength];
	short maxRx, maxTx, min;

	touch_i2c_read(ts->client, REPORT_DATA_REG, MaxArrayLength, cap_data);

	maxRx = ((short)cap_data[0] | (short)cap_data[1] << 8);
	maxTx = ((short)cap_data[2] | (short)cap_data[3] << 8);
	min = ((short)cap_data[4] | (short)cap_data[5] << 8);

	maxRxpF = maxRx;
	maxTxpF = maxTx;
	minpF = min;

	WRITE_BUFFER(f54_wlog_buf, "High Resistance Test\n");
	WRITE_BUFFER(f54_wlog_buf, "Max Rx Offset(pF) = %d\n", maxRxpF);
	WRITE_BUFFER(f54_wlog_buf, "Max Tx Offset(pF) = %d\n", maxTxpF);
	WRITE_BUFFER(f54_wlog_buf, "Min(pF) = %d\n", minpF);
	WRITE_BUFFER(f54_wlog_buf, "\n=====================================================\n");
	WRITE_BUFFER(f54_wlog_buf, "\tHigh Resistance Test\n");
	WRITE_BUFFER(f54_wlog_buf, "=====================================================\n");
	WRITE_BUFFER(f54_wlog_buf, " Parameters: ");
	WRITE_BUFFER(f54_wlog_buf, "%5d %5d %5d ", maxRxpF, maxTxpF, minpF);
	WRITE_BUFFER(f54_wlog_buf, "\n\n Limits(+) : ");

	for(i = 0; i < 3; i++)
		WRITE_BUFFER(f54_wlog_buf, "%5d ", HighResistanceUpperLimit[i]);

	WRITE_BUFFER(f54_wlog_buf, "\n Limits(-) : ");

	for(i = 0; i < 3; i++)
		WRITE_BUFFER(f54_wlog_buf, "%5d ", HighResistanceLowerLimit[i]);

	WRITE_BUFFER(f54_wlog_buf, "\n-----------------------------------------------------\n");

	if (maxRxpF > HighResistanceUpperLimit[0] || maxRxpF < HighResistanceLowerLimit[0])
		result = LGTC_FAIL;
	if (maxTxpF > HighResistanceUpperLimit[1] || maxTxpF < HighResistanceLowerLimit[1])
		result = LGTC_FAIL;
	if (minpF > HighResistanceUpperLimit[2] || minpF < HighResistanceLowerLimit[2])
		result = LGTC_FAIL;

	if (result == LGTC_FAIL)
		WRITE_BUFFER(f54_wlog_buf, "HighResistance Test failed.\n\n");
	else
		WRITE_BUFFER(f54_wlog_buf, "HighResistance Test passed.\n\n");

	write_log(NULL, f54_wlog_buf);

	return result;
}
int Read8BitRegisters(unsigned short regAddr, unsigned char *data, int length)
{
	// I2C read
	int rst = 0;
	
	rst = touch_i2c_read(ds4_i2c_client, regAddr, length, data);
	
	return rst;
}
void device_I2C_read(unsigned char add, unsigned char *value, unsigned short len)
{
	// I2C read
	if(ds4_i2c_client == NULL) {
		printk("[Touch] ds4_i2c_client is NULL\n");
		return;
	} else {
		if(touch_i2c_read(ds4_i2c_client, add, len, value) < 0) return;
	}
}
int touch_bus_read(struct device *dev, struct touch_bus_msg *msg)
{
	struct touch_core_data *ts = to_touch_core(dev);
	int ret = 0;

	if (ts->bus_type == HWIF_I2C)
		ret = touch_i2c_read(to_i2c_client(dev), msg);
	else if (ts->bus_type == HWIF_SPI)
		ret = touch_spi_read(to_spi_device(dev), msg);

	return ret;
}
示例#8
0
//[*]--------------------------------------------------------------------------------------------------[*]
// firmware version display
//[*]--------------------------------------------------------------------------------------------------[*]
static	ssize_t show_fw_version			(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct touch 	*ts = dev_get_drvdata(dev);

	if(!err_mask(ts->fw_status) && !(ts->fw_status & STATUS_BOOT_MODE))	{
		touch_disable(ts);
		touch_wake_control(ts);
		touch_i2c_read(ts->client, REG_TS_FIRMWARE_ID, 1, &ts->fw_version);
		touch_enable(ts);
	}

	return sprintf(buf, "%d\n", ts->fw_version);
}
// Construct data with Report Type #20 data
static int ReadRawData(struct synaptics_ts_data *ts)
{
	int MaxArrayLength = RxChNum * TxChNum * 2;
	int i,j,k = 0;
	int result = LGTC_SUCCESS;
	u8 cap_data[MaxArrayLength];

	touch_i2c_read(ts->client, REPORT_DATA_REG, MaxArrayLength, cap_data);

	WRITE_BUFFER(f54_wlog_buf, "Full Raw Capacitance Test\n");
	WRITE_BUFFER(f54_wlog_buf, "\nInfo: Tx = %d Rx = %d \n", TxChNum, RxChNum);
	WRITE_BUFFER(f54_wlog_buf, "Image Data : \n");
	WRITE_BUFFER(f54_wlog_buf, "==========================================================================================================\n         :");

	for (i = 0; i < RxChNum; i++)
		WRITE_BUFFER(f54_wlog_buf, "%5d ", i);

	WRITE_BUFFER(f54_wlog_buf, "\n----------------------------------------------------------------------------------------------------------\n");

	for (i = 0; i < TxChNum; i++) {
		WRITE_BUFFER(f54_wlog_buf, "   %5d : ", i);
		for (j = 0; j < RxChNum; j++) {
			full_raw_data[i][j] = ((short)cap_data[k] | (short)cap_data[k+1] << 8);

			WRITE_BUFFER(f54_wlog_buf, "%5d ", full_raw_data[i][j]);
			k = k + 2;
		}
		WRITE_BUFFER(f54_wlog_buf, "\n");
	}
	WRITE_BUFFER(f54_wlog_buf, "------------------------------------------------------------------------------------------------------------\n");

	//Compare 2D area
	for (j = 0; j < RxChNum; j++) {
		for (i = 0; i < TxChNum; i++) {
			if ((full_raw_data[i][j] < LowerImageLimit[i][j]) || (full_raw_data[i][j] > UpperImageLimit[i][j])) {
				WRITE_BUFFER(f54_wlog_buf, "FAIL, %d,%d,%d\n", LowerImageLimit[i][j], UpperImageLimit[i][j], full_raw_data[i][j]);
				result = LGTC_FAIL;
				break;
			}
		}
	}

	if (result == LGTC_SUCCESS)
		WRITE_BUFFER(f54_wlog_buf, "\nFull Raw Capacitance Image Test passed.\n\n");
	else
		WRITE_BUFFER(f54_wlog_buf, "\nFull Raw Capacitance Image Test failed.\n\n");

	write_log(NULL, f54_wlog_buf);

	return result;
}
static error_type ReadChCount(struct synaptics_ts_data *ts)
{
	u8 data[64] = {0};
	u8 rx_max_cnt = 0;
	u8 tx_max_cnt = 0;
	int i;

	RxChNum = TxChNum = 0;

	/*Read channel count*/
	touch_i2c_read(ts->client, RX_CH_CNT_REG, 1, &rx_max_cnt);
	touch_i2c_read(ts->client, TX_CH_CNT_REG, 1, &tx_max_cnt);

	DO_SAFE(touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, ts->sensor_fc.function_page), error);

	touch_i2c_read(ts->client, ts->sensor_fc.dsc.data_base+1, rx_max_cnt, data);

	for (i = 0; i < (int)rx_max_cnt; i++) {
		if (data[i] != 0xFF)
			RxChNum++;
	}

	touch_i2c_read(ts->client, ts->sensor_fc.dsc.data_base+2, tx_max_cnt, data);

	for (i = 0; i < (int)tx_max_cnt; i++) {
		if (data[i] != 0xFF)
			TxChNum++;
	}

	LGTC_DBG("rx ch cnt = %d, tx ch cnt = %d\n", RxChNum, TxChNum);

	DO_SAFE(touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, ts->analog_fc.function_page), error);

	return NO_ERROR;
error:
	return ERROR;
}
示例#11
0
//[*]--------------------------------------------------------------------------------------------------[*]
static void 	touch_work(struct touch *ts)
{
	int				i, report_id, report_cnt;
	unsigned char	rdata[MAX_PROTOCOL_SIZE +1], length;
	
	touch_i2c_read(ts->client, REG_TS_LENGTH, 1, &length);

#if defined(DEBUG_TOUCH)
//	printk("%s : REG_TS_LENGTH = %d\n", __func__, length);
#endif	
	if(length > MAX_PROTOCOL_SIZE)		return;
	
	if(length)	{
		touch_i2c_read(ts->client, REG_TS_DATA, length, &rdata[0]);
	
		report_id 	= ((rdata[1] << 4) | rdata[0]) & 0x3FF;
		
#if defined(DEBUG_TOUCH)
//	printk("%s : REPORT ID = 0x%04X\n", __func__, report_id);
#endif	
		for(i = 0, report_cnt = 0; i < ts->pdata->max_fingers; report_id >>= 1, i++)	{
			if(report_id & 0x01)	{
				ts->finger[i].event = TS_EVENT_MOVE;
				ts->finger[i].x 	= ((rdata[2 + (report_cnt * 3)] << 4) & 0xF00) | rdata[2 + (report_cnt * 3) + 1];
				ts->finger[i].y 	= ((rdata[2 + (report_cnt * 3)] << 8) & 0xF00) | rdata[2 + (report_cnt * 3) + 2];
				report_cnt++;
			}
			else	{
				if(ts->finger[i].event == TS_EVENT_MOVE)	ts->finger[i].event = TS_EVENT_RELEASE;
				else										ts->finger[i].event = TS_EVENT_UNKNOWN;
			}
		}
		// Touch screen status & data struct
		touch_report(ts);
	}
}
示例#12
0
//[*]--------------------------------------------------------------------------------------------------[*]
//[*]--------------------------------------------------------------------------------------------------[*]
//   disablel (1 -> disable irq, cancel work, 0 -> enable irq), show irq state
//[*]--------------------------------------------------------------------------------------------------[*]
static	ssize_t show_idle				(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct touch 	*ts = dev_get_drvdata(dev);
	unsigned char	idle = 0;

	if(!err_mask(ts->fw_status) && !(ts->fw_status & STATUS_BOOT_MODE))	{
		touch_disable(ts);
		touch_wake_control(ts);
		if(touch_i2c_read(ts->client, REG_TS_IDLE_RD, 1, &idle) == 1)		{
			touch_enable(ts);
			return sprintf(buf, "%d\n", idle);
		}
		touch_enable(ts);
	}
	return sprintf(buf, "%d\n", -1);
}
static int readRMI(struct i2c_client *client, u8 uRmiAddress, u8 *data, unsigned int length)
{
	return touch_i2c_read(client, uRmiAddress, length, data);
}
unsigned char F54_HighResistance(struct i2c_client *client, char *buf)
{
	struct synaptics_ts_data* ts = (struct synaptics_ts_data*)get_touch_handle(client);

	unsigned char imageBuffer[6];
	short resistance[3];
	int i, result = 0, iRtn = 0;
	unsigned char command = 0;
	int resistanceLimit[3][2] = {{-1000, 450}, {-1000, 450}, {-400, 20}};

	TOUCH_DEBUG_MSG("%s START!! disable_irq_nosync!! \n", __func__);
	disable_irq_nosync(ts->client->irq);

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x01);
	touch_i2c_write_byte(ts->client, F54_DATA_BASE, 0x04);
	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x04);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x02);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_write_byte(ts->client, F54_DATA_LOWINDEX, 0x00);
	touch_i2c_write_byte(ts->client, F54_DATA_HIGHINDEX, 0x00);

	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x01);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_read(ts->client, F54_DATA_BUFFER, 6, &imageBuffer[0]);

	printk("Parameters:\t");
	if (buf != NULL) iRtn += sprintf(buf + iRtn, "Parameters:\t");
	for (i=0; i<3; i++) {
		resistance[i] = (short)((imageBuffer[i*2+1] << 8) | imageBuffer[i*2]);
		printk("%d.%03d,\t\t", resistance[i]/1000, resistance[i]%1000);
		if (buf != NULL) iRtn += sprintf(buf + iRtn, "%d.%03d,\t\t", resistance[i]/1000, resistance[i]%1000);
		if ((resistance[i] >= resistanceLimit[i][0]) && (resistance[i] <= resistanceLimit[i][1])) result ++;
	}
	printk("\n");
	if (buf != NULL) iRtn += sprintf(buf + iRtn, "\n");

	printk("Limits:\t\t");
	if (buf != NULL) iRtn += sprintf(buf + iRtn, "Limits:\t\t");
	for (i=0; i<3; i++) {
		printk("%d.%03d,%d.%03d\t", resistanceLimit[i][0]/1000, resistanceLimit[i][0]%1000, resistanceLimit[i][1]/1000, resistanceLimit[i][1]%1000);
		if (buf != NULL) iRtn += sprintf(buf + iRtn, "%d.%03d,%d.%03d\t", resistanceLimit[i][0]/1000, resistanceLimit[i][0]%1000, resistanceLimit[i][1]/1000, resistanceLimit[i][1]%1000);
	}
	printk("\n");
	if (buf != NULL) iRtn += sprintf(buf + iRtn, "\n");

	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x02);
	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x00);
	touch_i2c_write_byte(ts->client, F01_CMD_BASE, 0x01);
	mdelay(200);
	touch_i2c_read(ts->client, F01_DATA_BASE + 1, sizeof(command), &command);

	if (result == 3) {
		printk("Test Result : Pass\n");
		if (buf != NULL) iRtn += sprintf(buf + iRtn, "Test Result : Pass\n");
	} else {
		printk("Test Result : Fail\n");
		if (buf != NULL) iRtn += sprintf(buf + iRtn, "Test Result : Fail\n");
	}
	enable_irq(ts->client->irq);
	TOUCH_DEBUG_MSG("%s END!! enable_irq!!!\n", __func__);
	return iRtn;
}
unsigned char F54_RxOpenReport(struct i2c_client *client)
{
	struct synaptics_ts_data* ts = (struct synaptics_ts_data*)get_touch_handle(client);
	int result = 0;
	/*short DiagonalLowerLimit = 900;*/
	/*short DiagonalUpperLimit = 1100;*/
	short OthersLowerLimit = -100;
	short OthersUpperLimit = 100;

	int i, j, k;
	int length;
	unsigned char command = 0;

	TOUCH_DEBUG_MSG("%s START!! disable_irq_nosync!! \n", __func__);
	disable_irq_nosync(ts->client->irq);

	for (j=0; j<CFG_F54_RXCOUNT; j++)
		printk("R%d\t", j);
	printk("\n");

	length = CFG_F54_RXCOUNT * CFG_F54_TXCOUNT * 2;

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x01);
	touch_i2c_write_byte(ts->client, F54_DATA_BASE, 0x0E);
	touch_i2c_write_byte(ts->client, F54_CBC_SETTINGS, 0x00);
	touch_i2c_write_byte(ts->client, NOISE_MITIGATION, 0x01);
	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x04);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);
	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x02);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_write_byte(ts->client, F54_DATA_LOWINDEX, 0x00);
	touch_i2c_write_byte(ts->client, F54_DATA_HIGHINDEX, 0x00);

	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x01);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_read(ts->client, F54_DATA_BUFFER, length, &ImageBuffer[0]);
	k = 0;
	for (i = 0; i < CFG_F54_TXCOUNT; i++)
	{
		for (j = 0; j < CFG_F54_RXCOUNT; j++)
		{
			ImageArray2[i][j] = (short)(ImageBuffer[k] | (ImageBuffer[k+1] << 8));
			k = k + 2;
		}
	}

	length = CFG_F54_RXCOUNT * (CFG_F54_RXCOUNT-CFG_F54_TXCOUNT) * 2;
	touch_i2c_write_byte(ts->client, F54_DATA_BASE, 0x12);
	touch_i2c_write_byte(ts->client, F54_DATA_LOWINDEX, 0x00);
	touch_i2c_write_byte(ts->client, F54_DATA_HIGHINDEX, 0x00);
	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x01);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_read(ts->client, F54_DATA_BUFFER, length, &ImageBuffer[0]);

	k = 0;
	for (i = 0; i < (CFG_F54_RXCOUNT-CFG_F54_TXCOUNT); i++)
	{
		for (j = 0; j < CFG_F54_RXCOUNT; j++)
		{
			ImageArray2[CFG_F54_TXCOUNT+i][j] = (short)(ImageBuffer[k] | (ImageBuffer[k+1] << 8));
			k = k + 2;
		}
	}

#if 1
	for (i = 0; i < CFG_F54_RXCOUNT; i++)
	{
		printk("R%d\t", i);
		for (j = 0; j < CFG_F54_RXCOUNT; j++)
		{
			if((ImageArray2[i][j] <= OthersUpperLimit) && (ImageArray2[i][j] >= OthersLowerLimit)) {
				result ++;
				printk("%d\t", ImageArray2[i][j]);
			} else {
				printk("%d(*)\t", ImageArray2[i][j]);
			}
		}
		printk("\n");
	}
#else
	for (i = 0; i < CFG_F54_RXCOUNT; i++)
	{
		printk("R%d\t", i);
		for (j = 0; j < CFG_F54_RXCOUNT; j++)
		{
			if (i == j)
			{
				if((ImageArray[i][j] <= DiagonalUpperLimit) && (ImageArray[i][j] >= DiagonalLowerLimit))
				{
					result++; //Pass
					printk("%d\t", ImageArray[i][j]);
				}
				else
				{
					printk("%d(*)\t", ImageArray[i][j]);
				}
			}
			else
			{
				if((ImageArray[i][j] <= OthersUpperLimit) && (ImageArray[i][j] >= OthersLowerLimit))
				{
					result++; //Pass
					printk("%d\t", ImageArray[i][j]);
				}
				else
				{
					printk("%d(*)\t", ImageArray[i][j]);
				}
			}
		}
		printk("\n");
	}
#endif
	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x01);
	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x00);
	touch_i2c_write_byte(ts->client, F01_CMD_BASE, 0x01);
	mdelay(200);
	touch_i2c_read(ts->client, F01_DATA_BASE + 1, sizeof(command), &command);

	if (result == CFG_F54_RXCOUNT* CFG_F54_RXCOUNT) {
		printk("Test Result : Pass\n");
	} else {
		printk("Test Result : Fail\n");
	}

	enable_irq(ts->client->irq);
	TOUCH_DEBUG_MSG("%s END!! enable_irq!!!\n", __func__);

	return 0;
}
unsigned char F54_TxOpenReport(struct i2c_client *client)
{
	struct synaptics_ts_data* ts = (struct synaptics_ts_data*)get_touch_handle(client);

	unsigned char ImageBuffer[CFG_F54_TXCOUNT];
	unsigned char ImageArray[CFG_F54_TXCOUNT];
	unsigned char result = 0;
	int i, k;
	int shift;
	unsigned char command = 0;

	TOUCH_DEBUG_MSG("%s START!! disable_irq_nosync!! \n", __func__);
	disable_irq_nosync(ts->client->irq);

	for (i=0; i<CFG_F54_TXCOUNT; i++) {
		ImageArray[i] = 0;
	}

	for (i=0; i<CFG_F54_TXCOUNT; i++) {
		ImageBuffer[i] = 0;
	}

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x01);
	touch_i2c_write_byte(ts->client, F54_DATA_BASE, 0x0F);

	touch_i2c_write_byte(ts->client, F54_DATA_LOWINDEX, 0x00);
	touch_i2c_write_byte(ts->client, F54_DATA_HIGHINDEX, 0x00);

	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x01);

	do {
		mdelay(1);
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_read(ts->client, F54_DATA_BUFFER, 2, &ImageBuffer[0]);

	k = 0;
	for (i=0; i<CFG_F54_TXCOUNT; i++) {
		k = i / 8;
		shift = i % 8;
		if ( ImageBuffer[k] & (1 << shift) ) ImageArray[i] = 0;
	}

	printk("Column:\t");
	for (i=0; i< CFG_F54_TXCOUNT; i++) {
		printk("Tx%d,\t", i);
	}
	printk("\n");

	printk("0:\t");
	for (i=0; i<CFG_F54_TXCOUNT; i++) {
		if (!ImageArray[i]) {
			result++;
			printk("%d,\t", ImageArray[i]);
		} else {
			printk("%d(*),\t", ImageArray[i]);
		}
	}
	printk("\n");

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x00);
	touch_i2c_write_byte(ts->client, F01_CMD_BASE, 0x01);
	mdelay(200);
	touch_i2c_read(ts->client, F01_DATA_BASE + 1, sizeof(command), &command);

	if (result == CFG_F54_TXCOUNT) {
		printk("Test Result : Pass\n");
	} else {
		printk("Test Result : Fail\n");
	}

	enable_irq(ts->client->irq);
	TOUCH_DEBUG_MSG("%s END!! enable_irq!!!\n", __func__);

	return 0;
}
int F54_FullRawCap(struct i2c_client *client, int mode, char *buf)
{
	struct synaptics_ts_data* ts = (struct synaptics_ts_data*)get_touch_handle(client);

	int i, j, k, iRtn = 0;
	unsigned short length;
	unsigned char numberOfTx;
	unsigned char numberOfRx;

	unsigned char command = 0;

	TOUCH_DEBUG_MSG("%s START!! disable_irq_nosync!! \n", __func__);
	disable_irq_nosync(ts->client->irq);

	numberOfTx = CFG_F54_TXCOUNT;
	numberOfRx = CFG_F54_RXCOUNT;

	TOUCH_DEBUG_MSG("numberOfTx : %d, numberOfRx : %d\n", numberOfTx, numberOfRx);
	length = numberOfTx * numberOfRx* 2;

	// Set report mode to to run the AutoScan
	if(mode >= 0 && mode < 4)	command = 0x03;
	if(mode == 4)				command = 0x02;

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x01);
	touch_i2c_write_byte(ts->client, F54_DATA_BASE, command);

	// Force update & Force cal
	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x06);

	do {
		mdelay(1); //wait 1ms
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	// Enabling only the analog image reporting interrupt, and turn off the rest
	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x00);
	touch_i2c_write_byte(ts->client, 0x14, 0x08);

	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x01);
	command = 0x00;
	touch_i2c_write_byte(ts->client, F54_DATA_BASE + 1, 0x00);
	touch_i2c_write_byte(ts->client, F54_DATA_BASE + 2, 0x00);

	// Set the GetReport bit to run the AutoScan
	touch_i2c_write_byte(ts->client, F54_COMMAND_BASE, 0x01);

	// Wait until the command is completed
	do {
		mdelay(1); //wait 1ms
		touch_i2c_read(ts->client, F54_COMMAND_BASE, sizeof(command), &command);
	} while (command != 0x00);

	touch_i2c_read(ts->client, F54_DATA_BASE + 3, length, &ImageBuffer[0]);

	TOUCH_DEBUG_MSG("numberOfTx : %d, numberOfRx : %d\n", numberOfTx, numberOfRx);

	switch(mode)
	{
		case 3:
		case 4:
			k = 0;
			for (i = 0; i < numberOfTx; i++)
			{
				for (j = 0; j < numberOfRx; j++)
				{
					ImageArray[i][j] = (short)(ImageBuffer[k] | (ImageBuffer[k+1] << 8));
					k = k + 2;
				}
			}
			// Print Capacitance Imgae for getting log for Excel format
			printk("\n\t");
			/*if (buf != NULL) iRtn += sprintf(buf + iRtn, "RX : ");*/
			for (j = 0; j < numberOfRx; j++) {
				printk("RX%d\t", j);
				/*if (buf != NULL) iRtn += sprintf(buf + iRtn, "%d  ", j);*/
			}
			printk("\n");
			/*if (buf != NULL) iRtn += sprintf(buf + iRtn, "\n");*/

			for (i = 0; i < numberOfTx; i++)
			{
				printk("TX%d\t", i);
				/*if (buf != NULL) iRtn += sprintf(buf + iRtn, "TX%d : ", i);*/
				for (j = 0; j < numberOfRx; j++)
				{
					if (mode == 3) {
						printk("%d.%03d\t", ImageArray[i][j]/1000, ImageArray[i][j]%1000);
						/*if (buf != NULL) iRtn += sprintf(buf + iRtn, "%d.%01d ", ImageArray[i][j]/1000, (ImageArray[i][j]%1000)/100);*/
					} else if(mode == 4) {
						printk("%d\t", ImageArray[i][j]);
						/*if (buf != NULL) iRtn += sprintf(buf + iRtn, "%d ", ImageArray[i][j]);*/
					}
				}
				printk("\n");
				/*if (buf != NULL) iRtn += sprintf(buf + iRtn, "\n");*/
			}
			break;

		default:
			break;
	}

	//Reset
	touch_i2c_write_byte(ts->client, PAGE_SELECT_REG, 0x00);
	touch_i2c_write_byte(ts->client, F01_CMD_BASE, 0x01);
	mdelay(200);
	touch_i2c_read(ts->client, F01_DATA_BASE + 1, sizeof(command), &command);

	enable_irq(ts->client->irq);
	TOUCH_DEBUG_MSG("%s END!! enable_irq!!!\n", __func__);

	return iRtn;
}
int Read8BitRegisters(unsigned short regAddr, unsigned char *data, int length)
{
	return touch_i2c_read(ds4_i2c_client, regAddr, length, data);
}