From c7b0ac0546985fc6361a8d92cf808d46da797677 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 10 Mar 2006 12:29:15 -0300 Subject: V4L/DVB (3516): Make video_buf more generic Video_buf were concerned to allow PCI devices to be used as video capture devices. This patch extends video_buf features by virtualizing pci-dependent functions and allowing other type of devices to use it. It is still DMA centric, although it may be used also by devices that emulates scatter/gather behavior or a DMA device Signed-off-by: Mauro Carvalho Chehab --- include/media/saa7146_vv.h | 3 ++- include/media/video-buf.h | 56 +++++++++++++++++++++++++++++++++------------- 2 files changed, 43 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index e5e749e984e..4507cb61ae9 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h @@ -197,7 +197,8 @@ void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); void saa7146_buffer_timeout(unsigned long data); -void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf); +void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, + struct saa7146_buf *buf); int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); int saa7146_vv_release(struct saa7146_dev* dev); diff --git a/include/media/video-buf.h b/include/media/video-buf.h index d90dec5484e..fff3fd0fbf9 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h @@ -1,15 +1,20 @@ /* * * generic helper functions for video4linux capture buffers, to handle - * memory management and PCI DMA. Right now bttv + saa7134 use it. + * memory management and PCI DMA. + * Right now, bttv, saa7134, saa7146 and cx88 use it. * * The functions expect the hardware being able to scatter gatter * (i.e. the buffers are not linear in physical memory, but fragmented * into PAGE_SIZE chunks). They also assume the driver does not need - * to touch the video data (thus it is probably not useful for USB as - * data often must be uncompressed by the drivers). + * to touch the video data. + * + * device specific map/unmap/sync stuff now are mapped as file operations + * to allow its usage by USB and virtual devices. * * (c) 2001,02 Gerd Knorr + * (c) 2006 Mauro Carvalho Chehab, + * (c) 2006 Ted Walther and John Sokol * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +43,9 @@ struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset); +struct videobuf_buffer; +struct videobuf_queue; + /* --------------------------------------------------------------------- */ /* @@ -49,7 +57,7 @@ struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, * pointer + length. The kernel version just wants the size and * does memory allocation too using vmalloc_32(). * - * videobuf_dma_pci_*() + * videobuf_dma_*() * see Documentation/DMA-mapping.txt, these functions to * basically the same. The map function does also build a * scatterlist for the buffer (and unmap frees it ...) @@ -86,12 +94,18 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, int nr_pages); int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, dma_addr_t addr, int nr_pages); -int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma); -int videobuf_dma_pci_sync(struct pci_dev *dev, - struct videobuf_dmabuf *dma); -int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma); int videobuf_dma_free(struct videobuf_dmabuf *dma); +int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); +int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); +int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); + + /*FIXME: these variants are used only on *-alsa code, where videobuf is + * used without queue + */ +int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); +int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); + /* --------------------------------------------------------------------- */ /* @@ -115,9 +129,6 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma); * */ -struct videobuf_buffer; -struct videobuf_queue; - struct videobuf_mapping { unsigned int count; unsigned long start; @@ -164,6 +175,10 @@ struct videobuf_buffer { struct timeval ts; }; +typedef int (vb_map_sg_t)(void *dev,struct scatterlist *sglist,int nr_pages, + int direction); + + struct videobuf_queue_ops { int (*buf_setup)(struct videobuf_queue *q, unsigned int *count, unsigned int *size); @@ -174,12 +189,20 @@ struct videobuf_queue_ops { struct videobuf_buffer *vb); void (*buf_release)(struct videobuf_queue *q, struct videobuf_buffer *vb); + + /* Helper operations - device dependent. + * If null, videobuf_init defaults all to PCI handling + */ + + vb_map_sg_t *vb_map_sg; + vb_map_sg_t *vb_dma_sync_sg; + vb_map_sg_t *vb_unmap_sg; }; struct videobuf_queue { struct mutex lock; spinlock_t *irqlock; - struct pci_dev *pci; + void *dev; /* on pci, points to struct pci_dev */ enum v4l2_buf_type type; unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ @@ -204,12 +227,15 @@ struct videobuf_queue { void* videobuf_alloc(unsigned int size); int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); -int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, - struct v4l2_framebuffer *fbuf); +int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, + struct v4l2_framebuffer *fbuf); + +/* Maps fops to PCI stuff */ +void videobuf_queue_pci(struct videobuf_queue* q); void videobuf_queue_init(struct videobuf_queue *q, struct videobuf_queue_ops *ops, - struct pci_dev *pci, + void *dev, spinlock_t *irqlock, enum v4l2_buf_type type, enum v4l2_field field, -- cgit v1.2.3 From fa3fcceb30eb8a3cb2ac299c207c6f89b9aed379 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 23 Mar 2006 21:45:24 -0300 Subject: V4L/DVB (3546): Fix Compilation after moving bttv code - Missing a Makefile for bt8xx - rds.h were at wrong directory, since it is a global header for an internal interface - tda7432 and tda9875 were dependent from bttv.h - bttv.h were holding i2c addresses Signed-off-by: Mauro Carvalho Chehab --- include/media/i2c-addr.h | 30 ++++++++++++++++++++++++++++++ include/media/rds.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 include/media/i2c-addr.h create mode 100644 include/media/rds.h (limited to 'include') diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h new file mode 100644 index 00000000000..4212832d48a --- /dev/null +++ b/include/media/i2c-addr.h @@ -0,0 +1,30 @@ +/* + * V4L I2C address list + * + * + * Copyright (C) 2006 Mauro Carvalho Chehab + * Based on a previous mapping by + * Ralph Metzler (rjkm@thp.uni-koeln.de) + * Gerd Knorr + * + */ + +/* bttv address list */ +#define I2C_TSA5522 0xc2 +#define I2C_TDA7432 0x8a +#define I2C_BT832_ALT1 0x88 +#define I2C_BT832_ALT2 0x8a // alternate setting +#define I2C_TDA8425 0x82 +#define I2C_TDA9840 0x84 +#define I2C_TDA9850 0xb6 /* also used by 9855,9873 */ +#define I2C_TDA9874 0xb0 /* also used by 9875 */ +#define I2C_TDA9875 0xb0 +#define I2C_HAUPEE 0xa0 +#define I2C_STBEE 0xae +#define I2C_VHX 0xc0 +#define I2C_MSP3400 0x80 +#define I2C_MSP3400_ALT 0x88 +#define I2C_TEA6300 0x80 /* also used by 6320 */ +#define I2C_DPL3518 0x84 +#define I2C_TDA9887 0x86 + diff --git a/include/media/rds.h b/include/media/rds.h new file mode 100644 index 00000000000..951c1ae0be7 --- /dev/null +++ b/include/media/rds.h @@ -0,0 +1,44 @@ +/* + + Types and defines needed for RDS. This is included by + saa6588.c and every driver (e.g. bttv-driver.c) that wants + to use the saa6588 module. + + Instead of having a seperate rds.h, I'd prefer to include + this stuff in one of the already existing files like tuner.h + + (c) 2005 by Hans J. Koch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef _RDS_H +#define _RDS_H + +struct rds_command { + unsigned int block_count; + int result; + unsigned char __user *buffer; + struct file *instance; + poll_table *event_list; +}; + +#define RDS_CMD_OPEN _IOW('R',1,int) +#define RDS_CMD_CLOSE _IOW('R',2,int) +#define RDS_CMD_READ _IOR('R',3,int) +#define RDS_CMD_POLL _IOR('R',4,int) + +#endif -- cgit v1.2.3 From 7c9b5048305ead226fb16def98d86f3ed67c4807 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 18 Mar 2006 08:08:14 -0300 Subject: V4L/DVB (3547): Tvaudio.h are just i2c addresses. Merged into i2c-addr.h Signed-off-by: Mauro Carvalho Chehab --- include/media/i2c-addr.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h index 4212832d48a..7b0f5fe94e0 100644 --- a/include/media/i2c-addr.h +++ b/include/media/i2c-addr.h @@ -28,3 +28,17 @@ #define I2C_DPL3518 0x84 #define I2C_TDA9887 0x86 +/* + * i2c bus addresses for the chips supported by tvaudio.c + */ + +#define I2C_TDA8425 0x82 +#define I2C_TDA9840 0x84 /* also used by TA8874Z */ +#define I2C_TDA985x_L 0xb4 /* also used by 9873 */ +#define I2C_TDA985x_H 0xb6 +#define I2C_TDA9874 0xb0 /* also used by 9875 */ + +#define I2C_TEA6300 0x80 /* also used by 6320 */ +#define I2C_TEA6420 0x98 + +#define I2C_PIC16C54 0x96 /* PV951 */ -- cgit v1.2.3 From 09df1c163adcf43e2c4234b52985f34b95b7634e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 18 Mar 2006 08:31:34 -0300 Subject: V4L/DVB (3548): Renamed I2C_foo addresses to I2C_ADDR_foo I2C_foo were used for some i2c addresses. Bad, since those constants could mean other i2c chip things. Signed-off-by: Mauro Carvalho Chehab --- include/media/i2c-addr.h | 58 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'include') diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h index 7b0f5fe94e0..e7ff44a35ca 100644 --- a/include/media/i2c-addr.h +++ b/include/media/i2c-addr.h @@ -1,44 +1,44 @@ /* - * V4L I2C address list + * V4L I2C address list * * - * Copyright (C) 2006 Mauro Carvalho Chehab + * Copyright (C) 2006 Mauro Carvalho Chehab * Based on a previous mapping by - * Ralph Metzler (rjkm@thp.uni-koeln.de) - * Gerd Knorr + * Ralph Metzler (rjkm@thp.uni-koeln.de) + * Gerd Knorr * */ /* bttv address list */ -#define I2C_TSA5522 0xc2 -#define I2C_TDA7432 0x8a -#define I2C_BT832_ALT1 0x88 -#define I2C_BT832_ALT2 0x8a // alternate setting -#define I2C_TDA8425 0x82 -#define I2C_TDA9840 0x84 -#define I2C_TDA9850 0xb6 /* also used by 9855,9873 */ -#define I2C_TDA9874 0xb0 /* also used by 9875 */ -#define I2C_TDA9875 0xb0 -#define I2C_HAUPEE 0xa0 -#define I2C_STBEE 0xae -#define I2C_VHX 0xc0 -#define I2C_MSP3400 0x80 -#define I2C_MSP3400_ALT 0x88 -#define I2C_TEA6300 0x80 /* also used by 6320 */ -#define I2C_DPL3518 0x84 -#define I2C_TDA9887 0x86 +#define I2C_ADDR_TSA5522 0xc2 +#define I2C_ADDR_TDA7432 0x8a +#define I2C_ADDR_BT832_ALT1 0x88 +#define I2C_ADDR_BT832_ALT2 0x8a // alternate setting +#define I2C_ADDR_TDA8425 0x82 +#define I2C_ADDR_TDA9840 0x84 +#define I2C_ADDR_TDA9850 0xb6 /* also used by 9855,9873 */ +#define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */ +#define I2C_ADDR_TDA9875 0xb0 +#define I2C_ADDR_HAUPEE 0xa0 +#define I2C_ADDR_STBEE 0xae +#define I2C_ADDR_VHX 0xc0 +#define I2C_ADDR_MSP3400 0x80 +#define I2C_ADDR_MSP3400_ALT 0x88 +#define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */ +#define I2C_ADDR_DPL3518 0x84 +#define I2C_ADDR_TDA9887 0x86 /* * i2c bus addresses for the chips supported by tvaudio.c */ -#define I2C_TDA8425 0x82 -#define I2C_TDA9840 0x84 /* also used by TA8874Z */ -#define I2C_TDA985x_L 0xb4 /* also used by 9873 */ -#define I2C_TDA985x_H 0xb6 -#define I2C_TDA9874 0xb0 /* also used by 9875 */ +#define I2C_ADDR_TDA8425 0x82 +#define I2C_ADDR_TDA9840 0x84 /* also used by TA8874Z */ +#define I2C_ADDR_TDA985x_L 0xb4 /* also used by 9873 */ +#define I2C_ADDR_TDA985x_H 0xb6 +#define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */ -#define I2C_TEA6300 0x80 /* also used by 6320 */ -#define I2C_TEA6420 0x98 +#define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */ +#define I2C_ADDR_TEA6420 0x98 -#define I2C_PIC16C54 0x96 /* PV951 */ +#define I2C_ADDR_PIC16C54 0x96 /* PV951 */ -- cgit v1.2.3 From 8bf2f8e747700419cc5bbc56c4496774eb8f2f1f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Mar 2006 21:31:00 -0300 Subject: V4L/DVB (3577): Cleanup audio input handling Cleanup audio input handling in bttv and tvaudio: - inputs were specified that were never used - mute was handled as a special input which led to confusing code - confusing naming made it difficult to see if the setting was for i2c or gpio. The old audiochip.h input names moved to tvaudio.h. Currently this is used both by tvaudio and msp3400 until the msp3400 implements the new msp3400-specific inputs. Detect in bttv the tvaudio and msp3400 i2c clients and use these client pointers to set the inputs directly instead of broadcasting the command. Removed AUDC_SET_INPUT. Now replaced by VIDIOC_S_AUDIO. This will be replaced again later by the new ROUTING commands. Removed VIDIOC_G_AUDIO implementations in i2c drivers: this command is a user level command and not to be used internally. It wasn't called at all anyway. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/audiochip.h | 14 -------------- include/media/tvaudio.h | 30 ++++++++++++++++++++++++++++++ include/media/v4l2-common.h | 11 ++++------- 3 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 include/media/tvaudio.h (limited to 'include') diff --git a/include/media/audiochip.h b/include/media/audiochip.h index 295d256ee81..1fd4a220757 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h @@ -21,18 +21,4 @@ enum audiochip { AUDIO_CHIP_MSP34XX }; -/* ---------------------------------------------------------------------- */ - -/* audio inputs */ -#define AUDIO_TUNER 0x00 -#define AUDIO_RADIO 0x01 -#define AUDIO_EXTERN 0x02 -#define AUDIO_INTERN 0x03 -#define AUDIO_OFF 0x04 -#define AUDIO_ON 0x05 -#define AUDIO_EXTERN_1 AUDIO_EXTERN -#define AUDIO_EXTERN_2 0x06 -#define AUDIO_MUTE 0x80 -#define AUDIO_UNMUTE 0x81 - #endif /* AUDIOCHIP_H */ diff --git a/include/media/tvaudio.h b/include/media/tvaudio.h new file mode 100644 index 00000000000..6915aafc875 --- /dev/null +++ b/include/media/tvaudio.h @@ -0,0 +1,30 @@ +/* + tvaudio.h - definition for tvaudio inputs + + Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _TVAUDIO_H +#define _TVAUDIO_H + +/* The tvaudio module accepts the following inputs: */ +#define TVAUDIO_INPUT_TUNER 0 +#define TVAUDIO_INPUT_RADIO 1 +#define TVAUDIO_INPUT_EXTERN 2 +#define TVAUDIO_INPUT_INTERN 3 + +#endif diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 2360453e749..07130474a0d 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -123,9 +123,6 @@ enum v4l2_chip_ident { /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ #define AUDC_SET_RADIO _IO('d',88) -/* select from TV,radio,extern,MUTE, to be replaced with VIDIOC_INT_S_AUDIO_ROUTING */ -#define AUDC_SET_INPUT _IOW('d',89,int) - /* msp3400 ioctl: will be removed in the near future, to be replaced by VIDIOC_INT_S_AUDIO_ROUTING. */ struct msp_matrix { @@ -209,10 +206,10 @@ struct v4l2_routing { }; /* These internal commands should be used to define the inputs and outputs - of an audio/video chip. They will replace AUDC_SET_INPUT. - The v4l2 API commands VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, - VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT are meant to be used by the - user. Internally these commands should be used to switch inputs/outputs + of an audio/video chip. They will replace the v4l2 API commands + VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT + that are meant to be used by the user. + The internal commands should be used to switch inputs/outputs because only the driver knows how to map a 'Television' input to the precise input/output routing of an A/D converter, or a DSP, or a video digitizer. These four commands should only be sent directly to an i2c device, they -- cgit v1.2.3 From 49965a80a4c4f5cbe15fb3bb1f8f8b0ec4ef02bc Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Mar 2006 08:45:38 -0300 Subject: V4L/DVB (3581): Add new media/msp3400.h header containing the routing macros Moved msp3400.h to msp3400-driver.h. Created media/msp3400.h with the new routing defines and lots of comments. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/msp3400.h | 221 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 include/media/msp3400.h (limited to 'include') diff --git a/include/media/msp3400.h b/include/media/msp3400.h new file mode 100644 index 00000000000..26e26585273 --- /dev/null +++ b/include/media/msp3400.h @@ -0,0 +1,221 @@ +/* + msp3400.h - definition for msp3400 inputs and outputs + + Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _MSP3400_H_ +#define _MSP3400_H_ + +/* msp3400 routing + =============== + + The msp3400 has a complicated routing scheme with many possible + combinations. The details are all in the datasheets but I will try + to give a short description here. + + Inputs + ====== + + There are 1) tuner inputs, 2) I2S inputs, 3) SCART inputs. You will have + to select which tuner input to use and which SCART input to use. The + selected tuner input, the selected SCART input and all I2S inputs go to + the DSP (the tuner input first goes through the demodulator). + + The DSP handles things like volume, bass/treble, balance, and some chips + have support for surround sound. It has several outputs: MAIN, AUX, I2S + and SCART1/2. Each output can select which DSP input to use. So the MAIN + output can select the tuner input while at the same time the SCART1 output + uses the I2S input. + + Outputs + ======= + + Most DSP outputs are also the outputs of the msp3400. However, the SCART + outputs of the msp3400 can select which input to use: either the SCART1 or + SCART2 output from the DSP, or the msp3400 SCART inputs, thus completely + bypassing the DSP. + + Summary + ======= + + So to specify a complete routing scheme for the msp3400 you will have to + specify in the 'input' field of the v4l2_routing struct: + + 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: + + 1) which SCART input to use for each SCART output + + Depending on how the msp is wired to the other components you can + ignore or mute certain inputs or outputs. + + Also, depending on the msp version only a subset of the inputs or + outputs may be present. At the end of this header some tables are + added containing a list of what is available for each msp version. + */ + +/* Inputs to the DSP unit: two independent selections have to be made: + 1) the tuner (SIF) input + 2) the SCART input + Bits 0-2 are used for the SCART input select, bit 3 is used for the tuner + input, bits 4-7 are reserved. + */ + +/* SCART input to DSP selection */ +#define MSP_IN_SCART_1 0 /* Pin SC1_IN */ +#define MSP_IN_SCART_2 1 /* Pin SC2_IN */ +#define MSP_IN_SCART_3 2 /* Pin SC3_IN */ +#define MSP_IN_SCART_4 3 /* Pin SC4_IN */ +#define MSP_IN_MONO 6 /* Pin MONO_IN */ +#define MSP_IN_MUTE 7 /* Mute DSP input */ +#define MSP_SCART_TO_DSP(in) (in) +/* Tuner input to demodulator and DSP selection */ +#define MSP_IN_TUNER_1 0 /* Analog Sound IF input pin ANA_IN1 */ +#define MSP_IN_TUNER_2 1 /* Analog Sound IF input pin ANA_IN2 */ +#define MSP_TUNER_TO_DSP(in) ((in) << 3) + +/* The msp has up to 5 DSP outputs, each output can independently select + a DSP input. + + The DSP outputs are: loudspeaker output (aka MAIN), headphones output + (aka AUX), SCART1 DA output, SCART2 DA output and an I2S output. + There also is a quasi-peak detector output, but that is not used by + this driver and is set to the same input as the loudspeaker output. + Not all outputs are supported by all msp models. Setting the input + of an unsupported output will be ignored by the driver. + + There are up to 16 DSP inputs to choose from, so each output is + assigned 4 bits. + + Note: the 44x8G can mix two inputs and feed the result back to the + DSP. This is currently not implemented. Also not implemented is the + multi-channel capable I2S3 input of the 44x0G. If someone can demonstrate + a need for one of those features then additional support can be added. */ +#define MSP_DSP_OUT_TUNER 0 /* Tuner output */ +#define MSP_DSP_OUT_SCART 2 /* SCART output */ +#define MSP_DSP_OUT_I2S1 5 /* I2S1 output */ +#define MSP_DSP_OUT_I2S2 6 /* I2S2 output */ +#define MSP_DSP_OUT_I2S3 7 /* I2S3 output */ +#define MSP_DSP_OUT_MAIN_AVC 11 /* MAIN AVC processed output */ +#define MSP_DSP_OUT_MAIN 12 /* MAIN output */ +#define MSP_DSP_OUT_AUX 13 /* AUX output */ +#define MSP_DSP_TO_MAIN(in) ((in) << 4) +#define MSP_DSP_TO_AUX(in) ((in) << 8) +#define MSP_DSP_TO_SCART1(in) ((in) << 12) +#define MSP_DSP_TO_SCART2(in) ((in) << 16) +#define MSP_DSP_TO_I2S(in) ((in) << 20) + +/* Output SCART select: the SCART outputs can select which input + to use. */ +#define MSP_OUT_SCART1 0 /* SCART1 input, bypassing the DSP */ +#define MSP_OUT_SCART2 1 /* SCART2 input, bypassing the DSP */ +#define MSP_OUT_SCART3 2 /* SCART3 input, bypassing the DSP */ +#define MSP_OUT_SCART4 3 /* SCART4 input, bypassing the DSP */ +#define MSP_OUT_SCART1_DA 4 /* DSP SCART1 output */ +#define MSP_OUT_SCART2_DA 5 /* DSP SCART2 output */ +#define MSP_OUT_MONO 6 /* MONO input, bypassing the DSP */ +#define MSP_OUT_MUTE 7 /* MUTE output */ +#define MSP_OUT_TO_SCART1(in) (in) +#define MSP_OUT_TO_SCART2(in) ((in) << 4) + +/* Shortcut macros */ +#define MSP_INPUT(sc, t, main_aux_src, sc_i2s_src) \ + (MSP_SCART_TO_DSP(sc) | \ + MSP_TUNER_TO_DSP(t) | \ + MSP_DSP_TO_MAIN(main_aux_src) | \ + MSP_DSP_TO_AUX(main_aux_src) | \ + MSP_DSP_TO_SCART1(sc_i2s_src) | \ + MSP_DSP_TO_SCART2(sc_i2s_src) | \ + MSP_DSP_TO_I2S(sc_i2s_src)) +#define MSP_OUTPUT(sc) \ + (MSP_OUT_TO_SCART1(sc) | \ + MSP_OUT_TO_SCART2(sc)) + +/* Tuner inputs vs. msp version */ +/* Chip TUNER_1 TUNER_2 + ------------------------- + msp34x0b y y + msp34x0c y y + msp34x0d y y + msp34x5d y n + msp34x7d y n + msp34x0g y y + msp34x1g y y + msp34x2g y y + msp34x5g y n + msp34x7g y n + msp44x0g y y + msp44x8g y y + */ + +/* SCART inputs vs. msp version */ +/* Chip SC1 SC2 SC3 SC4 + ------------------------- + msp34x0b y y y n + msp34x0c y y y n + msp34x0d y y y y + msp34x5d y y n n + msp34x7d y n n n + msp34x0g y y y y + msp34x1g y y y y + msp34x2g y y y y + msp34x5g y y n n + msp34x7g y n n n + msp44x0g y y y y + msp44x8g y y y y + */ + +/* DSP inputs vs. msp version (tuner and SCART inputs are always available) */ +/* Chip I2S1 I2S2 I2S3 MAIN_AVC MAIN AUX + ------------------------------------------ + msp34x0b y n n n n n + msp34x0c y y n n n n + msp34x0d y y n n n n + msp34x5d y y n n n n + msp34x7d n n n n n n + msp34x0g y y n n n n + msp34x1g y y n n n n + msp34x2g y y n y y y + msp34x5g y y n n n n + msp34x7g n n n n n n + msp44x0g y y y y y y + msp44x8g y y y n n n + */ + +/* DSP outputs vs. msp version */ +/* Chip MAIN AUX SCART1 SCART2 I2S + ------------------------------------ + msp34x0b y y y n y + msp34x0c y y y n y + msp34x0d y y y y y + msp34x5d y n y n y + msp34x7d y n y n n + msp34x0g y y y y y + msp34x1g y y y y y + msp34x2g y y y y y + msp34x5g y n y n y + msp34x7g y n y n n + msp44x0g y y y y y + msp44x8g y y y y y + */ + +#endif /* MSP3400_H */ + -- cgit v1.2.3 From 2474ed444b475614ef795523076be7cc8437ae00 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Mar 2006 12:35:57 -0300 Subject: V4L/DVB (3582): Implement correct msp3400 input/output routing - implement VIDIOC_INT_S_AUDIO_ROUTING for msp3400 and tvaudio - use the new command in bttv, pvrusb2 and em28xx. - remove the now obsolete MSP_SET_MATRIX from msp3400 (yeah!) - remove the obsolete VIDIOC_S_AUDIO from msp3400. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/msp3400.h | 5 +++++ include/media/v4l2-common.h | 8 -------- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/media/msp3400.h b/include/media/msp3400.h index 26e26585273..0be61a021d4 100644 --- a/include/media/msp3400.h +++ b/include/media/msp3400.h @@ -145,9 +145,14 @@ MSP_DSP_TO_SCART1(sc_i2s_src) | \ MSP_DSP_TO_SCART2(sc_i2s_src) | \ MSP_DSP_TO_I2S(sc_i2s_src)) +#define MSP_INPUT_DEFAULT MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, \ + MSP_DSP_OUT_TUNER, MSP_DSP_OUT_TUNER) #define MSP_OUTPUT(sc) \ (MSP_OUT_TO_SCART1(sc) | \ MSP_OUT_TO_SCART2(sc)) +/* This equals the RESET position of the msp3400 ACB register */ +#define MSP_OUTPUT_DEFAULT (MSP_OUT_TO_SCART1(MSP_OUT_SCART3) | \ + MSP_OUT_TO_SCART2(MSP_OUT_SCART1_DA)) /* Tuner inputs vs. msp version */ /* Chip TUNER_1 TUNER_2 diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 07130474a0d..642520acdfa 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -123,14 +123,6 @@ enum v4l2_chip_ident { /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ #define AUDC_SET_RADIO _IO('d',88) -/* msp3400 ioctl: will be removed in the near future, to be replaced by - VIDIOC_INT_S_AUDIO_ROUTING. */ -struct msp_matrix { - int input; - int output; -}; -#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) - /* tuner ioctls */ /* Sets tuner type and its I2C addr */ -- cgit v1.2.3 From 301e22d69140898eddd38a9134da711cb5dfc170 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Mar 2006 17:15:00 -0300 Subject: V4L/DVB (3584): Implement V4L2_TUNER_MODE_LANG1_LANG2 audio mode Add a new audio mode V4L2_TUNER_MODE_LANG1_LANG2 (used by VIDIOC_G/S_TUNER). This mode allows the user to select both languages of a bilingual transmission, one language on the left, one on the right audio channel. If there is no bilingual transmission, or it is not supported, then this mode should act like V4L2_TUNER_MODE_STEREO. This mode is introduced for PVR-like drivers where it is useful to be able to record both languages of a bilingual broadcast. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 724cfbf54b8..2275bfec5b6 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -883,6 +883,7 @@ struct v4l2_modulator #define V4L2_TUNER_MODE_LANG2 0x0002 #define V4L2_TUNER_MODE_SAP 0x0002 #define V4L2_TUNER_MODE_LANG1 0x0003 +#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 struct v4l2_frequency { -- cgit v1.2.3 From a20c522498330ba0f4970a9bcd11890312277ae2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 23 Mar 2006 19:37:58 -0300 Subject: V4L/DVB (3598): Add bit algorithm adapter for the Conexant CX2341X boards. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/linux/i2c-id.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index ec311bc8943..679b46a6a56 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -184,6 +184,7 @@ #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ +#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ /* --- PCF 8584 based algorithms */ #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ -- cgit v1.2.3 From 7fa033b103bc3f5c37f934695473f63adf140dba Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 23 Mar 2006 20:12:26 -0300 Subject: V4L/DVB (3599): Implement new routing commands for wm8775 and cs53l32a. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/cs53l32a.h | 34 ++++++++++++++++++++++++++++++++++ include/media/wm8775.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 include/media/cs53l32a.h create mode 100644 include/media/wm8775.h (limited to 'include') diff --git a/include/media/cs53l32a.h b/include/media/cs53l32a.h new file mode 100644 index 00000000000..bf76197d379 --- /dev/null +++ b/include/media/cs53l32a.h @@ -0,0 +1,34 @@ +/* + cs53l32a.h - definition for cs53l32a inputs and outputs + + Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _CS53L32A_H_ +#define _CS53L32A_H_ + +/* 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. */ + +/* CS53L32A HW inputs */ +#define CS53L32A_IN0 0 +#define CS53L32A_IN1 1 +#define CS53L32A_IN2 2 + +#endif diff --git a/include/media/wm8775.h b/include/media/wm8775.h new file mode 100644 index 00000000000..60739c5a23a --- /dev/null +++ b/include/media/wm8775.h @@ -0,0 +1,35 @@ +/* + wm8775.h - definition for wm8775 inputs and outputs + + Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _WM8775_H_ +#define _WM8775_H_ + +/* The WM8775 has 4 inputs and one output. Zero or more inputs + are multiplexed together to the output. Hence there are + 16 combinations. + If only one input is active (the normal case) then the + input values 1, 2, 4 or 8 should be used. */ + +#define WM8775_AIN1 1 +#define WM8775_AIN2 2 +#define WM8775_AIN3 4 +#define WM8775_AIN4 8 + +#endif -- cgit v1.2.3