]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/media/tuners/e4000_priv.h
8f45a300f688e8558b6f93a8113872f2846324ad
[karo-tx-linux.git] / drivers / media / tuners / e4000_priv.h
1 /*
2  * Elonics E4000 silicon tuner driver
3  *
4  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
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 along
17  *    with this program; if not, write to the Free Software Foundation, Inc.,
18  *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef E4000_PRIV_H
22 #define E4000_PRIV_H
23
24 #include "e4000.h"
25
26 struct e4000_priv {
27         struct i2c_client *client;
28         u32 clock;
29         struct dvb_frontend *fe;
30 };
31
32 struct e4000_pll {
33         u32 freq;
34         u8 div;
35         u8 mul;
36 };
37
38 static const struct e4000_pll e4000_pll_lut[] = {
39 /*                                      VCO min    VCO max */
40         {   72400000, 0x0f, 48 }, /* .......... 3475200000 */
41         {   81200000, 0x0e, 40 }, /* 2896000000 3248000000 */
42         {  108300000, 0x0d, 32 }, /* 2598400000 3465600000 */
43         {  162500000, 0x0c, 24 }, /* 2599200000 3900000000 */
44         {  216600000, 0x0b, 16 }, /* 2600000000 3465600000 */
45         {  325000000, 0x0a, 12 }, /* 2599200000 3900000000 */
46         {  350000000, 0x09,  8 }, /* 2600000000 2800000000 */
47         {  432000000, 0x03,  8 }, /* 2800000000 3456000000 */
48         {  667000000, 0x02,  6 }, /* 2592000000 4002000000 */
49         { 1200000000, 0x01,  4 }, /* 2668000000 4800000000 */
50         { 0xffffffff, 0x00,  2 }, /* 2400000000 .......... */
51 };
52
53 struct e4000_lna_filter {
54         u32 freq;
55         u8 val;
56 };
57
58 static const struct e4000_lna_filter e400_lna_filter_lut[] = {
59         {  370000000,  0 },
60         {  392500000,  1 },
61         {  415000000,  2 },
62         {  437500000,  3 },
63         {  462500000,  4 },
64         {  490000000,  5 },
65         {  522500000,  6 },
66         {  557500000,  7 },
67         {  595000000,  8 },
68         {  642500000,  9 },
69         {  695000000, 10 },
70         {  740000000, 11 },
71         {  800000000, 12 },
72         {  865000000, 13 },
73         {  930000000, 14 },
74         { 1000000000, 15 },
75         { 1310000000,  0 },
76         { 1340000000,  1 },
77         { 1385000000,  2 },
78         { 1427500000,  3 },
79         { 1452500000,  4 },
80         { 1475000000,  5 },
81         { 1510000000,  6 },
82         { 1545000000,  7 },
83         { 1575000000,  8 },
84         { 1615000000,  9 },
85         { 1650000000, 10 },
86         { 1670000000, 11 },
87         { 1690000000, 12 },
88         { 1710000000, 13 },
89         { 1735000000, 14 },
90         { 0xffffffff, 15 },
91 };
92
93 struct e4000_band {
94         u32 freq;
95         u8 reg07_val;
96         u8 reg78_val;
97 };
98
99 static const struct e4000_band e4000_band_lut[] = {
100         {  140000000, 0x01, 0x03 },
101         {  350000000, 0x03, 0x03 },
102         { 1000000000, 0x05, 0x03 },
103         { 0xffffffff, 0x07, 0x00 },
104 };
105
106 struct e4000_if_filter {
107         u32 freq;
108         u8 reg11_val;
109         u8 reg12_val;
110 };
111
112 static const struct e4000_if_filter e4000_if_filter_lut[] = {
113         {    4300000, 0xfd, 0x1f },
114         {    4400000, 0xfd, 0x1e },
115         {    4480000, 0xfc, 0x1d },
116         {    4560000, 0xfc, 0x1c },
117         {    4600000, 0xfc, 0x1b },
118         {    4800000, 0xfc, 0x1a },
119         {    4900000, 0xfc, 0x19 },
120         {    5000000, 0xfc, 0x18 },
121         {    5100000, 0xfc, 0x17 },
122         {    5200000, 0xfc, 0x16 },
123         {    5400000, 0xfc, 0x15 },
124         {    5500000, 0xfc, 0x14 },
125         {    5600000, 0xfc, 0x13 },
126         {    5800000, 0xfb, 0x12 },
127         {    5900000, 0xfb, 0x11 },
128         {    6000000, 0xfb, 0x10 },
129         {    6200000, 0xfb, 0x0f },
130         {    6400000, 0xfa, 0x0e },
131         {    6600000, 0xfa, 0x0d },
132         {    6800000, 0xf9, 0x0c },
133         {    7200000, 0xf9, 0x0b },
134         {    7400000, 0xf9, 0x0a },
135         {    7600000, 0xf8, 0x09 },
136         {    7800000, 0xf8, 0x08 },
137         {    8200000, 0xf8, 0x07 },
138         {    8600000, 0xf7, 0x06 },
139         {    8800000, 0xf7, 0x05 },
140         {    9200000, 0xf7, 0x04 },
141         {    9600000, 0xf6, 0x03 },
142         {   10000000, 0xf6, 0x02 },
143         {   10600000, 0xf5, 0x01 },
144         {   11000000, 0xf5, 0x00 },
145         { 0xffffffff, 0x00, 0x20 },
146 };
147
148 #endif