aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 15:25:37 -0200
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 15:25:37 -0200
commit9bb13a6dc3a6f68c990264838ff0493d900c48d7 (patch)
tree274f9dfdcbbbff9f7a382df772a6f2efa9247cc7
parente1bc80adaf801bf75ca176b9c1b60b3cceee1e03 (diff)
downloadlinux-9bb13a6dc3a6f68c990264838ff0493d900c48d7.tar.gz
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 57779e63f35d34..58f7b4194a0d51 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -30,6 +30,7 @@
#include <media/tuner.h>
#include <media/audiochip.h>
#include <media/tveeprom.h>
+#include <media/v4l2-common.h>
#include "msp3400.h"
#include "em28xx.h"
@@ -261,7 +262,6 @@ void em28xx_card_setup(struct em28xx *dev)
/* request some modules */
if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) {
struct tveeprom tv;
- struct v4l2_audioout ao;
#ifdef CONFIG_MODULES
request_module("tveeprom");
request_module("ir-kbd-i2c");
@@ -274,12 +274,8 @@ void em28xx_card_setup(struct em28xx *dev)
dev->tuner_type= tv.tuner_type;
if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
+ dev->i2s_speed=2048000;
dev->has_msp34xx=1;
- memset (&ao,0,sizeof(ao));
-
- ao.index=2;
- ao.mode=V4L2_AUDMODE_32BITS;
- em28xx_i2c_call_clients(dev, VIDIOC_S_AUDOUT, &ao);
} else
dev->has_msp34xx=0;
}
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 5e831fccf3fd4c..0b5557c479aedc 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)
em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput);
if (dev->has_msp34xx) {
+ if (dev->i2s_speed)
+ em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed);
em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput);
ainput = EM28XX_AUDIO_SRC_TUNER;
em28xx_audio_source(dev, ainput);
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 5c7a41ce69f37c..ffa9acc9be37c7 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -216,6 +216,8 @@ struct em28xx {
unsigned int has_msp34xx:1;
unsigned int has_tda9887:1;
+ u32 i2s_speed; /* I2S speed for audio digital stream */
+
enum em28xx_decoder decoder;
int tuner_type; /* type of the tuner */
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index fd0589352822d6..11235c1ac5c6b7 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -54,6 +54,7 @@
#include <linux/videodev.h>
#include <media/audiochip.h>
+#include <media/v4l2-common.h>
#include "msp3400.h"
/* ---------------------------------------------------------------------- */
@@ -2104,23 +2105,36 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (a->index<0||a->index>2)
return -EINVAL;
- if (a->index==2) {
- if (a->mode == V4L2_AUDMODE_32BITS)
- msp->i2s_mode=1;
- else
- msp->i2s_mode=0;
- }
- msp3400_dbg("Setting audio out on msp34xx to input %i, mode %i\n",a->index,msp->i2s_mode);
+ msp3400_dbg("Setting audio out on msp34xx to input %i\n",a->index);
msp3400c_set_scart(client,msp->in_scart,a->index+1);
break;
}
+ case VIDIOC_INT_I2S_CLOCK_FREQ:
+ {
+ u32 *a=(u32 *)arg;
+
+ msp3400_dbg("Setting I2S speed to %d\n",*a);
+
+ switch (*a) {
+ case 1024000:
+ msp->i2s_mode=0;
+ break;
+ case 2048000:
+ msp->i2s_mode=1;
+ break;
+ default:
+ return -EINVAL;
+ }
+ break;
+ }
+
case VIDIOC_QUERYCTRL:
{
struct v4l2_queryctrl *qc = arg;
int i;
- msp3400_dbg("VIDIOC_QUERYCTRL");
+ msp3400_dbg("VIDIOC_QUERYCTRL\n");
for (i = 0; i < ARRAY_SIZE(msp34xx_qctrl); i++)
if (qc->id && qc->id == msp34xx_qctrl[i].id) {
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b2f5e864b39728..6ac7c1f7902fba 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -895,7 +895,6 @@ struct v4l2_audio
/* Flags for the 'mode' field */
#define V4L2_AUDMODE_AVL 0x00001
-#define V4L2_AUDMODE_32BITS 0x00002
struct v4l2_audioout
{
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index d3fd48157eb8bb..2f2402996409af 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -107,4 +107,11 @@ enum v4l2_chip_ident {
be made. */
#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *)
+/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
+ clock used by driving digital audio streams at some board designs.
+ Usual values for the frequency are 1024000 and 2048000.
+ If the frequency is not supported, then -EINVAL is returned. */
+#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
+
+
#endif /* V4L2_COMMON_H_ */