Scroll to navigation

PWM_SET_RELATIVE_DUT(9) Pulse-Width Modulation (PWM) PWM_SET_RELATIVE_DUT(9)

NAME

pwm_set_relative_duty_cycle - Set a relative duty cycle value

SYNOPSIS

int pwm_set_relative_duty_cycle(struct pwm_state * state, unsigned int duty_cycle, unsigned int scale);

ARGUMENTS

state
PWM state to fill
duty_cycle
relative duty cycle value
scale
scale in which duty_cycle is expressed

DESCRIPTION

This functions converts a relative into an absolute duty cycle (expressed in nanoseconds), and puts the result in state->duty_cycle.
For example if you want to configure a 50% duty cycle, call:
pwm_init_state(pwm, state); pwm_set_relative_duty_cycle(state, 50, 100); pwm_apply_state(pwm, state);
This functions returns -EINVAL if duty_cycle and/or scale are inconsistent ( scale == 0 or duty_cycle > scale).

COPYRIGHT

January 2017 Kernel Hackers Manual 4.8.