Lines Matching +full:1000 +full:- +full:10000
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Sony Horus3A DVB-S/S2 tuner driver
40 dev_dbg(&priv->i2c->dev, "horus3a: I2C %s reg 0x%02x size %d\n", in horus3a_i2c_debug()
53 .addr = priv->i2c_address, in horus3a_write_regs()
61 dev_warn(&priv->i2c->dev,"wr reg=%04x: len=%d is too big!\n", in horus3a_write_regs()
63 return -E2BIG; in horus3a_write_regs()
69 ret = i2c_transfer(priv->i2c, msg, 1); in horus3a_write_regs()
71 ret = -EREMOTEIO; in horus3a_write_regs()
73 dev_warn(&priv->i2c->dev, in horus3a_write_regs()
92 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in horus3a_enter_power_save()
93 if (priv->state == STATE_SLEEP) in horus3a_enter_power_save()
109 /* 0x11 - 0x12 */ in horus3a_enter_power_save()
111 priv->state = STATE_SLEEP; in horus3a_enter_power_save()
119 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in horus3a_leave_power_save()
120 if (priv->state == STATE_ACTIVE) in horus3a_leave_power_save()
126 /* 0x11 - 0x12 */ in horus3a_leave_power_save()
135 priv->state = STATE_ACTIVE; in horus3a_leave_power_save()
141 struct horus3a_priv *priv = fe->tuner_priv; in horus3a_init()
143 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in horus3a_init()
149 struct horus3a_priv *priv = fe->tuner_priv; in horus3a_release()
151 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in horus3a_release()
152 kfree(fe->tuner_priv); in horus3a_release()
153 fe->tuner_priv = NULL; in horus3a_release()
158 struct horus3a_priv *priv = fe->tuner_priv; in horus3a_sleep()
160 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in horus3a_sleep()
167 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in horus3a_set_params()
168 struct horus3a_priv *priv = fe->tuner_priv; in horus3a_set_params()
169 u32 frequency = p->frequency; in horus3a_set_params()
170 u32 symbol_rate = p->symbol_rate/1000; in horus3a_set_params()
179 dev_dbg(&priv->i2c->dev, "%s(): frequency %dkHz symbol_rate %dksps\n", in horus3a_set_params()
181 if (priv->set_tuner) in horus3a_set_params()
182 priv->set_tuner(priv->set_tuner_data, 0); in horus3a_set_params()
183 if (priv->state == STATE_SLEEP) in horus3a_set_params()
187 frequency = DIV_ROUND_CLOSEST(frequency, 1000) * 1000; in horus3a_set_params()
195 /* Assumed that fREF == 1MHz (1000kHz) */ in horus3a_set_params()
196 ms = DIV_ROUND_CLOSEST((frequency * mixdiv) / 2, 1000); in horus3a_set_params()
198 dev_err(&priv->i2c->dev, "horus3a: invalid frequency %d\n", in horus3a_set_params()
200 return -EINVAL; in horus3a_set_params()
215 /* F_CTL=10000 G_CTL=011 */ in horus3a_set_params()
244 if (p->delivery_system == SYS_DVBS) { in horus3a_set_params()
259 else if (symbol_rate <= 10000) in horus3a_set_params()
266 } else if (p->delivery_system == SYS_DVBS2) { in horus3a_set_params()
278 else if (symbol_rate <= 10000) in horus3a_set_params()
279 fc_lpf = (u8)((symbol_rate * 11 + (10000-1)) / 10000); in horus3a_set_params()
281 fc_lpf = (u8)((symbol_rate * 3 + (5000-1)) / 5000 + 5); in horus3a_set_params()
286 dev_err(&priv->i2c->dev, in horus3a_set_params()
288 p->delivery_system); in horus3a_set_params()
289 return -EINVAL; in horus3a_set_params()
291 /* 0x00 - 0x04 */ in horus3a_set_params()
309 priv->frequency = ms * 2 * 1000 / mixdiv; in horus3a_set_params()
315 struct horus3a_priv *priv = fe->tuner_priv; in horus3a_get_frequency()
317 *frequency = priv->frequency; in horus3a_get_frequency()
345 priv->i2c_address = (config->i2c_address >> 1); in horus3a_attach()
346 priv->i2c = i2c; in horus3a_attach()
347 priv->set_tuner_data = config->set_tuner_priv; in horus3a_attach()
348 priv->set_tuner = config->set_tuner_callback; in horus3a_attach()
350 if (fe->ops.i2c_gate_ctrl) in horus3a_attach()
351 fe->ops.i2c_gate_ctrl(fe, 1); in horus3a_attach()
358 buf[0] = config->xtal_freq_mhz; in horus3a_attach()
359 buf[1] = config->xtal_freq_mhz; in horus3a_attach()
361 /* 0x6 - 0x8 */ in horus3a_attach()
365 switch (config->xtal_freq_mhz) { in horus3a_attach()
377 dev_warn(&priv->i2c->dev, in horus3a_attach()
379 config->xtal_freq_mhz); in horus3a_attach()
387 if (fe->ops.i2c_gate_ctrl) in horus3a_attach()
388 fe->ops.i2c_gate_ctrl(fe, 0); in horus3a_attach()
390 memcpy(&fe->ops.tuner_ops, &horus3a_tuner_ops, in horus3a_attach()
392 fe->tuner_priv = priv; in horus3a_attach()
393 dev_info(&priv->i2c->dev, in horus3a_attach()
395 priv->i2c_address, priv->i2c); in horus3a_attach()