Loading Documentation/devicetree/bindings/input/misc/mpu6050.txt +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ Required properties: - interrupts : Gyrometer sample interrupt to indicate new data ready. - vdd-supply : Analog power supply needed to power device. - vlogic-supply : Digital IO power supply needed for IO and I2C. - vi2c-supply : Digital IO Power supply needed for I2C. - invn,place : The placing of the accelerometer on board. There are 8 patterns of placing described as below: "Portrait Up": Portrait Up Loading @@ -25,6 +24,7 @@ Required properties: Optional properties: - vi2c-supply : Digital IO Power supply needed for I2C. - invn,use-interrupt : use device interrupt to trigger data acquisition instead of polling data. - invn,gpio-int : GPIO used for interrupt. Loading drivers/input/misc/mpu6050.c +23 −21 Original line number Diff line number Diff line Loading @@ -286,14 +286,17 @@ static int mpu6050_power_ctl(struct mpu6050_sensor *sensor, bool on) return rc; } if (!IS_ERR_OR_NULL(sensor->vi2c)) { rc = regulator_enable(sensor->vi2c); if (rc) { dev_err(&sensor->client->dev, "Regulator vi2c enable failed rc=%d\n", rc); "Regulator vi2c enable failed rc=%d\n", rc); regulator_disable(sensor->vlogic); regulator_disable(sensor->vdd); return rc; } } if (gpio_is_valid(sensor->enable_gpio)) { udelay(POWER_EN_DELAY_US); Loading Loading @@ -328,14 +331,17 @@ static int mpu6050_power_ctl(struct mpu6050_sensor *sensor, bool on) return rc; } if (!IS_ERR_OR_NULL(sensor->vi2c)) { rc = regulator_disable(sensor->vi2c); if (rc) { dev_err(&sensor->client->dev, "Regulator vi2c disable failed rc=%d\n", rc); "Regulator vi2c disable failed rc=%d\n", rc); if (regulator_enable(sensor->vi2c) || regulator_enable(sensor->vdd)) return -EIO; } } sensor->power_enabled = false; } else { Loading Loading @@ -390,12 +396,10 @@ static int mpu6050_power_init(struct mpu6050_sensor *sensor) sensor->vi2c = regulator_get(&sensor->client->dev, "vi2c"); if (IS_ERR(sensor->vi2c)) { ret = PTR_ERR(sensor->vi2c); dev_err(&sensor->client->dev, dev_info(&sensor->client->dev, "Regulator get failed vi2c ret=%d\n", ret); goto reg_vlogic_set_vtg; } if (regulator_count_voltages(sensor->vi2c) > 0) { sensor->vi2c = NULL; } else if (regulator_count_voltages(sensor->vi2c) > 0) { ret = regulator_set_voltage(sensor->vi2c, MPU6050_VI2C_MIN_UV, MPU6050_VI2C_MAX_UV); Loading @@ -406,12 +410,10 @@ static int mpu6050_power_init(struct mpu6050_sensor *sensor) } } return 0; reg_vi2c_put: regulator_put(sensor->vi2c); reg_vlogic_set_vtg: if (regulator_count_voltages(sensor->vlogic) > 0) regulator_set_voltage(sensor->vlogic, 0, MPU6050_VLOGIC_MAX_UV); reg_vlogic_put: Loading Loading
Documentation/devicetree/bindings/input/misc/mpu6050.txt +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ Required properties: - interrupts : Gyrometer sample interrupt to indicate new data ready. - vdd-supply : Analog power supply needed to power device. - vlogic-supply : Digital IO power supply needed for IO and I2C. - vi2c-supply : Digital IO Power supply needed for I2C. - invn,place : The placing of the accelerometer on board. There are 8 patterns of placing described as below: "Portrait Up": Portrait Up Loading @@ -25,6 +24,7 @@ Required properties: Optional properties: - vi2c-supply : Digital IO Power supply needed for I2C. - invn,use-interrupt : use device interrupt to trigger data acquisition instead of polling data. - invn,gpio-int : GPIO used for interrupt. Loading
drivers/input/misc/mpu6050.c +23 −21 Original line number Diff line number Diff line Loading @@ -286,14 +286,17 @@ static int mpu6050_power_ctl(struct mpu6050_sensor *sensor, bool on) return rc; } if (!IS_ERR_OR_NULL(sensor->vi2c)) { rc = regulator_enable(sensor->vi2c); if (rc) { dev_err(&sensor->client->dev, "Regulator vi2c enable failed rc=%d\n", rc); "Regulator vi2c enable failed rc=%d\n", rc); regulator_disable(sensor->vlogic); regulator_disable(sensor->vdd); return rc; } } if (gpio_is_valid(sensor->enable_gpio)) { udelay(POWER_EN_DELAY_US); Loading Loading @@ -328,14 +331,17 @@ static int mpu6050_power_ctl(struct mpu6050_sensor *sensor, bool on) return rc; } if (!IS_ERR_OR_NULL(sensor->vi2c)) { rc = regulator_disable(sensor->vi2c); if (rc) { dev_err(&sensor->client->dev, "Regulator vi2c disable failed rc=%d\n", rc); "Regulator vi2c disable failed rc=%d\n", rc); if (regulator_enable(sensor->vi2c) || regulator_enable(sensor->vdd)) return -EIO; } } sensor->power_enabled = false; } else { Loading Loading @@ -390,12 +396,10 @@ static int mpu6050_power_init(struct mpu6050_sensor *sensor) sensor->vi2c = regulator_get(&sensor->client->dev, "vi2c"); if (IS_ERR(sensor->vi2c)) { ret = PTR_ERR(sensor->vi2c); dev_err(&sensor->client->dev, dev_info(&sensor->client->dev, "Regulator get failed vi2c ret=%d\n", ret); goto reg_vlogic_set_vtg; } if (regulator_count_voltages(sensor->vi2c) > 0) { sensor->vi2c = NULL; } else if (regulator_count_voltages(sensor->vi2c) > 0) { ret = regulator_set_voltage(sensor->vi2c, MPU6050_VI2C_MIN_UV, MPU6050_VI2C_MAX_UV); Loading @@ -406,12 +410,10 @@ static int mpu6050_power_init(struct mpu6050_sensor *sensor) } } return 0; reg_vi2c_put: regulator_put(sensor->vi2c); reg_vlogic_set_vtg: if (regulator_count_voltages(sensor->vlogic) > 0) regulator_set_voltage(sensor->vlogic, 0, MPU6050_VLOGIC_MAX_UV); reg_vlogic_put: Loading