summaryrefslogtreecommitdiff
path: root/sys/dev/pci/azalia.c
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2008-10-16 19:16:59 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2008-10-16 19:16:59 +0000
commit90aabd4ca2cee27b46f35ad2bde34bdc150da7d6 (patch)
treeecb3705ba40ce2f839fff414e3d0b2eae90c396d /sys/dev/pci/azalia.c
parentbd4e71e6bed07a52899e9b2eb7b4088e57f0a007 (diff)
Add S/PDIF support. From NetBSD.
Clean up a little while here. from Alexey Suslikov, thanks tested by several as part of a larger diff, thanks also
Diffstat (limited to 'sys/dev/pci/azalia.c')
-rw-r--r--sys/dev/pci/azalia.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index 8600d3a0f82..3f7e11aa0f9 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.59 2008/10/12 10:42:38 jakemsr Exp $ */
+/* $OpenBSD: azalia.c,v 1.60 2008/10/16 19:16:58 jakemsr Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -36,7 +36,6 @@
*
*
* TO DO:
- * - S/PDIF
* - power hook
* - multiple codecs (needed?)
* - multiple streams (needed?)
@@ -1513,6 +1512,7 @@ int
azalia_codec_connect_stream(codec_t *this, int dir, uint16_t fmt, int number)
{
const convgroup_t *group;
+ uint32_t v;
int i, err, startchan, nchan;
nid_t nid;
boolean_t flag222;
@@ -1550,6 +1550,14 @@ azalia_codec_connect_stream(codec_t *this, int dir, uint16_t fmt, int number)
stream_chan, NULL);
if (err)
goto exit;
+ if (this->w[nid].widgetcap & COP_AWCAP_DIGITAL) {
+ /* enable S/PDIF */
+ this->comresp(this, nid, CORB_GET_DIGITAL_CONTROL,
+ 0, &v);
+ v = (v & 0xff) | CORB_DCC_DIGEN;
+ this->comresp(this, nid, CORB_SET_DIGITAL_CONTROL_L,
+ v, NULL);
+ }
startchan += WIDGET_CHANNELS(&this->w[nid]);
}
@@ -1562,6 +1570,7 @@ int
azalia_codec_disconnect_stream(codec_t *this, int dir)
{
const convgroup_t *group;
+ uint32_t v;
int i;
nid_t nid;
@@ -1573,6 +1582,12 @@ azalia_codec_disconnect_stream(codec_t *this, int dir)
nid = group->conv[i];
this->comresp(this, nid, CORB_SET_CONVERTER_STREAM_CHANNEL,
0, NULL); /* stream#0 */
+ if (this->w[nid].widgetcap & COP_AWCAP_DIGITAL) {
+ /* disable S/PDIF */
+ this->comresp(this, nid, CORB_GET_DIGITAL_CONTROL, 0, &v);
+ v = (v & ~CORB_DCC_DIGEN) & 0xff;
+ this->comresp(this, nid, CORB_SET_DIGITAL_CONTROL_L, v, NULL);
+ }
}
return 0;
}