diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2005-12-05 15:16:27 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2005-12-05 15:16:27 +0000 |
commit | 09067cc80402d252652f7080346c861ad16bab92 (patch) | |
tree | 7672bce43dcae95641bc871a4d1a22b91c3bcc6d | |
parent | 72e20f55b44e5d48732d13f3670fce7338f6a1c9 (diff) |
Add support to tune the channel and the channel sets via radio(4).
ok mickey@
-rw-r--r-- | sys/dev/pci/bktr/bktr_os.c | 41 | ||||
-rw-r--r-- | sys/sys/radioio.h | 7 |
2 files changed, 41 insertions, 7 deletions
diff --git a/sys/dev/pci/bktr/bktr_os.c b/sys/dev/pci/bktr/bktr_os.c index 4b62d103f32..c575e275625 100644 --- a/sys/dev/pci/bktr/bktr_os.c +++ b/sys/dev/pci/bktr/bktr_os.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_os.c,v 1.21 2005/12/02 15:01:32 robert Exp $ */ +/* $OpenBSD: bktr_os.c,v 1.22 2005/12/05 15:16:26 robert Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp $ */ /* @@ -1259,7 +1259,9 @@ int bktr_set_info(void *v, struct radio_info *ri) { struct bktr_softc *sc = v; + struct TVTUNER *tv = &sc->tuner; u_int32_t freq; + u_int32_t chan; if (ri->mute) { /* mute the audio stream by switching the mux */ @@ -1278,15 +1280,39 @@ bktr_set_info(void *v, struct radio_info *ri) init_audio_devices(sc); } - if (ri->freq < MIN_FM_FREQ) - ri->freq = MIN_FM_FREQ; - if (ri->freq > MAX_FM_FREQ) - ri->freq = MAX_FM_FREQ; + if (ri->chan) { + if (ri->chan < MIN_TV_CHAN) + ri->chan = MIN_TV_CHAN; + if (ri->chan > MAX_TV_CHAN) + ri->chan = MAX_TV_CHAN; + } else { + if (ri->freq < MIN_FM_FREQ) + ri->freq = MIN_FM_FREQ; + if (ri->freq > MAX_FM_FREQ) + ri->freq = MAX_FM_FREQ; + } freq = ri->freq / 10; + chan = ri->chan; + + if (ri->chnlset >= CHNLSET_MIN && ri->chnlset <= CHNLSET_MAX) + tv->chnlset = ri->chnlset; + else + tv->chnlset = DEFAULT_CHNLSET; + set_audio(sc, AUDIO_INTERN); /* use internal audio */ temp_mute(sc, TRUE); - ri->freq = tv_freq(sc, freq, FM_RADIO_FREQUENCY) * 10; + + /* + * We only need to set the frequency if we are using + * FM Radio. If the channel is > 0 then call tv_channel(), + * which will set the correct TV frequency. + */ + if (!ri->chan) + ri->freq = tv_freq(sc, freq, FM_RADIO_FREQUENCY) * 10; + else + ri->chan = tv_channel(sc, chan); + temp_mute(sc, FALSE); return (0); @@ -1316,6 +1342,9 @@ bktr_get_info(void *v, struct radio_info *ri) * The ri->info is for that purpose. */ ri->stereo = 1; /* Can't switch to mono, always stereo */ + + ri->chan = tv->channel; + ri->chnlset = tv->chnlset; return (0); } diff --git a/sys/sys/radioio.h b/sys/sys/radioio.h index e76d28143f6..2df603c8488 100644 --- a/sys/sys/radioio.h +++ b/sys/sys/radioio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radioio.h,v 1.2 2001/12/05 10:27:05 mickey Exp $ */ +/* $OpenBSD: radioio.h,v 1.3 2005/12/05 15:16:26 robert Exp $ */ /* $RuOBSD: radioio.h,v 1.4 2001/10/18 16:51:36 pva Exp $ */ /* @@ -35,6 +35,9 @@ #define MIN_FM_FREQ 87500 #define MAX_FM_FREQ 108000 +#define MIN_TV_CHAN 0 +#define MAX_TV_CHAN 150 + #define IF_FREQ 10700 struct radio_info { @@ -58,6 +61,8 @@ struct radio_info { u_int32_t info; #define RADIO_INFO_STEREO (1<<0) #define RADIO_INFO_SIGNAL (1<<1) + u_int32_t chan; + u_int32_t chnlset; }; /* Radio device operations */ |