Lines Matching refs:pwm

73  * @pwm: global index of the PWM device
84 unsigned int pwm;
95 * @pwm: PWM device
98 static inline void pwm_get_state(const struct pwm_device *pwm, struct pwm_state *state)
100 *state = pwm->state;
103 static inline bool pwm_is_enabled(const struct pwm_device *pwm)
107 pwm_get_state(pwm, &state);
112 static inline void pwm_set_period(struct pwm_device *pwm, u64 period)
114 if (pwm) {
115 pwm->state.period = period;
119 static inline u64 pwm_get_period(const struct pwm_device *pwm)
123 pwm_get_state(pwm, &state);
128 static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty)
130 if (pwm) {
131 pwm->state.duty_cycle = duty;
135 static inline u64 pwm_get_duty_cycle(const struct pwm_device *pwm)
139 pwm_get_state(pwm, &state);
144 static inline enum pwm_polarity pwm_get_polarity(const struct pwm_device *pwm)
148 pwm_get_state(pwm, &state);
153 static inline void pwm_get_args(const struct pwm_device *pwm, struct pwm_args *args)
155 *args = pwm->args;
160 * @pwm: PWM device
166 * and polarity fields with the reference values defined in pwm->args.
175 static inline void pwm_init_state(const struct pwm_device *pwm, struct pwm_state *state)
180 pwm_get_state(pwm, state);
183 pwm_get_args(pwm, &args);
200 * pwm_get_state(pwm, &state);
223 * pwm_init_state(pwm, &state);
225 * pwm_apply_state(pwm, &state);
257 int (*request)(struct pwm_chip *chip, struct pwm_device *pwm);
258 void (*free)(struct pwm_chip *chip, struct pwm_device *pwm);
259 int (*capture)(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_capture *result, unsigned long timeout);
260 int (*apply)(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state);
261 void (*get_state)(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_state *state);
265 int (*config)(struct pwm_chip *chip, struct pwm_device *pwm, int duty_ns, int period_ns);
266 int (*set_polarity)(struct pwm_chip *chip, struct pwm_device *pwm, enum pwm_polarity polarity);
267 int (*enable)(struct pwm_chip *chip, struct pwm_device *pwm);
268 void (*disable)(struct pwm_chip *chip, struct pwm_device *pwm);
309 void pwm_free(struct pwm_device *pwm);
310 int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state);
311 int pwm_adjust_config(struct pwm_device *pwm);
315 * @pwm: PWM device
321 static inline int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
325 if (!pwm) {
333 pwm_get_state(pwm, &state);
340 return pwm_apply_state(pwm, &state);
345 * @pwm: PWM device
349 static inline int pwm_enable(struct pwm_device *pwm)
353 if (!pwm) {
357 pwm_get_state(pwm, &state);
363 return pwm_apply_state(pwm, &state);
368 * @pwm: PWM device
370 static inline void pwm_disable(struct pwm_device *pwm)
374 if (!pwm) {
378 pwm_get_state(pwm, &state);
384 pwm_apply_state(pwm, &state);
388 int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result, unsigned long timeout);
389 int pwm_set_chip_data(struct pwm_device *pwm, void *data);
390 void *pwm_get_chip_data(struct pwm_device *pwm);
401 void pwm_put(struct pwm_device *pwm);
406 void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
413 static inline void pwm_free(struct pwm_device *pwm)
417 static inline int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state)
422 static inline int pwm_adjust_config(struct pwm_device *pwm)
427 static inline int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
432 static inline int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result, unsigned long timeout)
437 static inline int pwm_enable(struct pwm_device *pwm)
442 static inline void pwm_disable(struct pwm_device *pwm)
446 static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
451 static inline void *pwm_get_chip_data(struct pwm_device *pwm)
486 static inline void pwm_put(struct pwm_device *pwm)
506 static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
511 static inline void pwm_apply_args(struct pwm_device *pwm)
537 state.polarity = pwm->args.polarity;
538 state.period = pwm->args.period;
540 pwm_apply_state(pwm, &state);