#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>
*/
#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
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");
}
}
- return 0;
+ /* Unlock expert registers. */
+ return regmap_write(regmap, ACT8945A_SYS_UNLK_REGS, 0xef);
}
static struct platform_driver act8945a_pmic_driver = {