aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:25:37 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:25:37 -0500
commit9bb13a6dc3a6f68c990264838ff0493d900c48d7 (patch)
tree274f9dfdcbbbff9f7a382df772a6f2efa9247cc7
parente1bc80adaf801bf75ca176b9c1b60b3cceee1e03 (diff)
V4L/DVB (3233): Fixed API to set I2S speed control
- Created a new ioctl to control I2S speed. Old calls to an inadequate V4L2 API replaced. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/em28xx/em28xx.h2
-rw-r--r--drivers/media/video/msp3400.c30
-rw-r--r--include/linux/videodev2.h1
-rw-r--r--include/media/v4l2-common.h7
6 files changed, 35 insertions, 15 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 57779e63f35d..58f7b4194a0d 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -30,6 +30,7 @@
30#include <media/tuner.h> 30#include <media/tuner.h>
31#include <media/audiochip.h> 31#include <media/audiochip.h>
32#include <media/tveeprom.h> 32#include <media/tveeprom.h>
33#include <media/v4l2-common.h>
33#include "msp3400.h" 34#include "msp3400.h"
34 35
35#include "em28xx.h" 36#include "em28xx.h"
@@ -261,7 +262,6 @@ void em28xx_card_setup(struct em28xx *dev)
261 /* request some modules */ 262 /* request some modules */
262 if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) { 263 if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) {
263 struct tveeprom tv; 264 struct tveeprom tv;
264 struct v4l2_audioout ao;
265#ifdef CONFIG_MODULES 265#ifdef CONFIG_MODULES
266 request_module("tveeprom"); 266 request_module("tveeprom");
267 request_module("ir-kbd-i2c"); 267 request_module("ir-kbd-i2c");
@@ -274,12 +274,8 @@ void em28xx_card_setup(struct em28xx *dev)
274 274
275 dev->tuner_type= tv.tuner_type; 275 dev->tuner_type= tv.tuner_type;
276 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { 276 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
277 dev->i2s_speed=2048000;
277 dev->has_msp34xx=1; 278 dev->has_msp34xx=1;
278 memset (&ao,0,sizeof(ao));
279
280 ao.index=2;
281 ao.mode=V4L2_AUDMODE_32BITS;
282 em28xx_i2c_call_clients(dev, VIDIOC_S_AUDOUT, &ao);
283 } else 279 } else
284 dev->has_msp34xx=0; 280 dev->has_msp34xx=0;
285 } 281 }
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 5e831fccf3fd..0b5557c479ae 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -287,6 +287,8 @@ static void video_mux(struct em28xx *dev, int index)
287 em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); 287 em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput);
288 288
289 if (dev->has_msp34xx) { 289 if (dev->has_msp34xx) {
290 if (dev->i2s_speed)
291 em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed);
290 em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput); 292 em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput);
291 ainput = EM28XX_AUDIO_SRC_TUNER; 293 ainput = EM28XX_AUDIO_SRC_TUNER;
292 em28xx_audio_source(dev, ainput); 294 em28xx_audio_source(dev, ainput);
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 5c7a41ce69f3..ffa9acc9be37 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -216,6 +216,8 @@ struct em28xx {
216 unsigned int has_msp34xx:1; 216 unsigned int has_msp34xx:1;
217 unsigned int has_tda9887:1; 217 unsigned int has_tda9887:1;
218 218
219 u32 i2s_speed; /* I2S speed for audio digital stream */
220
219 enum em28xx_decoder decoder; 221 enum em28xx_decoder decoder;
220 222
221 int tuner_type; /* type of the tuner */ 223 int tuner_type; /* type of the tuner */
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index fd0589352822..11235c1ac5c6 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -54,6 +54,7 @@
54 54
55#include <linux/videodev.h> 55#include <linux/videodev.h>
56#include <media/audiochip.h> 56#include <media/audiochip.h>
57#include <media/v4l2-common.h>
57#include "msp3400.h" 58#include "msp3400.h"
58 59
59/* ---------------------------------------------------------------------- */ 60/* ---------------------------------------------------------------------- */
@@ -2104,23 +2105,36 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
2104 if (a->index<0||a->index>2) 2105 if (a->index<0||a->index>2)
2105 return -EINVAL; 2106 return -EINVAL;
2106 2107
2107 if (a->index==2) { 2108 msp3400_dbg("Setting audio out on msp34xx to input %i\n",a->index);
2108 if (a->mode == V4L2_AUDMODE_32BITS)
2109 msp->i2s_mode=1;
2110 else
2111 msp->i2s_mode=0;
2112 }
2113 msp3400_dbg("Setting audio out on msp34xx to input %i, mode %i\n",a->index,msp->i2s_mode);
2114 msp3400c_set_scart(client,msp->in_scart,a->index+1); 2109 msp3400c_set_scart(client,msp->in_scart,a->index+1);
2115 2110
2116 break; 2111 break;
2117 } 2112 }
2113 case VIDIOC_INT_I2S_CLOCK_FREQ:
2114 {
2115 u32 *a=(u32 *)arg;
2116
2117 msp3400_dbg("Setting I2S speed to %d\n",*a);
2118
2119 switch (*a) {
2120 case 1024000:
2121 msp->i2s_mode=0;
2122 break;
2123 case 2048000:
2124 msp->i2s_mode=1;
2125 break;
2126 default:
2127 return -EINVAL;
2128 }
2129 break;
2130 }
2131
2118 case VIDIOC_QUERYCTRL: 2132 case VIDIOC_QUERYCTRL:
2119 { 2133 {
2120 struct v4l2_queryctrl *qc = arg; 2134 struct v4l2_queryctrl *qc = arg;
2121 int i; 2135 int i;
2122 2136
2123 msp3400_dbg("VIDIOC_QUERYCTRL"); 2137 msp3400_dbg("VIDIOC_QUERYCTRL\n");
2124 2138
2125 for (i = 0; i < ARRAY_SIZE(msp34xx_qctrl); i++) 2139 for (i = 0; i < ARRAY_SIZE(msp34xx_qctrl); i++)
2126 if (qc->id && qc->id == msp34xx_qctrl[i].id) { 2140 if (qc->id && qc->id == msp34xx_qctrl[i].id) {
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b2f5e864b397..6ac7c1f7902f 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -895,7 +895,6 @@ struct v4l2_audio
895 895
896/* Flags for the 'mode' field */ 896/* Flags for the 'mode' field */
897#define V4L2_AUDMODE_AVL 0x00001 897#define V4L2_AUDMODE_AVL 0x00001
898#define V4L2_AUDMODE_32BITS 0x00002
899 898
900struct v4l2_audioout 899struct v4l2_audioout
901{ 900{
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index d3fd48157eb8..2f2402996409 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -107,4 +107,11 @@ enum v4l2_chip_ident {
107 be made. */ 107 be made. */
108#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *) 108#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *)
109 109
110/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
111 clock used by driving digital audio streams at some board designs.
112 Usual values for the frequency are 1024000 and 2048000.
113 If the frequency is not supported, then -EINVAL is returned. */
114#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
115
116
110#endif /* V4L2_COMMON_H_ */ 117#endif /* V4L2_COMMON_H_ */