Module Name:    src
Committed By:   jmcneill
Date:           Thu May 26 23:42:05 UTC 2011

Modified Files:
        src/sys/dev/i2c: au8522.c au8522var.h

Log Message:
add a function to mute/unmute the audio input


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/au8522.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/au8522var.h

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/i2c/au8522.c
diff -u src/sys/dev/i2c/au8522.c:1.2 src/sys/dev/i2c/au8522.c:1.3
--- src/sys/dev/i2c/au8522.c:1.2	Tue Dec 28 00:11:50 2010
+++ src/sys/dev/i2c/au8522.c	Thu May 26 23:42:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: au8522.c,v 1.2 2010/12/28 00:11:50 jmcneill Exp $ */
+/* $NetBSD: au8522.c,v 1.3 2011/05/26 23:42:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: au8522.c,v 1.2 2010/12/28 00:11:50 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: au8522.c,v 1.3 2011/05/26 23:42:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -257,6 +257,20 @@
 	return (status & AU8522_STATUS_LOCK) == AU8522_STATUS_LOCK ? 1 : 0;
 }
 
+void
+au8522_set_audio(struct au8522 *au, bool onoff)
+{
+	if (onoff) {
+		au8522_write_1(au, AU8522_REG_AUDIO_VOL_L, 0x7f);
+		au8522_write_1(au, AU8522_REG_AUDIO_VOL_R, 0x7f);
+		au8522_write_1(au, AU8522_REG_AUDIO_VOL, 0xff);
+	} else {
+		au8522_write_1(au, AU8522_REG_AUDIO_VOL_L, 0x00);
+		au8522_write_1(au, AU8522_REG_AUDIO_VOL_R, 0x00);
+		au8522_write_1(au, AU8522_REG_AUDIO_VOL, 0x00);
+	}
+}
+
 MODULE(MODULE_CLASS_DRIVER, au8522, NULL);
 
 static int

Index: src/sys/dev/i2c/au8522var.h
diff -u src/sys/dev/i2c/au8522var.h:1.1 src/sys/dev/i2c/au8522var.h:1.2
--- src/sys/dev/i2c/au8522var.h:1.1	Mon Dec 27 15:42:11 2010
+++ src/sys/dev/i2c/au8522var.h	Thu May 26 23:42:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: au8522var.h,v 1.1 2010/12/27 15:42:11 jmcneill Exp $ */
+/* $NetBSD: au8522var.h,v 1.2 2011/05/26 23:42:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca>
@@ -58,5 +58,6 @@
 void		au8522_set_input(struct au8522 *,
 				 au8522_vinput_t, au8522_ainput_t);
 int		au8522_get_signal(struct au8522 *);
+void		au8522_set_audio(struct au8522 *, bool);
 
 #endif /* !_AU8522VAR_H */

Reply via email to