Commit 4b9b936f authored by Nickolay V. Shmyrev's avatar Nickolay V. Shmyrev Committed by Mauro Carvalho Chehab

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: default avatarNickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 40c6e683
...@@ -7,22 +7,18 @@ ...@@ -7,22 +7,18 @@
#include "bttv-audio-hook.h" #include "bttv-audio-hook.h"
#include <linux/delay.h>
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* winview */ /* 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 */ /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
int bits_out, loops, vol, data; int bits_out, loops, vol, data;
if (!set) {
/* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
v->flags |= VIDEO_AUDIO_VOLUME;
return;
}
/* 32 levels logarithmic */ /* 32 levels logarithmic */
vol = 32 - ((v->volume>>11)); vol = 32 - ((volume>>11));
/* units */ /* units */
bits_out = (PT2254_DBS_IN_2>>(vol%5)); bits_out = (PT2254_DBS_IN_2>>(vol%5));
/* tens */ /* tens */
...@@ -56,30 +52,28 @@ ...@@ -56,30 +52,28 @@
/* mono/stereo control for various cards (which don't use i2c chips but */ /* mono/stereo control for various cards (which don't use i2c chips but */
/* connect something to the GPIO pins */ /* connect something to the GPIO pins */
void void gvbctv3pci_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int con = 0; unsigned int con = 0;
if (set) { if (set) {
gpio_inout(0x300, 0x300); gpio_inout(0x300, 0x300);
if (v->mode & VIDEO_SOUND_LANG1) if (t->audmode & V4L2_TUNER_MODE_LANG1)
con = 0x000; con = 0x000;
if (v->mode & VIDEO_SOUND_LANG2) if (t->audmode & V4L2_TUNER_MODE_LANG2)
con = 0x300; con = 0x300;
if (v->mode & VIDEO_SOUND_STEREO) if (t->audmode & V4L2_TUNER_MODE_STEREO)
con = 0x200; con = 0x200;
/* if (v->mode & VIDEO_SOUND_MONO) /* if (t->audmode & V4L2_TUNER_MODE_MONO)
* con = 0x100; */ * con = 0x100; */
gpio_bits(0x300, con); gpio_bits(0x300, con);
} else { } else {
v->mode = VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
} }
void void gvbctv5pci_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int val, con; unsigned int val, con;
...@@ -89,8 +83,8 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -89,8 +83,8 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
val = gpio_read(); val = gpio_read();
if (set) { if (set) {
con = 0x000; con = 0x000;
if (v->mode & VIDEO_SOUND_LANG2) { if (t->audmode & V4L2_TUNER_MODE_LANG2) {
if (v->mode & VIDEO_SOUND_LANG1) { if (t->audmode & V4L2_TUNER_MODE_LANG1) {
/* LANG1 + LANG2 */ /* LANG1 + LANG2 */
con = 0x100; con = 0x100;
} }
...@@ -107,23 +101,23 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -107,23 +101,23 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
} else { } else {
switch (val & 0x70) { switch (val & 0x70) {
case 0x10: case 0x10:
v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; t->audmode = V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
break; break;
case 0x30: case 0x30:
v->mode = VIDEO_SOUND_LANG2; t->audmode = V4L2_TUNER_MODE_LANG2;
break; break;
case 0x50: case 0x50:
v->mode = VIDEO_SOUND_LANG1; t->audmode = V4L2_TUNER_MODE_LANG1;
break; break;
case 0x60: case 0x60:
v->mode = VIDEO_SOUND_STEREO; t->audmode = V4L2_TUNER_MODE_STEREO;
break; break;
case 0x70: case 0x70:
v->mode = VIDEO_SOUND_MONO; t->audmode = V4L2_TUNER_MODE_MONO;
break; break;
default: default:
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
} }
} }
...@@ -141,15 +135,15 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -141,15 +135,15 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
* handles this with a tda9840 * 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; int val = 0;
if (set) { if (set) {
if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */
val = 0x02; val = 0x02;
if (v->mode & VIDEO_SOUND_STEREO) if (t->audmode & V4L2_TUNER_MODE_STEREO)
val = 0x01; val = 0x01;
if (val) { if (val) {
gpio_bits(0x03,val); gpio_bits(0x03,val);
...@@ -157,97 +151,96 @@ avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -157,97 +151,96 @@ avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
bttv_gpio_tracking(btv,"avermedia"); bttv_gpio_tracking(btv,"avermedia");
} }
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1; V4L2_TUNER_MODE_LANG1;
return; 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; int val = 0;
if (set) { if (set) {
if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */
val = 0x01; val = 0x01;
if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */ if (t->audmode & V4L2_TUNER_MODE_STEREO) /* STEREO */
val = 0x02; val = 0x02;
btaor(val, ~0x03, BT848_GPIO_DATA); btaor(val, ~0x03, BT848_GPIO_DATA);
if (bttv_gpio) if (bttv_gpio)
bttv_gpio_tracking(btv,"avermedia"); bttv_gpio_tracking(btv,"avermedia");
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
return; return;
} }
} }
/* Lifetec 9415 handling */ /* 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; int val = 0;
if (gpio_read() & 0x4000) { if (gpio_read() & 0x4000) {
v->mode = VIDEO_SOUND_MONO; t->audmode = V4L2_TUNER_MODE_MONO;
return; return;
} }
if (set) { if (set) {
if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */ if (t->audmode & V4L2_TUNER_MODE_LANG2) /* A2 SAP */
val = 0x0080; val = 0x0080;
if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */ if (t->audmode & V4L2_TUNER_MODE_STEREO) /* A2 stereo */
val = 0x0880; val = 0x0880;
if ((v->mode & VIDEO_SOUND_LANG1) || if ((t->audmode & V4L2_TUNER_MODE_LANG1) ||
(v->mode & VIDEO_SOUND_MONO)) (t->audmode & V4L2_TUNER_MODE_MONO))
val = 0; val = 0;
gpio_bits(0x0880, val); gpio_bits(0x0880, val);
if (bttv_gpio) if (bttv_gpio)
bttv_gpio_tracking(btv,"lt9415"); bttv_gpio_tracking(btv,"lt9415");
} else { } else {
/* autodetect doesn't work with this card :-( */ /* autodetect doesn't work with this card :-( */
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
return; return;
} }
} }
/* TDA9821 on TerraTV+ Bt848, Bt878 */ /* TDA9821 on TerraTV+ Bt848, Bt878 */
void void terratv_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
terratv_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int con = 0; unsigned int con = 0;
if (set) { if (set) {
gpio_inout(0x180000,0x180000); gpio_inout(0x180000,0x180000);
if (v->mode & VIDEO_SOUND_LANG2) if (t->audmode & V4L2_TUNER_MODE_LANG2)
con = 0x080000; con = 0x080000;
if (v->mode & VIDEO_SOUND_STEREO) if (t->audmode & V4L2_TUNER_MODE_STEREO)
con = 0x180000; con = 0x180000;
gpio_bits(0x180000, con); gpio_bits(0x180000, con);
if (bttv_gpio) if (bttv_gpio)
bttv_gpio_tracking(btv,"terratv"); bttv_gpio_tracking(btv,"terratv");
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 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; unsigned long val = 0;
if (set) { if (set) {
/*btor (0xc32000, BT848_GPIO_OUT_EN);*/ /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
if (v->mode & VIDEO_SOUND_MONO) /* Mono */ if (t->audmode & V4L2_TUNER_MODE_MONO) /* Mono */
val = 0x420000; val = 0x420000;
if (v->mode & VIDEO_SOUND_LANG1) /* Mono */ if (t->audmode & V4L2_TUNER_MODE_LANG1) /* Mono */
val = 0x420000; val = 0x420000;
if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */
val = 0x410000; val = 0x410000;
if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */ if (t->audmode & V4L2_TUNER_MODE_STEREO) /* Stereo */
val = 0x020000; val = 0x020000;
if (val) { if (val) {
gpio_bits(0x430000, val); gpio_bits(0x430000, val);
...@@ -255,8 +248,8 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -255,8 +248,8 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
bttv_gpio_tracking(btv,"winfast2000"); bttv_gpio_tracking(btv,"winfast2000");
} }
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
} }
...@@ -268,8 +261,7 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -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" * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
* will mute this cards. * will mute this cards.
*/ */
void void pvbt878p9b_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int val = 0; unsigned int val = 0;
...@@ -277,11 +269,11 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -277,11 +269,11 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
return; return;
if (set) { if (set) {
if (v->mode & VIDEO_SOUND_MONO) { if (t->audmode & V4L2_TUNER_MODE_MONO) {
val = 0x01; val = 0x01;
} }
if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) if ((t->audmode & (V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2))
|| (v->mode & VIDEO_SOUND_STEREO)) { || (t->audmode & V4L2_TUNER_MODE_STEREO)) {
val = 0x02; val = 0x02;
} }
if (val) { if (val) {
...@@ -290,8 +282,8 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -290,8 +282,8 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
bttv_gpio_tracking(btv,"pvbt878p9b"); bttv_gpio_tracking(btv,"pvbt878p9b");
} }
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
} }
...@@ -300,8 +292,7 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -300,8 +292,7 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
* sound control for FlyVideo 2000S (with tda9874 decoder) * sound control for FlyVideo 2000S (with tda9874 decoder)
* based on pvbt878p9b_audio() - this is not tested, please fix!!! * based on pvbt878p9b_audio() - this is not tested, please fix!!!
*/ */
void void fv2000s_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int val = 0xffff; unsigned int val = 0xffff;
...@@ -309,11 +300,11 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -309,11 +300,11 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
return; return;
if (set) { if (set) {
if (v->mode & VIDEO_SOUND_MONO) { if (t->audmode & V4L2_TUNER_MODE_MONO) {
val = 0x0000; val = 0x0000;
} }
if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) if ((t->audmode & (V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2))
|| (v->mode & VIDEO_SOUND_STEREO)) { || (t->audmode & V4L2_TUNER_MODE_STEREO)) {
val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */ val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */
} }
if (val != 0xffff) { if (val != 0xffff) {
...@@ -322,8 +313,8 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -322,8 +313,8 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
bttv_gpio_tracking(btv,"fv2000s"); bttv_gpio_tracking(btv,"fv2000s");
} }
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
} }
...@@ -331,19 +322,18 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -331,19 +322,18 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
* sound control for Canopus WinDVR PCI * sound control for Canopus WinDVR PCI
* Masaki Suzuki <masaki@btree.org> * Masaki Suzuki <masaki@btree.org>
*/ */
void void windvr_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
windvr_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned long val = 0; unsigned long val = 0;
if (set) { if (set) {
if (v->mode & VIDEO_SOUND_MONO) if (t->audmode & V4L2_TUNER_MODE_MONO)
val = 0x040000; val = 0x040000;
if (v->mode & VIDEO_SOUND_LANG1) if (t->audmode & V4L2_TUNER_MODE_LANG1)
val = 0; val = 0;
if (v->mode & VIDEO_SOUND_LANG2) if (t->audmode & V4L2_TUNER_MODE_LANG2)
val = 0x100000; val = 0x100000;
if (v->mode & VIDEO_SOUND_STEREO) if (t->audmode & V4L2_TUNER_MODE_STEREO)
val = 0; val = 0;
if (val) { if (val) {
gpio_bits(0x140000, val); gpio_bits(0x140000, val);
...@@ -351,8 +341,8 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -351,8 +341,8 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set)
bttv_gpio_tracking(btv,"windvr"); bttv_gpio_tracking(btv,"windvr");
} }
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
} }
...@@ -360,8 +350,7 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -360,8 +350,7 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set)
* sound control for AD-TVK503 * sound control for AD-TVK503
* Hiroshi Takekawa <sian@big.or.jp> * Hiroshi Takekawa <sian@big.or.jp>
*/ */
void void adtvk503_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int con = 0xffffff; unsigned int con = 0xffffff;
...@@ -369,13 +358,13 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -369,13 +358,13 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
if (set) { if (set) {
/* btor(***, BT848_GPIO_OUT_EN); */ /* btor(***, BT848_GPIO_OUT_EN); */
if (v->mode & VIDEO_SOUND_LANG1) if (t->audmode & V4L2_TUNER_MODE_LANG1)
con = 0x00000000; con = 0x00000000;
if (v->mode & VIDEO_SOUND_LANG2) if (t->audmode & V4L2_TUNER_MODE_LANG2)
con = 0x00180000; con = 0x00180000;
if (v->mode & VIDEO_SOUND_STEREO) if (t->audmode & V4L2_TUNER_MODE_STEREO)
con = 0x00000000; con = 0x00000000;
if (v->mode & VIDEO_SOUND_MONO) if (t->audmode & V4L2_TUNER_MODE_MONO)
con = 0x00060000; con = 0x00060000;
if (con != 0xffffff) { if (con != 0xffffff) {
gpio_bits(0x1e0000,con); gpio_bits(0x1e0000,con);
...@@ -383,7 +372,7 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -383,7 +372,7 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
bttv_gpio_tracking(btv, "adtvk503"); bttv_gpio_tracking(btv, "adtvk503");
} }
} else { } else {
v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
} }
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
#include "bttvp.h" #include "bttvp.h"
static void winview_audio(struct bttv *btv, struct video_audio *v, int set); void winview_volume (struct bttv *btv, __u16 volume);
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, void lt9415_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
int set); void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, void avermedia_tv_stereo_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
int set); void terratv_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void terratv_audio(struct bttv *btv, struct video_audio *v, int set); void gvbctv3pci_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set); void gvbctv5pci_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set); void winfast2000_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set); void pvbt878p9b_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set); void fv2000s_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set); void windvr_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void windvr_audio(struct bttv *btv, struct video_audio *v, int set); void adtvk503_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
...@@ -414,7 +414,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -414,7 +414,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = UNSET, .tuner_type = UNSET,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = avermedia_tvphone_audio, .audio_mode_gpio= avermedia_tvphone_audio,
.has_remote = 1, .has_remote = 1,
}, },
[BTTV_BOARD_MATRIX_VISION] = { [BTTV_BOARD_MATRIX_VISION] = {
...@@ -526,7 +526,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -526,7 +526,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_PAL, .tuner_type = TUNER_PHILIPS_PAL,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = avermedia_tv_stereo_audio, .audio_mode_gpio= avermedia_tv_stereo_audio,
.no_gpioirq = 1, .no_gpioirq = 1,
}, },
[BTTV_BOARD_VHX] = { [BTTV_BOARD_VHX] = {
...@@ -591,7 +591,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -591,7 +591,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = UNSET, .tuner_type = UNSET,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = winview_audio, .volume_gpio = winview_volume,
.has_radio = 1, .has_radio = 1,
}, },
[BTTV_BOARD_AVEC_INTERCAP] = { [BTTV_BOARD_AVEC_INTERCAP] = {
...@@ -715,7 +715,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -715,7 +715,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_PAL, .tuner_type = TUNER_PHILIPS_PAL,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = terratv_audio, .audio_mode_gpio= terratv_audio,
}, },
[BTTV_BOARD_HAUPPAUG_WCAM] = { [BTTV_BOARD_HAUPPAUG_WCAM] = {
.name = "Hauppauge WinCam newer (bt878)", .name = "Hauppauge WinCam newer (bt878)",
...@@ -763,7 +763,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -763,7 +763,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_PAL, .tuner_type = TUNER_PHILIPS_PAL,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = terratv_audio, .audio_mode_gpio= terratv_audio,
/* GPIO wiring: /* GPIO wiring:
External 20 pin connector (for Active Radio Upgrade board) External 20 pin connector (for Active Radio Upgrade board)
gpio00: i2c-sda gpio00: i2c-sda
...@@ -902,7 +902,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -902,7 +902,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */ .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = winfast2000_audio, .audio_mode_gpio= winfast2000_audio,
.has_remote = 1, .has_remote = 1,
}, },
[BTTV_BOARD_CHRONOS_VS2] = { [BTTV_BOARD_CHRONOS_VS2] = {
...@@ -1022,7 +1022,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1022,7 +1022,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.has_radio = 1, .has_radio = 1,
.audio_hook = avermedia_tvphone_audio, .audio_mode_gpio= avermedia_tvphone_audio,
}, },
[BTTV_BOARD_PV951] = { [BTTV_BOARD_PV951] = {
.name = "ProVideo PV951", /* pic16c54 */ .name = "ProVideo PV951", /* pic16c54 */
...@@ -1154,7 +1154,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1154,7 +1154,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_ALPS_TSHC6_NTSC, .tuner_type = TUNER_ALPS_TSHC6_NTSC,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = gvbctv3pci_audio, .audio_mode_gpio= gvbctv3pci_audio,
}, },
[BTTV_BOARD_PXELVWPLTVPAK] = { [BTTV_BOARD_PXELVWPLTVPAK] = {
.name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
...@@ -1459,7 +1459,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1459,7 +1459,7 @@ struct tvcard bttv_tvcards[] = {
/* -dk-???: set mute=0x1800 for tda9874h daughterboard */ /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
.gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, .gpiomux = { 0x0000,0x0800,0x1000,0x1000 },
.gpiomute = 0x1800, .gpiomute = 0x1800,
.audio_hook = fv2000s_audio, .audio_mode_gpio= fv2000s_audio,
.no_msp34xx = 1, .no_msp34xx = 1,
.no_tda9875 = 1, .no_tda9875 = 1,
.needs_tvaudio = 1, .needs_tvaudio = 1,
...@@ -1500,7 +1500,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1500,7 +1500,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_SHARP_2U5JF5540_NTSC, .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = gvbctv3pci_audio, .audio_mode_gpio= gvbctv3pci_audio,
}, },
/* ---- card 0x44 ---------------------------------- */ /* ---- card 0x44 ---------------------------------- */
...@@ -1619,7 +1619,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1619,7 +1619,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_PAL, .tuner_type = TUNER_PHILIPS_PAL,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_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_radio = 1, /* Note: not all cards have radio */
.has_remote = 1, .has_remote = 1,
/* GPIO wiring: /* GPIO wiring:
...@@ -1697,7 +1697,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1697,7 +1697,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_NTSC, .tuner_type = TUNER_PHILIPS_NTSC,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = windvr_audio, .audio_mode_gpio= windvr_audio,
}, },
[BTTV_BOARD_GRANDTEC_MULTI] = { [BTTV_BOARD_GRANDTEC_MULTI] = {
.name = "GrandTec Multi Capture Card (Bt878)", .name = "GrandTec Multi Capture Card (Bt878)",
...@@ -1794,7 +1794,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -1794,7 +1794,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_NTSC_M, .tuner_type = TUNER_PHILIPS_NTSC_M,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = gvbctv5pci_audio, .audio_mode_gpio= gvbctv5pci_audio,
.has_radio = 1, .has_radio = 1,
}, },
[BTTV_BOARD_OSPREY1x0] = { [BTTV_BOARD_OSPREY1x0] = {
...@@ -2093,7 +2093,7 @@ struct tvcard bttv_tvcards[] = { ...@@ -2093,7 +2093,7 @@ struct tvcard bttv_tvcards[] = {
.tuner_type = TUNER_PHILIPS_NTSC, .tuner_type = TUNER_PHILIPS_NTSC,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.audio_hook = adtvk503_audio, .audio_mode_gpio= adtvk503_audio,
}, },
/* ---- card 0x64 ---------------------------------- */ /* ---- card 0x64 ---------------------------------- */
...@@ -3160,8 +3160,8 @@ static void flyvideo_gpio(struct bttv *btv) ...@@ -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 /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
* LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00 * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
* Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */ * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio; if(has_tda9820_tda9821) btv->audio_mode_gpio = lt9415_audio;
/* todo: if(has_tda9874) btv->audio_hook = fv2000s_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, 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) ...@@ -3581,8 +3581,10 @@ void __devinit bttv_init_card2(struct bttv *btv)
btv->has_remote=1; btv->has_remote=1;
if (!bttv_tvcards[btv->c.type].no_gpioirq) if (!bttv_tvcards[btv->c.type].no_gpioirq)
btv->gpioirq=1; btv->gpioirq=1;
if (bttv_tvcards[btv->c.type].audio_hook) if (bttv_tvcards[btv->c.type].volume_gpio)
btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook; 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) { if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
/* detect Bt832 chip for quartzsight digital camera */ /* detect Bt832 chip for quartzsight digital camera */
......
...@@ -1434,20 +1434,6 @@ static void bttv_reinit_bt848(struct bttv *btv) ...@@ -1434,20 +1434,6 @@ static void bttv_reinit_bt848(struct bttv *btv)
static int get_control(struct bttv *btv, struct v4l2_control *c) 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) { switch (c->id) {
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
c->value = btv->bright; c->value = btv->bright;
...@@ -1513,21 +1499,6 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) ...@@ -1513,21 +1499,6 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
{ {
int val; 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) { switch (c->id) {
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
bt848_bright(btv,c->value); bt848_bright(btv,c->value);
...@@ -1545,6 +1516,11 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) ...@@ -1545,6 +1516,11 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
audio_mute(btv, c->value); audio_mute(btv, c->value);
/* fall through */ /* fall through */
case V4L2_CID_AUDIO_VOLUME: 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_BALANCE:
case V4L2_CID_AUDIO_BASS: case V4L2_CID_AUDIO_BASS:
case V4L2_CID_AUDIO_TREBLE: case V4L2_CID_AUDIO_TREBLE:
...@@ -1953,22 +1929,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) ...@@ -1953,22 +1929,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
return -EINVAL; return -EINVAL;
mutex_lock(&btv->lock); mutex_lock(&btv->lock);
bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t); bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t);
#ifdef CONFIG_VIDEO_V4L1
if (btv->audio_hook) { if (btv->audio_mode_gpio) {
struct video_audio va; btv->audio_mode_gpio (btv,t,1);
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);
} }
#endif
mutex_unlock(&btv->lock); mutex_unlock(&btv->lock);
return 0; return 0;
} }
...@@ -2846,19 +2810,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2846,19 +2810,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
*c = bttv_ctls[i]; *c = bttv_ctls[i];
#ifdef CONFIG_VIDEO_V4L1
if (btv->audio_hook && i >= 4 && i <= 8) { if (!btv->volume_gpio &&
struct video_audio va; (bttv_ctls[i].id == V4L2_CID_AUDIO_VOLUME))
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; *c = no_ctl;
break;
}
}
#endif
return 0; return 0;
} }
case VIDIOC_G_PARM: case VIDIOC_G_PARM:
...@@ -2890,26 +2846,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2890,26 +2846,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
t->type = V4L2_TUNER_ANALOG_TV; t->type = V4L2_TUNER_ANALOG_TV;
if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC)
t->signal = 0xffff; t->signal = 0xffff;
#ifdef CONFIG_VIDEO_V4L1
if (btv->audio_hook) { if (btv->audio_mode_gpio) {
/* Hmmm ... */ btv->audio_mode_gpio (btv,t,0);
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;
}
} }
#endif
/* FIXME: fill capability+audmode */
mutex_unlock(&btv->lock); mutex_unlock(&btv->lock);
return 0; return 0;
} }
...@@ -3403,6 +3344,10 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, ...@@ -3403,6 +3344,10 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t); 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); mutex_unlock(&btv->lock);
return 0; return 0;
......
...@@ -241,9 +241,10 @@ struct tvcard ...@@ -241,9 +241,10 @@ struct tvcard
unsigned int radio_addr; unsigned int radio_addr;
unsigned int has_radio; unsigned int has_radio;
#ifdef CONFIG_VIDEO_V4L1
void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); void (*volume_gpio)(struct bttv *btv, __u16 volume);
#endif void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set);
void (*muxsel_hook)(struct bttv *btv, unsigned int input); void (*muxsel_hook)(struct bttv *btv, unsigned int input);
}; };
......
...@@ -336,9 +336,10 @@ struct bttv { ...@@ -336,9 +336,10 @@ struct bttv {
/* old gpio interface */ /* old gpio interface */
wait_queue_head_t gpioq; wait_queue_head_t gpioq;
int shutdown; int shutdown;
#ifdef CONFIG_VIDEO_V4L1
void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); void (*volume_gpio)(struct bttv *btv, __u16 volume);
#endif void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set);
/* new gpio interface */ /* new gpio interface */
spinlock_t gpio_lock; spinlock_t gpio_lock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment