Commit dc3d75da authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (6418): Converted tvaudio from V4L1 to V4L2

V4L1 ioctls were replaced to V4L2 were applicable. The older ones
already implemented were removed.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 155c6ab9
...@@ -307,14 +307,16 @@ static void generic_checkmode(struct CHIPSTATE *chip) ...@@ -307,14 +307,16 @@ static void generic_checkmode(struct CHIPSTATE *chip)
v4l_dbg(1, debug, &chip->c, "%s: thread checkmode\n", chip->c.name); v4l_dbg(1, debug, &chip->c, "%s: thread checkmode\n", chip->c.name);
chip->prevmode = mode; chip->prevmode = mode;
if (mode & VIDEO_SOUND_STEREO) if (mode & V4L2_TUNER_MODE_STEREO)
desc->setmode(chip,VIDEO_SOUND_STEREO); desc->setmode(chip,V4L2_TUNER_MODE_STEREO);
else if (mode & VIDEO_SOUND_LANG1) if (mode & V4L2_TUNER_MODE_LANG1_LANG2)
desc->setmode(chip,VIDEO_SOUND_LANG1); desc->setmode(chip,V4L2_TUNER_MODE_STEREO);
else if (mode & VIDEO_SOUND_LANG2) else if (mode & V4L2_TUNER_MODE_LANG1)
desc->setmode(chip,VIDEO_SOUND_LANG2); desc->setmode(chip,V4L2_TUNER_MODE_LANG1);
else if (mode & V4L2_TUNER_MODE_LANG2)
desc->setmode(chip,V4L2_TUNER_MODE_LANG2);
else else
desc->setmode(chip,VIDEO_SOUND_MONO); desc->setmode(chip,V4L2_TUNER_MODE_MONO);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -345,11 +347,11 @@ static int tda9840_getmode(struct CHIPSTATE *chip) ...@@ -345,11 +347,11 @@ static int tda9840_getmode(struct CHIPSTATE *chip)
int val, mode; int val, mode;
val = chip_read(chip); val = chip_read(chip);
mode = VIDEO_SOUND_MONO; mode = V4L2_TUNER_MODE_MONO;
if (val & TDA9840_DS_DUAL) if (val & TDA9840_DS_DUAL)
mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
if (val & TDA9840_ST_STEREO) if (val & TDA9840_ST_STEREO)
mode |= VIDEO_SOUND_STEREO; mode |= V4L2_TUNER_MODE_STEREO;
v4l_dbg(1, debug, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n", v4l_dbg(1, debug, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n",
val, mode); val, mode);
...@@ -362,16 +364,16 @@ static void tda9840_setmode(struct CHIPSTATE *chip, int mode) ...@@ -362,16 +364,16 @@ static void tda9840_setmode(struct CHIPSTATE *chip, int mode)
int t = chip->shadow.bytes[TDA9840_SW + 1] & ~0x7e; int t = chip->shadow.bytes[TDA9840_SW + 1] & ~0x7e;
switch (mode) { switch (mode) {
case VIDEO_SOUND_MONO: case V4L2_TUNER_MODE_MONO:
t |= TDA9840_MONO; t |= TDA9840_MONO;
break; break;
case VIDEO_SOUND_STEREO: case V4L2_TUNER_MODE_STEREO:
t |= TDA9840_STEREO; t |= TDA9840_STEREO;
break; break;
case VIDEO_SOUND_LANG1: case V4L2_TUNER_MODE_LANG1:
t |= TDA9840_DUALA; t |= TDA9840_DUALA;
break; break;
case VIDEO_SOUND_LANG2: case V4L2_TUNER_MODE_LANG2:
t |= TDA9840_DUALB; t |= TDA9840_DUALB;
break; break;
default: default:
...@@ -502,7 +504,7 @@ static int tda985x_getmode(struct CHIPSTATE *chip) ...@@ -502,7 +504,7 @@ static int tda985x_getmode(struct CHIPSTATE *chip)
chip_read(chip)) >> 4; chip_read(chip)) >> 4;
/* Add mono mode regardless of SAP and stereo */ /* Add mono mode regardless of SAP and stereo */
/* Allows forced mono */ /* Allows forced mono */
return mode | VIDEO_SOUND_MONO; return mode | V4L2_TUNER_MODE_MONO;
} }
static void tda985x_setmode(struct CHIPSTATE *chip, int mode) static void tda985x_setmode(struct CHIPSTATE *chip, int mode)
...@@ -511,13 +513,13 @@ static void tda985x_setmode(struct CHIPSTATE *chip, int mode) ...@@ -511,13 +513,13 @@ static void tda985x_setmode(struct CHIPSTATE *chip, int mode)
int c6 = chip->shadow.bytes[TDA985x_C6+1] & 0x3f; int c6 = chip->shadow.bytes[TDA985x_C6+1] & 0x3f;
switch (mode) { switch (mode) {
case VIDEO_SOUND_MONO: case V4L2_TUNER_MODE_MONO:
c6 |= TDA985x_MONO; c6 |= TDA985x_MONO;
break; break;
case VIDEO_SOUND_STEREO: case V4L2_TUNER_MODE_STEREO:
c6 |= TDA985x_STEREO; c6 |= TDA985x_STEREO;
break; break;
case VIDEO_SOUND_LANG1: case V4L2_TUNER_MODE_LANG1:
c6 |= TDA985x_SAP; c6 |= TDA985x_SAP;
break; break;
default: default:
...@@ -650,11 +652,11 @@ static int tda9873_getmode(struct CHIPSTATE *chip) ...@@ -650,11 +652,11 @@ static int tda9873_getmode(struct CHIPSTATE *chip)
int val,mode; int val,mode;
val = chip_read(chip); val = chip_read(chip);
mode = VIDEO_SOUND_MONO; mode = V4L2_TUNER_MODE_MONO;
if (val & TDA9873_STEREO) if (val & TDA9873_STEREO)
mode |= VIDEO_SOUND_STEREO; mode |= V4L2_TUNER_MODE_STEREO;
if (val & TDA9873_DUAL) if (val & TDA9873_DUAL)
mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
v4l_dbg(1, debug, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n", v4l_dbg(1, debug, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n",
val, mode); val, mode);
return mode; return mode;
...@@ -674,16 +676,16 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode) ...@@ -674,16 +676,16 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode)
v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): sw_data = %d\n", sw_data); v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): sw_data = %d\n", sw_data);
switch (mode) { switch (mode) {
case VIDEO_SOUND_MONO: case V4L2_TUNER_MODE_MONO:
sw_data |= TDA9873_TR_MONO; sw_data |= TDA9873_TR_MONO;
break; break;
case VIDEO_SOUND_STEREO: case V4L2_TUNER_MODE_STEREO:
sw_data |= TDA9873_TR_STEREO; sw_data |= TDA9873_TR_STEREO;
break; break;
case VIDEO_SOUND_LANG1: case V4L2_TUNER_MODE_LANG1:
sw_data |= TDA9873_TR_DUALA; sw_data |= TDA9873_TR_DUALA;
break; break;
case VIDEO_SOUND_LANG2: case V4L2_TUNER_MODE_LANG2:
sw_data |= TDA9873_TR_DUALB; sw_data |= TDA9873_TR_DUALB;
break; break;
default: default:
...@@ -841,7 +843,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) ...@@ -841,7 +843,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
int dsr,nsr,mode; int dsr,nsr,mode;
int necr; /* just for debugging */ int necr; /* just for debugging */
mode = VIDEO_SOUND_MONO; mode = V4L2_TUNER_MODE_MONO;
if(-1 == (dsr = chip_read2(chip,TDA9874A_DSR))) if(-1 == (dsr = chip_read2(chip,TDA9874A_DSR)))
return mode; return mode;
...@@ -860,18 +862,18 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) ...@@ -860,18 +862,18 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
* that sound has (temporarily) switched from NICAM to * that sound has (temporarily) switched from NICAM to
* mono FM (or AM) on 1st sound carrier due to high NICAM bit * mono FM (or AM) on 1st sound carrier due to high NICAM bit
* error count. So in fact there is no stereo in this case :-( * error count. So in fact there is no stereo in this case :-(
* But changing the mode to VIDEO_SOUND_MONO would switch * But changing the mode to V4L2_TUNER_MODE_MONO would switch
* external 4052 multiplexer in audio_hook(). * external 4052 multiplexer in audio_hook().
*/ */
if(nsr & 0x02) /* NSR.S/MB=1 */ if(nsr & 0x02) /* NSR.S/MB=1 */
mode |= VIDEO_SOUND_STEREO; mode |= V4L2_TUNER_MODE_STEREO;
if(nsr & 0x01) /* NSR.D/SB=1 */ if(nsr & 0x01) /* NSR.D/SB=1 */
mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} else { } else {
if(dsr & 0x02) /* DSR.IDSTE=1 */ if(dsr & 0x02) /* DSR.IDSTE=1 */
mode |= VIDEO_SOUND_STEREO; mode |= V4L2_TUNER_MODE_STEREO;
if(dsr & 0x04) /* DSR.IDDUA=1 */ if(dsr & 0x04) /* DSR.IDDUA=1 */
mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
} }
v4l_dbg(1, debug, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", v4l_dbg(1, debug, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n",
...@@ -902,14 +904,14 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode) ...@@ -902,14 +904,14 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
int mdacosr = (tda9874a_mode) ? 0x82:0x80; int mdacosr = (tda9874a_mode) ? 0x82:0x80;
switch(mode) { switch(mode) {
case VIDEO_SOUND_MONO: case V4L2_TUNER_MODE_MONO:
case VIDEO_SOUND_STEREO: case V4L2_TUNER_MODE_STEREO:
break; break;
case VIDEO_SOUND_LANG1: case V4L2_TUNER_MODE_LANG1:
aosr = 0x80; /* auto-select, dual A/A */ aosr = 0x80; /* auto-select, dual A/A */
mdacosr = (tda9874a_mode) ? 0x82:0x80; mdacosr = (tda9874a_mode) ? 0x82:0x80;
break; break;
case VIDEO_SOUND_LANG2: case V4L2_TUNER_MODE_LANG2:
aosr = 0xa0; /* auto-select, dual B/B */ aosr = 0xa0; /* auto-select, dual B/B */
mdacosr = (tda9874a_mode) ? 0x83:0x81; mdacosr = (tda9874a_mode) ? 0x83:0x81;
break; break;
...@@ -927,11 +929,11 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode) ...@@ -927,11 +929,11 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
int fmmr,aosr; int fmmr,aosr;
switch(mode) { switch(mode) {
case VIDEO_SOUND_MONO: case V4L2_TUNER_MODE_MONO:
fmmr = 0x00; /* mono */ fmmr = 0x00; /* mono */
aosr = 0x10; /* A/A */ aosr = 0x10; /* A/A */
break; break;
case VIDEO_SOUND_STEREO: case V4L2_TUNER_MODE_STEREO:
if(tda9874a_mode) { if(tda9874a_mode) {
fmmr = 0x00; fmmr = 0x00;
aosr = 0x00; /* handled by NICAM auto-mute */ aosr = 0x00; /* handled by NICAM auto-mute */
...@@ -940,11 +942,11 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode) ...@@ -940,11 +942,11 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
aosr = 0x00; aosr = 0x00;
} }
break; break;
case VIDEO_SOUND_LANG1: case V4L2_TUNER_MODE_LANG1:
fmmr = 0x02; /* dual */ fmmr = 0x02; /* dual */
aosr = 0x10; /* dual A/A */ aosr = 0x10; /* dual A/A */
break; break;
case VIDEO_SOUND_LANG2: case V4L2_TUNER_MODE_LANG2:
fmmr = 0x02; /* dual */ fmmr = 0x02; /* dual */
aosr = 0x20; /* dual B/B */ aosr = 0x20; /* dual B/B */
break; break;
...@@ -1105,20 +1107,20 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int mode) ...@@ -1105,20 +1107,20 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int mode)
{ {
int s1 = chip->shadow.bytes[TDA8425_S1+1] & 0xe1; int s1 = chip->shadow.bytes[TDA8425_S1+1] & 0xe1;
if (mode & VIDEO_SOUND_LANG1) { if (mode & V4L2_TUNER_MODE_LANG1) {
s1 |= TDA8425_S1_ML_SOUND_A; s1 |= TDA8425_S1_ML_SOUND_A;
s1 |= TDA8425_S1_STEREO_PSEUDO; s1 |= TDA8425_S1_STEREO_PSEUDO;
} else if (mode & VIDEO_SOUND_LANG2) { } else if (mode & V4L2_TUNER_MODE_LANG2) {
s1 |= TDA8425_S1_ML_SOUND_B; s1 |= TDA8425_S1_ML_SOUND_B;
s1 |= TDA8425_S1_STEREO_PSEUDO; s1 |= TDA8425_S1_STEREO_PSEUDO;
} else { } else {
s1 |= TDA8425_S1_ML_STEREO; s1 |= TDA8425_S1_ML_STEREO;
if (mode & VIDEO_SOUND_MONO) if (mode & V4L2_TUNER_MODE_MONO)
s1 |= TDA8425_S1_STEREO_MONO; s1 |= TDA8425_S1_STEREO_MONO;
if (mode & VIDEO_SOUND_STEREO) if (mode & V4L2_TUNER_MODE_STEREO)
s1 |= TDA8425_S1_STEREO_SPATIAL; s1 |= TDA8425_S1_STEREO_SPATIAL;
} }
chip_write(chip,TDA8425_S1,s1); chip_write(chip,TDA8425_S1,s1);
...@@ -1177,11 +1179,11 @@ static int ta8874z_getmode(struct CHIPSTATE *chip) ...@@ -1177,11 +1179,11 @@ static int ta8874z_getmode(struct CHIPSTATE *chip)
int val, mode; int val, mode;
val = chip_read(chip); val = chip_read(chip);
mode = VIDEO_SOUND_MONO; mode = V4L2_TUNER_MODE_MONO;
if (val & TA8874Z_B1){ if (val & TA8874Z_B1){
mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
}else if (!(val & TA8874Z_B0)){ }else if (!(val & TA8874Z_B0)){
mode |= VIDEO_SOUND_STEREO; mode |= V4L2_TUNER_MODE_STEREO;
} }
/* v4l_dbg(1, debug, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ /* v4l_dbg(1, debug, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */
return mode; return mode;
...@@ -1199,16 +1201,16 @@ static void ta8874z_setmode(struct CHIPSTATE *chip, int mode) ...@@ -1199,16 +1201,16 @@ static void ta8874z_setmode(struct CHIPSTATE *chip, int mode)
v4l_dbg(1, debug, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode); v4l_dbg(1, debug, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode);
switch(mode){ switch(mode){
case VIDEO_SOUND_MONO: case V4L2_TUNER_MODE_MONO:
t = &ta8874z_mono; t = &ta8874z_mono;
break; break;
case VIDEO_SOUND_STEREO: case V4L2_TUNER_MODE_STEREO:
t = &ta8874z_stereo; t = &ta8874z_stereo;
break; break;
case VIDEO_SOUND_LANG1: case V4L2_TUNER_MODE_LANG1:
t = &ta8874z_main; t = &ta8874z_main;
break; break;
case VIDEO_SOUND_LANG2: case V4L2_TUNER_MODE_LANG2:
t = &ta8874z_sub; t = &ta8874z_sub;
break; break;
default: default:
...@@ -1570,7 +1572,48 @@ static int chip_detach(struct i2c_client *client) ...@@ -1570,7 +1572,48 @@ static int chip_detach(struct i2c_client *client)
return 0; return 0;
} }
static int tvaudio_set_ctrl(struct CHIPSTATE *chip, struct v4l2_control *ctrl) static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
struct v4l2_control *ctrl)
{
struct CHIPDESC *desc = chiplist + chip->type;
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
ctrl->value=chip->muted;
return 0;
case V4L2_CID_AUDIO_VOLUME:
if (!desc->flags & CHIP_HAS_VOLUME)
break;
ctrl->value = max(chip->left,chip->right);
return 0;
case V4L2_CID_AUDIO_BALANCE:
{
int volume;
if (!desc->flags & CHIP_HAS_VOLUME)
break;
volume = max(chip->left,chip->right);
if (volume)
ctrl->value=(32768*min(chip->left,chip->right))/volume;
else
ctrl->value=32768;
return 0;
}
case V4L2_CID_AUDIO_BASS:
if (desc->flags & CHIP_HAS_BASSTREBLE)
break;
ctrl->value = chip->bass;
return 0;
case V4L2_CID_AUDIO_TREBLE:
if (desc->flags & CHIP_HAS_BASSTREBLE)
return -EINVAL;
ctrl->value = chip->treble;
return 0;
}
return -EINVAL;
}
static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
struct v4l2_control *ctrl)
{ {
struct CHIPDESC *desc = chiplist + chip->type; struct CHIPDESC *desc = chiplist + chip->type;
...@@ -1584,11 +1627,60 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip, struct v4l2_control *ctrl) ...@@ -1584,11 +1627,60 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip, struct v4l2_control *ctrl)
else else
chip_write_masked(chip,desc->inputreg, chip_write_masked(chip,desc->inputreg,
desc->inputmap[chip->input],desc->inputmask); desc->inputmap[chip->input],desc->inputmask);
return 0;
case V4L2_CID_AUDIO_VOLUME:
{
int volume,balance;
if (!desc->flags & CHIP_HAS_VOLUME)
break; break;
default:
return -EINVAL; volume = max(chip->left,chip->right);
if (volume)
balance=(32768*min(chip->left,chip->right))/volume;
else
balance=32768;
volume=ctrl->value;
chip->left = (min(65536 - balance,32768) * volume) / 32768;
chip->right = (min(balance,volume *(__u16)32768)) / 32768;
chip_write(chip,desc->leftreg,desc->volfunc(chip->left));
chip_write(chip,desc->rightreg,desc->volfunc(chip->right));
return 0;
} }
case V4L2_CID_AUDIO_BALANCE:
{
int volume, balance;
if (!desc->flags & CHIP_HAS_VOLUME)
break;
volume = max(chip->left,chip->right);
balance = ctrl->value;
chip_write(chip,desc->leftreg,desc->volfunc(chip->left));
chip_write(chip,desc->rightreg,desc->volfunc(chip->right));
return 0; return 0;
}
case V4L2_CID_AUDIO_BASS:
if (desc->flags & CHIP_HAS_BASSTREBLE)
break;
chip->bass = ctrl->value;
chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));
return 0;
case V4L2_CID_AUDIO_TREBLE:
if (desc->flags & CHIP_HAS_BASSTREBLE)
return -EINVAL;
chip->treble = ctrl->value;
chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
return 0;
}
return -EINVAL;
} }
...@@ -1609,67 +1701,36 @@ static int chip_command(struct i2c_client *client, ...@@ -1609,67 +1701,36 @@ static int chip_command(struct i2c_client *client,
chip->watch_stereo = 0; chip->watch_stereo = 0;
/* del_timer(&chip->wt); */ /* del_timer(&chip->wt); */
break; break;
/* --- v4l ioctls --- */ /* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a /* take care: bttv does userspace copying, we'll get a
kernel pointer here... */ kernel pointer here... */
case VIDIOCGAUDIO: case VIDIOC_QUERYCTRL:
{ {
struct video_audio *va = arg; struct v4l2_queryctrl *qc = arg;
if (desc->flags & CHIP_HAS_VOLUME) { switch (qc->id) {
va->flags |= VIDEO_AUDIO_VOLUME; case V4L2_CID_AUDIO_MUTE:
va->volume = max(chip->left,chip->right);
if (va->volume)
va->balance = (32768*min(chip->left,chip->right))/
va->volume;
else
va->balance = 32768;
}
if (desc->flags & CHIP_HAS_BASSTREBLE) {
va->flags |= VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE;
va->bass = chip->bass;
va->treble = chip->treble;
}
if (!chip->radio) {
if (desc->getmode)
va->mode = desc->getmode(chip);
else
va->mode = VIDEO_SOUND_MONO;
}
break; break;
} case V4L2_CID_AUDIO_VOLUME:
case V4L2_CID_AUDIO_BALANCE:
case VIDIOCSAUDIO: if (!desc->flags & CHIP_HAS_VOLUME)
{ return -EINVAL;
struct video_audio *va = arg;
if (desc->flags & CHIP_HAS_VOLUME) {
chip->left = (min(65536 - va->balance,32768) *
va->volume) / 32768;
chip->right = (min(va->balance,(__u16)32768) *
va->volume) / 32768;
chip_write(chip,desc->leftreg,desc->volfunc(chip->left));
chip_write(chip,desc->rightreg,desc->volfunc(chip->right));
}
if (desc->flags & CHIP_HAS_BASSTREBLE) {
chip->bass = va->bass;
chip->treble = va->treble;
chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));
chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
}
if (desc->setmode && va->mode) {
chip->watch_stereo = 0;
/* del_timer(&chip->wt); */
chip->mode = va->mode;
desc->setmode(chip,va->mode);
}
break; break;
case V4L2_CID_AUDIO_BASS:
case V4L2_CID_AUDIO_TREBLE:
if (desc->flags & CHIP_HAS_BASSTREBLE)
return -EINVAL;
break;
default:
return -EINVAL;
}
return v4l2_ctrl_query_fill_std(qc);
} }
case VIDIOC_S_CTRL: case VIDIOC_S_CTRL:
return tvaudio_set_ctrl(chip, arg); return tvaudio_set_ctrl(chip, arg);
case VIDIOC_G_CTRL:
return tvaudio_get_ctrl(chip, arg);
case VIDIOC_INT_G_AUDIO_ROUTING: case VIDIOC_INT_G_AUDIO_ROUTING:
{ {
struct v4l2_routing *rt = arg; struct v4l2_routing *rt = arg;
...@@ -1678,7 +1739,6 @@ static int chip_command(struct i2c_client *client, ...@@ -1678,7 +1739,6 @@ static int chip_command(struct i2c_client *client,
rt->output = 0; rt->output = 0;
break; break;
} }
case VIDIOC_INT_S_AUDIO_ROUTING: case VIDIOC_INT_S_AUDIO_ROUTING:
{ {
struct v4l2_routing *rt = arg; struct v4l2_routing *rt = arg;
...@@ -1693,7 +1753,6 @@ static int chip_command(struct i2c_client *client, ...@@ -1693,7 +1753,6 @@ static int chip_command(struct i2c_client *client,
desc->inputmap[chip->input], desc->inputmask); desc->inputmap[chip->input], desc->inputmask);
break; break;
} }
case VIDIOC_S_TUNER: case VIDIOC_S_TUNER:
{ {
struct v4l2_tuner *vt = arg; struct v4l2_tuner *vt = arg;
...@@ -1703,17 +1762,13 @@ static int chip_command(struct i2c_client *client, ...@@ -1703,17 +1762,13 @@ static int chip_command(struct i2c_client *client,
break; break;
switch (vt->audmode) { switch (vt->audmode) {
case V4L2_TUNER_MODE_MONO: case V4L2_TUNER_MODE_MONO:
mode = VIDEO_SOUND_MONO;
break;
case V4L2_TUNER_MODE_STEREO: case V4L2_TUNER_MODE_STEREO:
case V4L2_TUNER_MODE_LANG1_LANG2:
mode = VIDEO_SOUND_STEREO;
break;
case V4L2_TUNER_MODE_LANG1: case V4L2_TUNER_MODE_LANG1:
mode = VIDEO_SOUND_LANG1;
break;
case V4L2_TUNER_MODE_LANG2: case V4L2_TUNER_MODE_LANG2:
mode = VIDEO_SOUND_LANG2; mode = vt->audmode;
break;
case V4L2_TUNER_MODE_LANG1_LANG2:
mode = V4L2_TUNER_MODE_STEREO;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -1728,11 +1783,10 @@ static int chip_command(struct i2c_client *client, ...@@ -1728,11 +1783,10 @@ static int chip_command(struct i2c_client *client,
} }
break; break;
} }
case VIDIOC_G_TUNER: case VIDIOC_G_TUNER:
{ {
struct v4l2_tuner *vt = arg; struct v4l2_tuner *vt = arg;
int mode = VIDEO_SOUND_MONO; int mode = V4L2_TUNER_MODE_MONO;
if (chip->radio) if (chip->radio)
break; break;
...@@ -1744,30 +1798,26 @@ static int chip_command(struct i2c_client *client, ...@@ -1744,30 +1798,26 @@ static int chip_command(struct i2c_client *client,
if (desc->getmode) if (desc->getmode)
mode = desc->getmode(chip); mode = desc->getmode(chip);
if (mode & VIDEO_SOUND_MONO) if (mode & V4L2_TUNER_MODE_MONO)
vt->rxsubchans |= V4L2_TUNER_SUB_MONO; vt->rxsubchans |= V4L2_TUNER_SUB_MONO;
if (mode & VIDEO_SOUND_STEREO) if (mode & V4L2_TUNER_MODE_STEREO)
vt->rxsubchans |= V4L2_TUNER_SUB_STEREO; vt->rxsubchans |= V4L2_TUNER_SUB_STEREO;
/* Note: for SAP it should be mono/lang2 or stereo/lang2. /* Note: for SAP it should be mono/lang2 or stereo/lang2.
When this module is converted fully to v4l2, then this When this module is converted fully to v4l2, then this
should change for those chips that can detect SAP. */ should change for those chips that can detect SAP. */
if (mode & VIDEO_SOUND_LANG1) if (mode & V4L2_TUNER_MODE_LANG1)
vt->rxsubchans = V4L2_TUNER_SUB_LANG1 | vt->rxsubchans = V4L2_TUNER_SUB_LANG1 |
V4L2_TUNER_SUB_LANG2; V4L2_TUNER_SUB_LANG2;
break; break;
} }
case VIDIOCSCHAN:
case VIDIOC_S_STD: case VIDIOC_S_STD:
chip->radio = 0; chip->radio = 0;
break; break;
case VIDIOCSFREQ:
case VIDIOC_S_FREQUENCY: case VIDIOC_S_FREQUENCY:
chip->mode = 0; /* automatic */ chip->mode = 0; /* automatic */
if (desc->checkmode) { if (desc->checkmode) {
desc->setmode(chip,VIDEO_SOUND_MONO); desc->setmode(chip,V4L2_TUNER_MODE_MONO);
if (chip->prevmode != VIDEO_SOUND_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)); mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
/* the thread will call checkmode() later */ /* the thread will call checkmode() later */
......
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