2 * $Id: dvb-pll.c,v 1.7 2005/02/10 11:52:02 kraxel Exp $
4 * descriptions + helper functions for simple dvb plls.
6 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <linux/module.h>
24 #include <linux/dvb/frontend.h>
25 #include <asm/types.h>
29 /* ----------------------------------------------------------- */
32 struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
33 .name = "Thomson dtt7579",
38 { 0, 36166667, 166666, 0xb4, 0x03 }, /* go sleep */
39 { 443250000, 36166667, 166666, 0xb4, 0x02 },
40 { 542000000, 36166667, 166666, 0xb4, 0x08 },
41 { 771000000, 36166667, 166666, 0xbc, 0x08 },
42 { 999999999, 36166667, 166666, 0xf4, 0x08 },
45 EXPORT_SYMBOL(dvb_pll_thomson_dtt7579);
47 struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {
48 .name = "Thomson dtt7610",
53 { 157250000, 44000000, 62500, 0x8e, 0x39 },
54 { 454000000, 44000000, 62500, 0x8e, 0x3a },
55 { 999999999, 44000000, 62500, 0x8e, 0x3c },
58 EXPORT_SYMBOL(dvb_pll_thomson_dtt7610);
60 static void thomson_dtt759x_bw(u8 *buf, int bandwidth)
62 if (BANDWIDTH_7_MHZ == bandwidth)
66 struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
67 .name = "Thomson dtt759x",
70 .setbw = thomson_dtt759x_bw,
73 { 0, 36166667, 166666, 0x84, 0x03 },
74 { 264000000, 36166667, 166666, 0xb4, 0x02 },
75 { 470000000, 36166667, 166666, 0xbc, 0x02 },
76 { 735000000, 36166667, 166666, 0xbc, 0x08 },
77 { 835000000, 36166667, 166666, 0xf4, 0x08 },
78 { 999999999, 36166667, 166666, 0xfc, 0x08 },
81 EXPORT_SYMBOL(dvb_pll_thomson_dtt759x);
83 struct dvb_pll_desc dvb_pll_lg_z201 = {
89 { 0, 36166667, 166666, 0xbc, 0x03 },
90 { 443250000, 36166667, 166666, 0xbc, 0x01 },
91 { 542000000, 36166667, 166666, 0xbc, 0x02 },
92 { 830000000, 36166667, 166666, 0xf4, 0x02 },
93 { 999999999, 36166667, 166666, 0xfc, 0x02 },
96 EXPORT_SYMBOL(dvb_pll_lg_z201);
98 struct dvb_pll_desc dvb_pll_unknown_1 = {
99 .name = "unknown 1", /* used by dntv live dvb-t */
104 { 150000000, 36166667, 166666, 0xb4, 0x01 },
105 { 173000000, 36166667, 166666, 0xbc, 0x01 },
106 { 250000000, 36166667, 166666, 0xb4, 0x02 },
107 { 400000000, 36166667, 166666, 0xbc, 0x02 },
108 { 420000000, 36166667, 166666, 0xf4, 0x02 },
109 { 470000000, 36166667, 166666, 0xfc, 0x02 },
110 { 600000000, 36166667, 166666, 0xbc, 0x08 },
111 { 730000000, 36166667, 166666, 0xf4, 0x08 },
112 { 999999999, 36166667, 166666, 0xfc, 0x08 },
115 EXPORT_SYMBOL(dvb_pll_unknown_1);
117 /* ----------------------------------------------------------- */
120 static int debug = 0;
121 module_param(debug, int, 0644);
122 MODULE_PARM_DESC(debug, "enable verbose debug messages");
124 int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
125 u32 freq, int bandwidth)
130 if (freq != 0 && (freq < desc->min || freq > desc->max))
133 for (i = 0; i < desc->count; i++) {
134 if (freq > desc->entries[i].limit)
139 printk("pll: %s: freq=%d bw=%d | i=%d/%d\n",
140 desc->name, freq, bandwidth, i, desc->count);
141 BUG_ON(i == desc->count);
143 div = (freq + desc->entries[i].offset) / desc->entries[i].stepsize;
146 buf[2] = desc->entries[i].cb1;
147 buf[3] = desc->entries[i].cb2;
150 desc->setbw(buf, bandwidth);
153 printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
154 desc->name, div, buf[0], buf[1], buf[2], buf[3]);
158 EXPORT_SYMBOL(dvb_pll_configure);
160 MODULE_DESCRIPTION("dvb pll library");
161 MODULE_AUTHOR("Gerd Knorr");
162 MODULE_LICENSE("GPL");