Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c add a function to mute/unmute the audio input



details:   https://anonhg.NetBSD.org/src/rev/02fccd62a6cf
branches:  trunk
changeset: 765438:02fccd62a6cf
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu May 26 23:42:05 2011 +0000

description:
add a function to mute/unmute the audio input

diffstat:

 sys/dev/i2c/au8522.c    |  18 ++++++++++++++++--
 sys/dev/i2c/au8522var.h |   3 ++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diffs (55 lines):

diff -r 9555f7053e36 -r 02fccd62a6cf sys/dev/i2c/au8522.c
--- a/sys/dev/i2c/au8522.c      Thu May 26 22:18:13 2011 +0000
+++ b/sys/dev/i2c/au8522.c      Thu May 26 23:42:05 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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
diff -r 9555f7053e36 -r 02fccd62a6cf sys/dev/i2c/au8522var.h
--- a/sys/dev/i2c/au8522var.h   Thu May 26 22:18:13 2011 +0000
+++ b/sys/dev/i2c/au8522var.h   Thu May 26 23:42:05 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 */



Home | Main Index | Thread Index | Old Index