| Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 1 | #ifndef _DVB_USB_M920X_H_ | 
|  | 2 | #define _DVB_USB_M920X_H_ | 
| Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 3 |  | 
| Michael Krufky | baa2ed0 | 2006-09-23 20:01:29 -0300 | [diff] [blame] | 4 | #define DVB_USB_LOG_PREFIX "m920x" | 
| Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 5 | #include "dvb-usb.h" | 
|  | 6 |  | 
| Aapo Tahkola | bf2b4f6 | 2007-03-26 16:59:16 -0300 | [diff] [blame] | 7 | #define deb(args...)   dprintk(dvb_usb_m920x_debug,0x01,args) | 
| Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 8 |  | 
| Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 9 | #define M9206_CORE	0x22 | 
| Michael Krufky | 26f48ea | 2006-09-28 01:46:49 -0300 | [diff] [blame] | 10 | #define M9206_RC_STATE	0xff51 | 
|  | 11 | #define M9206_RC_KEY	0xff52 | 
|  | 12 | #define M9206_RC_INIT1	0xff54 | 
|  | 13 | #define M9206_RC_INIT2	0xff55 | 
|  | 14 | #define M9206_FW_GO	0xff69 | 
| Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 15 |  | 
|  | 16 | #define M9206_I2C	0x23 | 
|  | 17 | #define M9206_FILTER	0x25 | 
|  | 18 | #define M9206_FW	0x30 | 
|  | 19 |  | 
|  | 20 | #define M9206_MAX_FILTERS 8 | 
| Massimo Del Fedele | 3d36f5c | 2009-10-24 13:12:37 -0300 | [diff] [blame] | 21 | #define M9206_MAX_ADAPTERS 4 | 
| Aapo Tahkola | 84ad757 | 2007-01-21 15:57:20 -0300 | [diff] [blame] | 22 |  | 
| Aapo Tahkola | 2624701 | 2007-03-05 18:23:19 -0300 | [diff] [blame] | 23 | /* | 
|  | 24 | sequences found in logs: | 
|  | 25 | [index value] | 
|  | 26 | 0x80 write addr | 
|  | 27 | (0x00 out byte)* | 
|  | 28 | 0x40 out byte | 
|  | 29 |  | 
|  | 30 | 0x80 write addr | 
|  | 31 | (0x00 out byte)* | 
|  | 32 | 0x80 read addr | 
|  | 33 | (0x21 in byte)* | 
|  | 34 | 0x60 in byte | 
|  | 35 |  | 
|  | 36 | this sequence works: | 
|  | 37 | 0x80 read addr | 
|  | 38 | (0x21 in byte)* | 
|  | 39 | 0x60 in byte | 
|  | 40 |  | 
| Trent Piepho | d40860f | 2007-03-05 23:55:00 -0300 | [diff] [blame] | 41 | Guess at API of the I2C function: | 
|  | 42 | I2C operation is done one byte at a time with USB control messages.  The | 
|  | 43 | index the messages is sent to is made up of a set of flags that control | 
|  | 44 | the I2C bus state: | 
|  | 45 | 0x80:  Send START condition.  After a START condition, one would normally | 
|  | 46 | always send the 7-bit slave I2C address as the 7 MSB, followed by | 
|  | 47 | the read/write bit as the LSB. | 
|  | 48 | 0x40:  Send STOP condition.  This should be set on the last byte of an | 
|  | 49 | I2C transaction. | 
|  | 50 | 0x20:  Read a byte from the slave.  As opposed to writing a byte to the | 
|  | 51 | slave.  The slave will normally not produce any data unless you | 
|  | 52 | set the R/W bit to 1 when sending the slave's address after the | 
|  | 53 | START condition. | 
|  | 54 | 0x01:  Respond with ACK, as opposed to a NACK.  For a multi-byte read, | 
|  | 55 | the master should send an ACK, that is pull SDA low during the 9th | 
|  | 56 | clock cycle, after every byte but the last.  This flags only makes | 
|  | 57 | sense when bit 0x20 is set, indicating a read. | 
|  | 58 |  | 
|  | 59 | What any other bits might mean, or how to get the slave's ACK/NACK | 
|  | 60 | response to a write, is unknown. | 
|  | 61 | */ | 
| Aapo Tahkola | 84ad757 | 2007-01-21 15:57:20 -0300 | [diff] [blame] | 62 |  | 
| Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 63 | struct m920x_state { | 
| Aapo Tahkola | 47f8df0 | 2007-05-08 12:03:55 -0300 | [diff] [blame] | 64 | u16 filters[M9206_MAX_ADAPTERS][M9206_MAX_FILTERS]; | 
|  | 65 | int filtering_enabled[M9206_MAX_ADAPTERS]; | 
| Aapo Tahkola | e2adbecf7 | 2006-09-28 00:47:51 -0300 | [diff] [blame] | 66 | int rep_count; | 
|  | 67 | }; | 
| Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 68 |  | 
|  | 69 | /* Initialisation data for the m920x | 
|  | 70 | */ | 
|  | 71 |  | 
| Aapo Tahkola | 4fd74a7 | 2007-03-26 17:05:59 -0300 | [diff] [blame] | 72 | struct m920x_inits { | 
| Nick Andrew | aa50ec2 | 2007-03-22 17:09:35 -0300 | [diff] [blame] | 73 | u16 address; | 
|  | 74 | u8  data; | 
|  | 75 | }; | 
|  | 76 |  | 
| Aapo Tahkola | 5fecd9f | 2006-09-23 20:00:41 -0300 | [diff] [blame] | 77 | #endif |