Use a different way to recognize tea5759 chips. From OpenBSD.
This commit is contained in:
parent
8531949548
commit
2f5aeb92d3
|
@ -1,5 +1,5 @@
|
||||||
/* $NetBSD: tea5757.c,v 1.1 2002/01/01 21:51:40 augustss Exp $ */
|
/* $NetBSD: tea5757.c,v 1.2 2002/09/03 18:53:40 augustss Exp $ */
|
||||||
/* $OpenBSD: tea5757.c,v 1.2 2001/12/06 16:28:18 mickey Exp $ */
|
/* $OpenBSD: tea5757.c,v 1.3 2002/01/07 18:32:19 mickey Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
|
* Copyright (c) 2001 Vladimir Popov <jumbo@narod.ru>
|
||||||
|
@ -61,18 +61,19 @@
|
||||||
* Convert frequency to hardware representation
|
* Convert frequency to hardware representation
|
||||||
*/
|
*/
|
||||||
u_int32_t
|
u_int32_t
|
||||||
tea5757_encode_freq(u_int32_t freq)
|
tea5757_encode_freq(u_int32_t freq, int tea5759)
|
||||||
{
|
{
|
||||||
#ifdef RADIO_TEA5759
|
if (tea5759)
|
||||||
freq -= IF_FREQ;
|
freq -= IF_FREQ;
|
||||||
#else
|
else
|
||||||
freq += IF_FREQ;
|
freq += IF_FREQ;
|
||||||
#endif /* RADIO_TEA5759 */
|
|
||||||
/*
|
/*
|
||||||
* NO FLOATING POINT!
|
* NO FLOATING POINT!
|
||||||
*/
|
*/
|
||||||
freq *= 10;
|
freq *= 10;
|
||||||
freq /= 125;
|
freq /= 125;
|
||||||
|
|
||||||
return freq & TEA5757_FREQ;
|
return freq & TEA5757_FREQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,16 +81,17 @@ tea5757_encode_freq(u_int32_t freq)
|
||||||
* Convert frequency from hardware representation
|
* Convert frequency from hardware representation
|
||||||
*/
|
*/
|
||||||
u_int32_t
|
u_int32_t
|
||||||
tea5757_decode_freq(u_int32_t freq)
|
tea5757_decode_freq(u_int32_t freq, int tea5759)
|
||||||
{
|
{
|
||||||
freq &= TEA5757_FREQ;
|
freq &= TEA5757_FREQ;
|
||||||
freq *= 125; /* 12.5 kHz */
|
freq *= 125; /* 12.5 kHz */
|
||||||
freq /= 10;
|
freq /= 10;
|
||||||
#ifdef RADIO_TEA5759
|
|
||||||
|
if (tea5759)
|
||||||
freq += IF_FREQ;
|
freq += IF_FREQ;
|
||||||
#else
|
else
|
||||||
freq -= IF_FREQ;
|
freq -= IF_FREQ;
|
||||||
#endif /* RADIO_TEA5759 */
|
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +142,8 @@ tea5757_set_freq(struct tea5757_t *tea, u_int32_t stereo, u_int32_t lock, u_int3
|
||||||
if (freq > MAX_FM_FREQ)
|
if (freq > MAX_FM_FREQ)
|
||||||
freq = MAX_FM_FREQ;
|
freq = MAX_FM_FREQ;
|
||||||
|
|
||||||
data = tea5757_encode_freq(freq) | stereo | lock | TEA5757_SEARCH_END;
|
data |= tea5757_encode_freq(freq, tea->flags & TEA5757_TEA5759);
|
||||||
|
data |= stereo | lock | TEA5757_SEARCH_END;
|
||||||
tea5757_hardware_write(tea, data);
|
tea5757_hardware_write(tea, data);
|
||||||
|
|
||||||
return freq;
|
return freq;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $NetBSD: tea5757.h,v 1.1 2002/01/01 21:51:40 augustss Exp $ */
|
/* $NetBSD: tea5757.h,v 1.2 2002/09/03 18:53:40 augustss Exp $ */
|
||||||
/* $OpenBSD: tea5757.h,v 1.2 2001/12/06 16:28:18 mickey Exp $ */
|
/* $OpenBSD: tea5757.h,v 1.3 2002/01/07 18:32:19 mickey Exp $ */
|
||||||
/* $RuOBSD: tea5757.h,v 1.2 2001/10/18 16:51:36 pva Exp $ */
|
/* $RuOBSD: tea5757.h,v 1.2 2001/10/18 16:51:36 pva Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -62,10 +62,13 @@
|
||||||
#define TEA5757_S030 (1 << 16) /* 0x0010000 * > 30 mkV */
|
#define TEA5757_S030 (1 << 16) /* 0x0010000 * > 30 mkV */
|
||||||
#define TEA5757_S150 (3 << 16) /* 0x0030000 * > 150 mkV */
|
#define TEA5757_S150 (3 << 16) /* 0x0030000 * > 150 mkV */
|
||||||
|
|
||||||
|
#define TEA5757_TEA5759 (1 << 0)
|
||||||
|
|
||||||
struct tea5757_t {
|
struct tea5757_t {
|
||||||
bus_space_tag_t iot;
|
bus_space_tag_t iot;
|
||||||
bus_space_handle_t ioh;
|
bus_space_handle_t ioh;
|
||||||
bus_size_t offset;
|
bus_size_t offset;
|
||||||
|
int flags;
|
||||||
|
|
||||||
void (*init)(bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
void (*init)(bus_space_tag_t, bus_space_handle_t, bus_size_t,
|
||||||
u_int32_t); /* init value */
|
u_int32_t); /* init value */
|
||||||
|
@ -76,8 +79,8 @@ struct tea5757_t {
|
||||||
u_int32_t (*read)(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
u_int32_t (*read)(bus_space_tag_t, bus_space_handle_t, bus_size_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
u_int32_t tea5757_encode_freq(u_int32_t);
|
u_int32_t tea5757_encode_freq(u_int32_t, int);
|
||||||
u_int32_t tea5757_decode_freq(u_int32_t);
|
u_int32_t tea5757_decode_freq(u_int32_t, int);
|
||||||
u_int32_t tea5757_encode_lock(u_int8_t);
|
u_int32_t tea5757_encode_lock(u_int8_t);
|
||||||
u_int8_t tea5757_decode_lock(u_int32_t);
|
u_int8_t tea5757_decode_lock(u_int32_t);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: radiotrack2.c,v 1.4 2002/01/07 21:47:14 thorpej Exp $ */
|
/* $NetBSD: radiotrack2.c,v 1.5 2002/09/03 18:53:41 augustss Exp $ */
|
||||||
/* $OpenBSD: radiotrack2.c,v 1.1 2001/12/05 10:27:06 mickey Exp $ */
|
/* $OpenBSD: radiotrack2.c,v 1.1 2001/12/05 10:27:06 mickey Exp $ */
|
||||||
/* $RuOBSD: radiotrack2.c,v 1.2 2001/10/18 16:51:36 pva Exp $ */
|
/* $RuOBSD: radiotrack2.c,v 1.2 2001/10/18 16:51:36 pva Exp $ */
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@ rtii_attach(struct device *parent, struct device *self, void *aux)
|
||||||
struct isa_attach_args *ia = aux;
|
struct isa_attach_args *ia = aux;
|
||||||
|
|
||||||
sc->tea.iot = ia->ia_iot;
|
sc->tea.iot = ia->ia_iot;
|
||||||
|
sc->tea.flags = 0;
|
||||||
sc->mute = 0;
|
sc->mute = 0;
|
||||||
sc->vol = 0;
|
sc->vol = 0;
|
||||||
sc->freq = MIN_FM_FREQ;
|
sc->freq = MIN_FM_FREQ;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sf16fmr2.c,v 1.4 2002/01/07 21:47:15 thorpej Exp $ */
|
/* $NetBSD: sf16fmr2.c,v 1.5 2002/09/03 18:53:41 augustss Exp $ */
|
||||||
/* $OpenBSD: sf16fmr2.c,v 1.3 2001/12/18 18:48:08 mickey Exp $ */
|
/* $OpenBSD: sf16fmr2.c,v 1.3 2001/12/18 18:48:08 mickey Exp $ */
|
||||||
/* $RuOBSD: sf16fmr2.c,v 1.12 2001/10/18 16:51:36 pva Exp $ */
|
/* $RuOBSD: sf16fmr2.c,v 1.12 2001/10/18 16:51:36 pva Exp $ */
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@ sf2r_attach(struct device *parent, struct device *self, void *aux)
|
||||||
struct isa_attach_args *ia = aux;
|
struct isa_attach_args *ia = aux;
|
||||||
|
|
||||||
sc->tea.iot = ia->ia_iot;
|
sc->tea.iot = ia->ia_iot;
|
||||||
|
sc->tea.flags = 0;
|
||||||
sc->mute = 0;
|
sc->mute = 0;
|
||||||
sc->vol = 0;
|
sc->vol = 0;
|
||||||
sc->freq = MIN_FM_FREQ;
|
sc->freq = MIN_FM_FREQ;
|
||||||
|
|
Loading…
Reference in New Issue