diff options
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/bktr/bktr_os.c | 67 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_reg.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_tuner.c | 6 |
3 files changed, 49 insertions, 29 deletions
diff --git a/sys/dev/pci/bktr/bktr_os.c b/sys/dev/pci/bktr/bktr_os.c index 0db3a38dc1c..af54a42bb3d 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.23 2006/01/15 20:38:41 jakemsr Exp $ */ +/* $OpenBSD: bktr_os.c,v 1.24 2006/02/05 23:52:58 jakemsr Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp $ */ /* @@ -1272,39 +1272,42 @@ bktr_set_info(void *v, struct radio_info *ri) init_audio_devices(sc); } - 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; + set_audio(sc, AUDIO_INTERN); /* use internal audio */ + temp_mute(sc, TRUE); + + if (ri->tuner_mode == RADIO_TUNER_MODE_TV) { + 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; + + chan = ri->chan; + ri->chan = tv_channel(sc, chan); + tv->tuner_mode = BT848_TUNER_MODE_TV; + } else { + ri->chan = tv->channel; + } } else { - if (ri->freq < MIN_FM_FREQ) - ri->freq = MIN_FM_FREQ; - if (ri->freq > MAX_FM_FREQ) - ri->freq = MAX_FM_FREQ; + if (ri->freq) { + 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; + ri->freq = tv_freq(sc, freq, FM_RADIO_FREQUENCY) * 10; + tv->tuner_mode = BT848_TUNER_MODE_RADIO; + } else { + ri->freq = tv->frequency; + } } - 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); - - /* - * 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); @@ -1322,12 +1325,22 @@ bktr_get_info(void *v, struct radio_info *ri) #define STATUSBIT_STEREO 0x10 ri->mute = (int)sc->audio_mute_state ? 1 : 0; ri->caps = RADIO_CAPS_DETECT_STEREO | RADIO_CAPS_HW_AFC; - ri->freq = tv->frequency * 10; ri->info = (status & STATUSBIT_STEREO) ? RADIO_INFO_STEREO : 0; /* not yet supported */ ri->volume = ri->rfreq = ri->lock = 0; + switch (tv->tuner_mode) { + case BT848_TUNER_MODE_TV: + ri->tuner_mode = RADIO_TUNER_MODE_TV; + ri->freq = tv->frequency * 1000 / 16; + break; + case BT848_TUNER_MODE_RADIO: + ri->tuner_mode = RADIO_TUNER_MODE_RADIO; + ri->freq = tv->frequency * 10; + break; + } + /* * The field ri->stereo is used to forcible switch to * mono/stereo, not as an indicator of received signal quality. diff --git a/sys/dev/pci/bktr/bktr_reg.h b/sys/dev/pci/bktr/bktr_reg.h index 909f6d4cf5a..2232ef1f59b 100644 --- a/sys/dev/pci/bktr/bktr_reg.h +++ b/sys/dev/pci/bktr/bktr_reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_reg.h,v 1.8 2005/11/21 18:16:41 millert Exp $ */ +/* $OpenBSD: bktr_reg.h,v 1.9 2006/02/05 23:52:58 jakemsr Exp $ */ /* * $FreeBSD: src/sys/dev/bktr/bktr_reg.h,v 1.42 2000/10/31 13:09:56 roger Exp $ * @@ -415,6 +415,9 @@ struct TVTUNER { u_char band; u_char afc; u_char radio_mode; /* current mode of the radio mode */ + int tuner_mode; /* current tuning mode */ +#define BT848_TUNER_MODE_TV 1 +#define BT848_TUNER_MODE_RADIO 2 }; /* description of the PHYSICAL tuner */ diff --git a/sys/dev/pci/bktr/bktr_tuner.c b/sys/dev/pci/bktr/bktr_tuner.c index 31b93309f34..c1d7b53e232 100644 --- a/sys/dev/pci/bktr/bktr_tuner.c +++ b/sys/dev/pci/bktr/bktr_tuner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_tuner.c,v 1.3 2003/02/11 19:20:28 mickey Exp $ */ +/* $OpenBSD: bktr_tuner.c,v 1.4 2006/02/05 23:52:58 jakemsr Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_tuner.c,v 1.9 2000/10/19 07:33:28 roger Exp $ */ /* @@ -801,6 +801,8 @@ tv_freq( bktr_ptr_t bktr, int frequency, int type ) else band_select = HIGH_BAND; + bktr->tuner.tuner_mode = BT848_TUNER_MODE_TV; + #if defined( TEST_TUNER_AFC ) if ( bktr->tuner.afc ) frequency -= 4; @@ -863,6 +865,8 @@ tv_freq( bktr_ptr_t bktr, int frequency, int type ) if ( type == FM_RADIO_FREQUENCY ) { band_select = FM_RADIO_BAND; + bktr->tuner.tuner_mode = BT848_TUNER_MODE_RADIO; + /* * N = { fRF(pc) + fIF(pc) }/step_size * The step size is 50kHz for FM radio. |