Lines Matching full:period

17  *   As setting the period/duty cycle takes 4 register writes, there is a window
18 * in which this races against the start of a new period.
23 * period. Therefore to get a 0% waveform, the output is set the max high/low
25 * If the duty cycle is 0%, and the requested period is less than the
26 * available period resolution, this will manifest as a ~100% waveform (with
28 * - The PWM period is set for the whole IP block not per channel. The driver
29 * will only change the period if no other PWM output is enabled.
59 struct mutex lock; /* protects the shared period */
71 bool enable, u64 period) in mchp_core_pwm_enable() argument
94 * applied to the waveform at the beginning of the next period. in mchp_core_pwm_enable()
98 mchp_core_pwm->update_timestamp = ktime_add_ns(ktime_get(), period); in mchp_core_pwm_enable()
109 * once the current period has ended. in mchp_core_pwm_wait_for_sync_update()
139 * Calculate the duty cycle in multiples of the prescaled period: in mchp_core_pwm_calc_duty()
190 * Calculate the period cycles and prescale values. in mchp_core_pwm_calc_period()
191 * The registers are each 8 bits wide & multiplied to compute the period in mchp_core_pwm_calc_period()
194 * period = ------------------------------------- in mchp_core_pwm_calc_period()
196 * so the maximum period that can be generated is 0x10000 times the in mchp_core_pwm_calc_period()
197 * period of the input clock. in mchp_core_pwm_calc_period()
201 * of the clock period attainable is (0xff + 1) * (0xfe + 1) = 0xff00 in mchp_core_pwm_calc_period()
206 * It's therefore not possible to set a period lower than 1/clk_rate, so in mchp_core_pwm_calc_period()
207 * if tmp is 0, abort. Without aborting, we will set a period that is in mchp_core_pwm_calc_period()
211 tmp = mul_u64_u64_div_u64(state->period, clk_rate, NSEC_PER_SEC); in mchp_core_pwm_calc_period()
223 * is as finegrain as possible, while also keeping the period less than in mchp_core_pwm_calc_period()
230 * Integer division will ensure a round down, so the period will thereby in mchp_core_pwm_calc_period()
237 * As we must produce a period less than that requested, and for the in mchp_core_pwm_calc_period()
248 * period * clk_rate in mchp_core_pwm_calc_period()
253 * period * clk_rate in mchp_core_pwm_calc_period()
261 * period * clk_rate in mchp_core_pwm_calc_period()
284 mchp_core_pwm_enable(chip, pwm, false, pwm->state.period); in mchp_core_pwm_apply_locked()
305 * As all the channels share the same period, do not allow it to be in mchp_core_pwm_apply_locked()
307 * If the period is locked, it may not be possible to use a period in mchp_core_pwm_apply_locked()
328 * The period is locked and we cannot change this, so we abort. in mchp_core_pwm_apply_locked()
340 * Because the period is not per channel, it is possible that the in mchp_core_pwm_apply_locked()
341 * requested duty cycle is longer than the period, in which case cap it in mchp_core_pwm_apply_locked()
342 * to the period, IOW a 100% duty cycle. in mchp_core_pwm_apply_locked()
354 mchp_core_pwm_enable(chip, pwm, true, pwm->state.period); in mchp_core_pwm_apply_locked()
396 * Calculating the period: in mchp_core_pwm_get_state()
397 * The registers are each 8 bits wide & multiplied to compute the period in mchp_core_pwm_get_state()
400 * period = ------------------------------------- in mchp_core_pwm_get_state()
411 state->period = (period_steps + 1) * (prescale + 1); in mchp_core_pwm_get_state()
412 state->period *= NSEC_PER_SEC; in mchp_core_pwm_get_state()
413 state->period = DIV64_U64_ROUND_UP(state->period, rate); in mchp_core_pwm_get_state()
421 state->duty_cycle = state->period; in mchp_core_pwm_get_state()
422 state->period *= 2; in mchp_core_pwm_get_state()