diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2012-06-13 16:25:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-25 10:07:50 -0400 |
commit | 39cca6b821d636f3f19c3f92c91b34a68f76f6d1 (patch) | |
tree | 13b3bb6fe6bf41cacd0b6c6eaaa86569c9245fb1 /drivers/media/radio | |
parent | 72a770c94deb158fbb1b804c7d0395623c568272 (diff) |
[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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/radio-aimslab.c | 66 |
1 files changed, 25 insertions, 41 deletions
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 98e0c8c20312..12c70e876f58 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <media/v4l2-ioctl.h> | 37 | #include <media/v4l2-ioctl.h> |
38 | #include <media/v4l2-ctrls.h> | 38 | #include <media/v4l2-ctrls.h> |
39 | #include "radio-isa.h" | 39 | #include "radio-isa.h" |
40 | #include "lm7000.h" | ||
40 | 41 | ||
41 | MODULE_AUTHOR("M. Kirkwood"); | 42 | MODULE_AUTHOR("M. Kirkwood"); |
42 | MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card."); | 43 | MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card."); |
@@ -72,55 +73,38 @@ static struct radio_isa_card *rtrack_alloc(void) | |||
72 | return rt ? &rt->isa : NULL; | 73 | return rt ? &rt->isa : NULL; |
73 | } | 74 | } |
74 | 75 | ||
75 | /* The 128+64 on these outb's is to keep the volume stable while tuning. | 76 | #define AIMS_BIT_TUN_CE (1 << 0) |
76 | * Without them, the volume _will_ creep up with each frequency change | 77 | #define AIMS_BIT_TUN_CLK (1 << 1) |
77 | * and bit 4 (+16) is to keep the signal strength meter enabled. | 78 | #define AIMS_BIT_TUN_DATA (1 << 2) |
78 | */ | 79 | #define AIMS_BIT_VOL_CE (1 << 3) |
80 | #define AIMS_BIT_TUN_STRQ (1 << 4) | ||
81 | /* bit 5 is not connected */ | ||
82 | #define AIMS_BIT_VOL_UP (1 << 6) /* active low */ | ||
83 | #define AIMS_BIT_VOL_DN (1 << 7) /* active low */ | ||
79 | 84 | ||
80 | static void send_0_byte(struct radio_isa_card *isa, int on) | 85 | void rtrack_set_pins(void *handle, u8 pins) |
81 | { | 86 | { |
82 | outb_p(128+64+16+on+1, isa->io); /* wr-enable + data low */ | 87 | struct radio_isa_card *isa = handle; |
83 | outb_p(128+64+16+on+2+1, isa->io); /* clock */ | 88 | struct rtrack *rt = container_of(isa, struct rtrack, isa); |
84 | msleep(1); | 89 | u8 bits = AIMS_BIT_VOL_DN | AIMS_BIT_VOL_UP | AIMS_BIT_TUN_STRQ; |
85 | } | ||
86 | 90 | ||
87 | static void send_1_byte(struct radio_isa_card *isa, int on) | 91 | if (!v4l2_ctrl_g_ctrl(rt->isa.mute)) |
88 | { | 92 | bits |= AIMS_BIT_VOL_CE; |
89 | outb_p(128+64+16+on+4+1, isa->io); /* wr-enable+data high */ | 93 | |
90 | outb_p(128+64+16+on+4+2+1, isa->io); /* clock */ | 94 | if (pins & LM7000_DATA) |
91 | msleep(1); | 95 | bits |= AIMS_BIT_TUN_DATA; |
96 | if (pins & LM7000_CLK) | ||
97 | bits |= AIMS_BIT_TUN_CLK; | ||
98 | if (pins & LM7000_CE) | ||
99 | bits |= AIMS_BIT_TUN_CE; | ||
100 | |||
101 | outb_p(bits, rt->isa.io); | ||
92 | } | 102 | } |
93 | 103 | ||
94 | static int rtrack_s_frequency(struct radio_isa_card *isa, u32 freq) | 104 | static int rtrack_s_frequency(struct radio_isa_card *isa, u32 freq) |
95 | { | 105 | { |
96 | int on = v4l2_ctrl_g_ctrl(isa->mute) ? 0 : 8; | 106 | lm7000_set_freq(freq, isa, rtrack_set_pins); |
97 | int i; | ||
98 | |||
99 | freq += 171200; /* Add 10.7 MHz IF */ | ||
100 | freq /= 800; /* Convert to 50 kHz units */ | ||
101 | |||
102 | send_0_byte(isa, on); /* 0: LSB of frequency */ | ||
103 | |||
104 | for (i = 0; i < 13; i++) /* : frequency bits (1-13) */ | ||
105 | if (freq & (1 << i)) | ||
106 | send_1_byte(isa, on); | ||
107 | else | ||
108 | send_0_byte(isa, on); | ||
109 | |||
110 | send_0_byte(isa, on); /* 14: test bit - always 0 */ | ||
111 | send_0_byte(isa, on); /* 15: test bit - always 0 */ | ||
112 | |||
113 | send_0_byte(isa, on); /* 16: band data 0 - always 0 */ | ||
114 | send_0_byte(isa, on); /* 17: band data 1 - always 0 */ | ||
115 | send_0_byte(isa, on); /* 18: band data 2 - always 0 */ | ||
116 | send_0_byte(isa, on); /* 19: time base - always 0 */ | ||
117 | |||
118 | send_0_byte(isa, on); /* 20: spacing (0 = 25 kHz) */ | ||
119 | send_1_byte(isa, on); /* 21: spacing (1 = 25 kHz) */ | ||
120 | send_0_byte(isa, on); /* 22: spacing (0 = 25 kHz) */ | ||
121 | send_1_byte(isa, on); /* 23: AM/FM (FM = 1, always) */ | ||
122 | 107 | ||
123 | outb(0xd0 + on, isa->io); /* volume steady + sigstr */ | ||
124 | return 0; | 108 | return 0; |
125 | } | 109 | } |
126 | 110 | ||