regulator: max77620: Eliminate duplicate code
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
47dbdbf64f
commit
aad76f743b
|
@ -264,8 +264,6 @@ static int max77620_read_slew_rate(struct max77620_regulator *pmic, int id)
|
||||||
int slew_rate;
|
int slew_rate;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch (rinfo->type) {
|
|
||||||
case MAX77620_REGULATOR_TYPE_SD:
|
|
||||||
ret = regmap_read(pmic->rmap, rinfo->cfg_addr, &rval);
|
ret = regmap_read(pmic->rmap, rinfo->cfg_addr, &rval);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(pmic->dev, "Register 0x%02x read failed: %d\n",
|
dev_err(pmic->dev, "Register 0x%02x read failed: %d\n",
|
||||||
|
@ -273,6 +271,8 @@ static int max77620_read_slew_rate(struct max77620_regulator *pmic, int id)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (rinfo->type) {
|
||||||
|
case MAX77620_REGULATOR_TYPE_SD:
|
||||||
slew_rate = (rval >> MAX77620_SD_SR_SHIFT) & 0x3;
|
slew_rate = (rval >> MAX77620_SD_SR_SHIFT) & 0x3;
|
||||||
switch (slew_rate) {
|
switch (slew_rate) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -291,12 +291,6 @@ static int max77620_read_slew_rate(struct max77620_regulator *pmic, int id)
|
||||||
rinfo->desc.ramp_delay = slew_rate;
|
rinfo->desc.ramp_delay = slew_rate;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = regmap_read(pmic->rmap, rinfo->cfg_addr, &rval);
|
|
||||||
if (ret < 0) {
|
|
||||||
dev_err(pmic->dev, "Register 0x%02x read failed: %d\n",
|
|
||||||
rinfo->cfg_addr, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
slew_rate = rval & 0x1;
|
slew_rate = rval & 0x1;
|
||||||
switch (slew_rate) {
|
switch (slew_rate) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
Loading…
Reference in New Issue