aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-06-25 10:06:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-25 10:06:54 -0400
commit8f7fa3c8014cc6a892e5bd0e31dc772989935ec3 (patch)
tree612261b4a16550f22c098b9ce76bdfccce8e008d /drivers/media/radio
parent6d642d26065c5d375fbb819dbfd8f5d1b9255ece (diff)
Revert "[media] radio-aimslab: Use LM7000 driver"
This reverts commit bece083a6b2b242c7ab74117640396e1bd851e49. As requested by Hans Verkuil: > You accidentally merged the wrong first version of the lm7000 patch series. > > These are the correct second version patches: > > http://patchwork.linuxtv.org/patch/11689/ > http://patchwork.linuxtv.org/patch/11690/ > http://patchwork.linuxtv.org/patch/11691/ > > The second version is much simpler and doesn't require the creation of a whole > new driver. Requested-by: Hans Verkuil <hverkuil@xs4all.nl> Cc: 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/Kconfig3
-rw-r--r--drivers/media/radio/radio-aimslab.c78
2 files changed, 45 insertions, 36 deletions
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index abdf43c0572..5bcce129d71 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -193,14 +193,11 @@ config RADIO_CADET
193 193
194config RADIO_LM7000 194config RADIO_LM7000
195 tristate 195 tristate
196 depends on RADIO_RTRACK
197 default RADIO_RTRACK
198 196
199config RADIO_RTRACK 197config RADIO_RTRACK
200 tristate "AIMSlab RadioTrack (aka RadioReveal) support" 198 tristate "AIMSlab RadioTrack (aka RadioReveal) support"
201 depends on ISA && VIDEO_V4L2 199 depends on ISA && VIDEO_V4L2
202 select RADIO_ISA 200 select RADIO_ISA
203 select RADIO_LM7000
204 ---help--- 201 ---help---
205 Choose Y here if you have one of these FM radio cards, and then fill 202 Choose Y here if you have one of these FM radio cards, and then fill
206 in the port address below. 203 in the port address below.
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 48b72d89dff..98e0c8c2031 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -37,7 +37,6 @@
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"
41 40
42MODULE_AUTHOR("M. Kirkwood"); 41MODULE_AUTHOR("M. Kirkwood");
43MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card."); 42MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card.");
@@ -62,53 +61,66 @@ MODULE_PARM_DESC(radio_nr, "Radio device numbers");
62struct rtrack { 61struct rtrack {
63 struct radio_isa_card isa; 62 struct radio_isa_card isa;
64 int curvol; 63 int curvol;
65 struct lm7000 lm;
66}; 64};
67 65
68#define AIMS_BIT_TUN_CE (1 << 0) 66static struct radio_isa_card *rtrack_alloc(void)
69#define AIMS_BIT_TUN_CLK (1 << 1)
70#define AIMS_BIT_TUN_DATA (1 << 2)
71#define AIMS_BIT_VOL_CE (1 << 3)
72#define AIMS_BIT_TUN_STRQ (1 << 4)
73/* bit 5 is not connected */
74#define AIMS_BIT_VOL_UP (1 << 6) /* active low */
75#define AIMS_BIT_VOL_DN (1 << 7) /* active low */
76
77void rtrack_set_pins(struct lm7000 *lm, u8 pins)
78{ 67{
79 struct rtrack *rt = container_of(lm, struct rtrack, lm); 68 struct rtrack *rt = kzalloc(sizeof(struct rtrack), GFP_KERNEL);
80 u8 bits = AIMS_BIT_VOL_DN | AIMS_BIT_VOL_UP | AIMS_BIT_TUN_STRQ;
81 69
82 if (!v4l2_ctrl_g_ctrl(rt->isa.mute)) 70 if (rt)
83 bits |= AIMS_BIT_VOL_CE; 71 rt->curvol = 0xff;
72 return rt ? &rt->isa : NULL;
73}
84 74
85 if (pins & LM7000_DATA) 75/* The 128+64 on these outb's is to keep the volume stable while tuning.
86 bits |= AIMS_BIT_TUN_DATA; 76 * Without them, the volume _will_ creep up with each frequency change
87 if (pins & LM7000_CLK) 77 * and bit 4 (+16) is to keep the signal strength meter enabled.
88 bits |= AIMS_BIT_TUN_CLK; 78 */
89 if (pins & LM7000_CE)
90 bits |= AIMS_BIT_TUN_CE;
91 79
92 outb_p(bits, rt->isa.io); 80static void send_0_byte(struct radio_isa_card *isa, int on)
81{
82 outb_p(128+64+16+on+1, isa->io); /* wr-enable + data low */
83 outb_p(128+64+16+on+2+1, isa->io); /* clock */
84 msleep(1);
93} 85}
94 86
95static struct radio_isa_card *rtrack_alloc(void) 87static void send_1_byte(struct radio_isa_card *isa, int on)
96{ 88{
97 struct rtrack *rt = kzalloc(sizeof(struct rtrack), GFP_KERNEL); 89 outb_p(128+64+16+on+4+1, isa->io); /* wr-enable+data high */
98 90 outb_p(128+64+16+on+4+2+1, isa->io); /* clock */
99 if (rt) { 91 msleep(1);
100 rt->curvol = 0xff;
101 rt->lm.set_pins = rtrack_set_pins;
102 }
103 return rt ? &rt->isa : NULL;
104} 92}
105 93
106static int rtrack_s_frequency(struct radio_isa_card *isa, u32 freq) 94static int rtrack_s_frequency(struct radio_isa_card *isa, u32 freq)
107{ 95{
108 struct rtrack *rt = container_of(isa, struct rtrack, isa); 96 int on = v4l2_ctrl_g_ctrl(isa->mute) ? 0 : 8;
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 */
109 117
110 lm7000_set_freq(&rt->lm, freq); 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) */
111 122
123 outb(0xd0 + on, isa->io); /* volume steady + sigstr */
112 return 0; 124 return 0;
113} 125}
114 126