V4L/DVB (8942): mxb: coding style cleanups
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
707ecf4603
Коммит
2633812f89
|
@ -317,7 +317,6 @@ static int mxb_init_done(struct saa7146_dev* dev)
|
|||
struct tea6415c_multiplex vm;
|
||||
|
||||
/* select video mode in saa7111a */
|
||||
/* fixme: currently pointless: gets overwritten by configuration below */
|
||||
mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_S_STD, &std);
|
||||
|
||||
/* select tuner-output on saa7111a */
|
||||
|
@ -372,7 +371,8 @@ static int mxb_init_done(struct saa7146_dev* dev)
|
|||
msg.len = mxb_saa7740_init[0].length;
|
||||
msg.buf = &mxb_saa7740_init[0].data[0];
|
||||
|
||||
if( 1 == (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) {
|
||||
err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
|
||||
if (err == 1) {
|
||||
/* the sound arena module is a pos, that's probably the reason
|
||||
philips refuses to hand out a datasheet for the saa7740...
|
||||
it seems to screw up the i2c bus, so we disable fast irq
|
||||
|
@ -380,13 +380,13 @@ static int mxb_init_done(struct saa7146_dev* dev)
|
|||
polling method ... */
|
||||
extension.flags &= ~SAA7146_USE_I2C_IRQ;
|
||||
for (i = 1; ; i++) {
|
||||
if( -1 == mxb_saa7740_init[i].length ) {
|
||||
if (-1 == mxb_saa7740_init[i].length)
|
||||
break;
|
||||
}
|
||||
|
||||
msg.len = mxb_saa7740_init[i].length;
|
||||
msg.buf = &mxb_saa7740_init[i].data[0];
|
||||
if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) {
|
||||
err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
|
||||
if (err != 1) {
|
||||
DEB_D(("failed to initialize 'sound arena module'.\n"));
|
||||
goto err;
|
||||
}
|
||||
|
@ -400,7 +400,8 @@ err:
|
|||
/* ext->saa has been filled by the core driver */
|
||||
|
||||
/* some stuff is done via variables */
|
||||
saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source, input_port_selection[mxb->cur_input].hps_sync);
|
||||
saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source,
|
||||
input_port_selection[mxb->cur_input].hps_sync);
|
||||
|
||||
/* some stuff is done via direct write to the registers */
|
||||
|
||||
|
@ -475,9 +476,8 @@ static int mxb_detach(struct saa7146_dev* dev)
|
|||
i2c_release_client(mxb->tuner);
|
||||
|
||||
saa7146_unregister_device(&mxb->video_dev,dev);
|
||||
if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) {
|
||||
if (MXB_BOARD_CAN_DO_VBI(dev))
|
||||
saa7146_unregister_device(&mxb->vbi_dev, dev);
|
||||
}
|
||||
saa7146_vv_release(dev);
|
||||
|
||||
mxb_num--;
|
||||
|
@ -500,11 +500,9 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
struct v4l2_input *i = arg;
|
||||
|
||||
DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index));
|
||||
if( i->index < 0 || i->index >= MXB_INPUTS) {
|
||||
if (i->index < 0 || i->index >= MXB_INPUTS)
|
||||
return -EINVAL;
|
||||
}
|
||||
memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input));
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* the saa7146 provides some controls (brightness, contrast, saturation)
|
||||
|
@ -530,22 +528,18 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
int i;
|
||||
|
||||
for (i = MAXCONTROLS - 1; i >= 0; i--) {
|
||||
if (mxb_controls[i].id == vc->id) {
|
||||
if (mxb_controls[i].id == vc->id)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( i < 0 ) {
|
||||
if (i < 0)
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
switch (vc->id ) {
|
||||
case V4L2_CID_AUDIO_MUTE: {
|
||||
if (vc->id == V4L2_CID_AUDIO_MUTE) {
|
||||
vc->value = mxb->cur_mute;
|
||||
DEB_D(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value));
|
||||
return 0;
|
||||
|
@ -557,29 +551,28 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
int i = 0;
|
||||
|
||||
for (i = MAXCONTROLS - 1; i >= 0; i--) {
|
||||
if (mxb_controls[i].id == vc->id) {
|
||||
if (mxb_controls[i].id == vc->id)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( i < 0 ) {
|
||||
if (i < 0)
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
switch (vc->id ) {
|
||||
case V4L2_CID_AUDIO_MUTE: {
|
||||
if (vc->id == V4L2_CID_AUDIO_MUTE) {
|
||||
mxb->cur_mute = vc->value;
|
||||
if( 0 == vc->value ) {
|
||||
if (!vc->value) {
|
||||
/* switch the audio-source */
|
||||
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][0]);
|
||||
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][1]);
|
||||
mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
|
||||
&TEA6420_line[video_audio_connect[mxb->cur_input]][0]);
|
||||
mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
|
||||
&TEA6420_line[video_audio_connect[mxb->cur_input]][1]);
|
||||
} else {
|
||||
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
|
||||
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);
|
||||
mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
|
||||
&TEA6420_line[6][0]);
|
||||
mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
|
||||
&TEA6420_line[6][1]);
|
||||
}
|
||||
DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n", vc->value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -600,72 +593,59 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
|
||||
DEB_EE(("VIDIOC_S_INPUT %d.\n", input));
|
||||
|
||||
if (input < 0 || input >= MXB_INPUTS) {
|
||||
if (input < 0 || input >= MXB_INPUTS)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mxb->cur_input = input;
|
||||
|
||||
saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync);
|
||||
saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source,
|
||||
input_port_selection[input].hps_sync);
|
||||
|
||||
/* prepare switching of tea6415c and saa7111a;
|
||||
have a look at the 'background'-file for further informations */
|
||||
switch (input) {
|
||||
|
||||
case TUNER:
|
||||
{
|
||||
i = SAA7115_COMPOSITE0;
|
||||
vm.in = 3;
|
||||
vm.out = 17;
|
||||
|
||||
if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) {
|
||||
printk("VIDIOC_S_INPUT: could not address tea6415c #1\n");
|
||||
if (mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm)) {
|
||||
printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #1\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
/* connect tuner-output always to multicable */
|
||||
vm.in = 3;
|
||||
vm.out = 13;
|
||||
break;
|
||||
}
|
||||
case AUX3_YC:
|
||||
{
|
||||
/* nothing to be done here. aux3_yc is
|
||||
directly connected to the saa711a */
|
||||
i = SAA7115_SVIDEO1;
|
||||
break;
|
||||
}
|
||||
case AUX3:
|
||||
{
|
||||
/* nothing to be done here. aux3 is
|
||||
directly connected to the saa711a */
|
||||
i = SAA7115_COMPOSITE1;
|
||||
break;
|
||||
}
|
||||
case AUX1:
|
||||
{
|
||||
i = SAA7115_COMPOSITE0;
|
||||
vm.in = 1;
|
||||
vm.out = 17;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* switch video in tea6415c only if necessary */
|
||||
switch (input) {
|
||||
case TUNER:
|
||||
case AUX1:
|
||||
{
|
||||
if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) {
|
||||
printk("VIDIOC_S_INPUT: could not address tea6415c #3\n");
|
||||
if (mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm)) {
|
||||
printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #3\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* switch video in saa7111a */
|
||||
route.input = i;
|
||||
|
@ -675,8 +655,10 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
|
||||
/* switch the audio-source only if necessary */
|
||||
if( 0 == mxb->cur_mute ) {
|
||||
mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][0]);
|
||||
mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][1]);
|
||||
mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
|
||||
&TEA6420_line[video_audio_connect[input]][0]);
|
||||
mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
|
||||
&TEA6420_line[video_audio_connect[input]][1]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -719,8 +701,9 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
{
|
||||
struct v4l2_frequency *f = arg;
|
||||
|
||||
if(0 != mxb->cur_input) {
|
||||
DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n",mxb->cur_input));
|
||||
if (mxb->cur_input) {
|
||||
DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n",
|
||||
mxb->cur_input));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -733,7 +716,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
{
|
||||
struct v4l2_frequency *f = arg;
|
||||
|
||||
if (0 != f->tuner)
|
||||
if (f->tuner)
|
||||
return -EINVAL;
|
||||
|
||||
if (V4L2_TUNER_ANALOG_TV != f->type)
|
||||
|
@ -805,13 +788,16 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
|
|||
case VIDIOC_S_AUDIO:
|
||||
{
|
||||
struct v4l2_audio *a = arg;
|
||||
|
||||
DEB_D(("VIDIOC_S_AUDIO %d.\n", a->index));
|
||||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
case VIDIOC_DBG_S_REGISTER:
|
||||
case VIDIOC_DBG_G_REGISTER:
|
||||
i2c_clients_command(&mxb->i2c_adapter, cmd, arg);
|
||||
break;
|
||||
return 0;
|
||||
#endif
|
||||
default:
|
||||
/*
|
||||
DEB2(printk("does not handle this ioctl.\n"));
|
||||
|
@ -919,7 +905,7 @@ static struct saa7146_extension extension = {
|
|||
|
||||
static int __init mxb_init_module(void)
|
||||
{
|
||||
if( 0 != saa7146_register_extension(&extension)) {
|
||||
if (saa7146_register_extension(&extension)) {
|
||||
DEB_S(("failed to register extension.\n"));
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче