xref: /netbsd-src/sys/dev/isa/joy_ess.c (revision e622eac459adf11c2e710d7a4de0f05510bbbe61)
1 /* $NetBSD: joy_ess.c,v 1.7 2019/05/08 13:40:18 isaki Exp $ */
2 
3 #include <sys/cdefs.h>
4 __KERNEL_RCSID(0, "$NetBSD: joy_ess.c,v 1.7 2019/05/08 13:40:18 isaki Exp $");
5 
6 #include <sys/param.h>
7 #include <sys/systm.h>
8 #include <sys/kernel.h>
9 #include <sys/device.h>
10 #include <sys/audioio.h>
11 #include <sys/bus.h>
12 
13 #include <dev/audio/audio_if.h>
14 #include <dev/isa/isavar.h>
15 #include <dev/isa/essvar.h>
16 #include <dev/ic/joyvar.h>
17 
18 static int 	joy_ess_match(device_t, cfdata_t, void *);
19 static void 	joy_ess_attach(device_t, device_t, void *);
20 
21 CFATTACH_DECL_NEW(joy_ess, sizeof (struct joy_softc),
22 	      joy_ess_match, joy_ess_attach, NULL, NULL);
23 
24 static int
joy_ess_match(device_t parent,cfdata_t match,void * aux)25 joy_ess_match(device_t parent, cfdata_t match, void *aux)
26 {
27 	struct audio_attach_args *aa = aux;
28 
29 	if (aa->type != AUDIODEV_TYPE_AUX)
30 		return 0;
31 	return 1;
32 }
33 
34 static void
joy_ess_attach(device_t parent,device_t self,void * aux)35 joy_ess_attach(device_t parent, device_t self, void *aux)
36 {
37 	struct ess_softc *esc = device_private(parent);
38 	struct joy_softc *sc = device_private(self);
39 
40 	aprint_normal("\n");
41 
42 	sc->sc_iot = esc->sc_joy_iot;
43 	sc->sc_ioh = esc->sc_joy_ioh;
44 	sc->sc_dev = self;
45 	sc->sc_lock = &esc->sc_lock;
46 
47 	joyattach(sc);
48 }
49