2006-04-08 21:06:16 +02:00
|
|
|
/* radio-aztech.c - Aztech radio card driver for Linux 2.2
|
2005-04-17 00:20:36 +02:00
|
|
|
*
|
2006-08-08 14:10:01 +02:00
|
|
|
* Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org>
|
2006-04-08 21:06:16 +02:00
|
|
|
* Adapted to support the Video for Linux API by
|
2005-04-17 00:20:36 +02:00
|
|
|
* Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
|
|
|
|
*
|
|
|
|
* Quay Ly
|
|
|
|
* Donald Song
|
2006-04-08 21:06:16 +02:00
|
|
|
* Jason Lewis (jlewis@twilight.vtc.vsc.edu)
|
2005-04-17 00:20:36 +02:00
|
|
|
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
|
|
|
|
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
|
|
|
|
*
|
|
|
|
* The basis for this code may be found at http://bigbang.vtc.vsc.edu/fmradio/
|
|
|
|
* along with more information on the card itself.
|
|
|
|
*
|
|
|
|
* History:
|
|
|
|
* 1999-02-24 Russell Kroll <rkroll@exploits.org>
|
|
|
|
* Fine tuning/VIDEO_TUNER_LOW
|
|
|
|
* Range expanded to 87-108 MHz (from 87.9-107.8)
|
|
|
|
*
|
|
|
|
* Notable changes from the original source:
|
|
|
|
* - includes stripped down to the essentials
|
|
|
|
* - for loops used as delays replaced with udelay()
|
|
|
|
* - #defines removed, changed to static values
|
|
|
|
* - tuning structure changed - no more character arrays, other changes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h> /* Modules */
|
|
|
|
#include <linux/init.h> /* Initdata */
|
2005-09-13 10:25:15 +02:00
|
|
|
#include <linux/ioport.h> /* request_region */
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <linux/delay.h> /* udelay */
|
2006-08-08 14:10:01 +02:00
|
|
|
#include <linux/videodev2.h> /* kernel radio structs */
|
2009-03-06 17:48:18 +01:00
|
|
|
#include <linux/version.h> /* for KERNEL_VERSION MACRO */
|
|
|
|
#include <linux/io.h> /* outb, outb_p */
|
|
|
|
#include <media/v4l2-device.h>
|
2008-07-20 13:12:02 +02:00
|
|
|
#include <media/v4l2-ioctl.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
MODULE_AUTHOR("Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath");
|
|
|
|
MODULE_DESCRIPTION("A driver for the Aztech radio card.");
|
|
|
|
MODULE_LICENSE("GPL");
|
2006-08-08 14:10:01 +02:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* acceptable ports: 0x350 (JP3 shorted), 0x358 (JP3 open) */
|
|
|
|
|
|
|
|
#ifndef CONFIG_RADIO_AZTECH_PORT
|
|
|
|
#define CONFIG_RADIO_AZTECH_PORT -1
|
|
|
|
#endif
|
|
|
|
|
2006-04-08 21:06:16 +02:00
|
|
|
static int io = CONFIG_RADIO_AZTECH_PORT;
|
2005-04-17 00:20:36 +02:00
|
|
|
static int radio_nr = -1;
|
|
|
|
static int radio_wait_time = 1000;
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
module_param(io, int, 0);
|
|
|
|
module_param(radio_nr, int, 0);
|
|
|
|
MODULE_PARM_DESC(io, "I/O address of the Aztech card (0x350 or 0x358)");
|
|
|
|
|
|
|
|
#define RADIO_VERSION KERNEL_VERSION(0, 0, 2)
|
|
|
|
|
|
|
|
struct aztech
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct v4l2_device v4l2_dev;
|
|
|
|
struct video_device vdev;
|
|
|
|
int io;
|
2005-04-17 00:20:36 +02:00
|
|
|
int curvol;
|
|
|
|
unsigned long curfreq;
|
|
|
|
int stereo;
|
2009-03-06 17:48:18 +01:00
|
|
|
struct mutex lock;
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static struct aztech aztech_card;
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
static int volconvert(int level)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
level >>= 14; /* Map 16bits down to 2 bit */
|
|
|
|
level &= 3;
|
2006-04-08 21:06:16 +02:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* convert to card-friendly values */
|
2009-03-06 17:48:18 +01:00
|
|
|
switch (level) {
|
|
|
|
case 0:
|
|
|
|
return 0;
|
|
|
|
case 1:
|
|
|
|
return 1;
|
|
|
|
case 2:
|
|
|
|
return 4;
|
|
|
|
case 3:
|
|
|
|
return 5;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
return 0; /* Quieten gcc */
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static void send_0_byte(struct aztech *az)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
udelay(radio_wait_time);
|
2009-03-06 17:48:18 +01:00
|
|
|
outb_p(2 + volconvert(az->curvol), az->io);
|
|
|
|
outb_p(64 + 2 + volconvert(az->curvol), az->io);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static void send_1_byte(struct aztech *az)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
udelay (radio_wait_time);
|
2009-03-06 17:48:18 +01:00
|
|
|
outb_p(128 + 2 + volconvert(az->curvol), az->io);
|
|
|
|
outb_p(128 + 64 + 2 + volconvert(az->curvol), az->io);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int az_setvol(struct aztech *az, int vol)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
mutex_lock(&az->lock);
|
|
|
|
outb(volconvert(vol), az->io);
|
|
|
|
mutex_unlock(&az->lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* thanks to Michael Dwyer for giving me a dose of clues in
|
|
|
|
* the signal strength department..
|
|
|
|
*
|
|
|
|
* This card has a stereo bit - bit 0 set = mono, not set = stereo
|
|
|
|
* It also has a "signal" bit - bit 1 set = bad signal, not set = good
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int az_getsigstr(struct aztech *az)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
int sig = 1;
|
|
|
|
|
|
|
|
mutex_lock(&az->lock);
|
|
|
|
if (inb(az->io) & 2) /* bit set = no signal present */
|
|
|
|
sig = 0;
|
|
|
|
mutex_unlock(&az->lock);
|
|
|
|
return sig;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int az_getstereo(struct aztech *az)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
int stereo = 1;
|
|
|
|
|
|
|
|
mutex_lock(&az->lock);
|
|
|
|
if (inb(az->io) & 1) /* bit set = mono */
|
|
|
|
stereo = 0;
|
|
|
|
mutex_unlock(&az->lock);
|
|
|
|
return stereo;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int az_setfreq(struct aztech *az, unsigned long frequency)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
mutex_lock(&az->lock);
|
|
|
|
|
|
|
|
az->curfreq = frequency;
|
2005-04-17 00:20:36 +02:00
|
|
|
frequency += 171200; /* Add 10.7 MHz IF */
|
|
|
|
frequency /= 800; /* Convert to 50 kHz units */
|
2006-04-08 21:06:16 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
send_0_byte(az); /* 0: LSB of frequency */
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
|
|
|
|
if (frequency & (1 << i))
|
2009-03-06 17:48:18 +01:00
|
|
|
send_1_byte(az);
|
2005-04-17 00:20:36 +02:00
|
|
|
else
|
2009-03-06 17:48:18 +01:00
|
|
|
send_0_byte(az);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
send_0_byte(az); /* 14: test bit - always 0 */
|
|
|
|
send_0_byte(az); /* 15: test bit - always 0 */
|
|
|
|
send_0_byte(az); /* 16: band data 0 - always 0 */
|
|
|
|
if (az->stereo) /* 17: stereo (1 to enable) */
|
|
|
|
send_1_byte(az);
|
2005-04-17 00:20:36 +02:00
|
|
|
else
|
2009-03-06 17:48:18 +01:00
|
|
|
send_0_byte(az);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
send_1_byte(az); /* 18: band data 1 - unknown */
|
|
|
|
send_0_byte(az); /* 19: time base - always 0 */
|
|
|
|
send_0_byte(az); /* 20: spacing (0 = 25 kHz) */
|
|
|
|
send_1_byte(az); /* 21: spacing (1 = 25 kHz) */
|
|
|
|
send_0_byte(az); /* 22: spacing (0 = 25 kHz) */
|
|
|
|
send_1_byte(az); /* 23: AM/FM (FM = 1, always) */
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/* latch frequency */
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
udelay(radio_wait_time);
|
|
|
|
outb_p(128 + 64 + volconvert(az->curvol), az->io);
|
2006-04-08 21:06:16 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
mutex_unlock(&az->lock);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_querycap(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_capability *v)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
strlcpy(v->driver, "radio-aztech", sizeof(v->driver));
|
|
|
|
strlcpy(v->card, "Aztech Radio", sizeof(v->card));
|
|
|
|
strlcpy(v->bus_info, "ISA", sizeof(v->bus_info));
|
2007-01-25 12:09:32 +01:00
|
|
|
v->version = RADIO_VERSION;
|
2009-03-06 17:48:18 +01:00
|
|
|
v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
|
2007-01-25 12:09:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_g_tuner(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_tuner *v)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct aztech *az = video_drvdata(file);
|
2006-04-08 21:06:16 +02:00
|
|
|
|
2007-01-25 12:09:32 +01:00
|
|
|
if (v->index > 0)
|
|
|
|
return -EINVAL;
|
2006-08-08 14:10:01 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
strlcpy(v->name, "FM", sizeof(v->name));
|
2007-01-25 12:09:32 +01:00
|
|
|
v->type = V4L2_TUNER_RADIO;
|
2006-08-08 14:10:01 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
v->rangelow = 87 * 16000;
|
|
|
|
v->rangehigh = 108 * 16000;
|
|
|
|
v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
|
|
|
|
v->capability = V4L2_TUNER_CAP_LOW;
|
|
|
|
if (az_getstereo(az))
|
2007-01-25 12:09:32 +01:00
|
|
|
v->audmode = V4L2_TUNER_MODE_STEREO;
|
|
|
|
else
|
|
|
|
v->audmode = V4L2_TUNER_MODE_MONO;
|
2009-03-06 17:48:18 +01:00
|
|
|
v->signal = 0xFFFF * az_getsigstr(az);
|
2006-08-08 14:10:01 +02:00
|
|
|
|
2007-01-25 12:09:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2006-08-08 14:10:01 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_s_tuner(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_tuner *v)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
return v->index ? -EINVAL : 0;
|
2007-01-25 19:10:31 +01:00
|
|
|
}
|
|
|
|
|
2007-01-25 20:48:13 +01:00
|
|
|
static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
|
|
|
|
{
|
|
|
|
*i = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
return i ? -EINVAL : 0;
|
2007-01-25 20:48:13 +01:00
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_g_audio(struct file *file, void *priv,
|
2007-01-25 19:10:31 +01:00
|
|
|
struct v4l2_audio *a)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
a->index = 0;
|
|
|
|
strlcpy(a->name, "Radio", sizeof(a->name));
|
|
|
|
a->capability = V4L2_AUDCAP_STEREO;
|
2007-01-25 19:10:31 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_s_audio(struct file *file, void *priv,
|
|
|
|
struct v4l2_audio *a)
|
|
|
|
{
|
|
|
|
return a->index ? -EINVAL : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vidioc_s_frequency(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_frequency *f)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct aztech *az = video_drvdata(file);
|
2006-08-08 14:10:01 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
az_setfreq(az, f->frequency);
|
2007-01-25 12:09:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_g_frequency(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_frequency *f)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct aztech *az = video_drvdata(file);
|
2007-01-25 12:09:32 +01:00
|
|
|
|
|
|
|
f->type = V4L2_TUNER_RADIO;
|
|
|
|
f->frequency = az->curfreq;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_queryctrl(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_queryctrl *qc)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
switch (qc->id) {
|
|
|
|
case V4L2_CID_AUDIO_MUTE:
|
|
|
|
return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
|
|
|
|
case V4L2_CID_AUDIO_VOLUME:
|
|
|
|
return v4l2_ctrl_query_fill(qc, 0, 0xff, 1, 0xff);
|
2007-01-25 12:09:32 +01:00
|
|
|
}
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2006-08-08 14:10:01 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_g_ctrl(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_control *ctrl)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct aztech *az = video_drvdata(file);
|
2007-01-25 12:09:32 +01:00
|
|
|
|
|
|
|
switch (ctrl->id) {
|
2009-03-06 17:48:18 +01:00
|
|
|
case V4L2_CID_AUDIO_MUTE:
|
|
|
|
if (az->curvol == 0)
|
|
|
|
ctrl->value = 1;
|
|
|
|
else
|
|
|
|
ctrl->value = 0;
|
|
|
|
return 0;
|
|
|
|
case V4L2_CID_AUDIO_VOLUME:
|
|
|
|
ctrl->value = az->curvol * 6554;
|
|
|
|
return 0;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
2007-01-25 12:09:32 +01:00
|
|
|
return -EINVAL;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static int vidioc_s_ctrl(struct file *file, void *priv,
|
2007-01-25 12:09:32 +01:00
|
|
|
struct v4l2_control *ctrl)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct aztech *az = video_drvdata(file);
|
2007-01-25 12:09:32 +01:00
|
|
|
|
|
|
|
switch (ctrl->id) {
|
2009-03-06 17:48:18 +01:00
|
|
|
case V4L2_CID_AUDIO_MUTE:
|
|
|
|
if (ctrl->value)
|
|
|
|
az_setvol(az, 0);
|
|
|
|
else
|
|
|
|
az_setvol(az, az->curvol);
|
|
|
|
return 0;
|
|
|
|
case V4L2_CID_AUDIO_VOLUME:
|
|
|
|
az_setvol(az, ctrl->value);
|
|
|
|
return 0;
|
2007-01-25 12:09:32 +01:00
|
|
|
}
|
|
|
|
return -EINVAL;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2008-12-30 10:58:20 +01:00
|
|
|
static const struct v4l2_file_operations aztech_fops = {
|
2005-04-17 00:20:36 +02:00
|
|
|
.owner = THIS_MODULE,
|
2007-01-25 12:09:32 +01:00
|
|
|
.ioctl = video_ioctl2,
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
2008-07-21 07:57:38 +02:00
|
|
|
static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
|
2007-01-25 12:09:32 +01:00
|
|
|
.vidioc_querycap = vidioc_querycap,
|
|
|
|
.vidioc_g_tuner = vidioc_g_tuner,
|
|
|
|
.vidioc_s_tuner = vidioc_s_tuner,
|
2007-01-25 19:10:31 +01:00
|
|
|
.vidioc_g_audio = vidioc_g_audio,
|
|
|
|
.vidioc_s_audio = vidioc_s_audio,
|
2007-01-25 20:48:13 +01:00
|
|
|
.vidioc_g_input = vidioc_g_input,
|
|
|
|
.vidioc_s_input = vidioc_s_input,
|
2007-01-25 12:09:32 +01:00
|
|
|
.vidioc_g_frequency = vidioc_g_frequency,
|
|
|
|
.vidioc_s_frequency = vidioc_s_frequency,
|
|
|
|
.vidioc_queryctrl = vidioc_queryctrl,
|
|
|
|
.vidioc_g_ctrl = vidioc_g_ctrl,
|
|
|
|
.vidioc_s_ctrl = vidioc_s_ctrl,
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __init aztech_init(void)
|
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct aztech *az = &aztech_card;
|
|
|
|
struct v4l2_device *v4l2_dev = &az->v4l2_dev;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
strlcpy(v4l2_dev->name, "aztech", sizeof(v4l2_dev->name));
|
|
|
|
az->io = io;
|
|
|
|
|
|
|
|
if (az->io == -1) {
|
2009-03-09 12:11:21 +01:00
|
|
|
v4l2_err(v4l2_dev, "you must set an I/O address with io=0x350 or 0x358\n");
|
2005-04-17 00:20:36 +02:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
if (!request_region(az->io, 2, "aztech")) {
|
|
|
|
v4l2_err(v4l2_dev, "port 0x%x already in use\n", az->io);
|
2005-04-17 00:20:36 +02:00
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
res = v4l2_device_register(NULL, v4l2_dev);
|
|
|
|
if (res < 0) {
|
|
|
|
release_region(az->io, 2);
|
|
|
|
v4l2_err(v4l2_dev, "Could not register v4l2_device\n");
|
|
|
|
return res;
|
|
|
|
}
|
2006-04-08 21:06:16 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
mutex_init(&az->lock);
|
|
|
|
strlcpy(az->vdev.name, v4l2_dev->name, sizeof(az->vdev.name));
|
|
|
|
az->vdev.v4l2_dev = v4l2_dev;
|
|
|
|
az->vdev.fops = &aztech_fops;
|
|
|
|
az->vdev.ioctl_ops = &aztech_ioctl_ops;
|
|
|
|
az->vdev.release = video_device_release_empty;
|
|
|
|
video_set_drvdata(&az->vdev, az);
|
|
|
|
|
|
|
|
if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
|
|
|
|
v4l2_device_unregister(v4l2_dev);
|
|
|
|
release_region(az->io, 2);
|
2005-04-17 00:20:36 +02:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
2006-04-08 21:06:16 +02:00
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n");
|
2005-04-17 00:20:36 +02:00
|
|
|
/* mute card - prevents noisy bootups */
|
2009-03-06 17:48:18 +01:00
|
|
|
outb(0, az->io);
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-06 17:48:18 +01:00
|
|
|
static void __exit aztech_exit(void)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2009-03-06 17:48:18 +01:00
|
|
|
struct aztech *az = &aztech_card;
|
|
|
|
|
|
|
|
video_unregister_device(&az->vdev);
|
|
|
|
v4l2_device_unregister(&az->v4l2_dev);
|
|
|
|
release_region(az->io, 2);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(aztech_init);
|
2009-03-06 17:48:18 +01:00
|
|
|
module_exit(aztech_exit);
|