Lines Matching +full:vco +full:- +full:hz
1 // SPDX-License-Identifier: GPL-2.0-or-later
20 #include "tuner-i2c.h"
38 msg.addr = priv->config->i2c_address; in max2165_write_reg()
43 ret = i2c_transfer(priv->i2c, &msg, 1); in max2165_write_reg()
49 return (ret != 1) ? -EIO : 0; in max2165_write_reg()
55 u8 dev_addr = priv->config->i2c_address; in max2165_read_reg()
64 ret = i2c_transfer(priv->i2c, msg, 2); in max2165_read_reg()
67 return -EIO; in max2165_read_reg()
104 priv->tf_ntch_low_cfg = dat[0] >> 4; in max2165_read_rom_table()
105 priv->tf_ntch_hi_cfg = dat[0] & 0x0F; in max2165_read_rom_table()
106 priv->tf_balun_low_ref = dat[1] & 0x0F; in max2165_read_rom_table()
107 priv->tf_balun_hi_ref = dat[1] >> 4; in max2165_read_rom_table()
108 priv->bb_filter_7mhz_cfg = dat[2] & 0x0F; in max2165_read_rom_table()
109 priv->bb_filter_8mhz_cfg = dat[2] >> 4; in max2165_read_rom_table()
111 dprintk("tf_ntch_low_cfg = 0x%X\n", priv->tf_ntch_low_cfg); in max2165_read_rom_table()
112 dprintk("tf_ntch_hi_cfg = 0x%X\n", priv->tf_ntch_hi_cfg); in max2165_read_rom_table()
113 dprintk("tf_balun_low_ref = 0x%X\n", priv->tf_balun_low_ref); in max2165_read_rom_table()
114 dprintk("tf_balun_hi_ref = 0x%X\n", priv->tf_balun_hi_ref); in max2165_read_rom_table()
115 dprintk("bb_filter_7mhz_cfg = 0x%X\n", priv->bb_filter_7mhz_cfg); in max2165_read_rom_table()
116 dprintk("bb_filter_8mhz_cfg = 0x%X\n", priv->bb_filter_8mhz_cfg); in max2165_read_rom_table()
129 v -= 8; in max2165_set_osc()
141 val = priv->bb_filter_8mhz_cfg; in max2165_set_bandwidth()
143 val = priv->bb_filter_7mhz_cfg; in max2165_set_bandwidth()
157 return -EINVAL; in fixpt_div32()
160 remainder = dividend - q * divisor; in fixpt_div32()
166 remainder -= divisor; in fixpt_div32()
186 ret = fixpt_div32(freq / 1000, priv->config->osc_clk * 1000, in max2165_set_rf()
191 /* 20-bit fraction */ in max2165_set_rf()
201 priv->tf_ntch_low_cfg : priv->tf_ntch_hi_cfg; in max2165_set_rf()
204 t = priv->tf_balun_low_ref; in max2165_set_rf()
205 t += (priv->tf_balun_hi_ref - priv->tf_balun_low_ref) in max2165_set_rf()
206 * (freq / 1000 - 470000) / (780000 - 470000); in max2165_set_rf()
224 u8 vco, vco_sub_band, adc; in max2165_debug_status() local
236 vco = autotune >> 6; in max2165_debug_status()
240 dprintk("auto VCO active: %d, auto VCO success: %d\n", in max2165_debug_status()
246 dprintk("VCO: %d, VCO Sub-band: %d, ADC: %d\n", vco, vco_sub_band, adc); in max2165_debug_status()
251 struct max2165_priv *priv = fe->tuner_priv; in max2165_set_params()
252 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in max2165_set_params()
255 switch (c->bandwidth_hz) { in max2165_set_params()
258 priv->frequency = c->frequency; in max2165_set_params()
261 printk(KERN_INFO "MAX2165: bandwidth %d Hz not supported.\n", in max2165_set_params()
262 c->bandwidth_hz); in max2165_set_params()
263 return -EINVAL; in max2165_set_params()
266 dprintk("%s() frequency=%d\n", __func__, c->frequency); in max2165_set_params()
268 if (fe->ops.i2c_gate_ctrl) in max2165_set_params()
269 fe->ops.i2c_gate_ctrl(fe, 1); in max2165_set_params()
270 max2165_set_bandwidth(priv, c->bandwidth_hz); in max2165_set_params()
271 ret = max2165_set_rf(priv, priv->frequency); in max2165_set_params()
274 if (fe->ops.i2c_gate_ctrl) in max2165_set_params()
275 fe->ops.i2c_gate_ctrl(fe, 0); in max2165_set_params()
278 return -EREMOTEIO; in max2165_set_params()
285 struct max2165_priv *priv = fe->tuner_priv; in max2165_get_frequency()
287 *freq = priv->frequency; in max2165_get_frequency()
293 struct max2165_priv *priv = fe->tuner_priv; in max2165_get_bandwidth()
296 *bw = priv->bandwidth; in max2165_get_bandwidth()
302 struct max2165_priv *priv = fe->tuner_priv; in max2165_get_status()
307 if (fe->ops.i2c_gate_ctrl) in max2165_get_status()
308 fe->ops.i2c_gate_ctrl(fe, 1); in max2165_get_status()
313 if (fe->ops.i2c_gate_ctrl) in max2165_get_status()
314 fe->ops.i2c_gate_ctrl(fe, 0); in max2165_get_status()
327 struct max2165_priv *priv = fe->tuner_priv; in max2165_init()
330 if (fe->ops.i2c_gate_ctrl) in max2165_init()
331 fe->ops.i2c_gate_ctrl(fe, 1); in max2165_init()
347 max2165_set_osc(priv, priv->config->osc_clk); in max2165_init()
353 if (fe->ops.i2c_gate_ctrl) in max2165_init()
354 fe->ops.i2c_gate_ctrl(fe, 0); in max2165_init()
361 struct max2165_priv *priv = fe->tuner_priv; in max2165_release()
365 fe->tuner_priv = NULL; in max2165_release()
393 dprintk("%s(%d-%04x)\n", __func__, in max2165_attach()
394 i2c ? i2c_adapter_id(i2c) : -1, in max2165_attach()
395 cfg ? cfg->i2c_address : -1); in max2165_attach()
401 memcpy(&fe->ops.tuner_ops, &max2165_tuner_ops, in max2165_attach()
404 priv->config = cfg; in max2165_attach()
405 priv->i2c = i2c; in max2165_attach()
406 fe->tuner_priv = priv; in max2165_attach()