Ejemplo n.º 1
0
void print_tsp_event(finger_info *finger)
{
	int idx = finger->bit_field.id - 1;
	int press = finger->bit_field.udmg & PRESS_MSG_MASK;
	if ( idx < 0 ) {
		tsp_err("finger idx err! idx value : %d\n", idx);
		return;
	}

	if (press == PRESS_MSG_MASK) {
		if (tsp_touched[idx] == 0) { // touch down
			tsp_info("%s - %d (%d, %d)\n",
				 TOUCH_DOWN_MESSAGE, finger->bit_field.id,
				 finger->bit_field.x, finger->bit_field.y);
			tsp_touched[idx] = 1;
		} else {                    // touch move
			tsp_debug("%s   %d (%d, %d)\n",
				  TOUCH_MOVE_MESSAGE, finger->bit_field.id,
				  finger->bit_field.x, finger->bit_field.y);
		}
	} else {
		if (tsp_touched[idx] == 1) { // touch up
			tsp_info("%s - %d (%d, %d)\n",
				 TOUCH_UP_MESSAGE, finger->bit_field.id,
				 finger->bit_field.x, finger->bit_field.y);
			tsp_touched[idx] = 0;
		}
	}
}
int print_line_cmcs(int mode, s16 *buf16, char *buf)
{
	int i, j;
	int idx;
	int type;
	int count = 0;
	int key_index[5] = { 0, };
	int key_cnt = 0;
	char msg[128];

	CMCS_INFO *cmcs = (CMCS_INFO *)&ts_cmcs->cmcs;

	int tx_num = cmcs->ch.tx_num;
	int rx_num = cmcs->ch.rx_num;

	if ((mode == CMCS_FLAG_CM_SLOPE0) || (mode == CMCS_FLAG_CM_SLOPE1)) {
		if (cmcs->ch.key_rx)
			rx_num--;
		else
			tx_num--;
	}

	for (i = 0; i < tx_num; i++) {
		for (j = 0; j < rx_num; j++) {
			type = check_tsp_type(i, j);
			if ((type == TSP_CH_UNKNOWN) || (type == TSP_CH_UNUSED))
				continue;   // Ignore

			if ((mode == CMCS_FLAG_CM_SLOPE0) && (j == (rx_num - 1)))
				continue;
			else if ((mode == CMCS_FLAG_CM_SLOPE1) && (i == (tx_num - 1)))
				continue;

			idx = (i * cmcs->ch.rx_num) + j;

			if (type == TSP_CH_KEY) {
				key_index[key_cnt++] = idx;
				continue;
			}

			count += sprintf(msg, "%5d ", buf16[idx]);
			strcat(buf, msg);
		}
	}

	tsp_info("key cnt: %d\n", key_cnt);
	if ((mode != CMCS_FLAG_CM_SLOPE0) && (mode != CMCS_FLAG_CM_SLOPE1)) {
		tsp_info("key cnt: %d\n", key_cnt);
		for (i = 0; i < key_cnt; i++) {
			count += sprintf(msg, "%5d ", buf16[key_index[i]]);
			strcat(buf, msg);
		}
	}

	count += sprintf(msg, "\n");
	strcat(buf, msg);

	return count;
}
int ist30xx_parse_cmcs_buf(CMCS_INFO *cmcs, s16 *buf)
{
	int i, j;

	tsp_info(" %d * %d\n", cmcs->ch.tx_num, cmcs->ch.rx_num);
	for (i = 0; i < cmcs->ch.tx_num; i++) {
		tsp_info(" ");
		for (j = 0; j < cmcs->ch.rx_num; j++)
			printk("%5d ", buf[i * cmcs->ch.rx_num + j]);
		printk("\n");
	}

	return 0;
}
/* /sys/class/factory/tsp/close_tsp_test */
ssize_t factory_tsp_test_close_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{
	tsp_info("tsp test close\n");

	return snprintf(buf, TSP_BUF_SIZE, "%u\n", 0);
}
/* sysfs: /sys/class/touch/cmcs/cmcs_custom */
ssize_t ist30xx_cmcs_custom_show(struct device *dev, struct device_attribute *attr,
				 char *buf)
{
	int ret;
	int bin_size = 0;
	u8 *bin = NULL;
	const struct firmware *req_bin = NULL;

	ret = request_firmware(&req_bin, IST30XXB_CMCS_NAME, &ts_data->client->dev);
	if (ret)
		return sprintf(buf, "File not found, %s\n", IST30XXB_CMCS_NAME);

	bin = (u8 *)req_bin->data;
	bin_size = (u32)req_bin->size;

	ist30xx_get_cmcs_info(bin, bin_size);

	mutex_lock(&ist30xx_mutex);
	ret = ist30xx_cmcs_test(bin, bin_size);
	mutex_unlock(&ist30xx_mutex);

	release_firmware(req_bin);

	tsp_info("size: %d\n", sprintf(buf, (ret == 0 ? "OK\n" : "Fail\n")));

	return sprintf(buf, (ret == 0 ? "OK\n" : "Fail\n"));
}
/* /sys/class/factory/tsp/chip_name */
ssize_t factory_tsp_chip_name_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	int ret;

	ist30xx_disable_irq(ts_data);

	ret = ist30xx_cmd_run_device(ts_data->client);
	if (ret)
		return sprintf(buf, "NULL");

	ret = ist30xx_read_cmd(ts_data->client, CMD_GET_CHIP_ID, &ts_data->chip_id);
	if (ret)
		return sprintf(buf, "NULL");

	ist30xx_enable_irq(ts_data);

	if ((ts_data->chip_id != IST30XX_CHIP_ID) &&
	    (ts_data->chip_id != IST30XXA_CHIP_ID))
		return sprintf(buf, "NULL");

	tsp_info("tsp chip name: %s\n", IST30XX_CHIP_NAME);

	return sprintf(buf, "%s\n", IST30XX_CHIP_NAME);
}
Ejemplo n.º 7
0
int ist30xx_ts_on(void)
{
#if 1
	ist30xx_ldo_power_on(ts_data, true);
	msleep(50);
	return 0;
#else
//	struct ist30xx_ts_device *dev = NULL;
	int ret = 0;

//	dev = &ist30xx_ts_dev;

	ret = ts_data->power(ON);

	tsp_info("ist30xx_ts_on\n");

	if(ret < 0) {
		tsp_err("ist30xx_ts_on power on failed\n");
		goto err_power_failed;
	}

	ts_data->status.power = 1;

	msleep(30);

err_power_failed:
	return ret;
#endif
}
Ejemplo n.º 8
0
/* [email protected] */
void ist30xx_ts_reset(void)
{
	ist30xx_ts_off();
	ist30xx_ts_on();

	tsp_info("ist30xx_ts_reset\n");
}
/* /sys/class/factory/tsp/panel_vendor */
ssize_t factory_tsp_panel_vendor_show(struct device *dev,
				      struct device_attribute *attr, char *buf)
{
	int ret;
	u32 panel_vendor;

	ist30xx_disable_irq(ts_data);
	ret = ist30xx_cmd_run_device(ts_data->client);
	if (ret)
		return sprintf(buf, "NULL");

	ret = ist30xx_read_cmd(ts_data->client, CMD_GET_TSP_VENDOR, &panel_vendor);
	if (ret)
		return sprintf(buf, "NULL");
	/*
	 * TSP panel_vendor
	 * - ALPS     1
	 * - SUNTEL   2
	 * - TOVIS    3
	 * - ILJIN    4
	 * - SYNOPEX  5
	 * - TAEYANG  6
	 */

	ist30xx_enable_irq(ts_data);

	tsp_info("tsp panel vendor: %d\n", panel_vendor);

	return sprintf(buf, "%d\n", panel_vendor);
}
/* /sys/class/factory/tsp/intensity_logging_off */
ssize_t factory_tsp_intensity_log_off(struct device *dev,
				      struct device_attribute *attr, char *buf)
{
	tsp_info("tsp intensity logging off : Ready");

	return snprintf(buf, sizeof(char) * 16, "Ready\n");
}
/* /sys/class/factory/tsp/cmd_result */
ssize_t factory_tsp_cmd_result_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{
	tsp_info("tsp cmd result : Ready");

	return snprintf(buf, sizeof(char) * 16, "Ready\n");
}
/* /sys/class/factory/tsp/cmd */
ssize_t factory_tsp_cmd_store(struct device *dev,
			      struct device_attribute *attr, const char *buf, size_t size)
{
	tsp_info("tsp cmd store\n");

	return size;
}
/* /sys/class/factory/tkey/tkey_zvalue */
ssize_t factory_tkey_zvalue_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{
	tsp_info("tkey zvalue: %d\n", ist30xx_key_sensitivity);

	return snprintf(buf, sizeof(int), "%d\n", ist30xx_key_sensitivity);
}
Ejemplo n.º 14
0
int ist30xx_get_ver_info(struct ist30xx_data *data)
{
	int ret;

	data->fw.pre_ver = data->fw.ver;
	data->fw.ver = 0;

	ret = ist30xx_read_cmd(data->client, CMD_GET_CHIP_ID, &data->chip_id);
	if (ret)
		return ret;

	ret = ist30xx_read_cmd(data->client, CMD_GET_FW_VER, &data->fw.ver);
	if (ret)
		return ret;

	ret = ist30xx_read_cmd(data->client, CMD_GET_PARAM_VER, &data->param_ver);
	if (ret)
		return ret;

	tsp_info("Chip ID : %x F/W: %x Param: %x\n",
		 data->chip_id, data->fw.ver, data->param_ver);

	if ((data->chip_id != IST30XX_CHIP_ID) &&
	    (data->chip_id != IST30XXA_CHIP_ID))
		return -EPERM;

	return 0;
}
Ejemplo n.º 15
0
int ist30xx_ts_off(void)
{
#if 1
	ist30xx_ldo_power_on(ts_data, false);
	msleep(20);
	return 0;
#else
//	struct ist30xx_ts_device *dev = NULL;
	int ret = 0;

//	dev = &ist30xx_ts_dev;

	ret = ts_data->power(OFF);

	tsp_info("ist30xx_ts_off\n");

	if(ret < 0) {
		tsp_err("ist30xx_ts_off power off failed\n");
		goto err_power_failed;
	}

	ts_data->status.power = 0;

	msleep(10);

err_power_failed:
	return ret;
#endif
}
/* /sys/class/factory/tsp/base_range */
ssize_t factory_tsp_base_range_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{
	tsp_info("tsp base range: %d~%d\n",
	       IST30XX_MIN_BASELINE, IST30XX_MAX_BASELINE);

	return sprintf(buf, "%d,%d\n", IST30XX_MIN_BASELINE, IST30XX_MAX_BASELINE);
}
/* /sys/class/factory/tsp/raw_range */
ssize_t factory_tsp_raw_range_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{
	tsp_info("tsp raw range: %d~%d\n",
	       IST30XX_MIN_RAW_DATA, IST30XX_MAX_RAW_DATA);

	return sprintf(buf, "%d,%d\n", IST30XX_MIN_RAW_DATA, IST30XX_MAX_RAW_DATA);
}
/* /sys/class/factory/tkey/tkey_threshold */
ssize_t factory_tkey_threshold_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{
	int threshold = 0;

	tsp_info("touch tkey threshold: %d\n", threshold);

	return snprintf(buf, sizeof(int), "%d\n", threshold);
}
/* /sys/class/factory/tkey/tkey_zval_range */
ssize_t factory_tkey_zval_range_show(struct device *dev,
				     struct device_attribute *attr, char *buf)
{
	tsp_info("zvalue range: %d~%d\n",
	       IST30XX_MIN_ZVALUE_TKEY, IST30XX_MAX_ZVALUE_TKEY);

	return sprintf(buf, "%d,%d\n",
		       IST30XX_MIN_ZVALUE_TKEY, IST30XX_MAX_ZVALUE_TKEY);
}
/* /sys/class/factory/tkey/tkey_raw_data3 */
ssize_t factory_tkey_rawcnt3_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{
	int raw_cnt = 0;

	tsp_info("raw counter3 : %d\n", raw_cnt);

	return snprintf(buf, sizeof(int), "%d\n", raw_cnt);
}
/* /sys/class/factory/tkey/tkey_recent */
ssize_t factory_recent_key_state_show(struct device *dev,
				      struct device_attribute *attr, char *buf)
{
	int key_state = 0;

	tsp_info("recent tkey state: %d\n", key_state);

	return snprintf(buf, sizeof(int), "%d\n", key_state);
}
/* /sys/class/factory/tsp/node_num */
ssize_t factory_tsp_node_num_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{
	tsp_info("tsp node num: width:%d, height: %d\n",
	       ist30xx_tsp_info.width, ist30xx_tsp_info.height);

	return sprintf(buf, "%d,%d\n",
		       ist30xx_tsp_info.width, ist30xx_tsp_info.height);
}
Ejemplo n.º 23
0
static void ist30xx_request_reset(void)
{
	ist30xx_error_cnt++;
	if (ist30xx_error_cnt >= ist30xx_max_error_cnt) {
		schedule_delayed_work(&work_reset_check, 0);
		tsp_info("%s()\n", __func__);
		ist30xx_error_cnt = 0;
	}
}
Ejemplo n.º 24
0
int ist30xx_cmd_calibrate(struct i2c_client *client)
{
	int ret = ist30xx_write_cmd(client, CMD_CALIBRATE, 0);

	tsp_info("%s\n", __func__);

	msleep(100);

	return ret;
}
Ejemplo n.º 25
0
int ist30xx_cmd_check_calib(struct i2c_client *client)
{
	int ret = ist30xx_write_cmd(client, CMD_CHECK_CALIB, 0);

	tsp_info("*** Check Calibration cmd ***\n");

	msleep(20);

	return ret;
}
Ejemplo n.º 26
0
static void fw_update_func(struct work_struct *work)
{
	if ((ts_data == NULL) || (ts_data->client == NULL))
		return;

	tsp_info("FW update function\n");

	if (ist30xx_auto_bin_update(ts_data))
		ist30xx_disable_irq(ts_data);
}
int ist30xx_parse_cmcs_buf(CMCS_INFO *cmcs, s16 *buf, int len)
{
	int i, j;
	int ch_num = cmcs->ch.tx_num * cmcs->ch.rx_num;

	tsp_info("len: %d, ch_num : %d\n", len, ch_num);

	if (ch_num > len)
		ch_num = len;

	tsp_info(" %d * %d\n", cmcs->ch.tx_num, cmcs->ch.rx_num);
	for (i = 0; i < cmcs->ch.tx_num; i++) {
		tsp_info(" ");
		for (j = 0; j < cmcs->ch.rx_num; j++)
			printk("%5d ", buf[i * cmcs->ch.rx_num + j]);
		printk("\n");
	}

	return 0;
}
Ejemplo n.º 28
0
int ist30xx_get_info(struct ist30xx_data *data)
{
	int ret;
	u32 calib_msg;
	int retry = 0;

	ist30xx_tsp_info.finger_num = IST30XX_MAX_MT_FINGERS;
	mutex_lock(&ist30xx_mutex);
	ist30xx_disable_irq(data);

RETRY :
	ret = ist30xx_write_cmd(data->client, CMD_RUN_DEVICE, 0);

	msleep(50);

	ret = ist30xx_get_ver_info(data);
	if(ret != 0) {
		if(retry++ < 10) {
			tsp_debug("ist30xx_get_info retry : %d \n", retry);
			ist30xx_ts_reset();
			goto RETRY;
		}
	}

	ret = ist30xx_tsp_update_info();
	ret = ist30xx_tkey_update_info();

	ist30xx_print_info();

	ret = ist30xx_read_cmd(ts_data->client, CMD_GET_CALIB_RESULT, &calib_msg);
	if (ret == 0) {
		tsp_info("calib status: 0x%08x\n", calib_msg);
		if ((calib_msg & CALIB_MSG_MASK) != CALIB_MSG_VALID ||
		    CALIB_TO_STATUS(calib_msg) > 0) {
			ist30xx_calibrate(IST30XX_FW_UPDATE_RETRY);

			ist30xx_cmd_run_device(data->client);
		}
	}

	ist30xx_start(ts_data);

#if IST30XX_EVENT_MODE
	ktime_get_ts(&t_event);
#endif

	data->status.calib = 0;

	ist30xx_enable_irq(data);

	mutex_unlock(&ist30xx_mutex);

	return ret;
}
int ist30xx_cmd_check_calib(struct i2c_client *client)
{
	int ret = ist30xx_write_cmd(client, CMD_CHECK_CALIB, 0);

	ist30xx_tracking(TRACK_CMD_CHECK_CALIB);

	tsp_info("%s: *** Check Calibration cmd ***\n", __func__);

	msleep(20);

	return ret;
}
Ejemplo n.º 30
0
void ist30xx_set_ta_mode(bool charging)
{
#if IST30XX_DETECT_TA
	if ((ist30xx_ta_status == -1) || (charging == ist30xx_ta_status))
		return;

	ist30xx_ta_status = charging ? 1 : 0;

	tsp_info("%s(), charging = %d\n", __func__, ist30xx_ta_status);

	schedule_delayed_work(&work_reset_check, 0);
#endif
}