[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1471437381-1752-1-git-send-email-fabio.estevam@nxp.com>
Date: Wed, 17 Aug 2016 09:36:21 -0300
From: Fabio Estevam <fabio.estevam@....com>
To: <broonie@...nel.org>
CC: <festevam@...il.com>, <linux-kernel@...r.kernel.org>,
Fabio Estevam <fabio.estevam@....com>
Subject: [PATCH] regulator: pfuze100: Allow pfuze3000 to not go to low power mode
On a imx6ul-pico board, after issuing a "echo mem > /sys/power/state"
the board goes trough a POR reset instead of going into suspend.
This happens because the pfuze3000 goes to low power by default when the
system goes to suspend.
This behaviour is controlled by the STBY_LOWPOWER_B bit of register
LDOGCTL as explained in the pfuze3000 datasheet:
"When STBY_LOWPOWER_B bit is set to 1, the front-end LDO does not enter
in low-power mode during IC standby mode."
Introduce a "fsl,low-power-mode-disabled" property that allows the
pfuze3000 to not enter low-power mode during system standby.
Signed-off-by: Fabio Estevam <fabio.estevam@....com>
---
.../devicetree/bindings/regulator/pfuze100.txt | 6 ++++
drivers/regulator/pfuze100-regulator.c | 32 ++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/pfuze100.txt b/Documentation/devicetree/bindings/regulator/pfuze100.txt
index 9b40db8..9d10767 100644
--- a/Documentation/devicetree/bindings/regulator/pfuze100.txt
+++ b/Documentation/devicetree/bindings/regulator/pfuze100.txt
@@ -4,6 +4,12 @@ Required properties:
- compatible: "fsl,pfuze100", "fsl,pfuze200", "fsl,pfuze3000"
- reg: I2C slave address
+Optional property (only for pfuze3000):
+- fsl,low-power-mode-disabled: This is a boolean property that when present
+ indicates that the pfzue3000 will not enter
+ low power mode when the system goes to
+ suspend.
+
Required child node:
- regulators: This is the list of child nodes that specify the regulator
initialization data for defined regulators. Please refer to below doc
diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
index cb18b5c..eca3945 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -56,6 +56,8 @@
#define PFUZE100_VGEN5VOL 0x70
#define PFUZE100_VGEN6VOL 0x71
+#define PFUZE3000_LDOGCTL 0x69
+
enum chips { PFUZE100, PFUZE200, PFUZE3000 = 3 };
struct pfuze_regulator {
@@ -510,6 +512,32 @@ static const struct regmap_config pfuze_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
+static int set_low_power_mode(struct pfuze_chip *pfuze_chip)
+{
+ struct device *dev = pfuze_chip->dev;
+ struct device_node *np;
+ unsigned int value;
+ int ret;
+
+ np = of_node_get(dev->of_node);
+ if (!np)
+ return -EINVAL;
+
+ if (!of_device_is_compatible(np, "fsl,pfuze3000"))
+ return 0;
+
+ if (of_find_property(np, "fsl,low-power-mode-disabled", NULL))
+ value = 1;
+ else
+ value = 0;
+
+ ret = regmap_write(pfuze_chip->regmap, PFUZE3000_LDOGCTL, value);
+ if (ret)
+ return ret;
+
+ return 0;
+};
+
static int pfuze100_regulator_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -635,6 +663,10 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
}
}
+ ret = set_low_power_mode(pfuze_chip);
+ if (ret)
+ return ret;
+
return 0;
}
--
1.9.1
Powered by blists - more mailing lists