Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 296e1ce0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* '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
  ...
parents b14ea38e becd4305
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
+9 −3
Original line number Diff line number Diff line
@@ -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;
@@ -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                                                  */

+58 −26
Original line number Diff line number Diff line
@@ -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;
@@ -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, },
@@ -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, },
@@ -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;
@@ -464,13 +464,25 @@ 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)
{
@@ -478,6 +490,12 @@ static int s5h1411_enable_modulation(struct dvb_frontend *fe,

	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__);
@@ -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;
@@ -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;

@@ -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;
@@ -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);
@@ -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;
}

@@ -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++)
@@ -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);
@@ -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;
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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
+37 −25
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static int vidioc_querycap(struct file *file, void *priv,
{
	strlcpy(v->driver, "dsbr100", sizeof(v->driver));
	strlcpy(v->card, "D-Link R-100 USB FM Radio", sizeof(v->card));
	sprintf(v->bus_info, "ISA");
	sprintf(v->bus_info, "USB");
	v->version = RADIO_VERSION;
	v->capabilities = V4L2_CAP_TUNER;
	return 0;
@@ -331,8 +331,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,

	for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
		if (qc->id && qc->id == radio_qctrl[i].id) {
			memcpy(qc, &(radio_qctrl[i]),
						sizeof(*qc));
			memcpy(qc, &(radio_qctrl[i]), sizeof(*qc));
			return 0;
		}
	}
@@ -412,6 +411,7 @@ static int vidioc_s_audio(struct file *file, void *priv,
static int usb_dsbr100_open(struct inode *inode, struct file *file)
{
	struct dsbr100_device *radio = video_drvdata(file);
	int retval;

	lock_kernel();
	radio->users = 1;
@@ -424,7 +424,12 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file)
		unlock_kernel();
		return -EIO;
	}
	dsbr100_setfreq(radio, radio->curfreq);

	retval = dsbr100_setfreq(radio, radio->curfreq);

	if (retval == -1)
		printk(KERN_WARNING KBUILD_MODNAME ": Set frequency failed\n");

	unlock_kernel();
	return 0;
}
@@ -485,13 +490,20 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
{
	struct dsbr100_device *radio;

	if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL)))
	radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL);

	if (!radio)
		return -ENOMEM;
	if (!(radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL))) {

	radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL);

	if (!(radio->transfer_buffer)) {
		kfree(radio);
		return -ENOMEM;
	}
	if (!(radio->videodev = video_device_alloc())) {
	radio->videodev = video_device_alloc();

	if (!(radio->videodev)) {
		kfree(radio->transfer_buffer);
		kfree(radio);
		return -ENOMEM;
Loading