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