Lines Matching refs:pc

57 	struct lgm_pwm_chip *pc = to_lgm_pwm_chip(chip);  in lgm_pwm_enable()  local
58 struct regmap *regmap = pc->regmap; in lgm_pwm_enable()
67 struct lgm_pwm_chip *pc = to_lgm_pwm_chip(chip); in lgm_pwm_apply() local
72 if (state->polarity != PWM_POLARITY_NORMAL || state->period < pc->period) in lgm_pwm_apply()
78 duty_cycle = min_t(u64, state->duty_cycle, pc->period); in lgm_pwm_apply()
79 val = duty_cycle * LGM_PWM_MAX_DUTY_CYCLE / pc->period; in lgm_pwm_apply()
81 ret = regmap_update_bits(pc->regmap, LGM_PWM_FAN_CON0, LGM_PWM_FAN_DC_MSK, in lgm_pwm_apply()
92 struct lgm_pwm_chip *pc = to_lgm_pwm_chip(chip); in lgm_pwm_get_state() local
95 state->enabled = regmap_test_bits(pc->regmap, LGM_PWM_FAN_CON0, in lgm_pwm_get_state()
98 state->period = pc->period; /* fixed period */ in lgm_pwm_get_state()
100 regmap_read(pc->regmap, LGM_PWM_FAN_CON0, &val); in lgm_pwm_get_state()
102 state->duty_cycle = DIV_ROUND_UP(duty * pc->period, LGM_PWM_MAX_DUTY_CYCLE); in lgm_pwm_get_state()
111 static void lgm_pwm_init(struct lgm_pwm_chip *pc) in lgm_pwm_init() argument
113 struct regmap *regmap = pc->regmap; in lgm_pwm_init()
117 pc->period = LGM_PWM_PERIOD_2WIRE_NS; in lgm_pwm_init()
170 struct lgm_pwm_chip *pc; in lgm_pwm_probe() local
175 pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); in lgm_pwm_probe()
176 if (!pc) in lgm_pwm_probe()
183 pc->regmap = devm_regmap_init_mmio(dev, io_base, &lgm_pwm_regmap_config); in lgm_pwm_probe()
184 if (IS_ERR(pc->regmap)) in lgm_pwm_probe()
185 return dev_err_probe(dev, PTR_ERR(pc->regmap), in lgm_pwm_probe()
205 pc->chip.dev = dev; in lgm_pwm_probe()
206 pc->chip.ops = &lgm_pwm_ops; in lgm_pwm_probe()
207 pc->chip.npwm = 1; in lgm_pwm_probe()
209 lgm_pwm_init(pc); in lgm_pwm_probe()
211 ret = devm_pwmchip_add(dev, &pc->chip); in lgm_pwm_probe()