summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-09-28 00:49:14 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-09-28 00:49:14 +0000
commitbb84958b07672daf56431357848fdc0d2bea2fcc (patch)
treec7048a9a1fed1d09760981941c291d87963ea2f1
parent262e00c9fd72059c751519c06b4f45ad09092b18 (diff)
downloadmediapointer-dvb-s2-bb84958b07672daf56431357848fdc0d2bea2fcc.tar.gz
mediapointer-dvb-s2-bb84958b07672daf56431357848fdc0d2bea2fcc.tar.bz2
- Some V4L2 API calls implemented on msp3400.c.
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
-rw-r--r--linux/drivers/media/video/msp3400-driver.c97
-rw-r--r--linux/drivers/media/video/msp3400.c97
-rw-r--r--v4l/ChangeLog8
3 files changed, 202 insertions, 0 deletions
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c
index b9ac5b2d1..23b46cacc 100644
--- a/linux/drivers/media/video/msp3400-driver.c
+++ b/linux/drivers/media/video/msp3400-driver.c
@@ -387,6 +387,9 @@ static void msp3400c_setvolume(struct i2c_client *client,
{
int val = 0, bal = 0;
+#if 1
+muted=0;
+#endif
if (!muted) {
/* 0x7f instead if 0x73 here has sound quality issues,
* probably due to overmodulation + clipping ... */
@@ -1010,6 +1013,8 @@ static int msp34xx_modus(int norm)
{
switch (norm) {
case VIDEO_MODE_PAL:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to PAL\n");
+
#if 1 /*KEEP*/
/* experimental: not sure this works with all chip versions */
return 0x7003;
@@ -1018,12 +1023,16 @@ static int msp34xx_modus(int norm)
return 0x1003;
#endif
case VIDEO_MODE_NTSC: /* BTSC */
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to NTSC\n");
return 0x2003;
case VIDEO_MODE_SECAM:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to SECAM\n");
return 0x0003;
case VIDEO_MODE_RADIO:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to Radio\n");
return 0x0003;
case VIDEO_MODE_AUTO:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to Auto\n");
return 0x2003;
default:
return 0x0003;
@@ -1527,6 +1536,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
dprintk("msp34xx: error while reading chip version\n");
return -1;
}
+ printk(KERN_INFO "msp34xx: rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2);
#if 0
/* this will turn on a 1kHz beep - might be useful for debugging... */
@@ -1798,6 +1808,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
msp_any_set_audmode(client,mode_v4l1_to_v4l2(va->mode));
break;
}
+
case VIDIOCSCHAN:
{
struct video_channel *vc = arg;
@@ -1818,6 +1829,92 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
}
/* --- v4l2 ioctls --- */
+ case VIDIOC_S_STD:
+ {
+ v4l2_std_id *id = arg;
+
+ /*FIXME: use V4L2 mode flags on msp3400 instead of V4L1*/
+ if (*id & V4L2_STD_PAL) {
+ msp->norm=VIDEO_MODE_PAL;
+ } else if (*id & V4L2_STD_SECAM) {
+ msp->norm=VIDEO_MODE_SECAM;
+ } else {
+ msp->norm=VIDEO_MODE_NTSC;
+ }
+
+ msp_wake_thread(client);
+ return 0;
+ }
+
+ case VIDIOC_G_AUDIO:
+ {
+ struct v4l2_audio *a = arg;
+
+ memset(a,0,sizeof(*a));
+
+ switch (a->index) {
+ case AUDIO_RADIO:
+ strcpy(a->name,"Radio");
+ break;
+ case AUDIO_EXTERN_1:
+ strcpy(a->name,"Extern 1");
+ break;
+ case AUDIO_EXTERN_2:
+ strcpy(a->name,"Extern 2");
+ break;
+ case AUDIO_TUNER:
+ strcpy(a->name,"Television");
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ msp_any_detect_stereo(client);
+ if (msp->audmode == V4L2_TUNER_MODE_STEREO) {
+ a->capability=V4L2_AUDCAP_STEREO;
+ }
+
+ break;
+ }
+ case VIDIOC_S_AUDIO:
+ {
+ struct v4l2_audio *sarg = arg;
+
+ switch (sarg->index) {
+ case AUDIO_RADIO:
+ /* Hauppauge uses IN2 for the radio */
+ msp->mode = MSP_MODE_FM_RADIO;
+ scart = SCART_IN2;
+ break;
+ case AUDIO_EXTERN_1:
+ /* IN1 is often used for external input ... */
+ msp->mode = MSP_MODE_EXTERN;
+ scart = SCART_IN1;
+ break;
+ case AUDIO_EXTERN_2:
+ /* ... sometimes it is IN2 through ;) */
+ msp->mode = MSP_MODE_EXTERN;
+ scart = SCART_IN2;
+ break;
+ case AUDIO_TUNER:
+ msp->mode = -1;
+ break;
+ }
+ if (scart) {
+ msp->rxsubchans = V4L2_TUNER_SUB_STEREO;
+ msp->audmode = V4L2_TUNER_MODE_STEREO;
+ msp3400c_set_scart(client,scart,0);
+ msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900);
+ }
+ if (sarg->capability==V4L2_AUDCAP_STEREO) {
+ msp->audmode = V4L2_TUNER_MODE_STEREO;
+ } else {
+ msp->audmode &= ~V4L2_TUNER_MODE_STEREO;
+ }
+ msp_any_set_audmode(client, msp->audmode);
+ msp_wake_thread(client);
+ break;
+ }
case VIDIOC_G_TUNER:
{
struct v4l2_tuner *vt = arg;
diff --git a/linux/drivers/media/video/msp3400.c b/linux/drivers/media/video/msp3400.c
index b9ac5b2d1..23b46cacc 100644
--- a/linux/drivers/media/video/msp3400.c
+++ b/linux/drivers/media/video/msp3400.c
@@ -387,6 +387,9 @@ static void msp3400c_setvolume(struct i2c_client *client,
{
int val = 0, bal = 0;
+#if 1
+muted=0;
+#endif
if (!muted) {
/* 0x7f instead if 0x73 here has sound quality issues,
* probably due to overmodulation + clipping ... */
@@ -1010,6 +1013,8 @@ static int msp34xx_modus(int norm)
{
switch (norm) {
case VIDEO_MODE_PAL:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to PAL\n");
+
#if 1 /*KEEP*/
/* experimental: not sure this works with all chip versions */
return 0x7003;
@@ -1018,12 +1023,16 @@ static int msp34xx_modus(int norm)
return 0x1003;
#endif
case VIDEO_MODE_NTSC: /* BTSC */
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to NTSC\n");
return 0x2003;
case VIDEO_MODE_SECAM:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to SECAM\n");
return 0x0003;
case VIDEO_MODE_RADIO:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to Radio\n");
return 0x0003;
case VIDEO_MODE_AUTO:
+ dprintk(KERN_DEBUG "msp34xx: video mode selected to Auto\n");
return 0x2003;
default:
return 0x0003;
@@ -1527,6 +1536,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
dprintk("msp34xx: error while reading chip version\n");
return -1;
}
+ printk(KERN_INFO "msp34xx: rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2);
#if 0
/* this will turn on a 1kHz beep - might be useful for debugging... */
@@ -1798,6 +1808,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
msp_any_set_audmode(client,mode_v4l1_to_v4l2(va->mode));
break;
}
+
case VIDIOCSCHAN:
{
struct video_channel *vc = arg;
@@ -1818,6 +1829,92 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
}
/* --- v4l2 ioctls --- */
+ case VIDIOC_S_STD:
+ {
+ v4l2_std_id *id = arg;
+
+ /*FIXME: use V4L2 mode flags on msp3400 instead of V4L1*/
+ if (*id & V4L2_STD_PAL) {
+ msp->norm=VIDEO_MODE_PAL;
+ } else if (*id & V4L2_STD_SECAM) {
+ msp->norm=VIDEO_MODE_SECAM;
+ } else {
+ msp->norm=VIDEO_MODE_NTSC;
+ }
+
+ msp_wake_thread(client);
+ return 0;
+ }
+
+ case VIDIOC_G_AUDIO:
+ {
+ struct v4l2_audio *a = arg;
+
+ memset(a,0,sizeof(*a));
+
+ switch (a->index) {
+ case AUDIO_RADIO:
+ strcpy(a->name,"Radio");
+ break;
+ case AUDIO_EXTERN_1:
+ strcpy(a->name,"Extern 1");
+ break;
+ case AUDIO_EXTERN_2:
+ strcpy(a->name,"Extern 2");
+ break;
+ case AUDIO_TUNER:
+ strcpy(a->name,"Television");
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ msp_any_detect_stereo(client);
+ if (msp->audmode == V4L2_TUNER_MODE_STEREO) {
+ a->capability=V4L2_AUDCAP_STEREO;
+ }
+
+ break;
+ }
+ case VIDIOC_S_AUDIO:
+ {
+ struct v4l2_audio *sarg = arg;
+
+ switch (sarg->index) {
+ case AUDIO_RADIO:
+ /* Hauppauge uses IN2 for the radio */
+ msp->mode = MSP_MODE_FM_RADIO;
+ scart = SCART_IN2;
+ break;
+ case AUDIO_EXTERN_1:
+ /* IN1 is often used for external input ... */
+ msp->mode = MSP_MODE_EXTERN;
+ scart = SCART_IN1;
+ break;
+ case AUDIO_EXTERN_2:
+ /* ... sometimes it is IN2 through ;) */
+ msp->mode = MSP_MODE_EXTERN;
+ scart = SCART_IN2;
+ break;
+ case AUDIO_TUNER:
+ msp->mode = -1;
+ break;
+ }
+ if (scart) {
+ msp->rxsubchans = V4L2_TUNER_SUB_STEREO;
+ msp->audmode = V4L2_TUNER_MODE_STEREO;
+ msp3400c_set_scart(client,scart,0);
+ msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900);
+ }
+ if (sarg->capability==V4L2_AUDCAP_STEREO) {
+ msp->audmode = V4L2_TUNER_MODE_STEREO;
+ } else {
+ msp->audmode &= ~V4L2_TUNER_MODE_STEREO;
+ }
+ msp_any_set_audmode(client, msp->audmode);
+ msp_wake_thread(client);
+ break;
+ }
case VIDIOC_G_TUNER:
{
struct v4l2_tuner *vt = arg;
diff --git a/v4l/ChangeLog b/v4l/ChangeLog
index d039689d5..ce6ad1dc7 100644
--- a/v4l/ChangeLog
+++ b/v4l/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-28 00:47 mchehab
+
+ * msp3400.c: (msp3400c_setvolume), (msp34xx_modus), (msp_attach),
+ (msp_command):
+ - Some V4L2 API calls implemented.
+
+ Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
+
2005-09-24 16:10 mkrufky
* bttv-cards.c: