aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea@microchip.com>2018-12-11 15:56:36 +0000
committerMark Brown <broonie@kernel.org>2018-12-12 16:57:44 +0000
commit90bc8ac220aab82df91322e67587d0418ec3b251 (patch)
tree900864b637ac4d93615488da502e1eb66257f345 /drivers/regulator
parentregulator: arizona-ldo1: Rely on core to handle GPIO descriptor (diff)
downloadlinux-dev-90bc8ac220aab82df91322e67587d0418ec3b251.tar.xz
linux-dev-90bc8ac220aab82df91322e67587d0418ec3b251.zip
regulator: act8945a-regulator: unlock expert registers
Unlock expert registers for act8945a. This is based on orginal work of Boris Brezillon at [1]. [1] https://www.spinics.net/lists/kernel/msg2942960.html Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/act8945a-regulator.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c
index 43fda8b4455a..8d71d9893d0d 100644
--- a/drivers/regulator/act8945a-regulator.c
+++ b/drivers/regulator/act8945a-regulator.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
@@ -23,6 +24,7 @@
*/
#define ACT8945A_SYS_MODE 0x00
#define ACT8945A_SYS_CTRL 0x01
+#define ACT8945A_SYS_UNLK_REGS 0x0b
#define ACT8945A_DCDC1_VSET1 0x20
#define ACT8945A_DCDC1_VSET2 0x21
#define ACT8945A_DCDC1_CTRL 0x22
@@ -123,9 +125,17 @@ static int act8945a_pmic_probe(struct platform_device *pdev)
struct regulator_config config = { };
const struct regulator_desc *regulators;
struct regulator_dev *rdev;
+ struct regmap *regmap;
int i, num_regulators;
bool voltage_select;
+ regmap = dev_get_regmap(pdev->dev.parent, NULL);
+ if (!regmap) {
+ dev_err(&pdev->dev,
+ "could not retrieve regmap from parent device\n");
+ return -EINVAL;
+ }
+
voltage_select = of_property_read_bool(pdev->dev.parent->of_node,
"active-semi,vsel-high");
@@ -149,7 +159,8 @@ static int act8945a_pmic_probe(struct platform_device *pdev)
}
}
- return 0;
+ /* Unlock expert registers. */
+ return regmap_write(regmap, ACT8945A_SYS_UNLK_REGS, 0xef);
}
static struct platform_driver act8945a_pmic_driver = {