From b59b36db9e8f441868c9907d6ea8fe0cdcb77f39 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Aug 2006 09:10:00 -0300 Subject: V4L/DVB (4339): Removed the remaining config.h stuff Since kernel include autoconf.h via command line, those config.h inclusion can be removed. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-aimslab.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/media/radio/radio-aimslab.c') diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index df22a582e7a..5a9c1f14e35 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c @@ -35,7 +35,6 @@ #include /* copy to/from user */ #include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_RTRACK_PORT */ #include /* Lock for the I/O */ #ifndef CONFIG_RADIO_RTRACK_PORT -- cgit v1.2.3 From 46ff2c7250eece24974ddb2198421c83a69a6289 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Aug 2006 09:10:01 -0300 Subject: V4L/DVB (4346): V4L2 conversion: radio_aimslab Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-aimslab.c | 148 ++++++++++++++++++++++++++---------- 1 file changed, 106 insertions(+), 42 deletions(-) (limited to 'drivers/media/radio/radio-aimslab.c') diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 5a9c1f14e35..7b9043f9d9b 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c @@ -1,5 +1,6 @@ /* radiotrack (radioreveal) driver for Linux radio support * (c) 1997 M. Kirkwood + * Converted to V4L2 API by Mauro Carvalho Chehab * Converted to new API by Alan Cox * Various bugfixes and enhancements by Russell Kroll * @@ -33,10 +34,13 @@ #include /* udelay */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include #include /* Lock for the I/O */ +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + #ifndef CONFIG_RADIO_RTRACK_PORT #define CONFIG_RADIO_RTRACK_PORT -1 #endif @@ -208,6 +212,25 @@ static int rt_getsigstr(struct rt_device *dev) return 1; /* signal present */ } +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 0xff, + .step = 1, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + static int rt_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) { @@ -216,73 +239,114 @@ static int rt_do_ioctl(struct inode *inode, struct file *file, switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; - strcpy(v->name, "RadioTrack"); + strlcpy(v->driver, "radio-aimslab", sizeof (v->driver)); + strlcpy(v->card, "RadioTrack", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if(v->tuner) /* Only 1 tuner */ + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; + + memset(v,0,sizeof(*v)); + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + v->rangelow=(87*16000); v->rangehigh=(108*16000); - v->flags=VIDEO_TUNER_LOW; - v->mode=VIDEO_MODE_AUTO; - strcpy(v->name, "FM"); + v->rxsubchans =V4L2_TUNER_SUB_MONO; + v->capability=V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; v->signal=0xFFFF*rt_getsigstr(rt); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - /* Only 1 tuner so no setting needed ! */ + return 0; } - case VIDIOCGFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - *freq = rt->curfreq; + struct v4l2_frequency *f = arg; + + rt->curfreq = f->frequency; + rt_setfreq(rt, rt->curfreq); return 0; } - case VIDIOCSFREQ: + case VIDIOC_G_FREQUENCY: { - unsigned long *freq = arg; - rt->curfreq = *freq; - rt_setfreq(rt, rt->curfreq); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = rt->curfreq; + return 0; } - case VIDIOCGAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - memset(v,0, sizeof(*v)); - v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; - v->volume=rt->curvol * 6554; - v->step=6554; - strcpy(v->name, "Radio"); - return 0; + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; } - case VIDIOCSAUDIO: + case VIDIOC_G_CTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; - if(v->flags&VIDEO_AUDIO_MUTE) - rt_mute(rt); - else - rt_setvol(rt,v->volume/6554); - return 0; + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=rt->muted; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value=rt->curvol * 6554; + return (0); + } + return -EINVAL; } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + rt_mute(rt); + } else { + rt_setvol(rt,rt->curvol); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + rt_setvol(rt,ctrl->value); + return (0); + } + return -EINVAL; + } + default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + rt_do_ioctl); } } -- cgit v1.2.3 From 38ee04f04340ffd6af868499862341d11ed2b331 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Aug 2006 09:10:01 -0300 Subject: V4L/DVB (4348): Fix: compile for radio aimslab and aztech with V4L2 only All radio devices use an obsolete mode of opening/release driver. Since this is not V4L1 core, better to keep the method available for more time than to rewrite open/release without a radio device to test, since the newer method is much more complex than the previous one (although providing support for multiple opens and multiple devices). Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-aimslab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/radio/radio-aimslab.c') diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 7b9043f9d9b..3368a89bfad 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c @@ -372,7 +372,7 @@ static struct video_device rtrack_radio= .owner = THIS_MODULE, .name = "RadioTrack radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_RTRACK, + .hardware = 0, .fops = &rtrack_fops, }; -- cgit v1.2.3