Module Name: src Committed By: jmcneill Date: Wed Sep 7 12:33:06 UTC 2011
Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: Read/modify/write the digital converter control 1 register when setting up digital playback instead of clobbering existing state. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdafg.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/dev/pci/hdaudio/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.5 src/sys/dev/pci/hdaudio/hdafg.c:1.6 --- src/sys/dev/pci/hdaudio/hdafg.c:1.5 Wed Sep 7 00:16:40 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Wed Sep 7 12:33:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.6 2011/09/07 12:33:06 jmcneill Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd <supp...@precedence.co.uk> @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.5 2011/09/07 00:16:40 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.6 2011/09/07 12:33:06 jmcneill Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -3041,8 +3041,6 @@ KASSERT(mode == AUMODE_PLAY || mode == AUMODE_RECORD); - dfmt = COP_DIGITAL_CONVCTRL1_DIGEN; - if (mode == AUMODE_PLAY) fmt = hdaudio_stream_param(sc->sc_audiodev.ad_playback, &sc->sc_pparam); @@ -3050,8 +3048,6 @@ fmt = hdaudio_stream_param(sc->sc_audiodev.ad_capture, &sc->sc_rparam); - if (fmt & HDAUDIO_FMT_TYPE_NONPCM) - dfmt |= COP_DIGITAL_CONVCTRL1_NAUDIO; for (i = 0; i < sc->sc_nassocs; i++) { if (as[i].as_enable == false) @@ -3112,6 +3108,13 @@ hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_CONVERTER_FORMAT, fmt); if (w->w_p.aw_cap & COP_AWCAP_DIGITAL) { + dfmt = hdaudio_command(sc->sc_codec, w->w_nid, + CORB_GET_DIGITAL_CONVERTER_CONTROL_1, 0); + dfmt |= COP_DIGITAL_CONVCTRL1_DIGEN; + if (fmt & HDAUDIO_FMT_TYPE_NONPCM) + dfmt |= COP_DIGITAL_CONVCTRL1_NAUDIO; + else + dfmt &= ~COP_DIGITAL_CONVCTRL1_NAUDIO; hdaudio_command(sc->sc_codec, w->w_nid, CORB_SET_DIGITAL_CONVERTER_CONTROL_1, dfmt); }