Lines Matching refs:scale
193 * @scale: target scale of the relative duty cycle
203 static inline unsigned int pwm_get_relative_duty_cycle(const struct pwm_state *state, unsigned int scale)
209 return DIV_ROUND_CLOSEST_ULL((u64)state->duty_cycle * scale, state->period);
216 * @scale: scale in which @duty_cycle is expressed
227 * This functions returns -EINVAL if @duty_cycle and/or @scale are
228 * inconsistent (@scale == 0 or @duty_cycle > @scale).
230 static inline int pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle, unsigned int scale)
232 if (!scale || duty_cycle > scale) {
236 state->duty_cycle = DIV_ROUND_CLOSEST_ULL((u64)duty_cycle * state->period, scale);