summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2001-10-14 19:22:51 +0000
committerscottl <scottl@FreeBSD.org>2001-10-14 19:22:51 +0000
commit9eb9a2e7aa9acd55b2b87275ba3e3f4a111d9a1a (patch)
tree6dcc75dfd15b52f810dc8f4135ca243bbc3fec5b
parent8dd54dc1741b2f7b46d6ced09abf391310734eec (diff)
downloadFreeBSD-src-9eb9a2e7aa9acd55b2b87275ba3e3f4a111d9a1a.zip
FreeBSD-src-9eb9a2e7aa9acd55b2b87275ba3e3f4a111d9a1a.tar.gz
Turn on the hardware volume buttons that are present on most laptops with
these chips. There is a new hint, hint.pcm.N.hwvol_config, that can be set to 1 or 0 to select which pins the buttons are connected to. I'm open to suggestions on where to document this. Also bump the number of playback channels up to 4. MFC after: 3 days
-rw-r--r--sys/dev/sound/pci/maestro3.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/dev/sound/pci/maestro3.c b/sys/dev/sound/pci/maestro3.c
index f9ff007..fb3f34c 100644
--- a/sys/dev/sound/pci/maestro3.c
+++ b/sys/dev/sound/pci/maestro3.c
@@ -87,7 +87,7 @@ static struct m3_card_type {
};
#define M3_BUFSIZE_DEFAULT 4096
-#define M3_PCHANS 2 /* create /dev/dsp0.[0-N] to use more than one */
+#define M3_PCHANS 4 /* create /dev/dsp0.[0-N] to use more than one */
#define M3_RCHANS 1
#define M3_MAXADDR ((1 << 27) - 1)
@@ -912,7 +912,6 @@ m3_intr(void *p)
if (status & HV_INT_PENDING) {
u_int8_t event;
- device_printf(sc->dev, "Hardware Volume Interrupt\n");
event = m3_rd_1(sc, HW_VOL_COUNTER_MASTER);
switch (event) {
case 0x99:
@@ -1196,6 +1195,7 @@ m3_pci_attach(device_t dev)
device_printf(dev, "attach: pcm_setstatus error\n");
goto bad;
}
+
mixer_hwvol_init(dev);
/* Create the buffer for saving the card state during suspend */
@@ -1366,10 +1366,25 @@ m3_assp_halt(struct sc_info *sc)
static void
m3_config(struct sc_info *sc)
{
- u_int32_t data;
+ u_int32_t data, hv_cfg;
+ int hint;
+
+ /*
+ * The volume buttons can be wired up via two different sets of pins.
+ * This presents a problem since we can't tell which way it's
+ * configured. Allow the user to set a hint in order to twiddle
+ * the proper bits.
+ */
+ if (resource_int_value(device_get_name(sc->dev),
+ device_get_unit(sc->dev),
+ "hwvol_config", &hint) == 0)
+ hv_cfg = (hint > 0) ? HV_BUTTON_FROM_GD : 0;
+ else
+ hv_cfg = HV_BUTTON_FROM_GD;
data = pci_read_config(sc->dev, PCI_ALLEGRO_CONFIG, 4);
- data &= REDUCED_DEBOUNCE;
+ data &= HV_BUTTON_FROM_GD;
+ data |= REDUCED_DEBOUNCE | HV_CTRL_ENABLE | hv_cfg;
data |= PM_CTRL_ENABLE | CLK_DIV_BY_49 | USE_PCI_TIMING;
pci_write_config(sc->dev, PCI_ALLEGRO_CONFIG, data, 4);
OpenPOWER on IntegriCloud