Loading drivers/iio/imu/inv_icm20602/inv_icm20602_core.c +8 −6 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ #include "inv_icm20602_iio.h" #include <linux/regulator/consumer.h> static struct regulator *reg_ldo; /* Attribute of icm20602 device init show */ static ssize_t inv_icm20602_init_show(struct device *dev, struct device_attribute *attr, char *buf) Loading Loading @@ -384,19 +387,19 @@ static int icm20602_ldo_work(struct inv_icm20602_state *st, bool enable) int ret = 0; if (enable) { ret = regulator_set_voltage(st->reg_ldo, ret = regulator_set_voltage(reg_ldo, ICM20602_LDO_VTG_MIN_UV, ICM20602_LDO_VTG_MAX_UV); if (ret) pr_err("Failed to request LDO voltage.\n"); ret = regulator_enable(st->reg_ldo); ret = regulator_enable(reg_ldo); if (ret) pr_err("Failed to enable LDO %d\n", ret); } else { ret = regulator_disable(st->reg_ldo); ret = regulator_disable(reg_ldo); regulator_set_load(reg_ldo, 0); if (ret) pr_err("Failed to disable LDO %d\n", ret); regulator_set_load(st->reg_ldo, 0); } return MPU_SUCCESS; Loading @@ -405,14 +408,13 @@ static int icm20602_ldo_work(struct inv_icm20602_state *st, bool enable) static int icm20602_init_regulators(struct inv_icm20602_state *st) { struct regulator *reg; reg = regulator_get(&st->client->dev, "vdd-ldo"); if (IS_ERR_OR_NULL(reg)) { pr_err("Unable to get regulator for LDO\n"); return -MPU_FAIL; } st->reg_ldo = reg; reg_ldo = reg; return MPU_SUCCESS; } Loading drivers/iio/imu/inv_icm20602/inv_icm20602_iio.h +2 −3 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ #define INV20602_SMD_IRQ_TRIGGER 1 #endif #define ICM20602_LDO_VTG_MIN_UV 3300000 #define ICM20602_LDO_VTG_MAX_UV 3300000 #define ICM20602_LDO_VTG_MIN_UV 1800000 #define ICM20602_LDO_VTG_MAX_UV 1800000 #define INV_ICM20602_TIME_STAMP_TOR 5 #define ICM20602_PACKAGE_SIZE 14 Loading Loading @@ -220,7 +220,6 @@ struct inv_icm20602_state { struct struct_icm20602_data *data_push; enum inv_devices chip_type; int gpio; struct regulator *reg_ldo; DECLARE_KFIFO(timestamps, long long, TIMESTAMP_FIFO_SIZE); }; Loading Loading
drivers/iio/imu/inv_icm20602/inv_icm20602_core.c +8 −6 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ #include "inv_icm20602_iio.h" #include <linux/regulator/consumer.h> static struct regulator *reg_ldo; /* Attribute of icm20602 device init show */ static ssize_t inv_icm20602_init_show(struct device *dev, struct device_attribute *attr, char *buf) Loading Loading @@ -384,19 +387,19 @@ static int icm20602_ldo_work(struct inv_icm20602_state *st, bool enable) int ret = 0; if (enable) { ret = regulator_set_voltage(st->reg_ldo, ret = regulator_set_voltage(reg_ldo, ICM20602_LDO_VTG_MIN_UV, ICM20602_LDO_VTG_MAX_UV); if (ret) pr_err("Failed to request LDO voltage.\n"); ret = regulator_enable(st->reg_ldo); ret = regulator_enable(reg_ldo); if (ret) pr_err("Failed to enable LDO %d\n", ret); } else { ret = regulator_disable(st->reg_ldo); ret = regulator_disable(reg_ldo); regulator_set_load(reg_ldo, 0); if (ret) pr_err("Failed to disable LDO %d\n", ret); regulator_set_load(st->reg_ldo, 0); } return MPU_SUCCESS; Loading @@ -405,14 +408,13 @@ static int icm20602_ldo_work(struct inv_icm20602_state *st, bool enable) static int icm20602_init_regulators(struct inv_icm20602_state *st) { struct regulator *reg; reg = regulator_get(&st->client->dev, "vdd-ldo"); if (IS_ERR_OR_NULL(reg)) { pr_err("Unable to get regulator for LDO\n"); return -MPU_FAIL; } st->reg_ldo = reg; reg_ldo = reg; return MPU_SUCCESS; } Loading
drivers/iio/imu/inv_icm20602/inv_icm20602_iio.h +2 −3 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ #define INV20602_SMD_IRQ_TRIGGER 1 #endif #define ICM20602_LDO_VTG_MIN_UV 3300000 #define ICM20602_LDO_VTG_MAX_UV 3300000 #define ICM20602_LDO_VTG_MIN_UV 1800000 #define ICM20602_LDO_VTG_MAX_UV 1800000 #define INV_ICM20602_TIME_STAMP_TOR 5 #define ICM20602_PACKAGE_SIZE 14 Loading Loading @@ -220,7 +220,6 @@ struct inv_icm20602_state { struct struct_icm20602_data *data_push; enum inv_devices chip_type; int gpio; struct regulator *reg_ldo; DECLARE_KFIFO(timestamps, long long, TIMESTAMP_FIFO_SIZE); }; Loading