Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/dev get rid of custom PMF event handlers, in...



details:   https://anonhg.NetBSD.org/src/rev/5ecc53818518
branches:  trunk
changeset: 757638:5ecc53818518
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Sep 09 00:24:59 2010 +0000

description:
get rid of custom PMF event handlers, instead do what the upper layer expects
so volume control via PMF still works

diffstat:

 sys/arch/macppc/dev/snapper.c |  45 +++++++++++-------------------------------
 1 files changed, 12 insertions(+), 33 deletions(-)

diffs (130 lines):

diff -r 4b4fa6c77a13 -r 5ecc53818518 sys/arch/macppc/dev/snapper.c
--- a/sys/arch/macppc/dev/snapper.c     Thu Sep 09 00:10:16 2010 +0000
+++ b/sys/arch/macppc/dev/snapper.c     Thu Sep 09 00:24:59 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: snapper.c,v 1.33 2009/11/05 05:37:30 dyoung Exp $      */
+/*     $NetBSD: snapper.c,v 1.34 2010/09/09 00:24:59 macallan Exp $    */
 /*     Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp     */
 /*     Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp         */
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.33 2009/11/05 05:37:30 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.34 2010/09/09 00:24:59 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/audioio.h>
@@ -148,8 +148,6 @@
 static int snapper_cint(void *);
 static int tas3004_init(struct snapper_softc *);
 static void snapper_init(struct snapper_softc *, int);
-static void snapper_volume_up(device_t);
-static void snapper_volume_down(device_t);
 
 struct snapper_codecvar {
        stream_filter_t base;
@@ -617,7 +615,7 @@
 #define  DEQ_MCR1_W_16 0x00    /*  16 bit */
 #define  DEQ_MCR1_W_18 0x01    /*  18 bit */
 #define  DEQ_MCR1_W_20 0x02    /*  20 bit */
-#define  DEQ_MCR1_W_24 0x03    /*  20 bit */
+#define  DEQ_MCR1_W_24 0x03    /*  24 bit */
 
 #define DEQ_MCR2_DL    0x80    /* Download */
 #define DEQ_MCR2_AP    0x02    /* All pass mode */
@@ -788,10 +786,8 @@
        aprint_normal(": irq %d,%d,%d\n", cirq, oirq, iirq);
 
        /* PMF event handler */
-       pmf_event_register(self, PMFE_AUDIO_VOLUME_DOWN,
-           snapper_volume_down, TRUE);
-       pmf_event_register(self, PMFE_AUDIO_VOLUME_UP,
-           snapper_volume_up, TRUE);
+       pmf_device_register(sc->sc_dev, NULL, NULL);
+
        config_defer(self, snapper_defer);
 }
 
@@ -1202,7 +1198,7 @@
        switch (dip->index) {
 
        case SNAPPER_OUTPUT_SELECT:
-               dip->mixer_class = SNAPPER_MONITOR_CLASS;
+               dip->mixer_class = SNAPPER_OUTPUT_CLASS;
                strcpy(dip->label.name, AudioNoutput);
                dip->type = AUDIO_MIXER_SET;
                dip->prev = dip->next = AUDIO_MIXER_LAST;
@@ -1214,11 +1210,12 @@
                return 0;
 
        case SNAPPER_VOL_OUTPUT:
-               dip->mixer_class = SNAPPER_MONITOR_CLASS;
+               dip->mixer_class = SNAPPER_OUTPUT_CLASS;
                strcpy(dip->label.name, AudioNmaster);
                dip->type = AUDIO_MIXER_VALUE;
                dip->prev = dip->next = AUDIO_MIXER_LAST;
                dip->un.v.num_channels = 2;
+               dip->un.v.delta = 16;
                strcpy(dip->un.v.units.name, AudioNvolume);
                return 0;
 
@@ -1271,7 +1268,7 @@
                if (sc->sc_mode == SNAPPER_SWVOL)
                        return ENXIO;
 
-               dip->mixer_class = SNAPPER_MONITOR_CLASS;
+               dip->mixer_class = SNAPPER_OUTPUT_CLASS;
                strcpy(dip->label.name, AudioNtreble);
                dip->type = AUDIO_MIXER_VALUE;
                dip->prev = dip->next = AUDIO_MIXER_LAST;
@@ -1282,7 +1279,7 @@
                if (sc->sc_mode == SNAPPER_SWVOL)
                        return ENXIO;
 
-               dip->mixer_class = SNAPPER_MONITOR_CLASS;
+               dip->mixer_class = SNAPPER_OUTPUT_CLASS;
                strcpy(dip->label.name, AudioNbass);
                dip->type = AUDIO_MIXER_VALUE;
                dip->prev = dip->next = AUDIO_MIXER_LAST;
@@ -1293,7 +1290,7 @@
                if (sc->sc_mode == SNAPPER_SWVOL)
                        return ENXIO;
 
-               dip->mixer_class = SNAPPER_MONITOR_CLASS;
+               dip->mixer_class = SNAPPER_OUTPUT_CLASS;
                strcpy(dip->label.name, AudioNdac);
                dip->type = AUDIO_MIXER_VALUE;
                dip->prev = dip->next = AUDIO_MIXER_LAST;
@@ -1304,7 +1301,7 @@
                if (sc->sc_mode == SNAPPER_SWVOL)
                        return ENXIO;
 
-               dip->mixer_class = SNAPPER_MONITOR_CLASS;
+               dip->mixer_class = SNAPPER_OUTPUT_CLASS;
                strcpy(dip->label.name, AudioNline);
                dip->type = AUDIO_MIXER_VALUE;
                dip->prev = dip->next = AUDIO_MIXER_LAST;
@@ -2111,21 +2108,3 @@
        sc->mixer[5] = 0;
        snapper_write_mixers(sc);
 }
-
-static void
-snapper_volume_up(device_t dev)
-{
-       struct snapper_softc *sc = device_private(dev);
-
-       snapper_set_volume(sc, min(0xff, sc->sc_vol_l + 8),
-            min(0xff, sc->sc_vol_r + 8));
-}
-
-static void
-snapper_volume_down(device_t dev)
-{
-       struct snapper_softc *sc = device_private(dev);
-
-       snapper_set_volume(sc, max(0, sc->sc_vol_l - 8),
-            max(0, sc->sc_vol_r - 8));
-}



Home | Main Index | Thread Index | Old Index