Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320019
b: refs/heads/master
c: e21adca
h: refs/heads/master
i:
  320017: b997baa
  320015: f3a2206
v: v3
  • Loading branch information
Daniel Glöckner authored and Mauro Carvalho Chehab committed Jun 18, 2012
1 parent 15a6f58 commit 2093de7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3322a59e095d648883fe68909df1b8f13ab096a9
refs/heads/master: e21adca897ee3744d15b805321012f9c40d3659c
61 changes: 32 additions & 29 deletions trunk/drivers/media/video/tvaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct CHIPSTATE {
audiocmd shadow;

/* current settings */
__u16 left,right,treble,bass,muted,mode;
__u16 left, right, treble, bass, muted;
int prevmode;
int radio;
int input;
Expand Down Expand Up @@ -287,7 +287,7 @@ static int chip_thread(void *data)
struct CHIPSTATE *chip = data;
struct CHIPDESC *desc = chip->desc;
struct v4l2_subdev *sd = &chip->sd;
int mode;
int mode, selected;

v4l2_dbg(1, debug, sd, "thread started\n");
set_freezable();
Expand All @@ -301,8 +301,8 @@ static int chip_thread(void *data)
break;
v4l2_dbg(1, debug, sd, "thread wakeup\n");

/* don't do anything for radio or if mode != auto */
if (chip->radio || chip->mode != 0)
/* don't do anything for radio */
if (chip->radio)
continue;

/* have a look what's going on */
Expand All @@ -315,16 +315,27 @@ static int chip_thread(void *data)

chip->prevmode = mode;

if (mode & V4L2_TUNER_SUB_STEREO)
desc->setmode(chip, V4L2_TUNER_MODE_STEREO);
if (mode & V4L2_TUNER_SUB_LANG1_LANG2)
desc->setmode(chip, V4L2_TUNER_MODE_STEREO);
else if (mode & V4L2_SUB_MODE_LANG1)
desc->setmode(chip, V4L2_TUNER_MODE_LANG1);
else if (mode & V4L2_SUB_MODE_LANG2)
desc->setmode(chip, V4L2_TUNER_MODE_LANG2);
else
desc->setmode(chip, V4L2_TUNER_MODE_MONO);
selected = V4L2_TUNER_MODE_MONO;
switch (chip->audmode) {
case V4L2_TUNER_MODE_MONO:
if (mode & V4L2_TUNER_SUB_LANG1)
selected = V4L2_TUNER_MODE_LANG1;
break;
case V4L2_TUNER_MODE_STEREO:
case V4L2_TUNER_MODE_LANG1:
if (mode & V4L2_TUNER_SUB_LANG1)
selected = V4L2_TUNER_MODE_LANG1;
else if (mode & V4L2_TUNER_SUB_STEREO)
selected = V4L2_TUNER_MODE_STEREO;
break;
case V4L2_TUNER_MODE_LANG2:
if (mode & V4L2_TUNER_SUB_LANG2)
selected = V4L2_TUNER_MODE_LANG2;
else if (mode & V4L2_TUNER_SUB_STEREO)
selected = V4L2_TUNER_MODE_STEREO;
break;
}
desc->setmode(chip, selected);

/* schedule next check */
mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
Expand Down Expand Up @@ -712,7 +723,6 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode)
sw_data |= TDA9873_TR_DUALB;
break;
default:
chip->mode = 0;
return;
}

Expand Down Expand Up @@ -944,7 +954,6 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
mdacosr = (tda9874a_mode) ? 0x83:0x81;
break;
default:
chip->mode = 0;
return;
}
chip_write(chip, TDA9874A_AOSR, aosr);
Expand Down Expand Up @@ -979,7 +988,6 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
aosr = 0x20; /* dual B/B */
break;
default:
chip->mode = 0;
return;
}
chip_write(chip, TDA9874A_FMMR, fmmr);
Expand Down Expand Up @@ -1799,7 +1807,6 @@ static int tvaudio_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
{
struct CHIPSTATE *chip = to_state(sd);
struct CHIPDESC *desc = chip->desc;
int mode = 0;

if (!desc->setmode)
return 0;
Expand All @@ -1811,21 +1818,20 @@ static int tvaudio_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
case V4L2_TUNER_MODE_STEREO:
case V4L2_TUNER_MODE_LANG1:
case V4L2_TUNER_MODE_LANG2:
mode = vt->audmode;
break;
case V4L2_TUNER_MODE_LANG1_LANG2:
mode = V4L2_TUNER_MODE_STEREO;
vt->audmode = V4L2_TUNER_MODE_STEREO;
break;
default:
return -EINVAL;
}
chip->audmode = vt->audmode;

if (mode) {
/* del_timer(&chip->wt); */
chip->mode = mode;
desc->setmode(chip, mode);
}
if (chip->thread)
wake_up_process(chip->thread);
else
desc->setmode(chip, vt->audmode);

return 0;
}

Expand Down Expand Up @@ -1860,8 +1866,6 @@ static int tvaudio_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *fr
struct CHIPSTATE *chip = to_state(sd);
struct CHIPDESC *desc = chip->desc;

chip->mode = 0; /* automatic */

/* For chips that provide getmode and setmode, and doesn't
automatically follows the stereo carrier, a kthread is
created to set the audio standard. In this case, when then
Expand All @@ -1872,8 +1876,7 @@ static int tvaudio_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *fr
*/
if (chip->thread) {
desc->setmode(chip, V4L2_TUNER_MODE_MONO);
if (chip->prevmode != V4L2_TUNER_MODE_MONO)
chip->prevmode = -1; /* reset previous mode */
chip->prevmode = -1; /* reset previous mode */
mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
}
return 0;
Expand Down

0 comments on commit 2093de7

Please sign in to comment.