Module Name: src Committed By: macallan Date: Thu Sep 9 00:24:59 UTC 2010
Modified Files: src/sys/arch/macppc/dev: snapper.c Log Message: get rid of custom PMF event handlers, instead do what the upper layer expects so volume control via PMF still works To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/macppc/dev/snapper.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/macppc/dev/snapper.c diff -u src/sys/arch/macppc/dev/snapper.c:1.33 src/sys/arch/macppc/dev/snapper.c:1.34 --- src/sys/arch/macppc/dev/snapper.c:1.33 Thu Nov 5 05:37:30 2009 +++ src/sys/arch/macppc/dev/snapper.c Thu Sep 9 00:24:59 2010 @@ -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)); -}