18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _DVB_USB_DIGITV_H_
38c2ecf20Sopenharmony_ci#define _DVB_USB_DIGITV_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define DVB_USB_LOG_PREFIX "digitv"
68c2ecf20Sopenharmony_ci#include "dvb-usb.h"
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cistruct digitv_state {
98c2ecf20Sopenharmony_ci	int is_nxt6000;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci	unsigned char sndbuf[7];
128c2ecf20Sopenharmony_ci	unsigned char rcvbuf[7];
138c2ecf20Sopenharmony_ci};
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/* protocol (from usblogging and the SDK:
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * Always 7 bytes bulk message(s) for controlling
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * First byte describes the command. Reads are 2 consecutive transfer (as always).
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci * General structure:
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * write or first message of a read:
248c2ecf20Sopenharmony_ci * <cmdbyte> VV <len> B0 B1 B2 B3
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * second message of a read
278c2ecf20Sopenharmony_ci * <cmdbyte> VV <len> R0 R1 R2 R3
288c2ecf20Sopenharmony_ci *
298c2ecf20Sopenharmony_ci * whereas 0 < len <= 4
308c2ecf20Sopenharmony_ci *
318c2ecf20Sopenharmony_ci * I2C address is stored somewhere inside the device.
328c2ecf20Sopenharmony_ci *
338c2ecf20Sopenharmony_ci * 0x01 read from EEPROM
348c2ecf20Sopenharmony_ci *  VV = offset; B* = 0; R* = value(s)
358c2ecf20Sopenharmony_ci *
368c2ecf20Sopenharmony_ci * 0x02 read register of the COFDM
378c2ecf20Sopenharmony_ci *  VV = register; B* = 0; R* = value(s)
388c2ecf20Sopenharmony_ci *
398c2ecf20Sopenharmony_ci * 0x05 write register of the COFDM
408c2ecf20Sopenharmony_ci *  VV = register; B* = value(s);
418c2ecf20Sopenharmony_ci *
428c2ecf20Sopenharmony_ci * 0x06 write to the tuner (only for NXT6000)
438c2ecf20Sopenharmony_ci *  VV = 0; B* = PLL data; len = 4;
448c2ecf20Sopenharmony_ci *
458c2ecf20Sopenharmony_ci * 0x03 read remote control
468c2ecf20Sopenharmony_ci *  VV = 0; B* = 0; len = 4; R* = key
478c2ecf20Sopenharmony_ci *
488c2ecf20Sopenharmony_ci * 0x07 write to the remote (don't know why one should this, resetting ?)
498c2ecf20Sopenharmony_ci *  VV = 0; B* = key; len = 4;
508c2ecf20Sopenharmony_ci *
518c2ecf20Sopenharmony_ci * 0x08 write remote type
528c2ecf20Sopenharmony_ci *  VV = 0; B[0] = 0x01, len = 4
538c2ecf20Sopenharmony_ci *
548c2ecf20Sopenharmony_ci * 0x09 write device init
558c2ecf20Sopenharmony_ci *  TODO
568c2ecf20Sopenharmony_ci */
578c2ecf20Sopenharmony_ci#define USB_READ_EEPROM         1
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define USB_READ_COFDM          2
608c2ecf20Sopenharmony_ci#define USB_WRITE_COFDM         5
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define USB_WRITE_TUNER         6
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define USB_READ_REMOTE         3
658c2ecf20Sopenharmony_ci#define USB_WRITE_REMOTE        7
668c2ecf20Sopenharmony_ci#define USB_WRITE_REMOTE_TYPE   8
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define USB_DEV_INIT            9
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#endif
71