diff --git a/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts b/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts index b03273d90ad8..df348e119643 100644 --- a/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts +++ b/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts @@ -217,13 +217,13 @@ vddee: regulator-vddee { compatible = "pwm-regulator"; regulator-name = "VDDEE"; - regulator-min-microvolt = <860000>; + regulator-min-microvolt = <1100000>; regulator-max-microvolt = <1140000>; pwm-supply = <&p5v0>; pwms = <&pwm_cd 1 12218 0>; - pwm-dutycycle-range = <91 0>; + pwm-dutycycle-range = <14 0>; regulator-boot-on; regulator-always-on; diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c index 30402ee18392..cb4e5fad5702 100644 --- a/drivers/regulator/pwm-regulator.c +++ b/drivers/regulator/pwm-regulator.c @@ -156,13 +156,10 @@ static int pwm_regulator_get_voltage(struct regulator_dev *rdev) unsigned int voltage; pwm_get_state(drvdata->pwm, &pstate); + if (!pstate.enabled) + return -ENOTRECOVERABLE; - if (pstate.enabled) - voltage = pwm_get_relative_duty_cycle(&pstate, duty_unit); - else if (max_uV_duty < min_uV_duty) - voltage = max_uV_duty; - else - voltage = min_uV_duty; + voltage = pwm_get_relative_duty_cycle(&pstate, duty_unit); /* * The dutycycle for min_uV might be greater than the one for max_uV. @@ -221,6 +218,7 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev, pwm_set_relative_duty_cycle(&pstate, dutycycle, duty_unit); + pstate.enabled = true; ret = pwm_apply_state(drvdata->pwm, &pstate); if (ret) { dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);