diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2008-03-29 19:49:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:56 -0400 |
commit | 6394cf53abc0b3a2db9e8b947ef5c77b16861ec8 (patch) | |
tree | 6d442ab2e89d17ef963ee840ba50440e225f30cb /drivers/media/dvb/b2c2/flexcop-usb.c | |
parent | 0b5afdd2ea5f52d260d1e42d43fb0fa09ec0da2f (diff) |
V4L/DVB (7469): Preparation for supporting new devices, cleanup and saneness
To prepare the support for new device to the flexcop-family some preparation and cleanups was done + some saneness:
- created an i2c-adapter for each i2c-port available. Easier usage for devices with several device on different i2c-busses
- initialize i2c before doing the eeprom read
- changed the way to attach the different frontends, easier to read now
- enabled support for i2c-devices having no register address (1-byte access)
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/b2c2/flexcop-usb.c')
-rw-r--r-- | drivers/media/dvb/b2c2/flexcop-usb.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c index 87fb75f0d1cf..449fb5c3d0b1 100644 --- a/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/drivers/media/dvb/b2c2/flexcop-usb.c | |||
@@ -211,10 +211,11 @@ static int flexcop_usb_utility_req(struct flexcop_usb *fc_usb, int set, | |||
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | /* usb i2c stuff */ | 213 | /* usb i2c stuff */ |
214 | static int flexcop_usb_i2c_req(struct flexcop_usb *fc_usb, | 214 | static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
215 | flexcop_usb_request_t req, flexcop_usb_i2c_function_t func, | 215 | flexcop_usb_request_t req, flexcop_usb_i2c_function_t func, |
216 | flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u8 buflen) | 216 | u8 chipaddr, u8 addr, u8 *buf, u8 buflen) |
217 | { | 217 | { |
218 | struct flexcop_usb *fc_usb = i2c->fc->bus_specific; | ||
218 | u16 wValue, wIndex; | 219 | u16 wValue, wIndex; |
219 | int nWaitTime,pipe,len; | 220 | int nWaitTime,pipe,len; |
220 | // u8 dwRequestType; | 221 | // u8 dwRequestType; |
@@ -242,7 +243,7 @@ static int flexcop_usb_i2c_req(struct flexcop_usb *fc_usb, | |||
242 | deb_info("unsupported function for i2c_req %x\n",func); | 243 | deb_info("unsupported function for i2c_req %x\n",func); |
243 | return -EINVAL; | 244 | return -EINVAL; |
244 | } | 245 | } |
245 | wValue = (func << 8 ) | (port << 4); | 246 | wValue = (func << 8) | (i2c->port << 4); |
246 | wIndex = (chipaddr << 8 ) | addr; | 247 | wIndex = (chipaddr << 8 ) | addr; |
247 | 248 | ||
248 | deb_i2c("i2c %2d: %02x %02x %02x %02x %02x %02x\n",func,request_type,req, | 249 | deb_i2c("i2c %2d: %02x %02x %02x %02x %02x %02x\n",func,request_type,req, |
@@ -274,13 +275,15 @@ static int flexcop_usb_write_ibi_reg(struct flexcop_device *fc, flexcop_ibi_regi | |||
274 | return flexcop_usb_readwrite_dw(fc,reg, &val.raw, 0); | 275 | return flexcop_usb_readwrite_dw(fc,reg, &val.raw, 0); |
275 | } | 276 | } |
276 | 277 | ||
277 | static int flexcop_usb_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op, | 278 | static int flexcop_usb_i2c_request(struct flexcop_i2c_adapter *i2c, |
278 | flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u16 len) | 279 | flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len) |
279 | { | 280 | { |
280 | if (op == FC_READ) | 281 | if (op == FC_READ) |
281 | return flexcop_usb_i2c_req(fc->bus_specific,B2C2_USB_I2C_REQUEST,USB_FUNC_I2C_READ,port,chipaddr,addr,buf,len); | 282 | return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST, |
283 | USB_FUNC_I2C_READ, chipaddr, addr, buf, len); | ||
282 | else | 284 | else |
283 | return flexcop_usb_i2c_req(fc->bus_specific,B2C2_USB_I2C_REQUEST,USB_FUNC_I2C_WRITE,port,chipaddr,addr,buf,len); | 285 | return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST, |
286 | USB_FUNC_I2C_WRITE, chipaddr, addr, buf, len); | ||
284 | } | 287 | } |
285 | 288 | ||
286 | static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, u8 *buffer, int buffer_length) | 289 | static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, u8 *buffer, int buffer_length) |