19 #include <linux/kernel.h>
20 #include <linux/module.h>
26 #include <linux/videodev2.h>
38 static int radio_nr = -1;
41 MODULE_PARM_DESC(
io,
"I/O address of the SF16-FMI/SF16-FMP/SF16-FMD card (0x284 or 0x384)");
54 static struct fmi fmi_card;
58 #define RSF16_MINFREQ (87 * 16000)
59 #define RSF16_MAXFREQ (108 * 16000)
61 #define FMI_BIT_TUN_CE (1 << 0)
62 #define FMI_BIT_TUN_CLK (1 << 1)
63 #define FMI_BIT_TUN_DATA (1 << 2)
64 #define FMI_BIT_VOL_SW (1 << 3)
65 #define FMI_BIT_TUN_STRQ (1 << 4)
87 static inline void fmi_mute(
struct fmi *
fmi)
94 static inline void fmi_unmute(
struct fmi *
fmi)
101 static inline int fmi_getsigstr(
struct fmi *
fmi)
107 val = fmi->
mute ? 0x00 : 0x08;
109 outb(val | 0x10, fmi->
io);
115 return (res & 2) ? 0 : 0xFFFF;
118 static int vidioc_querycap(
struct file *
file,
void *
priv,
128 static int vidioc_g_tuner(
struct file *
file,
void *
priv,
131 struct fmi *fmi = video_drvdata(file);
143 v->
signal = fmi_getsigstr(fmi);
147 static int vidioc_s_tuner(
struct file *file,
void *priv,
153 static int vidioc_s_frequency(
struct file *file,
void *priv,
156 struct fmi *fmi = video_drvdata(file);
169 static int vidioc_g_frequency(
struct file *file,
void *priv,
172 struct fmi *fmi = video_drvdata(file);
181 static int vidioc_queryctrl(
struct file *file,
void *priv,
191 static int vidioc_g_ctrl(
struct file *file,
void *priv,
194 struct fmi *fmi = video_drvdata(file);
204 static int vidioc_s_ctrl(
struct file *file,
void *priv,
207 struct fmi *fmi = video_drvdata(file);
221 static int vidioc_g_input(
struct file *filp,
void *priv,
unsigned int *
i)
227 static int vidioc_s_input(
struct file *filp,
void *priv,
unsigned int i)
232 static int vidioc_g_audio(
struct file *file,
void *priv,
241 static int vidioc_s_audio(
struct file *file,
void *priv,
275 { ISAPNP_CARD_END, },
280 static int __init isapnp_fmi_probe(
void)
286 id_table[i].
function,
NULL);
295 printk(
KERN_ERR "radio-sf16fmi: PnP configure failed (out of resources?)\n");
299 if (!pnp_port_valid(dev, 0)) {
304 i = pnp_port_start(dev, 0);
310 static int __init fmi_init(
void)
312 struct fmi *fmi = &fmi_card;
315 int probe_ports[] = { 0, 0x284, 0x384 };
318 for (i = 0; i <
ARRAY_SIZE(probe_ports); i++) {
321 io = isapnp_fmi_probe();
333 ((
inb(
io) & 0xf9) == 0xf9 && (
inb(
io) & 0x4) == 0))
343 if (
inb(
io) == 0xff) {
362 v4l2_err(v4l2_dev,
"Could not register v4l2_device\n");
367 fmi->
vdev.v4l2_dev = v4l2_dev;
368 fmi->
vdev.fops = &fmi_fops;
369 fmi->
vdev.ioctl_ops = &fmi_ioctl_ops;
371 video_set_drvdata(&fmi->
vdev, fmi);
386 v4l2_info(v4l2_dev,
"card driver at 0x%x\n", fmi->
io);
390 static void __exit fmi_exit(
void)
392 struct fmi *fmi = &fmi_card;