V4L/DVB (5363): Dvb: Remove lgh06xf driver
[linux-2.6-block.git] / drivers / media / dvb / bt8xx / dst_common.h
CommitLineData
50b215a0
JS
1/*
2 Frontend-driver for TwinHan DST Frontend
3
4 Copyright (C) 2003 Jamie Honan
5 Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
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 DST_COMMON_H
23#define DST_COMMON_H
24
d28d5762 25#include <linux/smp_lock.h>
50b215a0
JS
26#include <linux/dvb/frontend.h>
27#include <linux/device.h>
3593cab5 28#include <linux/mutex.h>
50b215a0
JS
29#include "bt878.h"
30
31#include "dst_ca.h"
32
33
34#define NO_DELAY 0
35#define LONG_DELAY 1
36#define DEVICE_INIT 2
37
38#define DELAY 1
39
40#define DST_TYPE_IS_SAT 0
41#define DST_TYPE_IS_TERR 1
42#define DST_TYPE_IS_CABLE 2
43#define DST_TYPE_IS_ATSC 3
44
7ef53b1a 45#define DST_TYPE_HAS_TS188 1
50b215a0
JS
46#define DST_TYPE_HAS_TS204 2
47#define DST_TYPE_HAS_SYMDIV 4
48#define DST_TYPE_HAS_FW_1 8
49#define DST_TYPE_HAS_FW_2 16
50#define DST_TYPE_HAS_FW_3 32
8385e46f 51#define DST_TYPE_HAS_FW_BUILD 64
7d53421c
MA
52#define DST_TYPE_HAS_OBS_REGS 128
53#define DST_TYPE_HAS_INC_COUNT 256
29b2f784 54#define DST_TYPE_HAS_MULTI_FE 512
1da5e8d3 55#define DST_TYPE_HAS_NEWTUNE_2 1024
5aef20ae 56#define DST_TYPE_HAS_DBOARD 2048
cdd4208c 57#define DST_TYPE_HAS_VLF 4096
50b215a0 58
50b215a0
JS
59/* Card capability list */
60
61#define DST_TYPE_HAS_MAC 1
62#define DST_TYPE_HAS_DISEQC3 2
63#define DST_TYPE_HAS_DISEQC4 4
64#define DST_TYPE_HAS_DISEQC5 8
65#define DST_TYPE_HAS_MOTO 16
66#define DST_TYPE_HAS_CA 32
67#define DST_TYPE_HAS_ANALOG 64 /* Analog inputs */
4a2cc126 68#define DST_TYPE_HAS_SESSION 128
50b215a0 69
396cffd6 70#define TUNER_TYPE_MULTI 1
4e7024bd 71#define TUNER_TYPE_UNKNOWN 2
364f255a 72/* DVB-S */
4e7024bd
MA
73#define TUNER_TYPE_L64724 4
74#define TUNER_TYPE_STV0299 8
75#define TUNER_TYPE_MB86A15 16
76
77/* DVB-T */
78#define TUNER_TYPE_TDA10046 32
396cffd6 79
364f255a 80/* ATSC */
4e7024bd 81#define TUNER_TYPE_NXT200x 64
364f255a
MA
82
83
50b215a0
JS
84#define RDC_8820_PIO_0_DISABLE 0
85#define RDC_8820_PIO_0_ENABLE 1
86#define RDC_8820_INT 2
87#define RDC_8820_RESET 4
88
89/* DST Communication */
90#define GET_REPLY 1
91#define NO_REPLY 0
92
93#define GET_ACK 1
94#define FIXED_COMM 8
95
96#define ACK 0xff
97
98struct dst_state {
99
100 struct i2c_adapter* i2c;
101
102 struct bt878* bt;
103
50b215a0
JS
104 /* configuration settings */
105 const struct dst_config* config;
106
107 struct dvb_frontend frontend;
108
109 /* private ASIC data */
110 u8 tx_tuna[10];
111 u8 rx_tuna[10];
112 u8 rxbuffer[10];
113 u8 diseq_flags;
114 u8 dst_type;
115 u32 type_flags;
116 u32 frequency; /* intermediate frequency in kHz for QPSK */
117 fe_spectral_inversion_t inversion;
118 u32 symbol_rate; /* symbol rate in Symbols per second */
119 fe_code_rate_t fec;
120 fe_sec_voltage_t voltage;
121 fe_sec_tone_mode_t tone;
122 u32 decode_freq;
123 u8 decode_lock;
124 u16 decode_strength;
125 u16 decode_snr;
126 unsigned long cur_jiff;
127 u8 k22;
128 fe_bandwidth_t bandwidth;
4a2cc126 129 u32 dst_hw_cap;
50b215a0
JS
130 u8 dst_fw_version;
131 fe_sec_mini_cmd_t minicmd;
7d53421c 132 fe_modulation_t modulation;
50b215a0 133 u8 messages[256];
62121b1f
MA
134 u8 mac_address[8];
135 u8 fw_version[8];
136 u8 card_info[8];
137 u8 vendor[8];
29b2f784 138 u8 board_info[8];
396cffd6 139 u32 tuner_type;
b633c6d6 140 char *tuner_name;
3593cab5 141 struct mutex dst_mutex;
63ad4e44 142 u8 fw_name[8];
bbdd11fa 143 struct dvb_device *dst_ca;
50b215a0
JS
144};
145
b633c6d6
MA
146struct tuner_types {
147 u32 tuner_type;
148 char *tuner_name;
364f255a 149 char *board_name;
4e7024bd 150 char *fw_name;
b633c6d6
MA
151};
152
50b215a0
JS
153struct dst_types {
154 char *device_id;
155 int offset;
156 u8 dst_type;
4a2cc126
JS
157 u32 type_flags;
158 u32 dst_feature;
396cffd6 159 u32 tuner_type;
50b215a0
JS
160};
161
50b215a0
JS
162struct dst_config
163{
164 /* the ASIC i2c address */
165 u8 demod_address;
166};
167
50b215a0
JS
168int rdc_reset_state(struct dst_state *state);
169int rdc_8820_reset(struct dst_state *state);
170
171int dst_wait_dst_ready(struct dst_state *state, u8 delay_mode);
172int dst_pio_enable(struct dst_state *state);
173int dst_pio_disable(struct dst_state *state);
174int dst_error_recovery(struct dst_state* state);
175int dst_error_bailout(struct dst_state *state);
176int dst_comm_init(struct dst_state* state);
177
178int write_dst(struct dst_state *state, u8 * data, u8 len);
179int read_dst(struct dst_state *state, u8 * ret, u8 len);
180u8 dst_check_sum(u8 * buf, u32 len);
181struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter);
bbdd11fa 182struct dvb_device *dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter);
50b215a0
JS
183int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay);
184
185int dst_command(struct dst_state* state, u8 * data, u8 len);
186
187
188#endif // DST_COMMON_H