Commit 40c6e683 authored by Nickolay V. Shmyrev's avatar Nickolay V. Shmyrev Committed by Mauro Carvalho Chehab

V4L/DVB (6415): Restructurize volume hook and drop unused mute hook

Signed-off-by: default avatarNickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent de5bec6b
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
* This code is placed under the terms of the GNU General Public License * This code is placed under the terms of the GNU General Public License
*/ */
#include "bttv-audio-hook.h"
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* winview */ /* winview */
#include "bttvp.h" void winview_audio(struct bttv *btv, struct video_audio *v, int set)
#include <linux/videodev.h>
static void winview_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
/* 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;
...@@ -57,7 +56,7 @@ static void winview_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -57,7 +56,7 @@ static void winview_audio(struct bttv *btv, struct video_audio *v, int set)
/* 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 */
static void void
gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set) gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int con = 0; unsigned int con = 0;
...@@ -79,7 +78,7 @@ gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -79,7 +78,7 @@ gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
} }
} }
static void void
gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int val, con; unsigned int val, con;
...@@ -142,7 +141,7 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -142,7 +141,7 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
* handles this with a tda9840 * handles this with a tda9840
* *
*/ */
static void void
avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
int val = 0; int val = 0;
...@@ -164,7 +163,7 @@ avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -164,7 +163,7 @@ avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
} }
} }
static void void
avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set) avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
int val = 0; int val = 0;
...@@ -185,7 +184,7 @@ avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -185,7 +184,7 @@ avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
} }
/* Lifetec 9415 handling */ /* Lifetec 9415 handling */
static void void
lt9415_audio(struct bttv *btv, struct video_audio *v, int set) lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
int val = 0; int val = 0;
...@@ -215,7 +214,7 @@ lt9415_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -215,7 +214,7 @@ lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
} }
/* TDA9821 on TerraTV+ Bt848, Bt878 */ /* TDA9821 on TerraTV+ Bt848, Bt878 */
static void void
terratv_audio(struct bttv *btv, struct video_audio *v, int set) terratv_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int con = 0; unsigned int con = 0;
...@@ -235,7 +234,7 @@ terratv_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -235,7 +234,7 @@ terratv_audio(struct bttv *btv, struct video_audio *v, int set)
} }
} }
static void void
winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned long val = 0; unsigned long val = 0;
...@@ -269,7 +268,7 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -269,7 +268,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.
*/ */
static void void
pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int val = 0; unsigned int val = 0;
...@@ -301,7 +300,7 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -301,7 +300,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!!!
*/ */
static void void
fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int val = 0xffff; unsigned int val = 0xffff;
...@@ -332,7 +331,7 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -332,7 +331,7 @@ 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>
*/ */
static void void
windvr_audio(struct bttv *btv, struct video_audio *v, int set) windvr_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned long val = 0; unsigned long val = 0;
...@@ -361,7 +360,7 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set) ...@@ -361,7 +360,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>
*/ */
static void void
adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
{ {
unsigned int con = 0xffffff; unsigned int con = 0xffffff;
......
...@@ -1434,23 +1434,13 @@ static void bttv_reinit_bt848(struct bttv *btv) ...@@ -1434,23 +1434,13 @@ 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)
{ {
int i;
for (i = 0; i < BTTV_CTLS; i++)
if (bttv_ctls[i].id == c->id)
break;
if (i == BTTV_CTLS)
return -EINVAL;
#ifdef CONFIG_VIDEO_V4L1 #ifdef CONFIG_VIDEO_V4L1
if (btv->audio_hook && i >= 4 && i <= 8) { if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
struct video_audio va; struct video_audio va;
memset(&va,0,sizeof(va)); memset(&va,0,sizeof(va));
btv->audio_hook(btv,&va,0); btv->audio_hook(btv,&va,0);
switch (c->id) { switch (c->id) {
case V4L2_CID_AUDIO_MUTE:
c->value = (VIDEO_AUDIO_MUTE & va.flags) ? 1 : 0;
break;
case V4L2_CID_AUDIO_VOLUME: case V4L2_CID_AUDIO_VOLUME:
c->value = va.volume; c->value = va.volume;
break; break;
...@@ -1521,30 +1511,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c) ...@@ -1521,30 +1511,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
static int set_control(struct bttv *btv, struct v4l2_control *c) static int set_control(struct bttv *btv, struct v4l2_control *c)
{ {
int i,val; int val;
for (i = 0; i < BTTV_CTLS; i++)
if (bttv_ctls[i].id == c->id)
break;
if (i == BTTV_CTLS)
return -EINVAL;
#ifdef CONFIG_VIDEO_V4L1 #ifdef CONFIG_VIDEO_V4L1
if (btv->audio_hook && i >= 4 && i <= 8) { if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
struct video_audio va; struct video_audio va;
memset(&va,0,sizeof(va)); memset(&va,0,sizeof(va));
btv->audio_hook(btv,&va,0); btv->audio_hook(btv,&va,0);
switch (c->id) { switch (c->id) {
case V4L2_CID_AUDIO_MUTE:
if (c->value) {
va.flags |= VIDEO_AUDIO_MUTE;
audio_mute(btv, 1);
} else {
va.flags &= ~VIDEO_AUDIO_MUTE;
audio_mute(btv, 0);
}
break;
case V4L2_CID_AUDIO_VOLUME: case V4L2_CID_AUDIO_VOLUME:
va.volume = c->value; va.volume = c->value;
break; break;
......
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