Esempio n. 1
0
/* probe function is used for matching and initializing input device */
static int /*__devinit*/ touch_driver_probe(struct i2c_client *client,
        const struct i2c_device_id *id)
{
#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
    int ret = 0;
    const char *vdd_name = "vdd";
    const char *vcc_i2c_name = "vcc_i2c";
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON

    printk("*** %s ***\n", __func__);
    
    if (client == NULL)
    {
        printk("i2c client is NULL\n");
        return -1;
    }
    g_I2cClient = client;

#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
    g_ReguVdd = regulator_get(&g_I2cClient->dev, vdd_name);

    ret = regulator_set_voltage(g_ReguVdd, 2800000, 2800000); 
    if (ret)
    {
        printk("Could not set to 2800mv.\n");
    }

    g_ReguVcc_i2c = regulator_get(&g_I2cClient->dev, vcc_i2c_name);

    ret = regulator_set_voltage(g_ReguVcc_i2c, 1800000, 1800000);  
    if (ret)
    {
        printk("Could not set to 1800mv.\n");
    }
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON

    return MsDrvInterfaceTouchDeviceProbe(g_I2cClient, id);
}
/* probe function is used for matching and initializing input device */
static int  touch_driver_probe(struct i2c_client *client,
		const struct i2c_device_id *id)
{

#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
	const char *vdd_name = "vdd";
#endif

	DBG("touch_driver_probe\n");
	DBG("*** %s ***\n", __FUNCTION__);

	if (client == NULL) {
		DBG("i2c client is NULL\n");
		return -EPERM;
	}
	g_I2cClient = client;

#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
	g_ReguVdd = regulator_get(&g_I2cClient->dev, vdd_name);
#endif

	return MsDrvInterfaceTouchDeviceProbe(g_I2cClient, id);
}