Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/hdaudio Read/modify/write the digital converter ...



details:   https://anonhg.NetBSD.org/src/rev/b21be9bf02fe
branches:  trunk
changeset: 769370:b21be9bf02fe
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Sep 07 12:33:06 2011 +0000

description:
Read/modify/write the digital converter control 1 register when setting up
digital playback instead of clobbering existing state.

diffstat:

 sys/dev/pci/hdaudio/hdafg.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 395712bd827d -r b21be9bf02fe sys/dev/pci/hdaudio/hdafg.c
--- a/sys/dev/pci/hdaudio/hdafg.c       Wed Sep 07 10:19:40 2011 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c       Wed Sep 07 12:33:06 2011 +0000
@@ -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 <support%precedence.co.uk@localhost>
@@ -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);
                        }



Home | Main Index | Thread Index | Old Index