4 * Driver for ST STV0367 DVB-T & DVB-C demodulator IC.
6 * Copyright (C) ST Microelectronics.
7 * Copyright (C) 2010,2011 NetUP Inc.
8 * Copyright (C) 2010,2011 Igor M. Liplianin <liplianin@netup.ru>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 /* Common driver error constants */
23 #ifndef STV0367_PRIV_H
24 #define STV0367_PRIV_H
37 /* MACRO definitions */
38 #define ABS(X) ((X) < 0 ? (-1 * (X)) : (X))
39 #define MAX(X, Y) ((X) >= (Y) ? (X) : (Y))
40 #define MIN(X, Y) ((X) <= (Y) ? (X) : (Y))
41 #define INRANGE(X, Y, Z) \
42 ((((X) <= (Y)) && ((Y) <= (Z))) || \
43 (((Z) <= (Y)) && ((Y) <= (X))) ? 1 : 0)
46 #define MAKEWORD(X, Y) (((X) << 8) + (Y))
49 #define LSB(X) (((X) & 0xff))
50 #define MSB(Y) (((Y) >> 8) & 0xff)
51 #define MMSB(Y)(((Y) >> 16) & 0xff)
53 enum stv0367_ter_signal_type
{
60 FE_TER_PRFOUNDOK
= 10,
61 FE_TER_NOPRFOUND
= 11,
70 enum stv0367_ts_mode
{
71 STV0367_OUTPUTMODE_DEFAULT
,
72 STV0367_SERIAL_PUNCT_CLOCK
,
73 STV0367_SERIAL_CONT_CLOCK
,
74 STV0367_PARALLEL_PUNCT_CLOCK
,
78 enum stv0367_clk_pol
{
79 STV0367_CLOCKPOLARITY_DEFAULT
,
80 STV0367_RISINGEDGE_CLOCK
,
81 STV0367_FALLINGEDGE_CLOCK
85 FE_TER_CHAN_BW_6M
= 6,
86 FE_TER_CHAN_BW_7M
= 7,
91 enum FE_TER_Rate_TPS
{
100 enum stv0367_ter_mode
{
106 enum FE_TER_Hierarchy_Alpha
{
107 FE_TER_HIER_ALPHA_NONE
, /* Regular modulation */
108 FE_TER_HIER_ALPHA_1
, /* Hierarchical modulation a = 1*/
109 FE_TER_HIER_ALPHA_2
, /* Hierarchical modulation a = 2*/
110 FE_TER_HIER_ALPHA_4
/* Hierarchical modulation a = 4*/
113 enum stv0367_ter_hierarchy
{
114 FE_TER_HIER_NONE
, /*Hierarchy None*/
115 FE_TER_HIER_LOW_PRIO
, /*Hierarchy : Low Priority*/
116 FE_TER_HIER_HIGH_PRIO
, /*Hierarchy : High Priority*/
117 FE_TER_HIER_PRIO_ANY
/*Hierarchy :Any*/
121 enum fe_stv0367_ter_spec
{
122 FE_TER_INVERSION_NONE
= 0,
123 FE_TER_INVERSION
= 1,
124 FE_TER_INVERSION_AUTO
= 2,
125 FE_TER_INVERSION_UNK
= 4
129 enum stv0367_ter_if_iq_mode
{
130 FE_TER_NORMAL_IF_TUNER
= 0,
131 FE_TER_LONGPATH_IF_TUNER
= 1,
137 enum FE_TER_FECRate
{
138 FE_TER_FEC_NONE
= 0x00, /* no FEC rate specified */
139 FE_TER_FEC_ALL
= 0xFF, /* Logical OR of all FECs */
141 FE_TER_FEC_2_3
= (1 << 1),
142 FE_TER_FEC_3_4
= (1 << 2),
143 FE_TER_FEC_4_5
= (1 << 3),
144 FE_TER_FEC_5_6
= (1 << 4),
145 FE_TER_FEC_6_7
= (1 << 5),
146 FE_TER_FEC_7_8
= (1 << 6),
147 FE_TER_FEC_8_9
= (1 << 7)
160 enum stv0367_ter_force
{
161 FE_TER_FORCENONE
= 0,
165 enum stv0367cab_mod
{
177 FE_CAB_FEC_A
= 1, /* J83 Annex A */
178 FE_CAB_FEC_B
= (1 << 1),/* J83 Annex B */
179 FE_CAB_FEC_C
= (1 << 2) /* J83 Annex C */
182 struct stv0367_cab_signal_info
{
184 u32 frequency
; /* kHz */
185 u32 symbol_rate
; /* Mbds */
186 enum stv0367cab_mod modulation
;
187 enum fe_spectral_inversion spect_inv
;
188 s32 Power_dBmx10
; /* Power of the RF signal (dBm x 10) */
189 u32 CN_dBx10
; /* Carrier to noise ratio (dB x 10) */
190 u32 BER
; /* Bit error rate (x 10000000) */
193 enum stv0367_cab_signal_type
{