Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 013b439d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "icm20602: fix suspend function problem"

parents e2222ff1 aac6ebb1
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -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)
@@ -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;
@@ -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;
}
+2 −3
Original line number Diff line number Diff line
@@ -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
@@ -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);
};