From: Nickolay V. Shmyrev Date: Fri, 25 Aug 2006 19:53:04 +0000 (-0300) Subject: V4L/DVB (6416): Split hooks on volume and audio mode and rework their handling X-Git-Tag: v2.6.25-rc1~1235^2~494 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b9b936f278163614543d66f8e8c93d5484dd148;p=linux-2.6 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/bt8xx/bttv-audio-hook.c b/drivers/media/video/bt8xx/bttv-audio-hook.c index 1f25cdbed7..a075198f83 100644 --- a/drivers/media/video/bt8xx/bttv-audio-hook.c +++ b/drivers/media/video/bt8xx/bttv-audio-hook.c @@ -7,22 +7,18 @@ #include "bttv-audio-hook.h" +#include + /* ----------------------------------------------------------------------- */ /* winview */ - void winview_audio(struct bttv *btv, struct video_audio *v, int set) +void winview_volume(struct bttv *btv, __u16 volume) { /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */ int bits_out, loops, vol, data; - if (!set) { - /* Fixed by Leandro Lucarella flags |= VIDEO_AUDIO_VOLUME; - return; - } - /* 32 levels logarithmic */ - vol = 32 - ((v->volume>>11)); + vol = 32 - ((volume>>11)); /* units */ bits_out = (PT2254_DBS_IN_2>>(vol%5)); /* tens */ @@ -56,30 +52,28 @@ /* mono/stereo control for various cards (which don't use i2c chips but */ /* connect something to the GPIO pins */ - void -gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set) +void gvbctv3pci_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned int con = 0; if (set) { gpio_inout(0x300, 0x300); - if (v->mode & VIDEO_SOUND_LANG1) + if (t->audmode & V4L2_TUNER_MODE_LANG1) con = 0x000; - if (v->mode & VIDEO_SOUND_LANG2) + if (t->audmode & V4L2_TUNER_MODE_LANG2) con = 0x300; - if (v->mode & VIDEO_SOUND_STEREO) + if (t->audmode & V4L2_TUNER_MODE_STEREO) con = 0x200; -/* if (v->mode & VIDEO_SOUND_MONO) +/* if (t->audmode & V4L2_TUNER_MODE_MONO) * con = 0x100; */ gpio_bits(0x300, con); } else { - v->mode = VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } - void -gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) +void gvbctv5pci_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned int val, con; @@ -89,8 +83,8 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) val = gpio_read(); if (set) { con = 0x000; - if (v->mode & VIDEO_SOUND_LANG2) { - if (v->mode & VIDEO_SOUND_LANG1) { + if (t->audmode & V4L2_TUNER_MODE_LANG2) { + if (t->audmode & V4L2_TUNER_MODE_LANG1) { /* LANG1 + LANG2 */ con = 0x100; } @@ -107,23 +101,23 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) } else { switch (val & 0x70) { case 0x10: - v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; break; case 0x30: - v->mode = VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_LANG2; break; case 0x50: - v->mode = VIDEO_SOUND_LANG1; + t->audmode = V4L2_TUNER_MODE_LANG1; break; case 0x60: - v->mode = VIDEO_SOUND_STEREO; + t->audmode = V4L2_TUNER_MODE_STEREO; break; case 0x70: - v->mode = VIDEO_SOUND_MONO; + t->audmode = V4L2_TUNER_MODE_MONO; break; default: - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } } @@ -141,15 +135,15 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) * handles this with a tda9840 * */ - void -avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) + +void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { int val = 0; if (set) { - if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ + if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */ val = 0x02; - if (v->mode & VIDEO_SOUND_STEREO) + if (t->audmode & V4L2_TUNER_MODE_STEREO) val = 0x01; if (val) { gpio_bits(0x03,val); @@ -157,97 +151,96 @@ avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) bttv_gpio_tracking(btv,"avermedia"); } } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1; return; } } - void -avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set) + +void avermedia_tv_stereo_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { int val = 0; if (set) { - if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ + if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */ val = 0x01; - if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */ + if (t->audmode & V4L2_TUNER_MODE_STEREO) /* STEREO */ val = 0x02; btaor(val, ~0x03, BT848_GPIO_DATA); if (bttv_gpio) bttv_gpio_tracking(btv,"avermedia"); } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; return; } } /* Lifetec 9415 handling */ - void -lt9415_audio(struct bttv *btv, struct video_audio *v, int set) + +void lt9415_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { int val = 0; if (gpio_read() & 0x4000) { - v->mode = VIDEO_SOUND_MONO; + t->audmode = V4L2_TUNER_MODE_MONO; return; } if (set) { - if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */ + if (t->audmode & V4L2_TUNER_MODE_LANG2) /* A2 SAP */ val = 0x0080; - if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */ + if (t->audmode & V4L2_TUNER_MODE_STEREO) /* A2 stereo */ val = 0x0880; - if ((v->mode & VIDEO_SOUND_LANG1) || - (v->mode & VIDEO_SOUND_MONO)) + if ((t->audmode & V4L2_TUNER_MODE_LANG1) || + (t->audmode & V4L2_TUNER_MODE_MONO)) val = 0; gpio_bits(0x0880, val); if (bttv_gpio) bttv_gpio_tracking(btv,"lt9415"); } else { /* autodetect doesn't work with this card :-( */ - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; return; } } /* TDA9821 on TerraTV+ Bt848, Bt878 */ - void -terratv_audio(struct bttv *btv, struct video_audio *v, int set) +void terratv_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned int con = 0; if (set) { gpio_inout(0x180000,0x180000); - if (v->mode & VIDEO_SOUND_LANG2) + if (t->audmode & V4L2_TUNER_MODE_LANG2) con = 0x080000; - if (v->mode & VIDEO_SOUND_STEREO) + if (t->audmode & V4L2_TUNER_MODE_STEREO) con = 0x180000; gpio_bits(0x180000, con); if (bttv_gpio) bttv_gpio_tracking(btv,"terratv"); } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } - void -winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) + +void winfast2000_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned long val = 0; if (set) { /*btor (0xc32000, BT848_GPIO_OUT_EN);*/ - if (v->mode & VIDEO_SOUND_MONO) /* Mono */ + if (t->audmode & V4L2_TUNER_MODE_MONO) /* Mono */ val = 0x420000; - if (v->mode & VIDEO_SOUND_LANG1) /* Mono */ + if (t->audmode & V4L2_TUNER_MODE_LANG1) /* Mono */ val = 0x420000; - if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ + if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */ val = 0x410000; - if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */ + if (t->audmode & V4L2_TUNER_MODE_STEREO) /* Stereo */ val = 0x020000; if (val) { gpio_bits(0x430000, val); @@ -255,8 +248,8 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) bttv_gpio_tracking(btv,"winfast2000"); } } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } @@ -268,8 +261,7 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) * Note: There are card variants without tda9874a. Forcing the "stereo sound route" * will mute this cards. */ - void -pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) +void pvbt878p9b_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned int val = 0; @@ -277,11 +269,11 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) return; if (set) { - if (v->mode & VIDEO_SOUND_MONO) { + if (t->audmode & V4L2_TUNER_MODE_MONO) { val = 0x01; } - if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) - || (v->mode & VIDEO_SOUND_STEREO)) { + if ((t->audmode & (V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2)) + || (t->audmode & V4L2_TUNER_MODE_STEREO)) { val = 0x02; } if (val) { @@ -290,8 +282,8 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) bttv_gpio_tracking(btv,"pvbt878p9b"); } } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } @@ -300,8 +292,7 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) * sound control for FlyVideo 2000S (with tda9874 decoder) * based on pvbt878p9b_audio() - this is not tested, please fix!!! */ - void -fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) +void fv2000s_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned int val = 0xffff; @@ -309,11 +300,11 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) return; if (set) { - if (v->mode & VIDEO_SOUND_MONO) { + if (t->audmode & V4L2_TUNER_MODE_MONO) { val = 0x0000; } - if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) - || (v->mode & VIDEO_SOUND_STEREO)) { + if ((t->audmode & (V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2)) + || (t->audmode & V4L2_TUNER_MODE_STEREO)) { val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */ } if (val != 0xffff) { @@ -322,8 +313,8 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) bttv_gpio_tracking(btv,"fv2000s"); } } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } @@ -331,19 +322,18 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) * sound control for Canopus WinDVR PCI * Masaki Suzuki */ - void -windvr_audio(struct bttv *btv, struct video_audio *v, int set) +void windvr_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned long val = 0; if (set) { - if (v->mode & VIDEO_SOUND_MONO) + if (t->audmode & V4L2_TUNER_MODE_MONO) val = 0x040000; - if (v->mode & VIDEO_SOUND_LANG1) + if (t->audmode & V4L2_TUNER_MODE_LANG1) val = 0; - if (v->mode & VIDEO_SOUND_LANG2) + if (t->audmode & V4L2_TUNER_MODE_LANG2) val = 0x100000; - if (v->mode & VIDEO_SOUND_STEREO) + if (t->audmode & V4L2_TUNER_MODE_STEREO) val = 0; if (val) { gpio_bits(0x140000, val); @@ -351,8 +341,8 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set) bttv_gpio_tracking(btv,"windvr"); } } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } @@ -360,8 +350,7 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set) * sound control for AD-TVK503 * Hiroshi Takekawa */ - void -adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) +void adtvk503_audio(struct bttv *btv, struct v4l2_tuner *t, int set) { unsigned int con = 0xffffff; @@ -369,13 +358,13 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) if (set) { /* btor(***, BT848_GPIO_OUT_EN); */ - if (v->mode & VIDEO_SOUND_LANG1) + if (t->audmode & V4L2_TUNER_MODE_LANG1) con = 0x00000000; - if (v->mode & VIDEO_SOUND_LANG2) + if (t->audmode & V4L2_TUNER_MODE_LANG2) con = 0x00180000; - if (v->mode & VIDEO_SOUND_STEREO) + if (t->audmode & V4L2_TUNER_MODE_STEREO) con = 0x00000000; - if (v->mode & VIDEO_SOUND_MONO) + if (t->audmode & V4L2_TUNER_MODE_MONO) con = 0x00060000; if (con != 0xffffff) { gpio_bits(0x1e0000,con); @@ -383,7 +372,7 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) bttv_gpio_tracking(btv, "adtvk503"); } } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO | + V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; } } diff --git a/drivers/media/video/bt8xx/bttv-audio-hook.h b/drivers/media/video/bt8xx/bttv-audio-hook.h index 9770cacc17..159d07adef 100644 --- a/drivers/media/video/bt8xx/bttv-audio-hook.h +++ b/drivers/media/video/bt8xx/bttv-audio-hook.h @@ -7,17 +7,17 @@ #include "bttvp.h" -static void winview_audio(struct bttv *btv, struct video_audio *v, int set); -static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); -static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, - int set); -static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, - int set); -static void terratv_audio(struct bttv *btv, struct video_audio *v, int set); -static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set); -static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set); -static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set); -static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set); -static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set); -static void windvr_audio(struct bttv *btv, struct video_audio *v, int set); -static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set); +void winview_volume (struct bttv *btv, __u16 volume); + +void lt9415_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void avermedia_tv_stereo_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void terratv_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void gvbctv3pci_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void gvbctv5pci_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void winfast2000_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void pvbt878p9b_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void fv2000s_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void windvr_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); +void adtvk503_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set); + diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 78e5e29748..63a47cd4c1 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c @@ -414,7 +414,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = avermedia_tvphone_audio, + .audio_mode_gpio= avermedia_tvphone_audio, .has_remote = 1, }, [BTTV_BOARD_MATRIX_VISION] = { @@ -526,7 +526,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = avermedia_tv_stereo_audio, + .audio_mode_gpio= avermedia_tv_stereo_audio, .no_gpioirq = 1, }, [BTTV_BOARD_VHX] = { @@ -591,7 +591,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = winview_audio, + .volume_gpio = winview_volume, .has_radio = 1, }, [BTTV_BOARD_AVEC_INTERCAP] = { @@ -715,7 +715,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = terratv_audio, + .audio_mode_gpio= terratv_audio, }, [BTTV_BOARD_HAUPPAUG_WCAM] = { .name = "Hauppauge WinCam newer (bt878)", @@ -763,7 +763,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = terratv_audio, + .audio_mode_gpio= terratv_audio, /* GPIO wiring: External 20 pin connector (for Active Radio Upgrade board) gpio00: i2c-sda @@ -902,7 +902,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */ .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = winfast2000_audio, + .audio_mode_gpio= winfast2000_audio, .has_remote = 1, }, [BTTV_BOARD_CHRONOS_VS2] = { @@ -1022,7 +1022,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .has_radio = 1, - .audio_hook = avermedia_tvphone_audio, + .audio_mode_gpio= avermedia_tvphone_audio, }, [BTTV_BOARD_PV951] = { .name = "ProVideo PV951", /* pic16c54 */ @@ -1154,7 +1154,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_ALPS_TSHC6_NTSC, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = gvbctv3pci_audio, + .audio_mode_gpio= gvbctv3pci_audio, }, [BTTV_BOARD_PXELVWPLTVPAK] = { .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", @@ -1459,7 +1459,7 @@ struct tvcard bttv_tvcards[] = { /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, .gpiomute = 0x1800, - .audio_hook = fv2000s_audio, + .audio_mode_gpio= fv2000s_audio, .no_msp34xx = 1, .no_tda9875 = 1, .needs_tvaudio = 1, @@ -1500,7 +1500,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = gvbctv3pci_audio, + .audio_mode_gpio= gvbctv3pci_audio, }, /* ---- card 0x44 ---------------------------------- */ @@ -1619,7 +1619,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = pvbt878p9b_audio, /* Note: not all cards have stereo */ + .audio_mode_gpio= pvbt878p9b_audio, /* Note: not all cards have stereo */ .has_radio = 1, /* Note: not all cards have radio */ .has_remote = 1, /* GPIO wiring: @@ -1697,7 +1697,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = windvr_audio, + .audio_mode_gpio= windvr_audio, }, [BTTV_BOARD_GRANDTEC_MULTI] = { .name = "GrandTec Multi Capture Card (Bt878)", @@ -1794,7 +1794,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_NTSC_M, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = gvbctv5pci_audio, + .audio_mode_gpio= gvbctv5pci_audio, .has_radio = 1, }, [BTTV_BOARD_OSPREY1x0] = { @@ -2093,7 +2093,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .audio_hook = adtvk503_audio, + .audio_mode_gpio= adtvk503_audio, }, /* ---- card 0x64 ---------------------------------- */ @@ -3160,8 +3160,8 @@ static void flyvideo_gpio(struct bttv *btv) /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80 * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00 * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */ - if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio; - /* todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; */ + if(has_tda9820_tda9821) btv->audio_mode_gpio = lt9415_audio; + /* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */ } static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1, @@ -3581,8 +3581,10 @@ void __devinit bttv_init_card2(struct bttv *btv) btv->has_remote=1; if (!bttv_tvcards[btv->c.type].no_gpioirq) btv->gpioirq=1; - if (bttv_tvcards[btv->c.type].audio_hook) - btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook; + if (bttv_tvcards[btv->c.type].volume_gpio) + btv->volume_gpio=bttv_tvcards[btv->c.type].volume_gpio; + if (bttv_tvcards[btv->c.type].audio_mode_gpio) + btv->audio_mode_gpio=bttv_tvcards[btv->c.type].audio_mode_gpio; if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) { /* detect Bt832 chip for quartzsight digital camera */ diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 13221da6e4..db0e4b78e7 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; diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h index 2edef15ba3..bf4c339a52 100644 --- a/drivers/media/video/bt8xx/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h @@ -241,9 +241,10 @@ struct tvcard unsigned int radio_addr; unsigned int has_radio; -#ifdef CONFIG_VIDEO_V4L1 - void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); -#endif + + void (*volume_gpio)(struct bttv *btv, __u16 volume); + void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set); + void (*muxsel_hook)(struct bttv *btv, unsigned int input); }; diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index fdd78f8b1d..4a02f0a8a4 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -336,9 +336,10 @@ struct bttv { /* old gpio interface */ wait_queue_head_t gpioq; int shutdown; -#ifdef CONFIG_VIDEO_V4L1 - void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); -#endif + + void (*volume_gpio)(struct bttv *btv, __u16 volume); + void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set); + /* new gpio interface */ spinlock_t gpio_lock;