diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/cros_ec.h | 13 | ||||
-rw-r--r-- | include/pwm.h | 8 |
2 files changed, 21 insertions, 0 deletions
diff --git a/include/cros_ec.h b/include/cros_ec.h index eddc23d48f..9396b4d246 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -513,6 +513,19 @@ int cros_ec_efs_verify(struct udevice *dev, enum ec_flash_region region); int cros_ec_battery_cutoff(struct udevice *dev, uint8_t flags); /** + * cros_ec_set_pwm_duty() - Set duty cycle of a generic pwm + * + * Note that duty value needs to be passed to the EC as a 16 bit number + * for increased precision. + * + * @param dev CROS-EC device + * @param index Index of the pwm + * @param duty Desired duty cycle, in 0..EC_PWM_MAX_DUTY range. + * @return 0 if OK, -ve on error + */ +int cros_ec_set_pwm_duty(struct udevice *dev, uint8_t index, uint16_t duty); + +/** * cros_ec_read_limit_power() - Check if power is limited by batter/charger * * Sometimes the battery is low and / or the device is connected to a charger diff --git a/include/pwm.h b/include/pwm.h index f9959706ce..668551e4b8 100644 --- a/include/pwm.h +++ b/include/pwm.h @@ -17,6 +17,10 @@ struct pwm_ops { /** * set_config() - Set the PWM configuration * + * Change both the PWM device's period and it's duty period if + * possible. Otherwise, set an appropriate duty period that best + * matches the given period_ns / duty_ns ratio for the device. + * * @dev: PWM device to update * @channel: PWM channel to update * @period_ns: PWM period in nanoseconds @@ -51,6 +55,10 @@ struct pwm_ops { /** * pwm_set_config() - Set the PWM configuration * + * Change both the PWM device's period and it's duty period if + * possible. Otherwise, set an appropriate duty period that best + * matches the given period_ns / duty_ns ratio for the device. + * * @dev: PWM device to update * @channel: PWM channel to update * @period_ns: PWM period in nanoseconds |