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

Commit b8d4c235 authored by Thomas Kaiser's avatar Thomas Kaiser Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (3934): Support new dvb-ttusb-budget boards with stv0297



Added config switch to stv0297 to control i2c STOP during write behaviour.
Update frontend init in dvb-ttusb-budget.
Enable i2c STOP on other users of stv0297.

Signed-off-by: Thomas Kaiser <linux-dvb AT kaiser-linux.li>
Signed-off-by: default avatarAndrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 21c28582
Loading
Loading
Loading
Loading
+31 −18
Original line number Diff line number Diff line
@@ -68,12 +68,12 @@ static int stv0297_readreg(struct stv0297_state *state, u8 reg)
	int ret;
	u8 b0[] = { reg };
	u8 b1[] = { 0 };
	struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf = b0,.len =
				  1},
	struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf = b0,.len = 1},
				 {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b1,.len = 1}
			       };

	// this device needs a STOP between the register and data
	if (state->config->stop_during_read) {
		if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) {
			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret);
			return -1;
@@ -82,6 +82,12 @@ static int stv0297_readreg(struct stv0297_state *state, u8 reg)
			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret);
			return -1;
		}
	} else {
		if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) {
			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret);
			return -1;
		}
	}

	return b1[0];
}
@@ -107,6 +113,7 @@ static int stv0297_readregs(struct stv0297_state *state, u8 reg1, u8 * b, u8 len
	};

	// this device needs a STOP between the register and data
	if (state->config->stop_during_read) {
		if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) {
			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret);
			return -1;
@@ -115,6 +122,12 @@ static int stv0297_readregs(struct stv0297_state *state, u8 reg1, u8 * b, u8 len
			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret);
			return -1;
		}
	} else {
		if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) {
			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret);
			return -1;
		}
	}

	return 0;
}
+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ struct stv0297_config

	/* does the "inversion" need inverted? */
	u8 invert:1;

	/* set to 1 if the device requires an i2c STOP during reading */
	u8 stop_during_read:1;
};

extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config,
+1 −0
Original line number Diff line number Diff line
@@ -1859,6 +1859,7 @@ static struct stv0297_config nexusca_stv0297_config = {
	.demod_address = 0x1C,
	.inittab = nexusca_stv0297_inittab,
	.invert = 1,
	.stop_during_read = 1,
};


+1 −0
Original line number Diff line number Diff line
@@ -977,6 +977,7 @@ static struct stv0297_config dvbc_philips_tdm1316l_config = {
	.demod_address = 0x1c,
	.inittab = dvbc_philips_tdm1316l_inittab,
	.invert = 0,
	.stop_during_read = 1,
};


+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ config DVB_TTUSB_BUDGET
	select DVB_VES1820
	select DVB_TDA8083
	select DVB_STV0299
	select DVB_STV0297
	select DVB_LNBP21
	help
	  Support for external USB adapters designed by Technotrend and
Loading