From 8ed06fd4729d25959f6af8b7ce4e3888866bfe56 Mon Sep 17 00:00:00 2001 From: Robert Krakora Date: Sun, 18 Jan 2009 21:44:46 -0300 Subject: V4L/DVB (10255): em28xx: Clock (XCLK) Cleanup Clock (XCLK) Cleanup Signed-off-by: Robert Krakora Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/video/em28xx/em28xx-core.c') diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 94fb1b639a2e..3ac8ce0adec3 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -424,7 +424,7 @@ int em28xx_audio_analog_set(struct em28xx *dev) xclk = dev->board.xclk & 0x7f; if (!dev->mute) - xclk |= 0x80; + xclk |= EM28XX_XCLK_AUDIO_UNMUTE; ret = em28xx_write_reg(dev, EM28XX_R0F_XCLK, xclk); if (ret < 0) -- cgit v1.2.3-59-g8ed1b From aa5a1821859c9c2915bc00e79f6e01e619df6e8f Mon Sep 17 00:00:00 2001 From: Robert Krakora Date: Sun, 8 Feb 2009 13:09:11 -0300 Subject: V4L/DVB (10518): em28xx: Fix for em28xx memory leak and function rename Fix for em28xx memory leak and function rename Signed-off-by: Robert Krakora Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 22 ++++++++++++++++++---- drivers/media/video/em28xx/em28xx-core.c | 13 +++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'drivers/media/video/em28xx/em28xx-core.c') diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 7a62c77b8485..c698d3c9690f 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "activates debug info"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; -static int em28xx_isoc_audio_deinit(struct em28xx *dev) +static int em28xx_deinit_isoc_audio(struct em28xx *dev) { int i; @@ -66,6 +66,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev) usb_kill_urb(dev->adev.urb[i]); else usb_unlink_urb(dev->adev.urb[i]); + usb_free_urb(dev->adev.urb[i]); dev->adev.urb[i] = NULL; @@ -87,6 +88,20 @@ static void em28xx_audio_isocirq(struct urb *urb) unsigned int stride; struct snd_pcm_substream *substream; struct snd_pcm_runtime *runtime; + + switch (urb->status) { + case 0: /* success */ + case -ETIMEDOUT: /* NAK */ + break; + case -ECONNRESET: /* kill */ + case -ENOENT: + case -ESHUTDOWN: + return; + default: /* error */ + dprintk("urb completition error %d.\n", urb->status); + break; + } + if (dev->adev.capture_pcm_substream) { substream = dev->adev.capture_pcm_substream; runtime = substream->runtime; @@ -197,8 +212,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); if (errCode) { - em28xx_isoc_audio_deinit(dev); - + em28xx_deinit_isoc_audio(dev); return errCode; } } @@ -218,7 +232,7 @@ static int em28xx_cmd(struct em28xx *dev, int cmd, int arg) em28xx_init_audio_isoc(dev); } else if (dev->adev.capture_stream == STREAM_ON && arg == 0) { dev->adev.capture_stream = STREAM_OFF; - em28xx_isoc_audio_deinit(dev); + em28xx_deinit_isoc_audio(dev); } else { printk(KERN_ERR "An underrun very likely occurred. " "Ignoring it.\n"); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 3ac8ce0adec3..43f1d0e4c549 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -827,6 +827,19 @@ static void em28xx_irq_callback(struct urb *urb) struct em28xx *dev = container_of(dma_q, struct em28xx, vidq); int rc, i; + switch (urb->status) { + case 0: /* success */ + case -ETIMEDOUT: /* NAK */ + break; + case -ECONNRESET: /* kill */ + case -ENOENT: + case -ESHUTDOWN: + return; + default: /* error */ + em28xx_isocdbg("urb completition error %d.\n", urb->status); + break; + } + /* Copy data from URB */ spin_lock(&dev->slock); rc = dev->isoc_ctl.isoc_copy(dev, urb); -- cgit v1.2.3-59-g8ed1b From a1a6ee74f2c68918f2e145dccba3637eea91a52a Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 10 Feb 2009 23:28:24 -0300 Subject: V4L/DVB (10525): em28xx: Coding style fixes and a typo correction Lots of coding style fixes and a typo correction for em28xx. [dougsland@redhat.com: fixed a reject due to a change on em28xx-audio.c] Signed-off-by: Nicola Soranzo Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 5 ++-- drivers/media/video/em28xx/em28xx-cards.c | 24 +++++++++-------- drivers/media/video/em28xx/em28xx-core.c | 19 +++++++------- drivers/media/video/em28xx/em28xx-i2c.c | 6 +++-- drivers/media/video/em28xx/em28xx-video.c | 43 ++++++++++++++++++------------- drivers/media/video/em28xx/em28xx.h | 6 +++-- 6 files changed, 58 insertions(+), 45 deletions(-) (limited to 'drivers/media/video/em28xx/em28xx-core.c') diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index abbf9ee0d39a..6296697d025f 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -245,7 +245,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, { struct snd_pcm_runtime *runtime = subs->runtime; - dprintk("Alocating vbuffer\n"); + dprintk("Allocating vbuffer\n"); if (runtime->dma_area) { if (runtime->dma_bytes > size) return 0; @@ -409,8 +409,7 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream *substream) { - unsigned long flags; - + unsigned long flags; struct em28xx *dev; snd_pcm_uframes_t hwptr_done; diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 89a8f2657b13..419304d31256 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -244,7 +244,7 @@ struct em28xx_board em28xx_boards[] = { .name = "Hauppauge WinTV USB 2", .tuner_type = TUNER_PHILIPS_FM1236_MK3, .tda9887_conf = TDA9887_PRESENT | - TDA9887_PORT1_ACTIVE| + TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE, .decoder = EM28XX_TVP5150, .has_msp34xx = 1, @@ -517,7 +517,7 @@ struct em28xx_board em28xx_boards[] = { }, [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = { .name = "Yakumo MovieMixer", - .tuner_type = TUNER_ABSENT, /* Capture only device */ + .tuner_type = TUNER_ABSENT, /* Capture only device */ .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -861,11 +861,11 @@ struct em28xx_board em28xx_boards[] = { } }, }, [EM2800_BOARD_GRABBEEX_USB2800] = { - .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder", - .is_em2800 = 1, - .decoder = EM28XX_SAA711X, - .tuner_type = TUNER_ABSENT, /* capture only board */ - .input = { { + .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder", + .is_em2800 = 1, + .decoder = EM28XX_SAA711X, + .tuner_type = TUNER_ABSENT, /* capture only board */ + .input = { { .type = EM28XX_VMUX_COMPOSITE1, .vmux = SAA7115_COMPOSITE0, .amux = EM28XX_AMUX_LINE_IN, @@ -1217,7 +1217,9 @@ struct em28xx_board em28xx_boards[] = { .has_dvb = 1, .dvb_gpio = kworld_330u_digital, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, - .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_EEPROM_ON_BOARD | EM28XX_I2C_EEPROM_KEY_VALID, + .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | + EM28XX_I2C_EEPROM_ON_BOARD | + EM28XX_I2C_EEPROM_KEY_VALID, .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -1299,7 +1301,7 @@ struct em28xx_board em28xx_boards[] = { const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); /* table of devices that work with this driver */ -struct usb_device_id em28xx_id_table [] = { +struct usb_device_id em28xx_id_table[] = { { USB_DEVICE(0xeb1a, 0x2750), .driver_info = EM2750_BOARD_UNKNOWN }, { USB_DEVICE(0xeb1a, 0x2751), @@ -1401,7 +1403,7 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table); /* * EEPROM hash table for devices with generic USB IDs */ -static struct em28xx_hash_table em28xx_eeprom_hash [] = { +static struct em28xx_hash_table em28xx_eeprom_hash[] = { /* P/N: SA 60002070465 Tuner: TVF7533-MF */ {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF}, {0x72cc5a8b, EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2, TUNER_YMEC_TVF_5533MF}, @@ -1433,7 +1435,7 @@ int em28xx_tuner_callback(void *ptr, int component, int command, int arg) } EXPORT_SYMBOL_GPL(em28xx_tuner_callback); -static void inline em28xx_set_model(struct em28xx *dev) +static inline void em28xx_set_model(struct em28xx *dev) { memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board)); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 43f1d0e4c549..eee8d015b249 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -33,8 +33,8 @@ /* #define ENABLE_DEBUG_ISOC_FRAMES */ static unsigned int core_debug; -module_param(core_debug,int,0644); -MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); +module_param(core_debug, int, 0644); +MODULE_PARM_DESC(core_debug, "enable debug messages [core]"); #define em28xx_coredbg(fmt, arg...) do {\ if (core_debug) \ @@ -42,8 +42,8 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); dev->name, __func__ , ##arg); } while (0) static unsigned int reg_debug; -module_param(reg_debug,int,0644); -MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); +module_param(reg_debug, int, 0644); +MODULE_PARM_DESC(reg_debug, "enable debug messages [URB reg]"); #define em28xx_regdbg(fmt, arg...) do {\ if (reg_debug) \ @@ -77,7 +77,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, return -EINVAL; if (reg_debug) { - printk( KERN_DEBUG "(pipe 0x%08x): " + printk(KERN_DEBUG "(pipe 0x%08x): " "IN: %02x %02x %02x %02x %02x %02x %02x %02x ", pipe, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, @@ -154,7 +154,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, if (reg_debug) { int byte; - printk( KERN_DEBUG "(pipe 0x%08x): " + printk(KERN_DEBUG "(pipe 0x%08x): " "OUT: %02x %02x %02x %02x %02x %02x %02x %02x >>>", pipe, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, @@ -462,7 +462,8 @@ int em28xx_audio_analog_set(struct em28xx *dev) if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN) { int sel = ac97_return_record_select(dev->ctl_aoutput); - /* Use the same input for both left and right channels */ + /* Use the same input for both left and right + channels */ sel |= (sel << 8); em28xx_write_ac97(dev, AC97_RECORD_SELECT, sel); @@ -698,7 +699,7 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2); /* it seems that both H and V scalers must be active to work correctly */ - mode = (h || v)? 0x30: 0x00; + mode = (h || v) ? 0x30 : 0x00; } return em28xx_write_reg_bits(dev, EM28XX_R26_COMPR, mode, 0x30); } @@ -958,7 +959,7 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets, em28xx_err("unable to allocate %i bytes for transfer" " buffer %i%s\n", sb_size, i, - in_interrupt()?" while in int":""); + in_interrupt() ? " while in int" : ""); em28xx_uninit_isoc(dev); return -ENOMEM; } diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index d69f0efcc9aa..2dab43d22da2 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -402,10 +402,12 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) dev->name); break; case 2: - printk(KERN_INFO "%s:\tI2S audio, sample rate=32k\n", dev->name); + printk(KERN_INFO "%s:\tI2S audio, sample rate=32k\n", + dev->name); break; case 3: - printk(KERN_INFO "%s:\tI2S audio, 3 sample rates\n", dev->name); + printk(KERN_INFO "%s:\tI2S audio, 3 sample rates\n", + dev->name); break; } diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 5b2a19b0cca6..efd641587e04 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -186,7 +186,8 @@ static void em28xx_copy_video(struct em28xx *dev, em28xx_isocdbg("Overflow of %zi bytes past buffer end (1)\n", ((char *)startwrite + lencopy) - ((char *)outp + buf->vb.size)); - lencopy = remain = (char *)outp + buf->vb.size - (char *)startwrite; + remain = (char *)outp + buf->vb.size - (char *)startwrite; + lencopy = remain; } if (lencopy <= 0) return; @@ -202,7 +203,8 @@ static void em28xx_copy_video(struct em28xx *dev, else lencopy = bytesperline; - if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) { + if ((char *)startwrite + lencopy > (char *)outp + + buf->vb.size) { em28xx_isocdbg("Overflow of %zi bytes past buffer end (2)\n", ((char *)startwrite + lencopy) - ((char *)outp + buf->vb.size)); @@ -347,7 +349,7 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb) } if (p[0] == 0x22 && p[1] == 0x5a) { em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2], - len, (p[2] & 1)? "odd" : "even"); + len, (p[2] & 1) ? "odd" : "even"); if (!(p[2] & 1)) { if (buf != NULL) @@ -476,7 +478,9 @@ fail: static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) { - struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); + struct em28xx_buffer *buf = container_of(vb, + struct em28xx_buffer, + vb); struct em28xx_fh *fh = vq->priv_data; struct em28xx *dev = fh->dev; struct em28xx_dmaqueue *vidq = &dev->vidq; @@ -489,7 +493,9 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) { - struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); + struct em28xx_buffer *buf = container_of(vb, + struct em28xx_buffer, + vb); struct em28xx_fh *fh = vq->priv_data; struct em28xx *dev = (struct em28xx *)fh->dev; @@ -557,7 +563,7 @@ static int res_get(struct em28xx_fh *fh) static int res_check(struct em28xx_fh *fh) { - return (fh->stream_on); + return fh->stream_on; } static void res_free(struct em28xx_fh *fh) @@ -791,7 +797,7 @@ out: return rc; } -static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm) +static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) { struct em28xx_fh *fh = priv; struct em28xx *dev = fh->dev; @@ -1436,7 +1442,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, if (rc < 0) return rc; - return (videobuf_reqbufs(&fh->vb_vidq, rb)); + return videobuf_reqbufs(&fh->vb_vidq, rb); } static int vidioc_querybuf(struct file *file, void *priv, @@ -1450,7 +1456,7 @@ static int vidioc_querybuf(struct file *file, void *priv, if (rc < 0) return rc; - return (videobuf_querybuf(&fh->vb_vidq, b)); + return videobuf_querybuf(&fh->vb_vidq, b); } static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) @@ -1463,7 +1469,7 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) if (rc < 0) return rc; - return (videobuf_qbuf(&fh->vb_vidq, b)); + return videobuf_qbuf(&fh->vb_vidq, b); } static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) @@ -1476,8 +1482,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) if (rc < 0) return rc; - return (videobuf_dqbuf(&fh->vb_vidq, b, - file->f_flags & O_NONBLOCK)); + return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); } #ifdef CONFIG_VIDEO_V4L1_COMPAT @@ -1786,7 +1791,7 @@ em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count, * em28xx_v4l2_poll() * will allocate buffers when called for the first time */ -static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait) +static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table *wait) { struct em28xx_fh *fh = filp->private_data; struct em28xx *dev = fh->dev; @@ -1939,8 +1944,8 @@ static struct video_device em28xx_radio_template = { static struct video_device *em28xx_vdev_init(struct em28xx *dev, - const struct video_device *template, - const char *type_name) + const struct video_device *template, + const char *type_name) { struct video_device *vfd; @@ -1989,8 +1994,9 @@ int em28xx_register_analog_devices(struct em28xx *dev) /* enable vbi capturing */ /* em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */ - val = (u8)em28xx_read_reg(dev, EM28XX_R0F_XCLK); - em28xx_write_reg(dev, EM28XX_R0F_XCLK, (EM28XX_XCLK_AUDIO_UNMUTE | val)); + val = (u8)em28xx_read_reg(dev, EM28XX_R0F_XCLK); + em28xx_write_reg(dev, EM28XX_R0F_XCLK, + (EM28XX_XCLK_AUDIO_UNMUTE | val)); em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51); em28xx_set_outfmt(dev); @@ -2025,7 +2031,8 @@ int em28xx_register_analog_devices(struct em28xx *dev) } if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { - dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, "radio"); + dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, + "radio"); if (!dev->radio_dev) { em28xx_errdev("cannot allocate video_device.\n"); return -ENODEV; diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 6844b98e1b67..5115db3a76a6 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -161,7 +161,8 @@ */ /* time to wait when stopping the isoc transfer */ -#define EM28XX_URB_TIMEOUT msecs_to_jiffies(EM28XX_NUM_BUFS * EM28XX_NUM_PACKETS) +#define EM28XX_URB_TIMEOUT \ + msecs_to_jiffies(EM28XX_NUM_BUFS * EM28XX_NUM_PACKETS) /* time in msecs to wait for i2c writes to finish */ #define EM2800_I2C_WRITE_TIMEOUT 20 @@ -530,7 +531,8 @@ struct em28xx { int num_alt; /* Number of alternative settings */ unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */ struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ - char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ + char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc + transfer */ char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */ /* helper funcs that call usb_control_msg */ -- cgit v1.2.3-59-g8ed1b From 2bd1d9eb1c27034a77c8e1887156da72d6160ae1 Mon Sep 17 00:00:00 2001 From: Vitaly Wool Date: Wed, 4 Mar 2009 08:27:52 -0300 Subject: V4L/DVB (10833): em28xx: enable Compro VideoMate ForYou sound Compro VideoMate uses an external audio DSP chip, controlled via tvaudio module (tda9874a). This patch improves em28xx infrastructure to support an external audio processor and fixes the Compro VideoMate entry to work with it. Signed-off-by: Vitaly Wool Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 21 ++++++++++++++++++++- drivers/media/video/em28xx/em28xx-core.c | 5 +++++ drivers/media/video/em28xx/em28xx-i2c.c | 6 ++++++ drivers/media/video/em28xx/em28xx-video.c | 7 +++++++ drivers/media/video/em28xx/em28xx.h | 1 + 5 files changed, 39 insertions(+), 1 deletion(-) (limited to 'drivers/media/video/em28xx/em28xx-core.c') diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index f7c817765752..650ccfda1428 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -122,6 +122,22 @@ static struct em28xx_reg_seq default_tuner_gpio[] = { { -1, -1, -1, -1}, }; +/* Mute/unmute */ +static struct em28xx_reg_seq compro_unmute_tv_gpio[] = { + {EM28XX_R08_GPIO, 5, 7, 10}, + { -1, -1, -1, -1}, +}; + +static struct em28xx_reg_seq compro_unmute_svid_gpio[] = { + {EM28XX_R08_GPIO, 4, 7, 10}, + { -1, -1, -1, -1}, +}; + +static struct em28xx_reg_seq compro_mute_gpio[] = { + {EM28XX_R08_GPIO, 6, 7, 10}, + { -1, -1, -1, -1}, +}; + /* * Board definitions */ @@ -1225,14 +1241,17 @@ struct em28xx_board em28xx_boards[] = { .tda9887_conf = TDA9887_PRESENT, .decoder = EM28XX_TVP5150, .adecoder = EM28XX_TVAUDIO, + .mute_gpio = compro_mute_gpio, .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, - .amux = EM28XX_AMUX_LINE_IN, + .amux = EM28XX_AMUX_VIDEO, + .gpio = compro_unmute_tv_gpio, }, { .type = EM28XX_VMUX_SVIDEO, .vmux = TVP5150_SVIDEO, .amux = EM28XX_AMUX_LINE_IN, + .gpio = compro_unmute_svid_gpio, } }, }, [EM2860_BOARD_KAIOMY_TVNPC_U2] = { diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index eee8d015b249..c896d24032f5 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -378,6 +378,11 @@ static int em28xx_set_audio_source(struct em28xx *dev) } } + if (dev->board.mute_gpio && dev->mute) + em28xx_gpio_set(dev, dev->board.mute_gpio); + else + em28xx_gpio_set(dev, INPUT(dev->ctl_input)->gpio); + ret = em28xx_write_reg_bits(dev, EM28XX_R0E_AUDIOSRC, input, 0xc0); if (ret < 0) return ret; diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 2dab43d22da2..02c12fe6361b 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -510,12 +510,17 @@ static int attach_inform(struct i2c_client *client) dprintk1(1, "attach_inform: tvp5150 detected.\n"); break; + case 0xb0: + dprintk1(1, "attach_inform: tda9874 detected\n"); + break; + default: if (!dev->tuner_addr) dev->tuner_addr = client->addr; dprintk1(1, "attach inform: detected I2C address %x\n", client->addr << 1); + dprintk1(1, "driver id %d\n", client->driver->id); } @@ -554,6 +559,7 @@ static char *i2c_devs[128] = { [0x80 >> 1] = "msp34xx", [0x88 >> 1] = "msp34xx", [0xa0 >> 1] = "eeprom", + [0xb0 >> 1] = "tda9874", [0xb8 >> 1] = "tvp5150a", [0xba >> 1] = "tvp5150a", [0xc0 >> 1] = "tuner (analog)", diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index efd641587e04..575472f1e702 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -540,6 +540,13 @@ static void video_mux(struct em28xx *dev, int index) &route); } + if (dev->board.adecoder != EM28XX_NOADECODER) { + route.input = dev->ctl_ainput; + route.output = dev->ctl_aoutput; + em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, + &route); + } + em28xx_audio_analog_set(dev); } diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 57a4084f9b5e..a33a58da016e 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -374,6 +374,7 @@ struct em28xx_board { struct em28xx_reg_seq *dvb_gpio; struct em28xx_reg_seq *suspend_gpio; struct em28xx_reg_seq *tuner_gpio; + struct em28xx_reg_seq *mute_gpio; unsigned int is_em2800:1; unsigned int has_msp34xx:1; -- cgit v1.2.3-59-g8ed1b From 9a4f8201a5d241dd725c1e1c796d826e49dcd396 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 22 Mar 2009 23:41:28 -0300 Subject: V4L/DVB (11141): em28xx: fix oops on ARM platform when allocating transfer buffers Add missing URB_NO_TRANSFER_DMA_MAP flag, since the use of consistent memory is not permitted for DMA on the ARM platform. Thanks to Paul Thomas for providing sample ARM hardware that was experiencing the oops (tested on the at91rm9200 based LinuxStamp). Thanks to David Brownell for providing insight into the ARM memory architecture. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/video/em28xx/em28xx-core.c') diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index c896d24032f5..8f1999ca4803 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -982,7 +982,7 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets, em28xx_irq_callback, dma_q, 1); urb->number_of_packets = max_packets; - urb->transfer_flags = URB_ISO_ASAP; + urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; k = 0; for (j = 0; j < max_packets; j++) { -- cgit v1.2.3-59-g8ed1b From f2cf250af156bef127433efd255abfae6aab02f6 Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Tue, 31 Mar 2009 17:10:58 -0300 Subject: V4L/DVB (11331): em28xx: convert to v4l2_subdev Converted em28xx driver to v4l2_subdev. Thanks to Hans Verkuil for helping this conversion. Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 145 ++++++++++++++++++++++++------ drivers/media/video/em28xx/em28xx-core.c | 9 +- drivers/media/video/em28xx/em28xx-i2c.c | 71 +-------------- drivers/media/video/em28xx/em28xx-video.c | 78 ++++++++-------- drivers/media/video/em28xx/em28xx.h | 10 ++- 5 files changed, 172 insertions(+), 141 deletions(-) (limited to 'drivers/media/video/em28xx/em28xx-core.c') diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 0f48c0ff5ac3..fe96da0d54ef 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -1240,6 +1242,7 @@ struct em28xx_board em28xx_boards[] = { [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = { .name = "Compro VideoMate ForYou/Stereo", .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .tvaudio_addr = 0xb0, .tda9887_conf = TDA9887_PRESENT, .decoder = EM28XX_TVP5150, .adecoder = EM28XX_TVAUDIO, @@ -1444,6 +1447,24 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = { {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC}, }; +/* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */ +static unsigned short saa711x_addrs[] = { + 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */ + 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */ + I2C_CLIENT_END }; + +static unsigned short tvp5150_addrs[] = { + 0xb8 >> 1, + 0xba >> 1, + I2C_CLIENT_END +}; + +static unsigned short msp3400_addrs[] = { + 0x80 >> 1, + 0x88 >> 1, + I2C_CLIENT_END +}; + int em28xx_tuner_callback(void *ptr, int component, int command, int arg) { int rc = 0; @@ -1672,31 +1693,55 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl) } } -static void em28xx_config_tuner(struct em28xx *dev) +static void em28xx_tuner_setup(struct em28xx *dev) { - struct v4l2_priv_tun_config xc2028_cfg; struct tuner_setup tun_setup; struct v4l2_frequency f; if (dev->tuner_type == TUNER_ABSENT) return; + memset(&tun_setup, 0, sizeof(tun_setup)); + tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; - tun_setup.type = dev->tuner_type; - tun_setup.addr = dev->tuner_addr; tun_setup.tuner_callback = em28xx_tuner_callback; - em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); + if (dev->board.radio.type) { + tun_setup.type = dev->board.radio.type; + tun_setup.addr = dev->board.radio_addr; + + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup); + } + + if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) { + tun_setup.type = dev->tuner_type; + tun_setup.addr = dev->tuner_addr; + + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup); + } + + if (dev->tda9887_conf) { + struct v4l2_priv_tun_config tda9887_cfg; + + tda9887_cfg.tuner = TUNER_TDA9887; + tda9887_cfg.priv = &dev->tda9887_conf; + + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &tda9887_cfg); + } if (dev->tuner_type == TUNER_XC2028) { + struct v4l2_priv_tun_config xc2028_cfg; struct xc2028_ctrl ctl; + memset(&xc2028_cfg, 0, sizeof(xc2028_cfg)); + memset(&ctl, 0, sizeof(ctl)); + em28xx_setup_xc3028(dev, &ctl); xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; - em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, &xc2028_cfg); } /* configure tuner */ @@ -1704,7 +1749,7 @@ static void em28xx_config_tuner(struct em28xx *dev) f.type = V4L2_TUNER_ANALOG_TV; f.frequency = 9076; /* just a magic number */ dev->ctl_freq = f.frequency; - em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); } static int em28xx_hint_board(struct em28xx *dev) @@ -1911,22 +1956,50 @@ void em28xx_card_setup(struct em28xx *dev) if (tuner >= 0) dev->tuner_type = tuner; -#ifdef CONFIG_MODULES /* request some modules */ if (dev->board.has_msp34xx) - request_module("msp3400"); + v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "msp3400", + "msp3400", msp3400_addrs); + if (dev->board.decoder == EM28XX_SAA711X) - request_module("saa7115"); + v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "saa7115", + "saa7115_auto", saa711x_addrs); + if (dev->board.decoder == EM28XX_TVP5150) - request_module("tvp5150"); - if (dev->board.tuner_type != TUNER_ABSENT) - request_module("tuner"); - if (dev->board.adecoder == EM28XX_TVAUDIO) - request_module("tvaudio"); -#endif + v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tvp5150", + "tvp5150", tvp5150_addrs); - em28xx_config_tuner(dev); + if (dev->board.adecoder == EM28XX_TVAUDIO) + v4l2_i2c_new_subdev(&dev->i2c_adap, "tvaudio", + "tvaudio", dev->board.tvaudio_addr); + + if (dev->board.tuner_type != TUNER_ABSENT) { + int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); + + if (dev->board.radio.type) + v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner", + dev->board.radio_addr); + + if (has_demod) + v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner", + "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); + if (dev->tuner_addr == 0) { + enum v4l2_i2c_tuner_type type = + has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; + struct v4l2_subdev *sd; + + sd = v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner", + "tuner", v4l2_i2c_tuner_addrs(type)); + + if (sd) + dev->tuner_addr = v4l2_i2c_subdev_addr(sd); + } else { + v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", + "tuner", dev->tuner_addr); + } + } + em28xx_tuner_setup(dev); em28xx_ir_init(dev); } @@ -1975,6 +2048,9 @@ void em28xx_release_resources(struct em28xx *dev) em28xx_remove_from_devlist(dev); em28xx_i2c_unregister(dev); + + v4l2_device_unregister(&dev->v4l2_dev); + usb_put_dev(dev->udev); /* Mark device as unused */ @@ -2019,9 +2095,16 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, } } + retval = v4l2_device_register(&dev->udev->dev, &dev->v4l2_dev); + if (retval < 0) { + em28xx_errdev("Call to v4l2_device_register() failed!\n"); + return retval; + } + /* register i2c bus */ errCode = em28xx_i2c_register(dev); if (errCode < 0) { + v4l2_device_unregister(&dev->v4l2_dev); em28xx_errdev("%s: em28xx_i2c_register - errCode [%d]!\n", __func__, errCode); return errCode; @@ -2033,6 +2116,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, /* Configure audio */ errCode = em28xx_audio_setup(dev); if (errCode < 0) { + v4l2_device_unregister(&dev->v4l2_dev); em28xx_errdev("%s: Error while setting audio - errCode [%d]!\n", __func__, errCode); } @@ -2077,7 +2161,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, em28xx_init_extension(dev); /* Save some power by putting tuner to sleep */ - em28xx_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_standby, 0); return 0; @@ -2096,7 +2180,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, struct usb_device *udev; struct usb_interface *uif; struct em28xx *dev = NULL; - int retval = -ENODEV; + int retval; int i, nr, ifnum, isoc_pipe; char *speed; char descr[255] = ""; @@ -2118,7 +2202,8 @@ static int em28xx_usb_probe(struct usb_interface *interface, interface->altsetting[0].desc.bInterfaceClass); em28xx_devused &= ~(1<cur_altsetting->endpoint[0].desc; @@ -2151,7 +2236,8 @@ static int em28xx_usb_probe(struct usb_interface *interface, "interface not used by the driver\n"); em28xx_devused &= ~(1<name, 29, "em28xx #%d", nr); @@ -2229,7 +2317,8 @@ static int em28xx_usb_probe(struct usb_interface *interface, em28xx_errdev("out of memory!\n"); em28xx_devused &= ~(1<num_alt ; i++) { @@ -2248,8 +2337,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, if (retval) { em28xx_devused &= ~(1<devno); kfree(dev); - - return retval; + goto err; } /* save our data pointer in this interface device */ @@ -2263,6 +2351,9 @@ static int em28xx_usb_probe(struct usb_interface *interface, mutex_unlock(&dev->lock); return 0; + +err: + return retval; } /* @@ -2288,6 +2379,8 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) wake_up_interruptible_all(&dev->open); + v4l2_device_disconnect(&dev->v4l2_dev); + if (dev->users) { em28xx_warn ("device /dev/video%d is open! Deregistration and memory " diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 8f1999ca4803..8f8f20e14713 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -1021,11 +1021,12 @@ void em28xx_wake_i2c(struct em28xx *dev) struct v4l2_routing route; int zero = 0; - route.input = INPUT(dev->ctl_input)->vmux; + route.input = INPUT(dev->ctl_input)->vmux; route.output = 0; - em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, &zero); - em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); - em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL); + + v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, zero); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); } /* diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 02c12fe6361b..f0bf1d960c75 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -459,70 +459,15 @@ static u32 functionality(struct i2c_adapter *adap) static int attach_inform(struct i2c_client *client) { struct em28xx *dev = client->adapter->algo_data; + struct IR_i2c *ir = i2c_get_clientdata(client); switch (client->addr << 1) { - case 0x86: - case 0x84: - case 0x96: - case 0x94: - { - struct v4l2_priv_tun_config tda9887_cfg; - - struct tuner_setup tun_setup; - - tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; - tun_setup.type = TUNER_TDA9887; - tun_setup.addr = client->addr; - - em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, - &tun_setup); - - tda9887_cfg.tuner = TUNER_TDA9887; - tda9887_cfg.priv = &dev->tda9887_conf; - em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, - &tda9887_cfg); - break; - } - case 0x42: - dprintk1(1, "attach_inform: saa7114 detected.\n"); - break; - case 0x4a: - dprintk1(1, "attach_inform: saa7113 detected.\n"); - break; - case 0xa0: - dprintk1(1, "attach_inform: eeprom detected.\n"); - break; case 0x60: case 0x8e: - { - struct IR_i2c *ir = i2c_get_clientdata(client); - dprintk1(1, "attach_inform: IR detected (%s).\n", - ir->phys); + dprintk1(1, "attach_inform: IR detected (%s).\n", ir->phys); em28xx_set_ir(dev, ir); break; } - case 0x80: - case 0x88: - dprintk1(1, "attach_inform: msp34xx detected.\n"); - break; - case 0xb8: - case 0xba: - dprintk1(1, "attach_inform: tvp5150 detected.\n"); - break; - - case 0xb0: - dprintk1(1, "attach_inform: tda9874 detected\n"); - break; - - default: - if (!dev->tuner_addr) - dev->tuner_addr = client->addr; - - dprintk1(1, "attach inform: detected I2C address %x\n", - client->addr << 1); - dprintk1(1, "driver id %d\n", client->driver->id); - - } return 0; } @@ -534,7 +479,6 @@ static struct i2c_algorithm em28xx_algo = { static struct i2c_adapter em28xx_adap_template = { .owner = THIS_MODULE, - .class = I2C_CLASS_TV_ANALOG, .name = "em28xx", .id = I2C_HW_B_EM28XX, .algo = &em28xx_algo, @@ -594,16 +538,6 @@ void em28xx_do_i2c_scan(struct em28xx *dev) ARRAY_SIZE(i2c_devicelist), 32); } -/* - * em28xx_i2c_call_clients() - * send commands to all attached i2c devices - */ -void em28xx_i2c_call_clients(struct em28xx *dev, unsigned int cmd, void *arg) -{ - BUG_ON(NULL == dev->i2c_adap.algo_data); - i2c_clients_command(&dev->i2c_adap, cmd, arg); -} - /* * em28xx_i2c_register() * register i2c bus @@ -618,6 +552,7 @@ int em28xx_i2c_register(struct em28xx *dev) dev->i2c_adap.dev.parent = &dev->udev->dev; strcpy(dev->i2c_adap.name, dev->name); dev->i2c_adap.algo_data = dev; + i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev); retval = i2c_add_adapter(&dev->i2c_adap); if (retval < 0) { diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 575472f1e702..6c09a37e4048 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -49,7 +49,7 @@ "Sascha Sommer " #define DRIVER_DESC "Empia em28xx based USB video device driver" -#define EM28XX_VERSION_CODE KERNEL_VERSION(0, 1, 1) +#define EM28XX_VERSION_CODE KERNEL_VERSION(0, 1, 2) #define em28xx_videodbg(fmt, arg...) do {\ if (video_debug) \ @@ -400,7 +400,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) f.frequency = dev->ctl_freq; f.type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; - em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); return 0; } @@ -526,25 +526,25 @@ static void video_mux(struct em28xx *dev, int index) if (!dev->ctl_aoutput) dev->ctl_aoutput = EM28XX_AOUT_MASTER; - em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route); if (dev->board.has_msp34xx) { if (dev->i2s_speed) { - em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, - &dev->i2s_speed); + v4l2_device_call_all(&dev->v4l2_dev, 0, audio, + s_i2s_clock_freq, dev->i2s_speed); } - route.input = dev->ctl_ainput; + route.input = dev->ctl_ainput; route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); + /* Note: this is msp3400 specific */ - em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, - &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route); } if (dev->board.adecoder != EM28XX_NOADECODER) { - route.input = dev->ctl_ainput; + route.input = dev->ctl_ainput; route.output = dev->ctl_aoutput; - em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, - &route); + + v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route); } em28xx_audio_analog_set(dev); @@ -829,7 +829,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); em28xx_resolution_set(dev); - em28xx_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_std, dev->norm); mutex_unlock(&dev->lock); return 0; @@ -995,8 +995,9 @@ static int vidioc_queryctrl(struct file *file, void *priv, } } } + mutex_lock(&dev->lock); - em28xx_i2c_call_clients(dev, VIDIOC_QUERYCTRL, qc); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, queryctrl, qc); mutex_unlock(&dev->lock); if (qc->type) @@ -1020,11 +1021,11 @@ static int vidioc_g_ctrl(struct file *file, void *priv, mutex_lock(&dev->lock); if (dev->board.has_msp34xx) - em28xx_i2c_call_clients(dev, VIDIOC_G_CTRL, ctrl); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_ctrl, ctrl); else { rc = em28xx_get_ctrl(dev, ctrl); if (rc < 0) { - em28xx_i2c_call_clients(dev, VIDIOC_G_CTRL, ctrl); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_ctrl, ctrl); rc = 0; } } @@ -1048,7 +1049,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, mutex_lock(&dev->lock); if (dev->board.has_msp34xx) - em28xx_i2c_call_clients(dev, VIDIOC_S_CTRL, ctrl); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl); else { rc = 1; for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) { @@ -1067,7 +1068,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, /* Control not found - try to send it to the attached devices */ if (rc == 1) { - em28xx_i2c_call_clients(dev, VIDIOC_S_CTRL, ctrl); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl); rc = 0; } @@ -1092,10 +1093,9 @@ static int vidioc_g_tuner(struct file *file, void *priv, strcpy(t->name, "Tuner"); mutex_lock(&dev->lock); - - em28xx_i2c_call_clients(dev, VIDIOC_G_TUNER, t); - + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); mutex_unlock(&dev->lock); + return 0; } @@ -1114,10 +1114,9 @@ static int vidioc_s_tuner(struct file *file, void *priv, return -EINVAL; mutex_lock(&dev->lock); - - em28xx_i2c_call_clients(dev, VIDIOC_S_TUNER, t); - + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); mutex_unlock(&dev->lock); + return 0; } @@ -1157,7 +1156,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, mutex_lock(&dev->lock); dev->ctl_freq = f->frequency; - em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); mutex_unlock(&dev->lock); @@ -1186,7 +1185,7 @@ static int vidioc_g_chip_ident(struct file *file, void *priv, chip->ident = V4L2_IDENT_NONE; chip->revision = 0; - em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_chip_ident, chip); return 0; } @@ -1211,7 +1210,7 @@ static int vidioc_g_register(struct file *file, void *priv, reg->size = 1; return 0; case V4L2_CHIP_MATCH_I2C_DRIVER: - em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_register, reg); return 0; case V4L2_CHIP_MATCH_I2C_ADDR: /* Not supported yet */ @@ -1263,7 +1262,7 @@ static int vidioc_s_register(struct file *file, void *priv, return rc; case V4L2_CHIP_MATCH_I2C_DRIVER: - em28xx_i2c_call_clients(dev, VIDIOC_DBG_S_REGISTER, reg); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_register, reg); return 0; case V4L2_CHIP_MATCH_I2C_ADDR: /* Not supported yet */ @@ -1406,13 +1405,13 @@ static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv, mutex_lock(&dev->lock); f->fmt.sliced.service_set = 0; - - em28xx_i2c_call_clients(dev, VIDIOC_G_FMT, f); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, g_fmt, f); if (f->fmt.sliced.service_set == 0) rc = -EINVAL; mutex_unlock(&dev->lock); + return rc; } @@ -1428,7 +1427,7 @@ static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv, return rc; mutex_lock(&dev->lock); - em28xx_i2c_call_clients(dev, VIDIOC_G_FMT, f); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, g_fmt, f); mutex_unlock(&dev->lock); if (f->fmt.sliced.service_set == 0) @@ -1532,7 +1531,7 @@ static int radio_g_tuner(struct file *file, void *priv, t->type = V4L2_TUNER_RADIO; mutex_lock(&dev->lock); - em28xx_i2c_call_clients(dev, VIDIOC_G_TUNER, t); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); mutex_unlock(&dev->lock); return 0; @@ -1567,7 +1566,7 @@ static int radio_s_tuner(struct file *file, void *priv, return -EINVAL; mutex_lock(&dev->lock); - em28xx_i2c_call_clients(dev, VIDIOC_S_TUNER, t); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); mutex_unlock(&dev->lock); return 0; @@ -1655,7 +1654,7 @@ static int em28xx_v4l2_open(struct file *filp) } if (fh->radio) { em28xx_videodbg("video_open: setting radio device\n"); - em28xx_i2c_call_clients(dev, AUDC_SET_RADIO, NULL); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_radio); } dev->users++; @@ -1738,7 +1737,7 @@ static int em28xx_v4l2_close(struct file *filp) } /* Save some power by putting tuner to sleep */ - em28xx_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_standby, 0); /* do this before setting alternate! */ em28xx_uninit_isoc(dev); @@ -1959,11 +1958,12 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, vfd = video_device_alloc(); if (NULL == vfd) return NULL; - *vfd = *template; - vfd->minor = -1; - vfd->parent = &dev->udev->dev; - vfd->release = video_device_release; - vfd->debug = video_debug; + + *vfd = *template; + vfd->minor = -1; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->release = video_device_release; + vfd->debug = video_debug; snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name); diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index a33a58da016e..4c4e58004f54 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -385,6 +386,8 @@ struct em28xx_board { unsigned int valid:1; unsigned char xclk, i2c_speed; + unsigned char radio_addr; + unsigned short tvaudio_addr; enum em28xx_decoder decoder; enum em28xx_adecoder adecoder; @@ -460,6 +463,7 @@ struct em28xx { int devno; /* marks the number of this device */ enum em28xx_chip_id chip_id; + struct v4l2_device v4l2_dev; struct em28xx_board board; unsigned int stream_on:1; /* Locks streams */ @@ -577,11 +581,9 @@ struct em28xx_ops { }; /* Provided by em28xx-i2c.c */ - -void em28xx_i2c_call_clients(struct em28xx *dev, unsigned int cmd, void *arg); void em28xx_do_i2c_scan(struct em28xx *dev); -int em28xx_i2c_register(struct em28xx *dev); -int em28xx_i2c_unregister(struct em28xx *dev); +int em28xx_i2c_register(struct em28xx *dev); +int em28xx_i2c_unregister(struct em28xx *dev); /* Provided by em28xx-core.c */ -- cgit v1.2.3-59-g8ed1b From 5325b4272a53b43f55b82cc369c310c2fcacdca1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 2 Apr 2009 11:26:22 -0300 Subject: V4L/DVB (11380): v4l2-subdev: change s_routing prototype It is no longer needed to use a struct pointer as argument, since v4l2_subdev doesn't require that ioctl-like approach anymore. Instead just pass the input, output and config (new!) arguments directly. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/au8522_decoder.c | 12 +-- drivers/media/video/adv7170.c | 19 ++-- drivers/media/video/adv7175.c | 17 ++-- drivers/media/video/au0828/au0828-video.c | 10 +- drivers/media/video/bt819.c | 11 ++- drivers/media/video/bt856.c | 11 ++- drivers/media/video/bt866.c | 11 ++- drivers/media/video/bt8xx/bttv-driver.c | 23 ++--- drivers/media/video/cs5345.c | 11 ++- drivers/media/video/cs53l32a.c | 9 +- drivers/media/video/cx18/cx18-audio.c | 9 +- drivers/media/video/cx18/cx18-av-core.c | 8 +- drivers/media/video/cx18/cx18-gpio.c | 4 +- drivers/media/video/cx18/cx18-ioctl.c | 2 +- drivers/media/video/cx18/cx18-video.c | 16 +-- drivers/media/video/cx231xx/cx231xx-cards.c | 5 +- drivers/media/video/cx231xx/cx231xx-video.c | 7 +- drivers/media/video/cx23885/cx23885-video.c | 8 +- drivers/media/video/cx25840/cx25840-core.c | 10 +- drivers/media/video/cx88/cx88-video.c | 12 +-- drivers/media/video/em28xx/em28xx-core.c | 11 +-- drivers/media/video/em28xx/em28xx-video.c | 19 ++-- drivers/media/video/ivtv/ivtv-gpio.c | 16 +-- drivers/media/video/ivtv/ivtv-ioctl.c | 10 +- drivers/media/video/ivtv/ivtv-routing.c | 66 +++++++------ drivers/media/video/ks0127.c | 17 ++-- drivers/media/video/m52790.c | 7 +- drivers/media/video/msp3400-driver.c | 25 ++--- drivers/media/video/msp3400-driver.h | 3 +- drivers/media/video/msp3400-kthreads.c | 6 +- drivers/media/video/mxb.c | 115 +++++++++------------- drivers/media/video/pvrusb2/pvrusb2-audio.c | 8 +- drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c | 7 +- drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c | 9 +- drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | 8 +- drivers/media/video/pvrusb2/pvrusb2-wm8775.c | 12 +-- drivers/media/video/saa7110.c | 13 +-- drivers/media/video/saa7115.c | 30 +++--- drivers/media/video/saa7127.c | 11 ++- drivers/media/video/saa717x.c | 23 ++--- drivers/media/video/saa7185.c | 9 +- drivers/media/video/saa7191.c | 6 +- drivers/media/video/tea6415c.c | 5 +- drivers/media/video/tea6420.c | 17 ++-- drivers/media/video/tvaudio.c | 7 +- drivers/media/video/tvp5150.c | 21 ++-- drivers/media/video/upd64031a.c | 11 ++- drivers/media/video/upd64083.c | 9 +- drivers/media/video/usbvision/usbvision-core.c | 5 +- drivers/media/video/vino.c | 10 +- drivers/media/video/vpx3220.c | 19 ++-- drivers/media/video/wm8775.c | 9 +- drivers/media/video/zoran/zoran_card.c | 4 +- drivers/media/video/zoran/zoran_device.c | 20 ++-- drivers/media/video/zoran/zoran_driver.c | 20 ++-- include/media/msp3400.h | 4 +- include/media/v4l2-subdev.h | 7 +- 57 files changed, 370 insertions(+), 444 deletions(-) (limited to 'drivers/media/video/em28xx/em28xx-core.c') diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c index d63e1527dc88..9e9a75576a1d 100644 --- a/drivers/media/dvb/frontends/au8522_decoder.c +++ b/drivers/media/dvb/frontends/au8522_decoder.c @@ -652,7 +652,7 @@ static int au8522_reset(struct v4l2_subdev *sd, u32 val) } static int au8522_s_video_routing(struct v4l2_subdev *sd, - const struct v4l2_routing *route) + u32 input, u32 output, u32 config) { struct au8522_state *state = to_state(sd); @@ -663,11 +663,11 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd, closed), and then came back to analog mode */ au8522_writereg(state, 0x106, 1); - if (route->input == AU8522_COMPOSITE_CH1) { + if (input == AU8522_COMPOSITE_CH1) { au8522_setup_cvbs_mode(state); - } else if (route->input == AU8522_SVIDEO_CH13) { + } else if (input == AU8522_SVIDEO_CH13) { au8522_setup_svideo_mode(state); - } else if (route->input == AU8522_COMPOSITE_CH4_SIF) { + } else if (input == AU8522_COMPOSITE_CH4_SIF) { au8522_setup_cvbs_tuner_mode(state); } else { printk(KERN_ERR "au8522 mode not currently supported\n"); @@ -677,10 +677,10 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd, } static int au8522_s_audio_routing(struct v4l2_subdev *sd, - const struct v4l2_routing *route) + u32 input, u32 output, u32 config) { struct au8522_state *state = to_state(sd); - set_audio_input(state, route->input); + set_audio_input(state, input); return 0; } diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 873c30a41bd7..97b003449c91 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c @@ -219,18 +219,19 @@ static int adv7170_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int adv7170_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int adv7170_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct adv7170 *encoder = to_adv7170(sd); - /* RJ: route->input = 0: input is from decoder - route->input = 1: input is from ZR36060 - route->input = 2: color bar */ + /* RJ: input = 0: input is from decoder + input = 1: input is from ZR36060 + input = 2: color bar */ v4l2_dbg(1, debug, sd, "set input from %s\n", - route->input == 0 ? "decoder" : "ZR36060"); + input == 0 ? "decoder" : "ZR36060"); - switch (route->input) { + switch (input) { case 0: adv7170_write(sd, 0x01, 0x20); adv7170_write(sd, 0x08, TR1CAPT); /* TR1 */ @@ -250,11 +251,11 @@ static int adv7170_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing * break; default: - v4l2_dbg(1, debug, sd, "illegal input: %d\n", route->input); + v4l2_dbg(1, debug, sd, "illegal input: %d\n", input); return -EINVAL; } - v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[route->input]); - encoder->input = route->input; + v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[input]); + encoder->input = input; return 0; } diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index ff1210303295..cf8c06c85ded 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c @@ -237,15 +237,16 @@ static int adv7175_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int adv7175_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int adv7175_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct adv7175 *encoder = to_adv7175(sd); - /* RJ: route->input = 0: input is from decoder - route->input = 1: input is from ZR36060 - route->input = 2: color bar */ + /* RJ: input = 0: input is from decoder + input = 1: input is from ZR36060 + input = 2: color bar */ - switch (route->input) { + switch (input) { case 0: adv7175_write(sd, 0x01, 0x00); @@ -288,11 +289,11 @@ static int adv7175_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing * break; default: - v4l2_dbg(1, debug, sd, "illegal input: %d\n", route->input); + v4l2_dbg(1, debug, sd, "illegal input: %d\n", input); return -EINVAL; } - v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[route->input]); - encoder->input = route->input; + v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[input]); + encoder->input = input; return 0; } diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 19b23f21f968..27bedc6c7791 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c @@ -1154,7 +1154,6 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) struct au0828_fh *fh = priv; struct au0828_dev *dev = fh->dev; int i; - struct v4l2_routing route; dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __func__, index); @@ -1180,9 +1179,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) break; } - route.input = AUVI_INPUT(index).vmux; - route.output = 0; - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, + AUVI_INPUT(index).vmux, 0, 0); for (i = 0; i < AU0828_MAX_INPUT; i++) { int enable = 0; @@ -1205,8 +1203,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) } } - route.input = AUVI_INPUT(index).amux; - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, + AUVI_INPUT(index).amux, 0, 0); return 0; } diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 9f84032ce38c..f9330e3529c3 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c @@ -292,21 +292,22 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int bt819_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int bt819_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct bt819 *decoder = to_bt819(sd); - v4l2_dbg(1, debug, sd, "set input %x\n", route->input); + v4l2_dbg(1, debug, sd, "set input %x\n", input); - if (route->input < 0 || route->input > 7) + if (input < 0 || input > 7) return -EINVAL; if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL) v4l2_err(sd, "no notify found!\n"); - if (decoder->input != route->input) { + if (decoder->input != input) { v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0); - decoder->input = route->input; + decoder->input = input; /* select mode */ if (decoder->input == 0) { bt819_setbit(decoder, 0x0b, 6, 0); diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 78db39503947..d0b4d4925ff8 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c @@ -142,16 +142,17 @@ static int bt856_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int bt856_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int bt856_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct bt856 *encoder = to_bt856(sd); - v4l2_dbg(1, debug, sd, "set input %d\n", route->input); + v4l2_dbg(1, debug, sd, "set input %d\n", input); /* We only have video bus. - * route->input= 0: input is from bt819 - * route->input= 1: input is from ZR36060 */ - switch (route->input) { + * input= 0: input is from bt819 + * input= 1: input is from ZR36060 */ + switch (input) { case 0: bt856_setbit(encoder, 0xde, 4, 0); bt856_setbit(encoder, 0xde, 3, 1); diff --git a/drivers/media/video/bt866.c b/drivers/media/video/bt866.c index 350cae4b02c3..af7e3a5bac9f 100644 --- a/drivers/media/video/bt866.c +++ b/drivers/media/video/bt866.c @@ -99,7 +99,8 @@ static int bt866_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int bt866_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int bt866_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { static const __u8 init[] = { 0xc8, 0xcc, /* CRSCALE */ @@ -137,7 +138,7 @@ static int bt866_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro val = encoder->reg[0xdc]; - if (route->input == 0) + if (input == 0) val |= 0x40; /* CBSWAP */ else val &= ~0x40; /* !CBSWAP */ @@ -145,15 +146,15 @@ static int bt866_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro bt866_write(encoder, 0xdc, val); val = encoder->reg[0xcc]; - if (route->input == 2) + if (input == 2) val |= 0x01; /* OSDBAR */ else val &= ~0x01; /* !OSDBAR */ bt866_write(encoder, 0xcc, val); - v4l2_dbg(1, debug, sd, "set input %d\n", route->input); + v4l2_dbg(1, debug, sd, "set input %d\n", input); - switch (route->input) { + switch (input) { case 0: case 1: case 2: diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 41c31eabe261..74f619d6cc93 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -1198,7 +1198,7 @@ audio_mux(struct bttv *btv, int input, int mute) ctrl.value = btv->mute; bttv_call_all(btv, core, s_ctrl, &ctrl); if (btv->sd_msp34xx) { - struct v4l2_routing route; + u32 in; /* Note: the inputs tuner/radio/extern/intern are translated to msp routings. This assumes common behavior for all msp3400 @@ -1207,11 +1207,11 @@ audio_mux(struct bttv *btv, int input, int mute) For now this is sufficient. */ switch (input) { case TVAUDIO_INPUT_RADIO: - route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1, + in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1, MSP_DSP_IN_SCART, MSP_DSP_IN_SCART); break; case TVAUDIO_INPUT_EXTERN: - route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1, + in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1, MSP_DSP_IN_SCART, MSP_DSP_IN_SCART); break; case TVAUDIO_INPUT_INTERN: @@ -1220,7 +1220,7 @@ audio_mux(struct bttv *btv, int input, int mute) input is the BTTV_BOARD_AVERMEDIA98. I wonder how that was tested. My guess is that the whole INTERN input does not work. */ - route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1, + in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1, MSP_DSP_IN_SCART, MSP_DSP_IN_SCART); break; case TVAUDIO_INPUT_TUNER: @@ -1229,21 +1229,18 @@ audio_mux(struct bttv *btv, int input, int mute) is the only difference between the VOODOOTV_FM and VOODOOTV_200 */ if (btv->c.type == BTTV_BOARD_VOODOOTV_200) - route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \ + in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \ MSP_DSP_IN_TUNER, MSP_DSP_IN_TUNER); else - route.input = MSP_INPUT_DEFAULT; + in = MSP_INPUT_DEFAULT; break; } - route.output = MSP_OUTPUT_DEFAULT; - v4l2_subdev_call(btv->sd_msp34xx, audio, s_routing, &route); + v4l2_subdev_call(btv->sd_msp34xx, audio, s_routing, + in, MSP_OUTPUT_DEFAULT, 0); } if (btv->sd_tvaudio) { - struct v4l2_routing route; - - route.input = input; - route.output = 0; - v4l2_subdev_call(btv->sd_tvaudio, audio, s_routing, &route); + v4l2_subdev_call(btv->sd_tvaudio, audio, s_routing, + input, 0, 0); } return 0; } diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c index 9714059ee949..57dc1704b6c0 100644 --- a/drivers/media/video/cs5345.c +++ b/drivers/media/video/cs5345.c @@ -53,14 +53,15 @@ static inline int cs5345_read(struct v4l2_subdev *sd, u8 reg) return i2c_smbus_read_byte_data(client, reg); } -static int cs5345_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int cs5345_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { - if ((route->input & 0xf) > 6) { - v4l2_err(sd, "Invalid input %d.\n", route->input); + if ((input & 0xf) > 6) { + v4l2_err(sd, "Invalid input %d.\n", input); return -EINVAL; } - cs5345_write(sd, 0x09, route->input & 0xf); - cs5345_write(sd, 0x05, route->input & 0xf0); + cs5345_write(sd, 0x09, input & 0xf); + cs5345_write(sd, 0x05, input & 0xf0); return 0; } diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 5aeb066857a7..80bca8df9fbf 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c @@ -58,17 +58,18 @@ static int cs53l32a_read(struct v4l2_subdev *sd, u8 reg) return i2c_smbus_read_byte_data(client, reg); } -static int cs53l32a_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int cs53l32a_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { /* There are 2 physical inputs, but the second input can be placed in two modes, the first mode bypasses the PGA (gain), the second goes through the PGA. Hence there are three possible inputs to choose from. */ - if (route->input > 2) { - v4l2_err(sd, "Invalid input %d.\n", route->input); + if (input > 2) { + v4l2_err(sd, "Invalid input %d.\n", input); return -EINVAL; } - cs53l32a_write(sd, 0x01, 0x01 + (route->input << 4)); + cs53l32a_write(sd, 0x01, 0x01 + (input << 4)); return 0; } diff --git a/drivers/media/video/cx18/cx18-audio.c b/drivers/media/video/cx18/cx18-audio.c index bb5c5165dd5f..1519e91c677a 100644 --- a/drivers/media/video/cx18/cx18-audio.c +++ b/drivers/media/video/cx18/cx18-audio.c @@ -33,7 +33,6 @@ int cx18_audio_set_io(struct cx18 *cx) { const struct cx18_card_audio_input *in; - struct v4l2_routing route; u32 val; int err; @@ -44,13 +43,11 @@ int cx18_audio_set_io(struct cx18 *cx) in = &cx->card->audio_inputs[cx->audio_input]; /* handle muxer chips */ - route.input = in->muxer_input; - route.output = 0; - v4l2_subdev_call(cx->sd_extmux, audio, s_routing, &route); + v4l2_subdev_call(cx->sd_extmux, audio, s_routing, + in->audio_input, 0, 0); - route.input = in->audio_input; err = cx18_call_hw_err(cx, cx->card->hw_audio_ctrl, - audio, s_routing, &route); + audio, s_routing, in->audio_input, 0, 0); if (err) return err; diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c index 9b3e574dd829..cf2bd888a429 100644 --- a/drivers/media/video/cx18/cx18-av-core.c +++ b/drivers/media/video/cx18/cx18-av-core.c @@ -547,19 +547,19 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, } static int cx18_av_s_video_routing(struct v4l2_subdev *sd, - const struct v4l2_routing *route) + u32 input, u32 output, u32 config) { struct cx18_av_state *state = to_cx18_av_state(sd); struct cx18 *cx = v4l2_get_subdevdata(sd); - return set_input(cx, route->input, state->aud_input); + return set_input(cx, input, state->aud_input); } static int cx18_av_s_audio_routing(struct v4l2_subdev *sd, - const struct v4l2_routing *route) + u32 input, u32 output, u32 config) { struct cx18_av_state *state = to_cx18_av_state(sd); struct cx18 *cx = v4l2_get_subdevdata(sd); - return set_input(cx, state->vid_input, route->input); + return set_input(cx, state->vid_input, input); } static int cx18_av_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c index ae2460e6860a..86a204b5448e 100644 --- a/drivers/media/video/cx18/cx18-gpio.c +++ b/drivers/media/video/cx18/cx18-gpio.c @@ -156,12 +156,12 @@ static int gpiomux_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) } static int gpiomux_s_audio_routing(struct v4l2_subdev *sd, - const struct v4l2_routing *route) + u32 input, u32 output, u32 config) { struct cx18 *cx = v4l2_get_subdevdata(sd); u32 data; - switch (route->input) { + switch (input) { case 0: data = cx->card->gpio_audio_input.tuner; break; diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c index f572080590fb..cdefd90d5eca 100644 --- a/drivers/media/video/cx18/cx18-ioctl.c +++ b/drivers/media/video/cx18/cx18-ioctl.c @@ -932,7 +932,7 @@ static long cx18_default(struct file *file, void *fh, int cmd, void *arg) CX18_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING(%d, %d)\n", route->input, route->output); cx18_call_hw(cx, cx->card->hw_audio_ctrl, audio, s_routing, - route); + route->input, route->output, 0); break; } diff --git a/drivers/media/video/cx18/cx18-video.c b/drivers/media/video/cx18/cx18-video.c index 6fdadedf17a8..6dc84aac8f44 100644 --- a/drivers/media/video/cx18/cx18-video.c +++ b/drivers/media/video/cx18/cx18-video.c @@ -25,20 +25,8 @@ void cx18_video_set_io(struct cx18 *cx) { - struct v4l2_routing route; int inp = cx->active_input; - u32 type; - route.input = cx->card->video_inputs[inp].video_input; - route.output = 0; - v4l2_subdev_call(cx->sd_av, video, s_routing, &route); - - type = cx->card->video_inputs[inp].video_type; - - if (type == CX18_CARD_INPUT_VID_TUNER) - route.input = 0; /* Tuner */ - else if (type < CX18_CARD_INPUT_COMPOSITE1) - route.input = 2; /* S-Video */ - else - route.input = 1; /* Composite */ + v4l2_subdev_call(cx->sd_av, video, s_routing, + cx->card->video_inputs[inp].video_input, 0, 0); } diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index f209fe14f829..c8a32b1b5381 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c @@ -357,10 +357,7 @@ int cx231xx_config(struct cx231xx *dev) */ void cx231xx_config_i2c(struct cx231xx *dev) { - struct v4l2_routing route; - - route.input = INPUT(dev->video_input)->vmux; - route.output = 0; + /* u32 input = INPUT(dev->video_input)->vmux; */ call_all(dev, video, s_stream, 1); } diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index 0645703e6f9c..a23ae73fe634 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c @@ -820,17 +820,12 @@ static struct videobuf_queue_ops cx231xx_video_qops = { void video_mux(struct cx231xx *dev, int index) { - - struct v4l2_routing route; - - route.input = INPUT(index)->vmux; - route.output = 0; dev->video_input = index; dev->ctl_ainput = INPUT(index)->amux; cx231xx_set_video_input_mux(dev, index); - cx25840_call(dev, video, s_routing, &route); + cx25840_call(dev, video, s_routing, INPUT(index)->vmux, 0, 0); cx231xx_set_audio_input(dev, dev->ctl_ainput); diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index ce7b3f8cdc65..68068c6d0987 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c @@ -393,9 +393,6 @@ static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh, static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) { - struct v4l2_routing route; - memset(&route, 0, sizeof(route)); - dprintk(1, "%s() video_mux: %d [vmux=%d, gpio=0x%x,0x%x,0x%x,0x%x]\n", __func__, input, INPUT(input)->vmux, @@ -403,10 +400,9 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) INPUT(input)->gpio2, INPUT(input)->gpio3); dev->input = input; - route.input = INPUT(input)->vmux; - /* Tell the internal A/V decoder */ - v4l2_subdev_call(dev->sd_cx25840, video, s_routing, &route); + v4l2_subdev_call(dev->sd_cx25840, video, s_routing, + INPUT(input)->vmux, 0, 0); return 0; } diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 62090279f46f..0be51b65f098 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -1322,22 +1322,24 @@ static int cx25840_s_radio(struct v4l2_subdev *sd) return 0; } -static int cx25840_s_video_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int cx25840_s_video_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct cx25840_state *state = to_state(sd); struct i2c_client *client = v4l2_get_subdevdata(sd); - return set_input(client, route->input, state->aud_input); + return set_input(client, input, state->aud_input); } -static int cx25840_s_audio_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int cx25840_s_audio_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct cx25840_state *state = to_state(sd); struct i2c_client *client = v4l2_get_subdevdata(sd); if (state->is_cx25836) return -EINVAL; - return set_input(client, state->vid_input, route->input); + return set_input(client, state->vid_input, input); } static int cx25840_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq) diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 61afa89f7b11..ec0425d9043a 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -428,10 +428,8 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input) routes for different inputs. HVR-1300 surely does */ if (core->board.audio_chip && core->board.audio_chip == V4L2_IDENT_WM8775) { - struct v4l2_routing route; - - route.input = INPUT(input).audioroute; - call_all(core, audio, s_routing, &route); + call_all(core, audio, s_routing, + INPUT(input).audioroute, 0, 0); } /* cx2388's C-ADC is connected to the tuner only. When used with S-Video, that ADC is busy dealing with @@ -823,10 +821,8 @@ static int video_open(struct file *file) if (core->board.radio.audioroute) { if(core->board.audio_chip && core->board.audio_chip == V4L2_IDENT_WM8775) { - struct v4l2_routing route; - - route.input = core->board.radio.audioroute; - call_all(core, audio, s_routing, &route); + call_all(core, audio, s_routing, + core->board.radio.audioroute, 0, 0); } /* "I2S ADC mode" */ core->tvaudio = WW_I2SADC; diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 8f8f20e14713..192b76cdd5d7 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -1018,14 +1018,9 @@ EXPORT_SYMBOL_GPL(em28xx_init_isoc); */ void em28xx_wake_i2c(struct em28xx *dev) { - struct v4l2_routing route; - int zero = 0; - - route.input = INPUT(dev->ctl_input)->vmux; - route.output = 0; - - v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, zero); - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, + INPUT(dev->ctl_input)->vmux, 0, 0); v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); } diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 96487843a473..882796e84dbc 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -515,10 +515,6 @@ static struct videobuf_queue_ops em28xx_video_qops = { static void video_mux(struct em28xx *dev, int index) { - struct v4l2_routing route; - - route.input = INPUT(index)->vmux; - route.output = 0; dev->ctl_input = index; dev->ctl_ainput = INPUT(index)->amux; dev->ctl_aoutput = INPUT(index)->aout; @@ -526,25 +522,22 @@ static void video_mux(struct em28xx *dev, int index) if (!dev->ctl_aoutput) dev->ctl_aoutput = EM28XX_AOUT_MASTER; - v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, + INPUT(index)->vmux, 0, 0); if (dev->board.has_msp34xx) { if (dev->i2s_speed) { v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_i2s_clock_freq, dev->i2s_speed); } - route.input = dev->ctl_ainput; - route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); - /* Note: this is msp3400 specific */ - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, + dev->ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); } if (dev->board.adecoder != EM28XX_NOADECODER) { - route.input = dev->ctl_ainput; - route.output = dev->ctl_aoutput; - - v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, &route); + v4l2_device_call_all(&dev->v4l2_dev, 0, audio, s_routing, + dev->ctl_ainput, dev->ctl_aoutput, 0); } em28xx_audio_analog_set(dev); diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c index 0dd5f53b7319..ceb05bdcaf62 100644 --- a/drivers/media/video/ivtv/ivtv-gpio.c +++ b/drivers/media/video/ivtv/ivtv-gpio.c @@ -248,15 +248,16 @@ static int subdev_s_std(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int subdev_s_audio_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int subdev_s_audio_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct ivtv *itv = sd_to_ivtv(sd); u16 mask, data; - if (route->input > 2) + if (input > 2) return -EINVAL; mask = itv->card->gpio_audio_input.mask; - switch (route->input) { + switch (input) { case 0: data = itv->card->gpio_audio_input.tuner; break; @@ -318,17 +319,18 @@ static int subdev_log_status(struct v4l2_subdev *sd) return 0; } -static int subdev_s_video_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int subdev_s_video_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct ivtv *itv = sd_to_ivtv(sd); u16 mask, data; - if (route->input > 2) /* 0:Tuner 1:Composite 2:S-Video */ + if (input > 2) /* 0:Tuner 1:Composite 2:S-Video */ return -EINVAL; mask = itv->card->gpio_video_input.mask; - if (route->input == 0) + if (input == 0) data = itv->card->gpio_video_input.tuner; - else if (route->input == 1) + else if (input == 1) data = itv->card->gpio_video_input.composite; else data = itv->card->gpio_video_input.svideo; diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 052fbe9cde86..cf48b6ab97cb 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1033,7 +1033,6 @@ static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) { struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; - struct v4l2_routing route; if (outp >= itv->card->nof_outputs) return -EINVAL; @@ -1046,9 +1045,9 @@ static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) itv->active_output, outp); itv->active_output = outp; - route.input = SAA7127_INPUT_TYPE_NORMAL; - route.output = itv->card->video_outputs[outp].video_output; - ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing, &route); + ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing, + SAA7127_INPUT_TYPE_NORMAL, + itv->card->video_outputs[outp].video_output, 0); return 0; } @@ -1738,7 +1737,8 @@ static long ivtv_default(struct file *file, void *fh, int cmd, void *arg) case VIDIOC_INT_S_AUDIO_ROUTING: { struct v4l2_routing *route = arg; - ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, route); + ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, + route->input, route->output, 0); break; } diff --git a/drivers/media/video/ivtv/ivtv-routing.c b/drivers/media/video/ivtv/ivtv-routing.c index 3fd302294497..8898c569a1c9 100644 --- a/drivers/media/video/ivtv/ivtv-routing.c +++ b/drivers/media/video/ivtv/ivtv-routing.c @@ -34,7 +34,7 @@ void ivtv_audio_set_io(struct ivtv *itv) { const struct ivtv_card_audio_input *in; - struct v4l2_routing route; + u32 input, output = 0; /* Determine which input to use */ if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) @@ -43,73 +43,77 @@ void ivtv_audio_set_io(struct ivtv *itv) in = &itv->card->audio_inputs[itv->audio_input]; /* handle muxer chips */ - route.input = in->muxer_input; - route.output = 0; + input = in->muxer_input; if (itv->card->hw_muxer & IVTV_HW_M52790) - route.output = M52790_OUT_STEREO; - v4l2_subdev_call(itv->sd_muxer, audio, s_routing, &route); + output = M52790_OUT_STEREO; + v4l2_subdev_call(itv->sd_muxer, audio, s_routing, + input, output, 0); - route.input = in->audio_input; - route.output = 0; + input = in->audio_input; + output = 0; if (itv->card->hw_audio & IVTV_HW_MSP34XX) - route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); - ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, &route); + output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); + ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, + input, output, 0); } /* Selects the video input and output according to the current settings. */ void ivtv_video_set_io(struct ivtv *itv) { - struct v4l2_routing route; int inp = itv->active_input; + u32 input; u32 type; - route.input = itv->card->video_inputs[inp].video_input; - route.output = 0; - v4l2_subdev_call(itv->sd_video, video, s_routing, &route); + v4l2_subdev_call(itv->sd_video, video, s_routing, + itv->card->video_inputs[inp].video_input, 0, 0); type = itv->card->video_inputs[inp].video_type; if (type == IVTV_CARD_INPUT_VID_TUNER) { - route.input = 0; /* Tuner */ + input = 0; /* Tuner */ } else if (type < IVTV_CARD_INPUT_COMPOSITE1) { - route.input = 2; /* S-Video */ + input = 2; /* S-Video */ } else { - route.input = 1; /* Composite */ + input = 1; /* Composite */ } if (itv->card->hw_video & IVTV_HW_GPIO) - ivtv_call_hw(itv, IVTV_HW_GPIO, video, s_routing, &route); + ivtv_call_hw(itv, IVTV_HW_GPIO, video, s_routing, + input, 0, 0); if (itv->card->hw_video & IVTV_HW_UPD64031A) { if (type == IVTV_CARD_INPUT_VID_TUNER || type >= IVTV_CARD_INPUT_COMPOSITE1) { /* Composite: GR on, connect to 3DYCS */ - route.input = UPD64031A_GR_ON | UPD64031A_3DYCS_COMPOSITE; + input = UPD64031A_GR_ON | UPD64031A_3DYCS_COMPOSITE; } else { /* S-Video: GR bypassed, turn it off */ - route.input = UPD64031A_GR_OFF | UPD64031A_3DYCS_DISABLE; + input = UPD64031A_GR_OFF | UPD64031A_3DYCS_DISABLE; } - route.input |= itv->card->gr_config; + input |= itv->card->gr_config; - ivtv_call_hw(itv, IVTV_HW_UPD64031A, video, s_routing, &route); + ivtv_call_hw(itv, IVTV_HW_UPD64031A, video, s_routing, + input, 0, 0); } if (itv->card->hw_video & IVTV_HW_UPD6408X) { - route.input = UPD64083_YCS_MODE; + input = UPD64083_YCS_MODE; if (type > IVTV_CARD_INPUT_VID_TUNER && type < IVTV_CARD_INPUT_COMPOSITE1) { - /* S-Video uses YCNR mode and internal Y-ADC, the upd64031a - is not used. */ - route.input |= UPD64083_YCNR_MODE; + /* S-Video uses YCNR mode and internal Y-ADC, the + upd64031a is not used. */ + input |= UPD64083_YCNR_MODE; } else if (itv->card->hw_video & IVTV_HW_UPD64031A) { - /* Use upd64031a output for tuner and composite(CX23416GYC only) inputs */ - if ((type == IVTV_CARD_INPUT_VID_TUNER)|| - (itv->card->type == IVTV_CARD_CX23416GYC)) { - route.input |= UPD64083_EXT_Y_ADC; - } + /* Use upd64031a output for tuner and + composite(CX23416GYC only) inputs */ + if (type == IVTV_CARD_INPUT_VID_TUNER || + itv->card->type == IVTV_CARD_CX23416GYC) { + input |= UPD64083_EXT_Y_ADC; + } } - ivtv_call_hw(itv, IVTV_HW_UPD6408X, video, s_routing, &route); + ivtv_call_hw(itv, IVTV_HW_UPD6408X, video, s_routing, + input, 0, 0); } } diff --git a/drivers/media/video/ks0127.c b/drivers/media/video/ks0127.c index 4e5f0e7dc591..fab8e0254bbc 100644 --- a/drivers/media/video/ks0127.c +++ b/drivers/media/video/ks0127.c @@ -409,11 +409,12 @@ static void ks0127_init(struct v4l2_subdev *sd) } } -static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int ks0127_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct ks0127 *ks = to_ks0127(sd); - switch (route->input) { + switch (input) { case KS_INPUT_COMPOSITE_1: case KS_INPUT_COMPOSITE_2: case KS_INPUT_COMPOSITE_3: @@ -421,13 +422,13 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r case KS_INPUT_COMPOSITE_5: case KS_INPUT_COMPOSITE_6: v4l2_dbg(1, debug, sd, - "s_routing %d: Composite\n", route->input); + "s_routing %d: Composite\n", input); /* autodetect 50/60 Hz */ ks0127_and_or(sd, KS_CMDA, 0xfc, 0x00); /* VSE=0 */ ks0127_and_or(sd, KS_CMDA, ~0x40, 0x00); /* set input line */ - ks0127_and_or(sd, KS_CMDB, 0xb0, route->input); + ks0127_and_or(sd, KS_CMDB, 0xb0, input); /* non-freerunning mode */ ks0127_and_or(sd, KS_CMDC, 0x70, 0x0a); /* analog input */ @@ -455,13 +456,13 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r case KS_INPUT_SVIDEO_2: case KS_INPUT_SVIDEO_3: v4l2_dbg(1, debug, sd, - "s_routing %d: S-Video\n", route->input); + "s_routing %d: S-Video\n", input); /* autodetect 50/60 Hz */ ks0127_and_or(sd, KS_CMDA, 0xfc, 0x00); /* VSE=0 */ ks0127_and_or(sd, KS_CMDA, ~0x40, 0x00); /* set input line */ - ks0127_and_or(sd, KS_CMDB, 0xb0, route->input); + ks0127_and_or(sd, KS_CMDB, 0xb0, input); /* non-freerunning mode */ ks0127_and_or(sd, KS_CMDC, 0x70, 0x0a); /* analog input */ @@ -496,7 +497,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r ks0127_and_or(sd, KS_CMDA, 0xff, 0x40); /* VSE=1 */ /* set input line and VALIGN */ - ks0127_and_or(sd, KS_CMDB, 0xb0, (route->input | 0x40)); + ks0127_and_or(sd, KS_CMDB, 0xb0, (input | 0x40)); /* freerunning mode, */ /* TSTGEN = 1 TSTGFR=11 TSTGPH=0 TSTGPK=0 VMEM=1*/ ks0127_and_or(sd, KS_CMDC, 0x70, 0x87); @@ -531,7 +532,7 @@ static int ks0127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r default: v4l2_dbg(1, debug, sd, - "s_routing: Unknown input %d\n", route->input); + "s_routing: Unknown input %d\n", input); break; } diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c index 1f340fefc49d..d7317e798cc4 100644 --- a/drivers/media/video/m52790.c +++ b/drivers/media/video/m52790.c @@ -69,12 +69,13 @@ static int m52790_write(struct v4l2_subdev *sd) part of the audio output routing. The normal case is that another chip takes care of the actual muting so making it part of the output routing seems to be the right thing to do for now. */ -static int m52790_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int m52790_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct m52790_state *state = to_state(sd); - state->input = route->input; - state->output = route->output; + state->input = input; + state->output = output; m52790_write(sd); return 0; } diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 38e639750a48..e9df3cb02cc1 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c @@ -505,25 +505,26 @@ static int msp_s_std(struct v4l2_subdev *sd, v4l2_std_id id) return 0; } -static int msp_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *rt) +static int msp_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct msp_state *state = to_state(sd); struct i2c_client *client = v4l2_get_subdevdata(sd); - int tuner = (rt->input >> 3) & 1; - int sc_in = rt->input & 0x7; - int sc1_out = rt->output & 0xf; - int sc2_out = (rt->output >> 4) & 0xf; + int tuner = (input >> 3) & 1; + int sc_in = input & 0x7; + int sc1_out = output & 0xf; + int sc2_out = (output >> 4) & 0xf; u16 val, reg; int i; int extern_input = 1; - if (state->routing.input == rt->input && - state->routing.output == rt->output) + if (state->route_in == input && state->route_out == output) return 0; - state->routing = *rt; + state->route_in = input; + state->route_out = output; /* check if the tuner input is used */ for (i = 0; i < 5; i++) { - if (((rt->input >> (4 + i * 4)) & 0xf) == 0) + if (((input >> (4 + i * 4)) & 0xf) == 0) extern_input = 0; } state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT; @@ -673,7 +674,7 @@ static int msp_log_status(struct v4l2_subdev *sd) } v4l_info(client, "Audmode: 0x%04x\n", state->audmode); v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n", - state->routing.input, state->routing.output); + state->route_in, state->route_out); v4l_info(client, "ACB: 0x%04x\n", state->acb); return 0; } @@ -761,8 +762,8 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) state->i2s_mode = 0; init_waitqueue_head(&state->wq); /* These are the reset input/output positions */ - state->routing.input = MSP_INPUT_DEFAULT; - state->routing.output = MSP_OUTPUT_DEFAULT; + state->route_in = MSP_INPUT_DEFAULT; + state->route_out = MSP_OUTPUT_DEFAULT; state->rev1 = msp_read_dsp(client, 0x1e); if (state->rev1 != -1) diff --git a/drivers/media/video/msp3400-driver.h b/drivers/media/video/msp3400-driver.h index 3fe1c1b10f53..d6b3e6d0eef7 100644 --- a/drivers/media/video/msp3400-driver.h +++ b/drivers/media/video/msp3400-driver.h @@ -80,7 +80,8 @@ struct msp_state { int i2s_mode; int main, second; /* sound carrier */ int input; - struct v4l2_routing routing; + u32 route_in; + u32 route_out; /* v4l2 */ int audmode; diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c index a655e9c30146..168bca703614 100644 --- a/drivers/media/video/msp3400-kthreads.c +++ b/drivers/media/video/msp3400-kthreads.c @@ -188,7 +188,7 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) { struct msp_state *state = to_state(i2c_get_clientdata(client)); struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode]; - int tuner = (state->routing.input >> 3) & 1; + int tuner = (state->route_in >> 3) & 1; int i; v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode); @@ -896,7 +896,7 @@ static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in) static void msp34xxg_set_sources(struct i2c_client *client) { struct msp_state *state = to_state(i2c_get_clientdata(client)); - u32 in = state->routing.input; + u32 in = state->route_in; msp34xxg_set_source(client, 0x0008, (in >> 4) & 0xf); /* quasi-peak detector is set to same input as the loudspeaker (MAIN) */ @@ -912,7 +912,7 @@ static void msp34xxg_set_sources(struct i2c_client *client) static void msp34xxg_reset(struct i2c_client *client) { struct msp_state *state = to_state(i2c_get_clientdata(client)); - int tuner = (state->routing.input >> 3) & 1; + int tuner = (state->route_in >> 3) & 1; int modus; /* initialize std to 1 (autodetect) to signal that no standard is diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index a547c85b4ca7..3be5a71bdac2 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c @@ -83,9 +83,14 @@ static struct { static int video_audio_connect[MXB_INPUTS] = { 0, 1, 3, 3 }; +struct mxb_routing { + u32 input; + u32 output; +}; + /* These are the necessary input-output-pins for bringing one audio source (see above) to the CD-output. Note that gain is set to 0 in this table. */ -static struct v4l2_routing TEA6420_cd[MXB_AUDIOS + 1][2] = { +static struct mxb_routing TEA6420_cd[MXB_AUDIOS + 1][2] = { { { 1, 1 }, { 1, 1 } }, /* Tuner */ { { 5, 1 }, { 6, 1 } }, /* AUX 1 */ { { 4, 1 }, { 6, 1 } }, /* AUX 2 */ @@ -97,7 +102,7 @@ static struct v4l2_routing TEA6420_cd[MXB_AUDIOS + 1][2] = { /* These are the necessary input-output-pins for bringing one audio source (see above) to the line-output. Note that gain is set to 0 in this table. */ -static struct v4l2_routing TEA6420_line[MXB_AUDIOS + 1][2] = { +static struct mxb_routing TEA6420_line[MXB_AUDIOS + 1][2] = { { { 2, 3 }, { 1, 2 } }, { { 5, 3 }, { 6, 2 } }, { { 4, 3 }, { 6, 2 } }, @@ -134,10 +139,6 @@ struct mxb #define saa7111a_call(mxb, o, f, args...) \ v4l2_subdev_call(mxb->saa7111a, o, f, ##args) -#define tea6420_1_call(mxb, o, f, args...) \ - v4l2_subdev_call(mxb->tea6420_1, o, f, ##args) -#define tea6420_2_call(mxb, o, f, args...) \ - v4l2_subdev_call(mxb->tea6420_2, o, f, ##args) #define tda9840_call(mxb, o, f, args...) \ v4l2_subdev_call(mxb->tda9840, o, f, ##args) #define tea6415c_call(mxb, o, f, args...) \ @@ -147,6 +148,22 @@ struct mxb #define call_all(dev, o, f, args...) \ v4l2_device_call_until_err(&dev->v4l2_dev, 0, o, f, ##args) +static inline void tea6420_route_cd(struct mxb *mxb, int idx) +{ + v4l2_subdev_call(mxb->tea6420_1, audio, s_routing, + TEA6420_cd[idx][0].input, TEA6420_cd[idx][0].output, 0); + v4l2_subdev_call(mxb->tea6420_2, audio, s_routing, + TEA6420_cd[idx][1].input, TEA6420_cd[idx][1].output, 0); +} + +static inline void tea6420_route_line(struct mxb *mxb, int idx) +{ + v4l2_subdev_call(mxb->tea6420_1, audio, s_routing, + TEA6420_line[idx][0].input, TEA6420_line[idx][0].output, 0); + v4l2_subdev_call(mxb->tea6420_2, audio, s_routing, + TEA6420_line[idx][1].input, TEA6420_line[idx][1].output, 0); +} + static struct saa7146_extension extension; static int mxb_probe(struct saa7146_dev *dev) @@ -268,7 +285,6 @@ static int mxb_init_done(struct saa7146_dev* dev) struct i2c_msg msg; struct tuner_setup tun_setup; v4l2_std_id std = V4L2_STD_PAL_BG; - struct v4l2_routing route; int i = 0, err = 0; @@ -277,9 +293,8 @@ static int mxb_init_done(struct saa7146_dev* dev) /* select tuner-output on saa7111a */ i = 0; - route.input = SAA7115_COMPOSITE0; - route.output = SAA7111_FMT_CCIR | SAA7111_VBI_BYPASS; - saa7111a_call(mxb, video, s_routing, &route); + saa7111a_call(mxb, video, s_routing, SAA7115_COMPOSITE0, + SAA7111_FMT_CCIR | SAA7111_VBI_BYPASS, 0); /* select a tuner type */ tun_setup.mode_mask = T_ANALOG_TV; @@ -296,20 +311,14 @@ static int mxb_init_done(struct saa7146_dev* dev) tuner_call(mxb, core, s_std, std); /* mute audio on tea6420s */ - tea6420_1_call(mxb, audio, s_routing, &TEA6420_line[6][0]); - tea6420_2_call(mxb, audio, s_routing, &TEA6420_line[6][1]); - tea6420_1_call(mxb, audio, s_routing, &TEA6420_cd[6][0]); - tea6420_2_call(mxb, audio, s_routing, &TEA6420_cd[6][1]); + tea6420_route_line(mxb, 6); + tea6420_route_cd(mxb, 6); /* switch to tuner-channel on tea6415c */ - route.input = 3; - route.output = 17; - tea6415c_call(mxb, video, s_routing, &route); + tea6415c_call(mxb, video, s_routing, 3, 17, 0); /* select tuner-output on multicable on tea6415c */ - route.input = 3; - route.output = 13; - tea6415c_call(mxb, video, s_routing, &route); + tea6415c_call(mxb, video, s_routing, 3, 13, 0); /* the rest for mxb */ mxb->cur_input = 0; @@ -433,18 +442,9 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *vc) if (vc->id == V4L2_CID_AUDIO_MUTE) { mxb->cur_mute = vc->value; - if (!vc->value) { - /* switch the audio-source */ - tea6420_1_call(mxb, audio, s_routing, - &TEA6420_line[video_audio_connect[mxb->cur_input]][0]); - tea6420_2_call(mxb, audio, s_routing, - &TEA6420_line[video_audio_connect[mxb->cur_input]][1]); - } else { - tea6420_1_call(mxb, audio, s_routing, - &TEA6420_line[6][0]); - tea6420_2_call(mxb, audio, s_routing, - &TEA6420_line[6][1]); - } + /* switch the audio-source */ + tea6420_route_line(mxb, vc->value ? 6 : + video_audio_connect[mxb->cur_input]); DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n", vc->value)); } return 0; @@ -473,7 +473,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) { struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; struct mxb *mxb = (struct mxb *)dev->ext_priv; - struct v4l2_routing route; + int err = 0; int i = 0; DEB_EE(("VIDIOC_S_INPUT %d.\n", input)); @@ -491,16 +491,12 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) switch (input) { case TUNER: i = SAA7115_COMPOSITE0; - route.input = 3; - route.output = 17; - if (tea6415c_call(mxb, video, s_routing, &route)) { - printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #1\n"); - return -EFAULT; - } + err = tea6415c_call(mxb, video, s_routing, 3, 17, 0); + /* connect tuner-output always to multicable */ - route.input = 3; - route.output = 13; + if (!err) + err = tea6415c_call(mxb, video, s_routing, 3, 13, 0); break; case AUX3_YC: /* nothing to be done here. aux3_yc is @@ -514,37 +510,20 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) break; case AUX1: i = SAA7115_COMPOSITE0; - route.input = 1; - route.output = 17; + err = tea6415c_call(mxb, video, s_routing, 1, 17, 0); break; } - /* switch video in tea6415c only if necessary */ - switch (input) { - case TUNER: - case AUX1: - if (tea6415c_call(mxb, video, s_routing, &route)) { - printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #3\n"); - return -EFAULT; - } - break; - default: - break; - } + if (err) + return err; /* switch video in saa7111a */ - route.input = i; - route.output = 0; - if (saa7111a_call(mxb, video, s_routing, &route)) + if (saa7111a_call(mxb, video, s_routing, i, 0, 0)) printk(KERN_ERR "VIDIOC_S_INPUT: could not address saa7111a #1.\n"); /* switch the audio-source only if necessary */ - if (0 == mxb->cur_mute) { - tea6420_1_call(mxb, audio, s_routing, - &TEA6420_line[video_audio_connect[input]][0]); - tea6420_2_call(mxb, audio, s_routing, - &TEA6420_line[video_audio_connect[input]][1]); - } + if (0 == mxb->cur_mute) + tea6420_route_line(mxb, video_audio_connect[input]); return 0; } @@ -686,9 +665,7 @@ static long vidioc_default(struct file *file, void *fh, int cmd, void *arg) DEB_EE(("MXB_S_AUDIO_CD: i:%d.\n", i)); - tea6420_1_call(mxb, audio, s_routing, &TEA6420_cd[i][0]); - tea6420_2_call(mxb, audio, s_routing, &TEA6420_cd[i][1]); - + tea6420_route_cd(mxb, i); return 0; } case MXB_S_AUDIO_LINE: @@ -701,9 +678,7 @@ static long vidioc_default(struct file *file, void *fh, int cmd, void *arg) } DEB_EE(("MXB_S_AUDIO_LINE: i:%d.\n", i)); - tea6420_1_call(mxb, audio, s_routing, &TEA6420_line[i][0]); - tea6420_2_call(mxb, audio, s_routing, &TEA6420_line[i][1]); - + tea6420_route_line(mxb, i); return 0; } default: diff --git a/drivers/media/video/pvrusb2/pvrusb2-audio.c b/drivers/media/video/pvrusb2/pvrusb2-audio.c index ccf2a3c7ad06..10ef1a2c13ea 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-audio.c +++ b/drivers/media/video/pvrusb2/pvrusb2-audio.c @@ -58,9 +58,9 @@ static const struct routing_scheme routing_schemes[] = { void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) { if (hdw->input_dirty || hdw->force_dirty) { - struct v4l2_routing route; const struct routing_scheme *sp; unsigned int sid = hdw->hdw_desc->signal_routing_scheme; + u32 input; pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo"); @@ -68,7 +68,7 @@ void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) ((sp = routing_schemes + sid) != NULL) && (hdw->input_val >= 0) && (hdw->input_val < sp->cnt)) { - route.input = sp->def[hdw->input_val]; + input = sp->def[hdw->input_val]; } else { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "*** WARNING *** subdev msp3400 set_input:" @@ -77,8 +77,8 @@ void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) sid, hdw->input_val); return; } - route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); - sd->ops->audio->s_routing(sd, &route); + sd->ops->audio->s_routing(sd, input, + MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); } } diff --git a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c index b5c3428ebb9f..9023adf3fdcc 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c +++ b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c @@ -60,16 +60,16 @@ static const struct routing_scheme routing_schemes[] = { void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) { if (hdw->input_dirty || hdw->force_dirty) { - struct v4l2_routing route; const struct routing_scheme *sp; unsigned int sid = hdw->hdw_desc->signal_routing_scheme; + u32 input; pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", hdw->input_val); if ((sid < ARRAY_SIZE(routing_schemes)) && ((sp = routing_schemes + sid) != NULL) && (hdw->input_val >= 0) && (hdw->input_val < sp->cnt)) { - route.input = sp->def[hdw->input_val]; + input = sp->def[hdw->input_val]; } else { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "*** WARNING *** subdev v4l2 set_input:" @@ -78,8 +78,7 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) sid, hdw->input_val); return; } - route.output = 0; - sd->ops->audio->s_routing(sd, &route); + sd->ops->audio->s_routing(sd, input, 0, 0); } } diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c index 4e017ff26c36..05e52358ae49 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c @@ -105,14 +105,11 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) { pvr2_trace(PVR2_TRACE_CHIPS, "subdev cx2584x update..."); if (hdw->input_dirty || hdw->force_dirty) { - struct v4l2_routing route; enum cx25840_video_input vid_input; enum cx25840_audio_input aud_input; const struct routing_scheme *sp; unsigned int sid = hdw->hdw_desc->signal_routing_scheme; - memset(&route, 0, sizeof(route)); - if ((sid < ARRAY_SIZE(routing_schemes)) && ((sp = routing_schemes + sid) != NULL) && (hdw->input_val >= 0) && @@ -131,10 +128,8 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) pvr2_trace(PVR2_TRACE_CHIPS, "subdev cx2584x set_input vid=0x%x aud=0x%x", vid_input, aud_input); - route.input = (u32)vid_input; - sd->ops->video->s_routing(sd, &route); - route.input = (u32)aud_input; - sd->ops->audio->s_routing(sd, &route); + sd->ops->video->s_routing(sd, (u32)vid_input, 0, 0); + sd->ops->audio->s_routing(sd, (u32)aud_input, 0, 0); } } diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c index b3862f5554bd..d2fe7c8f2c3a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c @@ -75,16 +75,17 @@ static const struct routing_scheme routing_schemes[] = { void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) { if (hdw->input_dirty || hdw->force_dirty) { - struct v4l2_routing route; const struct routing_scheme *sp; unsigned int sid = hdw->hdw_desc->signal_routing_scheme; + u32 input; + pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", hdw->input_val); if ((sid < ARRAY_SIZE(routing_schemes)) && ((sp = routing_schemes + sid) != NULL) && (hdw->input_val >= 0) && (hdw->input_val < sp->cnt)) { - route.input = sp->def[hdw->input_val]; + input = sp->def[hdw->input_val]; } else { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "*** WARNING *** subdev v4l2 set_input:" @@ -93,8 +94,7 @@ void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) sid, hdw->input_val); return; } - route.output = 0; - sd->ops->video->s_routing(sd, &route); + sd->ops->video->s_routing(sd, input, 0, 0); } } diff --git a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c index 1670aa4051ce..8c1eae05aa08 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c +++ b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c @@ -39,24 +39,22 @@ void pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) { if (hdw->input_dirty || hdw->force_dirty) { - struct v4l2_routing route; - - memset(&route, 0, sizeof(route)); + u32 input; switch (hdw->input_val) { case PVR2_CVAL_INPUT_RADIO: - route.input = 1; + input = 1; break; default: /* All other cases just use the second input */ - route.input = 2; + input = 2; break; } pvr2_trace(PVR2_TRACE_CHIPS, "subdev wm8775" " set_input(val=%d route=0x%x)", - hdw->input_val, route.input); + hdw->input_val, input); - sd->ops->audio->s_routing(sd, &route); + sd->ops->audio->s_routing(sd, input, 0, 0); } } diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index 8bb1fc17d195..5c24c993ac16 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c @@ -299,17 +299,18 @@ static int saa7110_s_std(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int saa7110_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int saa7110_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct saa7110 *decoder = to_saa7110(sd); - if (route->input < 0 || route->input >= SAA7110_MAX_INPUT) { - v4l2_dbg(1, debug, sd, "input=%d not available\n", route->input); + if (input < 0 || input >= SAA7110_MAX_INPUT) { + v4l2_dbg(1, debug, sd, "input=%d not available\n", input); return -EINVAL; } - if (decoder->input != route->input) { - saa7110_selmux(sd, route->input); - v4l2_dbg(1, debug, sd, "switched to input=%d\n", route->input); + if (decoder->input != input) { + saa7110_selmux(sd, input); + v4l2_dbg(1, debug, sd, "switched to input=%d\n", input); } return 0; } diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index c0e66a88be4f..44873a016c2c 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -1228,30 +1228,32 @@ static int saa711x_s_radio(struct v4l2_subdev *sd) return 0; } -static int saa711x_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int saa711x_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct saa711x_state *state = to_state(sd); - u32 input = route->input; u8 mask = (state->ident == V4L2_IDENT_SAA7111) ? 0xf8 : 0xf0; - v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n", route->input, route->output); + v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n", + input, output); + /* saa7111/3 does not have these inputs */ if ((state->ident == V4L2_IDENT_SAA7113 || state->ident == V4L2_IDENT_SAA7111) && - (route->input == SAA7115_COMPOSITE4 || - route->input == SAA7115_COMPOSITE5)) { + (input == SAA7115_COMPOSITE4 || + input == SAA7115_COMPOSITE5)) { return -EINVAL; } - if (route->input > SAA7115_SVIDEO3) + if (input > SAA7115_SVIDEO3) return -EINVAL; - if (route->output > SAA7115_IPORT_ON) + if (output > SAA7115_IPORT_ON) return -EINVAL; - if (state->input == route->input && state->output == route->output) + if (state->input == input && state->output == output) return 0; v4l2_dbg(1, debug, sd, "now setting %s input %s output\n", - (route->input >= SAA7115_SVIDEO0) ? "S-Video" : "Composite", - (route->output == SAA7115_IPORT_ON) ? "iport on" : "iport off"); - state->input = route->input; + (input >= SAA7115_SVIDEO0) ? "S-Video" : "Composite", + (output == SAA7115_IPORT_ON) ? "iport on" : "iport off"); + state->input = input; /* saa7111 has slightly different input numbering */ if (state->ident == V4L2_IDENT_SAA7111) { @@ -1260,10 +1262,10 @@ static int saa711x_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing * /* saa7111 specific */ saa711x_write(sd, R_10_CHROMA_CNTL_2, (saa711x_read(sd, R_10_CHROMA_CNTL_2) & 0x3f) | - ((route->output & 0xc0) ^ 0x40)); + ((output & 0xc0) ^ 0x40)); saa711x_write(sd, R_13_RT_X_PORT_OUT_CNTL, (saa711x_read(sd, R_13_RT_X_PORT_OUT_CNTL) & 0xf0) | - ((route->output & 2) ? 0x0a : 0)); + ((output & 2) ? 0x0a : 0)); } /* select mode */ @@ -1276,7 +1278,7 @@ static int saa711x_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing * (saa711x_read(sd, R_09_LUMA_CNTL) & 0x7f) | (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0)); - state->output = route->output; + state->output = output; if (state->ident == V4L2_IDENT_SAA7114 || state->ident == V4L2_IDENT_SAA7115) { saa711x_write(sd, R_83_X_PORT_I_O_ENA_AND_OUT_CLK, diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 128bb8b8dbbf..2fe7a701b954 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c @@ -570,15 +570,16 @@ static int saa7127_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) return saa7127_set_std(sd, std); } -static int saa7127_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int saa7127_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct saa7127_state *state = to_state(sd); int rc = 0; - if (state->input_type != route->input) - rc = saa7127_set_input_type(sd, route->input); - if (rc == 0 && state->output_type != route->output) - rc = saa7127_set_output_type(sd, route->output); + if (state->input_type != input) + rc = saa7127_set_input_type(sd, input); + if (rc == 0 && state->output_type != output) + rc = saa7127_set_output_type(sd, output); return rc; } diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c index b73801caaa9d..b15c40908e84 100644 --- a/drivers/media/video/saa717x.c +++ b/drivers/media/video/saa717x.c @@ -1104,22 +1104,22 @@ static struct v4l2_queryctrl saa717x_qctrl[] = { }, }; -static int saa717x_s_video_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int saa717x_s_video_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct saa717x_state *decoder = to_state(sd); - int inp = route->input; - int is_tuner = inp & 0x80; /* tuner input flag */ + int is_tuner = input & 0x80; /* tuner input flag */ - inp &= 0x7f; + input &= 0x7f; - v4l2_dbg(1, debug, sd, "decoder set input (%d)\n", inp); + v4l2_dbg(1, debug, sd, "decoder set input (%d)\n", input); /* inputs from 0-9 are available*/ /* saa717x have mode0-mode9 but mode5 is reserved. */ - if (inp < 0 || inp > 9 || inp == 5) + if (input < 0 || input > 9 || input == 5) return -EINVAL; - if (decoder->input != inp) { - int input_line = inp; + if (decoder->input != input) { + int input_line = input; decoder->input = input_line; v4l2_dbg(1, debug, sd, "now setting %s input %d\n", @@ -1276,12 +1276,13 @@ static int saa717x_s_std(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int saa717x_s_audio_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int saa717x_s_audio_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct saa717x_state *decoder = to_state(sd); - if (route->input < 3) { /* FIXME! --tadachi */ - decoder->audio_input = route->input; + if (input < 3) { /* FIXME! --tadachi */ + decoder->audio_input = input; v4l2_dbg(1, debug, sd, "set decoder audio input to %d\n", decoder->audio_input); diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 75747b104d07..212baa10829b 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c @@ -245,14 +245,15 @@ static int saa7185_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int saa7185_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int saa7185_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct saa7185 *encoder = to_saa7185(sd); - /* RJ: route->input = 0: input is from SA7111 - route->input = 1: input is from ZR36060 */ + /* RJ: input = 0: input is from SA7111 + input = 1: input is from ZR36060 */ - switch (route->input) { + switch (input) { case 0: /* turn off colorbar */ saa7185_write(sd, 0x3a, 0x0f); diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c index 13ab4f2ddcc5..a2513772196b 100644 --- a/drivers/media/video/saa7191.c +++ b/drivers/media/video/saa7191.c @@ -160,14 +160,14 @@ static int saa7191_write_block(struct v4l2_subdev *sd, /* Helper functions */ static int saa7191_s_routing(struct v4l2_subdev *sd, - const struct v4l2_routing *route) + u32 input, u32 output, u32 config) { struct saa7191 *decoder = to_saa7191(sd); u8 luma = saa7191_read_reg(sd, SAA7191_REG_LUMA); u8 iock = saa7191_read_reg(sd, SAA7191_REG_IOCK); int err; - switch (route->input) { + switch (input) { case SAA7191_INPUT_COMPOSITE: /* Set Composite input */ iock &= ~(SAA7191_IOCK_CHRS | SAA7191_IOCK_GPSW1 | SAA7191_IOCK_GPSW2); @@ -190,7 +190,7 @@ static int saa7191_s_routing(struct v4l2_subdev *sd, if (err) return -EIO; - decoder->input = route->input; + decoder->input = input; return 0; } diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index ff696d14a5dd..d4a9ed45764b 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c @@ -47,12 +47,11 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); /* makes a connection between the input-pin 'i' and the output-pin 'o' */ -static int tea6415c_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int tea6415c_s_routing(struct v4l2_subdev *sd, + u32 i, u32 o, u32 config) { struct i2c_client *client = v4l2_get_subdevdata(sd); u8 byte = 0; - u32 i = route->input; - u32 o = route->output; int ret; v4l2_dbg(1, debug, sd, "i=%d, o=%d\n", i, o); diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index 8a55b46ea9b7..ced6eadf347a 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c @@ -48,15 +48,15 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); /* make a connection between the input 'i' and the output 'o' with gain 'g' (note: i = 6 means 'mute') */ -static int tea6420_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int tea6420_s_routing(struct v4l2_subdev *sd, + u32 i, u32 o, u32 config) { struct i2c_client *client = v4l2_get_subdevdata(sd); - int i = route->input; - int o = route->output & 0xf; - int g = (route->output >> 4) & 0xf; + int g = (o >> 4) & 0xf; u8 byte; int ret; + o &= 0xf; v4l2_dbg(1, debug, sd, "i=%d, o=%d, g=%d\n", i, o, g); /* check if the parameters are valid */ @@ -133,13 +133,8 @@ static int tea6420_probe(struct i2c_client *client, /* set initial values: set "mute"-input to all outputs at gain 0 */ err = 0; - for (i = 1; i < 5; i++) { - struct v4l2_routing route; - - route.input = 6; - route.output = i; - err += tea6420_s_routing(sd, &route); - } + for (i = 1; i < 5; i++) + err += tea6420_s_routing(sd, 6, i, 0); if (err) { v4l_dbg(1, debug, client, "could not initialize tea6420\n"); return -ENODEV; diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 17d50e3cd518..0869bafc2b56 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -1781,17 +1781,18 @@ static int tvaudio_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) return -EINVAL; } -static int tvaudio_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *rt) +static int tvaudio_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct CHIPSTATE *chip = to_state(sd); struct CHIPDESC *desc = chip->desc; if (!(desc->flags & CHIP_HAS_INPUTSEL)) return 0; - if (rt->input >= 4) + if (input >= 4) return -EINVAL; /* There are four inputs: tuner, radio, extern and intern. */ - chip->input = rt->input; + chip->input = input; if (chip->muted) return 0; chip_write_masked(chip, desc->inputreg, diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 4aea84a392e8..2d38e253f14e 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -69,7 +69,8 @@ struct tvp5150 { struct v4l2_subdev sd; v4l2_std_id norm; /* Current set standard */ - struct v4l2_routing route; + u32 input; + u32 output; int enable; int bright; int contrast; @@ -280,10 +281,10 @@ static inline void tvp5150_selmux(struct v4l2_subdev *sd) int input = 0; unsigned char val; - if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) + if ((decoder->output & TVP5150_BLACK_SCREEN) || !decoder->enable) input = 8; - switch (decoder->route.input) { + switch (decoder->input) { case TVP5150_COMPOSITE1: input |= 2; /* fall through */ @@ -299,8 +300,8 @@ static inline void tvp5150_selmux(struct v4l2_subdev *sd) v4l2_dbg(1, debug, sd, "Selecting video route: route input=%i, output=%i " "=> tvp5150 input=%i, opmode=%i\n", - decoder->route.input,decoder->route.output, - input, opmode ); + decoder->input, decoder->output, + input, opmode); tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode); tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input); @@ -309,7 +310,7 @@ static inline void tvp5150_selmux(struct v4l2_subdev *sd) * For Composite and TV, it should be the reverse */ val = tvp5150_read(sd, TVP5150_MISC_CTL); - if (decoder->route.input == TVP5150_SVIDEO) + if (decoder->input == TVP5150_SVIDEO) val = (val & ~0x40) | 0x10; else val = (val & ~0x10) | 0x40; @@ -878,11 +879,13 @@ static int tvp5150_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) I2C Command ****************************************************************************/ -static int tvp5150_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int tvp5150_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct tvp5150 *decoder = to_tvp5150(sd); - decoder->route = *route; + decoder->input = input; + decoder->output = output; tvp5150_selmux(sd); return 0; } @@ -1077,7 +1080,7 @@ static int tvp5150_probe(struct i2c_client *c, c->addr << 1, c->adapter->name); core->norm = V4L2_STD_ALL; /* Default is autodetect */ - core->route.input = TVP5150_COMPOSITE1; + core->input = TVP5150_COMPOSITE1; core->enable = 1; core->bright = 128; core->contrast = 128; diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index c0ac651bb358..a07a3fbb51eb 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c @@ -124,17 +124,18 @@ static int upd64031a_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency * /* ------------------------------------------------------------------------ */ -static int upd64031a_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int upd64031a_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct upd64031a_state *state = to_state(sd); u8 r00, r05, r08; - state->gr_mode = (route->input & 3) << 6; - state->direct_3dycs_connect = (route->input & 0xc) << 4; + state->gr_mode = (input & 3) << 6; + state->direct_3dycs_connect = (input & 0xc) << 4; state->ext_comp_sync = - (route->input & UPD64031A_COMPOSITE_EXTERNAL) << 1; + (input & UPD64031A_COMPOSITE_EXTERNAL) << 1; state->ext_vert_sync = - (route->input & UPD64031A_VERTICAL_EXTERNAL) << 2; + (input & UPD64031A_VERTICAL_EXTERNAL) << 2; r00 = (state->regs[R00] & ~GR_MODE_MASK) | state->gr_mode; r05 = (state->regs[R00] & ~SYNC_CIRCUIT_MASK) | state->ext_comp_sync | state->ext_vert_sync; diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index 410c915d51fa..6eb0e5b00c32 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c @@ -102,15 +102,16 @@ static u8 upd64083_read(struct v4l2_subdev *sd, u8 reg) /* ------------------------------------------------------------------------ */ -static int upd64083_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int upd64083_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct upd64083_state *state = to_state(sd); u8 r00, r02; - if (route->input > 7 || (route->input & 6) == 6) + if (input > 7 || (input & 6) == 6) return -EINVAL; - state->mode = (route->input & 3) << 6; - state->ext_y_adc = (route->input & UPD64083_EXT_Y_ADC) << 3; + state->mode = (input & 3) << 6; + state->ext_y_adc = (input & UPD64083_EXT_Y_ADC) << 3; r00 = (state->regs[R00] & ~(3 << 6)) | state->mode; r02 = (state->regs[R02] & ~(1 << 5)) | state->ext_y_adc; upd64083_write(sd, R00, r00); diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index a0feb1c97736..8bc03b9e1315 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c @@ -2597,7 +2597,6 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) /* inputs #1 and #2 are variable for SAA7111 and SAA7113 */ int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3}; int audio[]= {1, 0, 0, 0}; - struct v4l2_routing route; //channel 0 is TV with audiochannel 1 (tuner mono) //channel 1 is Composite with audio channel 0 (line in) //channel 2 is S-Video with audio channel 0 (line in) @@ -2630,9 +2629,7 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) mode[2] = SAA7115_SVIDEO1; break; } - route.input = mode[channel]; - route.output = 0; - call_all(usbvision, video, s_routing, &route); + call_all(usbvision, video, s_routing, mode[channel], 0, 0); usbvision_set_audio(usbvision, audio[channel]); return 0; } diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 2fb745464311..43e0998adb53 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c @@ -2565,12 +2565,11 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) int input; int data_norm; v4l2_std_id norm; - struct v4l2_routing route = { 0, 0 }; input = VINO_INPUT_COMPOSITE; - route.input = vino_get_saa7191_input(input); - ret = decoder_call(video, s_routing, &route); + ret = decoder_call(video, s_routing, + vino_get_saa7191_input(input), 0, 0); if (ret) { ret = -EINVAL; goto out; @@ -2656,10 +2655,9 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) if (vino_drvdata->decoder_owner == vcs->channel) { int data_norm; v4l2_std_id norm; - struct v4l2_routing route = { 0, 0 }; - route.input = vino_get_saa7191_input(input); - ret = decoder_call(video, s_routing, &route); + ret = decoder_call(video, s_routing, + vino_get_saa7191_input(input), 0, 0); if (ret) { vino_drvdata->decoder_owner = VINO_NO_CHANNEL; ret = -EINVAL; diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 59a8bb046c35..97e0ce28ff18 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c @@ -376,33 +376,34 @@ static int vpx3220_s_std(struct v4l2_subdev *sd, v4l2_std_id std) return 0; } -static int vpx3220_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int vpx3220_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { int data; - /* RJ: route->input = 0: ST8 (PCTV) input - route->input = 1: COMPOSITE input - route->input = 2: SVHS input */ + /* RJ: input = 0: ST8 (PCTV) input + input = 1: COMPOSITE input + input = 2: SVHS input */ - const int input[3][2] = { + const int input_vals[3][2] = { {0x0c, 0}, {0x0d, 0}, {0x0e, 1} }; - if (route->input < 0 || route->input > 2) + if (input < 0 || input > 2) return -EINVAL; - v4l2_dbg(1, debug, sd, "input switched to %s\n", inputs[route->input]); + v4l2_dbg(1, debug, sd, "input switched to %s\n", inputs[input]); - vpx3220_write(sd, 0x33, input[route->input][0]); + vpx3220_write(sd, 0x33, input_vals[input][0]); data = vpx3220_fp_read(sd, 0xf2) & ~(0x0020); if (data < 0) return data; /* 0x0010 is required to latch the setting */ vpx3220_fp_write(sd, 0xf2, - data | (input[route->input][1] << 5) | 0x0010); + data | (input_vals[input][1] << 5) | 0x0010); udelay(10); return 0; diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index eddf11abe1d9..f1f261a35245 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -79,7 +79,8 @@ static int wm8775_write(struct v4l2_subdev *sd, int reg, u16 val) return -1; } -static int wm8775_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) +static int wm8775_s_routing(struct v4l2_subdev *sd, + u32 input, u32 output, u32 config) { struct wm8775_state *state = to_state(sd); @@ -88,11 +89,11 @@ static int wm8775_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r 16 combinations. If only one input is active (the normal case) then the input values 1, 2, 4 or 8 should be used. */ - if (route->input > 15) { - v4l2_err(sd, "Invalid input %d.\n", route->input); + if (input > 15) { + v4l2_err(sd, "Invalid input %d.\n", input); return -EINVAL; } - state->input = route->input; + state->input = input; if (state->muted) return 0; wm8775_write(sd, R21, 0x0c0); diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 1ef70b090c4c..ea6c577b0eb3 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c @@ -1087,10 +1087,8 @@ zr36057_init (struct zoran *zr) detect_guest_activity(zr); test_interrupts(zr); if (!pass_through) { - struct v4l2_routing route = { 2, 0 }; - decoder_call(zr, video, s_stream, 0); - encoder_call(zr, video, s_routing, &route); + encoder_call(zr, video, s_routing, 2, 0, 0); } zr->zoran_proc = NULL; diff --git a/drivers/media/video/zoran/zoran_device.c b/drivers/media/video/zoran/zoran_device.c index 25e565f0502a..f6c2fb4fc3b4 100644 --- a/drivers/media/video/zoran/zoran_device.c +++ b/drivers/media/video/zoran/zoran_device.c @@ -971,7 +971,6 @@ zr36057_enable_jpg (struct zoran *zr, struct vfe_settings cap; int field_size = zr->jpg_buffers.buffer_size / zr->jpg_settings.field_per_buff; - struct v4l2_routing route = { 0, 0 }; zr->codec_mode = mode; @@ -994,8 +993,7 @@ zr36057_enable_jpg (struct zoran *zr, */ set_videobus_dir(zr, 0); decoder_call(zr, video, s_stream, 1); - route.input = 0; - encoder_call(zr, video, s_routing, &route); + encoder_call(zr, video, s_routing, 0, 0, 0); /* Take the JPEG codec and the VFE out of sleep */ jpeg_codec_sleep(zr, 0); @@ -1043,8 +1041,7 @@ zr36057_enable_jpg (struct zoran *zr, */ decoder_call(zr, video, s_stream, 0); set_videobus_dir(zr, 1); - route.input = 1; - encoder_call(zr, video, s_routing, &route); + encoder_call(zr, video, s_routing, 1, 0, 0); /* Take the JPEG codec and the VFE out of sleep */ jpeg_codec_sleep(zr, 0); @@ -1089,8 +1086,7 @@ zr36057_enable_jpg (struct zoran *zr, zr36057_adjust_vfe(zr, mode); decoder_call(zr, video, s_stream, 1); - route.input = 0; - encoder_call(zr, video, s_routing, &route); + encoder_call(zr, video, s_routing, 0, 0, 0); dprintk(2, KERN_INFO "%s: enable_jpg(IDLE)\n", ZR_DEVNAME(zr)); break; @@ -1571,8 +1567,6 @@ zoran_set_pci_master (struct zoran *zr, void zoran_init_hardware (struct zoran *zr) { - struct v4l2_routing route = { 0, 0 }; - /* Enable bus-mastering */ zoran_set_pci_master(zr, 1); @@ -1581,16 +1575,14 @@ zoran_init_hardware (struct zoran *zr) zr->card.init(zr); } - route.input = zr->card.input[zr->input].muxsel; - decoder_call(zr, core, init, 0); decoder_call(zr, core, s_std, zr->norm); - decoder_call(zr, video, s_routing, &route); + decoder_call(zr, video, s_routing, + zr->card.input[zr->input].muxsel, 0, 0); encoder_call(zr, core, init, 0); encoder_call(zr, video, s_std_output, zr->norm); - route.input = 0; - encoder_call(zr, video, s_routing, &route); + encoder_call(zr, video, s_routing, 0, 0, 0); /* toggle JPEG codec sleep to sync PLL */ jpeg_codec_sleep(zr, 1); diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 979e8d0e80f5..092333b1c34f 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c @@ -1018,10 +1018,8 @@ zoran_close(struct file *file) zoran_set_pci_master(zr, 0); if (!pass_through) { /* Switch to color bar */ - struct v4l2_routing route = { 2, 0 }; - decoder_call(zr, video, s_stream, 0); - encoder_call(zr, video, s_routing, &route); + encoder_call(zr, video, s_routing, 2, 0, 0); } } @@ -1496,8 +1494,6 @@ static int zoran_set_input (struct zoran *zr, int input) { - struct v4l2_routing route = { 0, 0 }; - if (input == zr->input) { return 0; } @@ -1519,10 +1515,10 @@ zoran_set_input (struct zoran *zr, return -EINVAL; } - route.input = zr->card.input[input].muxsel; zr->input = input; - decoder_call(zr, video, s_routing, &route); + decoder_call(zr, video, s_routing, + zr->card.input[input].muxsel, 0, 0); return 0; } @@ -1748,7 +1744,6 @@ jpgreqbuf_unlock_and_return: case BUZIOC_G_STATUS: { struct zoran_status *bstat = arg; - struct v4l2_routing route = { 0, 0 }; int status = 0, res = 0; v4l2_std_id norm; @@ -1762,8 +1757,6 @@ jpgreqbuf_unlock_and_return: return -EINVAL; } - route.input = zr->card.input[bstat->input].muxsel; - mutex_lock(&zr->resource_lock); if (zr->codec_mode != BUZ_MODE_IDLE) { @@ -1775,7 +1768,8 @@ jpgreqbuf_unlock_and_return: goto gstat_unlock_and_return; } - decoder_call(zr, video, s_routing, &route); + decoder_call(zr, video, s_routing, + zr->card.input[bstat->input].muxsel, 0, 0); /* sleep 1 second */ ssleep(1); @@ -1785,8 +1779,8 @@ jpgreqbuf_unlock_and_return: decoder_call(zr, video, g_input_status, &status); /* restore previous input and norm */ - route.input = zr->card.input[zr->input].muxsel; - decoder_call(zr, video, s_routing, &route); + decoder_call(zr, video, s_routing, + zr->card.input[zr->input].muxsel, 0, 0); gstat_unlock_and_return: mutex_unlock(&zr->resource_lock); diff --git a/include/media/msp3400.h b/include/media/msp3400.h index 6ab854931c05..90cf22ada8b4 100644 --- a/include/media/msp3400.h +++ b/include/media/msp3400.h @@ -54,13 +54,13 @@ ======= So to specify a complete routing scheme for the msp3400 you will have to - specify in the 'input' field of the v4l2_routing struct: + specify in the 'input' arg of the s_routing function: 1) which tuner input to use 2) which SCART input to use 3) which DSP input to use for each DSP output - And in the 'output' field of the v4l2_routing struct you specify: + And in the 'output' arg of the s_routing function you specify: 1) which SCART input to use for each SCART output diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index df4a76800bd6..17856081c809 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -148,7 +148,8 @@ struct v4l2_subdev_tuner_ops { board designs. Usual values for the frequency are 1024000 and 2048000. If the frequency is not supported, then -EINVAL is returned. - s_routing: used to define the input and/or output pins of an audio chip. + s_routing: used to define the input and/or output pins of an audio chip, + and any additional configuration data. Never attempt to use user-level input IDs (e.g. Composite, S-Video, Tuner) at this level. An i2c device shouldn't know about whether an input pin is connected to a Composite connector, become on another @@ -159,7 +160,7 @@ struct v4l2_subdev_tuner_ops { struct v4l2_subdev_audio_ops { int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); - int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route); + int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); }; /* @@ -200,7 +201,7 @@ struct v4l2_subdev_audio_ops { devices. */ struct v4l2_subdev_video_ops { - int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route); + int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line); int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data); -- cgit v1.2.3-59-g8ed1b