Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / media / dvb-frontends / stv090x.h
blob89f45d9fa4278126ebe600074261f72034196605
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 STV0900/0903 Multistandard Broadcast Frontend driver
4 Copyright (C) Manu Abraham <abraham.manu@gmail.com>
6 Copyright (C) ST Microelectronics
8 */
10 #ifndef __STV090x_H
11 #define __STV090x_H
13 enum stv090x_demodulator {
14 STV090x_DEMODULATOR_0 = 1,
15 STV090x_DEMODULATOR_1
18 enum stv090x_device {
19 STV0903 = 0,
20 STV0900,
23 enum stv090x_mode {
24 STV090x_DUAL = 0,
25 STV090x_SINGLE
28 enum stv090x_tsmode {
29 STV090x_TSMODE_SERIAL_PUNCTURED = 1,
30 STV090x_TSMODE_SERIAL_CONTINUOUS,
31 STV090x_TSMODE_PARALLEL_PUNCTURED,
32 STV090x_TSMODE_DVBCI
35 enum stv090x_clkmode {
36 STV090x_CLK_INT = 0, /* Clk i/p = CLKI */
37 STV090x_CLK_EXT = 2 /* Clk i/p = XTALI */
40 enum stv090x_i2crpt {
41 STV090x_RPTLEVEL_256 = 0,
42 STV090x_RPTLEVEL_128 = 1,
43 STV090x_RPTLEVEL_64 = 2,
44 STV090x_RPTLEVEL_32 = 3,
45 STV090x_RPTLEVEL_16 = 4,
46 STV090x_RPTLEVEL_8 = 5,
47 STV090x_RPTLEVEL_4 = 6,
48 STV090x_RPTLEVEL_2 = 7,
51 enum stv090x_adc_range {
52 STV090x_ADC_2Vpp = 0,
53 STV090x_ADC_1Vpp = 1
56 struct stv090x_config {
57 enum stv090x_device device;
58 enum stv090x_mode demod_mode;
59 enum stv090x_clkmode clk_mode;
60 enum stv090x_demodulator demod;
62 u32 xtal; /* default: 8000000 */
63 u8 address; /* default: 0x68 */
65 u8 ts1_mode;
66 u8 ts2_mode;
67 u32 ts1_clk;
68 u32 ts2_clk;
70 u8 ts1_tei : 1;
71 u8 ts2_tei : 1;
73 enum stv090x_i2crpt repeater_level;
75 u8 tuner_bbgain; /* default: 10db */
76 enum stv090x_adc_range adc1_range; /* default: 2Vpp */
77 enum stv090x_adc_range adc2_range; /* default: 2Vpp */
79 bool diseqc_envelope_mode;
81 int (*tuner_init)(struct dvb_frontend *fe);
82 int (*tuner_sleep)(struct dvb_frontend *fe);
83 int (*tuner_set_mode)(struct dvb_frontend *fe, enum tuner_mode mode);
84 int (*tuner_set_frequency)(struct dvb_frontend *fe, u32 frequency);
85 int (*tuner_get_frequency)(struct dvb_frontend *fe, u32 *frequency);
86 int (*tuner_set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth);
87 int (*tuner_get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
88 int (*tuner_set_bbgain)(struct dvb_frontend *fe, u32 gain);
89 int (*tuner_get_bbgain)(struct dvb_frontend *fe, u32 *gain);
90 int (*tuner_set_refclk)(struct dvb_frontend *fe, u32 refclk);
91 int (*tuner_get_status)(struct dvb_frontend *fe, u32 *status);
92 void (*tuner_i2c_lock)(struct dvb_frontend *fe, int lock);
94 /* dir = 0 -> output, dir = 1 -> input/open-drain */
95 int (*set_gpio)(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value,
96 u8 xor_value);
98 struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *i2c);
101 #if IS_REACHABLE(CONFIG_DVB_STV090x)
103 struct dvb_frontend *stv090x_attach(struct stv090x_config *config,
104 struct i2c_adapter *i2c,
105 enum stv090x_demodulator demod);
107 #else
109 static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
110 struct i2c_adapter *i2c,
111 enum stv090x_demodulator demod)
113 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
114 return NULL;
117 #endif /* CONFIG_DVB_STV090x */
119 #endif /* __STV090x_H */