V4L/DVB (3753): Whitespace cleanups at media/radio
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
@@ -136,7 +136,7 @@ config RADIO_GEMTEK_PCI
|
|||||||
Choose Y here if you have this PCI FM radio card.
|
Choose Y here if you have this PCI FM radio card.
|
||||||
|
|
||||||
In order to control your radio card, you will need to use programs
|
In order to control your radio card, you will need to use programs
|
||||||
that are compatible with the Video for Linux API. Information on
|
that are compatible with the Video for Linux API. Information on
|
||||||
this API and pointers to "v4l" programs may be found at
|
this API and pointers to "v4l" programs may be found at
|
||||||
<file:Documentation/video4linux/API.html>.
|
<file:Documentation/video4linux/API.html>.
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* What ever you think about the ACI, version 0x07 is not very well!
|
/* What ever you think about the ACI, version 0x07 is not very well!
|
||||||
* I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
|
* I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
|
||||||
* conditions... Robert
|
* conditions... Robert
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@@ -123,7 +123,7 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct pcm20_device *pcm20 = dev->priv;
|
struct pcm20_device *pcm20 = dev->priv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@@ -139,7 +139,7 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
v->rangelow=87*16000;
|
v->rangelow=87*16000;
|
||||||
v->rangehigh=108*16000;
|
v->rangehigh=108*16000;
|
||||||
@@ -172,7 +172,7 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags=VIDEO_AUDIO_MUTABLE;
|
v->flags=VIDEO_AUDIO_MUTABLE;
|
||||||
@@ -183,12 +183,12 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
v->mode|=VIDEO_SOUND_MONO;
|
v->mode|=VIDEO_SOUND_MONO;
|
||||||
/* v->step=2048; */
|
/* v->step=2048; */
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pcm20_mute(pcm20, !!(v->flags&VIDEO_AUDIO_MUTE));
|
pcm20_mute(pcm20, !!(v->flags&VIDEO_AUDIO_MUTE));
|
||||||
@@ -237,7 +237,7 @@ static int __init pcm20_init(void)
|
|||||||
{
|
{
|
||||||
if(video_register_device(&pcm20_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
if(video_register_device(&pcm20_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
||||||
goto video_register_device;
|
goto video_register_device;
|
||||||
|
|
||||||
if(attach_aci_rds()<0)
|
if(attach_aci_rds()<0)
|
||||||
goto attach_aci_rds;
|
goto attach_aci_rds;
|
||||||
|
|
||||||
|
@@ -33,24 +33,24 @@ static struct mutex aci_rds_mutex;
|
|||||||
#define RDS_BUSYMASK 0x10 /* Bit 4 */
|
#define RDS_BUSYMASK 0x10 /* Bit 4 */
|
||||||
#define RDS_CLOCKMASK 0x08 /* Bit 3 */
|
#define RDS_CLOCKMASK 0x08 /* Bit 3 */
|
||||||
|
|
||||||
#define RDS_DATA(x) (((x) >> RDS_DATASHIFT) & 1)
|
#define RDS_DATA(x) (((x) >> RDS_DATASHIFT) & 1)
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
static void print_matrix(char array[], unsigned int length)
|
static void print_matrix(char array[], unsigned int length)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i=0; i<length; i++) {
|
for (i=0; i<length; i++) {
|
||||||
printk(KERN_DEBUG "aci-rds: ");
|
printk(KERN_DEBUG "aci-rds: ");
|
||||||
for (j=7; j>=0; j--) {
|
for (j=7; j>=0; j--) {
|
||||||
printk("%d", (array[i] >> j) & 0x1);
|
printk("%d", (array[i] >> j) & 0x1);
|
||||||
}
|
}
|
||||||
if (i%8 == 0)
|
if (i%8 == 0)
|
||||||
printk(" byte-border\n");
|
printk(" byte-border\n");
|
||||||
else
|
else
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ static int rds_write(unsigned char cmd)
|
|||||||
{
|
{
|
||||||
unsigned char sendbuffer[8];
|
unsigned char sendbuffer[8];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (byte2trans(cmd, sendbuffer, 8) != 0){
|
if (byte2trans(cmd, sendbuffer, 8) != 0){
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
@@ -151,7 +151,7 @@ static int rds_read(unsigned char databuffer[], int datasize)
|
|||||||
I have to waitread() here */
|
I have to waitread() here */
|
||||||
if (rds_waitread() < 0)
|
if (rds_waitread() < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(databuffer, 0, datasize);
|
memset(databuffer, 0, datasize);
|
||||||
|
|
||||||
for (i=0; i< READSIZE; i++)
|
for (i=0; i< READSIZE; i++)
|
||||||
@@ -194,7 +194,7 @@ int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
mutex_unlock(&aci_rds_mutex);
|
mutex_unlock(&aci_rds_mutex);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(aci_rds_cmd);
|
EXPORT_SYMBOL(aci_rds_cmd);
|
||||||
|
@@ -48,7 +48,7 @@ static int rds_f_release(struct inode *in, struct file *fi)
|
|||||||
|
|
||||||
static void print_matrix(char *ch, char out[])
|
static void print_matrix(char *ch, char out[])
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j=7; j>=0; j--) {
|
for (j=7; j>=0; j--) {
|
||||||
out[7-j] = ((*ch >> j) & 0x1) + '0';
|
out[7-j] = ((*ch >> j) & 0x1) + '0';
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
* out(port, start_increasing_volume);
|
* out(port, start_increasing_volume);
|
||||||
* wait(a_wee_while);
|
* wait(a_wee_while);
|
||||||
* out(port, stop_changing_the_volume);
|
* out(port, stop_changing_the_volume);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h> /* Modules */
|
#include <linux/module.h> /* Modules */
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
#define CONFIG_RADIO_RTRACK_PORT -1
|
#define CONFIG_RADIO_RTRACK_PORT -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int io = CONFIG_RADIO_RTRACK_PORT;
|
static int io = CONFIG_RADIO_RTRACK_PORT;
|
||||||
static int radio_nr = -1;
|
static int radio_nr = -1;
|
||||||
static struct mutex lock;
|
static struct mutex lock;
|
||||||
|
|
||||||
@@ -93,12 +93,12 @@ static int rt_setvol(struct rt_device *dev, int vol)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
mutex_lock(&lock);
|
mutex_lock(&lock);
|
||||||
|
|
||||||
if(vol == dev->curvol) { /* requested volume = current */
|
if(vol == dev->curvol) { /* requested volume = current */
|
||||||
if (dev->muted) { /* user is unmuting the card */
|
if (dev->muted) { /* user is unmuting the card */
|
||||||
dev->muted = 0;
|
dev->muted = 0;
|
||||||
outb (0xd8, io); /* enable card */
|
outb (0xd8, io); /* enable card */
|
||||||
}
|
}
|
||||||
mutex_unlock(&lock);
|
mutex_unlock(&lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -114,10 +114,10 @@ static int rt_setvol(struct rt_device *dev, int vol)
|
|||||||
|
|
||||||
dev->muted = 0;
|
dev->muted = 0;
|
||||||
if(vol > dev->curvol)
|
if(vol > dev->curvol)
|
||||||
for(i = dev->curvol; i < vol; i++)
|
for(i = dev->curvol; i < vol; i++)
|
||||||
rt_incvol();
|
rt_incvol();
|
||||||
else
|
else
|
||||||
for(i = dev->curvol; i > vol; i--)
|
for(i = dev->curvol; i > vol; i--)
|
||||||
rt_decvol();
|
rt_decvol();
|
||||||
|
|
||||||
dev->curvol = vol;
|
dev->curvol = vol;
|
||||||
@@ -125,7 +125,7 @@ static int rt_setvol(struct rt_device *dev, int vol)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the 128+64 on these outb's is to keep the volume stable while tuning
|
/* 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
|
* without them, the volume _will_ creep up with each frequency change
|
||||||
* and bit 4 (+16) is to keep the signal strength meter enabled
|
* and bit 4 (+16) is to keep the signal strength meter enabled
|
||||||
*/
|
*/
|
||||||
@@ -140,7 +140,7 @@ static void send_0_byte(int port, struct rt_device *dev)
|
|||||||
outb_p(128+64+16+8+ 1, port); /* on + wr-enable + data low */
|
outb_p(128+64+16+8+ 1, port); /* on + wr-enable + data low */
|
||||||
outb_p(128+64+16+8+2+1, port); /* clock */
|
outb_p(128+64+16+8+2+1, port); /* clock */
|
||||||
}
|
}
|
||||||
sleep_delay(1000);
|
sleep_delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_1_byte(int port, struct rt_device *dev)
|
static void send_1_byte(int port, struct rt_device *dev)
|
||||||
@@ -148,13 +148,13 @@ static void send_1_byte(int port, struct rt_device *dev)
|
|||||||
if ((dev->curvol == 0) || (dev->muted)) {
|
if ((dev->curvol == 0) || (dev->muted)) {
|
||||||
outb_p(128+64+16+4 +1, port); /* wr-enable+data high */
|
outb_p(128+64+16+4 +1, port); /* wr-enable+data high */
|
||||||
outb_p(128+64+16+4+2+1, port); /* clock */
|
outb_p(128+64+16+4+2+1, port); /* clock */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
outb_p(128+64+16+8+4 +1, port); /* on+wr-enable+data high */
|
outb_p(128+64+16+8+4 +1, port); /* on+wr-enable+data high */
|
||||||
outb_p(128+64+16+8+4+2+1, port); /* clock */
|
outb_p(128+64+16+8+4+2+1, port); /* clock */
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep_delay(1000);
|
sleep_delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rt_setfreq(struct rt_device *dev, unsigned long freq)
|
static int rt_setfreq(struct rt_device *dev, unsigned long freq)
|
||||||
@@ -167,9 +167,9 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
|
|||||||
|
|
||||||
freq += 171200; /* Add 10.7 MHz IF */
|
freq += 171200; /* Add 10.7 MHz IF */
|
||||||
freq /= 800; /* Convert to 50 kHz units */
|
freq /= 800; /* Convert to 50 kHz units */
|
||||||
|
|
||||||
mutex_lock(&lock); /* Stop other ops interfering */
|
mutex_lock(&lock); /* Stop other ops interfering */
|
||||||
|
|
||||||
send_0_byte (io, dev); /* 0: LSB of frequency */
|
send_0_byte (io, dev); /* 0: LSB of frequency */
|
||||||
|
|
||||||
for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
|
for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
|
||||||
@@ -195,7 +195,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
|
|||||||
outb (0xd0, io); /* volume steady + sigstr */
|
outb (0xd0, io); /* volume steady + sigstr */
|
||||||
else
|
else
|
||||||
outb (0xd8, io); /* volume steady + sigstr + on */
|
outb (0xd8, io); /* volume steady + sigstr + on */
|
||||||
|
|
||||||
mutex_unlock(&lock);
|
mutex_unlock(&lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -213,7 +213,7 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct rt_device *rt=dev->priv;
|
struct rt_device *rt=dev->priv;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@@ -229,7 +229,7 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
v->rangelow=(87*16000);
|
v->rangelow=(87*16000);
|
||||||
v->rangehigh=(108*16000);
|
v->rangehigh=(108*16000);
|
||||||
@@ -261,21 +261,21 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
||||||
v->volume=rt->curvol * 6554;
|
v->volume=rt->curvol * 6554;
|
||||||
v->step=6554;
|
v->step=6554;
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if(v->flags&VIDEO_AUDIO_MUTE)
|
if(v->flags&VIDEO_AUDIO_MUTE)
|
||||||
rt_mute(rt);
|
rt_mute(rt);
|
||||||
else
|
else
|
||||||
rt_setvol(rt,v->volume/6554);
|
rt_setvol(rt,v->volume/6554);
|
||||||
@@ -298,7 +298,7 @@ static struct file_operations rtrack_fops = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = video_exclusive_open,
|
.open = video_exclusive_open,
|
||||||
.release = video_exclusive_release,
|
.release = video_exclusive_release,
|
||||||
.ioctl = rt_ioctl,
|
.ioctl = rt_ioctl,
|
||||||
.compat_ioctl = v4l_compat_ioctl32,
|
.compat_ioctl = v4l_compat_ioctl32,
|
||||||
.llseek = no_llseek,
|
.llseek = no_llseek,
|
||||||
};
|
};
|
||||||
@@ -320,14 +320,14 @@ static int __init rtrack_init(void)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!request_region(io, 2, "rtrack"))
|
if (!request_region(io, 2, "rtrack"))
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "rtrack: port 0x%x already in use\n", io);
|
printk(KERN_ERR "rtrack: port 0x%x already in use\n", io);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtrack_radio.priv=&rtrack_unit;
|
rtrack_radio.priv=&rtrack_unit;
|
||||||
|
|
||||||
if(video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
if(video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
||||||
{
|
{
|
||||||
release_region(io, 2);
|
release_region(io, 2);
|
||||||
@@ -336,10 +336,10 @@ static int __init rtrack_init(void)
|
|||||||
printk(KERN_INFO "AIMSlab RadioTrack/RadioReveal card driver.\n");
|
printk(KERN_INFO "AIMSlab RadioTrack/RadioReveal card driver.\n");
|
||||||
|
|
||||||
/* Set up the I/O locking */
|
/* Set up the I/O locking */
|
||||||
|
|
||||||
mutex_init(&lock);
|
mutex_init(&lock);
|
||||||
|
|
||||||
/* mute card - prevents noisy bootups */
|
/* mute card - prevents noisy bootups */
|
||||||
|
|
||||||
/* this ensures that the volume is all the way down */
|
/* this ensures that the volume is all the way down */
|
||||||
outb(0x48, io); /* volume down but still "on" */
|
outb(0x48, io); /* volume down but still "on" */
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/* radio-aztech.c - Aztech radio card driver for Linux 2.2
|
/* radio-aztech.c - Aztech radio card driver for Linux 2.2
|
||||||
*
|
*
|
||||||
* Adapted to support the Video for Linux API by
|
* Adapted to support the Video for Linux API by
|
||||||
* Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
|
* Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
|
||||||
*
|
*
|
||||||
* Quay Ly
|
* Quay Ly
|
||||||
* Donald Song
|
* Donald Song
|
||||||
* Jason Lewis (jlewis@twilight.vtc.vsc.edu)
|
* Jason Lewis (jlewis@twilight.vtc.vsc.edu)
|
||||||
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
|
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
|
||||||
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
|
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
|
||||||
*
|
*
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#define CONFIG_RADIO_AZTECH_PORT -1
|
#define CONFIG_RADIO_AZTECH_PORT -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int io = CONFIG_RADIO_AZTECH_PORT;
|
static int io = CONFIG_RADIO_AZTECH_PORT;
|
||||||
static int radio_nr = -1;
|
static int radio_nr = -1;
|
||||||
static int radio_wait_time = 1000;
|
static int radio_wait_time = 1000;
|
||||||
static struct mutex lock;
|
static struct mutex lock;
|
||||||
@@ -53,15 +53,15 @@ struct az_device
|
|||||||
|
|
||||||
static int volconvert(int level)
|
static int volconvert(int level)
|
||||||
{
|
{
|
||||||
level>>=14; /* Map 16bits down to 2 bit */
|
level>>=14; /* Map 16bits down to 2 bit */
|
||||||
level&=3;
|
level&=3;
|
||||||
|
|
||||||
/* convert to card-friendly values */
|
/* convert to card-friendly values */
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return 0;
|
return 0;
|
||||||
case 1:
|
case 1:
|
||||||
return 1;
|
return 1;
|
||||||
case 2:
|
case 2:
|
||||||
return 4;
|
return 4;
|
||||||
@@ -121,9 +121,9 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency)
|
|||||||
|
|
||||||
frequency += 171200; /* Add 10.7 MHz IF */
|
frequency += 171200; /* Add 10.7 MHz IF */
|
||||||
frequency /= 800; /* Convert to 50 kHz units */
|
frequency /= 800; /* Convert to 50 kHz units */
|
||||||
|
|
||||||
mutex_lock(&lock);
|
mutex_lock(&lock);
|
||||||
|
|
||||||
send_0_byte (dev); /* 0: LSB of frequency */
|
send_0_byte (dev); /* 0: LSB of frequency */
|
||||||
|
|
||||||
for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
|
for (i = 0; i < 13; i++) /* : frequency bits (1-13) */
|
||||||
@@ -151,7 +151,7 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency)
|
|||||||
|
|
||||||
udelay (radio_wait_time);
|
udelay (radio_wait_time);
|
||||||
outb_p(128+64+volconvert(dev->curvol), io);
|
outb_p(128+64+volconvert(dev->curvol), io);
|
||||||
|
|
||||||
mutex_unlock(&lock);
|
mutex_unlock(&lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -162,7 +162,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct az_device *az = dev->priv;
|
struct az_device *az = dev->priv;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@@ -178,7 +178,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
v->rangelow=(87*16000);
|
v->rangelow=(87*16000);
|
||||||
v->rangehigh=(108*16000);
|
v->rangehigh=(108*16000);
|
||||||
@@ -211,7 +211,7 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
||||||
@@ -222,17 +222,17 @@ static int az_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
v->volume=az->curvol;
|
v->volume=az->curvol;
|
||||||
v->step=16384;
|
v->step=16384;
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
az->curvol=v->volume;
|
az->curvol=v->volume;
|
||||||
|
|
||||||
az->stereo=(v->mode&VIDEO_SOUND_STEREO)?1:0;
|
az->stereo=(v->mode&VIDEO_SOUND_STEREO)?1:0;
|
||||||
if(v->flags&VIDEO_AUDIO_MUTE)
|
if(v->flags&VIDEO_AUDIO_MUTE)
|
||||||
az_setvol(az,0);
|
az_setvol(az,0);
|
||||||
else
|
else
|
||||||
az_setvol(az,az->curvol);
|
az_setvol(az,az->curvol);
|
||||||
@@ -277,7 +277,7 @@ static int __init aztech_init(void)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!request_region(io, 2, "aztech"))
|
if (!request_region(io, 2, "aztech"))
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "aztech: port 0x%x already in use\n", io);
|
printk(KERN_ERR "aztech: port 0x%x already in use\n", io);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
@@ -285,13 +285,13 @@ static int __init aztech_init(void)
|
|||||||
|
|
||||||
mutex_init(&lock);
|
mutex_init(&lock);
|
||||||
aztech_radio.priv=&aztech_unit;
|
aztech_radio.priv=&aztech_unit;
|
||||||
|
|
||||||
if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
||||||
{
|
{
|
||||||
release_region(io,2);
|
release_region(io,2);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n");
|
printk(KERN_INFO "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n");
|
||||||
/* mute card - prevents noisy bootups */
|
/* mute card - prevents noisy bootups */
|
||||||
outb (0, io);
|
outb (0, io);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* Russell Kroll (rkroll@exploits.org)
|
* Russell Kroll (rkroll@exploits.org)
|
||||||
* Quay Ly
|
* Quay Ly
|
||||||
* Donald Song
|
* Donald Song
|
||||||
* Jason Lewis (jlewis@twilight.vtc.vsc.edu)
|
* Jason Lewis (jlewis@twilight.vtc.vsc.edu)
|
||||||
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
|
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
|
||||||
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
|
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
|
||||||
*
|
*
|
||||||
@@ -55,29 +55,29 @@ static int cadet_probe(void);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Signal Strength Threshold Values
|
* Signal Strength Threshold Values
|
||||||
* The V4L API spec does not define any particular unit for the signal
|
* The V4L API spec does not define any particular unit for the signal
|
||||||
* strength value. These values are in microvolts of RF at the tuner's input.
|
* strength value. These values are in microvolts of RF at the tuner's input.
|
||||||
*/
|
*/
|
||||||
static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}};
|
static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}};
|
||||||
|
|
||||||
static int cadet_getrds(void)
|
static int cadet_getrds(void)
|
||||||
{
|
{
|
||||||
int rdsstat=0;
|
int rdsstat=0;
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
outb(3,io); /* Select Decoder Control/Status */
|
outb(3,io); /* Select Decoder Control/Status */
|
||||||
outb(inb(io+1)&0x7f,io+1); /* Reset RDS detection */
|
outb(inb(io+1)&0x7f,io+1); /* Reset RDS detection */
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
|
|
||||||
msleep(100);
|
msleep(100);
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
outb(3,io); /* Select Decoder Control/Status */
|
outb(3,io); /* Select Decoder Control/Status */
|
||||||
if((inb(io+1)&0x80)!=0) {
|
if((inb(io+1)&0x80)!=0) {
|
||||||
rdsstat|=VIDEO_TUNER_RDS_ON;
|
rdsstat|=VIDEO_TUNER_RDS_ON;
|
||||||
}
|
}
|
||||||
if((inb(io+1)&0x10)!=0) {
|
if((inb(io+1)&0x10)!=0) {
|
||||||
rdsstat|=VIDEO_TUNER_MBS_ON;
|
rdsstat|=VIDEO_TUNER_MBS_ON;
|
||||||
}
|
}
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
return rdsstat;
|
return rdsstat;
|
||||||
@@ -86,49 +86,49 @@ static int cadet_getrds(void)
|
|||||||
static int cadet_getstereo(void)
|
static int cadet_getstereo(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if(curtuner != 0) /* Only FM has stereo capability! */
|
if(curtuner != 0) /* Only FM has stereo capability! */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
if( (inb(io+1) & 0x40) == 0)
|
if( (inb(io+1) & 0x40) == 0)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned cadet_gettune(void)
|
static unsigned cadet_gettune(void)
|
||||||
{
|
{
|
||||||
int curvol,i;
|
int curvol,i;
|
||||||
unsigned fifo=0;
|
unsigned fifo=0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prepare for read
|
* Prepare for read
|
||||||
*/
|
*/
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
|
|
||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
curvol=inb(io+1); /* Save current volume/mute setting */
|
curvol=inb(io+1); /* Save current volume/mute setting */
|
||||||
outb(0x00,io+1); /* Ensure WRITE-ENABLE is LOW */
|
outb(0x00,io+1); /* Ensure WRITE-ENABLE is LOW */
|
||||||
tunestat=0xffff;
|
tunestat=0xffff;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the shift register
|
* Read the shift register
|
||||||
*/
|
*/
|
||||||
for(i=0;i<25;i++) {
|
for(i=0;i<25;i++) {
|
||||||
fifo=(fifo<<1)|((inb(io+1)>>7)&0x01);
|
fifo=(fifo<<1)|((inb(io+1)>>7)&0x01);
|
||||||
if(i<24) {
|
if(i<24) {
|
||||||
outb(0x01,io+1);
|
outb(0x01,io+1);
|
||||||
tunestat&=inb(io+1);
|
tunestat&=inb(io+1);
|
||||||
outb(0x00,io+1);
|
outb(0x00,io+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Restore volume/mute setting
|
* Restore volume/mute setting
|
||||||
*/
|
*/
|
||||||
outb(curvol,io+1);
|
outb(curvol,io+1);
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
|
|
||||||
return fifo;
|
return fifo;
|
||||||
@@ -136,43 +136,43 @@ static unsigned cadet_gettune(void)
|
|||||||
|
|
||||||
static unsigned cadet_getfreq(void)
|
static unsigned cadet_getfreq(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned freq=0,test,fifo=0;
|
unsigned freq=0,test,fifo=0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read current tuning
|
* Read current tuning
|
||||||
*/
|
*/
|
||||||
fifo=cadet_gettune();
|
fifo=cadet_gettune();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert to actual frequency
|
* Convert to actual frequency
|
||||||
*/
|
*/
|
||||||
if(curtuner==0) { /* FM */
|
if(curtuner==0) { /* FM */
|
||||||
test=12500;
|
test=12500;
|
||||||
for(i=0;i<14;i++) {
|
for(i=0;i<14;i++) {
|
||||||
if((fifo&0x01)!=0) {
|
if((fifo&0x01)!=0) {
|
||||||
freq+=test;
|
freq+=test;
|
||||||
}
|
}
|
||||||
test=test<<1;
|
test=test<<1;
|
||||||
fifo=fifo>>1;
|
fifo=fifo>>1;
|
||||||
}
|
}
|
||||||
freq-=10700000; /* IF frequency is 10.7 MHz */
|
freq-=10700000; /* IF frequency is 10.7 MHz */
|
||||||
freq=(freq*16)/1000000; /* Make it 1/16 MHz */
|
freq=(freq*16)/1000000; /* Make it 1/16 MHz */
|
||||||
}
|
}
|
||||||
if(curtuner==1) { /* AM */
|
if(curtuner==1) { /* AM */
|
||||||
freq=((fifo&0x7fff)-2010)*16;
|
freq=((fifo&0x7fff)-2010)*16;
|
||||||
}
|
}
|
||||||
|
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cadet_settune(unsigned fifo)
|
static void cadet_settune(unsigned fifo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned test;
|
unsigned test;
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
|
|
||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
/*
|
/*
|
||||||
* Write the shift register
|
* Write the shift register
|
||||||
@@ -183,7 +183,7 @@ static void cadet_settune(unsigned fifo)
|
|||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
outb(test,io+1); /* Initialize for write */
|
outb(test,io+1); /* Initialize for write */
|
||||||
for(i=0;i<25;i++) {
|
for(i=0;i<25;i++) {
|
||||||
test|=0x01; /* Toggle SCK High */
|
test|=0x01; /* Toggle SCK High */
|
||||||
outb(test,io+1);
|
outb(test,io+1);
|
||||||
test&=0xfe; /* Toggle SCK Low */
|
test&=0xfe; /* Toggle SCK Low */
|
||||||
outb(test,io+1);
|
outb(test,io+1);
|
||||||
@@ -196,57 +196,57 @@ static void cadet_settune(unsigned fifo)
|
|||||||
|
|
||||||
static void cadet_setfreq(unsigned freq)
|
static void cadet_setfreq(unsigned freq)
|
||||||
{
|
{
|
||||||
unsigned fifo;
|
unsigned fifo;
|
||||||
int i,j,test;
|
int i,j,test;
|
||||||
int curvol;
|
int curvol;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Formulate a fifo command
|
* Formulate a fifo command
|
||||||
*/
|
*/
|
||||||
fifo=0;
|
fifo=0;
|
||||||
if(curtuner==0) { /* FM */
|
if(curtuner==0) { /* FM */
|
||||||
test=102400;
|
test=102400;
|
||||||
freq=(freq*1000)/16; /* Make it kHz */
|
freq=(freq*1000)/16; /* Make it kHz */
|
||||||
freq+=10700; /* IF is 10700 kHz */
|
freq+=10700; /* IF is 10700 kHz */
|
||||||
for(i=0;i<14;i++) {
|
for(i=0;i<14;i++) {
|
||||||
fifo=fifo<<1;
|
fifo=fifo<<1;
|
||||||
if(freq>=test) {
|
if(freq>=test) {
|
||||||
fifo|=0x01;
|
fifo|=0x01;
|
||||||
freq-=test;
|
freq-=test;
|
||||||
}
|
}
|
||||||
test=test>>1;
|
test=test>>1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(curtuner==1) { /* AM */
|
if(curtuner==1) { /* AM */
|
||||||
fifo=(freq/16)+2010; /* Make it kHz */
|
fifo=(freq/16)+2010; /* Make it kHz */
|
||||||
fifo|=0x100000; /* Select AM Band */
|
fifo|=0x100000; /* Select AM Band */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save current volume/mute setting
|
* Save current volume/mute setting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
curvol=inb(io+1);
|
curvol=inb(io+1);
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tune the card
|
* Tune the card
|
||||||
*/
|
*/
|
||||||
for(j=3;j>-1;j--) {
|
for(j=3;j>-1;j--) {
|
||||||
cadet_settune(fifo|(j<<16));
|
cadet_settune(fifo|(j<<16));
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
outb(curvol,io+1);
|
outb(curvol,io+1);
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
|
|
||||||
msleep(100);
|
msleep(100);
|
||||||
|
|
||||||
cadet_gettune();
|
cadet_gettune();
|
||||||
if((tunestat & 0x40) == 0) { /* Tuned */
|
if((tunestat & 0x40) == 0) { /* Tuned */
|
||||||
sigstrength=sigtable[curtuner][j];
|
sigstrength=sigtable[curtuner][j];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,28 +257,28 @@ static void cadet_setfreq(unsigned freq)
|
|||||||
static int cadet_getvol(void)
|
static int cadet_getvol(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
|
|
||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
if((inb(io + 1) & 0x20) != 0)
|
if((inb(io + 1) & 0x20) != 0)
|
||||||
ret = 0xffff;
|
ret = 0xffff;
|
||||||
|
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void cadet_setvol(int vol)
|
static void cadet_setvol(int vol)
|
||||||
{
|
{
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
outb(7,io); /* Select tuner control */
|
outb(7,io); /* Select tuner control */
|
||||||
if(vol>0)
|
if(vol>0)
|
||||||
outb(0x20,io+1);
|
outb(0x20,io+1);
|
||||||
else
|
else
|
||||||
outb(0x00,io+1);
|
outb(0x00,io+1);
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cadet_handler(unsigned long data)
|
static void cadet_handler(unsigned long data)
|
||||||
{
|
{
|
||||||
@@ -288,15 +288,15 @@ static void cadet_handler(unsigned long data)
|
|||||||
|
|
||||||
if(spin_trylock(&cadet_io_lock))
|
if(spin_trylock(&cadet_io_lock))
|
||||||
{
|
{
|
||||||
outb(0x3,io); /* Select RDS Decoder Control */
|
outb(0x3,io); /* Select RDS Decoder Control */
|
||||||
if((inb(io+1)&0x20)!=0) {
|
if((inb(io+1)&0x20)!=0) {
|
||||||
printk(KERN_CRIT "cadet: RDS fifo overflow\n");
|
printk(KERN_CRIT "cadet: RDS fifo overflow\n");
|
||||||
}
|
}
|
||||||
outb(0x80,io); /* Select RDS fifo */
|
outb(0x80,io); /* Select RDS fifo */
|
||||||
while((inb(io)&0x80)!=0) {
|
while((inb(io)&0x80)!=0) {
|
||||||
rdsbuf[rdsin]=inb(io+1);
|
rdsbuf[rdsin]=inb(io+1);
|
||||||
if(rdsin==rdsout)
|
if(rdsin==rdsout)
|
||||||
printk(KERN_WARNING "cadet: RDS buffer overflow\n");
|
printk(KERN_WARNING "cadet: RDS buffer overflow\n");
|
||||||
else
|
else
|
||||||
rdsin++;
|
rdsin++;
|
||||||
}
|
}
|
||||||
@@ -307,9 +307,9 @@ static void cadet_handler(unsigned long data)
|
|||||||
* Service pending read
|
* Service pending read
|
||||||
*/
|
*/
|
||||||
if( rdsin!=rdsout)
|
if( rdsin!=rdsout)
|
||||||
wake_up_interruptible(&read_queue);
|
wake_up_interruptible(&read_queue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clean up and exit
|
* Clean up and exit
|
||||||
*/
|
*/
|
||||||
init_timer(&readtimer);
|
init_timer(&readtimer);
|
||||||
@@ -324,12 +324,12 @@ static void cadet_handler(unsigned long data)
|
|||||||
static ssize_t cadet_read(struct file *file, char __user *data,
|
static ssize_t cadet_read(struct file *file, char __user *data,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
unsigned char readbuf[RDS_BUFFER];
|
unsigned char readbuf[RDS_BUFFER];
|
||||||
|
|
||||||
if(rdsstat==0) {
|
if(rdsstat==0) {
|
||||||
spin_lock(&cadet_io_lock);
|
spin_lock(&cadet_io_lock);
|
||||||
rdsstat=1;
|
rdsstat=1;
|
||||||
outb(0x80,io); /* Select RDS fifo */
|
outb(0x80,io); /* Select RDS fifo */
|
||||||
spin_unlock(&cadet_io_lock);
|
spin_unlock(&cadet_io_lock);
|
||||||
init_timer(&readtimer);
|
init_timer(&readtimer);
|
||||||
@@ -339,15 +339,15 @@ static ssize_t cadet_read(struct file *file, char __user *data,
|
|||||||
add_timer(&readtimer);
|
add_timer(&readtimer);
|
||||||
}
|
}
|
||||||
if(rdsin==rdsout) {
|
if(rdsin==rdsout) {
|
||||||
if (file->f_flags & O_NONBLOCK)
|
if (file->f_flags & O_NONBLOCK)
|
||||||
return -EWOULDBLOCK;
|
return -EWOULDBLOCK;
|
||||||
interruptible_sleep_on(&read_queue);
|
interruptible_sleep_on(&read_queue);
|
||||||
}
|
}
|
||||||
while( i<count && rdsin!=rdsout)
|
while( i<count && rdsin!=rdsout)
|
||||||
readbuf[i++]=rdsbuf[rdsout++];
|
readbuf[i++]=rdsbuf[rdsout++];
|
||||||
|
|
||||||
if (copy_to_user(data,readbuf,i))
|
if (copy_to_user(data,readbuf,i))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,29 +375,29 @@ static int cadet_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
switch(v->tuner) {
|
switch(v->tuner) {
|
||||||
case 0:
|
case 0:
|
||||||
strcpy(v->name,"FM");
|
strcpy(v->name,"FM");
|
||||||
v->rangelow=1400; /* 87.5 MHz */
|
v->rangelow=1400; /* 87.5 MHz */
|
||||||
v->rangehigh=1728; /* 108.0 MHz */
|
v->rangehigh=1728; /* 108.0 MHz */
|
||||||
v->flags=0;
|
v->flags=0;
|
||||||
v->mode=0;
|
v->mode=0;
|
||||||
v->mode|=VIDEO_MODE_AUTO;
|
v->mode|=VIDEO_MODE_AUTO;
|
||||||
v->signal=sigstrength;
|
v->signal=sigstrength;
|
||||||
if(cadet_getstereo()==1) {
|
if(cadet_getstereo()==1) {
|
||||||
v->flags|=VIDEO_TUNER_STEREO_ON;
|
v->flags|=VIDEO_TUNER_STEREO_ON;
|
||||||
}
|
}
|
||||||
v->flags|=cadet_getrds();
|
v->flags|=cadet_getrds();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
strcpy(v->name,"AM");
|
strcpy(v->name,"AM");
|
||||||
v->rangelow=8320; /* 520 kHz */
|
v->rangelow=8320; /* 520 kHz */
|
||||||
v->rangehigh=26400; /* 1650 kHz */
|
v->rangehigh=26400; /* 1650 kHz */
|
||||||
v->flags=0;
|
v->flags=0;
|
||||||
v->flags|=VIDEO_TUNER_LOW;
|
v->flags|=VIDEO_TUNER_LOW;
|
||||||
v->mode=0;
|
v->mode=0;
|
||||||
v->mode|=VIDEO_MODE_AUTO;
|
v->mode|=VIDEO_MODE_AUTO;
|
||||||
v->signal=sigstrength;
|
v->signal=sigstrength;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -407,49 +407,49 @@ static int cadet_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
if((v->tuner<0)||(v->tuner>1)) {
|
if((v->tuner<0)||(v->tuner>1)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
curtuner=v->tuner;
|
curtuner=v->tuner;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGFREQ:
|
case VIDIOCGFREQ:
|
||||||
{
|
{
|
||||||
unsigned long *freq = arg;
|
unsigned long *freq = arg;
|
||||||
*freq = cadet_getfreq();
|
*freq = cadet_getfreq();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSFREQ:
|
case VIDIOCSFREQ:
|
||||||
{
|
{
|
||||||
unsigned long *freq = arg;
|
unsigned long *freq = arg;
|
||||||
if((curtuner==0)&&((*freq<1400)||(*freq>1728))) {
|
if((curtuner==0)&&((*freq<1400)||(*freq>1728))) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if((curtuner==1)&&((*freq<8320)||(*freq>26400))) {
|
if((curtuner==1)&&((*freq<8320)||(*freq>26400))) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
cadet_setfreq(*freq);
|
cadet_setfreq(*freq);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
v->flags=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
||||||
if(cadet_getstereo()==0) {
|
if(cadet_getstereo()==0) {
|
||||||
v->mode=VIDEO_SOUND_MONO;
|
v->mode=VIDEO_SOUND_MONO;
|
||||||
} else {
|
} else {
|
||||||
v->mode=VIDEO_SOUND_STEREO;
|
v->mode=VIDEO_SOUND_STEREO;
|
||||||
}
|
}
|
||||||
v->volume=cadet_getvol();
|
v->volume=cadet_getvol();
|
||||||
v->step=0xffff;
|
v->step=0xffff;
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
cadet_setvol(v->volume);
|
cadet_setvol(v->volume);
|
||||||
if(v->flags&VIDEO_AUDIO_MUTE)
|
if(v->flags&VIDEO_AUDIO_MUTE)
|
||||||
cadet_setvol(0);
|
cadet_setvol(0);
|
||||||
else
|
else
|
||||||
cadet_setvol(0xffff);
|
cadet_setvol(0xffff);
|
||||||
@@ -539,16 +539,16 @@ static struct pnp_driver cadet_pnp_driver = {
|
|||||||
|
|
||||||
static int cadet_probe(void)
|
static int cadet_probe(void)
|
||||||
{
|
{
|
||||||
static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
|
static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;i<8;i++) {
|
for(i=0;i<8;i++) {
|
||||||
io=iovals[i];
|
io=iovals[i];
|
||||||
if (request_region(io, 2, "cadet-probe")) {
|
if (request_region(io, 2, "cadet-probe")) {
|
||||||
cadet_setfreq(1410);
|
cadet_setfreq(1410);
|
||||||
if(cadet_getfreq()==1410) {
|
if(cadet_getfreq()==1410) {
|
||||||
release_region(io, 2);
|
release_region(io, 2);
|
||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
release_region(io, 2);
|
release_region(io, 2);
|
||||||
}
|
}
|
||||||
@@ -556,7 +556,7 @@ static int cadet_probe(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* io should only be set if the user has used something like
|
* io should only be set if the user has used something like
|
||||||
* isapnp (the userspace program) to initialize this card for us
|
* isapnp (the userspace program) to initialize this card for us
|
||||||
*/
|
*/
|
||||||
@@ -564,7 +564,7 @@ static int cadet_probe(void)
|
|||||||
static int __init cadet_init(void)
|
static int __init cadet_init(void)
|
||||||
{
|
{
|
||||||
spin_lock_init(&cadet_io_lock);
|
spin_lock_init(&cadet_io_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a probe was requested then probe ISAPnP first (safest)
|
* If a probe was requested then probe ISAPnP first (safest)
|
||||||
*/
|
*/
|
||||||
@@ -579,12 +579,12 @@ static int __init cadet_init(void)
|
|||||||
/*
|
/*
|
||||||
* Else we bail out
|
* Else we bail out
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(io < 0) {
|
if(io < 0) {
|
||||||
#ifdef MODULE
|
#ifdef MODULE
|
||||||
printk(KERN_ERR "You must set an I/O address with io=0x???\n");
|
printk(KERN_ERR "You must set an I/O address with io=0x???\n");
|
||||||
#endif
|
#endif
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (!request_region(io,2,"cadet"))
|
if (!request_region(io,2,"cadet"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
*
|
*
|
||||||
* radio-gemtek-pci.c - Gemtek PCI Radio driver
|
* radio-gemtek-pci.c - Gemtek PCI Radio driver
|
||||||
* (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru>
|
* (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru>
|
||||||
*
|
*
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
* radio device driver.
|
* radio device driver.
|
||||||
*
|
*
|
||||||
* Please, let me know if this piece of code was useful :)
|
* Please, let me know if this piece of code was useful :)
|
||||||
*
|
*
|
||||||
* TODO: multiple device support and portability were not tested
|
* TODO: multiple device support and portability were not tested
|
||||||
*
|
*
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
@@ -69,18 +69,18 @@
|
|||||||
#define TRUE (1)
|
#define TRUE (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
#define FALSE (0)
|
#define FALSE (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct gemtek_pci_card {
|
struct gemtek_pci_card {
|
||||||
struct video_device *videodev;
|
struct video_device *videodev;
|
||||||
|
|
||||||
u32 iobase;
|
u32 iobase;
|
||||||
u32 length;
|
u32 length;
|
||||||
u8 chiprev;
|
u8 chiprev;
|
||||||
u16 model;
|
u16 model;
|
||||||
|
|
||||||
u32 current_frequency;
|
u32 current_frequency;
|
||||||
u8 mute;
|
u8 mute;
|
||||||
};
|
};
|
||||||
@@ -96,7 +96,7 @@ static inline u8 gemtek_pci_out( u16 value, u32 port )
|
|||||||
return (u8)value;
|
return (u8)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _b0( v ) *((u8 *)&v)
|
#define _b0( v ) *((u8 *)&v)
|
||||||
static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep )
|
static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep )
|
||||||
{
|
{
|
||||||
register u8 byte = *last_byte;
|
register u8 byte = *last_byte;
|
||||||
@@ -104,7 +104,7 @@ static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep )
|
|||||||
if ( !value ) {
|
if ( !value ) {
|
||||||
if ( !keep )
|
if ( !keep )
|
||||||
value = (u16)port;
|
value = (u16)port;
|
||||||
byte &= 0xfd;
|
byte &= 0xfd;
|
||||||
} else
|
} else
|
||||||
byte |= 2;
|
byte |= 2;
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep )
|
|||||||
byte &= 0xfe;
|
byte &= 0xfe;
|
||||||
_b0( value ) = byte;
|
_b0( value ) = byte;
|
||||||
outw( value, port );
|
outw( value, port );
|
||||||
|
|
||||||
*last_byte = byte;
|
*last_byte = byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,13 +193,13 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
c->audios = 1;
|
c->audios = 1;
|
||||||
strcpy( c->name, "Gemtek PCI Radio" );
|
strcpy( c->name, "Gemtek PCI Radio" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *t = arg;
|
struct video_tuner *t = arg;
|
||||||
|
|
||||||
if ( t->tuner )
|
if ( t->tuner )
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
t->rangelow = GEMTEK_PCI_RANGE_LOW;
|
t->rangelow = GEMTEK_PCI_RANGE_LOW;
|
||||||
@@ -228,7 +228,7 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCSFREQ:
|
case VIDIOCSFREQ:
|
||||||
{
|
{
|
||||||
unsigned long *freq = arg;
|
unsigned long *freq = arg;
|
||||||
|
|
||||||
if ( (*freq < GEMTEK_PCI_RANGE_LOW) ||
|
if ( (*freq < GEMTEK_PCI_RANGE_LOW) ||
|
||||||
(*freq > GEMTEK_PCI_RANGE_HIGH) )
|
(*freq > GEMTEK_PCI_RANGE_HIGH) )
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -239,9 +239,9 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *a = arg;
|
struct video_audio *a = arg;
|
||||||
|
|
||||||
memset( a, 0, sizeof( *a ) );
|
memset( a, 0, sizeof( *a ) );
|
||||||
@@ -249,17 +249,17 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
a->volume = 1;
|
a->volume = 1;
|
||||||
a->step = 65535;
|
a->step = 65535;
|
||||||
strcpy( a->name, "Radio" );
|
strcpy( a->name, "Radio" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *a = arg;
|
struct video_audio *a = arg;
|
||||||
|
|
||||||
if ( a->audio )
|
if ( a->audio )
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if ( a->flags & VIDEO_AUDIO_MUTE )
|
if ( a->flags & VIDEO_AUDIO_MUTE )
|
||||||
gemtek_pci_mute( card );
|
gemtek_pci_mute( card );
|
||||||
else
|
else
|
||||||
gemtek_pci_unmute( card );
|
gemtek_pci_unmute( card );
|
||||||
@@ -323,9 +323,9 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pci_enable_device( pci_dev ) )
|
if ( pci_enable_device( pci_dev ) )
|
||||||
goto err_pci;
|
goto err_pci;
|
||||||
|
|
||||||
card->iobase = pci_resource_start( pci_dev, 0 );
|
card->iobase = pci_resource_start( pci_dev, 0 );
|
||||||
card->length = pci_resource_len( pci_dev, 0 );
|
card->length = pci_resource_len( pci_dev, 0 );
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
|
|||||||
pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model );
|
pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model );
|
||||||
|
|
||||||
pci_set_drvdata( pci_dev, card );
|
pci_set_drvdata( pci_dev, card );
|
||||||
|
|
||||||
if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) {
|
if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) {
|
||||||
printk( KERN_ERR "gemtek_pci: out of memory\n" );
|
printk( KERN_ERR "gemtek_pci: out of memory\n" );
|
||||||
goto err_video;
|
goto err_video;
|
||||||
@@ -354,7 +354,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
|
|||||||
devradio->priv = card;
|
devradio->priv = card;
|
||||||
gemtek_pci_mute( card );
|
gemtek_pci_mute( card );
|
||||||
|
|
||||||
printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
|
printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
|
||||||
card->chiprev, card->iobase, card->iobase + card->length - 1 );
|
card->chiprev, card->iobase, card->iobase + card->length - 1 );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -364,7 +364,7 @@ err_video:
|
|||||||
|
|
||||||
err_pci:
|
err_pci:
|
||||||
kfree( card );
|
kfree( card );
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev )
|
static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev )
|
||||||
@@ -375,12 +375,12 @@ static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev )
|
|||||||
kfree( card->videodev );
|
kfree( card->videodev );
|
||||||
|
|
||||||
release_region( card->iobase, card->length );
|
release_region( card->iobase, card->length );
|
||||||
|
|
||||||
if ( mx )
|
if ( mx )
|
||||||
gemtek_pci_mute( card );
|
gemtek_pci_mute( card );
|
||||||
|
|
||||||
kfree( card );
|
kfree( card );
|
||||||
|
|
||||||
pci_set_drvdata( pci_dev, NULL );
|
pci_set_drvdata( pci_dev, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* Besides the protocol changes, this is mostly a copy of:
|
* Besides the protocol changes, this is mostly a copy of:
|
||||||
*
|
*
|
||||||
* RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff
|
* RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff
|
||||||
*
|
*
|
||||||
* Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood
|
* Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood
|
||||||
* Converted to new API by Alan Cox <Alan.Cox@linux.org>
|
* Converted to new API by Alan Cox <Alan.Cox@linux.org>
|
||||||
* Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
|
* Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
#define CONFIG_RADIO_GEMTEK_PORT -1
|
#define CONFIG_RADIO_GEMTEK_PORT -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int io = CONFIG_RADIO_GEMTEK_PORT;
|
static int io = CONFIG_RADIO_GEMTEK_PORT;
|
||||||
static int radio_nr = -1;
|
static int radio_nr = -1;
|
||||||
static spinlock_t lock;
|
static spinlock_t lock;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ struct gemtek_device
|
|||||||
*/
|
*/
|
||||||
static void gemtek_mute(struct gemtek_device *dev)
|
static void gemtek_mute(struct gemtek_device *dev)
|
||||||
{
|
{
|
||||||
if(dev->muted)
|
if(dev->muted)
|
||||||
return;
|
return;
|
||||||
spin_lock(&lock);
|
spin_lock(&lock);
|
||||||
outb(0x10, io);
|
outb(0x10, io);
|
||||||
@@ -94,20 +94,20 @@ static int gemtek_setfreq(struct gemtek_device *dev, unsigned long freq)
|
|||||||
freq /= 100000;
|
freq /= 100000;
|
||||||
|
|
||||||
spin_lock(&lock);
|
spin_lock(&lock);
|
||||||
|
|
||||||
/* 2 start bits */
|
/* 2 start bits */
|
||||||
outb_p(0x03, io);
|
outb_p(0x03, io);
|
||||||
udelay(5);
|
udelay(5);
|
||||||
outb_p(0x07, io);
|
outb_p(0x07, io);
|
||||||
udelay(5);
|
udelay(5);
|
||||||
|
|
||||||
/* 28 frequency bits (lsb first) */
|
/* 28 frequency bits (lsb first) */
|
||||||
for (i = 0; i < 14; i++)
|
for (i = 0; i < 14; i++)
|
||||||
if (freq & (1 << i))
|
if (freq & (1 << i))
|
||||||
one();
|
one();
|
||||||
else
|
else
|
||||||
zero();
|
zero();
|
||||||
/* 36 unknown bits */
|
/* 36 unknown bits */
|
||||||
for (i = 0; i < 11; i++)
|
for (i = 0; i < 11; i++)
|
||||||
zero();
|
zero();
|
||||||
one();
|
one();
|
||||||
@@ -123,7 +123,7 @@ static int gemtek_setfreq(struct gemtek_device *dev, unsigned long freq)
|
|||||||
udelay(5);
|
udelay(5);
|
||||||
|
|
||||||
spin_unlock(&lock);
|
spin_unlock(&lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ static int gemtek_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
v->rangelow=87*16000;
|
v->rangelow=87*16000;
|
||||||
v->rangehigh=108*16000;
|
v->rangehigh=108*16000;
|
||||||
@@ -193,25 +193,25 @@ static int gemtek_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags|=VIDEO_AUDIO_MUTABLE;
|
v->flags|=VIDEO_AUDIO_MUTABLE;
|
||||||
v->volume=1;
|
v->volume=1;
|
||||||
v->step=65535;
|
v->step=65535;
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if(v->flags&VIDEO_AUDIO_MUTE)
|
if(v->flags&VIDEO_AUDIO_MUTE)
|
||||||
gemtek_mute(rt);
|
gemtek_mute(rt);
|
||||||
else
|
else
|
||||||
gemtek_unmute(rt);
|
gemtek_unmute(rt);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -254,14 +254,14 @@ static int __init gemtek_init(void)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!request_region(io, 4, "gemtek"))
|
if (!request_region(io, 4, "gemtek"))
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "gemtek: port 0x%x already in use\n", io);
|
printk(KERN_ERR "gemtek: port 0x%x already in use\n", io);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
gemtek_radio.priv=&gemtek_unit;
|
gemtek_radio.priv=&gemtek_unit;
|
||||||
|
|
||||||
if(video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
if(video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
||||||
{
|
{
|
||||||
release_region(io, 4);
|
release_region(io, 4);
|
||||||
@@ -274,7 +274,7 @@ static int __init gemtek_init(void)
|
|||||||
/* this is _maybe_ unnecessary */
|
/* this is _maybe_ unnecessary */
|
||||||
outb(0x01, io);
|
outb(0x01, io);
|
||||||
|
|
||||||
/* mute card - prevents noisy bootups */
|
/* mute card - prevents noisy bootups */
|
||||||
gemtek_unit.muted = 0;
|
gemtek_unit.muted = 0;
|
||||||
gemtek_mute(&gemtek_unit);
|
gemtek_mute(&gemtek_unit);
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* (c) 2000 A. Tlalka, atlka@pg.gda.pl
|
* (c) 2000 A. Tlalka, atlka@pg.gda.pl
|
||||||
* Notes on the hardware
|
* Notes on the hardware
|
||||||
*
|
*
|
||||||
* + Frequency control is done digitally
|
* + Frequency control is done digitally
|
||||||
* + No volume control - only mute/unmute - you have to use Aux line volume
|
* + No volume control - only mute/unmute - you have to use Aux line volume
|
||||||
* control on Maestro card to set the volume
|
* control on Maestro card to set the volume
|
||||||
* + Radio status (tuned/not_tuned and stereo/mono) is valid some time after
|
* + Radio status (tuned/not_tuned and stereo/mono) is valid some time after
|
||||||
@@ -103,7 +103,7 @@ static struct video_device maestro_radio = {
|
|||||||
struct radio_device {
|
struct radio_device {
|
||||||
u16 io, /* base of Maestro card radio io (GPIO_DATA)*/
|
u16 io, /* base of Maestro card radio io (GPIO_DATA)*/
|
||||||
muted, /* VIDEO_AUDIO_MUTE */
|
muted, /* VIDEO_AUDIO_MUTE */
|
||||||
stereo, /* VIDEO_TUNER_STEREO_ON */
|
stereo, /* VIDEO_TUNER_STEREO_ON */
|
||||||
tuned; /* signal strength (0 or 0xffff) */
|
tuned; /* signal strength (0 or 0xffff) */
|
||||||
struct mutex lock;
|
struct mutex lock;
|
||||||
};
|
};
|
||||||
@@ -122,14 +122,14 @@ static u32 radio_bits_get(struct radio_device *dev)
|
|||||||
for (l=24;l--;) {
|
for (l=24;l--;) {
|
||||||
outw(STR_CLK, io); /* HI state */
|
outw(STR_CLK, io); /* HI state */
|
||||||
udelay(2);
|
udelay(2);
|
||||||
if(!l)
|
if(!l)
|
||||||
dev->tuned = inw(io) & STR_MOST ? 0 : 0xffff;
|
dev->tuned = inw(io) & STR_MOST ? 0 : 0xffff;
|
||||||
outw(0, io); /* LO state */
|
outw(0, io); /* LO state */
|
||||||
udelay(2);
|
udelay(2);
|
||||||
data <<= 1; /* shift data */
|
data <<= 1; /* shift data */
|
||||||
rdata = inw(io);
|
rdata = inw(io);
|
||||||
if(!l)
|
if(!l)
|
||||||
dev->stereo = rdata & STR_MOST ?
|
dev->stereo = rdata & STR_MOST ?
|
||||||
0 : VIDEO_TUNER_STEREO_ON;
|
0 : VIDEO_TUNER_STEREO_ON;
|
||||||
else
|
else
|
||||||
if(rdata & STR_DATA)
|
if(rdata & STR_DATA)
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Guillemot Maxi Radio FM 2000 PCI radio card driver for Linux
|
* Guillemot Maxi Radio FM 2000 PCI radio card driver for Linux
|
||||||
* (C) 2001 Dimitromanolakis Apostolos <apdim@grecian.net>
|
* (C) 2001 Dimitromanolakis Apostolos <apdim@grecian.net>
|
||||||
*
|
*
|
||||||
* Based in the radio Maestro PCI driver. Actually it uses the same chip
|
* Based in the radio Maestro PCI driver. Actually it uses the same chip
|
||||||
* for radio but different pci controller.
|
* for radio but different pci controller.
|
||||||
*
|
*
|
||||||
* I didn't have any specs I reversed engineered the protocol from
|
* I didn't have any specs I reversed engineered the protocol from
|
||||||
* the windows driver (radio.dll).
|
* the windows driver (radio.dll).
|
||||||
*
|
*
|
||||||
* The card uses the TEA5757 chip that includes a search function but it
|
* The card uses the TEA5757 chip that includes a search function but it
|
||||||
* is useless as I haven't found any way to read back the frequency. If
|
* is useless as I haven't found any way to read back the frequency. If
|
||||||
* anybody does please mail me.
|
* anybody does please mail me.
|
||||||
*
|
*
|
||||||
* For the pdf file see:
|
* For the pdf file see:
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
* - tiding up
|
* - tiding up
|
||||||
* - removed support for multiple devices as it didn't work anyway
|
* - removed support for multiple devices as it didn't work anyway
|
||||||
*
|
*
|
||||||
* BUGS:
|
* BUGS:
|
||||||
* - card unmutes if you change frequency
|
* - card unmutes if you change frequency
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -80,7 +80,7 @@ static struct file_operations maxiradio_fops = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = video_exclusive_open,
|
.open = video_exclusive_open,
|
||||||
.release = video_exclusive_release,
|
.release = video_exclusive_release,
|
||||||
.ioctl = radio_ioctl,
|
.ioctl = radio_ioctl,
|
||||||
.compat_ioctl = v4l_compat_ioctl32,
|
.compat_ioctl = v4l_compat_ioctl32,
|
||||||
.llseek = no_llseek,
|
.llseek = no_llseek,
|
||||||
};
|
};
|
||||||
@@ -97,11 +97,11 @@ static struct radio_device
|
|||||||
{
|
{
|
||||||
__u16 io, /* base of radio io */
|
__u16 io, /* base of radio io */
|
||||||
muted, /* VIDEO_AUDIO_MUTE */
|
muted, /* VIDEO_AUDIO_MUTE */
|
||||||
stereo, /* VIDEO_TUNER_STEREO_ON */
|
stereo, /* VIDEO_TUNER_STEREO_ON */
|
||||||
tuned; /* signal strength (0 or 0xffff) */
|
tuned; /* signal strength (0 or 0xffff) */
|
||||||
|
|
||||||
unsigned long freq;
|
unsigned long freq;
|
||||||
|
|
||||||
struct mutex lock;
|
struct mutex lock;
|
||||||
} radio_unit = {0, 0, 0, 0, };
|
} radio_unit = {0, 0, 0, 0, };
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ static void outbit(unsigned long bit, __u16 io)
|
|||||||
outb( power|wren|data|clk ,io); udelay(4);
|
outb( power|wren|data|clk ,io); udelay(4);
|
||||||
outb( power|wren|data ,io); udelay(4);
|
outb( power|wren|data ,io); udelay(4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
outb( power|wren ,io); udelay(4);
|
outb( power|wren ,io); udelay(4);
|
||||||
outb( power|wren|clk ,io); udelay(4);
|
outb( power|wren|clk ,io); udelay(4);
|
||||||
@@ -132,12 +132,12 @@ static void set_freq(__u16 io, __u32 data)
|
|||||||
{
|
{
|
||||||
unsigned long int si;
|
unsigned long int si;
|
||||||
int bl;
|
int bl;
|
||||||
|
|
||||||
/* TEA5757 shift register bits (see pdf) */
|
/* TEA5757 shift register bits (see pdf) */
|
||||||
|
|
||||||
outbit(0,io); // 24 search
|
outbit(0,io); // 24 search
|
||||||
outbit(1,io); // 23 search up/down
|
outbit(1,io); // 23 search up/down
|
||||||
|
|
||||||
outbit(0,io); // 22 stereo/mono
|
outbit(0,io); // 22 stereo/mono
|
||||||
|
|
||||||
outbit(0,io); // 21 band
|
outbit(0,io); // 21 band
|
||||||
@@ -145,24 +145,24 @@ static void set_freq(__u16 io, __u32 data)
|
|||||||
|
|
||||||
outbit(0,io); // 19 port ?
|
outbit(0,io); // 19 port ?
|
||||||
outbit(0,io); // 18 port ?
|
outbit(0,io); // 18 port ?
|
||||||
|
|
||||||
outbit(0,io); // 17 search level
|
outbit(0,io); // 17 search level
|
||||||
outbit(0,io); // 16 search level
|
outbit(0,io); // 16 search level
|
||||||
|
|
||||||
si = 0x8000;
|
si = 0x8000;
|
||||||
for(bl = 1; bl <= 16 ; bl++) { outbit(data & si,io); si >>=1; }
|
for(bl = 1; bl <= 16 ; bl++) { outbit(data & si,io); si >>=1; }
|
||||||
|
|
||||||
outb(power,io);
|
outb(power,io);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_stereo(__u16 io)
|
static int get_stereo(__u16 io)
|
||||||
{
|
{
|
||||||
outb(power,io); udelay(4);
|
outb(power,io); udelay(4);
|
||||||
return !(inb(io) & mo_st);
|
return !(inb(io) & mo_st);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_tune(__u16 io)
|
static int get_tune(__u16 io)
|
||||||
{
|
{
|
||||||
outb(power+clk,io); udelay(4);
|
outb(power+clk,io); udelay(4);
|
||||||
return !(inb(io) & mo_st);
|
return !(inb(io) & mo_st);
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ static inline int radio_function(struct inode *inode, struct file *file,
|
|||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
case VIDIOCGCAP: {
|
case VIDIOCGCAP: {
|
||||||
struct video_capability *v = arg;
|
struct video_capability *v = arg;
|
||||||
|
|
||||||
memset(v,0,sizeof(*v));
|
memset(v,0,sizeof(*v));
|
||||||
strcpy(v->name, "Maxi Radio FM2000 radio");
|
strcpy(v->name, "Maxi Radio FM2000 radio");
|
||||||
v->type=VID_TYPE_TUNER;
|
v->type=VID_TYPE_TUNER;
|
||||||
@@ -186,22 +186,22 @@ static inline int radio_function(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
case VIDIOCGTUNER: {
|
case VIDIOCGTUNER: {
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
|
|
||||||
if(v->tuner)
|
if(v->tuner)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
card->stereo = 0xffff * get_stereo(card->io);
|
card->stereo = 0xffff * get_stereo(card->io);
|
||||||
card->tuned = 0xffff * get_tune(card->io);
|
card->tuned = 0xffff * get_tune(card->io);
|
||||||
|
|
||||||
v->flags = VIDEO_TUNER_LOW | card->stereo;
|
v->flags = VIDEO_TUNER_LOW | card->stereo;
|
||||||
v->signal = card->tuned;
|
v->signal = card->tuned;
|
||||||
|
|
||||||
strcpy(v->name, "FM");
|
strcpy(v->name, "FM");
|
||||||
|
|
||||||
v->rangelow = FREQ_LO;
|
v->rangelow = FREQ_LO;
|
||||||
v->rangehigh = FREQ_HI;
|
v->rangehigh = FREQ_HI;
|
||||||
v->mode = VIDEO_MODE_AUTO;
|
v->mode = VIDEO_MODE_AUTO;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSTUNER: {
|
case VIDIOCSTUNER: {
|
||||||
@@ -212,13 +212,13 @@ static inline int radio_function(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
case VIDIOCGFREQ: {
|
case VIDIOCGFREQ: {
|
||||||
unsigned long *freq = arg;
|
unsigned long *freq = arg;
|
||||||
|
|
||||||
*freq = card->freq;
|
*freq = card->freq;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSFREQ: {
|
case VIDIOCSFREQ: {
|
||||||
unsigned long *freq = arg;
|
unsigned long *freq = arg;
|
||||||
|
|
||||||
if (*freq < FREQ_LO || *freq > FREQ_HI)
|
if (*freq < FREQ_LO || *freq > FREQ_HI)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
card->freq = *freq;
|
card->freq = *freq;
|
||||||
@@ -226,18 +226,18 @@ static inline int radio_function(struct inode *inode, struct file *file,
|
|||||||
msleep(125);
|
msleep(125);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO: {
|
case VIDIOCGAUDIO: {
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0,sizeof(*v));
|
memset(v,0,sizeof(*v));
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
v->flags=VIDEO_AUDIO_MUTABLE | card->muted;
|
v->flags=VIDEO_AUDIO_MUTABLE | card->muted;
|
||||||
v->mode=VIDEO_SOUND_STEREO;
|
v->mode=VIDEO_SOUND_STEREO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIDIOCSAUDIO: {
|
case VIDIOCSAUDIO: {
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
|
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
card->muted = v->flags & VIDEO_AUDIO_MUTE;
|
card->muted = v->flags & VIDEO_AUDIO_MUTE;
|
||||||
@@ -249,13 +249,13 @@ static inline int radio_function(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
case VIDIOCGUNIT: {
|
case VIDIOCGUNIT: {
|
||||||
struct video_unit *v = arg;
|
struct video_unit *v = arg;
|
||||||
|
|
||||||
v->video=VIDEO_NO_UNIT;
|
v->video=VIDEO_NO_UNIT;
|
||||||
v->vbi=VIDEO_NO_UNIT;
|
v->vbi=VIDEO_NO_UNIT;
|
||||||
v->radio=dev->minor;
|
v->radio=dev->minor;
|
||||||
v->audio=0;
|
v->audio=0;
|
||||||
v->teletext=VIDEO_NO_UNIT;
|
v->teletext=VIDEO_NO_UNIT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
default: return -ENOIOCTLCMD;
|
default: return -ENOIOCTLCMD;
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,7 @@ static int radio_ioctl(struct inode *inode, struct file *file,
|
|||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct radio_device *card=dev->priv;
|
struct radio_device *card=dev->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&card->lock);
|
mutex_lock(&card->lock);
|
||||||
ret = video_usercopy(inode, file, cmd, arg, radio_function);
|
ret = video_usercopy(inode, file, cmd, arg, radio_function);
|
||||||
mutex_unlock(&card->lock);
|
mutex_unlock(&card->lock);
|
||||||
@@ -282,21 +282,21 @@ MODULE_LICENSE("GPL");
|
|||||||
static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
{
|
{
|
||||||
if(!request_region(pci_resource_start(pdev, 0),
|
if(!request_region(pci_resource_start(pdev, 0),
|
||||||
pci_resource_len(pdev, 0), "Maxi Radio FM 2000")) {
|
pci_resource_len(pdev, 0), "Maxi Radio FM 2000")) {
|
||||||
printk(KERN_ERR "radio-maxiradio: can't reserve I/O ports\n");
|
printk(KERN_ERR "radio-maxiradio: can't reserve I/O ports\n");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pci_enable_device(pdev))
|
if (pci_enable_device(pdev))
|
||||||
goto err_out_free_region;
|
goto err_out_free_region;
|
||||||
|
|
||||||
radio_unit.io = pci_resource_start(pdev, 0);
|
radio_unit.io = pci_resource_start(pdev, 0);
|
||||||
mutex_init(&radio_unit.lock);
|
mutex_init(&radio_unit.lock);
|
||||||
maxiradio_radio.priv = &radio_unit;
|
maxiradio_radio.priv = &radio_unit;
|
||||||
|
|
||||||
if(video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) {
|
if(video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) {
|
||||||
printk("radio-maxiradio: can't register device!");
|
printk("radio-maxiradio: can't register device!");
|
||||||
goto err_out_free_region;
|
goto err_out_free_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "radio-maxiradio: version "
|
printk(KERN_INFO "radio-maxiradio: version "
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff
|
/* RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff
|
||||||
*
|
*
|
||||||
* Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood
|
* Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood
|
||||||
* Converted to new API by Alan Cox <Alan.Cox@linux.org>
|
* Converted to new API by Alan Cox <Alan.Cox@linux.org>
|
||||||
* Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
|
* Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
#define CONFIG_RADIO_RTRACK2_PORT -1
|
#define CONFIG_RADIO_RTRACK2_PORT -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int io = CONFIG_RADIO_RTRACK2_PORT;
|
static int io = CONFIG_RADIO_RTRACK2_PORT;
|
||||||
static int radio_nr = -1;
|
static int radio_nr = -1;
|
||||||
static spinlock_t lock;
|
static spinlock_t lock;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ struct rt_device
|
|||||||
|
|
||||||
static void rt_mute(struct rt_device *dev)
|
static void rt_mute(struct rt_device *dev)
|
||||||
{
|
{
|
||||||
if(dev->muted)
|
if(dev->muted)
|
||||||
return;
|
return;
|
||||||
spin_lock(&lock);
|
spin_lock(&lock);
|
||||||
outb(1, io);
|
outb(1, io);
|
||||||
@@ -58,14 +58,14 @@ static void rt_unmute(struct rt_device *dev)
|
|||||||
|
|
||||||
static void zero(void)
|
static void zero(void)
|
||||||
{
|
{
|
||||||
outb_p(1, io);
|
outb_p(1, io);
|
||||||
outb_p(3, io);
|
outb_p(3, io);
|
||||||
outb_p(1, io);
|
outb_p(1, io);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void one(void)
|
static void one(void)
|
||||||
{
|
{
|
||||||
outb_p(5, io);
|
outb_p(5, io);
|
||||||
outb_p(7, io);
|
outb_p(7, io);
|
||||||
outb_p(5, io);
|
outb_p(5, io);
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
freq = freq / 200 + 856;
|
freq = freq / 200 + 856;
|
||||||
|
|
||||||
spin_lock(&lock);
|
spin_lock(&lock);
|
||||||
|
|
||||||
outb_p(0xc8, io);
|
outb_p(0xc8, io);
|
||||||
@@ -94,7 +94,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq)
|
|||||||
outb_p(0xc8, io);
|
outb_p(0xc8, io);
|
||||||
if (!dev->muted)
|
if (!dev->muted)
|
||||||
outb_p(0, io);
|
outb_p(0, io);
|
||||||
|
|
||||||
spin_unlock(&lock);
|
spin_unlock(&lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
v->rangelow=88*16000;
|
v->rangelow=88*16000;
|
||||||
v->rangehigh=108*16000;
|
v->rangehigh=108*16000;
|
||||||
@@ -159,25 +159,25 @@ static int rt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags|=VIDEO_AUDIO_MUTABLE;
|
v->flags|=VIDEO_AUDIO_MUTABLE;
|
||||||
v->volume=1;
|
v->volume=1;
|
||||||
v->step=65535;
|
v->step=65535;
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if(v->flags&VIDEO_AUDIO_MUTE)
|
if(v->flags&VIDEO_AUDIO_MUTE)
|
||||||
rt_mute(rt);
|
rt_mute(rt);
|
||||||
else
|
else
|
||||||
rt_unmute(rt);
|
rt_unmute(rt);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ static int __init rtrack2_init(void)
|
|||||||
printk(KERN_ERR "You must set an I/O address with io=0x20c or io=0x30c\n");
|
printk(KERN_ERR "You must set an I/O address with io=0x20c or io=0x30c\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (!request_region(io, 4, "rtrack2"))
|
if (!request_region(io, 4, "rtrack2"))
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "rtrack2: port 0x%x already in use\n", io);
|
printk(KERN_ERR "rtrack2: port 0x%x already in use\n", io);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
@@ -227,16 +227,16 @@ static int __init rtrack2_init(void)
|
|||||||
|
|
||||||
rtrack2_radio.priv=&rtrack2_unit;
|
rtrack2_radio.priv=&rtrack2_unit;
|
||||||
|
|
||||||
spin_lock_init(&lock);
|
spin_lock_init(&lock);
|
||||||
if(video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
if(video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
||||||
{
|
{
|
||||||
release_region(io, 4);
|
release_region(io, 4);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "AIMSlab Radiotrack II card driver.\n");
|
printk(KERN_INFO "AIMSlab Radiotrack II card driver.\n");
|
||||||
|
|
||||||
/* mute card - prevents noisy bootups */
|
/* mute card - prevents noisy bootups */
|
||||||
outb(1, io);
|
outb(1, io);
|
||||||
rtrack2_unit.muted = 1;
|
rtrack2_unit.muted = 1;
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
* Frequency control is done digitally -- ie out(port,encodefreq(95.8));
|
* Frequency control is done digitally -- ie out(port,encodefreq(95.8));
|
||||||
* No volume control - only mute/unmute - you have to use line volume
|
* No volume control - only mute/unmute - you have to use line volume
|
||||||
* control on SB-part of SF16FMI
|
* control on SB-part of SF16FMI
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h> /* __setup */
|
#include <linux/kernel.h> /* __setup */
|
||||||
@@ -29,19 +29,19 @@
|
|||||||
struct fmi_device
|
struct fmi_device
|
||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
int curvol; /* 1 or 0 */
|
int curvol; /* 1 or 0 */
|
||||||
unsigned long curfreq; /* freq in kHz */
|
unsigned long curfreq; /* freq in kHz */
|
||||||
__u32 flags;
|
__u32 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int io = -1;
|
static int io = -1;
|
||||||
static int radio_nr = -1;
|
static int radio_nr = -1;
|
||||||
static struct pnp_dev *dev = NULL;
|
static struct pnp_dev *dev = NULL;
|
||||||
static struct mutex lock;
|
static struct mutex lock;
|
||||||
|
|
||||||
/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */
|
/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */
|
||||||
/* It is only useful to give freq in intervall of 800 (=0.05Mhz),
|
/* It is only useful to give freq in intervall of 800 (=0.05Mhz),
|
||||||
* other bits will be truncated, e.g 92.7400016 -> 92.7, but
|
* other bits will be truncated, e.g 92.7400016 -> 92.7, but
|
||||||
* 92.7400017 -> 92.75
|
* 92.7400017 -> 92.75
|
||||||
*/
|
*/
|
||||||
#define RSF16_ENCODE(x) ((x)/800+214)
|
#define RSF16_ENCODE(x) ((x)/800+214)
|
||||||
@@ -51,7 +51,7 @@ static struct mutex lock;
|
|||||||
static void outbits(int bits, unsigned int data, int port)
|
static void outbits(int bits, unsigned int data, int port)
|
||||||
{
|
{
|
||||||
while(bits--) {
|
while(bits--) {
|
||||||
if(data & 1) {
|
if(data & 1) {
|
||||||
outb(5, port);
|
outb(5, port);
|
||||||
udelay(6);
|
udelay(6);
|
||||||
outb(7, port);
|
outb(7, port);
|
||||||
@@ -101,7 +101,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
|
|||||||
int res;
|
int res;
|
||||||
int myport = dev->port;
|
int myport = dev->port;
|
||||||
|
|
||||||
|
|
||||||
mutex_lock(&lock);
|
mutex_lock(&lock);
|
||||||
val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */
|
val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */
|
||||||
outb(val, myport);
|
outb(val, myport);
|
||||||
@@ -109,7 +109,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev)
|
|||||||
msleep(143); /* was schedule_timeout(HZ/7) */
|
msleep(143); /* was schedule_timeout(HZ/7) */
|
||||||
res = (int)inb(myport+1);
|
res = (int)inb(myport+1);
|
||||||
outb(val, myport);
|
outb(val, myport);
|
||||||
|
|
||||||
mutex_unlock(&lock);
|
mutex_unlock(&lock);
|
||||||
return (res & 2) ? 0 : 0xFFFF;
|
return (res & 2) ? 0 : 0xFFFF;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ static int fmi_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct fmi_device *fmi=dev->priv;
|
struct fmi_device *fmi=dev->priv;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@@ -174,18 +174,18 @@ static int fmi_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
/*rounding in steps of 800 to match th freq
|
/*rounding in steps of 800 to match th freq
|
||||||
that will be used */
|
that will be used */
|
||||||
fmi->curfreq = (*freq/800)*800;
|
fmi->curfreq = (*freq/800)*800;
|
||||||
fmi_setfreq(fmi);
|
fmi_setfreq(fmi);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0,sizeof(*v));
|
memset(v,0,sizeof(*v));
|
||||||
v->flags=( (!fmi->curvol)*VIDEO_AUDIO_MUTE | VIDEO_AUDIO_MUTABLE);
|
v->flags=( (!fmi->curvol)*VIDEO_AUDIO_MUTE | VIDEO_AUDIO_MUTABLE);
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
v->mode=VIDEO_SOUND_STEREO;
|
v->mode=VIDEO_SOUND_STEREO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
@@ -193,19 +193,19 @@ static int fmi_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
fmi->curvol= v->flags&VIDEO_AUDIO_MUTE ? 0 : 1;
|
fmi->curvol= v->flags&VIDEO_AUDIO_MUTE ? 0 : 1;
|
||||||
fmi->curvol ?
|
fmi->curvol ?
|
||||||
fmi_unmute(fmi->port) : fmi_mute(fmi->port);
|
fmi_unmute(fmi->port) : fmi_mute(fmi->port);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGUNIT:
|
case VIDIOCGUNIT:
|
||||||
{
|
{
|
||||||
struct video_unit *v = arg;
|
struct video_unit *v = arg;
|
||||||
v->video=VIDEO_NO_UNIT;
|
v->video=VIDEO_NO_UNIT;
|
||||||
v->vbi=VIDEO_NO_UNIT;
|
v->vbi=VIDEO_NO_UNIT;
|
||||||
v->radio=dev->minor;
|
v->radio=dev->minor;
|
||||||
v->audio=0; /* How do we find out this??? */
|
v->audio=0; /* How do we find out this??? */
|
||||||
v->teletext=VIDEO_NO_UNIT;
|
v->teletext=VIDEO_NO_UNIT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOIOCTLCMD;
|
||||||
@@ -295,14 +295,14 @@ static int __init fmi_init(void)
|
|||||||
fmi_unit.curfreq = 0;
|
fmi_unit.curfreq = 0;
|
||||||
fmi_unit.flags = VIDEO_TUNER_LOW;
|
fmi_unit.flags = VIDEO_TUNER_LOW;
|
||||||
fmi_radio.priv = &fmi_unit;
|
fmi_radio.priv = &fmi_unit;
|
||||||
|
|
||||||
mutex_init(&lock);
|
mutex_init(&lock);
|
||||||
|
|
||||||
if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) {
|
if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) {
|
||||||
release_region(io, 2);
|
release_region(io, 2);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "SF16FMx radio card driver at 0x%x\n", io);
|
printk(KERN_INFO "SF16FMx radio card driver at 0x%x\n", io);
|
||||||
/* mute card - prevents noisy bootups */
|
/* mute card - prevents noisy bootups */
|
||||||
fmi_mute(io);
|
fmi_mute(io);
|
||||||
|
@@ -202,7 +202,7 @@ static int fmr2_setvolume(struct fmr2_device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int fmr2_do_ioctl(struct inode *inode, struct file *file,
|
static int fmr2_do_ioctl(struct inode *inode, struct file *file,
|
||||||
unsigned int cmd, void *arg)
|
unsigned int cmd, void *arg)
|
||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct fmr2_device *fmr2 = dev->priv;
|
struct fmr2_device *fmr2 = dev->priv;
|
||||||
@@ -344,7 +344,7 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int fmr2_ioctl(struct inode *inode, struct file *file,
|
static int fmr2_ioctl(struct inode *inode, struct file *file,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
return video_usercopy(inode, file, cmd, arg, fmr2_do_ioctl);
|
return video_usercopy(inode, file, cmd, arg, fmr2_do_ioctl);
|
||||||
}
|
}
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
* (c) 1999 R. Offermanns (rolf@offermanns.de)
|
* (c) 1999 R. Offermanns (rolf@offermanns.de)
|
||||||
* based on the aimslab radio driver from M. Kirkwood
|
* based on the aimslab radio driver from M. Kirkwood
|
||||||
* many thanks to Michael Becker and Friedhelm Birth (from TerraTec)
|
* many thanks to Michael Becker and Friedhelm Birth (from TerraTec)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* History:
|
* History:
|
||||||
* 1999-05-21 First preview release
|
* 1999-05-21 First preview release
|
||||||
*
|
*
|
||||||
* Notes on the hardware:
|
* Notes on the hardware:
|
||||||
* There are two "main" chips on the card:
|
* There are two "main" chips on the card:
|
||||||
* - Philips OM5610 (http://www-us.semiconductors.philips.com/acrobat/datasheets/OM5610_2.pdf)
|
* - Philips OM5610 (http://www-us.semiconductors.philips.com/acrobat/datasheets/OM5610_2.pdf)
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
* (as soon i have understand how to get started :)
|
* (as soon i have understand how to get started :)
|
||||||
* If you can help me out with that, please contact me!!
|
* If you can help me out with that, please contact me!!
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h> /* Modules */
|
#include <linux/module.h> /* Modules */
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#define WRT_EN 0x10
|
#define WRT_EN 0x10
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
static int io = CONFIG_RADIO_TERRATEC_PORT;
|
static int io = CONFIG_RADIO_TERRATEC_PORT;
|
||||||
static int radio_nr = -1;
|
static int radio_nr = -1;
|
||||||
static spinlock_t lock;
|
static spinlock_t lock;
|
||||||
|
|
||||||
@@ -88,15 +88,15 @@ static void tt_mute(struct tt_device *dev)
|
|||||||
|
|
||||||
static int tt_setvol(struct tt_device *dev, int vol)
|
static int tt_setvol(struct tt_device *dev, int vol)
|
||||||
{
|
{
|
||||||
|
|
||||||
// printk(KERN_ERR "setvol called, vol = %d\n", vol);
|
// printk(KERN_ERR "setvol called, vol = %d\n", vol);
|
||||||
|
|
||||||
if(vol == dev->curvol) { /* requested volume = current */
|
if(vol == dev->curvol) { /* requested volume = current */
|
||||||
if (dev->muted) { /* user is unmuting the card */
|
if (dev->muted) { /* user is unmuting the card */
|
||||||
dev->muted = 0;
|
dev->muted = 0;
|
||||||
cardWriteVol(vol); /* enable card */
|
cardWriteVol(vol); /* enable card */
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,9 +107,9 @@ static int tt_setvol(struct tt_device *dev, int vol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dev->muted = 0;
|
dev->muted = 0;
|
||||||
|
|
||||||
cardWriteVol(vol);
|
cardWriteVol(vol);
|
||||||
|
|
||||||
dev->curvol = vol;
|
dev->curvol = vol;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -121,13 +121,13 @@ static int tt_setvol(struct tt_device *dev, int vol)
|
|||||||
/* many more or less strange things are going on here, but hey, it works :) */
|
/* many more or less strange things are going on here, but hey, it works :) */
|
||||||
|
|
||||||
static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
|
static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
|
||||||
{
|
{
|
||||||
int freq;
|
int freq;
|
||||||
int i;
|
int i;
|
||||||
int p;
|
int p;
|
||||||
int temp;
|
int temp;
|
||||||
long rest;
|
long rest;
|
||||||
|
|
||||||
unsigned char buffer[25]; /* we have to bit shift 25 registers */
|
unsigned char buffer[25]; /* we have to bit shift 25 registers */
|
||||||
freq = freq1/160; /* convert the freq. to a nice to handle value */
|
freq = freq1/160; /* convert the freq. to a nice to handle value */
|
||||||
for(i=24;i>-1;i--)
|
for(i=24;i>-1;i--)
|
||||||
@@ -142,9 +142,9 @@ static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
|
|||||||
{
|
{
|
||||||
if (rest%temp == rest)
|
if (rest%temp == rest)
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[i] = 1;
|
buffer[i] = 1;
|
||||||
rest = rest-temp;
|
rest = rest-temp;
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
@@ -153,10 +153,10 @@ static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock(&lock);
|
spin_lock(&lock);
|
||||||
|
|
||||||
for (i=24;i>-1;i--) /* bit shift the values to the radiocard */
|
for (i=24;i>-1;i--) /* bit shift the values to the radiocard */
|
||||||
{
|
{
|
||||||
if (buffer[i]==1)
|
if (buffer[i]==1)
|
||||||
{
|
{
|
||||||
outb(WRT_EN|DATA, BASEPORT);
|
outb(WRT_EN|DATA, BASEPORT);
|
||||||
outb(WRT_EN|DATA|CLK_ON , BASEPORT);
|
outb(WRT_EN|DATA|CLK_ON , BASEPORT);
|
||||||
@@ -168,11 +168,11 @@ static int tt_setfreq(struct tt_device *dev, unsigned long freq1)
|
|||||||
outb(WRT_EN|0x00|CLK_ON , BASEPORT);
|
outb(WRT_EN|0x00|CLK_ON , BASEPORT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outb(0x00, BASEPORT);
|
outb(0x00, BASEPORT);
|
||||||
|
|
||||||
spin_unlock(&lock);
|
spin_unlock(&lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tt_getsigstr(struct tt_device *dev) /* TODO */
|
static int tt_getsigstr(struct tt_device *dev) /* TODO */
|
||||||
@@ -190,7 +190,7 @@ static int tt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_device *dev = video_devdata(file);
|
struct video_device *dev = video_devdata(file);
|
||||||
struct tt_device *tt=dev->priv;
|
struct tt_device *tt=dev->priv;
|
||||||
|
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case VIDIOCGCAP:
|
case VIDIOCGCAP:
|
||||||
@@ -206,7 +206,7 @@ static int tt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
v->rangelow=(87*16000);
|
v->rangelow=(87*16000);
|
||||||
v->rangehigh=(108*16000);
|
v->rangehigh=(108*16000);
|
||||||
@@ -238,21 +238,21 @@ static int tt_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME;
|
||||||
v->volume=tt->curvol * 6554;
|
v->volume=tt->curvol * 6554;
|
||||||
v->step=6554;
|
v->step=6554;
|
||||||
strcpy(v->name, "Radio");
|
strcpy(v->name, "Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if(v->flags&VIDEO_AUDIO_MUTE)
|
if(v->flags&VIDEO_AUDIO_MUTE)
|
||||||
tt_mute(tt);
|
tt_mute(tt);
|
||||||
else
|
else
|
||||||
tt_setvol(tt,v->volume/6554);
|
tt_setvol(tt,v->volume/6554);
|
||||||
@@ -296,25 +296,25 @@ static int __init terratec_init(void)
|
|||||||
printk(KERN_ERR "You must set an I/O address with io=0x???\n");
|
printk(KERN_ERR "You must set an I/O address with io=0x???\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (!request_region(io, 2, "terratec"))
|
if (!request_region(io, 2, "terratec"))
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "TerraTec: port 0x%x already in use\n", io);
|
printk(KERN_ERR "TerraTec: port 0x%x already in use\n", io);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
terratec_radio.priv=&terratec_unit;
|
terratec_radio.priv=&terratec_unit;
|
||||||
|
|
||||||
spin_lock_init(&lock);
|
spin_lock_init(&lock);
|
||||||
|
|
||||||
if(video_register_device(&terratec_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
if(video_register_device(&terratec_radio, VFL_TYPE_RADIO, radio_nr)==-1)
|
||||||
{
|
{
|
||||||
release_region(io,2);
|
release_region(io,2);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver.\n");
|
printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver.\n");
|
||||||
|
|
||||||
/* mute card - prevents noisy bootups */
|
/* mute card - prevents noisy bootups */
|
||||||
|
|
||||||
/* this ensures that the volume is all the way down */
|
/* this ensures that the volume is all the way down */
|
||||||
cardWriteVol(0);
|
cardWriteVol(0);
|
||||||
@@ -334,7 +334,7 @@ static void __exit terratec_cleanup_module(void)
|
|||||||
{
|
{
|
||||||
video_unregister_device(&terratec_radio);
|
video_unregister_device(&terratec_radio);
|
||||||
release_region(io,2);
|
release_region(io,2);
|
||||||
printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver unloaded.\n");
|
printk(KERN_INFO "TERRATEC ActivRadio Standalone card driver unloaded.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(terratec_init);
|
module_init(terratec_init);
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/* radio-trust.c - Trust FM Radio card driver for Linux 2.2
|
/* radio-trust.c - Trust FM Radio card driver for Linux 2.2
|
||||||
* by Eric Lammerts <eric@scintilla.utwente.nl>
|
* by Eric Lammerts <eric@scintilla.utwente.nl>
|
||||||
*
|
*
|
||||||
* Based on radio-aztech.c. Original notes:
|
* Based on radio-aztech.c. Original notes:
|
||||||
*
|
*
|
||||||
* Adapted to support the Video for Linux API by
|
* Adapted to support the Video for Linux API by
|
||||||
* Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
|
* Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
|
||||||
*
|
*
|
||||||
* Quay Ly
|
* Quay Ly
|
||||||
* Donald Song
|
* Donald Song
|
||||||
* Jason Lewis (jlewis@twilight.vtc.vsc.edu)
|
* Jason Lewis (jlewis@twilight.vtc.vsc.edu)
|
||||||
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
|
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
|
||||||
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
|
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
|
||||||
*
|
*
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
#define CONFIG_RADIO_TRUST_PORT -1
|
#define CONFIG_RADIO_TRUST_PORT -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int io = CONFIG_RADIO_TRUST_PORT;
|
static int io = CONFIG_RADIO_TRUST_PORT;
|
||||||
static int radio_nr = -1;
|
static int radio_nr = -1;
|
||||||
static int ioval = 0xf;
|
static int ioval = 0xf;
|
||||||
static __u16 curvol;
|
static __u16 curvol;
|
||||||
@@ -135,7 +135,7 @@ static void tr_setmute(int mute)
|
|||||||
static int tr_getsigstr(void)
|
static int tr_getsigstr(void)
|
||||||
{
|
{
|
||||||
int i, v;
|
int i, v;
|
||||||
|
|
||||||
for(i = 0, v = 0; i < 100; i++) v |= inb(io);
|
for(i = 0, v = 0; i < 100; i++) v |= inb(io);
|
||||||
return (v & 1)? 0 : 0xffff;
|
return (v & 1)? 0 : 0xffff;
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ static int tr_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
|
|
||||||
if(v->tuner) /* Only 1 tuner */
|
if(v->tuner) /* Only 1 tuner */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
v->rangelow = 87500 * 16;
|
v->rangelow = 87500 * 16;
|
||||||
@@ -211,28 +211,28 @@ static int tr_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCGAUDIO:
|
case VIDIOCGAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
|
|
||||||
memset(v,0, sizeof(*v));
|
memset(v,0, sizeof(*v));
|
||||||
v->flags = VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME |
|
v->flags = VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME |
|
||||||
VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE;
|
VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE;
|
||||||
v->mode = curstereo? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
|
v->mode = curstereo? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
|
||||||
v->volume = curvol * 2048;
|
v->volume = curvol * 2048;
|
||||||
v->step = 2048;
|
v->step = 2048;
|
||||||
v->bass = curbass * 4370;
|
v->bass = curbass * 4370;
|
||||||
v->treble = curtreble * 4370;
|
v->treble = curtreble * 4370;
|
||||||
|
|
||||||
strcpy(v->name, "Trust FM Radio");
|
strcpy(v->name, "Trust FM Radio");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOCSAUDIO:
|
case VIDIOCSAUDIO:
|
||||||
{
|
{
|
||||||
struct video_audio *v = arg;
|
struct video_audio *v = arg;
|
||||||
|
|
||||||
if(v->audio)
|
if(v->audio)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
tr_setvol(v->volume);
|
tr_setvol(v->volume);
|
||||||
tr_setbass(v->bass);
|
tr_setbass(v->bass);
|
||||||
tr_settreble(v->treble);
|
tr_settreble(v->treble);
|
||||||
tr_setstereo(v->mode & VIDEO_SOUND_STEREO);
|
tr_setstereo(v->mode & VIDEO_SOUND_STEREO);
|
||||||
@@ -292,7 +292,7 @@ static int __init trust_init(void)
|
|||||||
write_i2c(2, TDA7318_ADDR, 0xe0); /* speaker att. RR = 0 dB */
|
write_i2c(2, TDA7318_ADDR, 0xe0); /* speaker att. RR = 0 dB */
|
||||||
write_i2c(2, TDA7318_ADDR, 0x40); /* stereo 1 input, gain = 18.75 dB */
|
write_i2c(2, TDA7318_ADDR, 0x40); /* stereo 1 input, gain = 18.75 dB */
|
||||||
|
|
||||||
tr_setvol(0x8000);
|
tr_setvol(0x8000);
|
||||||
tr_setbass(0x8000);
|
tr_setbass(0x8000);
|
||||||
tr_settreble(0x8000);
|
tr_settreble(0x8000);
|
||||||
tr_setstereo(1);
|
tr_setstereo(1);
|
||||||
|
@@ -361,7 +361,7 @@ static int __init typhoon_init(void)
|
|||||||
|
|
||||||
#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
|
#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
|
||||||
if (!create_proc_info_entry("driver/radio-typhoon", 0, NULL,
|
if (!create_proc_info_entry("driver/radio-typhoon", 0, NULL,
|
||||||
typhoon_get_info))
|
typhoon_get_info))
|
||||||
printk(KERN_ERR "radio-typhoon: registering /proc/driver/radio-typhoon failed\n");
|
printk(KERN_ERR "radio-typhoon: registering /proc/driver/radio-typhoon failed\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/* zoltrix radio plus driver for Linux radio support
|
/* zoltrix radio plus driver for Linux radio support
|
||||||
* (c) 1998 C. van Schaik <carl@leg.uct.ac.za>
|
* (c) 1998 C. van Schaik <carl@leg.uct.ac.za>
|
||||||
*
|
*
|
||||||
* BUGS
|
* BUGS
|
||||||
* Due to the inconsistency in reading from the signal flags
|
* Due to the inconsistency in reading from the signal flags
|
||||||
* it is difficult to get an accurate tuned signal.
|
* it is difficult to get an accurate tuned signal.
|
||||||
*
|
*
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* 1999-05-06 - (C. van Schaik)
|
* 1999-05-06 - (C. van Schaik)
|
||||||
* - Make signal strength and stereo scans
|
* - Make signal strength and stereo scans
|
||||||
* kinder to cpu while in delay
|
* kinder to cpu while in delay
|
||||||
* 1999-01-05 - (C. van Schaik)
|
* 1999-01-05 - (C. van Schaik)
|
||||||
* - Changed tuning to 1/160Mhz accuracy
|
* - Changed tuning to 1/160Mhz accuracy
|
||||||
* - Added stereo support
|
* - Added stereo support
|
||||||
@@ -105,7 +105,7 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
|
|||||||
i = 45;
|
i = 45;
|
||||||
|
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
|
|
||||||
outb(0, io);
|
outb(0, io);
|
||||||
outb(0, io);
|
outb(0, io);
|
||||||
inb(io + 3); /* Zoltrix needs to be read to confirm */
|
inb(io + 3); /* Zoltrix needs to be read to confirm */
|
||||||
@@ -139,8 +139,8 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
|
|||||||
udelay(1000);
|
udelay(1000);
|
||||||
inb(io+2);
|
inb(io+2);
|
||||||
|
|
||||||
udelay(1000);
|
udelay(1000);
|
||||||
|
|
||||||
if (dev->muted)
|
if (dev->muted)
|
||||||
{
|
{
|
||||||
outb(0, io);
|
outb(0, io);
|
||||||
@@ -148,12 +148,12 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq)
|
|||||||
inb(io + 3);
|
inb(io + 3);
|
||||||
udelay(1000);
|
udelay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&dev->lock);
|
mutex_unlock(&dev->lock);
|
||||||
|
|
||||||
if(!dev->muted)
|
if(!dev->muted)
|
||||||
{
|
{
|
||||||
zol_setvol(dev, dev->curvol);
|
zol_setvol(dev, dev->curvol);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -174,14 +174,14 @@ static int zol_getsigstr(struct zol_device *dev)
|
|||||||
b = inb(io);
|
b = inb(io);
|
||||||
|
|
||||||
mutex_unlock(&dev->lock);
|
mutex_unlock(&dev->lock);
|
||||||
|
|
||||||
if (a != b)
|
if (a != b)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
if ((a == 0xcf) || (a == 0xdf) /* I found this out by playing */
|
if ((a == 0xcf) || (a == 0xdf) /* I found this out by playing */
|
||||||
|| (a == 0xef)) /* with a binary scanner on the card io */
|
|| (a == 0xef)) /* with a binary scanner on the card io */
|
||||||
return (1);
|
return (1);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int zol_is_stereo (struct zol_device *dev)
|
static int zol_is_stereo (struct zol_device *dev)
|
||||||
@@ -189,7 +189,7 @@ static int zol_is_stereo (struct zol_device *dev)
|
|||||||
int x1, x2;
|
int x1, x2;
|
||||||
|
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
|
|
||||||
outb(0x00, io);
|
outb(0x00, io);
|
||||||
outb(dev->curvol, io);
|
outb(dev->curvol, io);
|
||||||
msleep(20);
|
msleep(20);
|
||||||
@@ -199,7 +199,7 @@ static int zol_is_stereo (struct zol_device *dev)
|
|||||||
x2 = inb(io);
|
x2 = inb(io);
|
||||||
|
|
||||||
mutex_unlock(&dev->lock);
|
mutex_unlock(&dev->lock);
|
||||||
|
|
||||||
if ((x1 == x2) && (x1 == 0xcf))
|
if ((x1 == x2) && (x1 == 0xcf))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -226,7 +226,7 @@ static int zol_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
case VIDIOCGTUNER:
|
case VIDIOCGTUNER:
|
||||||
{
|
{
|
||||||
struct video_tuner *v = arg;
|
struct video_tuner *v = arg;
|
||||||
if (v->tuner)
|
if (v->tuner)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
strcpy(v->name, "FM");
|
strcpy(v->name, "FM");
|
||||||
v->rangelow = (int) (88.0 * 16000);
|
v->rangelow = (int) (88.0 * 16000);
|
||||||
@@ -351,7 +351,7 @@ static int __init zoltrix_init(void)
|
|||||||
printk(KERN_INFO "Zoltrix Radio Plus card driver.\n");
|
printk(KERN_INFO "Zoltrix Radio Plus card driver.\n");
|
||||||
|
|
||||||
mutex_init(&zoltrix_unit.lock);
|
mutex_init(&zoltrix_unit.lock);
|
||||||
|
|
||||||
/* mute card - prevents noisy bootups */
|
/* mute card - prevents noisy bootups */
|
||||||
|
|
||||||
/* this ensures that the volume is all the way down */
|
/* this ensures that the volume is all the way down */
|
||||||
|
@@ -67,10 +67,10 @@ MODULE_SUPPORTED_DEVICE("video");
|
|||||||
static unsigned short colorspace_conv;
|
static unsigned short colorspace_conv;
|
||||||
module_param(colorspace_conv, ushort, 0444);
|
module_param(colorspace_conv, ushort, 0444);
|
||||||
MODULE_PARM_DESC(colorspace_conv,
|
MODULE_PARM_DESC(colorspace_conv,
|
||||||
" Colorspace conversion:"
|
" Colorspace conversion:"
|
||||||
"\n 0 = disable, 1 = enable"
|
"\n 0 = disable, 1 = enable"
|
||||||
"\n Default value is 0"
|
"\n Default value is 0"
|
||||||
);
|
);
|
||||||
|
|
||||||
#define ABOUT "V4L-Driver for Vision CPiA based cameras"
|
#define ABOUT "V4L-Driver for Vision CPiA based cameras"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user