diff options
author | Thomas Kaiser <linux-dvb AT kaiser-linux.li> | 2006-04-27 20:45:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:59:46 -0400 |
commit | b8d4c235d50f8512bbc9d67730c24da3309b0307 (patch) | |
tree | 9af461a3b198bfd6856ab510044363b34a7d7be4 /drivers/media/dvb/frontends/stv0297.c | |
parent | 21c2858235a81ce4fa1862432eb0c98d8dbdee1e (diff) |
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: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/stv0297.c')
-rw-r--r-- | drivers/media/dvb/frontends/stv0297.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index c8c3b74f9958..98b95a205fd2 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -68,19 +68,25 @@ static int stv0297_readreg(struct stv0297_state *state, u8 reg) | |||
68 | int ret; | 68 | int ret; |
69 | u8 b0[] = { reg }; | 69 | u8 b0[] = { reg }; |
70 | u8 b1[] = { 0 }; | 70 | u8 b1[] = { 0 }; |
71 | struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf = b0,.len = | 71 | struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf = b0,.len = 1}, |
72 | 1}, | 72 | {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b1,.len = 1} |
73 | {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b1,.len = 1} | 73 | }; |
74 | }; | ||
75 | 74 | ||
76 | // this device needs a STOP between the register and data | 75 | // this device needs a STOP between the register and data |
77 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { | 76 | if (state->config->stop_during_read) { |
78 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); | 77 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { |
79 | return -1; | 78 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); |
80 | } | 79 | return -1; |
81 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { | 80 | } |
82 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); | 81 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { |
83 | return -1; | 82 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); |
83 | return -1; | ||
84 | } | ||
85 | } else { | ||
86 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { | ||
87 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); | ||
88 | return -1; | ||
89 | } | ||
84 | } | 90 | } |
85 | 91 | ||
86 | return b1[0]; | 92 | return b1[0]; |
@@ -107,13 +113,20 @@ static int stv0297_readregs(struct stv0297_state *state, u8 reg1, u8 * b, u8 len | |||
107 | }; | 113 | }; |
108 | 114 | ||
109 | // this device needs a STOP between the register and data | 115 | // this device needs a STOP between the register and data |
110 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { | 116 | if (state->config->stop_during_read) { |
111 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); | 117 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { |
112 | return -1; | 118 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); |
113 | } | 119 | return -1; |
114 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { | 120 | } |
115 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); | 121 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { |
116 | return -1; | 122 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); |
123 | return -1; | ||
124 | } | ||
125 | } else { | ||
126 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { | ||
127 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); | ||
128 | return -1; | ||
129 | } | ||
117 | } | 130 | } |
118 | 131 | ||
119 | return 0; | 132 | return 0; |