2 STV0900/0903 Multistandard Broadcast Frontend driver
3 Copyright (C) Manu Abraham <abraham.manu@gmail.com>
5 Copyright (C) ST Microelectronics
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef __STV090x_PRIV_H
23 #define __STV090x_PRIV_H
25 #include "dvb_frontend.h"
33 #define dprintk(__y, __z, format, arg...) do { \
35 if ((verbose > FE_ERROR) && (verbose > __y)) \
36 printk(KERN_ERR "%s: " format "\n", __func__ , ##arg); \
37 else if ((verbose > FE_NOTICE) && (verbose > __y)) \
38 printk(KERN_NOTICE "%s: " format "\n", __func__ , ##arg); \
39 else if ((verbose > FE_INFO) && (verbose > __y)) \
40 printk(KERN_INFO "%s: " format "\n", __func__ , ##arg); \
41 else if ((verbose > FE_DEBUG) && (verbose > __y)) \
42 printk(KERN_DEBUG "%s: " format "\n", __func__ , ##arg); \
45 printk(format, ##arg); \
49 #define STV090x_READ_DEMOD(__state, __reg) (( \
50 (__state)->demod == STV090x_DEMODULATOR_1) ? \
51 stv090x_read_reg(__state, STV090x_P2_##__reg) : \
52 stv090x_read_reg(__state, STV090x_P1_##__reg))
54 #define STV090x_WRITE_DEMOD(__state, __reg, __data) (( \
55 (__state)->demod == STV090x_DEMODULATOR_1) ? \
56 stv090x_write_reg(__state, STV090x_P2_##__reg, __data) :\
57 stv090x_write_reg(__state, STV090x_P1_##__reg, __data))
59 #define STV090x_ADDR_OFFST(__state, __x) (( \
60 (__state->demod) == STV090x_DEMODULATOR_1) ? \
65 #define STV090x_SETFIELD(mask, bitf, val) (mask = (mask & (~(((1 << STV090x_WIDTH_##bitf) - 1) <<\
66 STV090x_OFFST_##bitf))) | \
67 (val << STV090x_OFFST_##bitf))
69 #define STV090x_GETFIELD(val, bitf) ((val >> STV090x_OFFST_##bitf) & ((1 << STV090x_WIDTH_##bitf) - 1))
72 #define STV090x_SETFIELD_Px(mask, bitf, val) (mask = (mask & (~(((1 << STV090x_WIDTH_Px_##bitf) - 1) <<\
73 STV090x_OFFST_Px_##bitf))) | \
74 (val << STV090x_OFFST_Px_##bitf))
76 #define STV090x_GETFIELD_Px(val, bitf) ((val >> STV090x_OFFST_Px_##bitf) & ((1 << STV090x_WIDTH_Px_##bitf) - 1))
78 #define MAKEWORD16(__a, __b) (((__a) << 8) | (__b))
80 #define STV090x_SEARCH_AGC2_TH 700
82 enum stv090x_signal_state {
103 enum stv090x_modulation {
121 enum stv090x_rolloff {
127 enum stv090x_inversion {
133 enum stv090x_modcod {
134 STV090x_DUMMY_PLF = 0,
163 STV090x_MODCODE_UNKNOWN
166 enum stv090x_search {
167 STV090x_SEARCH_DSS = 0,
168 STV090x_SEARCH_DVBS1,
169 STV090x_SEARCH_DVBS2,
174 STV090x_BLIND_SEARCH,
179 enum stv090x_delsys {
186 struct stv090x_long_frame_crloop {
187 enum stv090x_modcod modcod;
194 u8 crl_pilots_off_10;
196 u8 crl_pilots_off_20;
198 u8 crl_pilots_off_30;
201 struct stv090x_short_frame_crloop {
202 enum stv090x_modulation modulation;
204 u8 crl_cut12_2; /* Cut 1.2, SR <= 3M */
205 u8 crl_cut20_2; /* Cut 2.0, SR < 3M */
206 u8 crl_cut12_5; /* Cut 1.2, 3 < SR <= 7M */
207 u8 crl_cut20_5; /* Cut 2.0, 3 < SR <= 7M */
208 u8 crl_cut12_10; /* Cut 1.2, 7 < SR <= 15M */
209 u8 crl_cut20_10; /* Cut 2.0, 7 < SR <= 15M */
210 u8 crl_cut12_20; /* Cut 1.2, 10 < SR <= 25M */
211 u8 crl_cut20_20; /* Cut 2.0, 10 < SR <= 25M */
212 u8 crl_cut12_30; /* Cut 1.2, 25 < SR <= 45M */
213 u8 crl_cut20_30; /* Cut 2.0, 10 < SR <= 45M */
217 struct stv090x_short_frame_vsmod_crloop {
218 enum stv090x_modulation modulation;
221 u8 crl_5; /* 3 < SR <= 7M */
222 u8 crl_10; /* 7 < SR <= 15M */
223 u8 crl_20; /* 10 < SR <= 25M */
224 u8 crl_30; /* 10 < SR <= 45M */
237 struct stv090x_state {
238 enum stv090x_device device;
239 enum stv090x_demodulator demod;
240 enum stv090x_mode demod_mode;
243 struct i2c_adapter *i2c;
244 const struct stv090x_config *config;
245 struct dvb_frontend frontend;
247 u32 *verbose; /* Cached module verbosity */
249 enum stv090x_delsys delsys;
250 enum stv090x_fec fec;
251 enum stv090x_modulation modulation;
252 enum stv090x_modcod modcod;
253 enum stv090x_search search_mode;
254 enum stv090x_frame frame_len;
255 enum stv090x_pilot pilots;
256 enum stv090x_rolloff rolloff;
257 enum stv090x_inversion inversion;
258 enum stv090x_algo algo;
263 s32 mclk; /* Masterclock Divider factor */
274 #endif /* __STV090x_PRIV_H */