Module Name: src Committed By: skrll Date: Fri Feb 4 11:00:31 UTC 2011
Modified Files: src/sys/arch/hp700/gsc: harmony.c Log Message: A better workaround hack for PR 41448 Bound the wait loop To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/hp700/gsc/harmony.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hp700/gsc/harmony.c diff -u src/sys/arch/hp700/gsc/harmony.c:1.21 src/sys/arch/hp700/gsc/harmony.c:1.22 --- src/sys/arch/hp700/gsc/harmony.c:1.21 Fri Feb 4 10:56:03 2011 +++ src/sys/arch/hp700/gsc/harmony.c Fri Feb 4 11:00:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: harmony.c,v 1.21 2011/02/04 10:56:03 skrll Exp $ */ +/* $NetBSD: harmony.c,v 1.22 2011/02/04 11:00:30 skrll Exp $ */ /* $OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $ */ @@ -98,7 +98,10 @@ int harmony_set_params(void *, int, int, audio_params_t *, audio_params_t *, stream_filter_list_t *, stream_filter_list_t *); int harmony_round_blocksize(void *, int, int, const audio_params_t *); + +int harmony_control_wait(struct harmony_softc *); int harmony_commit_settings(void *); + int harmony_halt_output(void *); int harmony_halt_input(void *); int harmony_getdev(void *, struct audio_device *); @@ -623,6 +626,24 @@ } int +harmony_control_wait(struct harmony_softc *sc) +{ + uint32_t reg; + int j = 0; + + while (j < 10) { + /* Wait for it to come out of control mode */ + reg = READ_REG(sc, HARMONY_CNTL); + if ((reg & CNTL_C) == 0) + return 0; + DELAY(50000); /* wait 0.05 */ + j++; + } + + return 1; +} + +int harmony_commit_settings(void *vsc) { struct harmony_softc *sc; @@ -669,24 +690,12 @@ offsetof(struct harmony_empty, playback[0][0]), PLAYBACK_EMPTYS * HARMONY_BUFSIZE, BUS_DMASYNC_PREWRITE); - for (;;) { - /* Wait for it to come out of control mode */ - reg = READ_REG(sc, HARMONY_CNTL); - if ((reg & CNTL_C) == 0) - break; - } + harmony_control_wait(sc); bus_space_write_4(sc->sc_bt, sc->sc_bh, HARMONY_CNTL, sc->sc_cntlbits | CNTL_C); -#if 0 - for (;;) { - /* Wait for it to come out of control mode */ - reg = READ_REG(sc, HARMONY_CNTL); - if ((reg & CNTL_C) == 0) - break; - } -#endif + harmony_control_wait(sc); sc->sc_need_commit = 0;