Lines Matching full:prescale
76 u32 val, duty, prescale; in sprd_pwm_get_state() local
99 * The period length is (PRESCALE + 1) * MOD counter steps. in sprd_pwm_get_state()
100 * The duty cycle length is (PRESCALE + 1) * DUTY counter steps. in sprd_pwm_get_state()
102 * period_ns = NSEC_PER_SEC * (prescale + 1) * mod / clk_rate in sprd_pwm_get_state()
103 * duty_ns = NSEC_PER_SEC * (prescale + 1) * duty / clk_rate in sprd_pwm_get_state()
106 prescale = val & SPRD_PWM_PRESCALE_MSK; in sprd_pwm_get_state()
107 tmp = (prescale + 1) * NSEC_PER_SEC * SPRD_PWM_MOD_MAX; in sprd_pwm_get_state()
112 tmp = (prescale + 1) * NSEC_PER_SEC * duty; in sprd_pwm_get_state()
127 u32 prescale, duty; in sprd_pwm_config() local
132 * The period length is (PRESCALE + 1) * MOD counter steps. in sprd_pwm_config()
133 * The duty cycle length is (PRESCALE + 1) * DUTY counter steps. in sprd_pwm_config()
136 * The value for PRESCALE is selected such that the resulting period in sprd_pwm_config()
144 prescale = DIV_ROUND_CLOSEST_ULL(tmp, SPRD_PWM_MOD_MAX) - 1; in sprd_pwm_config()
145 if (prescale > SPRD_PWM_PRESCALE_MSK) in sprd_pwm_config()
146 prescale = SPRD_PWM_PRESCALE_MSK; in sprd_pwm_config()
156 sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_PRESCALE, prescale); in sprd_pwm_config()