Lines Matching full:prescaler
116 unsigned int prescaler; in sun4i_pwm_get_state() local
140 prescaler = 1; in sun4i_pwm_get_state()
142 prescaler = prescaler_table[PWM_REG_PRESCAL(val, pwm->hwpwm)]; in sun4i_pwm_get_state()
144 if (prescaler == 0) in sun4i_pwm_get_state()
160 tmp = (u64)prescaler * NSEC_PER_SEC * PWM_REG_DTY(val); in sun4i_pwm_get_state()
163 tmp = (u64)prescaler * NSEC_PER_SEC * PWM_REG_PRD(val); in sun4i_pwm_get_state()
175 unsigned int prescaler = 0; in sun4i_pwm_calculate() local
190 /* First, test without any prescaler when available */ in sun4i_pwm_calculate()
191 prescaler = PWM_PRESCAL_MASK; in sun4i_pwm_calculate()
193 * When not using any prescaler, the clock period in nanoseconds in sun4i_pwm_calculate()
200 prescaler = 0; in sun4i_pwm_calculate()
203 if (prescaler == 0) { in sun4i_pwm_calculate()
205 for (prescaler = 0; prescaler < PWM_PRESCAL_MASK; prescaler++) { in sun4i_pwm_calculate()
206 unsigned int pval = prescaler_table[prescaler]; in sun4i_pwm_calculate()
227 *prsclr = prescaler; in sun4i_pwm_calculate()
239 unsigned int delay_us, prescaler = 0; in sun4i_pwm_apply() local
252 ret = sun4i_pwm_calculate(sun4ichip, state, &duty, &period, &prescaler, in sun4i_pwm_apply()
276 if (PWM_REG_PRESCAL(ctrl, pwm->hwpwm) != prescaler) { in sun4i_pwm_apply()
277 /* Prescaler changed, the clock has to be gated */ in sun4i_pwm_apply()
282 ctrl |= BIT_CH(prescaler, pwm->hwpwm); in sun4i_pwm_apply()