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 Enable sysbeep(4) to be heard on speaker...



details:   https://anonhg.NetBSD.org/src/rev/e1c0dbf16694
branches:  trunk
changeset: 332430:e1c0dbf16694
user:      nat <nat%NetBSD.org@localhost>
date:      Sun Sep 21 10:41:22 2014 +0000

description:
Enable sysbeep(4) to be heard on speakers on Toughbook mk1 and mk5
computers.  Also on computers with SigmaTel STAC 9200(D), 9202(D)
9404(D), 9205(D) hdaudio controllers as well as Realtek ALC 231
hdaudio controllers reporting as ALC 269.

Addresses PR 45778.
Addresses PR 48495.

This commit was approved by christos@

diffstat:

 sys/dev/pci/hdaudio/hdafg.c |  66 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 2 deletions(-)

diffs (98 lines):

diff -r 58fc85b2e5bc -r e1c0dbf16694 sys/dev/pci/hdaudio/hdafg.c
--- a/sys/dev/pci/hdaudio/hdafg.c       Sun Sep 21 09:48:32 2014 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c       Sun Sep 21 10:41:22 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.22 2014/09/19 17:23:35 christos Exp $ */
+/* $NetBSD: hdafg.c,v 1.23 2014/09/21 10:41:22 nat 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.22 2014/09/19 17:23:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.23 2014/09/21 10:41:22 nat Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -339,6 +339,7 @@
                                        prop_dictionary_t);
 static int     hdafg_codec_info(void *, prop_dictionary_t,
                                       prop_dictionary_t);
+static void    hdafg_enable_analog_beep(struct hdafg_softc *);
 
 CFATTACH_DECL2_NEW(
     hdafg,
@@ -3688,6 +3689,9 @@
        if (1) hdafg_widget_pin_dump(sc);
        hdafg_assoc_dump(sc);
 
+       hda_debug(sc, "enabling analog beep\n");
+       hdafg_enable_analog_beep(sc);
+
        hda_debug(sc, "configuring encodings\n");
        sc->sc_audiodev.ad_sc = sc;
        hdafg_configure_encodings(sc);
@@ -4361,3 +4365,61 @@
                return ENOTTY;
        }
 }
+
+#define HDAFG_GET_ANACTRL              0xfe0
+#define HDAFG_SET_ANACTRL              0x7e0
+#define HDAFG_ANALOG_BEEP_EN           __BIT(5)
+
+static void
+hdafg_enable_analog_beep(struct hdafg_softc *sc)
+{
+       int nid;
+       uint32_t response;
+       
+       switch (sc->sc_vendor) {
+       case HDAUDIO_VENDOR_SIGMATEL:
+               switch (sc->sc_product) {
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9200:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9200D:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9202:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9202D:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9204:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9204D:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9205:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9205_1:
+               case HDAUDIO_PRODUCT_SIGMATEL_STAC9205D:
+                       nid = 0x01;
+
+                       response = hdaudio_command(sc->sc_codec, nid,
+                           HDAFG_GET_ANACTRL, 0x00);
+                       hda_delay(100);
+
+                       response |= HDAFG_ANALOG_BEEP_EN;
+
+                       hdaudio_command(sc->sc_codec, nid, HDAFG_SET_ANACTRL,
+                           response);
+                       hda_delay(100);
+                       break;
+               default:
+                       break;
+               }
+               break;
+       case HDAUDIO_VENDOR_REALTEK:
+               switch (sc->sc_product) {
+               case HDAUDIO_PRODUCT_REALTEK_ALC269:
+                       /* The Panasonic Toughbook CF19 - Mk 5 uses a Realtek
+                        * ALC231 that identifies as an ALC269.
+                        * This unmutes the PCBEEP on the speaker.
+                        */
+                       nid = 0xf;
+                       response = hdaudio_command(sc->sc_codec, nid,
+                           CORB_SET_AMPLIFIER_GAIN_MUTE, 0x7100);
+                       hda_delay(100);
+                       break;
+               default:
+                       break;
+               }
+       default:
+               break;
+       }
+}



Home | Main Index | Thread Index | Old Index