mirror of
https://github.com/torvalds/linux.git
synced 2024-11-19 10:31:48 +00:00
[media] radio-aimslab: Use LM7000 driver
Convert radio-aimslab to use generic LM7000 driver. Tested with Reveal RA300. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
4ecbb69414
commit
bece083a6b
@ -193,11 +193,14 @@ config RADIO_CADET
|
|||||||
|
|
||||||
config RADIO_LM7000
|
config RADIO_LM7000
|
||||||
tristate
|
tristate
|
||||||
|
depends on RADIO_RTRACK
|
||||||
|
default RADIO_RTRACK
|
||||||
|
|
||||||
config RADIO_RTRACK
|
config RADIO_RTRACK
|
||||||
tristate "AIMSlab RadioTrack (aka RadioReveal) support"
|
tristate "AIMSlab RadioTrack (aka RadioReveal) support"
|
||||||
depends on ISA && VIDEO_V4L2
|
depends on ISA && VIDEO_V4L2
|
||||||
select RADIO_ISA
|
select RADIO_ISA
|
||||||
|
select RADIO_LM7000
|
||||||
---help---
|
---help---
|
||||||
Choose Y here if you have one of these FM radio cards, and then fill
|
Choose Y here if you have one of these FM radio cards, and then fill
|
||||||
in the port address below.
|
in the port address below.
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <media/v4l2-ioctl.h>
|
#include <media/v4l2-ioctl.h>
|
||||||
#include <media/v4l2-ctrls.h>
|
#include <media/v4l2-ctrls.h>
|
||||||
#include "radio-isa.h"
|
#include "radio-isa.h"
|
||||||
|
#include "lm7000.h"
|
||||||
|
|
||||||
MODULE_AUTHOR("M. Kirkwood");
|
MODULE_AUTHOR("M. Kirkwood");
|
||||||
MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card.");
|
MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card.");
|
||||||
@ -61,66 +62,53 @@ MODULE_PARM_DESC(radio_nr, "Radio device numbers");
|
|||||||
struct rtrack {
|
struct rtrack {
|
||||||
struct radio_isa_card isa;
|
struct radio_isa_card isa;
|
||||||
int curvol;
|
int curvol;
|
||||||
|
struct lm7000 lm;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define AIMS_BIT_TUN_CE (1 << 0)
|
||||||
|
#define AIMS_BIT_TUN_CLK (1 << 1)
|
||||||
|
#define AIMS_BIT_TUN_DATA (1 << 2)
|
||||||
|
#define AIMS_BIT_VOL_CE (1 << 3)
|
||||||
|
#define AIMS_BIT_TUN_STRQ (1 << 4)
|
||||||
|
/* bit 5 is not connected */
|
||||||
|
#define AIMS_BIT_VOL_UP (1 << 6) /* active low */
|
||||||
|
#define AIMS_BIT_VOL_DN (1 << 7) /* active low */
|
||||||
|
|
||||||
|
void rtrack_set_pins(struct lm7000 *lm, u8 pins)
|
||||||
|
{
|
||||||
|
struct rtrack *rt = container_of(lm, struct rtrack, lm);
|
||||||
|
u8 bits = AIMS_BIT_VOL_DN | AIMS_BIT_VOL_UP | AIMS_BIT_TUN_STRQ;
|
||||||
|
|
||||||
|
if (!v4l2_ctrl_g_ctrl(rt->isa.mute))
|
||||||
|
bits |= AIMS_BIT_VOL_CE;
|
||||||
|
|
||||||
|
if (pins & LM7000_DATA)
|
||||||
|
bits |= AIMS_BIT_TUN_DATA;
|
||||||
|
if (pins & LM7000_CLK)
|
||||||
|
bits |= AIMS_BIT_TUN_CLK;
|
||||||
|
if (pins & LM7000_CE)
|
||||||
|
bits |= AIMS_BIT_TUN_CE;
|
||||||
|
|
||||||
|
outb_p(bits, rt->isa.io);
|
||||||
|
}
|
||||||
|
|
||||||
static struct radio_isa_card *rtrack_alloc(void)
|
static struct radio_isa_card *rtrack_alloc(void)
|
||||||
{
|
{
|
||||||
struct rtrack *rt = kzalloc(sizeof(struct rtrack), GFP_KERNEL);
|
struct rtrack *rt = kzalloc(sizeof(struct rtrack), GFP_KERNEL);
|
||||||
|
|
||||||
if (rt)
|
if (rt) {
|
||||||
rt->curvol = 0xff;
|
rt->curvol = 0xff;
|
||||||
|
rt->lm.set_pins = rtrack_set_pins;
|
||||||
|
}
|
||||||
return rt ? &rt->isa : NULL;
|
return rt ? &rt->isa : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The 128+64 on these outb's is to keep the volume stable while tuning.
|
|
||||||
* Without them, the volume _will_ creep up with each frequency change
|
|
||||||
* and bit 4 (+16) is to keep the signal strength meter enabled.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void send_0_byte(struct radio_isa_card *isa, int on)
|
|
||||||
{
|
|
||||||
outb_p(128+64+16+on+1, isa->io); /* wr-enable + data low */
|
|
||||||
outb_p(128+64+16+on+2+1, isa->io); /* clock */
|
|
||||||
msleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void send_1_byte(struct radio_isa_card *isa, int on)
|
|
||||||
{
|
|
||||||
outb_p(128+64+16+on+4+1, isa->io); /* wr-enable+data high */
|
|
||||||
outb_p(128+64+16+on+4+2+1, isa->io); /* clock */
|
|
||||||
msleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int rtrack_s_frequency(struct radio_isa_card *isa, u32 freq)
|
static int rtrack_s_frequency(struct radio_isa_card *isa, u32 freq)
|
||||||
{
|
{
|
||||||
int on = v4l2_ctrl_g_ctrl(isa->mute) ? 0 : 8;
|
struct rtrack *rt = container_of(isa, struct rtrack, isa);
|
||||||
int i;
|
|
||||||
|
|
||||||
freq += 171200; /* Add 10.7 MHz IF */
|
lm7000_set_freq(&rt->lm, freq);
|
||||||
freq /= 800; /* Convert to 50 kHz units */
|
|
||||||
|
|
||||||
send_0_byte(isa, on); /* 0: LSB of frequency */
|
|
||||||
|
|
||||||
for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
|
|
||||||
if (freq & (1 << i))
|
|
||||||
send_1_byte(isa, on);
|
|
||||||
else
|
|
||||||
send_0_byte(isa, on);
|
|
||||||
|
|
||||||
send_0_byte(isa, on); /* 14: test bit - always 0 */
|
|
||||||
send_0_byte(isa, on); /* 15: test bit - always 0 */
|
|
||||||
|
|
||||||
send_0_byte(isa, on); /* 16: band data 0 - always 0 */
|
|
||||||
send_0_byte(isa, on); /* 17: band data 1 - always 0 */
|
|
||||||
send_0_byte(isa, on); /* 18: band data 2 - always 0 */
|
|
||||||
send_0_byte(isa, on); /* 19: time base - always 0 */
|
|
||||||
|
|
||||||
send_0_byte(isa, on); /* 20: spacing (0 = 25 kHz) */
|
|
||||||
send_1_byte(isa, on); /* 21: spacing (1 = 25 kHz) */
|
|
||||||
send_0_byte(isa, on); /* 22: spacing (0 = 25 kHz) */
|
|
||||||
send_1_byte(isa, on); /* 23: AM/FM (FM = 1, always) */
|
|
||||||
|
|
||||||
outb(0xd0 + on, isa->io); /* volume steady + sigstr */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user