예제 #1
0
static int check_debug_data(struct melfas_ts_data *ts)
{
	u8 write_buffer[6];
	u8 read_buffer[2];
	int sensing_line, exciting_line;
	int gpio = ts->pdata->gpio_int;
	int count = 0;

	disable_irq(ts->client->irq);
	/* enter the debug mode */
	write_buffer[0] = 0xB0;
	write_buffer[1] = 0x1A;
	write_buffer[2] = 0x0;
	write_buffer[3] = 0x0;
	write_buffer[4] = 0x0;
	write_buffer[5] = 0x01;
	melfas_i2c_write(ts->client, (char *)write_buffer, 6);

	/* wating for the interrupt */
	while (gpio_get_value(gpio)) {
		pr_info(".");
		udelay(100);
		count++;
		if (count == 100000) {
			enable_irq(ts->client->irq);
			return -1;
		}
	}

	if (debug_print)
		pr_info("[TSP] read dummy\n");

	/* read the dummy data */
	melfas_i2c_read(ts->client, 0xBF, 2, read_buffer);

	if (debug_print)
		pr_info("[TSP] read inspenction data\n");
	write_buffer[5] = 0x02;
	for (sensing_line = 0; sensing_line < X_LINE; sensing_line++) {
		for (exciting_line = 0; exciting_line < Y_LINE;\
			exciting_line++) {
			write_buffer[2] = exciting_line;
			write_buffer[3] = sensing_line;
			melfas_i2c_write(ts->client, (char *)write_buffer, 6);
			melfas_i2c_read(ts->client, 0xBF, 2, read_buffer);
			reference_data[exciting_line + sensing_line * Y_LINE] =
			    (read_buffer[1] & 0xf) << 8 | read_buffer[0];
		}
	}
	pr_info("[TSP] Reading data end.\n");

	msleep(200);
	melfas_ts_suspend(ts->client, PMSG_SUSPEND);

	msleep(200);
	melfas_ts_resume(ts->client);

	enable_irq(ts->client->irq);
	return 0;
}
예제 #2
0
static void melfas_ts_early_suspend(struct early_suspend *h)
{
	struct melfas_ts_data *ts;

	ts = container_of(h, struct melfas_ts_data, early_suspend);
	melfas_ts_suspend(ts->client, PMSG_SUSPEND);
}
예제 #3
0
static ssize_t
set_all_refer_mode_show(struct device *dev,
			struct device_attribute *attr, char *buf)
{
	int status = 0;
	int i;
	struct melfas_ts_data *ts = dev_get_drvdata(dev);

	if (!tsp_enabled)
		return 0;

	for (i = 0; i < 3; i++) {
		if (!check_debug_data(ts)) {
			status = 0;
			break;
		} else {
			pr_info("[TSP] check_debug_data Error try=%d", i);
			msleep(200);
			melfas_ts_suspend(ts->client, PMSG_SUSPEND);

			msleep(200);
			melfas_ts_resume(ts->client);
			msleep(300);
			status = 1;
		}
	}
	if (!status) {
		for (i = 0; i < X_LINE * Y_LINE; i++) {
			/* out of range */
			if (reference_data[i] < 30) {
				status = 1;
				break;
			}

			if (debug_print) {
				if (0 == i % X_LINE)
					pr_info("[TSP]\n");
				pr_info("[TSP] %5u  ", reference_data[i]);
			}
		}
	} else {
		pr_info
		    ("[TSP] all_refer_show func & check_debug_data error[%d]",
		     status);
		return sprintf(buf, "%u\n", status);
	}

	pr_info("[TSP] all_refer_show func [%d]", status);
	return sprintf(buf, "%u\n", status);
}
예제 #4
0
static ssize_t set_tsp_module_off_show(struct device *dev, struct device_attribute *attr, char *buf)
{
	int ret;
	struct melfas_ts_data *ts = dev_get_drvdata(dev);

	ret = melfas_ts_suspend(ts->client, PMSG_SUSPEND);

	if (ret  = 0)
		*buf = '1';
	else
		*buf = '0';

	return 0;
}
예제 #5
0
static void check_intensity_data(struct melfas_ts_data *ts, int num)
{
	u8 write_buffer[6];
	u8 read_buffer[2];
	int sensing_line, exciting_line;
	int gpio = ts->pdata->gpio_int;
	int i = 0, ret;

	if (0 == reference_data[0]) {
		disable_irq(ts->client->irq);

		/* enter the debug mode */
		write_buffer[0] = 0xB0;
		write_buffer[1] = 0x1A;
		write_buffer[2] = 0x0;
		write_buffer[3] = 0x0;
		write_buffer[4] = 0x0;
		write_buffer[5] = 0x01;
		melfas_i2c_write(ts->client, (char *)write_buffer, 6);

		/* wating for the interrupt*/
		while (gpio_get_value(gpio)) {
			pr_info(".");
			udelay(100);
		}

		/* read the dummy data */
		melfas_i2c_read(ts->client, 0xBF, 2, read_buffer);

		if (debug_print)
			pr_info("[TSP] read the dummy data\n");

		write_buffer[5] = 0x07;
		for (sensing_line = 0; sensing_line < X_LINE; sensing_line++) {
			for (exciting_line = 0; exciting_line < Y_LINE;
							exciting_line++) {
				write_buffer[2] = exciting_line;
				write_buffer[3] = sensing_line;
				melfas_i2c_write(ts->client,
						(char *)write_buffer, 6);
				melfas_i2c_read(ts->client, 0xBF, 2,
								read_buffer);
				reference_data[exciting_line +
						sensing_line * Y_LINE] =
					(read_buffer[1] & 0xf) << 8
						| read_buffer[0];
			}
		}
		msleep(200);
		melfas_ts_suspend(ts->client, PMSG_SUSPEND);

		msleep(200);
		melfas_ts_resume(ts->client);

		msleep(100);
		enable_irq(ts->client->irq);
		msleep(100);
	}

	disable_irq(ts->client->irq);
	release_all_fingers(ts);

	write_buffer[0] = 0xB0;
	write_buffer[1] = 0x1A;
	write_buffer[2] = 0x0;
	write_buffer[3] = 0x0;
	write_buffer[4] = 0x0;
	write_buffer[5] = 0x04;
	for (sensing_line = 0; sensing_line < X_LINE; sensing_line++) {
		for (exciting_line = 0; exciting_line < Y_LINE;\
			exciting_line++) {
			write_buffer[2] = exciting_line;
			write_buffer[3] = sensing_line;
			melfas_i2c_write(ts->client, (char *)write_buffer, 6);
			melfas_i2c_read(ts->client, 0xBF, 2, read_buffer);
			intensity_data[exciting_line + sensing_line * Y_LINE] =
			    (read_buffer[1] & 0xf) << 8 | read_buffer[0];
		}
	}
	enable_irq(ts->client->irq);
}
예제 #6
0
static void check_intensity_data(struct melfas_ts_data *ts)
{

	u8 write_buffer[6];
	u8 read_buffer[2];
	int sensing_line, exciting_line;
	int gpio = ts->client->irq - NR_MSM_IRQS;

	disable_irq(ts->client->irq);
	if (0 == inspection_data[0]) {
		/* enter the debug mode */
		write_buffer[0] = 0xA0;
		write_buffer[1] = 0x1A;
		write_buffer[2] = 0x0;
		write_buffer[3] = 0x0;
		write_buffer[4] = 0x0;
		write_buffer[5] = 0x01;
		melfas_i2c_write(ts->client, (char *)write_buffer, 6);

		/* wating for the interrupt*/
		while (gpio_get_value(gpio)) {
			printk(".");
			udelay(100);
		}

		/* read the dummy data */
		melfas_i2c_read(ts->client, 0xA8, 2, read_buffer);

		write_buffer[5] = 0x02;
		for (sensing_line = 0; sensing_line < 14; sensing_line++) {
			for (exciting_line =0; exciting_line < 26; exciting_line++) {
				write_buffer[2] = exciting_line;
				write_buffer[3] = sensing_line;
				melfas_i2c_write(ts->client, (char *)write_buffer, 6);
				melfas_i2c_read(ts->client, 0xA8, 2, read_buffer);
				inspection_data[exciting_line + sensing_line * 26] =
					(read_buffer[1] & 0xf) << 8 | read_buffer[0];
			}
		}
		melfas_ts_suspend(ts->client, PMSG_SUSPEND);
		msleep(200);
		melfas_ts_resume(ts->client);
	}

	write_buffer[0] = 0xA0;
	write_buffer[1] = 0x1A;
	write_buffer[4] = 0x0;
	write_buffer[5] = 0x04;
	for (sensing_line = 0; sensing_line < 14; sensing_line++) {
		for (exciting_line =0; exciting_line < 26; exciting_line++) {
			write_buffer[2] = exciting_line;
			write_buffer[3] = sensing_line;
			melfas_i2c_write(ts->client, (char *)write_buffer, 6);
			melfas_i2c_read(ts->client, 0xA8, 2, read_buffer);
			lntensity_data[exciting_line + sensing_line * 26] =
				(read_buffer[1] & 0xf) << 8 | read_buffer[0];
		}
	}
	enable_irq(ts->client->irq);
/*
	pr_info("[TSP] lntensity data");
	int i;
	for (i = 0; i < 14*16; i++) {
		if (0 == i % 26)
			printk("\n");
		printk("%2u, ", lntensity_data[i]);
	}
*/
}