79 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef _DVB_USB_M920X_H_3#define _DVB_USB_M920X_H_4 5#define DVB_USB_LOG_PREFIX "m920x"6#include "dvb-usb.h"7 8#define deb(args...) dprintk(dvb_usb_m920x_debug,0x01,args)9 10#define M9206_CORE 0x2211#define M9206_RC_STATE 0xff5112#define M9206_RC_KEY 0xff5213#define M9206_RC_INIT1 0xff5414#define M9206_RC_INIT2 0xff5515#define M9206_FW_GO 0xff6916 17#define M9206_I2C 0x2318#define M9206_FILTER 0x2519#define M9206_FW 0x3020 21#define M9206_MAX_FILTERS 822#define M9206_MAX_ADAPTERS 423 24/*25sequences found in logs:26[index value]270x80 write addr28(0x00 out byte)*290x40 out byte30 310x80 write addr32(0x00 out byte)*330x80 read addr34(0x21 in byte)*350x60 in byte36 37this sequence works:380x80 read addr39(0x21 in byte)*400x60 in byte41 42Guess at API of the I2C function:43I2C operation is done one byte at a time with USB control messages. The44index the messages is sent to is made up of a set of flags that control45the I2C bus state:460x80: Send START condition. After a START condition, one would normally47 always send the 7-bit slave I2C address as the 7 MSB, followed by48 the read/write bit as the LSB.490x40: Send STOP condition. This should be set on the last byte of an50 I2C transaction.510x20: Read a byte from the slave. As opposed to writing a byte to the52 slave. The slave will normally not produce any data unless you53 set the R/W bit to 1 when sending the slave's address after the54 START condition.550x01: Respond with ACK, as opposed to a NACK. For a multi-byte read,56 the master should send an ACK, that is pull SDA low during the 9th57 clock cycle, after every byte but the last. This flags only makes58 sense when bit 0x20 is set, indicating a read.59 60What any other bits might mean, or how to get the slave's ACK/NACK61response to a write, is unknown.62*/63 64struct m920x_state {65 u16 filters[M9206_MAX_ADAPTERS][M9206_MAX_FILTERS];66 int filtering_enabled[M9206_MAX_ADAPTERS];67 int rep_count;68};69 70/* Initialisation data for the m920x71 */72 73struct m920x_inits {74 u16 address;75 u8 data;76};77 78#endif79