diff options
author | Johannes Stezenbach <devnull@localhost> | 2004-01-06 12:47:41 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2004-01-06 12:47:41 +0000 |
commit | ca107fda10ccb2b4e93d1a18f070a3ed0ef57841 (patch) | |
tree | 6f3f6fc498a5a38bc9f3a1becdd2ccbc4b7722b3 | |
parent | e0e760e24c39699beabc0c04e1b884413e29ed21 (diff) | |
download | mediapointer-dvb-s2-ca107fda10ccb2b4e93d1a18f070a3ed0ef57841.tar.gz mediapointer-dvb-s2-ca107fda10ccb2b4e93d1a18f070a3ed0ef57841.tar.bz2 |
minor whitespace / coding style fixes
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110_v4l.c | 133 |
1 files changed, 60 insertions, 73 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110_v4l.c b/linux/drivers/media/dvb/ttpci/av7110_v4l.c index 3476028b4..9a02ef808 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/linux/drivers/media/dvb/ttpci/av7110_v4l.c @@ -47,13 +47,13 @@ extern int av7110_debug; int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val) { - u8 msg[5]={ dev, reg>>8, reg&0xff, val>>8 , val&0xff }; - struct dvb_i2c_bus *i2c = av7110->i2c_bus; - struct i2c_msg msgs = { .flags = 0, .addr = 0x40, .len = 5, .buf = msg}; + u8 msg[5] = { dev, reg >> 8, reg & 0xff, val >> 8 , val & 0xff }; + struct dvb_i2c_bus *i2c = av7110->i2c_bus; + struct i2c_msg msgs = { .flags = 0, .addr = 0x40, .len = 5, .buf = msg }; - if (i2c->xfer(i2c, &msgs, 1) != 1) { + if (i2c->xfer(i2c, &msgs, 1) != 1) { printk("av7110(%d): %s(%u = %u) failed\n", - av7110->dvb_adapter->num, __FUNCTION__, reg, val); + av7110->dvb_adapter->num, __FUNCTION__, reg, val); return -EIO; } return 0; @@ -61,17 +61,17 @@ int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val) int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val) { - u8 msg1[3]={ dev, reg>>8, reg&0xff }; - u8 msg2[2]; - struct dvb_i2c_bus *i2c = av7110->i2c_bus; - struct i2c_msg msgs[2] = { - { .flags = 0, .addr = 0x40, .len = 3, .buf = msg1}, - { .flags = I2C_M_RD, .addr = 0x40, .len = 2, .buf = msg2} + u8 msg1[3] = { dev, reg >> 8, reg & 0xff }; + u8 msg2[2]; + struct dvb_i2c_bus *i2c = av7110->i2c_bus; + struct i2c_msg msgs[2] = { + { .flags = 0, .addr = 0x40, .len = 3, .buf = msg1 }, + { .flags = I2C_M_RD, .addr = 0x40, .len = 2, .buf = msg2 } }; - if (i2c->xfer(i2c, msgs, 2) != 2) { + if (i2c->xfer(i2c, msgs, 2) != 2) { printk("av7110(%d): %s(%u) failed\n", - av7110->dvb_adapter->num, __FUNCTION__, reg); + av7110->dvb_adapter->num, __FUNCTION__, reg); return -EIO; } *val = (msg2[0] << 8) | msg2[1]; @@ -100,30 +100,28 @@ static struct v4l2_input inputs[2] = { } }; -/* taken from ves1820.c */ +/* for Siemens DVB-C analog module: (taken from ves1820.c) */ static int ves1820_writereg(struct saa7146_dev *dev, u8 reg, u8 data) { u8 addr = 0x09; - u8 buf[] = { 0x00, reg, data }; + u8 buf[] = { 0x00, reg, data }; struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = buf, .len = 3 }; - DEB_EE(("av7710: dev: %p\n",dev)); + DEB_EE(("av7710: dev: %p\n", dev)); - if( 1 != saa7146_i2c_transfer(dev, &msg, 1, 1)) { + if (1 != saa7146_i2c_transfer(dev, &msg, 1, 1)) return -1; - } return 0; } static int tuner_write(struct saa7146_dev *dev, u8 addr, u8 data [4]) { - struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = data, .len = 4 }; + struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = data, .len = 4 }; - DEB_EE(("av7710: dev: %p\n",dev)); + DEB_EE(("av7710: dev: %p\n", dev)); - if( 1 != saa7146_i2c_transfer(dev, &msg, 1, 1)) { + if (1 != saa7146_i2c_transfer(dev, &msg, 1, 1)) return -1; - } return 0; } @@ -132,13 +130,13 @@ static int tuner_write(struct saa7146_dev *dev, u8 addr, u8 data [4]) * set up the downconverter frequency divisor for a * reference clock comparision frequency of 62.5 kHz. */ -static int tuner_set_tv_freq (struct saa7146_dev *dev, u32 freq) +static int tuner_set_tv_freq(struct saa7146_dev *dev, u32 freq) { - u32 div; + u32 div; u8 config; - u8 buf [4]; + u8 buf[4]; - DEB_EE(("av7710: freq: 0x%08x\n",freq)); + DEB_EE(("av7710: freq: 0x%08x\n", freq)); /* magic number: 614. tuning with the frequency given by v4l2 is always off by 614*62.5 = 38375 kHz...*/ @@ -148,9 +146,9 @@ static int tuner_set_tv_freq (struct saa7146_dev *dev, u32 freq) buf[1] = div & 0xff; buf[2] = 0x8e; - if (freq < (u32) 16*168.25 ) + if (freq < (u32) (16 * 168.25)) config = 0xa0; - else if (freq < (u32) 16*447.25) + else if (freq < (u32) (16 * 447.25)) config = 0x90; else config = 0x30; @@ -158,9 +156,10 @@ static int tuner_set_tv_freq (struct saa7146_dev *dev, u32 freq) buf[3] = config; - return tuner_write (dev, 0x61, buf); + return tuner_write(dev, 0x61, buf); } + static struct saa7146_standard analog_standard[]; static struct saa7146_standard dvb_standard[]; static struct saa7146_standard standard[]; @@ -182,20 +181,20 @@ int av7110_dvb_c_switch(struct saa7146_fh *fh) struct saa7146_fh *ov_fh = NULL; int restart_overlay = 0; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); - if( vv->ov_data != NULL ) { + if (vv->ov_data != NULL) { ov_fh = vv->ov_data->fh; saa7146_stop_preview(ov_fh); restart_overlay = 1; } - if( 0 != av7110->current_input ) { + if (0 != av7110->current_input) { adswitch = 1; band = 0x68; /* analog band */ source = SAA7146_HPS_SOURCE_PORT_B; sync = SAA7146_HPS_SYNC_PORT_B; - memcpy(standard,analog_standard,sizeof(struct saa7146_standard)*2); + memcpy(standard, analog_standard, sizeof(struct saa7146_standard) * 2); printk("av7110: switching to analog TV\n"); msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source @@ -208,7 +207,7 @@ int av7110_dvb_c_switch(struct saa7146_fh *fh) band = 0x28; /* digital band */ source = SAA7146_HPS_SOURCE_PORT_A; sync = SAA7146_HPS_SYNC_PORT_A; - memcpy(standard,dvb_standard,sizeof(struct saa7146_standard)*2); + memcpy(standard, dvb_standard, sizeof(struct saa7146_standard) * 2); printk("av7110: switching DVB mode\n"); msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0220); // loudspeaker source msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0220); // headphone source @@ -222,12 +221,11 @@ int av7110_dvb_c_switch(struct saa7146_fh *fh) if (outcom(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, adswitch)) printk("ADSwitch error\n"); - if (0 != ves1820_writereg(dev, 0x0f, band)) + if (ves1820_writereg(dev, 0x0f, band)) printk("setting band in demodulator failed.\n"); saa7146_set_hps_source_and_sync(dev, source, sync); - /* restart overlay if it was active before */ - if (0 != restart_overlay) + if (restart_overlay) saa7146_start_preview(ov_fh); return 0; @@ -236,10 +234,10 @@ int av7110_dvb_c_switch(struct saa7146_fh *fh) int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) { struct saa7146_dev *dev = fh->dev; - struct av7110 *av7110 = (struct av7110*)dev->ext_priv; - DEB_EE(("saa7146_dev: %p\n",dev)); + struct av7110 *av7110 = (struct av7110*) dev->ext_priv; + DEB_EE(("saa7146_dev: %p\n", dev)); - switch(cmd) { + switch (cmd) { case VIDIOC_G_TUNER: { struct v4l2_tuner *t = arg; @@ -248,11 +246,10 @@ int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) DEB_EE(("VIDIOC_G_TUNER: %d\n", t->index)); - if( 0 == av7110->has_analog_tuner || t->index != 0 ) { + if (!av7110->has_analog_tuner || t->index != 0) return -EINVAL; - } - memset(t,0,sizeof(*t)); + memset(t, 0, sizeof(*t)); strcpy(t->name, "Television"); t->type = V4L2_TUNER_ANALOG_TV; @@ -264,6 +261,7 @@ int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) t->signal = 0xffff; t->afc = 0; +// FIXME: standard / stereo detection is still broken msp_readreg(av7110, MSP_RD_DEM, 0x007e, &stereo_det); printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); @@ -278,7 +276,7 @@ printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); else if (stereo < -0x10) { /* bilingual*/ t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; - t->audmode = V4L2_TUNER_MODE_LANG1; + t->audmode = V4L2_TUNER_MODE_LANG1; } else /* mono */ t->rxsubchans = V4L2_TUNER_SUB_MONO; @@ -291,12 +289,10 @@ printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); u16 fm_matrix, src; DEB_EE(("VIDIOC_S_TUNER: %d\n", t->index)); - if( 0 == av7110->has_analog_tuner || av7110->current_input != 1 ) { + if (!av7110->has_analog_tuner || av7110->current_input != 1) return -EINVAL; - } - - switch(t->audmode) { + switch (t->audmode) { case V4L2_TUNER_MODE_STEREO: DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n")); fm_matrix = 0x3001; // stereo @@ -322,7 +318,6 @@ printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); msp_writereg(av7110, MSP_WR_DSP, 0x0008, src); msp_writereg(av7110, MSP_WR_DSP, 0x0009, src); msp_writereg(av7110, MSP_WR_DSP, 0x000a, src); - return 0; } case VIDIOC_G_FREQUENCY: @@ -331,25 +326,22 @@ printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", f->frequency)); - if( 0 == av7110->has_analog_tuner || av7110->current_input != 1 ) { + if (!av7110->has_analog_tuner || av7110->current_input != 1) return -EINVAL; - } - memset(f,0,sizeof(*f)); + memset(f, 0, sizeof(*f)); f->type = V4L2_TUNER_ANALOG_TV; - f->frequency = av7110->current_freq; - + f->frequency = av7110->current_freq; return 0; } case VIDIOC_S_FREQUENCY: { struct v4l2_frequency *f = arg; - DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n",f->frequency)); + DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", f->frequency)); - if( 0 == av7110->has_analog_tuner || av7110->current_input != 1 ) { + if (av7110->has_analog_tuner || av7110->current_input != 1) return -EINVAL; - } if (V4L2_TUNER_ANALOG_TV != f->type) return -EINVAL; @@ -365,7 +357,6 @@ printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); msp_writereg(av7110, MSP_WR_DSP, 0x0015, 0x0000); msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume - return 0; } case VIDIOC_ENUMINPUT: @@ -374,14 +365,12 @@ printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); DEB_EE(("VIDIOC_ENUMINPUT: %d\n", i->index)); - if( 0 != av7110->has_analog_tuner ) { - if( i->index < 0 || i->index >= 2) { + if (av7110->has_analog_tuner ) { + if (i->index < 0 || i->index >= 2) return -EINVAL; - } } else { - if( i->index != 0 ) { + if (i->index != 0) return -EINVAL; - } } memcpy(i, &inputs[i->index], sizeof(struct v4l2_input)); @@ -401,15 +390,13 @@ printk("VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); DEB_EE(("VIDIOC_S_INPUT: %d\n", input)); - if( 0 == av7110->has_analog_tuner ) { + if (!av7110->has_analog_tuner ) return 0; - } - if( input < 0 || input >= 2) { + if (input < 0 || input >= 2) return -EINVAL; - } - /* fixme: switch inputs here */ + /* FIXME: switch inputs here */ av7110->current_input = input; return av7110_dvb_c_switch(fh); } @@ -619,7 +606,7 @@ int av7110_init_v4l(struct av7110 *av7110) /* we use this to remember that this dvb-c card can do vbi */ av7110->has_analog_tuner = 2; } - return 0; + return 0; } int av7110_exit_v4l(struct av7110 *av7110) @@ -678,10 +665,10 @@ static struct saa7146_standard dvb_standard[] = { static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std) { - struct av7110 *av7110 = (struct av7110*)dev->ext_priv; + struct av7110 *av7110 = (struct av7110*) dev->ext_priv; if (std->id == V4L2_STD_PAL) { - av7110->vidmode = VIDEO_MODE_PAL; + av7110->vidmode = VIDEO_MODE_PAL; SetMode(av7110, av7110->vidmode); } else if (std->id == V4L2_STD_NTSC) { @@ -702,7 +689,7 @@ static struct saa7146_ext_vv av7110_vv_data_st = { .flags = 0, .stds = &standard[0], - .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), + .num_stds = sizeof(standard) / sizeof(struct saa7146_standard), .std_callback = &std_callback, .ioctls = &ioctls[0], @@ -716,7 +703,7 @@ static struct saa7146_ext_vv av7110_vv_data_c = { .flags = SAA7146_USE_PORT_B_FOR_VBI, .stds = &standard[0], - .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), + .num_stds = sizeof(standard) / sizeof(struct saa7146_standard), .std_callback = &std_callback, .ioctls = &ioctls[0], |