summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-driver.c
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2006-08-25 16:53:04 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 19:00:59 -0200
commit4b9b936f278163614543d66f8e8c93d5484dd148 (patch)
treef7f03bb576f318a32f3d0959ccf41f7031f241be /drivers/media/video/bt8xx/bttv-driver.c
parent40c6e683a238c561db00c4fdfead43cb3b19d75f (diff)
downloadtalos-op-linux-4b9b936f278163614543d66f8e8c93d5484dd148.tar.gz
talos-op-linux-4b9b936f278163614543d66f8e8c93d5484dd148.zip
V4L/DVB (6416): Split hooks on volume and audio mode and rework their handling
Also convert audio_mode_gpio functions from audio_hook Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c97
1 files changed, 21 insertions, 76 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 13221da6e40f..db0e4b78e7dd 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1434,20 +1434,6 @@ static void bttv_reinit_bt848(struct bttv *btv)
static int get_control(struct bttv *btv, struct v4l2_control *c)
{
-#ifdef CONFIG_VIDEO_V4L1
- if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
- struct video_audio va;
-
- memset(&va,0,sizeof(va));
- btv->audio_hook(btv,&va,0);
- switch (c->id) {
- case V4L2_CID_AUDIO_VOLUME:
- c->value = va.volume;
- break;
- }
- return 0;
- }
-#endif
switch (c->id) {
case V4L2_CID_BRIGHTNESS:
c->value = btv->bright;
@@ -1513,21 +1499,6 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
{
int val;
-#ifdef CONFIG_VIDEO_V4L1
- if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
- struct video_audio va;
-
- memset(&va,0,sizeof(va));
- btv->audio_hook(btv,&va,0);
- switch (c->id) {
- case V4L2_CID_AUDIO_VOLUME:
- va.volume = c->value;
- break;
- }
- btv->audio_hook(btv,&va,1);
- return 0;
- }
-#endif
switch (c->id) {
case V4L2_CID_BRIGHTNESS:
bt848_bright(btv,c->value);
@@ -1545,6 +1516,11 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
audio_mute(btv, c->value);
/* fall through */
case V4L2_CID_AUDIO_VOLUME:
+ if (btv->volume_gpio) {
+ btv->volume_gpio (btv, c->value);
+ }
+ bttv_call_i2c_clients(btv,VIDIOC_S_CTRL,c);
+ break;
case V4L2_CID_AUDIO_BALANCE:
case V4L2_CID_AUDIO_BASS:
case V4L2_CID_AUDIO_TREBLE:
@@ -1953,22 +1929,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
return -EINVAL;
mutex_lock(&btv->lock);
bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t);
-#ifdef CONFIG_VIDEO_V4L1
- if (btv->audio_hook) {
- struct video_audio va;
- memset(&va, 0, sizeof(struct video_audio));
- if (t->audmode == V4L2_TUNER_MODE_MONO)
- va.mode = VIDEO_SOUND_MONO;
- else if (t->audmode == V4L2_TUNER_MODE_STEREO ||
- t->audmode == V4L2_TUNER_MODE_LANG1_LANG2)
- va.mode = VIDEO_SOUND_STEREO;
- else if (t->audmode == V4L2_TUNER_MODE_LANG1)
- va.mode = VIDEO_SOUND_LANG1;
- else if (t->audmode == V4L2_TUNER_MODE_LANG2)
- va.mode = VIDEO_SOUND_LANG2;
- btv->audio_hook(btv,&va,1);
+
+ if (btv->audio_mode_gpio) {
+ btv->audio_mode_gpio (btv,t,1);
}
-#endif
mutex_unlock(&btv->lock);
return 0;
}
@@ -2846,19 +2810,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
return 0;
}
*c = bttv_ctls[i];
-#ifdef CONFIG_VIDEO_V4L1
- if (btv->audio_hook && i >= 4 && i <= 8) {
- struct video_audio va;
- memset(&va,0,sizeof(va));
- btv->audio_hook(btv,&va,0);
- switch (bttv_ctls[i].id) {
- case V4L2_CID_AUDIO_VOLUME:
- if (!(va.flags & VIDEO_AUDIO_VOLUME))
- *c = no_ctl;
- break;
- }
- }
-#endif
+
+ if (!btv->volume_gpio &&
+ (bttv_ctls[i].id == V4L2_CID_AUDIO_VOLUME))
+ *c = no_ctl;
+
return 0;
}
case VIDIOC_G_PARM:
@@ -2890,26 +2846,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
t->type = V4L2_TUNER_ANALOG_TV;
if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC)
t->signal = 0xffff;
-#ifdef CONFIG_VIDEO_V4L1
- if (btv->audio_hook) {
- /* Hmmm ... */
- struct video_audio va;
- memset(&va, 0, sizeof(struct video_audio));
- btv->audio_hook(btv,&va,0);
- t->audmode = V4L2_TUNER_MODE_MONO;
- t->rxsubchans = V4L2_TUNER_SUB_MONO;
- if(va.mode & VIDEO_SOUND_STEREO) {
- t->audmode = V4L2_TUNER_MODE_STEREO;
- t->rxsubchans = V4L2_TUNER_SUB_STEREO;
- }
- if(va.mode & VIDEO_SOUND_LANG2) {
- t->audmode = V4L2_TUNER_MODE_LANG1;
- t->rxsubchans = V4L2_TUNER_SUB_LANG1
- | V4L2_TUNER_SUB_LANG2;
- }
+
+ if (btv->audio_mode_gpio) {
+ btv->audio_mode_gpio (btv,t,0);
}
-#endif
- /* FIXME: fill capability+audmode */
+
mutex_unlock(&btv->lock);
return 0;
}
@@ -3403,6 +3344,10 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t);
+ if (btv->audio_mode_gpio) {
+ btv->audio_mode_gpio (btv,t,0);
+ }
+
mutex_unlock(&btv->lock);
return 0;
OpenPOWER on IntegriCloud