diff options
Diffstat (limited to 'sys/arm')
| -rw-r--r-- | sys/arm/allwinner/a10_codec.c | 12 | ||||
| -rw-r--r-- | sys/arm/allwinner/aw_i2s.c | 8 | ||||
| -rw-r--r-- | sys/arm/arm/gic.c | 6 | ||||
| -rw-r--r-- | sys/arm/arm/gic_common.h | 2 | ||||
| -rw-r--r-- | sys/arm/broadcom/bcm2835/bcm2835_audio.c | 161 | ||||
| -rw-r--r-- | sys/arm/broadcom/bcm2835/vc_vchi_audioserv_defs.h | 8 | ||||
| -rw-r--r-- | sys/arm/conf/GENERIC | 6 | ||||
| -rw-r--r-- | sys/arm/freescale/imx/imx6_ssi.c | 30 | ||||
| -rw-r--r-- | sys/arm/freescale/vybrid/vf_sai.c | 22 |
9 files changed, 196 insertions, 59 deletions
diff --git a/sys/arm/allwinner/a10_codec.c b/sys/arm/allwinner/a10_codec.c index 12d389d24243..d3920eddc1f1 100644 --- a/sys/arm/allwinner/a10_codec.c +++ b/sys/arm/allwinner/a10_codec.c @@ -159,7 +159,7 @@ struct a10codec_chinfo { struct a10codec_info { device_t dev; struct resource *res[2]; - struct mtx *lock; + struct mtx lock; bus_dma_tag_t dmat; unsigned dmasize; void *ih; @@ -680,7 +680,7 @@ a10codec_dmaintr(void *priv) struct a10codec_chinfo *ch = priv; unsigned bufsize; - bufsize = sndbuf_getsize(ch->buffer); + bufsize = ch->buffer->bufsize; ch->pos += ch->blocksize; if (ch->pos >= bufsize) @@ -949,7 +949,7 @@ a10codec_chan_trigger(kobj_t obj, void *data, int go) if (!PCMTRIG_COMMON(go)) return (0); - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); switch (go) { case PCMTRIG_START: ch->run = 1; @@ -964,7 +964,7 @@ a10codec_chan_trigger(kobj_t obj, void *data, int go) default: break; } - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); return (0); } @@ -1075,7 +1075,7 @@ a10codec_attach(device_t dev) sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->cfg = (void *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; sc->dev = dev; - sc->lock = snd_mtxcreate(device_get_nameunit(dev), "a10codec softc"); + mtx_init(&sc->lock, device_get_nameunit(dev), "a10codec_softc", MTX_DEF); if (bus_alloc_resources(dev, a10codec_spec, sc->res)) { device_printf(dev, "cannot allocate resources for device\n"); @@ -1180,7 +1180,7 @@ a10codec_attach(device_t dev) fail: bus_release_resources(dev, a10codec_spec, sc->res); - snd_mtxfree(sc->lock); + mtx_destroy(&sc->lock); free(sc, M_DEVBUF); return (ENXIO); diff --git a/sys/arm/allwinner/aw_i2s.c b/sys/arm/allwinner/aw_i2s.c index 87dfb109363f..31c6d9854171 100644 --- a/sys/arm/allwinner/aw_i2s.c +++ b/sys/arm/allwinner/aw_i2s.c @@ -530,10 +530,10 @@ aw_i2s_dai_intr(device_t dev, struct snd_dbuf *play_buf, struct snd_dbuf *rec_bu val = I2S_READ(sc, DA_FSTA); empty = DA_FSTA_TXE_CNT(val); count = sndbuf_getready(play_buf); - size = sndbuf_getsize(play_buf); + size = play_buf->bufsize; readyptr = sndbuf_getreadyptr(play_buf); - samples = (uint8_t*)sndbuf_getbuf(play_buf); + samples = play_buf->buf; written = 0; if (empty > count / 2) empty = count / 2; @@ -556,9 +556,9 @@ aw_i2s_dai_intr(device_t dev, struct snd_dbuf *play_buf, struct snd_dbuf *rec_bu available = DA_FSTA_RXA_CNT(val); count = sndbuf_getfree(rec_buf); - size = sndbuf_getsize(rec_buf); + size = rec_buf->bufsize; freeptr = sndbuf_getfreeptr(rec_buf); - samples = (uint8_t*)sndbuf_getbuf(rec_buf); + samples = rec_buf->buf; recorded = 0; if (available > count / 2) available = count / 2; diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index b1b7aacd63ab..c1b2cf626ed8 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -514,6 +514,12 @@ arm_gic_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) ("arm_gic_read_ivar: Invalid bus type %u", sc->gic_bus)); *result = sc->gic_bus; return (0); + case GIC_IVAR_VGIC: + *result = 0; + return (0); + case GIC_IVAR_SUPPORT_LPIS: + *result = false; + return (0); } return (ENOENT); diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h index c45832ec1782..c2d1b1340b9b 100644 --- a/sys/arm/arm/gic_common.h +++ b/sys/arm/arm/gic_common.h @@ -38,6 +38,7 @@ struct arm_gic_range { #define GIC_IVAR_HW_REV 500 #define GIC_IVAR_BUS 501 #define GIC_IVAR_VGIC 502 +#define GIC_IVAR_SUPPORT_LPIS 503 /* GIC_IVAR_BUS values */ #define GIC_BUS_UNKNOWN 0 @@ -48,6 +49,7 @@ struct arm_gic_range { __BUS_ACCESSOR(gic, hw_rev, GIC, HW_REV, u_int); __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); __BUS_ACCESSOR(gic, vgic, GIC, VGIC, u_int); +__BUS_ACCESSOR(gic, support_lpis, GIC, SUPPORT_LPIS, bool); /* Software Generated Interrupts */ #define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ diff --git a/sys/arm/broadcom/bcm2835/bcm2835_audio.c b/sys/arm/broadcom/bcm2835/bcm2835_audio.c index 2df6ac76124f..1406fcc3d952 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_audio.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_audio.c @@ -113,6 +113,12 @@ struct bcm2835_audio_chinfo { uint64_t retrieved_samples; uint64_t underruns; int starved; + struct bcm_log_vars { + unsigned int bsize ; + int slept_for_lack_of_space ; + } log_vars; +#define DEFAULT_LOG_VALUES \ + ((struct bcm_log_vars) { .bsize = 0 , .slept_for_lack_of_space = 0 }) }; struct bcm2835_audio_info { @@ -164,6 +170,10 @@ struct bcm2835_audio_info { device_printf((sc)->dev, __VA_ARGS__); \ } while(0) +/* Useful for circular buffer calcs */ +#define MOD_DIFF(front,rear,mod) (((mod) + (front) - (rear)) % (mod)) + + static const char * dest_description(uint32_t dest) { @@ -237,10 +247,21 @@ bcm2835_audio_callback(void *param, const VCHI_CALLBACK_REASON_T reason, void *m m.type); } } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { - struct bcm2835_audio_chinfo *ch = m.u.complete.cookie; + unsigned int signaled = 0; + struct bcm2835_audio_chinfo *ch ; +#if defined(__aarch64__) + ch = (void *) ((((size_t)m.u.complete.callback) << 32) + | ((size_t)m.u.complete.cookie)); +#else + ch = (void *) (m.u.complete.cookie); +#endif int count = m.u.complete.count & 0xffff; int perr = (m.u.complete.count & (1U << 30)) != 0; + + BCM2835_LOG_TRACE(sc, "in:: count:0x%x perr:%d\n", + m.u.complete.count, perr); + ch->callbacks++; if (perr) ch->underruns++; @@ -264,13 +285,31 @@ bcm2835_audio_callback(void *param, const VCHI_CALLBACK_REASON_T reason, void *m (uintmax_t)ch->retrieved_samples, (uintmax_t)ch->submitted_samples); } - ch->available_space += count; - ch->retrieved_samples += count; } - if (perr || (ch->available_space >= VCHIQ_AUDIO_PACKET_SIZE)) - cv_signal(&sc->worker_cv); + ch->available_space += count; + ch->retrieved_samples += count; + /* + * XXXMDC + * Experimental: if VC says it's empty, believe it + * Has to come after the usual adjustments + */ + if(perr){ + ch->available_space = VCHIQ_AUDIO_BUFFER_SIZE; + perr = ch->retrieved_samples; // shd be != 0 + } + + if ((ch->available_space >= 1*VCHIQ_AUDIO_PACKET_SIZE)){ + cv_signal(&sc->worker_cv); + signaled = 1; + } } BCM2835_AUDIO_UNLOCK(sc); + if(perr){ + BCM2835_LOG_WARN(sc, + "VC starved; reported %u for a total of %u\n" + "worker %s\n", count, perr, + (signaled ? "signaled": "not signaled")); + } } else BCM2835_LOG_WARN(sc, "%s: unknown m.type: %d\n", __func__, m.type); @@ -371,6 +410,7 @@ bcm2835_audio_stop(struct bcm2835_audio_chinfo *ch) m.type = VC_AUDIO_MSG_TYPE_STOP; m.u.stop.draining = 0; + BCM2835_LOG_INFO(sc,"sending stop\n"); ret = vchi_msg_queue(sc->vchi_handle, &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); @@ -449,18 +489,25 @@ static bool bcm2835_audio_buffer_should_sleep(struct bcm2835_audio_chinfo *ch) { + ch->log_vars.slept_for_lack_of_space = 0; if (ch->playback_state != PLAYBACK_PLAYING) return (true); /* Not enough data */ - if (sndbuf_getready(ch->buffer) < VCHIQ_AUDIO_PACKET_SIZE) { - printf("starve\n"); + /* XXXMDC Take unsubmitted stuff into account */ + if (sndbuf_getready(ch->buffer) + - MOD_DIFF( + ch->unsubmittedptr, + sndbuf_getreadyptr(ch->buffer), + ch->buffer->bufsize + ) < VCHIQ_AUDIO_PACKET_SIZE) { ch->starved++; return (true); } /* Not enough free space */ if (ch->available_space < VCHIQ_AUDIO_PACKET_SIZE) { + ch->log_vars.slept_for_lack_of_space = 1; return (true); } @@ -481,8 +528,13 @@ bcm2835_audio_write_samples(struct bcm2835_audio_chinfo *ch, void *buf, uint32_t m.type = VC_AUDIO_MSG_TYPE_WRITE; m.u.write.count = count; m.u.write.max_packet = VCHIQ_AUDIO_PACKET_SIZE; - m.u.write.callback = NULL; - m.u.write.cookie = ch; +#if defined(__aarch64__) + m.u.write.callback = (uint32_t)(((size_t) ch) >> 32) & 0xffffffff; + m.u.write.cookie = (uint32_t)(((size_t) ch) & 0xffffffff); +#else + m.u.write.callback = (uint32_t) NULL; + m.u.write.cookie = (uint32_t) ch; +#endif m.u.write.silence = 0; ret = vchi_msg_queue(sc->vchi_handle, @@ -529,6 +581,11 @@ bcm2835_audio_worker(void *data) while ((sc->flags_pending == 0) && bcm2835_audio_buffer_should_sleep(ch)) { cv_wait_sig(&sc->worker_cv, &sc->lock); + if ((sc->flags_pending == 0) && + (ch->log_vars.slept_for_lack_of_space)) { + BCM2835_LOG_TRACE(sc, + "slept for lack of space\n"); + } } flags = sc->flags_pending; /* Clear pending flags */ @@ -555,16 +612,25 @@ bcm2835_audio_worker(void *data) BCM2835_AUDIO_LOCK(sc); bcm2835_audio_reset_channel(&sc->pch); ch->playback_state = PLAYBACK_IDLE; + long sub_total = ch->submitted_samples; + long retd = ch->retrieved_samples; BCM2835_AUDIO_UNLOCK(sc); + BCM2835_LOG_INFO(sc, + "stopped audio. submitted a total of %lu " + "having been acked %lu\n", sub_total, retd); continue; } /* Requested to start playback */ if ((flags & AUDIO_PLAY) && (ch->playback_state == PLAYBACK_IDLE)) { + BCM2835_LOG_INFO(sc, "starting audio\n"); + unsigned int bsize = ch->buffer->bufsize; BCM2835_AUDIO_LOCK(sc); ch->playback_state = PLAYBACK_PLAYING; + ch->log_vars.bsize = bsize; BCM2835_AUDIO_UNLOCK(sc); + BCM2835_LOG_INFO(sc, "buffer size is %u\n", bsize); bcm2835_audio_start(ch); } @@ -574,29 +640,84 @@ bcm2835_audio_worker(void *data) if (sndbuf_getready(ch->buffer) == 0) continue; - count = sndbuf_getready(ch->buffer); - size = sndbuf_getsize(ch->buffer); - readyptr = sndbuf_getreadyptr(ch->buffer); + uint32_t i_count; + + /* XXXMDC Take unsubmitted stuff into account */ + count = i_count = sndbuf_getready(ch->buffer) + - MOD_DIFF(ch->unsubmittedptr, + sndbuf_getreadyptr(ch->buffer), + ch->buffer->bufsize); + size = ch->buffer->bufsize; + readyptr = ch->unsubmittedptr; + + int size_changed = 0; + unsigned int available; BCM2835_AUDIO_LOCK(sc); - if (readyptr + count > size) + if (size != ch->log_vars.bsize) { + ch->log_vars.bsize = size; + size_changed = 1; + } + available = ch->available_space; + /* + * XXXMDC + * + * On arm64, got into situations where + * readyptr was less than a packet away + * from the end of the buffer, which led + * to count being set to 0 and, inexorably, starvation. + * Code below tries to take that into account. + * The problem might have been fixed with some of the + * other changes that were made in the meantime, + * but for now this works fine. + */ + if (readyptr + count > size) { count = size - readyptr; - count = min(count, ch->available_space); - count -= (count % VCHIQ_AUDIO_PACKET_SIZE); + } + if(count > ch->available_space){ + count = ch->available_space; + count -= (count % VCHIQ_AUDIO_PACKET_SIZE); + }else if (count > VCHIQ_AUDIO_PACKET_SIZE){ + count -= (count % VCHIQ_AUDIO_PACKET_SIZE); + }else if (size > count + readyptr) { + count = 0; + } BCM2835_AUDIO_UNLOCK(sc); - if (count < VCHIQ_AUDIO_PACKET_SIZE) + if (count % VCHIQ_AUDIO_PACKET_SIZE != 0) { + BCM2835_LOG_WARN(sc, "count: %u initial count: %u " + "size: %u readyptr: %u available: %u\n", count, + i_count,size,readyptr,available); + } + if (size_changed) + BCM2835_LOG_INFO(sc, "bsize changed to %u\n", size); + + if (count == 0) { + BCM2835_LOG_WARN(sc, + "not enough room for a packet: count %d," + " i_count %d, rptr %d, size %d\n", + count, i_count, readyptr, size); continue; + } - buf = (uint8_t*)sndbuf_getbuf(ch->buffer) + readyptr; + buf = ch->buffer->buf + readyptr; bcm2835_audio_write_samples(ch, buf, count); BCM2835_AUDIO_LOCK(sc); - ch->unsubmittedptr = (ch->unsubmittedptr + count) % sndbuf_getsize(ch->buffer); + ch->unsubmittedptr = (ch->unsubmittedptr + count) % + ch->buffer->bufsize; ch->available_space -= count; ch->submitted_samples += count; + long sub = count; + long sub_total = ch->submitted_samples; + long retd = ch->retrieved_samples; KASSERT(ch->available_space >= 0, ("ch->available_space == %d\n", ch->available_space)); BCM2835_AUDIO_UNLOCK(sc); + + BCM2835_LOG_TRACE(sc, + "submitted %lu for a total of %lu having been acked %lu; " + "rptr %d, had %u available\n", sub, sub_total, retd, + readyptr, available); } BCM2835_AUDIO_LOCK(sc); @@ -649,6 +770,8 @@ bcmchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * return NULL; } + ch->log_vars = DEFAULT_LOG_VALUES; + BCM2835_AUDIO_LOCK(sc); bcm2835_worker_update_params(sc); BCM2835_AUDIO_UNLOCK(sc); @@ -662,7 +785,7 @@ bcmchan_free(kobj_t obj, void *data) struct bcm2835_audio_chinfo *ch = data; void *buffer; - buffer = sndbuf_getbuf(ch->buffer); + buffer = ch->buffer->buf; if (buffer) free(buffer, M_DEVBUF); diff --git a/sys/arm/broadcom/bcm2835/vc_vchi_audioserv_defs.h b/sys/arm/broadcom/bcm2835/vc_vchi_audioserv_defs.h index 896e706ff492..ea972ff2d001 100644 --- a/sys/arm/broadcom/bcm2835/vc_vchi_audioserv_defs.h +++ b/sys/arm/broadcom/bcm2835/vc_vchi_audioserv_defs.h @@ -112,8 +112,8 @@ typedef struct typedef struct { uint32_t count; /* in bytes */ - void *callback; - void *cookie; + uint32_t callback; + uint32_t cookie; uint16_t silence; uint16_t max_packet; } VC_AUDIO_WRITE_T; @@ -129,8 +129,8 @@ typedef struct typedef struct { int32_t count; /* Success value */ - void *callback; - void *cookie; + uint32_t callback; + uint32_t cookie; } VC_AUDIO_COMPLETE_T; /* Message header for all messages in HOST->VC direction */ diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 22bb75993834..89841947713d 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -216,6 +216,12 @@ device ffec # Freescale Fast Ethernet Controller device neta # Marvell 10/100/1000 Network controller device smsc # SMSC LAN91C111 +# random(4) +device tpm # Trusted Platform Module +options RANDOM_ENABLE_TPM # enable entropy from TPM 2.0 +options RANDOM_ENABLE_KBD +options RANDOM_ENABLE_MOUSE + # Sound support device sound diff --git a/sys/arm/freescale/imx/imx6_ssi.c b/sys/arm/freescale/imx/imx6_ssi.c index cb77f1454e63..76870cfb29c9 100644 --- a/sys/arm/freescale/imx/imx6_ssi.c +++ b/sys/arm/freescale/imx/imx6_ssi.c @@ -173,7 +173,7 @@ struct sc_info { bus_space_tag_t bst; bus_space_handle_t bsh; device_t dev; - struct mtx *lock; + struct mtx lock; void *ih; int pos; int dma_size; @@ -242,10 +242,10 @@ ssimixer_init(struct snd_mixer *m) mask = SOUND_MASK_PCM; mask |= SOUND_MASK_VOLUME; - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); pcm_setflags(scp->dev, pcm_getflags(scp->dev) | SD_F_SOFTPCMVOL); mix_setdevs(m, mask); - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); return (0); } @@ -290,14 +290,14 @@ ssichan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, scp = (struct sc_pcminfo *)devinfo; sc = scp->sc; - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); ch = &scp->chan[0]; ch->dir = dir; ch->run = 0; ch->buffer = b; ch->channel = c; ch->parent = scp; - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); if (sndbuf_setup(ch->buffer, sc->buf_base, sc->dma_size) != 0) { device_printf(scp->dev, "Can't setup sndbuf.\n"); @@ -318,9 +318,9 @@ ssichan_free(kobj_t obj, void *data) device_printf(scp->dev, "ssichan_free()\n"); #endif - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); /* TODO: free channel buffer */ - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); return (0); } @@ -398,7 +398,7 @@ ssichan_setblocksize(kobj_t obj, void *data, uint32_t blocksize) setup_dma(scp); - return (sndbuf_getblksz(ch->buffer)); + return (ch->buffer->blksz); } uint32_t @@ -415,7 +415,7 @@ ssi_dma_intr(void *arg, int chn) sc = scp->sc; conf = sc->conf; - bufsize = sndbuf_getsize(ch->buffer); + bufsize = ch->buffer->bufsize; sc->pos += conf->period; if (sc->pos >= bufsize) @@ -487,8 +487,8 @@ setup_dma(struct sc_pcminfo *scp) conf->saddr = sc->buf_base_phys; conf->daddr = rman_get_start(sc->res[0]) + SSI_STX0; conf->event = sc->sdma_ev_tx; /* SDMA TX event */ - conf->period = sndbuf_getblksz(ch->buffer); - conf->num_bd = sndbuf_getblkcnt(ch->buffer); + conf->period = ch->buffer->blksz; + conf->num_bd = ch->buffer->blkcnt; /* * Word Length @@ -497,7 +497,7 @@ setup_dma(struct sc_pcminfo *scp) * SSI supports 24 at max. */ - fmt = sndbuf_getfmt(ch->buffer); + fmt = ch->buffer->fmt; if (fmt & AFMT_16BIT) { conf->word_length = 16; @@ -565,7 +565,7 @@ ssichan_trigger(kobj_t obj, void *data, int go) scp = ch->parent; sc = scp->sc; - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); switch (go) { case PCMTRIG_START: @@ -590,7 +590,7 @@ ssichan_trigger(kobj_t obj, void *data, int go) break; } - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); return (0); } @@ -736,7 +736,7 @@ ssi_attach(device_t dev) sc->pos = 0; sc->conf = malloc(sizeof(struct sdma_conf), M_DEVBUF, M_WAITOK | M_ZERO); - sc->lock = snd_mtxcreate(device_get_nameunit(dev), "ssi softc"); + mtx_init(&sc->lock, device_get_nameunit(dev), "ssi softc"); if (sc->lock == NULL) { device_printf(dev, "Can't create mtx\n"); return (ENXIO); diff --git a/sys/arm/freescale/vybrid/vf_sai.c b/sys/arm/freescale/vybrid/vf_sai.c index e895529c4810..6ccfcae2bc2e 100644 --- a/sys/arm/freescale/vybrid/vf_sai.c +++ b/sys/arm/freescale/vybrid/vf_sai.c @@ -138,7 +138,7 @@ struct sc_info { bus_space_tag_t bst; bus_space_handle_t bsh; device_t dev; - struct mtx *lock; + struct mtx lock; uint32_t speed; uint32_t period; void *ih; @@ -206,10 +206,10 @@ saimixer_init(struct snd_mixer *m) mask = SOUND_MASK_PCM; - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); pcm_setflags(scp->dev, pcm_getflags(scp->dev) | SD_F_SOFTPCMVOL); mix_setdevs(m, mask); - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); return (0); } @@ -252,14 +252,14 @@ saichan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, scp = (struct sc_pcminfo *)devinfo; sc = scp->sc; - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); ch = &scp->chan[0]; ch->dir = dir; ch->run = 0; ch->buffer = b; ch->channel = c; ch->parent = scp; - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); if (sndbuf_setup(ch->buffer, sc->buf_base, sc->dma_size) != 0) { device_printf(scp->dev, "Can't setup sndbuf.\n"); @@ -280,9 +280,9 @@ saichan_free(kobj_t obj, void *data) device_printf(scp->dev, "saichan_free()\n"); #endif - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); /* TODO: free channel buffer */ - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); return (0); } @@ -369,7 +369,7 @@ saichan_setblocksize(kobj_t obj, void *data, uint32_t blocksize) sndbuf_resize(ch->buffer, sc->dma_size / blocksize, blocksize); - sc->period = sndbuf_getblksz(ch->buffer); + sc->period = ch->buffer->blksz; return (sc->period); } @@ -513,7 +513,7 @@ saichan_trigger(kobj_t obj, void *data, int go) struct sc_pcminfo *scp = ch->parent; struct sc_info *sc = scp->sc; - snd_mtxlock(sc->lock); + mtx_lock(&sc->lock); switch (go) { case PCMTRIG_START: @@ -532,7 +532,7 @@ saichan_trigger(kobj_t obj, void *data, int go) break; } - snd_mtxunlock(sc->lock); + mtx_unlock(&sc->lock); return (0); } @@ -691,7 +691,7 @@ sai_attach(device_t dev) sc->sr = &rate_map[0]; sc->pos = 0; - sc->lock = snd_mtxcreate(device_get_nameunit(dev), "sai softc"); + mtx_init(&sc->lock, device_get_nameunit(dev), "sai softc"); if (sc->lock == NULL) { device_printf(dev, "Cant create mtx\n"); return (ENXIO); |
