Lines Matching refs:pwm
92 { .compat = "brcm,bcm2835-pwm" },
165 /* The PWM hardware can be used by vcaudio if the
183 struct bcm_pwm_channel *pwm;
193 pwm = &sc->sc_channels[num];
196 if (pwm->inuse)
197 pwm = NULL;
199 pwm->inuse = true;
202 if (pwm) {
203 pwm->datsave = PWM_READ(pwm->sc, pwm->dat);
204 pwm->ctlsave = PWM_READ(pwm->sc, PWM_CTL);
205 pwm->rngsave = PWM_READ(pwm->sc, pwm->rng);
208 return pwm;
212 bcm_pwm_free(struct bcm_pwm_channel *pwm)
214 struct bcm2835pwm_softc *sc = pwm->sc;
216 KASSERT(pwm->inuse);
218 PWM_WRITE(pwm->sc, pwm->rng, pwm->rngsave);
219 PWM_WRITE(pwm->sc, PWM_CTL, pwm->ctlsave & ~PWM_CTL_WRITEZERO);
220 PWM_WRITE(pwm->sc, pwm->dat, pwm->datsave);
223 pwm->inuse = false;
228 bcm_pwm_control(struct bcm_pwm_channel *pwm, uint32_t ctl, uint32_t rng)
230 struct bcm2835pwm_softc *sc = pwm->sc;
233 KASSERT(pwm->inuse);
238 w = PWM_READ(pwm->sc, PWM_CTL);
239 ctl = (w & ~pwm->ctlmask) | __SHIFTIN(ctl, pwm->ctlmask);
246 PWM_WRITE(sc, pwm->rng, rng);
251 bcm_pwm_status(struct bcm_pwm_channel *pwm)
262 w = PWM_READ(pwm->sc, PWM_STA);
263 PWM_WRITE(pwm->sc, PWM_STA, w &
264 (pwm->stamask | pwm->gapomask | common));
266 w = __SHIFTIN(__SHIFTOUT(w, pwm->stamask), PWM_STA_STA)
267 | __SHIFTIN(__SHIFTOUT(w, pwm->gapomask), PWM_STA_GAPO)
292 bcm_pwm_write(struct bcm_pwm_channel *pwm, uint32_t *data1, uint32_t *data2,
295 struct bcm2835pwm_softc *sc = pwm->sc;
300 KASSERT(pwm->inuse);
317 bcm_pwm_set(struct bcm_pwm_channel *pwm, uint32_t w)
319 struct bcm2835pwm_softc *sc = pwm->sc;
321 PWM_WRITE(sc, pwm->dat, w);
325 bcm_pwm_flush(struct bcm_pwm_channel *pwm)
327 struct bcm2835pwm_softc *sc = pwm->sc;
333 bcm_pwm_dma_enable(struct bcm_pwm_channel *pwm, bool enable)
335 struct bcm2835pwm_softc *sc = pwm->sc;
353 bcm_pwm_dma_address(struct bcm_pwm_channel *pwm)
355 struct bcm2835pwm_softc *sc = pwm->sc;