diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-03-05 21:55:00 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:44:42 -0400 |
commit | d40860f8e2edb31196f4233d3691704d313dbdd6 (patch) | |
tree | 033a5354d255a7090aadbf1c134a392aaf6409bc /drivers/media/dvb/dvb-usb/m920x.h | |
parent | 634bc48da766a9817e55e7dbd9909a6b26567e92 (diff) |
V4L/DVB (5427): M920x: Improve I2C operations
Write some better documentation about what might be known about how the
m920x I2C works, since a datasheet is lacking.
The I2C xfer function should now handle more types of I2C transactions
than it could before. Those it can't, will return error codes instead of
being executed incorrectly. Multi-byte reads were not being done
correctly, which should be fixed.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/m920x.h')
-rw-r--r-- | drivers/media/dvb/dvb-usb/m920x.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.h b/drivers/media/dvb/dvb-usb/m920x.h index c5ef592cbfee..7dd3db65c80e 100644 --- a/drivers/media/dvb/dvb-usb/m920x.h +++ b/drivers/media/dvb/dvb-usb/m920x.h | |||
@@ -37,13 +37,27 @@ this sequence works: | |||
37 | (0x21 in byte)* | 37 | (0x21 in byte)* |
38 | 0x60 in byte | 38 | 0x60 in byte |
39 | 39 | ||
40 | _my guess_: | 40 | Guess at API of the I2C function: |
41 | 0x80: begin i2c transfer using address. value=address<<1|(reading?1:0) | 41 | I2C operation is done one byte at a time with USB control messages. The |
42 | 0x00: write byte | 42 | index the messages is sent to is made up of a set of flags that control |
43 | 0x21: read byte, more to follow | 43 | the I2C bus state: |
44 | 0x40: write last byte of message sequence | 44 | 0x80: Send START condition. After a START condition, one would normally |
45 | 0x60: read last byte of message sequence | 45 | always send the 7-bit slave I2C address as the 7 MSB, followed by |
46 | */ | 46 | the read/write bit as the LSB. |
47 | 0x40: Send STOP condition. This should be set on the last byte of an | ||
48 | I2C transaction. | ||
49 | 0x20: Read a byte from the slave. As opposed to writing a byte to the | ||
50 | slave. The slave will normally not produce any data unless you | ||
51 | set the R/W bit to 1 when sending the slave's address after the | ||
52 | START condition. | ||
53 | 0x01: Respond with ACK, as opposed to a NACK. For a multi-byte read, | ||
54 | the master should send an ACK, that is pull SDA low during the 9th | ||
55 | clock cycle, after every byte but the last. This flags only makes | ||
56 | sense when bit 0x20 is set, indicating a read. | ||
57 | |||
58 | What any other bits might mean, or how to get the slave's ACK/NACK | ||
59 | response to a write, is unknown. | ||
60 | */ | ||
47 | 61 | ||
48 | struct m9206_state { | 62 | struct m9206_state { |
49 | u16 filters[M9206_MAX_FILTERS]; | 63 | u16 filters[M9206_MAX_FILTERS]; |