Skip to content

Commit

Permalink
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/mchehab/linux-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (36 commits)
  V4L/DVB (9336): cx88: always de-alloc frontends on fault condition
  V4L/DVB (9335): videobuf: split unregister bus creating self-contained frontend de-allocator
  V4L/DVB (9334): cx88: dvb_remove debug output
  V4L/DVB (9333): cx88: Not all boards that requires cx88-mpeg has frontends
  V4L/DVB (9332): cx88: initial fix for analogue only compilation
  V4L/DVB (9331): Remove unused inode parameter from video_ioctl2
  V4L/DVB (9330): Get rid of inode parameter at v4l_compat_translate_ioctl()
  V4L/DVB (9328): ivtvfb: FB_BLANK_POWERDOWN turns off video output
  V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d
  V4L/DVB (9326): ivtv: avoid green flashing when loading ivtv
  V4L/DVB (9325): ivtv: switch to unlocked_ioctl.
  V4L/DVB (9324): v4l2: add video_ioctl2_unlocked for unlocked_ioctl support.
  V4L/DVB (9323): v4l2-int-if: Add enum_framesizes and enum_frameintervals ioctls.
  V4L/DVB (9322): v4l2-int-if: Export more interfaces to modules
  V4L/DVB (9321): v4l2-int-if: Define new power state changes
  V4L/DVB (9320): v4l2: Add 10-bit RAW Bayer formats
  V4L/DVB (9319): v4l2-int-if: Add cropcap, g_crop and s_crop commands.
  V4L/DVB (9318): v4l2-int-if: Add command to get slave private data.
  V4L/DVB (9316): s5h1411: Power down s5h1411 when not in use
  V4L/DVB (9315): s5h1411: Skip reconfiguring demod modulation if already at the desired modulation
  ...
  • Loading branch information
Linus Torvalds committed Oct 23, 2008
2 parents b14ea38 + becd430 commit 296e1ce
Show file tree
Hide file tree
Showing 58 changed files with 495 additions and 362 deletions.
4 changes: 2 additions & 2 deletions drivers/media/common/saa7146_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,11 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
if( VFL_TYPE_GRABBER == type ) {
vv->video_minor = vfd->minor;
INFO(("%s: registered device video%d [v4l2]\n",
dev->name, vfd->minor & 0x1f));
dev->name, vfd->num));
} else {
vv->vbi_minor = vfd->minor;
INFO(("%s: registered device vbi%d [v4l2]\n",
dev->name, vfd->minor & 0x1f));
dev->name, vfd->num));
}

*vid = vfd;
Expand Down
12 changes: 9 additions & 3 deletions drivers/media/common/saa7146_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
* copying is done already, arg is a kernel pointer.
*/

int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg)
static int __saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg)
{
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
Expand Down Expand Up @@ -1215,12 +1215,18 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
}
#endif
default:
return v4l_compat_translate_ioctl(inode,file,cmd,arg,
saa7146_video_do_ioctl);
return v4l_compat_translate_ioctl(file, cmd, arg,
__saa7146_video_do_ioctl);
}
return 0;
}

int saa7146_video_do_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)
{
return __saa7146_video_do_ioctl(file, cmd, arg);
}

/*********************************************************************************/
/* buffer handling functions */

Expand Down
84 changes: 58 additions & 26 deletions drivers/media/dvb/frontends/s5h1411.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct s5h1411_state {
struct dvb_frontend frontend;

fe_modulation_t current_modulation;
unsigned int first_tune:1;

u32 current_frequency;
int if_freq;
Expand All @@ -62,7 +63,7 @@ static struct init_tab {
{ S5H1411_I2C_TOP_ADDR, 0x08, 0x0047, },
{ S5H1411_I2C_TOP_ADDR, 0x1c, 0x0400, },
{ S5H1411_I2C_TOP_ADDR, 0x1e, 0x0370, },
{ S5H1411_I2C_TOP_ADDR, 0x1f, 0x342a, },
{ S5H1411_I2C_TOP_ADDR, 0x1f, 0x342c, },
{ S5H1411_I2C_TOP_ADDR, 0x24, 0x0231, },
{ S5H1411_I2C_TOP_ADDR, 0x25, 0x1011, },
{ S5H1411_I2C_TOP_ADDR, 0x26, 0x0f07, },
Expand Down Expand Up @@ -100,7 +101,6 @@ static struct init_tab {
{ S5H1411_I2C_TOP_ADDR, 0x78, 0x3141, },
{ S5H1411_I2C_TOP_ADDR, 0x7a, 0x3141, },
{ S5H1411_I2C_TOP_ADDR, 0xb3, 0x8003, },
{ S5H1411_I2C_TOP_ADDR, 0xb5, 0xafbb, },
{ S5H1411_I2C_TOP_ADDR, 0xb5, 0xa6bb, },
{ S5H1411_I2C_TOP_ADDR, 0xb6, 0x0609, },
{ S5H1411_I2C_TOP_ADDR, 0xb7, 0x2f06, },
Expand Down Expand Up @@ -393,7 +393,7 @@ static int s5h1411_set_if_freq(struct dvb_frontend *fe, int KHz)

switch (KHz) {
case 3250:
s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x10d9);
s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x10d5);
s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x39, 0x5342);
s5h1411_writereg(state, S5H1411_I2C_QAM_ADDR, 0x2c, 0x10d9);
break;
Expand Down Expand Up @@ -464,20 +464,38 @@ static int s5h1411_set_spectralinversion(struct dvb_frontend *fe, int inversion)

if (inversion == 1)
val |= 0x1000; /* Inverted */
else
val |= 0x0000;

state->inversion = inversion;
return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x24, val);
}

static int s5h1411_set_serialmode(struct dvb_frontend *fe, int serial)
{
struct s5h1411_state *state = fe->demodulator_priv;
u16 val;

dprintk("%s(%d)\n", __func__, serial);
val = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xbd) & ~0x100;

if (serial == 1)
val |= 0x100;

return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, val);
}

static int s5h1411_enable_modulation(struct dvb_frontend *fe,
fe_modulation_t m)
{
struct s5h1411_state *state = fe->demodulator_priv;

dprintk("%s(0x%08x)\n", __func__, m);

if ((state->first_tune == 0) && (m == state->current_modulation)) {
dprintk("%s() Already at desired modulation. Skipping...\n",
__func__);
return 0;
}

switch (m) {
case VSB_8:
dprintk("%s() VSB_8\n", __func__);
Expand All @@ -502,6 +520,7 @@ static int s5h1411_enable_modulation(struct dvb_frontend *fe,
}

state->current_modulation = m;
state->first_tune = 0;
s5h1411_softreset(fe);

return 0;
Expand Down Expand Up @@ -535,7 +554,7 @@ static int s5h1411_set_gpio(struct dvb_frontend *fe, int enable)
return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xe0, val);
}

static int s5h1411_sleep(struct dvb_frontend *fe, int enable)
static int s5h1411_set_powerstate(struct dvb_frontend *fe, int enable)
{
struct s5h1411_state *state = fe->demodulator_priv;

Expand All @@ -551,6 +570,11 @@ static int s5h1411_sleep(struct dvb_frontend *fe, int enable)
return 0;
}

static int s5h1411_sleep(struct dvb_frontend *fe)
{
return s5h1411_set_powerstate(fe, 1);
}

static int s5h1411_register_reset(struct dvb_frontend *fe)
{
struct s5h1411_state *state = fe->demodulator_priv;
Expand All @@ -574,9 +598,6 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe,

s5h1411_enable_modulation(fe, p->u.vsb.modulation);

/* Allow the demod to settle */
msleep(100);

if (fe->ops.tuner_ops.set_params) {
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
Expand All @@ -587,6 +608,10 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe,
fe->ops.i2c_gate_ctrl(fe, 0);
}

/* Issue a reset to the demod so it knows to resync against the
newly tuned frequency */
s5h1411_softreset(fe);

return 0;
}

Expand All @@ -599,7 +624,7 @@ static int s5h1411_init(struct dvb_frontend *fe)

dprintk("%s()\n", __func__);

s5h1411_sleep(fe, 0);
s5h1411_set_powerstate(fe, 0);
s5h1411_register_reset(fe);

for (i = 0; i < ARRAY_SIZE(init_tab); i++)
Expand All @@ -610,12 +635,17 @@ static int s5h1411_init(struct dvb_frontend *fe)
/* The datasheet says that after initialisation, VSB is default */
state->current_modulation = VSB_8;

/* Although the datasheet says it's in VSB, empirical evidence
shows problems getting lock on the first tuning request. Make
sure we call enable_modulation the first time around */
state->first_tune = 1;

if (state->config->output_mode == S5H1411_SERIAL_OUTPUT)
/* Serial */
s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1101);
s5h1411_set_serialmode(fe, 1);
else
/* Parallel */
s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1001);
s5h1411_set_serialmode(fe, 0);

s5h1411_set_spectralinversion(fe, state->config->inversion);
s5h1411_set_if_freq(fe, state->config->vsb_if);
Expand All @@ -637,28 +667,29 @@ static int s5h1411_read_status(struct dvb_frontend *fe, fe_status_t *status)

*status = 0;

/* Get the demodulator status */
reg = (s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf2) >> 15)
& 0x0001;
if (reg)
*status |= FE_HAS_LOCK | FE_HAS_CARRIER | FE_HAS_SIGNAL;
/* Register F2 bit 15 = Master Lock, removed */

switch (state->current_modulation) {
case QAM_64:
case QAM_256:
reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf0);
if (reg & 0x100)
*status |= FE_HAS_VITERBI;
if (reg & 0x10)
*status |= FE_HAS_SYNC;
if (reg & 0x10) /* QAM FEC Lock */
*status |= FE_HAS_SYNC | FE_HAS_LOCK;
if (reg & 0x100) /* QAM EQ Lock */
*status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL;

break;
case VSB_8:
reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0x5e);
if (reg & 0x0001)
*status |= FE_HAS_SYNC;
reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf2);
if (reg & 0x1000)
*status |= FE_HAS_VITERBI;
if (reg & 0x1000) /* FEC Lock */
*status |= FE_HAS_SYNC | FE_HAS_LOCK;
if (reg & 0x2000) /* EQ Lock */
*status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL;

reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0x53);
if (reg & 0x1) /* AFC Lock */
*status |= FE_HAS_SIGNAL;

break;
default:
return -EINVAL;
Expand Down Expand Up @@ -863,6 +894,7 @@ static struct dvb_frontend_ops s5h1411_ops = {
},

.init = s5h1411_init,
.sleep = s5h1411_sleep,
.i2c_gate_ctrl = s5h1411_i2c_gate_ctrl,
.set_frontend = s5h1411_set_frontend,
.get_frontend = s5h1411_get_frontend,
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/dvb/frontends/s5h1411.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct s5h1411_config {
u16 mpeg_timing;

/* IF Freq for QAM and VSB in KHz */
#define S5H1411_IF_2500 2500
#define S5H1411_IF_3250 3250
#define S5H1411_IF_3500 3500
#define S5H1411_IF_4000 4000
#define S5H1411_IF_5380 5380
Expand Down
Loading

0 comments on commit 296e1ce

Please sign in to comment.