Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
stv090x_priv.h
Go to the documentation of this file.
1 /*
2  STV0900/0903 Multistandard Broadcast Frontend driver
3  Copyright (C) Manu Abraham <[email protected]>
4 
5  Copyright (C) ST Microelectronics
6 
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.
11 
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.
16 
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.
20 */
21 
22 #ifndef __STV090x_PRIV_H
23 #define __STV090x_PRIV_H
24 
25 #include "dvb_frontend.h"
26 
27 #define FE_ERROR 0
28 #define FE_NOTICE 1
29 #define FE_INFO 2
30 #define FE_DEBUG 3
31 #define FE_DEBUGREG 4
32 
33 #define dprintk(__y, __z, format, arg...) do { \
34  if (__z) { \
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); \
43  } else { \
44  if (verbose > __y) \
45  printk(format, ##arg); \
46  } \
47 } while (0)
48 
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))
53 
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))
58 
59 #define STV090x_ADDR_OFFST(__state, __x) (( \
60  (__state->demod) == STV090x_DEMODULATOR_1) ? \
61  STV090x_P1_##__x : \
62  STV090x_P2_##__x)
63 
64 
65 #define STV090x_SETFIELD(mask, bitf, val) (mask = (mask & (~(((1 << STV090x_WIDTH_##bitf) - 1) <<\
66  STV090x_OFFST_##bitf))) | \
67  (val << STV090x_OFFST_##bitf))
68 
69 #define STV090x_GETFIELD(val, bitf) ((val >> STV090x_OFFST_##bitf) & ((1 << STV090x_WIDTH_##bitf) - 1))
70 
71 
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))
75 
76 #define STV090x_GETFIELD_Px(val, bitf) ((val >> STV090x_OFFST_Px_##bitf) & ((1 << STV090x_WIDTH_Px_##bitf) - 1))
77 
78 #define MAKEWORD16(__a, __b) (((__a) << 8) | (__b))
79 
80 #define MSB(__x) ((__x >> 8) & 0xff)
81 #define LSB(__x) (__x & 0xff)
82 
83 
84 #define STV090x_IQPOWER_THRESHOLD 30
85 #define STV090x_SEARCH_AGC2_TH_CUT20 700
86 #define STV090x_SEARCH_AGC2_TH_CUT30 1400
87 
88 #define STV090x_SEARCH_AGC2_TH(__ver) \
89  ((__ver <= 0x20) ? \
90  STV090x_SEARCH_AGC2_TH_CUT20 : \
91  STV090x_SEARCH_AGC2_TH_CUT30)
92 
100 };
101 
113 };
114 
121 };
122 
126 };
127 
131 };
132 
137 };
138 
143 };
144 
176 };
177 
183 };
184 
189 };
190 
196 };
197 
200 
211 };
212 
215 
216  u8 crl_2; /* SR < 3M */
217  u8 crl_5; /* 3 < SR <= 7M */
218  u8 crl_10; /* 7 < SR <= 15M */
219  u8 crl_20; /* 10 < SR <= 25M */
220  u8 crl_30; /* 10 < SR <= 45M */
221 };
222 
223 struct stv090x_reg {
226 };
227 
228 struct stv090x_tab {
231 };
232 
236 
237  struct mutex demod_lock; /* Lock access to shared register */
238  struct mutex tuner_lock; /* Lock access to tuners */
239  s32 mclk; /* Masterclock Divider factor */
241 
242  int num_used;
243 };
244 
249  struct stv090x_internal *internal;
250 
251  struct i2c_adapter *i2c;
252  const struct stv090x_config *config;
254 
255  u32 *verbose; /* Cached module verbosity */
256 
267 
270 
272 
274 
277 };
278 
279 #endif /* __STV090x_PRIV_H */