NetBSD-Bugs archive

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

kern/48495: no sysbeep on speakers on Panasonic Toughbook mk5 after hdaudio attach



>Number:         48495
>Category:       kern
>Synopsis:       no sysbeep on speakers on Panasonic Toughbook mk5 after 
>hdaudio attach
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 04 00:15:00 +0000 2014
>Originator:     Nat Sloss
>Release:        NetBSD 6.1.1
>Organization:
>Environment:
NetBSD beast 6.1.1_PATCH NetBSD 6.1.1_PATCH (C3TEST) #0: Thu Jan  2 10:54:36 
EST 2014  build@microrusty:/usr/src/sys/arch/i386/compile/obj/C3TEST i386
>Description:
Sysbeep can be heard on headphones but not through the speaker on a Panasonic 
Toughbook mk5.

The audio codec is a Realtek ALC231 which wrongly identifies as an ALC269.  
After resetting the hdaudio device the mixer for the speakers (nid 0xf) mutes 
the input from the mixer that the analogue pc beep is attached to (nid 0xb and 
nid 0x1d respectively.)
>How-To-Repeat:
In a tty with headphones connected type:
printf "\007" (you will hear sysbeep)

Disconnect the headphones and repeat the command above and you wont hear 
sysbeep.
>Fix:
Apply this patch:

NB: This patch is a continuation of an earlier PR #45778 as I think that an 
analogue pc beep enable function is the best place for the code of analogue pc 
beep quirks.

Index: sys/dev/pci/hdaudio/hdafg.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/hdaudio/hdafg.c,v
retrieving revision 1.15.2.1
diff -u -r1.15.2.1 hdafg.c
--- sys/dev/pci/hdaudio/hdafg.c 17 Mar 2012 17:26:07 -0000      1.15.2.1
+++ sys/dev/pci/hdaudio/hdafg.c 3 Jan 2014 23:54:54 -0000
@@ -338,6 +338,7 @@
                                        prop_dictionary_t);
 static int     hdafg_codec_info(void *, prop_dictionary_t,
                                       prop_dictionary_t);
+static void    hdafg_enable_analogue_beep(struct hdafg_softc *);
 
 CFATTACH_DECL2_NEW(
     hdafg,
@@ -3681,6 +3682,9 @@
        if (1) hdafg_widget_pin_dump(sc);
        hdafg_assoc_dump(sc);
 
+       hda_debug(sc, "enabling analogue beep\n");
+       hdafg_enable_analogue_beep(sc);
+
        hda_debug(sc, "configuring encodings\n");
        sc->sc_audiodev.ad_sc = sc;
        hdafg_configure_encodings(sc);
@@ -4356,3 +4360,64 @@
                return ENOTTY;
        }
 }
+
+static void
+hdafg_enable_analogue_beep(struct hdafg_softc *sc)
+{
+       int nid;
+       uint32_t response;
+       
+       switch (sc->sc_vendor) {
+           case HDA_VENDOR_SIGMATEL:
+               switch (sc->sc_product) {
+                   case 0x7632:        /* STAC9202 */
+                   case 0x7633:        /* STAC9202D */
+                   case 0x7690:        /* STAC9200 */
+                   case 0x7691:        /* STAC9200D */
+                   case 0x7698:        /* STAC9205 */
+                   case 0x76a0:        /* STAC9205 */
+                   case 0x76a1:        /* STAC9205D */
+                   case 0x76a2:        /* STAC9204 */
+                   case 0x76a3:        /* STAC9204D */
+
+#define AFG_GET_ANACTRL 0xFe0
+#define AFG_SET_ANACTRL 0x7e0
+#define AnalogBeepEn 0x20              /* bit 5 = 1 */
+
+                       nid = 0x01;
+
+                       response = hdaudio_command(sc->sc_codec, nid,
+                           AFG_GET_ANACTRL, 0x00);
+                       hda_delay(100);
+
+                       response |= AnalogBeepEn;
+
+                       hdaudio_command(sc->sc_codec, nid, AFG_SET_ANACTRL,
+                           response);
+                       hda_delay(100);
+                       break;
+
+                   default:
+                       break;
+               }
+               break;
+           case HDA_VENDOR_REALTEK:
+               switch (sc->sc_product) {
+                   case 0x0269:
+                       /* 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;
+       }
+}

NB: This patch is my own work which I submit freely under the NetBSD license.

Regards,

Nat.



Home | Main Index | Thread Index | Old Index