Lines Matching defs:state
48 bool vop_pwm_en; /* indicate voppwm mirror register state */
75 static void rockchip_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_state *state)
90 state->period = DIV_ROUND_CLOSEST_ULL(tmp, pc->clk_rate);
94 state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, pc->clk_rate);
97 state->enabled = (val & enable_conf) == enable_conf;
100 state->polarity = PWM_POLARITY_INVERSED;
102 state->polarity = PWM_POLARITY_NORMAL;
108 static void rockchip_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state)
121 div = (u64)pc->clk_rate * state->period;
124 div = (u64)pc->clk_rate * state->duty_cycle;
142 if (state->oneshot_count > PWM_ONESHOT_COUNT_MAX) {
145 } else if (state->oneshot_count > 0) {
147 ctrl |= (state->oneshot_count - 1) << PWM_ONESHOT_COUNT_SHIFT;
164 if (state->polarity == PWM_POLARITY_INVERSED) {
228 static int rockchip_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state)
243 if (state->polarity != curstate.polarity && enabled && !pc->data->supports_lock) {
251 rockchip_pwm_config(chip, pwm, state);
252 if (state->enabled != enabled) {
253 ret = rockchip_pwm_enable(chip, pwm, state->enabled);
259 if (state->enabled) {
413 dev_err(&pdev->dev, "No active pinctrl state\n");