Lines Matching full:prescaler

10  * With the prescaler setting you can select which bit of the counter is used
16 * | prescaler | reset | counter bits | frequency | period length |
25 * - The hardware cannot generate a 100% duty cycle if the prescaler is 0.
26 * - The hardware cannot atomically set the prescaler and the counter value,
28 * - The counter is not reset if you switch the prescaler which leads
55 #define SL28CPLD_PWM_MAX_DUTY_CYCLE(prescaler) (1 << (7 - (prescaler))) argument
56 #define SL28CPLD_PWM_PERIOD(prescaler) \ argument
57 (NSEC_PER_SEC / SL28CPLD_PWM_CLK * SL28CPLD_PWM_MAX_DUTY_CYCLE(prescaler))
64 * max_period_ns = 1 << (7 - prescaler) / SL28CPLD_PWM_CLK * NSEC_PER_SEC
65 * max_duty_cycle = 1 << (7 - prescaler)
99 int prescaler; in sl28cpld_pwm_get_state() local
105 prescaler = FIELD_GET(SL28CPLD_PWM_CTRL_PRESCALER_MASK, reg); in sl28cpld_pwm_get_state()
106 state->period = SL28CPLD_PWM_PERIOD(prescaler); in sl28cpld_pwm_get_state()
113 * Sanitize values for the PWM core. Depending on the prescaler it in sl28cpld_pwm_get_state()
129 unsigned int cycle, prescaler; in sl28cpld_pwm_apply() local
139 * Calculate the prescaler. Pick the biggest period that isn't in sl28cpld_pwm_apply()
142 prescaler = DIV_ROUND_UP_ULL(SL28CPLD_PWM_PERIOD(0), state->period); in sl28cpld_pwm_apply()
143 prescaler = order_base_2(prescaler); in sl28cpld_pwm_apply()
145 if (prescaler > field_max(SL28CPLD_PWM_CTRL_PRESCALER_MASK)) in sl28cpld_pwm_apply()
148 ctrl = FIELD_PREP(SL28CPLD_PWM_CTRL_PRESCALER_MASK, prescaler); in sl28cpld_pwm_apply()
153 cycle = min_t(unsigned int, cycle, SL28CPLD_PWM_MAX_DUTY_CYCLE(prescaler)); in sl28cpld_pwm_apply()
157 * cycle if the prescaler is 0. Set prescaler to 1 instead. We don't in sl28cpld_pwm_apply()
160 * We don't need to check the actual prescaler setting, because only in sl28cpld_pwm_apply()
161 * if the prescaler is 0 we can have this particular value. in sl28cpld_pwm_apply()
170 * To avoid glitches when we switch the prescaler, we have to make sure in sl28cpld_pwm_apply()
173 * Take the current prescaler (or the current period length) into in sl28cpld_pwm_apply()
175 * prescaler first. If the period length is decreasing we have to in sl28cpld_pwm_apply()