summaryrefslogtreecommitdiff
path: root/drivers/power/regulator
diff options
context:
space:
mode:
authorElaine Zhang <zhangqing@rock-chips.com>2019-09-26 15:43:55 +0800
committerKever Yang <kever.yang@rock-chips.com>2019-11-10 20:32:51 +0800
commitb62280745e553b5800fa0797b920e547c92da82d (patch)
treebbff2e6e55cb55fdb95fdb157df44da5a765d50b /drivers/power/regulator
parentaddd062beaccc028fccdc90500d5d17647461da6 (diff)
downloadu-boot-b62280745e553b5800fa0797b920e547c92da82d.tar.gz
power: pmic: rk805: support rk805 pmic
The RK805 are a Power Management IC (PMIC) for multimedia and handheld devices. They contains the following components: - Regulators(4*BUCKs, 3*LDOs) - RTC - Clocking Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'drivers/power/regulator')
-rw-r--r--drivers/power/regulator/rk8xx.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
index 5a474c7313..466a871b7e 100644
--- a/drivers/power/regulator/rk8xx.c
+++ b/drivers/power/regulator/rk8xx.c
@@ -38,7 +38,14 @@
/*
* Ramp delay
*/
+#define RK805_RAMP_RATE_OFFSET 3
+#define RK805_RAMP_RATE_MASK (3 << RK805_RAMP_RATE_OFFSET)
+#define RK805_RAMP_RATE_3MV_PER_US (0 << RK805_RAMP_RATE_OFFSET)
+#define RK805_RAMP_RATE_6MV_PER_US (1 << RK805_RAMP_RATE_OFFSET)
+#define RK805_RAMP_RATE_12_5MV_PER_US (2 << RK805_RAMP_RATE_OFFSET)
+#define RK805_RAMP_RATE_25MV_PER_US (3 << RK805_RAMP_RATE_OFFSET)
#define RK808_RAMP_RATE_OFFSET 3
+
#define RK808_RAMP_RATE_MASK (3 << RK808_RAMP_RATE_OFFSET)
#define RK808_RAMP_RATE_2MV_PER_US (0 << RK808_RAMP_RATE_OFFSET)
#define RK808_RAMP_RATE_4MV_PER_US (1 << RK808_RAMP_RATE_OFFSET)
@@ -131,6 +138,7 @@ static const struct rk8xx_reg_info *get_buck_reg(struct udevice *pmic,
struct rk8xx_priv *priv = dev_get_priv(pmic);
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
switch (num) {
case 0:
@@ -185,6 +193,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable)
struct rk8xx_priv *priv = dev_get_priv(pmic);
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
if (buck >= 4) {
buck -= 4;
@@ -246,6 +255,7 @@ static int _buck_get_enable(struct udevice *pmic, int buck)
int ret = 0;
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
if (buck >= 4) {
mask = 1 << (buck - 4);
@@ -277,6 +287,7 @@ static int _buck_set_suspend_enable(struct udevice *pmic, int buck, bool enable)
struct rk8xx_priv *priv = dev_get_priv(pmic);
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
mask = 1 << buck;
ret = pmic_clrsetbits(pmic, RK816_REG_DCDC_SLP_EN, mask,
@@ -302,6 +313,7 @@ static int _buck_get_suspend_enable(struct udevice *pmic, int buck)
uint mask;
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
mask = 1 << buck;
val = pmic_reg_read(pmic, RK816_REG_DCDC_SLP_EN);
@@ -330,6 +342,7 @@ static const struct rk8xx_reg_info *get_ldo_reg(struct udevice *pmic,
struct rk8xx_priv *priv = dev_get_priv(pmic);
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
return &rk816_ldo[num];
case RK818_ID:
@@ -346,6 +359,7 @@ static int _ldo_get_enable(struct udevice *pmic, int ldo)
int ret = 0;
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
if (ldo >= 4) {
mask = 1 << (ldo - 4);
@@ -377,6 +391,7 @@ static int _ldo_set_enable(struct udevice *pmic, int ldo, bool enable)
int ret = 0;
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
if (ldo >= 4) {
ldo -= 4;
@@ -409,6 +424,7 @@ static int _ldo_set_suspend_enable(struct udevice *pmic, int ldo, bool enable)
int ret = 0;
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
mask = 1 << ldo;
ret = pmic_clrsetbits(pmic, RK816_REG_LDO_SLP_EN, mask,
@@ -432,6 +448,7 @@ static int _ldo_get_suspend_enable(struct udevice *pmic, int ldo)
uint mask;
switch (priv->variant) {
+ case RK805_ID:
case RK816_ID:
mask = 1 << ldo;
val = pmic_reg_read(pmic, RK816_REG_LDO_SLP_EN);