/* * TODO: * I2C write and read works only for one single register. Multiple registers * could not be accessed using normal register address auto-increment. * There could be (very likely) register to change that behavior....
*/
/* write single register conditionally only when value differs from 0xff * XXX: This is special routine meant only for writing fc2580_freq_regs_lut[]
* values. Do not use for the other purposes. */ staticint fc2580_wr_reg_ff(struct fc2580_dev *dev, u8 reg, u8 val)
{ if (val == 0xff) return 0; else return regmap_write(dev->regmap, reg, val);
}
ret = regmap_write(dev->regmap, 0x02, synth_config); if (ret) goto err;
ret = regmap_write(dev->regmap, 0x18, div_ref_val << 0 | k_cw >> 16); if (ret) goto err;
ret = regmap_write(dev->regmap, 0x1a, (k_cw >> 8) & 0xff); if (ret) goto err;
ret = regmap_write(dev->regmap, 0x1b, (k_cw >> 0) & 0xff); if (ret) goto err;
ret = regmap_write(dev->regmap, 0x1c, div_n); if (ret) goto err;
/* registers */ for (i = 0; i < ARRAY_SIZE(fc2580_freq_regs_lut); i++) { if (dev->f_frequency <= fc2580_freq_regs_lut[i].freq) break;
} if (i == ARRAY_SIZE(fc2580_freq_regs_lut)) {
ret = -EINVAL; goto err;
}
ret = fc2580_wr_reg_ff(dev, 0x25, fc2580_freq_regs_lut[i].r25_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x27, fc2580_freq_regs_lut[i].r27_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x28, fc2580_freq_regs_lut[i].r28_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x29, fc2580_freq_regs_lut[i].r29_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x2b, fc2580_freq_regs_lut[i].r2b_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x2c, fc2580_freq_regs_lut[i].r2c_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x2d, fc2580_freq_regs_lut[i].r2d_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x30, fc2580_freq_regs_lut[i].r30_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x44, fc2580_freq_regs_lut[i].r44_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x50, fc2580_freq_regs_lut[i].r50_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x53, fc2580_freq_regs_lut[i].r53_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x5f, fc2580_freq_regs_lut[i].r5f_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x61, fc2580_freq_regs_lut[i].r61_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x62, fc2580_freq_regs_lut[i].r62_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x63, fc2580_freq_regs_lut[i].r63_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x67, fc2580_freq_regs_lut[i].r67_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x68, fc2580_freq_regs_lut[i].r68_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x69, fc2580_freq_regs_lut[i].r69_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x6a, fc2580_freq_regs_lut[i].r6a_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x6b, fc2580_freq_regs_lut[i].r6b_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x6c, fc2580_freq_regs_lut[i].r6c_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x6d, fc2580_freq_regs_lut[i].r6d_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x6e, fc2580_freq_regs_lut[i].r6e_val); if (ret) goto err;
ret = fc2580_wr_reg_ff(dev, 0x6f, fc2580_freq_regs_lut[i].r6f_val); if (ret) goto err;
/* IF filters */ for (i = 0; i < ARRAY_SIZE(fc2580_if_filter_lut); i++) { if (dev->f_bandwidth <= fc2580_if_filter_lut[i].freq) break;
} if (i == ARRAY_SIZE(fc2580_if_filter_lut)) {
ret = -EINVAL; goto err;
}
ret = regmap_write(dev->regmap, 0x36, fc2580_if_filter_lut[i].r36_val); if (ret) goto err;
for (i = 0; i < ARRAY_SIZE(fc2580_init_reg_vals); i++) {
ret = regmap_write(dev->regmap, fc2580_init_reg_vals[i].reg,
fc2580_init_reg_vals[i].val); if (ret) goto err;
}
switch (ctrl->id) { case V4L2_CID_RF_TUNER_BANDWIDTH_AUTO: case V4L2_CID_RF_TUNER_BANDWIDTH: /* * TODO: Auto logic does not work 100% correctly as tuner driver * do not have information to calculate maximum suitable * bandwidth. Calculating it is responsible of master driver.
*/
dev->f_bandwidth = dev->bandwidth->val;
ret = fc2580_set_params(dev); break; default:
dev_dbg(&client->dev, "unknown ctrl");
ret = -EINVAL;
} return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.