static int cyttsp5_i2c_probe(struct i2c_client *client,const struct i2c_device_id *i2c_id)
{
	struct device *dev = &client->dev;
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
	const struct of_device_id *match;
#endif
    int rc;

    rc = cyttsp5_pinctrl_init(&client->dev);
    if (rc < 0){
        return rc;
    }
        rc = pinctrl_select_state(cyttsp5_pctrl.pinctrl,cyttsp5_pctrl.gpio_state_active);
    if (rc){
        pr_err("%s:%d cyttsp5 cannot set pin to gpio_state_active state\n",__func__, __LINE__);
        return -EIO;
    }

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		dev_err(dev, "I2C functionality not Supported\n");
		return -EIO;
	}

#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
        match = of_match_device(of_match_ptr(cyttsp5_i2c_of_match), dev);
        if (match) {
            rc = cyttsp5_devtree_create_and_get_pdata(dev);
            if (rc < 0){
                return rc;
            }
        }
#endif
cyttsp_power_on(&client->dev);

	rc = cyttsp5_probe(&cyttsp5_i2c_bus_ops, &client->dev, client->irq,
			  CY_I2C_DATA_SIZE);

#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
	if (rc && match){
		cyttsp5_devtree_clean_pdata(dev);
    }
#endif

	return rc;
}
static int cyttsp5_i2c_probe(struct i2c_client *client,
	const struct i2c_device_id *i2c_id)
{
	struct cyttsp5_i2c *ts_i2c;
	struct device *dev = &client->dev;
//	const struct of_device_id *match;
	char const *adap_id;
	int rc;

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		dev_err(dev, "%s: fail check I2C functionality\n", __func__);
		rc = -EIO;
		goto error_alloc_data_failed;
	}

	ts_i2c = kzalloc(sizeof(struct cyttsp5_i2c), GFP_KERNEL);
	if (ts_i2c == NULL) {
		dev_err(dev, "%s: Error, kzalloc.\n", __func__);
		rc = -ENOMEM;
		goto error_alloc_data_failed;
	}
    
/*** ZTEMT Modify by luochangyang, 2013/09/03 ***/
#if 1
#ifdef CONFIG_OF
    if (client->dev.of_node) {
        rc = cyttsp_parse_dt(&client->dev);
        if (rc)
            return rc;
    } else
        dev_err(dev, "%s: no client->dev.of_node.\n", __func__);
    
    cyttsp_power_on(&client->dev);

    adap_id = dev_get_platdata(dev);
#endif
#else
    match = of_match_device(of_match_ptr(cyttsp5_i2c_of_match), dev);
    if (match) {
        rc = of_property_read_string(dev->of_node, "cy,adapter_id",
                &adap_id);
        if (rc) {
            dev_err(dev, "%s: OF error rc=%d\n", __func__, rc);
            goto error_free_data;
        }
        cyttsp5_devtree_register_devices(dev);
    } else {
        adap_id = dev_get_platdata(dev);
    }
#endif
/***ZTEMT END***/

	mutex_init(&ts_i2c->lock);
	ts_i2c->client = client;
	ts_i2c->id = (adap_id) ? adap_id : CYTTSP5_I2C_NAME;
	client->dev.bus = &i2c_bus_type;
	i2c_set_clientdata(client, ts_i2c);
	dev_set_drvdata(&client->dev, ts_i2c);

	dev_dbg(dev, "%s: add adap='%s' (CYTTSP5_I2C_NAME=%s)\n", __func__,
		ts_i2c->id, CYTTSP5_I2C_NAME);

	pm_runtime_enable(&client->dev);

	rc = cyttsp5_add_adapter(ts_i2c->id, &ops, dev);
	if (rc) {
		dev_err(dev, "%s: Error on probe %s\n", __func__,
			CYTTSP5_I2C_NAME);
		goto add_adapter_err;
	}

	return 0;

add_adapter_err:
	pm_runtime_disable(&client->dev);
	dev_set_drvdata(&client->dev, NULL);
	i2c_set_clientdata(client, NULL);
//error_free_data:
	kfree(ts_i2c);
error_alloc_data_failed:
	return rc;
}
static int cyttsp_i2c_probe(struct i2c_client *client,
	const struct i2c_device_id *id)
{
	struct cyttsp_i2c *ts;
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP3_DEVICETREE_SUPPORT
	struct device *dev = &client->dev;
	const struct of_device_id *match;
#endif	
	int retval = 0;

	pr_info("%s: Starting %s probe...\n", __func__, CY_I2C_NAME);

/*** ZTEMT Added by lixin, 2015/12/02 ***/
        retval = cyttsp3_pinctrl_init(&client->dev);
        if (retval < 0){
            return retval;
        }
            retval = pinctrl_select_state(cyttsp3_pctrl.pinctrl,cyttsp3_pctrl.gpio_state_active);
        if (retval){
            pr_err("%s:%d cyttsp3 cannot set pin to gpio_state_active state\n",__func__, __LINE__);
            return -EIO;
        }
/*** ZTEMT END ***/

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		pr_err("%s: fail check I2C functionality\n", __func__);
		retval = -EIO;
		goto cyttsp_i2c_probe_exit;
	}

#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP3_DEVICETREE_SUPPORT
	match = of_match_device(of_match_ptr(cyttsp3_i2c_of_match), dev);
	if (match) {
		retval = cyttsp3_devtree_create_and_get_pdata(dev);
		if (retval < 0)
			return retval;
	}
#endif	

    retval = cyttsp_power_on(&client->dev);
    if (retval){
                pr_err("%s:%d cyttsp3 power on failed \n",__func__, __LINE__);
                return -EIO;
            }

	/* allocate and clear memory */
	ts = kzalloc(sizeof(struct cyttsp_i2c), GFP_KERNEL);
	if (ts == NULL) {
		pr_err("%s: Error, kzalloc.\n", __func__);
		retval = -ENOMEM;
		goto cyttsp_i2c_probe_exit;
	}

	/* register driver_data */
	ts->client = client;
	i2c_set_clientdata(client, ts);
	ts->ops.write = ttsp_i2c_write_block_data;
	ts->ops.read = ttsp_i2c_read_block_data;
	ts->ops.dev = &client->dev;
	ts->ops.dev->bus = &i2c_bus_type;

	ts->ttsp_client = cyttsp_core_init(&ts->ops, &client->dev,
		client->irq, client->name);

	if (ts->ttsp_client == NULL) {
		kfree(ts);
		ts = NULL;
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP3_DEVICETREE_SUPPORT
		if (match)
			cyttsp3_devtree_clean_pdata(dev);
#endif
		retval = -ENODATA;
		pr_err("%s: Registration fail ret=%d\n", __func__, retval);
		goto cyttsp_i2c_probe_exit;
	}

/*** ZTEMT start ***/
	if(!gpio_is_valid(rst_gpio_number))
		return -ENODEV;
   	 retval = gpio_request(rst_gpio_number, "CYTTSP3_I2C_RST_GPIO");
    	if (retval < 0) 
    	{
        	printk("Failed to request GPIO:%d, ERRNO:%d", (s32)rst_gpio_number, retval);
        	retval = -ENODEV;
    	}
   	    else
   	    {
        	gpio_direction_output(rst_gpio_number, 1);
		
        }

	if(!gpio_is_valid(irq_gpio_number))
		return -ENODEV;

	retval = gpio_request(irq_gpio_number, "CYTTSP3_I2C_IRQ_GPIO");
	if (retval < 0) {
			printk("Failed request CYTTSP3_I2C_IRQ_GPIO.\n");
			return -ENODEV;
		}
	gpio_direction_input(irq_gpio_number);

	id_number = 0;

/*ZTEMT end*/

	pr_info("%s: Registration complete\n", __func__);

cyttsp_i2c_probe_exit:
	return retval;
}