From: Stefan Ringel <stefan.ringel@xxxxxxxx> Signed-off-by: Stefan Ringel <stefan.ringel@xxxxxxxx> diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c index 8c61271..9716d7e 100644 --- a/drivers/media/dvb/frontends/zl10353.c +++ b/drivers/media/dvb/frontends/zl10353.c @@ -74,7 +74,7 @@ static int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen) return 0; } -static int zl10353_read_register(struct zl10353_state *state, u8 reg) +static int zl10353_read1_register(struct zl10353_state *state, u8 reg) { int ret; u8 b0[1] = { reg }; @@ -97,6 +97,41 @@ static int zl10353_read_register(struct zl10353_state *state, u8 reg) return b1[0]; } +static int zl10353_read2_register(struct zl10353_state *state, u8 reg) +{ + int ret; + u8 b0[1] = { reg - 1 }; + u8 b1[1] = { 0 }; + struct i2c_msg msg[2] = { { .addr = state->config.demod_address, + .flags = 0, + .buf = b0, .len = 1 }, + { .addr = state->config.demod_address, + .flags = I2C_M_RD, + .buf = b1, .len = 2 } }; + + ret = i2c_transfer(state->i2c, msg, 2); + + if (ret != 2) { + printk("%s: readreg error (reg=%d, ret==%i)\n", + __func__, reg, ret); + return ret; + } + + return b1[1]; +} + +static int zl10353_read_register(struct zl10353_state *state, u8 reg) +{ + int ret; + + if ((state->i2c->id == I2C_HW_B_TM6000) && (reg % 2 == 0)) + ret = zl10353_read2_register(state, reg); + else + ret = zl10353_read1_register(state, reg); + + return ret; +} + static void zl10353_dump_regs(struct dvb_frontend *fe) { struct zl10353_state *state = fe->demodulator_priv; -- 1.6.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html