diff options
Diffstat (limited to 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/dsbr100.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-cadet.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-isa.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-keene.c | 3 | ||||
-rw-r--r-- | drivers/media/radio/radio-ma901.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-miropcm20.c | 304 | ||||
-rw-r--r-- | drivers/media/radio/radio-mr800.c | 3 | ||||
-rw-r--r-- | drivers/media/radio/radio-raremono.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmi.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-si476x.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-tea5764.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-tea5777.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/radio-timb.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/si470x/radio-si470x-usb.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/si4713/radio-platform-si4713.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/si4713/radio-usb-si4713.c | 1 | ||||
-rw-r--r-- | drivers/media/radio/si4713/si4713.c | 80 | ||||
-rw-r--r-- | drivers/media/radio/si4713/si4713.h | 9 | ||||
-rw-r--r-- | drivers/media/radio/tea575x.c | 1 |
19 files changed, 374 insertions, 39 deletions
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 142c2ee64d31..2262b8139ca1 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -390,7 +390,6 @@ static int usb_dsbr100_probe(struct usb_interface *intf, radio->videodev.release = video_device_release_empty; radio->videodev.lock = &radio->v4l2_lock; radio->videodev.ctrl_handler = &radio->hdl; - set_bit(V4L2_FL_USE_FH_PRIO, &radio->videodev.flags); radio->usbdev = interface_to_usbdev(intf); radio->curfreq = FREQ_MIN * FREQ_MUL; diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index d719e59e2179..82affaedf067 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c @@ -650,7 +650,6 @@ static int __init cadet_init(void) dev->vdev.ioctl_ops = &cadet_ioctl_ops; dev->vdev.release = video_device_release_empty; dev->vdev.lock = &dev->lock; - set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags); video_set_drvdata(&dev->vdev, dev); res = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); diff --git a/drivers/media/radio/radio-isa.c b/drivers/media/radio/radio-isa.c index 6ff350831d56..c309ee45a08e 100644 --- a/drivers/media/radio/radio-isa.c +++ b/drivers/media/radio/radio-isa.c @@ -253,7 +253,6 @@ static int radio_isa_common_probe(struct radio_isa_card *isa, isa->vdev.fops = &radio_isa_fops; isa->vdev.ioctl_ops = &radio_isa_ioctl_ops; isa->vdev.release = video_device_release_empty; - set_bit(V4L2_FL_USE_FH_PRIO, &isa->vdev.flags); video_set_drvdata(&isa->vdev, isa); isa->freq = FREQ_LOW; isa->stereo = drv->has_stereo; diff --git a/drivers/media/radio/radio-keene.c b/drivers/media/radio/radio-keene.c index 3d127825eceb..0c5d2db3b828 100644 --- a/drivers/media/radio/radio-keene.c +++ b/drivers/media/radio/radio-keene.c @@ -265,7 +265,7 @@ static int keene_s_ctrl(struct v4l2_ctrl *ctrl) return keene_cmd_set(radio); case V4L2_CID_AUDIO_COMPRESSION_GAIN: - radio->tx = db2tx[(ctrl->val - ctrl->minimum) / ctrl->step]; + radio->tx = db2tx[(ctrl->val - (s32)ctrl->minimum) / (s32)ctrl->step]; return keene_cmd_set(radio); } return -EINVAL; @@ -380,7 +380,6 @@ static int usb_keene_probe(struct usb_interface *intf, usb_set_intfdata(intf, &radio->v4l2_dev); video_set_drvdata(&radio->vdev, radio); - set_bit(V4L2_FL_USE_FH_PRIO, &radio->vdev.flags); /* at least 11ms is needed in order to settle hardware */ msleep(20); diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c index a85b064cb7be..b3000ef85ee7 100644 --- a/drivers/media/radio/radio-ma901.c +++ b/drivers/media/radio/radio-ma901.c @@ -411,7 +411,6 @@ static int usb_ma901radio_probe(struct usb_interface *intf, radio->vdev.ioctl_ops = &usb_ma901radio_ioctl_ops; radio->vdev.release = video_device_release_empty; radio->vdev.lock = &radio->lock; - set_bit(V4L2_FL_USE_FH_PRIO, &radio->vdev.flags); radio->usbdev = interface_to_usbdev(intf); radio->intf = intf; diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c index a7e93d7477dd..998919e97dfe 100644 --- a/drivers/media/radio/radio-miropcm20.c +++ b/drivers/media/radio/radio-miropcm20.c @@ -1,20 +1,35 @@ -/* Miro PCM20 radio driver for Linux radio support +/* + * Miro PCM20 radio driver for Linux radio support * (c) 1998 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl> * Thanks to Norberto Pellici for the ACI device interface specification * The API part is based on the radiotrack driver by M. Kirkwood * This driver relies on the aci mixer provided by the snd-miro * ALSA driver. * Look there for further info... - */ - -/* 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 - * conditions... Robert + * + * From the original miro RDS sources: + * + * (c) 2001 Robert Siemer <Robert.Siemer@gmx.de> + * + * Many thanks to Fred Seidel <seidel@metabox.de>, the + * designer of the RDS decoder hardware. With his help + * I was able to code this driver. + * Thanks also to Norberto Pellicci, Dominic Mounteney + * <DMounteney@pinnaclesys.com> and www.teleauskunft.de + * for good hints on finding Fred. It was somewhat hard + * to locate him here in Germany... [: + * + * This code has been reintroduced and converted to use + * the new V4L2 RDS API by: + * + * Hans Verkuil <hans.verkuil@cisco.com> */ #include <linux/module.h> #include <linux/init.h> +#include <linux/delay.h> #include <linux/videodev2.h> +#include <linux/kthread.h> #include <media/v4l2-device.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-ctrls.h> @@ -22,6 +37,22 @@ #include <media/v4l2-event.h> #include <sound/aci.h> +#define RDS_DATASHIFT 2 /* Bit 2 */ +#define RDS_DATAMASK (1 << RDS_DATASHIFT) +#define RDS_BUSYMASK 0x10 /* Bit 4 */ +#define RDS_CLOCKMASK 0x08 /* Bit 3 */ +#define RDS_DATA(x) (((x) >> RDS_DATASHIFT) & 1) + +#define RDS_STATUS 0x01 +#define RDS_STATIONNAME 0x02 +#define RDS_TEXT 0x03 +#define RDS_ALTFREQ 0x04 +#define RDS_TIMEDATE 0x05 +#define RDS_PI_CODE 0x06 +#define RDS_PTYTATP 0x07 +#define RDS_RESET 0x08 +#define RDS_RXVALUE 0x09 + static int radio_nr = -1; module_param(radio_nr, int, 0); MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)"); @@ -30,6 +61,14 @@ struct pcm20 { struct v4l2_device v4l2_dev; struct video_device vdev; struct v4l2_ctrl_handler ctrl_handler; + struct v4l2_ctrl *rds_pty; + struct v4l2_ctrl *rds_ps_name; + struct v4l2_ctrl *rds_radio_test; + struct v4l2_ctrl *rds_ta; + struct v4l2_ctrl *rds_tp; + struct v4l2_ctrl *rds_ms; + /* thread for periodic RDS status checking */ + struct task_struct *kthread; unsigned long freq; u32 audmode; struct snd_miro_aci *aci; @@ -41,6 +80,103 @@ static struct pcm20 pcm20_card = { .audmode = V4L2_TUNER_MODE_STEREO, }; + +static int rds_waitread(struct snd_miro_aci *aci) +{ + u8 byte; + int i = 2000; + + do { + byte = inb(aci->aci_port + ACI_REG_RDS); + i--; + } while ((byte & RDS_BUSYMASK) && i); + + /* + * It's magic, but without this the data that you read later on + * is unreliable and full of bit errors. With this 1 usec delay + * everything is fine. + */ + udelay(1); + return i ? byte : -1; +} + +static int rds_rawwrite(struct snd_miro_aci *aci, u8 byte) +{ + if (rds_waitread(aci) >= 0) { + outb(byte, aci->aci_port + ACI_REG_RDS); + return 0; + } + return -1; +} + +static int rds_write(struct snd_miro_aci *aci, u8 byte) +{ + u8 sendbuffer[8]; + int i; + + for (i = 7; i >= 0; i--) + sendbuffer[7 - i] = (byte & (1 << i)) ? RDS_DATAMASK : 0; + sendbuffer[0] |= RDS_CLOCKMASK; + + for (i = 0; i < 8; i++) + rds_rawwrite(aci, sendbuffer[i]); + return 0; +} + +static int rds_readcycle_nowait(struct snd_miro_aci *aci) +{ + outb(0, aci->aci_port + ACI_REG_RDS); + return rds_waitread(aci); +} + +static int rds_readcycle(struct snd_miro_aci *aci) +{ + if (rds_rawwrite(aci, 0) < 0) + return -1; + return rds_waitread(aci); +} + +static int rds_ack(struct snd_miro_aci *aci) +{ + int i = rds_readcycle(aci); + + if (i < 0) + return -1; + if (i & RDS_DATAMASK) + return 0; /* ACK */ + return 1; /* NACK */ +} + +static int rds_cmd(struct snd_miro_aci *aci, u8 cmd, u8 databuffer[], u8 datasize) +{ + int i, j; + + rds_write(aci, cmd); + + /* RDS_RESET doesn't need further processing */ + if (cmd == RDS_RESET) + return 0; + if (rds_ack(aci)) + return -EIO; + if (datasize == 0) + return 0; + + /* to be able to use rds_readcycle_nowait() + I have to waitread() here */ + if (rds_waitread(aci) < 0) + return -1; + + memset(databuffer, 0, datasize); + + for (i = 0; i < 8 * datasize; i++) { + j = rds_readcycle_nowait(aci); + if (j < 0) + return -EIO; + databuffer[i / 8] |= RDS_DATA(j) << (7 - (i % 8)); + } + return 0; +} + static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq) { unsigned char freql; @@ -54,17 +190,10 @@ static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq) freql = freq & 0xff; freqh = freq >> 8; + rds_cmd(aci, RDS_RESET, NULL, 0); return snd_aci_cmd(aci, ACI_WRITE_TUNE, freql, freqh); } -static const struct v4l2_file_operations pcm20_fops = { - .owner = THIS_MODULE, - .open = v4l2_fh_open, - .poll = v4l2_ctrl_poll, - .release = v4l2_fh_release, - .unlocked_ioctl = video_ioctl2, -}; - static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *v) { @@ -73,16 +202,31 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "Miro PCM20", sizeof(v->driver)); strlcpy(v->card, "Miro PCM20", sizeof(v->card)); snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", dev->v4l2_dev.name); - v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO; + v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE; v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS; return 0; } +static bool sanitize(char *p, int size) +{ + int i; + bool ret = true; + + for (i = 0; i < size; i++) { + if (p[i] < 32) { + p[i] = ' '; + ret = false; + } + } + return ret; +} + static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { struct pcm20 *dev = video_drvdata(file); int res; + u8 buf; if (v->index) return -EINVAL; @@ -97,8 +241,12 @@ static int vidioc_g_tuner(struct file *file, void *priv, res = snd_aci_cmd(dev->aci, ACI_READ_TUNERSTEREO, -1, -1); v->rxsubchans = (res & 0x40) ? V4L2_TUNER_SUB_MONO : V4L2_TUNER_SUB_STEREO; - v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; + v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | + V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_CONTROLS; v->audmode = dev->audmode; + res = rds_cmd(dev->aci, RDS_RXVALUE, &buf, 1); + if (res >= 0 && buf) + v->rxsubchans |= V4L2_TUNER_SUB_RDS; return 0; } @@ -157,6 +305,115 @@ static int pcm20_s_ctrl(struct v4l2_ctrl *ctrl) return -EINVAL; } +static int pcm20_thread(void *data) +{ + struct pcm20 *dev = data; + const unsigned no_rds_start_counter = 5; + const unsigned sleep_msecs = 2000; + unsigned no_rds_counter = no_rds_start_counter; + + for (;;) { + char text_buffer[66]; + u8 buf; + int res; + + msleep_interruptible(sleep_msecs); + + if (kthread_should_stop()) + break; + + res = rds_cmd(dev->aci, RDS_RXVALUE, &buf, 1); + if (res) + continue; + if (buf == 0) { + if (no_rds_counter == 0) + continue; + no_rds_counter--; + if (no_rds_counter) + continue; + + /* + * No RDS seen for no_rds_start_counter * sleep_msecs + * milliseconds, clear all RDS controls to their + * default values. + */ + v4l2_ctrl_s_ctrl_string(dev->rds_ps_name, ""); + v4l2_ctrl_s_ctrl(dev->rds_ms, 1); + v4l2_ctrl_s_ctrl(dev->rds_ta, 0); + v4l2_ctrl_s_ctrl(dev->rds_tp, 0); + v4l2_ctrl_s_ctrl(dev->rds_pty, 0); + v4l2_ctrl_s_ctrl_string(dev->rds_radio_test, ""); + continue; + } + no_rds_counter = no_rds_start_counter; + + res = rds_cmd(dev->aci, RDS_STATUS, &buf, 1); + if (res) + continue; + if ((buf >> 3) & 1) { + res = rds_cmd(dev->aci, RDS_STATIONNAME, text_buffer, 8); + text_buffer[8] = 0; + if (!res && sanitize(text_buffer, 8)) + v4l2_ctrl_s_ctrl_string(dev->rds_ps_name, text_buffer); + } + if ((buf >> 6) & 1) { + u8 pty; + + res = rds_cmd(dev->aci, RDS_PTYTATP, &pty, 1); + if (!res) { + v4l2_ctrl_s_ctrl(dev->rds_ms, !!(pty & 0x01)); + v4l2_ctrl_s_ctrl(dev->rds_ta, !!(pty & 0x02)); + v4l2_ctrl_s_ctrl(dev->rds_tp, !!(pty & 0x80)); + v4l2_ctrl_s_ctrl(dev->rds_pty, (pty >> 2) & 0x1f); + } + } + if ((buf >> 4) & 1) { + res = rds_cmd(dev->aci, RDS_TEXT, text_buffer, 65); + text_buffer[65] = 0; + if (!res && sanitize(text_buffer + 1, 64)) + v4l2_ctrl_s_ctrl_string(dev->rds_radio_test, text_buffer + 1); + } + } + return 0; +} + +static int pcm20_open(struct file *file) +{ + struct pcm20 *dev = video_drvdata(file); + int res = v4l2_fh_open(file); + + if (!res && v4l2_fh_is_singular_file(file) && + IS_ERR_OR_NULL(dev->kthread)) { + dev->kthread = kthread_run(pcm20_thread, dev, "%s", + dev->v4l2_dev.name); + if (IS_ERR(dev->kthread)) { + v4l2_err(&dev->v4l2_dev, "kernel_thread() failed\n"); + v4l2_fh_release(file); + return PTR_ERR(dev->kthread); + } + } + return res; +} + +static int pcm20_release(struct file *file) +{ + struct pcm20 *dev = video_drvdata(file); + + if (v4l2_fh_is_singular_file(file) && !IS_ERR_OR_NULL(dev->kthread)) { + kthread_stop(dev->kthread); + dev->kthread = NULL; + } + return v4l2_fh_release(file); +} + +static const struct v4l2_file_operations pcm20_fops = { + .owner = THIS_MODULE, + .open = pcm20_open, + .poll = v4l2_ctrl_poll, + .release = pcm20_release, + .unlocked_ioctl = video_ioctl2, +}; + static const struct v4l2_ioctl_ops pcm20_ioctl_ops = { .vidioc_querycap = vidioc_querycap, .vidioc_g_tuner = vidioc_g_tuner, @@ -195,9 +452,21 @@ static int __init pcm20_init(void) } hdl = &dev->ctrl_handler; - v4l2_ctrl_handler_init(hdl, 1); + v4l2_ctrl_handler_init(hdl, 7); v4l2_ctrl_new_std(hdl, &pcm20_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); + dev->rds_pty = v4l2_ctrl_new_std(hdl, NULL, + V4L2_CID_RDS_RX_PTY, 0, 0x1f, 1, 0); + dev->rds_ps_name = v4l2_ctrl_new_std(hdl, NULL, + V4L2_CID_RDS_RX_PS_NAME, 0, 8, 8, 0); + dev->rds_radio_test = v4l2_ctrl_new_std(hdl, NULL, + V4L2_CID_RDS_RX_RADIO_TEXT, 0, 64, 64, 0); + dev->rds_ta = v4l2_ctrl_new_std(hdl, NULL, + V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT, 0, 1, 1, 0); + dev->rds_tp = v4l2_ctrl_new_std(hdl, NULL, + V4L2_CID_RDS_RX_TRAFFIC_PROGRAM, 0, 1, 1, 0); + dev->rds_ms = v4l2_ctrl_new_std(hdl, NULL, + V4L2_CID_RDS_RX_MUSIC_SPEECH, 0, 1, 1, 1); v4l2_dev->ctrl_handler = hdl; if (hdl->error) { res = hdl->error; @@ -210,7 +479,6 @@ static int __init pcm20_init(void) dev->vdev.ioctl_ops = &pcm20_ioctl_ops; dev->vdev.release = video_device_release_empty; dev->vdev.lock = &dev->lock; - set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags); video_set_drvdata(&dev->vdev, dev); snd_aci_cmd(dev->aci, ACI_SET_TUNERMONO, dev->audmode == V4L2_TUNER_MODE_MONO, -1); diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index a360227ca3ab..c2927fd12615 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -32,7 +32,7 @@ * achievements (specifications given). * Also, Faidon Liambotis <paravoid@debian.org> wrote nice driver for this radio * in 2007. He allowed to use his driver to improve current mr800 radio driver. - * http://kerneltrap.org/mailarchive/linux-usb-devel/2007/10/11/342492 + * http://www.spinics.net/lists/linux-usb-devel/msg10109.html * * Version 0.01: First working version. * It's required to blacklist AverMedia USB Radio @@ -558,7 +558,6 @@ static int usb_amradio_probe(struct usb_interface *intf, radio->vdev.ioctl_ops = &usb_amradio_ioctl_ops; radio->vdev.release = video_device_release_empty; radio->vdev.lock = &radio->lock; - set_bit(V4L2_FL_USE_FH_PRIO, &radio->vdev.flags); radio->usbdev = interface_to_usbdev(intf); radio->intf = intf; diff --git a/drivers/media/radio/radio-raremono.c b/drivers/media/radio/radio-raremono.c index 7b3bdbb1be73..bfb3a6d051ba 100644 --- a/drivers/media/radio/radio-raremono.c +++ b/drivers/media/radio/radio-raremono.c @@ -361,7 +361,6 @@ static int usb_raremono_probe(struct usb_interface *intf, usb_set_intfdata(intf, &radio->v4l2_dev); video_set_drvdata(&radio->vdev, radio); - set_bit(V4L2_FL_USE_FH_PRIO, &radio->vdev.flags); raremono_cmd_main(radio, BAND_FM, 95160); diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 6f4318ff0db3..d7ce8fe6b5ae 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c @@ -344,7 +344,6 @@ static int __init fmi_init(void) fmi->vdev.fops = &fmi_fops; fmi->vdev.ioctl_ops = &fmi_ioctl_ops; fmi->vdev.release = video_device_release_empty; - set_bit(V4L2_FL_USE_FH_PRIO, &fmi->vdev.flags); video_set_drvdata(&fmi->vdev, fmi); mutex_init(&fmi->lock); diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 2fd9009f8663..633022b45f33 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -1470,7 +1470,6 @@ static int si476x_radio_probe(struct platform_device *pdev) video_set_drvdata(&radio->videodev, radio); platform_set_drvdata(pdev, radio); - set_bit(V4L2_FL_USE_FH_PRIO, &radio->videodev.flags); radio->v4l2dev.ctrl_handler = &radio->ctrl_handler; v4l2_ctrl_handler_init(&radio->ctrl_handler, diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index 3ed1f5669f79..925049654c5b 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c @@ -478,7 +478,6 @@ static int tea5764_i2c_probe(struct i2c_client *client, video_set_drvdata(&radio->vdev, radio); radio->vdev.lock = &radio->mutex; radio->vdev.v4l2_dev = v4l2_dev; - set_bit(V4L2_FL_USE_FH_PRIO, &radio->vdev.flags); /* initialize and power off the chip */ tea5764_i2c_read(radio); diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c index e2455970725a..83fe7ab358df 100644 --- a/drivers/media/radio/radio-tea5777.c +++ b/drivers/media/radio/radio-tea5777.c @@ -570,7 +570,6 @@ int radio_tea5777_init(struct radio_tea5777 *tea, struct module *owner) tea->fops = tea575x_fops; tea->fops.owner = owner; tea->vd.fops = &tea->fops; - set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags); tea->vd.ctrl_handler = &tea->ctrl_handler; v4l2_ctrl_handler_init(&tea->ctrl_handler, 1); diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c index 0817964d9172..b9285e6584af 100644 --- a/drivers/media/radio/radio-timb.c +++ b/drivers/media/radio/radio-timb.c @@ -126,7 +126,6 @@ static int timbradio_probe(struct platform_device *pdev) tr->video_dev.release = video_device_release_empty; tr->video_dev.minor = -1; tr->video_dev.lock = &tr->lock; - set_bit(V4L2_FL_USE_FH_PRIO, &tr->video_dev.flags); strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name)); err = v4l2_device_register(NULL, &tr->v4l2_dev); diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index 07ef40595efd..494fac061306 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -680,7 +680,6 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, radio->videodev.lock = &radio->lock; radio->videodev.v4l2_dev = &radio->v4l2_dev; radio->videodev.release = video_device_release_empty; - set_bit(V4L2_FL_USE_FH_PRIO, &radio->videodev.flags); video_set_drvdata(&radio->videodev, radio); /* get device and chip versions */ diff --git a/drivers/media/radio/si4713/radio-platform-si4713.c b/drivers/media/radio/si4713/radio-platform-si4713.c index ba4cfc946868..a47502a330f0 100644 --- a/drivers/media/radio/si4713/radio-platform-si4713.c +++ b/drivers/media/radio/si4713/radio-platform-si4713.c @@ -196,7 +196,6 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) rsdev->radio_dev = radio_si4713_vdev_template; rsdev->radio_dev.v4l2_dev = &rsdev->v4l2_dev; rsdev->radio_dev.ctrl_handler = sd->ctrl_handler; - set_bit(V4L2_FL_USE_FH_PRIO, &rsdev->radio_dev.flags); /* Serialize all access to the si4713 */ rsdev->radio_dev.lock = &rsdev->lock; video_set_drvdata(&rsdev->radio_dev, rsdev); diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c b/drivers/media/radio/si4713/radio-usb-si4713.c index 86502b2786d0..a77319dcba05 100644 --- a/drivers/media/radio/si4713/radio-usb-si4713.c +++ b/drivers/media/radio/si4713/radio-usb-si4713.c @@ -492,7 +492,6 @@ static int usb_si4713_probe(struct usb_interface *intf, radio->vdev.vfl_dir = VFL_DIR_TX; video_set_drvdata(&radio->vdev, radio); - set_bit(V4L2_FL_USE_FH_PRIO, &radio->vdev.flags); retval = video_register_device(&radio->vdev, VFL_TYPE_RADIO, -1); if (retval < 0) { diff --git a/drivers/media/radio/si4713/si4713.c b/drivers/media/radio/si4713/si4713.c index 07d5153811e8..b5765557ea3d 100644 --- a/drivers/media/radio/si4713/si4713.c +++ b/drivers/media/radio/si4713/si4713.c @@ -957,6 +957,41 @@ static int si4713_choose_econtrol_action(struct si4713_device *sdev, u32 id, *bit = 5; *mask = 0x1F << 5; break; + case V4L2_CID_RDS_TX_DYNAMIC_PTY: + *property = SI4713_TX_RDS_PS_MISC; + *bit = 15; + *mask = 1 << 15; + break; + case V4L2_CID_RDS_TX_COMPRESSED: + *property = SI4713_TX_RDS_PS_MISC; + *bit = 14; + *mask = 1 << 14; + break; + case V4L2_CID_RDS_TX_ARTIFICIAL_HEAD: + *property = SI4713_TX_RDS_PS_MISC; + *bit = 13; + *mask = 1 << 13; + break; + case V4L2_CID_RDS_TX_MONO_STEREO: + *property = SI4713_TX_RDS_PS_MISC; + *bit = 12; + *mask = 1 << 12; + break; + case V4L2_CID_RDS_TX_TRAFFIC_PROGRAM: + *property = SI4713_TX_RDS_PS_MISC; + *bit = 10; + *mask = 1 << 10; + break; + case V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT: + *property = SI4713_TX_RDS_PS_MISC; + *bit = 4; + *mask = 1 << 4; + break; + case V4L2_CID_RDS_TX_MUSIC_SPEECH: + *property = SI4713_TX_RDS_PS_MISC; + *bit = 3; + *mask = 1 << 3; + break; case V4L2_CID_AUDIO_LIMITER_ENABLED: *property = SI4713_TX_ACOMP_ENABLE; *bit = 1; @@ -1098,11 +1133,11 @@ static int si4713_s_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl->id) { case V4L2_CID_RDS_TX_PS_NAME: - ret = si4713_set_rds_ps_name(sdev, ctrl->string); + ret = si4713_set_rds_ps_name(sdev, ctrl->p_new.p_char); break; case V4L2_CID_RDS_TX_RADIO_TEXT: - ret = si4713_set_rds_radio_text(sdev, ctrl->string); + ret = si4713_set_rds_radio_text(sdev, ctrl->p_new.p_char); break; case V4L2_CID_TUNE_ANTENNA_CAPACITOR: @@ -1122,6 +1157,17 @@ static int si4713_s_ctrl(struct v4l2_ctrl *ctrl) } break; + case V4L2_CID_RDS_TX_ALT_FREQS_ENABLE: + case V4L2_CID_RDS_TX_ALT_FREQS: + if (sdev->rds_alt_freqs_enable->val) { + val = sdev->rds_alt_freqs->p_new.p_u32[0]; + val = val / 100 - 876 + 0xe101; + } else { + val = 0xe0e0; + } + ret = si4713_write_property(sdev, SI4713_TX_RDS_PS_AF, val); + break; + default: ret = si4713_choose_econtrol_action(sdev, ctrl->id, &bit, &mask, &property, &mul, &table, &size); @@ -1355,6 +1401,17 @@ static const struct v4l2_subdev_ops si4713_subdev_ops = { .tuner = &si4713_subdev_tuner_ops, }; +static const struct v4l2_ctrl_config si4713_alt_freqs_ctrl = { + .id = V4L2_CID_RDS_TX_ALT_FREQS, + .type = V4L2_CTRL_TYPE_U32, + .min = 87600, + .max = 107900, + .step = 100, + .def = 87600, + .dims = { 1 }, + .elem_size = sizeof(u32), +}; + /* * I2C driver interface */ @@ -1410,6 +1467,23 @@ static int si4713_probe(struct i2c_client *client, V4L2_CID_RDS_TX_PI, 0, 0xffff, 1, DEFAULT_RDS_PI); sdev->rds_pty = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, V4L2_CID_RDS_TX_PTY, 0, 31, 1, DEFAULT_RDS_PTY); + sdev->rds_compressed = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_COMPRESSED, 0, 1, 1, 0); + sdev->rds_art_head = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_ARTIFICIAL_HEAD, 0, 1, 1, 0); + sdev->rds_stereo = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_MONO_STEREO, 0, 1, 1, 1); + sdev->rds_tp = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_TRAFFIC_PROGRAM, 0, 1, 1, 0); + sdev->rds_ta = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT, 0, 1, 1, 0); + sdev->rds_ms = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_MUSIC_SPEECH, 0, 1, 1, 1); + sdev->rds_dyn_pty = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_DYNAMIC_PTY, 0, 1, 1, 0); + sdev->rds_alt_freqs_enable = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, + V4L2_CID_RDS_TX_ALT_FREQS_ENABLE, 0, 1, 1, 0); + sdev->rds_alt_freqs = v4l2_ctrl_new_custom(hdl, &si4713_alt_freqs_ctrl, NULL); sdev->rds_deviation = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, V4L2_CID_RDS_TX_DEVIATION, 0, MAX_RDS_DEVIATION, 10, DEFAULT_RDS_DEVIATION); @@ -1476,7 +1550,7 @@ static int si4713_probe(struct i2c_client *client, rval = hdl->error; goto free_ctrls; } - v4l2_ctrl_cluster(20, &sdev->mute); + v4l2_ctrl_cluster(29, &sdev->mute); sdev->sd.ctrl_handler = hdl; if (client->irq) { diff --git a/drivers/media/radio/si4713/si4713.h b/drivers/media/radio/si4713/si4713.h index 4837cf6e0e1b..ed700e387605 100644 --- a/drivers/media/radio/si4713/si4713.h +++ b/drivers/media/radio/si4713/si4713.h @@ -211,6 +211,15 @@ struct si4713_device { struct v4l2_ctrl *rds_pi; struct v4l2_ctrl *rds_deviation; struct v4l2_ctrl *rds_pty; + struct v4l2_ctrl *rds_compressed; + struct v4l2_ctrl *rds_art_head; + struct v4l2_ctrl *rds_stereo; + struct v4l2_ctrl *rds_ta; + struct v4l2_ctrl *rds_tp; + struct v4l2_ctrl *rds_ms; + struct v4l2_ctrl *rds_dyn_pty; + struct v4l2_ctrl *rds_alt_freqs_enable; + struct v4l2_ctrl *rds_alt_freqs; struct v4l2_ctrl *compression_enabled; struct v4l2_ctrl *compression_threshold; struct v4l2_ctrl *compression_gain; diff --git a/drivers/media/radio/tea575x.c b/drivers/media/radio/tea575x.c index 7c14060a40b8..f1a0867789fe 100644 --- a/drivers/media/radio/tea575x.c +++ b/drivers/media/radio/tea575x.c @@ -523,7 +523,6 @@ int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner) tea->fops = tea575x_fops; tea->fops.owner = owner; tea->vd.fops = &tea->fops; - set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags); /* disable hw_freq_seek if we can't use it */ if (tea->cannot_read_data) v4l2_disable_ioctl(&tea->vd, VIDIOC_S_HW_FREQ_SEEK); |