From 6394cf53abc0b3a2db9e8b947ef5c77b16861ec8 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Sat, 29 Mar 2008 20:49:57 -0300 Subject: 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/b2c2/flexcop-usb.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb/b2c2/flexcop-usb.c') 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, #endif /* usb i2c stuff */ -static int flexcop_usb_i2c_req(struct flexcop_usb *fc_usb, +static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, flexcop_usb_request_t req, flexcop_usb_i2c_function_t func, - flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u8 buflen) + u8 chipaddr, u8 addr, u8 *buf, u8 buflen) { + struct flexcop_usb *fc_usb = i2c->fc->bus_specific; u16 wValue, wIndex; int nWaitTime,pipe,len; // u8 dwRequestType; @@ -242,7 +243,7 @@ static int flexcop_usb_i2c_req(struct flexcop_usb *fc_usb, deb_info("unsupported function for i2c_req %x\n",func); return -EINVAL; } - wValue = (func << 8 ) | (port << 4); + wValue = (func << 8) | (i2c->port << 4); wIndex = (chipaddr << 8 ) | addr; 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 return flexcop_usb_readwrite_dw(fc,reg, &val.raw, 0); } -static int flexcop_usb_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op, - flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u16 len) +static int flexcop_usb_i2c_request(struct flexcop_i2c_adapter *i2c, + flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len) { if (op == FC_READ) - return flexcop_usb_i2c_req(fc->bus_specific,B2C2_USB_I2C_REQUEST,USB_FUNC_I2C_READ,port,chipaddr,addr,buf,len); + return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST, + USB_FUNC_I2C_READ, chipaddr, addr, buf, len); else - return flexcop_usb_i2c_req(fc->bus_specific,B2C2_USB_I2C_REQUEST,USB_FUNC_I2C_WRITE,port,chipaddr,addr,buf,len); + return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST, + USB_FUNC_I2C_WRITE, chipaddr, addr, buf, len); } static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, u8 *buffer, int buffer_length) -- cgit v1.2.3