Index: sys/dev/audio.c =================================================================== RCS file: /cvsroot/src/sys/dev/audio.c,v retrieving revision 1.243.6.3 diff -u -r1.243.6.3 audio.c --- sys/dev/audio.c 16 Oct 2009 05:43:37 -0000 1.243.6.3 +++ sys/dev/audio.c 18 Oct 2010 23:35:30 -0000 @@ -177,6 +177,8 @@ void audioattach(device_t, device_t, void *); int audiodetach(device_t, int); int audioactivate(device_t, enum devact); +int audiorescan(device_t, const char *, const int *); +void audiodevdetached(device_t, device_t); #ifdef AUDIO_PM_IDLE static void audio_idle(void *); @@ -266,8 +268,9 @@ .channels = 1, }; -CFATTACH_DECL_NEW(audio, sizeof(struct audio_softc), - audioprobe, audioattach, audiodetach, audioactivate); +CFATTACH_DECL2_NEW(audio, sizeof(struct audio_softc), + audioprobe, audioattach, audiodetach, audioactivate, + audiorescan, audiodevdetached); extern struct cfdriver audio_cd; @@ -532,6 +535,8 @@ #ifdef AUDIO_PM_IDLE callout_schedule(&sc->sc_idle_counter, audio_idle_timeout * hz); #endif + + sc->sc_kmixer = config_found_ia(self, "audiocore", NULL, NULL); } int @@ -552,6 +557,26 @@ } int +audiorescan(device_t self, const char *ifattr, const int *locators) +{ + struct audio_softc *sc = device_private(self); + + if (sc->sc_kmixer == NULL) + sc->sc_kmixer = config_found_ia(self, "audiocore", NULL, NULL); + + return 0; +} + +void +audiodevdetached(device_t self, device_t child) +{ + struct audio_softc *sc = device_private(self); + + if (sc->sc_kmixer == child) + sc->sc_kmixer = NULL; +} + +int audiodetach(device_t self, int flags) { struct audio_softc *sc; @@ -563,6 +588,9 @@ sc->sc_dying = true; + if (sc->sc_kmixer != NULL) + config_detach(sc->sc_kmixer, flags); + pmf_event_deregister(self, PMFE_AUDIO_VOLUME_DOWN, audio_volume_down, true); pmf_event_deregister(self, PMFE_AUDIO_VOLUME_UP, Index: sys/dev/audiovar.h =================================================================== RCS file: /cvsroot/src/sys/dev/audiovar.h,v retrieving revision 1.45 diff -u -r1.45 audiovar.h --- sys/dev/audiovar.h 28 Apr 2008 20:23:46 -0000 1.45 +++ sys/dev/audiovar.h 18 Oct 2010 23:35:31 -0000 @@ -224,6 +224,8 @@ mixer_ctrl_t *sc_mixer_state; int sc_nmixer_states; + + device_t sc_kmixer; /* kmixer device instance */ }; #endif /* _SYS_DEV_AUDIOVAR_H_ */ Index: sys/conf/files =================================================================== RCS file: /cvsroot/src/sys/conf/files,v retrieving revision 1.924.4.6 diff -u -r1.924.4.6 files --- sys/conf/files 8 Oct 2009 09:47:09 -0000 1.924.4.6 +++ sys/conf/files 18 Oct 2010 23:35:31 -0000 @@ -264,6 +264,7 @@ # generic attributes # define audiobus { } +define audiocore { } define midibus { } define midisyn define videobus { } @@ -290,7 +291,7 @@ # audio and midi devices, attaches to audio hardware driver # -device audio: audiodev +device audio: audiocore, audiodev attach audio at audiobus device midi attach midi at midibus Index: sys/conf/majors =================================================================== RCS file: /cvsroot/src/sys/conf/majors,v retrieving revision 1.42.4.1 diff -u -r1.42.4.1 majors --- sys/conf/majors 26 Sep 2009 19:52:09 -0000 1.42.4.1 +++ sys/conf/majors 18 Oct 2010 23:35:31 -0000 @@ -39,3 +39,4 @@ device-major isv char 192 isv device-major video char 193 video device-major hdaudio char 195 hdaudio +device-major kmixer char 196 kmixer