18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * gp8psk_fe driver
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef GP8PSK_FE_H
78c2ecf20Sopenharmony_ci#define GP8PSK_FE_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/types.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* gp8psk commands */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define GET_8PSK_CONFIG                 0x80    /* in */
148c2ecf20Sopenharmony_ci#define SET_8PSK_CONFIG                 0x81
158c2ecf20Sopenharmony_ci#define I2C_WRITE			0x83
168c2ecf20Sopenharmony_ci#define I2C_READ			0x84
178c2ecf20Sopenharmony_ci#define ARM_TRANSFER                    0x85
188c2ecf20Sopenharmony_ci#define TUNE_8PSK                       0x86
198c2ecf20Sopenharmony_ci#define GET_SIGNAL_STRENGTH             0x87    /* in */
208c2ecf20Sopenharmony_ci#define LOAD_BCM4500                    0x88
218c2ecf20Sopenharmony_ci#define BOOT_8PSK                       0x89    /* in */
228c2ecf20Sopenharmony_ci#define START_INTERSIL                  0x8A    /* in */
238c2ecf20Sopenharmony_ci#define SET_LNB_VOLTAGE                 0x8B
248c2ecf20Sopenharmony_ci#define SET_22KHZ_TONE                  0x8C
258c2ecf20Sopenharmony_ci#define SEND_DISEQC_COMMAND             0x8D
268c2ecf20Sopenharmony_ci#define SET_DVB_MODE                    0x8E
278c2ecf20Sopenharmony_ci#define SET_DN_SWITCH                   0x8F
288c2ecf20Sopenharmony_ci#define GET_SIGNAL_LOCK                 0x90    /* in */
298c2ecf20Sopenharmony_ci#define GET_FW_VERS			0x92
308c2ecf20Sopenharmony_ci#define GET_SERIAL_NUMBER               0x93    /* in */
318c2ecf20Sopenharmony_ci#define USE_EXTRA_VOLT                  0x94
328c2ecf20Sopenharmony_ci#define GET_FPGA_VERS			0x95
338c2ecf20Sopenharmony_ci#define CW3K_INIT			0x9d
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* PSK_configuration bits */
368c2ecf20Sopenharmony_ci#define bm8pskStarted                   0x01
378c2ecf20Sopenharmony_ci#define bm8pskFW_Loaded                 0x02
388c2ecf20Sopenharmony_ci#define bmIntersilOn                    0x04
398c2ecf20Sopenharmony_ci#define bmDVBmode                       0x08
408c2ecf20Sopenharmony_ci#define bm22kHz                         0x10
418c2ecf20Sopenharmony_ci#define bmSEL18V                        0x20
428c2ecf20Sopenharmony_ci#define bmDCtuned                       0x40
438c2ecf20Sopenharmony_ci#define bmArmed                         0x80
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* Satellite modulation modes */
468c2ecf20Sopenharmony_ci#define ADV_MOD_DVB_QPSK 0     /* DVB-S QPSK */
478c2ecf20Sopenharmony_ci#define ADV_MOD_TURBO_QPSK 1   /* Turbo QPSK */
488c2ecf20Sopenharmony_ci#define ADV_MOD_TURBO_8PSK 2   /* Turbo 8PSK (also used for Trellis 8PSK) */
498c2ecf20Sopenharmony_ci#define ADV_MOD_TURBO_16QAM 3  /* Turbo 16QAM (also used for Trellis 8PSK) */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define ADV_MOD_DCII_C_QPSK 4  /* Digicipher II Combo */
528c2ecf20Sopenharmony_ci#define ADV_MOD_DCII_I_QPSK 5  /* Digicipher II I-stream */
538c2ecf20Sopenharmony_ci#define ADV_MOD_DCII_Q_QPSK 6  /* Digicipher II Q-stream */
548c2ecf20Sopenharmony_ci#define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */
558c2ecf20Sopenharmony_ci#define ADV_MOD_DSS_QPSK 8     /* DSS (DIRECTV) QPSK */
568c2ecf20Sopenharmony_ci#define ADV_MOD_DVB_BPSK 9     /* DVB-S BPSK */
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* firmware revision id's */
598c2ecf20Sopenharmony_ci#define GP8PSK_FW_REV1			0x020604
608c2ecf20Sopenharmony_ci#define GP8PSK_FW_REV2			0x020704
618c2ecf20Sopenharmony_ci#define GP8PSK_FW_VERS(_fw_vers) \
628c2ecf20Sopenharmony_ci	((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0])
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistruct gp8psk_fe_ops {
658c2ecf20Sopenharmony_ci	int (*in)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen);
668c2ecf20Sopenharmony_ci	int (*out)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen);
678c2ecf20Sopenharmony_ci	int (*reload)(void *priv);
688c2ecf20Sopenharmony_ci};
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cistruct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops,
718c2ecf20Sopenharmony_ci				      void *priv, bool is_rev1);
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#endif
74