static int tps61310_probe(struct i2c_client *client, const struct i2c_device_id *devid) { int ret = -1; int tempvalue = 0; printk("tps61310_probe start!\n"); tps61310_client = client; /* GPIO 27 used by BT of some products, we use GPIO 83 instead. */ if(HW_BT_WAKEUP_GPIO_IS_27 == get_hw_bt_wakeup_gpio_type()) { tps61310_nreset = 83; } else { tps61310_nreset = 27; } /*device init of gpio init*/ if ( tps61310_device_init()){ printk("tps61310_device_init error!\n"); } if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { ret = -ENODEV; } if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)){ ret = -ENODEV; } /* read chip id */ tempvalue = tps61310_i2c_read(tps61310_client, 0x07); if ((tempvalue & 0x07) == 0x06) { printk("tps61310 read chip id ok!\n"); register_led_set_state(tps61310_set_flash); } else { printk("tps61310 read chip id error!\n"); /*if probe failed, free the gpio*/ gpio_free(tps61310_nreset); gpio_free(tps61310_strb0); return -ENODEV; } #ifdef CONFIG_HUAWEI_HW_DEV_DCT /* detect current device successful, set the flag as present */ set_hw_dev_flag(DEV_I2C_FLASH); #endif printk("tps61310_probe end!\n"); return 0; }
static int tps61310_probe(struct i2c_client *client, const struct i2c_device_id *devid) { int ret = -1; int tempvalue = 0; printk("tps61310_probe start!\n"); tps61310_client = client; /* GPIO 27 used by BT of some products, we use GPIO 83 instead. */ #ifdef CONFIG_ARCH_MSM7X27A if(HW_BT_WAKEUP_GPIO_IS_27 == get_hw_bt_wakeup_gpio_type()) { tps61310_nreset = 83; } else { tps61310_nreset = 27; } #endif /*device init of gpio init*/ #ifdef CONFIG_ARCH_MSM7X27A if ( tps61310_device_init()){ printk("tps61310_device_init error!\n"); } #else /* pull up the nreset pin */ pm8xxx_gpio_set_value(PMIC_GPIO_FLASH_EN, 1); #endif if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { ret = -ENODEV; } if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)){ ret = -ENODEV; } /* read chip id */ tempvalue = tps61310_i2c_read(tps61310_client, 0x07); if ((tempvalue & 0x07) == 0x06) { printk("tps61310 read chip id ok!\n"); } else { printk("tps61310 read chip id error!\n"); } printk("tps61310_probe end!\n"); return 0; }