blob: 80b66a695261dfc7af4194f4803caee1cb44a939 [file] [log] [blame]
Steve Tothb79cb652006-01-09 15:25:07 -02001/*
2 Conexant cx24123/cx24109 - DVB QPSK Satellite demod/tuner driver
3
4 Copyright (C) 2005 Steven Toth <stoth@hauppauge.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef CX24123_H
22#define CX24123_H
23
24#include <linux/dvb/frontend.h>
25
26struct cx24123_config
27{
28 /* the demodulator's i2c address */
29 u8 demod_address;
30
31 /* PLL maintenance */
32 int (*pll_init)(struct dvb_frontend* fe);
33 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
34
35 /* Need to set device param for start_dma */
36 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
37};
38
39/* Various tuner defaults need to be established for a given symbol rate Sps */
40struct
41{
42 u32 symbolrate_low;
43 u32 symbolrate_high;
44 u32 VCAslope;
45 u32 VCAoffset;
46 u32 VGA1offset;
47 u32 VGA2offset;
48 u32 VCAprogdata;
49 u32 VGAprogdata;
50} cx24123_AGC_vals[] =
51{
52 {
53 .symbolrate_low = 1000000,
54 .symbolrate_high = 4999999,
55 .VCAslope = 0x07,
56 .VCAoffset = 0x0f,
57 .VGA1offset = 0x1f8,
58 .VGA2offset = 0x1f8,
59 .VGAprogdata = (2 << 18) | (0x1f8 << 9) | 0x1f8,
60 .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x07,
61 },
62 {
63 .symbolrate_low = 5000000,
64 .symbolrate_high = 14999999,
65 .VCAslope = 0x1f,
66 .VCAoffset = 0x1f,
67 .VGA1offset = 0x1e0,
68 .VGA2offset = 0x180,
69 .VGAprogdata = (2 << 18) | (0x180 << 9) | 0x1e0,
70 .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x1f,
71 },
72 {
73 .symbolrate_low = 15000000,
74 .symbolrate_high = 45000000,
75 .VCAslope = 0x3f,
76 .VCAoffset = 0x3f,
77 .VGA1offset = 0x180,
78 .VGA2offset = 0x100,
79 .VGAprogdata = (2 << 18) | (0x100 << 9) | 0x180,
80 .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x3f,
81 },
82};
83
84/*
85 * Various tuner defaults need to be established for a given frequency kHz.
86 * fixme: The bounds on the bands do not match the doc in real life.
87 * fixme: Some of them have been moved, other might need adjustment.
88 */
89struct
90{
91 u32 freq_low;
92 u32 freq_high;
93 u32 bandselect;
94 u32 VCOdivider;
95 u32 VCOnumber;
96 u32 progdata;
97} cx24123_bandselect_vals[] =
98{
99 {
100 .freq_low = 950000,
101 .freq_high = 1018999,
102 .bandselect = 0x40,
103 .VCOdivider = 4,
104 .VCOnumber = 7,
105 .progdata = (0 << 18) | (0 << 9) | 0x40,
106 },
107 {
108 .freq_low = 1019000,
109 .freq_high = 1074999,
110 .bandselect = 0x80,
111 .VCOdivider = 4,
112 .VCOnumber = 8,
113 .progdata = (0 << 18) | (0 << 9) | 0x80,
114 },
115 {
116 .freq_low = 1075000,
117 .freq_high = 1227999,
118 .bandselect = 0x01,
119 .VCOdivider = 2,
120 .VCOnumber = 1,
121 .progdata = (0 << 18) | (1 << 9) | 0x01,
122 },
123 {
124 .freq_low = 1228000,
125 .freq_high = 1349999,
126 .bandselect = 0x02,
127 .VCOdivider = 2,
128 .VCOnumber = 2,
129 .progdata = (0 << 18) | (1 << 9) | 0x02,
130 },
131 {
132 .freq_low = 1350000,
133 .freq_high = 1481999,
134 .bandselect = 0x04,
135 .VCOdivider = 2,
136 .VCOnumber = 3,
137 .progdata = (0 << 18) | (1 << 9) | 0x04,
138 },
139 {
140 .freq_low = 1482000,
141 .freq_high = 1595999,
142 .bandselect = 0x08,
143 .VCOdivider = 2,
144 .VCOnumber = 4,
145 .progdata = (0 << 18) | (1 << 9) | 0x08,
146 },
147 {
148 .freq_low = 1596000,
149 .freq_high = 1717999,
150 .bandselect = 0x10,
151 .VCOdivider = 2,
152 .VCOnumber = 5,
153 .progdata = (0 << 18) | (1 << 9) | 0x10,
154 },
155 {
156 .freq_low = 1718000,
157 .freq_high = 1855999,
158 .bandselect = 0x20,
159 .VCOdivider = 2,
160 .VCOnumber = 6,
161 .progdata = (0 << 18) | (1 << 9) | 0x20,
162 },
163 {
164 .freq_low = 1856000,
165 .freq_high = 2035999,
166 .bandselect = 0x40,
167 .VCOdivider = 2,
168 .VCOnumber = 7,
169 .progdata = (0 << 18) | (1 << 9) | 0x40,
170 },
171 {
172 .freq_low = 2036000,
173 .freq_high = 2149999,
174 .bandselect = 0x80,
175 .VCOdivider = 2,
176 .VCOnumber = 8,
177 .progdata = (0 << 18) | (1 << 9) | 0x80,
178 },
179};
180
181extern struct dvb_frontend* cx24123_attach(const struct cx24123_config* config,
182 struct i2c_adapter* i2c);
183
184#endif /* CX24123_H */
185