diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-01-07 18:32:20 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-01-07 18:32:20 +0000 |
commit | eaca3614406686835b9fbf953a990eca6be2c0be (patch) | |
tree | 569d8512fac557766e56110adc7b696e8bdafd73 /sys/dev/isa | |
parent | e1666a5ad6a0c67bc9fc79a79a7dddb89c3c82c6 (diff) |
use flags instead of options to choose the tea5757 vs tea5759.
from Vladimir Popov <jumbo@narod.ru>
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/radiotrack.c | 4 | ||||
-rw-r--r-- | sys/dev/isa/radiotrack2.c | 20 | ||||
-rw-r--r-- | sys/dev/isa/sf16fmr2.c | 21 |
3 files changed, 27 insertions, 18 deletions
diff --git a/sys/dev/isa/radiotrack.c b/sys/dev/isa/radiotrack.c index 4e66b89c792..a2534459bee 100644 --- a/sys/dev/isa/radiotrack.c +++ b/sys/dev/isa/radiotrack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiotrack.c,v 1.2 2002/01/02 19:36:50 mickey Exp $ */ +/* $OpenBSD: radiotrack.c,v 1.3 2002/01/07 18:32:19 mickey Exp $ */ /* $RuOBSD: radiotrack.c,v 1.3 2001/10/18 16:51:36 pva Exp $ */ /* @@ -132,7 +132,7 @@ u_int8_t rt_conv_vol(u_int8_t); u_int8_t rt_unconv_vol(u_int8_t); int -rt_probe(struct device *parent, void *self, void *aux) +rt_probe(struct device *parent, void *match, void *aux) { struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; diff --git a/sys/dev/isa/radiotrack2.c b/sys/dev/isa/radiotrack2.c index 99c4345392b..0a78c8ee6d6 100644 --- a/sys/dev/isa/radiotrack2.c +++ b/sys/dev/isa/radiotrack2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiotrack2.c,v 1.2 2002/01/02 19:36:51 mickey Exp $ */ +/* $OpenBSD: radiotrack2.c,v 1.3 2002/01/07 18:32:19 mickey Exp $ */ /* $RuOBSD: radiotrack2.c,v 1.2 2001/10/18 16:51:36 pva Exp $ */ /* @@ -113,7 +113,7 @@ struct cfdriver rtii_cd = { }; void rtii_set_mute(struct rtii_softc *); -int rtii_find(bus_space_tag_t, bus_space_handle_t); +int rtii_find(bus_space_tag_t, bus_space_handle_t, int); u_int32_t rtii_hw_read(bus_space_tag_t, bus_space_handle_t, bus_size_t); @@ -122,12 +122,12 @@ void rtii_rset(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t); void rtii_write_bit(bus_space_tag_t, bus_space_handle_t, bus_size_t, int); int -rtii_probe(struct device *parent, void *self, void *aux) +rtii_probe(struct device *parent, void *match, void *aux) { struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - + struct cfdata *cf = match; int iosize = 1, iobase = ia->ia_iobase; if (!RTII_BASE_VALID(iobase)) { @@ -138,7 +138,7 @@ rtii_probe(struct device *parent, void *self, void *aux) if (bus_space_map(iot, iobase, iosize, 0, &ioh)) return (0); - if (!rtii_find(iot, ioh)) { + if (!rtii_find(iot, ioh, cf->cf_flags)) { bus_space_unmap(iot, ioh, iosize); return (0); } @@ -153,6 +153,7 @@ rtii_attach(struct device *parent, struct device *self, void *aux) { struct rtii_softc *sc = (void *) self; struct isa_attach_args *ia = aux; + struct cfdata *cf = sc->dev.dv_cfdata; sc->tea.iot = ia->ia_iot; sc->mute = 0; @@ -169,6 +170,7 @@ rtii_attach(struct device *parent, struct device *self, void *aux) } sc->tea.offset = 0; + sc->tea.flags = cf->cf_flags; sc->tea.init = rtii_init; sc->tea.rset = rtii_rset; @@ -211,7 +213,7 @@ rtii_rset(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off, u_int32_t } int -rtii_find(bus_space_tag_t iot, bus_space_handle_t ioh) +rtii_find(bus_space_tag_t iot, bus_space_handle_t ioh, int flags) { struct rtii_softc sc; u_int32_t freq; @@ -219,6 +221,7 @@ rtii_find(bus_space_tag_t iot, bus_space_handle_t ioh) sc.tea.iot = iot; sc.tea.ioh = ioh; sc.tea.offset = 0; + sc.tea.flags = flags; sc.tea.init = rtii_init; sc.tea.rset = rtii_rset; sc.tea.write_bit = rtii_write_bit; @@ -235,7 +238,8 @@ rtii_find(bus_space_tag_t iot, bus_space_handle_t ioh) tea5757_set_freq(&sc.tea, sc.stereo, sc.lock, sc.freq); rtii_set_mute(&sc); freq = rtii_hw_read(iot, ioh, sc.tea.offset); - if (tea5757_decode_freq(freq) == sc.freq) + if (tea5757_decode_freq(freq, sc.tea.flags & TEA5757_TEA5759) + == sc.freq) return 1; return 0; @@ -288,7 +292,7 @@ rtii_get_info(void *v, struct radio_info *ri) ri->lock = tea5757_decode_lock(sc->lock); ri->freq = sc->freq = tea5757_decode_freq(rtii_hw_read(sc->tea.iot, - sc->tea.ioh, sc->tea.offset)); + sc->tea.ioh, sc->tea.offset), sc->tea.flags & TEA5757_TEA5759); switch (bus_space_read_1(sc->tea.iot, sc->tea.ioh, 0)) { case 0xFD: diff --git a/sys/dev/isa/sf16fmr2.c b/sys/dev/isa/sf16fmr2.c index 1362823b21d..42a22076d76 100644 --- a/sys/dev/isa/sf16fmr2.c +++ b/sys/dev/isa/sf16fmr2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sf16fmr2.c,v 1.4 2002/01/02 19:36:51 mickey Exp $ */ +/* $OpenBSD: sf16fmr2.c,v 1.5 2002/01/07 18:32:19 mickey Exp $ */ /* $RuOBSD: sf16fmr2.c,v 1.12 2001/10/18 16:51:36 pva Exp $ */ /* @@ -113,7 +113,7 @@ struct cfdriver sf2r_cd = { }; void sf2r_set_mute(struct sf2r_softc *); -int sf2r_find(bus_space_tag_t, bus_space_handle_t); +int sf2r_find(bus_space_tag_t, bus_space_handle_t, int); u_int32_t sf2r_read_register(bus_space_tag_t, bus_space_handle_t, bus_size_t); @@ -122,12 +122,12 @@ void sf2r_rset(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t); void sf2r_write_bit(bus_space_tag_t, bus_space_handle_t, bus_size_t, int); int -sf2r_probe(struct device *parent, void *self, void *aux) +sf2r_probe(struct device *parent, void *match, void *aux) { struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh; - + struct cfdata *cf = match; int iosize = 1, iobase = ia->ia_iobase; if (!SF16FMR2_BASE_VALID(iobase)) { @@ -138,7 +138,7 @@ sf2r_probe(struct device *parent, void *self, void *aux) if (bus_space_map(iot, iobase, iosize, 0, &ioh)) return (0); - if (!sf2r_find(iot, ioh)) { + if (!sf2r_find(iot, ioh, cf->cf_flags)) { bus_space_unmap(iot, ioh, iosize); return (0); } @@ -153,6 +153,7 @@ sf2r_attach(struct device *parent, struct device *self, void *aux) { struct sf2r_softc *sc = (void *) self; struct isa_attach_args *ia = aux; + struct cfdata *cf = sc->sc_dev.dv_cfdata; sc->tea.iot = ia->ia_iot; sc->mute = 0; @@ -169,6 +170,7 @@ sf2r_attach(struct device *parent, struct device *self, void *aux) } sc->tea.offset = 0; + sc->tea.flags = cf->cf_flags; sc->tea.init = sf2r_init; sc->tea.rset = sf2r_rset; @@ -210,7 +212,7 @@ sf2r_rset(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off, u_int32_t } int -sf2r_find(bus_space_tag_t iot, bus_space_handle_t ioh) +sf2r_find(bus_space_tag_t iot, bus_space_handle_t ioh, int flags) { struct sf2r_softc sc; u_int32_t freq; @@ -218,6 +220,7 @@ sf2r_find(bus_space_tag_t iot, bus_space_handle_t ioh) sc.tea.iot = iot; sc.tea.ioh = ioh; sc.tea.offset = 0; + sc.tea.flags = flags; sc.tea.init = sf2r_init; sc.tea.rset = sf2r_rset; sc.tea.write_bit = sf2r_write_bit; @@ -235,7 +238,8 @@ sf2r_find(bus_space_tag_t iot, bus_space_handle_t ioh) tea5757_set_freq(&sc.tea, sc.stereo, sc.lock, sc.freq); sf2r_set_mute(&sc); freq = sf2r_read_register(iot, ioh, sc.tea.offset); - if (tea5757_decode_freq(freq) == sc.freq) + if (tea5757_decode_freq(freq, sc.tea.flags & TEA5757_TEA5759) + == sc.freq) return 1; } @@ -307,7 +311,8 @@ sf2r_get_info(void *v, struct radio_info *ri) ri->lock = tea5757_decode_lock(sc->lock); buf = sf2r_read_register(sc->tea.iot, sc->tea.ioh, sc->tea.offset); - ri->freq = sc->freq = tea5757_decode_freq(buf); + ri->freq = sc->freq = tea5757_decode_freq(buf, + sc->tea.flags & TEA5757_TEA5759); ri->info = 3 & (buf >> 24); return (0); |