aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYeasah Pell <yeasah@schwide.net>2006-04-13 16:26:22 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-05-12 18:55:08 -0400
commit70047f9cca231126981f360c79cde98ea30410b2 (patch)
treeaabe74c0f39d3c05d2d315cee9d5c14f77d58300
parent0e4558ab4a89a127e0de36746552da9353e35f10 (diff)
V4L/DVB (3804): Tweak bandselect setup fox cx24123
*) Allow forcing the bandselect value with a module parameter to facilitate determining the correct bandselect frequencies. *) Changes the bandselect frequency thresholds based on experiments with the above parameter in conjunction with the values in the spec. Signed-off-by: Yeasah Pell <yeasah at schwide.net> Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/frontends/cx24123.c97
1 files changed, 60 insertions, 37 deletions
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index 2aac17451d75..691dc840dcc0 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -31,6 +31,7 @@
31 31
32#define XTAL 10111000 32#define XTAL 10111000
33 33
34static int force_band;
34static int debug; 35static int debug;
35#define dprintk(args...) \ 36#define dprintk(args...) \
36 do { \ 37 do { \
@@ -109,65 +110,76 @@ static struct
109 u32 progdata; 110 u32 progdata;
110} cx24123_bandselect_vals[] = 111} cx24123_bandselect_vals[] =
111{ 112{
113 /* band 1 */
112 { 114 {
113 .freq_low = 950000, 115 .freq_low = 950000,
114 .freq_high = 1018999,
115 .VCOdivider = 4,
116 .progdata = (0 << 18) | (0 << 9) | 0x40,
117 },
118 {
119 .freq_low = 1019000,
120 .freq_high = 1074999, 116 .freq_high = 1074999,
121 .VCOdivider = 4, 117 .VCOdivider = 4,
122 .progdata = (0 << 18) | (0 << 9) | 0x80, 118 .progdata = (0 << 19) | (0 << 9) | 0x40,
123 }, 119 },
120
121 /* band 2 */
124 { 122 {
125 .freq_low = 1075000, 123 .freq_low = 1075000,
126 .freq_high = 1227999, 124 .freq_high = 1177999,
127 .VCOdivider = 2, 125 .VCOdivider = 4,
128 .progdata = (0 << 18) | (1 << 9) | 0x01, 126 .progdata = (0 << 19) | (0 << 9) | 0x80,
129 }, 127 },
128
129 /* band 3 */
130 { 130 {
131 .freq_low = 1228000, 131 .freq_low = 1178000,
132 .freq_high = 1349999, 132 .freq_high = 1295999,
133 .VCOdivider = 2, 133 .VCOdivider = 2,
134 .progdata = (0 << 18) | (1 << 9) | 0x02, 134 .progdata = (0 << 19) | (1 << 9) | 0x01,
135 }, 135 },
136
137 /* band 4 */
136 { 138 {
137 .freq_low = 1350000, 139 .freq_low = 1296000,
138 .freq_high = 1481999, 140 .freq_high = 1431999,
139 .VCOdivider = 2, 141 .VCOdivider = 2,
140 .progdata = (0 << 18) | (1 << 9) | 0x04, 142 .progdata = (0 << 19) | (1 << 9) | 0x02,
141 }, 143 },
144
145 /* band 5 */
142 { 146 {
143 .freq_low = 1482000, 147 .freq_low = 1432000,
144 .freq_high = 1595999, 148 .freq_high = 1575999,
145 .VCOdivider = 2, 149 .VCOdivider = 2,
146 .progdata = (0 << 18) | (1 << 9) | 0x08, 150 .progdata = (0 << 19) | (1 << 9) | 0x04,
147 }, 151 },
152
153 /* band 6 */
148 { 154 {
149 .freq_low = 1596000, 155 .freq_low = 1576000,
150 .freq_high = 1717999, 156 .freq_high = 1717999,
151 .VCOdivider = 2, 157 .VCOdivider = 2,
152 .progdata = (0 << 18) | (1 << 9) | 0x10, 158 .progdata = (0 << 19) | (1 << 9) | 0x08,
153 }, 159 },
160
161 /* band 7 */
154 { 162 {
155 .freq_low = 1718000, 163 .freq_low = 1718000,
156 .freq_high = 1855999, 164 .freq_high = 1855999,
157 .VCOdivider = 2, 165 .VCOdivider = 2,
158 .progdata = (0 << 18) | (1 << 9) | 0x20, 166 .progdata = (0 << 19) | (1 << 9) | 0x10,
159 }, 167 },
168
169 /* band 8 */
160 { 170 {
161 .freq_low = 1856000, 171 .freq_low = 1856000,
162 .freq_high = 2035999, 172 .freq_high = 2035999,
163 .VCOdivider = 2, 173 .VCOdivider = 2,
164 .progdata = (0 << 18) | (1 << 9) | 0x40, 174 .progdata = (0 << 19) | (1 << 9) | 0x20,
165 }, 175 },
176
177 /* band 9 */
166 { 178 {
167 .freq_low = 2036000, 179 .freq_low = 2036000,
168 .freq_high = 2149999, 180 .freq_high = 2150000,
169 .VCOdivider = 2, 181 .VCOdivider = 2,
170 .progdata = (0 << 18) | (1 << 9) | 0x80, 182 .progdata = (0 << 19) | (1 << 9) | 0x40,
171 }, 183 },
172}; 184};
173 185
@@ -520,6 +532,8 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
520 u32 ndiv = 0, adiv = 0, vco_div = 0; 532 u32 ndiv = 0, adiv = 0, vco_div = 0;
521 int i = 0; 533 int i = 0;
522 int pump = 2; 534 int pump = 2;
535 int band = 0;
536 int num_bands = sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]);
523 537
524 /* Defaults for low freq, low rate */ 538 /* Defaults for low freq, low rate */
525 state->VCAarg = cx24123_AGC_vals[0].VCAprogdata; 539 state->VCAarg = cx24123_AGC_vals[0].VCAprogdata;
@@ -538,21 +552,27 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
538 } 552 }
539 } 553 }
540 554
541 /* For the given frequency, determine the bandselect programming bits */ 555 /* determine the band to use */
542 for (i = 0; i < sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]); i++) 556 if(force_band < 1 || force_band > num_bands)
543 { 557 {
544 if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) && 558 for (i = 0; i < num_bands; i++)
545 (cx24123_bandselect_vals[i].freq_high >= p->frequency) ) { 559 {
546 state->bandselectarg = cx24123_bandselect_vals[i].progdata; 560 if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) &&
547 vco_div = cx24123_bandselect_vals[i].VCOdivider; 561 (cx24123_bandselect_vals[i].freq_high >= p->frequency) )
548 562 band = i;
549 /* determine the charge pump current */
550 if ( p->frequency < (cx24123_bandselect_vals[i].freq_low + cx24123_bandselect_vals[i].freq_high)/2 )
551 pump = 0x01;
552 else
553 pump = 0x02;
554 } 563 }
555 } 564 }
565 else
566 band = force_band - 1;
567
568 state->bandselectarg = cx24123_bandselect_vals[band].progdata;
569 vco_div = cx24123_bandselect_vals[band].VCOdivider;
570
571 /* determine the charge pump current */
572 if ( p->frequency < (cx24123_bandselect_vals[band].freq_low + cx24123_bandselect_vals[band].freq_high)/2 )
573 pump = 0x01;
574 else
575 pump = 0x02;
556 576
557 /* Determine the N/A dividers for the requested lband freq (in kHz). */ 577 /* Determine the N/A dividers for the requested lband freq (in kHz). */
558 /* Note: the reference divider R=10, frequency is in KHz, XTAL is in Hz */ 578 /* Note: the reference divider R=10, frequency is in KHz, XTAL is in Hz */
@@ -1086,6 +1106,9 @@ static struct dvb_frontend_ops cx24123_ops = {
1086module_param(debug, int, 0644); 1106module_param(debug, int, 0644);
1087MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); 1107MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
1088 1108
1109module_param(force_band, int, 0644);
1110MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off).");
1111
1089MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware"); 1112MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware");
1090MODULE_AUTHOR("Steven Toth"); 1113MODULE_AUTHOR("Steven Toth");
1091MODULE_LICENSE("GPL"); 1114MODULE_LICENSE("GPL");