24 #include <linux/kernel.h>
25 #include <linux/module.h>
26 #include <linux/slab.h>
27 #include <linux/string.h>
46 { .addr = config->
addr, .flags = 0, .buf = b0, .len = 1 },
47 { .addr = config->
addr, .flags =
I2C_M_RD, .buf = b1, .len = 1 }
76 memcpy(&buf[1], data, len);
89 return stv6110x_write_regs(stv6110x, reg, &data, 1);
97 ret = stv6110x_write_regs(stv6110x, 0, stv6110x->
regs,
111 s32 pVal, pCalc, rDivOpt = 0, pCalcOpt = 1000;
116 if (frequency <= 1023000) {
120 }
else if (frequency <= 1300000) {
124 }
else if (frequency <= 2046000) {
134 for (rDiv = 0; rDiv <= 3; rDiv++) {
137 if ((
abs((
s32)(pCalc - pVal))) < (
abs((
s32)(pCalcOpt - pVal))))
144 divider = (divider + 5) / 10;
158 for (i = 0; i <
TRIALS; i++) {
168 static int stv6110x_get_frequency(
struct dvb_frontend *fe,
u32 *frequency)
192 halfbw = bandwidth >> 1;
194 if (halfbw > 36000000)
196 else if (halfbw < 5000000)
208 for (i = 0; i <
TRIALS; i++) {
220 static int stv6110x_get_bandwidth(
struct dvb_frontend *fe,
u32 *bandwidth)
230 static int stv6110x_set_refclock(
struct dvb_frontend *fe,
u32 refclock)
339 .name =
"STV6110(A) Silicon Tuner",
340 .frequency_min = 950000,
341 .frequency_max = 2150000,
344 .release = stv6110x_release
348 .tuner_init = stv6110x_init,
349 .tuner_sleep = stv6110x_sleep,
350 .tuner_set_mode = stv6110x_set_mode,
351 .tuner_set_frequency = stv6110x_set_frequency,
352 .tuner_get_frequency = stv6110x_get_frequency,
353 .tuner_set_bandwidth = stv6110x_set_bandwidth,
354 .tuner_get_bandwidth = stv6110x_get_bandwidth,
355 .tuner_set_bbgain = stv6110x_set_bbgain,
356 .tuner_get_bbgain = stv6110x_get_bbgain,
357 .tuner_set_refclk = stv6110x_set_refclock,
358 .tuner_get_status = stv6110x_get_status,
366 u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e};
374 stv6110x->
devctl = &stv6110x_ctl;
378 switch (stv6110x->
config->clk_div) {
396 fe->
ops.tuner_ops = stv6110x_ops;