summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/cx24116.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/cx24116.c')
-rw-r--r--drivers/media/dvb/frontends/cx24116.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c
index cf1ec6c8204..26e65a66719 100644
--- a/drivers/media/dvb/frontends/cx24116.c
+++ b/drivers/media/dvb/frontends/cx24116.c
@@ -566,7 +566,7 @@ static int cx24116_load_firmware(struct dvb_frontend *fe,
{
struct cx24116_state *state = fe->demodulator_priv;
struct cx24116_cmd cmd;
- int i, ret;
+ int i, ret, len, remaining;
unsigned char vers[4];
dprintk("%s\n", __func__);
@@ -603,8 +603,19 @@ static int cx24116_load_firmware(struct dvb_frontend *fe,
cx24116_writereg(state, 0xF5, 0x00);
cx24116_writereg(state, 0xF6, 0x00);
- /* write the entire firmware as one transaction */
- cx24116_writeregN(state, 0xF7, fw->data, fw->size);
+ /* Split firmware to the max I2C write len and write.
+ * This overflows 16 bit intentionally in order to get max write
+ * len when i2c_wr_max is set to 0. */
+ for (remaining = fw->size; remaining > 0;
+ remaining -= (u16) (state->config->i2c_wr_max - 1)) {
+
+ len = remaining;
+ if (len > (u16) (state->config->i2c_wr_max - 1))
+ len = (u16) (state->config->i2c_wr_max - 1);
+
+ cx24116_writeregN(state, 0xF7, &fw->data[fw->size - remaining],
+ len);
+ }
cx24116_writereg(state, 0xF4, 0x10);
cx24116_writereg(state, 0xF0, 0x00);