Commit 34a4b239 authored by Haojian Zhuang's avatar Haojian Zhuang Committed by Samuel Ortiz

regulator: Unsupport 88pm8607 A0 and A1

Remove the support 88PM8607 A0/A1 stepping. There's some register
definition changes in B0 stepping. It can make software more efficient.
Signed-off-by: default avatarHaojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 866a98ae
...@@ -48,7 +48,6 @@ static inline int check_range(struct pm8607_regulator_info *info, ...@@ -48,7 +48,6 @@ static inline int check_range(struct pm8607_regulator_info *info,
static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
{ {
struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
uint8_t chip_id = info->chip->chip_version;
int ret = -EINVAL; int ret = -EINVAL;
switch (info->desc.id) { switch (info->desc.id) {
...@@ -90,79 +89,29 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) ...@@ -90,79 +89,29 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
case PM8607_ID_LDO2: case PM8607_ID_LDO2:
case PM8607_ID_LDO3: case PM8607_ID_LDO3:
case PM8607_ID_LDO9: case PM8607_ID_LDO9:
switch (chip_id) { ret = (index < 3) ? (index * 50000 + 1800000) :
case PM8607_CHIP_A0: ((index < 7) ? (index * 50000 + 2550000) :
case PM8607_CHIP_A1: 3300000);
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 8) ? (index * 50000 + 2550000) :
-EINVAL);
break;
case PM8607_CHIP_B0:
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 7) ? (index * 50000 + 2550000) :
3300000);
break;
}
break; break;
case PM8607_ID_LDO4: case PM8607_ID_LDO4:
switch (chip_id) { ret = (index < 3) ? (index * 50000 + 1800000) :
case PM8607_CHIP_A0: ((index < 6) ? (index * 50000 + 2550000) :
case PM8607_CHIP_A1: ((index == 6) ? 2900000 : 3300000));
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 8) ? (index * 50000 + 2550000) :
-EINVAL);
break;
case PM8607_CHIP_B0:
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 6) ? (index * 50000 + 2550000) :
((index == 6) ? 2900000 : 3300000));
break;
}
break; break;
case PM8607_ID_LDO6: case PM8607_ID_LDO6:
switch (chip_id) { ret = (index < 2) ? (index * 50000 + 1800000) :
case PM8607_CHIP_A0: ((index < 7) ? (index * 50000 + 2500000) :
case PM8607_CHIP_A1: 3300000);
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 8) ? (index * 50000 + 2450000) :
-EINVAL);
break;
case PM8607_CHIP_B0:
ret = (index < 2) ? (index * 50000 + 1800000) :
((index < 7) ? (index * 50000 + 2500000) :
3300000);
break;
}
break; break;
case PM8607_ID_LDO10: case PM8607_ID_LDO10:
switch (chip_id) { ret = (index < 3) ? (index * 50000 + 1800000) :
case PM8607_CHIP_A0: ((index < 7) ? (index * 50000 + 2550000) :
case PM8607_CHIP_A1: ((index == 7) ? 3300000 : 1200000));
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 8) ? (index * 50000 + 2550000) :
1200000);
break;
case PM8607_CHIP_B0:
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 7) ? (index * 50000 + 2550000) :
((index == 7) ? 3300000 : 1200000));
break;
}
break; break;
case PM8607_ID_LDO14: case PM8607_ID_LDO14:
switch (chip_id) { ret = (index < 2) ? (index * 50000 + 1800000) :
case PM8607_CHIP_A0: ((index < 7) ? (index * 50000 + 2600000) :
case PM8607_CHIP_A1: 3300000);
ret = (index < 3) ? (index * 50000 + 1800000) :
((index < 8) ? (index * 50000 + 2550000) :
-EINVAL);
break;
case PM8607_CHIP_B0:
ret = (index < 2) ? (index * 50000 + 1800000) :
((index < 7) ? (index * 50000 + 2600000) :
3300000);
break;
}
break; break;
} }
return ret; return ret;
...@@ -171,7 +120,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) ...@@ -171,7 +120,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
{ {
struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
uint8_t chip_id = info->chip->chip_version;
int val = -ENOENT; int val = -ENOENT;
int ret; int ret;
...@@ -256,161 +204,77 @@ static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) ...@@ -256,161 +204,77 @@ static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
case PM8607_ID_LDO2: case PM8607_ID_LDO2:
case PM8607_ID_LDO3: case PM8607_ID_LDO3:
case PM8607_ID_LDO9: case PM8607_ID_LDO9:
switch (chip_id) { if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
case PM8607_CHIP_A0: if (min_uV <= 1800000)
case PM8607_CHIP_A1: val = 0;
if (min_uV < 2700000) /* 1800mV ~ 1900mV / 50mV */ else if (min_uV <= 1900000)
if (min_uV <= 1800000) val = (min_uV - 1750001) / 50000;
val = 0; else
else if (min_uV <= 1900000) val = 3; /* 2700mV */
val = (min_uV - 1750001) / 50000; } else { /* 2700mV ~ 2850mV / 50mV */
else if (min_uV <= 2850000) {
val = 3; /* 2700mV */ val = (min_uV - 2650001) / 50000;
else { /* 2700mV ~ 2900mV / 50mV */ val += 3;
if (min_uV <= 2900000) { } else if (min_uV <= 3300000)
val = (min_uV - 2650001) / 50000; val = 7;
val += 3; else
} else val = -EINVAL;
val = -EINVAL;
}
break;
case PM8607_CHIP_B0:
if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
if (min_uV <= 1800000)
val = 0;
else if (min_uV <= 1900000)
val = (min_uV - 1750001) / 50000;
else
val = 3; /* 2700mV */
} else { /* 2700mV ~ 2850mV / 50mV */
if (min_uV <= 2850000) {
val = (min_uV - 2650001) / 50000;
val += 3;
} else if (min_uV <= 3300000)
val = 7;
else
val = -EINVAL;
}
break;
} }
break; break;
case PM8607_ID_LDO4: case PM8607_ID_LDO4:
switch (chip_id) { if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
case PM8607_CHIP_A0: if (min_uV <= 1800000)
case PM8607_CHIP_A1: val = 0;
if (min_uV < 2700000) /* 1800mV ~ 1900mV / 50mV */ else if (min_uV <= 1900000)
if (min_uV <= 1800000) val = (min_uV - 1750001) / 50000;
val = 0; else
else if (min_uV <= 1900000) val = 3; /* 2700mV */
val = (min_uV - 1750001) / 50000; } else { /* 2700mV ~ 2800mV / 50mV */
else if (min_uV <= 2850000) {
val = 3; /* 2700mV */ val = (min_uV - 2650001) / 50000;
else { /* 2700mV ~ 2900mV / 50mV */ val += 3;
if (min_uV <= 2900000) { } else if (min_uV <= 2900000)
val = (min_uV - 2650001) / 50000; val = 6;
val += 3; else if (min_uV <= 3300000)
} else val = 7;
val = -EINVAL; else
} val = -EINVAL;
break;
case PM8607_CHIP_B0:
if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
if (min_uV <= 1800000)
val = 0;
else if (min_uV <= 1900000)
val = (min_uV - 1750001) / 50000;
else
val = 3; /* 2700mV */
} else { /* 2700mV ~ 2800mV / 50mV */
if (min_uV <= 2850000) {
val = (min_uV - 2650001) / 50000;
val += 3;
} else if (min_uV <= 2900000)
val = 6;
else if (min_uV <= 3300000)
val = 7;
else
val = -EINVAL;
}
break;
} }
break; break;
case PM8607_ID_LDO6: case PM8607_ID_LDO6:
switch (chip_id) { if (min_uV < 2600000) { /* 1800mV ~ 1850mV / 50mV */
case PM8607_CHIP_A0: if (min_uV <= 1800000)
case PM8607_CHIP_A1: val = 0;
if (min_uV < 2600000) { /* 1800mV ~ 1900mV / 50mV */ else if (min_uV <= 1850000)
if (min_uV <= 1800000) val = (min_uV - 1750001) / 50000;
val = 0; else
else if (min_uV <= 1900000) val = 2; /* 2600mV */
val = (min_uV - 1750001) / 50000; } else { /* 2600mV ~ 2800mV / 50mV */
else if (min_uV <= 2800000) {
val = 3; /* 2600mV */ val = (min_uV - 2550001) / 50000;
} else { /* 2600mV ~ 2800mV / 50mV */ val += 2;
if (min_uV <= 2800000) { } else if (min_uV <= 3300000)
val = (min_uV - 2550001) / 50000; val = 7;
val += 3; else
} else val = -EINVAL;
val = -EINVAL;
}
break;
case PM8607_CHIP_B0:
if (min_uV < 2600000) { /* 1800mV ~ 1850mV / 50mV */
if (min_uV <= 1800000)
val = 0;
else if (min_uV <= 1850000)
val = (min_uV - 1750001) / 50000;
else
val = 2; /* 2600mV */
} else { /* 2600mV ~ 2800mV / 50mV */
if (min_uV <= 2800000) {
val = (min_uV - 2550001) / 50000;
val += 2;
} else if (min_uV <= 3300000)
val = 7;
else
val = -EINVAL;
}
break;
} }
break; break;
case PM8607_ID_LDO14: case PM8607_ID_LDO14:
switch (chip_id) { if (min_uV < 2700000) { /* 1800mV ~ 1850mV / 50mV */
case PM8607_CHIP_A0: if (min_uV <= 1800000)
case PM8607_CHIP_A1: val = 0;
if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */ else if (min_uV <= 1850000)
if (min_uV <= 1800000) val = (min_uV - 1750001) / 50000;
val = 0; else
else if (min_uV <= 1900000) val = 2; /* 2700mV */
val = (min_uV - 1750001) / 50000; } else { /* 2700mV ~ 2900mV / 50mV */
else if (min_uV <= 2900000) {
val = 3; /* 2700mV */ val = (min_uV - 2650001) / 50000;
} else { /* 2700mV ~ 2900mV / 50mV */ val += 2;
if (min_uV <= 2900000) { } else if (min_uV <= 3300000)
val = (min_uV - 2650001) / 50000; val = 7;
val += 3; else
} else val = -EINVAL;
val = -EINVAL;
}
break;
case PM8607_CHIP_B0:
if (min_uV < 2700000) { /* 1800mV ~ 1850mV / 50mV */
if (min_uV <= 1800000)
val = 0;
else if (min_uV <= 1850000)
val = (min_uV - 1750001) / 50000;
else
val = 2; /* 2700mV */
} else { /* 2700mV ~ 2900mV / 50mV */
if (min_uV <= 2900000) {
val = (min_uV - 2650001) / 50000;
val += 2;
} else if (min_uV <= 3300000)
val = 7;
else
val = -EINVAL;
}
break;
} }
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment