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

Commit 32304d75 authored by Gregory Hermant's avatar Gregory Hermant Committed by Greg Kroah-Hartman
Browse files

max310x: max3109_detect should use indirect addressing in SPI mode for REVID register



This patch allows to read the REV_ID register in SPI mode and consequently
to properly detect the max3109. Indeed in SPI mode, this register is only
accessible by using indirect addressing.

Signed-off-by: default avatarGregory Hermant <gregory.hermant@calao-systems.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 510d4832
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -346,10 +346,13 @@ static int max3109_detect(struct device *dev)
	unsigned int val = 0;
	int ret;

	ret = regmap_read(s->regmap, MAX310X_REVID_REG, &val);
	ret = regmap_write(s->regmap, MAX310X_GLOBALCMD_REG,
			   MAX310X_EXTREG_ENBL);
	if (ret)
		return ret;

	regmap_read(s->regmap, MAX310X_REVID_EXTREG, &val);
	regmap_write(s->regmap, MAX310X_GLOBALCMD_REG, MAX310X_EXTREG_DSBL);
	if (((val & MAX310x_REV_MASK) != MAX3109_REV_ID)) {
		dev_err(dev,
			"%s ID 0x%02x does not match\n", s->devtype->name, val);