Lines Matching +full:i2c +full:- +full:gate

1 // SPDX-License-Identifier: GPL-2.0-or-later
21 struct tda18212_dev *dev = fe->tuner_priv; in tda18212_set_params()
22 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in tda18212_set_params()
50 dev_dbg(&dev->client->dev, in tda18212_set_params()
52 c->delivery_system, c->frequency, in tda18212_set_params()
53 c->bandwidth_hz); in tda18212_set_params()
55 if (fe->ops.i2c_gate_ctrl) in tda18212_set_params()
56 fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */ in tda18212_set_params()
58 switch (c->delivery_system) { in tda18212_set_params()
60 if_khz = dev->cfg.if_atsc_vsb; in tda18212_set_params()
64 if_khz = dev->cfg.if_atsc_qam; in tda18212_set_params()
68 switch (c->bandwidth_hz) { in tda18212_set_params()
70 if_khz = dev->cfg.if_dvbt_6; in tda18212_set_params()
74 if_khz = dev->cfg.if_dvbt_7; in tda18212_set_params()
78 if_khz = dev->cfg.if_dvbt_8; in tda18212_set_params()
82 ret = -EINVAL; in tda18212_set_params()
87 switch (c->bandwidth_hz) { in tda18212_set_params()
89 if_khz = dev->cfg.if_dvbt2_6; in tda18212_set_params()
93 if_khz = dev->cfg.if_dvbt2_7; in tda18212_set_params()
97 if_khz = dev->cfg.if_dvbt2_8; in tda18212_set_params()
101 ret = -EINVAL; in tda18212_set_params()
107 if_khz = dev->cfg.if_dvbc; in tda18212_set_params()
111 ret = -EINVAL; in tda18212_set_params()
115 ret = regmap_write(dev->regmap, 0x23, bw_params[i][2]); in tda18212_set_params()
119 ret = regmap_write(dev->regmap, 0x06, 0x00); in tda18212_set_params()
123 ret = regmap_write(dev->regmap, 0x0f, bw_params[i][0]); in tda18212_set_params()
131 buf[4] = ((c->frequency / 1000) >> 16) & 0xff; in tda18212_set_params()
132 buf[5] = ((c->frequency / 1000) >> 8) & 0xff; in tda18212_set_params()
133 buf[6] = ((c->frequency / 1000) >> 0) & 0xff; in tda18212_set_params()
136 ret = regmap_bulk_write(dev->regmap, 0x12, buf, sizeof(buf)); in tda18212_set_params()
141 dev->if_frequency = buf[3] * 50 * 1000; in tda18212_set_params()
144 if (fe->ops.i2c_gate_ctrl) in tda18212_set_params()
145 fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ in tda18212_set_params()
150 dev_dbg(&dev->client->dev, "failed=%d\n", ret); in tda18212_set_params()
156 struct tda18212_dev *dev = fe->tuner_priv; in tda18212_get_if_frequency()
158 *frequency = dev->if_frequency; in tda18212_get_if_frequency()
178 struct tda18212_config *cfg = client->dev.platform_data; in tda18212_probe()
179 struct dvb_frontend *fe = cfg->fe; in tda18212_probe()
191 ret = -ENOMEM; in tda18212_probe()
192 dev_err(&client->dev, "kzalloc() failed\n"); in tda18212_probe()
196 memcpy(&dev->cfg, cfg, sizeof(struct tda18212_config)); in tda18212_probe()
197 dev->client = client; in tda18212_probe()
198 dev->regmap = devm_regmap_init_i2c(client, &regmap_config); in tda18212_probe()
199 if (IS_ERR(dev->regmap)) { in tda18212_probe()
200 ret = PTR_ERR(dev->regmap); in tda18212_probe()
205 if (fe->ops.i2c_gate_ctrl) in tda18212_probe()
206 fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */ in tda18212_probe()
208 ret = regmap_read(dev->regmap, 0x00, &chip_id); in tda18212_probe()
209 dev_dbg(&dev->client->dev, "chip_id=%02x\n", chip_id); in tda18212_probe()
211 if (fe->ops.i2c_gate_ctrl) in tda18212_probe()
212 fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ in tda18212_probe()
225 ret = -ENODEV; in tda18212_probe()
229 dev_info(&dev->client->dev, in tda18212_probe()
232 fe->tuner_priv = dev; in tda18212_probe()
233 memcpy(&fe->ops.tuner_ops, &tda18212_tuner_ops, in tda18212_probe()
239 dev_dbg(&client->dev, "failed=%d\n", ret); in tda18212_probe()
247 struct dvb_frontend *fe = dev->cfg.fe; in tda18212_remove()
249 dev_dbg(&client->dev, "\n"); in tda18212_remove()
251 memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops)); in tda18212_remove()
252 fe->tuner_priv = NULL; in tda18212_remove()
260 MODULE_DEVICE_TABLE(i2c, tda18212_id);