aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-driver.c
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2006-08-25 15:53:04 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:00:59 -0500
commit4b9b936f278163614543d66f8e8c93d5484dd148 (patch)
treef7f03bb576f318a32f3d0959ccf41f7031f241be /drivers/media/video/bt8xx/bttv-driver.c
parent40c6e683a238c561db00c4fdfead43cb3b19d75f (diff)
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)
1434 1434
1435static int get_control(struct bttv *btv, struct v4l2_control *c) 1435static int get_control(struct bttv *btv, struct v4l2_control *c)
1436{ 1436{
1437#ifdef CONFIG_VIDEO_V4L1
1438 if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
1439 struct video_audio va;
1440
1441 memset(&va,0,sizeof(va));
1442 btv->audio_hook(btv,&va,0);
1443 switch (c->id) {
1444 case V4L2_CID_AUDIO_VOLUME:
1445 c->value = va.volume;
1446 break;
1447 }
1448 return 0;
1449 }
1450#endif
1451 switch (c->id) { 1437 switch (c->id) {
1452 case V4L2_CID_BRIGHTNESS: 1438 case V4L2_CID_BRIGHTNESS:
1453 c->value = btv->bright; 1439 c->value = btv->bright;
@@ -1513,21 +1499,6 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1513{ 1499{
1514 int val; 1500 int val;
1515 1501
1516#ifdef CONFIG_VIDEO_V4L1
1517 if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
1518 struct video_audio va;
1519
1520 memset(&va,0,sizeof(va));
1521 btv->audio_hook(btv,&va,0);
1522 switch (c->id) {
1523 case V4L2_CID_AUDIO_VOLUME:
1524 va.volume = c->value;
1525 break;
1526 }
1527 btv->audio_hook(btv,&va,1);
1528 return 0;
1529 }
1530#endif
1531 switch (c->id) { 1502 switch (c->id) {
1532 case V4L2_CID_BRIGHTNESS: 1503 case V4L2_CID_BRIGHTNESS:
1533 bt848_bright(btv,c->value); 1504 bt848_bright(btv,c->value);
@@ -1545,6 +1516,11 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1545 audio_mute(btv, c->value); 1516 audio_mute(btv, c->value);
1546 /* fall through */ 1517 /* fall through */
1547 case V4L2_CID_AUDIO_VOLUME: 1518 case V4L2_CID_AUDIO_VOLUME:
1519 if (btv->volume_gpio) {
1520 btv->volume_gpio (btv, c->value);
1521 }
1522 bttv_call_i2c_clients(btv,VIDIOC_S_CTRL,c);
1523 break;
1548 case V4L2_CID_AUDIO_BALANCE: 1524 case V4L2_CID_AUDIO_BALANCE:
1549 case V4L2_CID_AUDIO_BASS: 1525 case V4L2_CID_AUDIO_BASS:
1550 case V4L2_CID_AUDIO_TREBLE: 1526 case V4L2_CID_AUDIO_TREBLE:
@@ -1953,22 +1929,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1953 return -EINVAL; 1929 return -EINVAL;
1954 mutex_lock(&btv->lock); 1930 mutex_lock(&btv->lock);
1955 bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t); 1931 bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t);
1956#ifdef CONFIG_VIDEO_V4L1 1932
1957 if (btv->audio_hook) { 1933 if (btv->audio_mode_gpio) {
1958 struct video_audio va; 1934 btv->audio_mode_gpio (btv,t,1);
1959 memset(&va, 0, sizeof(struct video_audio));
1960 if (t->audmode == V4L2_TUNER_MODE_MONO)
1961 va.mode = VIDEO_SOUND_MONO;
1962 else if (t->audmode == V4L2_TUNER_MODE_STEREO ||
1963 t->audmode == V4L2_TUNER_MODE_LANG1_LANG2)
1964 va.mode = VIDEO_SOUND_STEREO;
1965 else if (t->audmode == V4L2_TUNER_MODE_LANG1)
1966 va.mode = VIDEO_SOUND_LANG1;
1967 else if (t->audmode == V4L2_TUNER_MODE_LANG2)
1968 va.mode = VIDEO_SOUND_LANG2;
1969 btv->audio_hook(btv,&va,1);
1970 } 1935 }
1971#endif
1972 mutex_unlock(&btv->lock); 1936 mutex_unlock(&btv->lock);
1973 return 0; 1937 return 0;
1974 } 1938 }
@@ -2846,19 +2810,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2846 return 0; 2810 return 0;
2847 } 2811 }
2848 *c = bttv_ctls[i]; 2812 *c = bttv_ctls[i];
2849#ifdef CONFIG_VIDEO_V4L1 2813
2850 if (btv->audio_hook && i >= 4 && i <= 8) { 2814 if (!btv->volume_gpio &&
2851 struct video_audio va; 2815 (bttv_ctls[i].id == V4L2_CID_AUDIO_VOLUME))
2852 memset(&va,0,sizeof(va)); 2816 *c = no_ctl;
2853 btv->audio_hook(btv,&va,0); 2817
2854 switch (bttv_ctls[i].id) {
2855 case V4L2_CID_AUDIO_VOLUME:
2856 if (!(va.flags & VIDEO_AUDIO_VOLUME))
2857 *c = no_ctl;
2858 break;
2859 }
2860 }
2861#endif
2862 return 0; 2818 return 0;
2863 } 2819 }
2864 case VIDIOC_G_PARM: 2820 case VIDIOC_G_PARM:
@@ -2890,26 +2846,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2890 t->type = V4L2_TUNER_ANALOG_TV; 2846 t->type = V4L2_TUNER_ANALOG_TV;
2891 if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) 2847 if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC)
2892 t->signal = 0xffff; 2848 t->signal = 0xffff;
2893#ifdef CONFIG_VIDEO_V4L1 2849
2894 if (btv->audio_hook) { 2850 if (btv->audio_mode_gpio) {
2895 /* Hmmm ... */ 2851 btv->audio_mode_gpio (btv,t,0);
2896 struct video_audio va;
2897 memset(&va, 0, sizeof(struct video_audio));
2898 btv->audio_hook(btv,&va,0);
2899 t->audmode = V4L2_TUNER_MODE_MONO;
2900 t->rxsubchans = V4L2_TUNER_SUB_MONO;
2901 if(va.mode & VIDEO_SOUND_STEREO) {
2902 t->audmode = V4L2_TUNER_MODE_STEREO;
2903 t->rxsubchans = V4L2_TUNER_SUB_STEREO;
2904 }
2905 if(va.mode & VIDEO_SOUND_LANG2) {
2906 t->audmode = V4L2_TUNER_MODE_LANG1;
2907 t->rxsubchans = V4L2_TUNER_SUB_LANG1
2908 | V4L2_TUNER_SUB_LANG2;
2909 }
2910 } 2852 }
2911#endif 2853
2912 /* FIXME: fill capability+audmode */
2913 mutex_unlock(&btv->lock); 2854 mutex_unlock(&btv->lock);
2914 return 0; 2855 return 0;
2915 } 2856 }
@@ -3403,6 +3344,10 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
3403 3344
3404 bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t); 3345 bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t);
3405 3346
3347 if (btv->audio_mode_gpio) {
3348 btv->audio_mode_gpio (btv,t,0);
3349 }
3350
3406 mutex_unlock(&btv->lock); 3351 mutex_unlock(&btv->lock);
3407 3352
3408 return 0; 3353 return 0;