22 #include <linux/module.h>
25 #include <linux/i2c.h>
26 #include <linux/slab.h>
33 #define mc_printk(level, format, arg...) \
34 printk(level "mc44s803: " format , ## arg)
41 .
addr = priv->
cfg->i2c_address, .flags = 0, .buf =
buf, .len = 3
44 buf[0] = (val & 0xff0000) >> 16;
45 buf[1] = (val & 0xff00) >> 8;
46 buf[2] = (val & 0xff);
62 { .addr = priv->
cfg->i2c_address, .flags =
I2C_M_RD,
63 .buf =
buf, .len = 3 },
69 ret = mc44s803_writereg(priv, wval);
78 *val = (buf[0] << 16) | (buf[1] << 8) | buf[2];
99 if (fe->
ops.i2c_gate_ctrl)
100 fe->
ops.i2c_gate_ctrl(fe, 1);
106 err = mc44s803_writereg(priv, val);
112 err = mc44s803_writereg(priv, val);
122 err = mc44s803_writereg(priv, val);
129 err = mc44s803_writereg(priv, val);
139 err = mc44s803_writereg(priv, val);
151 err = mc44s803_writereg(priv, val);
167 err = mc44s803_writereg(priv, val);
179 err = mc44s803_writereg(priv, val);
188 err = mc44s803_writereg(priv, val);
201 err = mc44s803_writereg(priv, val);
205 if (fe->
ops.i2c_gate_ctrl)
206 fe->
ops.i2c_gate_ctrl(fe, 0);
210 if (fe->
ops.i2c_gate_ctrl)
211 fe->
ops.i2c_gate_ctrl(fe, 0);
231 lo1 = ((60 * n1) + (r1 / 2)) / r1;
235 lo2 = ((60 * n2) + (r2 / 2)) / r2;
237 if (fe->
ops.i2c_gate_ctrl)
238 fe->
ops.i2c_gate_ctrl(fe, 1);
245 err = mc44s803_writereg(priv, val);
252 err = mc44s803_writereg(priv, val);
259 err = mc44s803_writereg(priv, val);
268 err = mc44s803_writereg(priv, val);
277 err = mc44s803_writereg(priv, val);
281 if (fe->
ops.i2c_gate_ctrl)
282 fe->
ops.i2c_gate_ctrl(fe, 0);
287 if (fe->
ops.i2c_gate_ctrl)
288 fe->
ops.i2c_gate_ctrl(fe, 0);
309 .name =
"Freescale MC44S803",
310 .frequency_min = 48000000,
311 .frequency_max = 1000000000,
312 .frequency_step = 100000,
315 .release = mc44s803_release,
316 .init = mc44s803_init,
317 .set_params = mc44s803_set_params,
318 .get_frequency = mc44s803_get_frequency,
319 .get_if_frequency = mc44s803_get_if_frequency,
342 if (fe->
ops.i2c_gate_ctrl)
343 fe->
ops.i2c_gate_ctrl(fe, 1);
353 "(%x should be 0x14)\n",
id);
358 memcpy(&fe->
ops.tuner_ops, &mc44s803_tuner_ops,
363 if (fe->
ops.i2c_gate_ctrl)
364 fe->
ops.i2c_gate_ctrl(fe, 0);
369 if (fe->
ops.i2c_gate_ctrl)
370 fe->
ops.i2c_gate_ctrl(fe, 0);