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 Increase safety of the speaker -> beep g...
details: https://anonhg.NetBSD.org/src/rev/5d11bf6968d3
branches: trunk
changeset: 757008:5d11bf6968d3
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Aug 10 13:47:38 2010 +0000
description:
Increase safety of the speaker -> beep generator workaround by check
that no such widget is defined first. On a Dell Latitude 430, widget
0x14 is the beep generator and the original version would replace the
normal speaker output, breaking head phone redirection in the process.
Discussed with jmcneill@
diffstat:
sys/dev/pci/hdaudio/hdaudio_afg.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diffs (73 lines):
diff -r c9f982bcd859 -r 5d11bf6968d3 sys/dev/pci/hdaudio/hdaudio_afg.c
--- a/sys/dev/pci/hdaudio/hdaudio_afg.c Tue Aug 10 11:14:30 2010 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_afg.c Tue Aug 10 13:47:38 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.21 2010/08/10 11:14:30 joerg Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.22 2010/08/10 13:47:38 joerg Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.21 2010/08/10 11:14:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.22 2010/08/10 13:47:38 joerg Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -285,6 +285,7 @@
struct hdaudio_control *sc_ctls;
int sc_nmixers;
struct hdaudio_mixer *sc_mixers;
+ bool sc_has_beepgen;
int sc_pchan, sc_rchan;
audio_params_t sc_pparam, sc_rparam;
@@ -634,6 +635,7 @@
static uint32_t
hdaudio_afg_widget_getcaps(struct hdaudio_widget *w)
{
+ struct hdaudio_afg_softc *sc = w->w_afg;
uint32_t wcap, config;
wcap = hda_get_wparam(w, AUDIO_WIDGET_CAPABILITIES);
@@ -641,7 +643,8 @@
w->w_waspin = false;
- if (COP_CFG_DEFAULT_DEVICE(config) == COP_DEVICE_SPEAKER &&
+ if (sc->sc_has_beepgen == false &&
+ COP_CFG_DEFAULT_DEVICE(config) == COP_DEVICE_SPEAKER &&
(wcap & (COP_AWCAP_INAMP_PRESENT|COP_AWCAP_OUTAMP_PRESENT)) == 0) {
wcap &= ~COP_AWCAP_TYPE_MASK;
wcap |= (COP_AWCAP_TYPE_BEEP_GENERATOR << COP_AWCAP_TYPE_SHIFT);
@@ -990,7 +993,7 @@
hdaudio_afg_parse(struct hdaudio_afg_softc *sc)
{
struct hdaudio_widget *w;
- uint32_t nodecnt;
+ uint32_t nodecnt, wcap;
int nid;
nodecnt = hda_get_param(sc, SUBORDINATE_NODE_COUNT);
@@ -1025,6 +1028,19 @@
w = hdaudio_afg_widget_lookup(sc, nid);
if (w == NULL)
continue;
+ wcap = hdaudio_command(sc->sc_codec, nid, CORB_GET_PARAMETER,
+ COP_AUDIO_WIDGET_CAPABILITIES);
+ switch (COP_AWCAP_TYPE(wcap)) {
+ case COP_AWCAP_TYPE_BEEP_GENERATOR:
+ sc->sc_has_beepgen = true;
+ break;
+ }
+ }
+
+ for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) {
+ w = hdaudio_afg_widget_lookup(sc, nid);
+ if (w == NULL)
+ continue;
w->w_afg = sc;
w->w_nid = nid;
w->w_enable = true;
Home |
Main Index |
Thread Index |
Old Index