52 dev_warn(&priv->
i2c->dev,
"%s: i2c wr failed=%d reg=%02x " \
53 "len=%d\n", KBUILD_MODNAME, ret, reg, len);
72 .addr = priv->
cfg->i2c_address,
84 dev_warn(&priv->
i2c->dev,
"%s: i2c rd failed=%d reg=%02x " \
85 "len=%d\n", KBUILD_MODNAME, ret, reg, len);
95 return tda18212_wr_regs(priv, reg, &val, 1);
101 return tda18212_rd_regs(priv, reg, val, 1);
110 #define TDA18212_RD_LEN 32
111 for (i = 0; i <
sizeof(
buf); i += TDA18212_RD_LEN)
112 tda18212_rd_regs(priv, i, &buf[i], TDA18212_RD_LEN);
136 static const u8 bw_params[][3] = {
138 [
DVBT_6] = { 0xb3, 0x20, 0x03 },
139 [
DVBT_7] = { 0xb3, 0x31, 0x01 },
140 [
DVBT_8] = { 0xb3, 0x22, 0x01 },
141 [
DVBT2_6] = { 0xbc, 0x20, 0x03 },
142 [
DVBT2_7] = { 0xbc, 0x72, 0x03 },
143 [
DVBT2_8] = { 0xbc, 0x22, 0x01 },
144 [
DVBC_6] = { 0x92, 0x50, 0x03 },
145 [
DVBC_8] = { 0x92, 0x53, 0x03 },
149 "%s: delivery_system=%d frequency=%d bandwidth_hz=%d\n",
153 if (fe->
ops.i2c_gate_ctrl)
154 fe->
ops.i2c_gate_ctrl(fe, 1);
160 if_khz = priv->
cfg->if_dvbt_6;
164 if_khz = priv->
cfg->if_dvbt_7;
168 if_khz = priv->
cfg->if_dvbt_8;
179 if_khz = priv->
cfg->if_dvbt2_6;
183 if_khz = priv->
cfg->if_dvbt2_7;
187 if_khz = priv->
cfg->if_dvbt2_8;
197 if_khz = priv->
cfg->if_dvbc;
205 ret = tda18212_wr_reg(priv, 0x23, bw_params[i][2]);
209 ret = tda18212_wr_reg(priv, 0x06, 0x00);
213 ret = tda18212_wr_reg(priv, 0x0f, bw_params[i][0]);
218 buf[1] = bw_params[
i][1];
221 buf[4] = ((c->
frequency / 1000) >> 16) & 0xff;
222 buf[5] = ((c->
frequency / 1000) >> 8) & 0xff;
223 buf[6] = ((c->
frequency / 1000) >> 0) & 0xff;
226 ret = tda18212_wr_regs(priv, 0x12, buf,
sizeof(buf));
234 if (fe->
ops.i2c_gate_ctrl)
235 fe->
ops.i2c_gate_ctrl(fe, 0);
240 dev_dbg(&priv->
i2c->dev,
"%s: failed=%d\n", __func__, ret);
262 .name =
"NXP TDA18212",
264 .frequency_min = 48000000,
265 .frequency_max = 864000000,
266 .frequency_step = 1000,
269 .release = tda18212_release,
271 .set_params = tda18212_set_params,
272 .get_if_frequency = tda18212_get_if_frequency,
290 if (fe->
ops.i2c_gate_ctrl)
291 fe->
ops.i2c_gate_ctrl(fe, 1);
294 ret = tda18212_rd_reg(priv, 0x00, &val);
296 if (fe->
ops.i2c_gate_ctrl)
297 fe->
ops.i2c_gate_ctrl(fe, 0);
299 dev_dbg(&priv->
i2c->dev,
"%s: ret=%d chip id=%02x\n", __func__, ret,
301 if (ret || val != 0xc7) {
307 "%s: NXP TDA18212HN successfully identified\n",
310 memcpy(&fe->
ops.tuner_ops, &tda18212_tuner_ops,