aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2007-10-26 16:21:30 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:00:59 -0500
commit40c6e683a238c561db00c4fdfead43cb3b19d75f (patch)
treefbdd4c62e304758ce72eece8e25dcc583444acb8
parentde5bec6bb57e88db7efa49c6f7de0794ae67d06a (diff)
V4L/DVB (6415): Restructurize volume hook and drop unused mute hook
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/bt8xx/bttv-audio-hook.c29
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c31
2 files changed, 17 insertions, 43 deletions
diff --git a/drivers/media/video/bt8xx/bttv-audio-hook.c b/drivers/media/video/bt8xx/bttv-audio-hook.c
index 1e7fcaa259eb..1f25cdbed7d6 100644
--- a/drivers/media/video/bt8xx/bttv-audio-hook.c
+++ b/drivers/media/video/bt8xx/bttv-audio-hook.c
@@ -5,13 +5,12 @@
5 * This code is placed under the terms of the GNU General Public License 5 * This code is placed under the terms of the GNU General Public License
6 */ 6 */
7 7
8#include "bttv-audio-hook.h"
9
8/* ----------------------------------------------------------------------- */ 10/* ----------------------------------------------------------------------- */
9/* winview */ 11/* winview */
10 12
11#include "bttvp.h" 13 void winview_audio(struct bttv *btv, struct video_audio *v, int set)
12#include <linux/videodev.h>
13
14static void winview_audio(struct bttv *btv, struct video_audio *v, int set)
15{ 14{
16 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */ 15 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
17 int bits_out, loops, vol, data; 16 int bits_out, loops, vol, data;
@@ -57,7 +56,7 @@ static void winview_audio(struct bttv *btv, struct video_audio *v, int set)
57/* mono/stereo control for various cards (which don't use i2c chips but */ 56/* mono/stereo control for various cards (which don't use i2c chips but */
58/* connect something to the GPIO pins */ 57/* connect something to the GPIO pins */
59 58
60static void 59 void
61gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set) 60gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
62{ 61{
63 unsigned int con = 0; 62 unsigned int con = 0;
@@ -79,7 +78,7 @@ gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
79 } 78 }
80} 79}
81 80
82static void 81 void
83gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) 82gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
84{ 83{
85 unsigned int val, con; 84 unsigned int val, con;
@@ -142,7 +141,7 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
142 * handles this with a tda9840 141 * handles this with a tda9840
143 * 142 *
144 */ 143 */
145static void 144 void
146avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) 145avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
147{ 146{
148 int val = 0; 147 int val = 0;
@@ -164,7 +163,7 @@ avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
164 } 163 }
165} 164}
166 165
167static void 166 void
168avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set) 167avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
169{ 168{
170 int val = 0; 169 int val = 0;
@@ -185,7 +184,7 @@ avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
185} 184}
186 185
187/* Lifetec 9415 handling */ 186/* Lifetec 9415 handling */
188static void 187 void
189lt9415_audio(struct bttv *btv, struct video_audio *v, int set) 188lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
190{ 189{
191 int val = 0; 190 int val = 0;
@@ -215,7 +214,7 @@ lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
215} 214}
216 215
217/* TDA9821 on TerraTV+ Bt848, Bt878 */ 216/* TDA9821 on TerraTV+ Bt848, Bt878 */
218static void 217 void
219terratv_audio(struct bttv *btv, struct video_audio *v, int set) 218terratv_audio(struct bttv *btv, struct video_audio *v, int set)
220{ 219{
221 unsigned int con = 0; 220 unsigned int con = 0;
@@ -235,7 +234,7 @@ terratv_audio(struct bttv *btv, struct video_audio *v, int set)
235 } 234 }
236} 235}
237 236
238static void 237 void
239winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) 238winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
240{ 239{
241 unsigned long val = 0; 240 unsigned long val = 0;
@@ -269,7 +268,7 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
269 * Note: There are card variants without tda9874a. Forcing the "stereo sound route" 268 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
270 * will mute this cards. 269 * will mute this cards.
271 */ 270 */
272static void 271 void
273pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) 272pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
274{ 273{
275 unsigned int val = 0; 274 unsigned int val = 0;
@@ -301,7 +300,7 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
301 * sound control for FlyVideo 2000S (with tda9874 decoder) 300 * sound control for FlyVideo 2000S (with tda9874 decoder)
302 * based on pvbt878p9b_audio() - this is not tested, please fix!!! 301 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
303 */ 302 */
304static void 303 void
305fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) 304fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
306{ 305{
307 unsigned int val = 0xffff; 306 unsigned int val = 0xffff;
@@ -332,7 +331,7 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
332 * sound control for Canopus WinDVR PCI 331 * sound control for Canopus WinDVR PCI
333 * Masaki Suzuki <masaki@btree.org> 332 * Masaki Suzuki <masaki@btree.org>
334 */ 333 */
335static void 334 void
336windvr_audio(struct bttv *btv, struct video_audio *v, int set) 335windvr_audio(struct bttv *btv, struct video_audio *v, int set)
337{ 336{
338 unsigned long val = 0; 337 unsigned long val = 0;
@@ -361,7 +360,7 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set)
361 * sound control for AD-TVK503 360 * sound control for AD-TVK503
362 * Hiroshi Takekawa <sian@big.or.jp> 361 * Hiroshi Takekawa <sian@big.or.jp>
363 */ 362 */
364static void 363 void
365adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) 364adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
366{ 365{
367 unsigned int con = 0xffffff; 366 unsigned int con = 0xffffff;
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 28b3a3efb84f..13221da6e40f 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1434,23 +1434,13 @@ 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 int i;
1438
1439 for (i = 0; i < BTTV_CTLS; i++)
1440 if (bttv_ctls[i].id == c->id)
1441 break;
1442 if (i == BTTV_CTLS)
1443 return -EINVAL;
1444#ifdef CONFIG_VIDEO_V4L1 1437#ifdef CONFIG_VIDEO_V4L1
1445 if (btv->audio_hook && i >= 4 && i <= 8) { 1438 if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
1446 struct video_audio va; 1439 struct video_audio va;
1447 1440
1448 memset(&va,0,sizeof(va)); 1441 memset(&va,0,sizeof(va));
1449 btv->audio_hook(btv,&va,0); 1442 btv->audio_hook(btv,&va,0);
1450 switch (c->id) { 1443 switch (c->id) {
1451 case V4L2_CID_AUDIO_MUTE:
1452 c->value = (VIDEO_AUDIO_MUTE & va.flags) ? 1 : 0;
1453 break;
1454 case V4L2_CID_AUDIO_VOLUME: 1444 case V4L2_CID_AUDIO_VOLUME:
1455 c->value = va.volume; 1445 c->value = va.volume;
1456 break; 1446 break;
@@ -1521,30 +1511,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
1521 1511
1522static int set_control(struct bttv *btv, struct v4l2_control *c) 1512static int set_control(struct bttv *btv, struct v4l2_control *c)
1523{ 1513{
1524 int i,val; 1514 int val;
1525 1515
1526 for (i = 0; i < BTTV_CTLS; i++)
1527 if (bttv_ctls[i].id == c->id)
1528 break;
1529 if (i == BTTV_CTLS)
1530 return -EINVAL;
1531#ifdef CONFIG_VIDEO_V4L1 1516#ifdef CONFIG_VIDEO_V4L1
1532 if (btv->audio_hook && i >= 4 && i <= 8) { 1517 if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
1533 struct video_audio va; 1518 struct video_audio va;
1534 1519
1535 memset(&va,0,sizeof(va)); 1520 memset(&va,0,sizeof(va));
1536 btv->audio_hook(btv,&va,0); 1521 btv->audio_hook(btv,&va,0);
1537 switch (c->id) { 1522 switch (c->id) {
1538 case V4L2_CID_AUDIO_MUTE:
1539 if (c->value) {
1540 va.flags |= VIDEO_AUDIO_MUTE;
1541 audio_mute(btv, 1);
1542 } else {
1543 va.flags &= ~VIDEO_AUDIO_MUTE;
1544 audio_mute(btv, 0);
1545 }
1546 break;
1547
1548 case V4L2_CID_AUDIO_VOLUME: 1523 case V4L2_CID_AUDIO_VOLUME:
1549 va.volume = c->value; 1524 va.volume = c->value;
1550 break; 1525 break;