diff --git a/sys/arch/arm/xscale/pxa2x0_i2s.c b/sys/arch/arm/xscale/pxa2x0_i2s.c index 7f699d8dbacd..db2c4b155450 100644 --- a/sys/arch/arm/xscale/pxa2x0_i2s.c +++ b/sys/arch/arm/xscale/pxa2x0_i2s.c @@ -1,4 +1,4 @@ -/* $NetBSD: pxa2x0_i2s.c,v 1.7 2007/10/17 19:53:44 garbled Exp $ */ +/* $NetBSD: pxa2x0_i2s.c,v 1.8 2009/03/13 13:55:18 nonaka Exp $ */ /* $OpenBSD: pxa2x0_i2s.c,v 1.7 2006/04/04 11:45:40 pascoe Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pxa2x0_i2s.c,v 1.7 2007/10/17 19:53:44 garbled Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pxa2x0_i2s.c,v 1.8 2009/03/13 13:55:18 nonaka Exp $"); #include #include @@ -232,8 +232,8 @@ pxa2x0_i2s_allocm(void *hdl, int direction, size_t size, dx->dx_cookie = sc; dx->dx_priority = DMAC_PRIORITY_NORMAL; - dx->dx_dev_width = DCMD_WIDTH_4; - dx->dx_burst_size = DCMD_SIZE_32; + dx->dx_dev_width = DMAC_DEV_WIDTH_4; + dx->dx_burst_size = DMAC_BURST_SIZE_32; p->next = sc->sc_dmas; sc->sc_dmas = p; @@ -259,7 +259,7 @@ pxa2x0_i2s_freem(void *hdl, void *ptr, struct malloc_type *type) struct pxa2x0_i2s_softc *sc = hdl; struct pxa2x0_i2s_dma **pp, *p; - for (pp = &(sc->sc_dmas); (p = *pp) != NULL; pp = &p->next) { + for (pp = &sc->sc_dmas; (p = *pp) != NULL; pp = &p->next) { if (p->addr == ptr) { pxa2x0_dmac_abort_xfer(p->dx); pxa2x0_dmac_free_xfer(p->dx); @@ -305,9 +305,9 @@ pxa2x0_i2s_round_blocksize(void *hdl, int bs, int mode, /* Enforce individual DMA block size limit */ if (bs > DCMD_LENGTH_MASK) - return (DCMD_LENGTH_MASK & ~0x03); + return (DCMD_LENGTH_MASK & ~0x07); - return (bs + 0x03) & ~0x03; /* 32-bit multiples */ + return (bs + 0x07) & ~0x07; /* XXX: 64-bit multiples */ } size_t @@ -356,28 +356,28 @@ pxa2x0_i2s_start_output(void *hdl, void *block, int bsize, struct pxa2x0_i2s_softc *sc = hdl; struct pxa2x0_i2s_dma *p; struct dmac_xfer *dx; - int rv; if (sc->sc_txdma) return EBUSY; - sc->sc_txfunc = tx_func; - sc->sc_txarg = tx_arg; - /* Find mapping which contains block completely */ - for (p = sc->sc_dmas; p != NULL && (((char *)block < (char *)p->addr) || - ((char *)block + bsize > (char *)p->addr + p->size)); p = p->next) + for (p = sc->sc_dmas; + p != NULL && + (((char*)block < (char *)p->addr) || + ((char *)block + bsize > (char *)p->addr + p->size)); + p = p->next) { continue; /* Nothing */ - + } if (p == NULL) { - printf("pxa2x0_i2s_start_output: request with bad start " - "address: %p, size: %d)\n", block, bsize); + aprint_error("pxa2x0_i2s_start_output: " + "request with bad start address: %p, size: %d)\n", + block, bsize); return ENXIO; } sc->sc_txdma = p; - p->segs[0].ds_addr = p->map->dm_segs[0].ds_addr - + ((char *)block - (char *)p->addr); + p->segs[0].ds_addr = p->map->dm_segs[0].ds_addr + + ((char *)block - (char *)p->addr); p->segs[0].ds_len = bsize; dx = p->dx; @@ -392,10 +392,11 @@ pxa2x0_i2s_start_output(void *hdl, void *block, int bsize, dx->dx_desc[DMAC_DESC_DST].xd_nsegs = 1; dx->dx_desc[DMAC_DESC_DST].xd_dma_segs = &sc->sc_dr; - /* Start DMA */ - rv = pxa2x0_dmac_start_xfer(dx); + sc->sc_txfunc = tx_func; + sc->sc_txarg = tx_arg; - return rv; + /* Start DMA */ + return pxa2x0_dmac_start_xfer(dx); } int @@ -405,28 +406,28 @@ pxa2x0_i2s_start_input(void *hdl, void *block, int bsize, struct pxa2x0_i2s_softc *sc = hdl; struct pxa2x0_i2s_dma *p; struct dmac_xfer *dx; - int rv; if (sc->sc_rxdma) return EBUSY; - sc->sc_rxfunc = rx_func; - sc->sc_rxarg = rx_arg; - /* Find mapping which contains block completely */ - for (p = sc->sc_dmas; p != NULL && (((char *)block < (char *)p->addr) || - ((char *)block + bsize > (char *)p->addr + p->size)); p = p->next) + for (p = sc->sc_dmas; + p != NULL && + (((char*)block < (char *)p->addr) || + ((char *)block + bsize > (char *)p->addr + p->size)); + p = p->next) { continue; /* Nothing */ - + } if (p == NULL) { - printf("pxa2x0_i2s_start_input: request with bad start " - "address: %p, size: %d)\n", block, bsize); + aprint_error("pxa2x0_i2s_start_input: " + "request with bad start address: %p, size: %d)\n", + block, bsize); return ENXIO; } - sc->sc_rxdma = p; - p->segs[0].ds_addr = p->map->dm_segs[0].ds_addr - + ((char *)block - (char *)p->addr); + + p->segs[0].ds_addr = p->map->dm_segs[0].ds_addr + + ((char *)block - (char *)p->addr); p->segs[0].ds_len = bsize; dx = p->dx; @@ -441,31 +442,30 @@ pxa2x0_i2s_start_input(void *hdl, void *block, int bsize, dx->dx_desc[DMAC_DESC_DST].xd_nsegs = p->nsegs; dx->dx_desc[DMAC_DESC_DST].xd_dma_segs = p->segs; - /* Start DMA */ - rv = pxa2x0_dmac_start_xfer(dx); + sc->sc_rxfunc = rx_func; + sc->sc_rxarg = rx_arg; - return rv; + /* Start DMA */ + return pxa2x0_dmac_start_xfer(dx); } static void pxa2x0_i2s_dmac_ointr(struct dmac_xfer *dx, int status) { struct pxa2x0_i2s_softc *sc = dx->dx_cookie; - struct pxa2x0_i2s_dma *p = sc->sc_txdma; int s; - if (p == NULL) { + if (sc->sc_txdma == NULL) { panic("pxa2x_i2s_dmac_ointr: bad TX DMA descriptor!"); } - - if (p->dx != dx) { + if (sc->sc_txdma->dx != dx) { panic("pxa2x_i2s_dmac_ointr: xfer mismatch!"); } + sc->sc_txdma = NULL; if (status) { - printf("%s: pxa2x0_i2s_dmac_ointr: " - "non-zero completion status %d\n", - sc->sc_dev.dv_xname, status); + aprint_error("pxa2x0_i2s_dmac_ointr: " + "non-zero completion status %d\n", status); } s = splaudio(); @@ -477,23 +477,22 @@ static void pxa2x0_i2s_dmac_iintr(struct dmac_xfer *dx, int status) { struct pxa2x0_i2s_softc *sc = dx->dx_cookie; - struct pxa2x0_i2s_dma *p = sc->sc_rxdma; int s; - if (p == NULL) { + if (sc->sc_rxdma == NULL) { panic("pxa2x_i2s_dmac_iintr: bad RX DMA descriptor!"); } - - if (p->dx != dx) { + if (sc->sc_rxdma->dx != dx) { panic("pxa2x_i2s_dmac_iintr: xfer mismatch!"); } + sc->sc_rxdma = NULL; if (status) { - printf("%s: pxa2x0_i2s_dmac_iintr: " - "non-zero completion status %d\n", - sc->sc_dev.dv_xname, status); + aprint_error("pxa2x0_i2s_dmac_iintr: " + "non-zero completion status %d\n", status); } + s = splaudio(); (sc->sc_rxfunc)(sc->sc_rxarg); splx(s); diff --git a/sys/arch/zaurus/conf/GENERIC b/sys/arch/zaurus/conf/GENERIC index e3bd6b771288..c1d3b73e2e76 100644 --- a/sys/arch/zaurus/conf/GENERIC +++ b/sys/arch/zaurus/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.22 2009/03/11 09:02:04 nonaka Exp $ +# $NetBSD: GENERIC,v 1.23 2009/03/13 13:55:18 nonaka Exp $ # # GENERIC machine description file # @@ -208,11 +208,11 @@ lcd0 at pxaip? wsdisplay* at lcd? console ? # Audio -#zaudio0 at pxaip? -#audio* at zaudio? +zaudio0 at pxaip? +audio* at zaudio? # Audio support -#audio* at audiobus? +audio* at audiobus? # integrated 16550 UARTs options COM_PXA2X0 diff --git a/sys/arch/zaurus/dev/zaudio.c b/sys/arch/zaurus/dev/zaudio.c index cd66170fdab0..88a6c1a9a2e9 100644 --- a/sys/arch/zaurus/dev/zaudio.c +++ b/sys/arch/zaurus/dev/zaudio.c @@ -1,4 +1,4 @@ -/* $NetBSD: zaudio.c,v 1.8 2009/03/11 09:04:50 nonaka Exp $ */ +/* $NetBSD: zaudio.c,v 1.9 2009/03/13 13:55:18 nonaka Exp $ */ /* $OpenBSD: zaurus_audio.c,v 1.8 2005/08/18 13:23:02 robert Exp $ */ /* @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zaudio.c,v 1.8 2009/03/11 09:04:50 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zaudio.c,v 1.9 2009/03/13 13:55:18 nonaka Exp $"); #include #include @@ -148,33 +148,34 @@ static paddr_t zaudio_mappage(void *, void *, off_t, int); static int zaudio_get_props(void *); struct audio_hw_if wm8750_hw_if = { - zaudio_open, - zaudio_close, - NULL, - zaudio_query_encoding, - zaudio_set_params, - zaudio_round_blocksize, - NULL, - NULL, - NULL, - zaudio_start_output, - zaudio_start_input, - zaudio_halt_output, - zaudio_halt_input, - NULL, - zaudio_getdev, - NULL, - zaudio_set_port, - zaudio_get_port, - zaudio_query_devinfo, - zaudio_allocm, - zaudio_freem, - zaudio_round_buffersize, - zaudio_mappage, - zaudio_get_props, - NULL, - NULL, - NULL, + .open = zaudio_open, + .close = zaudio_close, + .drain = NULL, + .query_encoding = zaudio_query_encoding, + .set_params = zaudio_set_params, + .round_blocksize = zaudio_round_blocksize, + .commit_settings = NULL, + .init_output = NULL, + .init_input = NULL, + .start_output = zaudio_start_output, + .start_input = zaudio_start_input, + .halt_output = zaudio_halt_output, + .halt_input = zaudio_halt_input, + .speaker_ctl = NULL, + .getdev = zaudio_getdev, + .setfd = NULL, + .set_port = zaudio_set_port, + .get_port = zaudio_get_port, + .query_devinfo = zaudio_query_devinfo, + .allocm = zaudio_allocm, + .freem = zaudio_freem, + .round_buffersize = zaudio_round_buffersize, + .mappage = zaudio_mappage, + .get_props = zaudio_get_props, + .trigger_output = NULL, + .trigger_input = NULL, + .dev_ioctl = NULL, + .powerstate = NULL, }; static const uint16_t playback_registers[][2] = {