Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Claudiu Beznea and committed by
Mark Brown
90bc8ac2 f306d760

+12 -1
+12 -1
drivers/regulator/act8945a-regulator.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/of_device.h> 17 17 #include <linux/platform_device.h> 18 + #include <linux/regmap.h> 18 19 #include <linux/regulator/driver.h> 19 20 #include <linux/regulator/machine.h> 20 21 ··· 24 23 */ 25 24 #define ACT8945A_SYS_MODE 0x00 26 25 #define ACT8945A_SYS_CTRL 0x01 26 + #define ACT8945A_SYS_UNLK_REGS 0x0b 27 27 #define ACT8945A_DCDC1_VSET1 0x20 28 28 #define ACT8945A_DCDC1_VSET2 0x21 29 29 #define ACT8945A_DCDC1_CTRL 0x22 ··· 125 123 struct regulator_config config = { }; 126 124 const struct regulator_desc *regulators; 127 125 struct regulator_dev *rdev; 126 + struct regmap *regmap; 128 127 int i, num_regulators; 129 128 bool voltage_select; 129 + 130 + regmap = dev_get_regmap(pdev->dev.parent, NULL); 131 + if (!regmap) { 132 + dev_err(&pdev->dev, 133 + "could not retrieve regmap from parent device\n"); 134 + return -EINVAL; 135 + } 130 136 131 137 voltage_select = of_property_read_bool(pdev->dev.parent->of_node, 132 138 "active-semi,vsel-high"); ··· 159 149 } 160 150 } 161 151 162 - return 0; 152 + /* Unlock expert registers. */ 153 + return regmap_write(regmap, ACT8945A_SYS_UNLK_REGS, 0xef); 163 154 } 164 155 165 156 static struct platform_driver act8945a_pmic_driver = {