Commit fa74aca3 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx-i2c: fix coding style of multi line comments

Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d230d5ad
...@@ -171,8 +171,10 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, ...@@ -171,8 +171,10 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
if (len < 1 || len > 64) if (len < 1 || len > 64)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* NOTE: limited by the USB ctrl message constraints /*
* Zero length reads always succeed, even if no device is connected */ * NOTE: limited by the USB ctrl message constraints
* Zero length reads always succeed, even if no device is connected
*/
/* Write to i2c device */ /* Write to i2c device */
ret = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); ret = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len);
...@@ -202,9 +204,11 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, ...@@ -202,9 +204,11 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
return ret; return ret;
} }
msleep(5); msleep(5);
/* NOTE: do we really have to wait for success ? /*
Never seen anything else than 0x00 or 0x10 * NOTE: do we really have to wait for success ?
(even with high payload) ... */ * Never seen anything else than 0x00 or 0x10
* (even with high payload) ...
*/
} }
em28xx_warn("write to i2c device at 0x%x timed out\n", addr); em28xx_warn("write to i2c device at 0x%x timed out\n", addr);
return -EIO; return -EIO;
...@@ -220,8 +224,10 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) ...@@ -220,8 +224,10 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
if (len < 1 || len > 64) if (len < 1 || len > 64)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* NOTE: limited by the USB ctrl message constraints /*
* Zero length reads always succeed, even if no device is connected */ * NOTE: limited by the USB ctrl message constraints
* Zero length reads always succeed, even if no device is connected
*/
/* Read data from i2c device */ /* Read data from i2c device */
ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len); ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len);
...@@ -230,7 +236,8 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) ...@@ -230,7 +236,8 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
addr, ret); addr, ret);
return ret; return ret;
} }
/* NOTE: some devices with two i2c busses have the bad habit to return 0 /*
* NOTE: some devices with two i2c busses have the bad habit to return 0
* bytes if we are on bus B AND there was no write attempt to the * bytes if we are on bus B AND there was no write attempt to the
* specified slave address before AND no device is present at the * specified slave address before AND no device is present at the
* requested slave address. * requested slave address.
...@@ -366,9 +373,10 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -366,9 +373,10 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
return num; return num;
} }
/* based on linux/sunrpc/svcauth.h and linux/hash.h /*
* based on linux/sunrpc/svcauth.h and linux/hash.h
* The original hash function returns a different value, if arch is x86_64 * The original hash function returns a different value, if arch is x86_64
* or i386. * or i386.
*/ */
static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits) static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits)
{ {
...@@ -391,8 +399,10 @@ static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits) ...@@ -391,8 +399,10 @@ static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits)
return (hash >> (32 - bits)) & 0xffffffffUL; return (hash >> (32 - bits)) & 0xffffffffUL;
} }
/* Helper function to read data blocks from i2c clients with 8 or 16 bit /*
* address width, 8 bit register width and auto incrementation been activated */ * Helper function to read data blocks from i2c clients with 8 or 16 bit
* address width, 8 bit register width and auto incrementation been activated
*/
static int em28xx_i2c_read_block(struct em28xx *dev, unsigned bus, u16 addr, static int em28xx_i2c_read_block(struct em28xx *dev, unsigned bus, u16 addr,
bool addr_w16, u16 len, u8 *data) bool addr_w16, u16 len, u8 *data)
{ {
...@@ -434,9 +444,11 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, ...@@ -434,9 +444,11 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
u8 **eedata, u16 *eedata_len) u8 **eedata, u16 *eedata_len)
{ {
const u16 len = 256; const u16 len = 256;
/* FIXME common length/size for bytes to read, to display, hash /*
* FIXME common length/size for bytes to read, to display, hash
* calculation and returned device dataset. Simplifies the code a lot, * calculation and returned device dataset. Simplifies the code a lot,
* but we might have to deal with multiple sizes in the future ! */ * but we might have to deal with multiple sizes in the future !
*/
int i, err; int i, err;
struct em28xx_eeprom *dev_config; struct em28xx_eeprom *dev_config;
u8 buf, *data; u8 buf, *data;
...@@ -497,7 +509,8 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, ...@@ -497,7 +509,8 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
em28xx_info("EEPROM info:\n"); em28xx_info("EEPROM info:\n");
em28xx_info("\tmicrocode start address = 0x%04x, boot configuration = 0x%02x\n", em28xx_info("\tmicrocode start address = 0x%04x, boot configuration = 0x%02x\n",
mc_start, data[2]); mc_start, data[2]);
/* boot configuration (address 0x0002): /*
* boot configuration (address 0x0002):
* [0] microcode download speed: 1 = 400 kHz; 0 = 100 kHz * [0] microcode download speed: 1 = 400 kHz; 0 = 100 kHz
* [1] always selects 12 kb RAM * [1] always selects 12 kb RAM
* [2] USB device speed: 1 = force Full Speed; 0 = auto detect * [2] USB device speed: 1 = force Full Speed; 0 = auto detect
...@@ -506,8 +519,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, ...@@ -506,8 +519,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
* characterization * characterization
*/ */
/* Read hardware config dataset offset from address /*
* (microcode start + 46) */ * Read hardware config dataset offset from address
* (microcode start + 46)
*/
err = em28xx_i2c_read_block(dev, bus, mc_start + 46, 1, 2, err = em28xx_i2c_read_block(dev, bus, mc_start + 46, 1, 2,
data); data);
if (err != 2) { if (err != 2) {
...@@ -520,7 +535,8 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, ...@@ -520,7 +535,8 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
hwconf_offset = mc_start + data[0] + (data[1] << 8); hwconf_offset = mc_start + data[0] + (data[1] << 8);
/* Read hardware config dataset */ /* Read hardware config dataset */
/* NOTE: the microcode copy can be multiple pages long, but /*
* NOTE: the microcode copy can be multiple pages long, but
* we assume the hardware config dataset is the same as in * we assume the hardware config dataset is the same as in
* the old eeprom and not longer than 256 bytes. * the old eeprom and not longer than 256 bytes.
* tveeprom is currently also limited to 256 bytes. * tveeprom is currently also limited to 256 bytes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment