Home | History | Annotate | Download | only in i2c

Lines Matching defs:lg

87 	struct lg3303 *lg;
89 lg = kmem_alloc(sizeof(*lg), KM_SLEEP);
90 lg->parent = parent;
91 lg->i2c = i2c;
92 lg->i2c_addr = addr;
93 lg->current_modulation = -1;
94 lg->flags = flags;
96 if (lg3303_init(lg) != 0) {
97 kmem_free(lg, sizeof(*lg));
101 device_printf(lg->parent, "lg3303: found @ 0x%02x\n", addr);
103 return lg;
107 lg3303_close(struct lg3303 *lg)
109 kmem_free(lg, sizeof(*lg));
113 lg3303_write(struct lg3303 *lg, uint8_t *buf, size_t len)
120 error = iic_exec(lg->i2c, I2C_OP_WRITE_WITH_STOP, lg->i2c_addr,
131 lg3303_read(struct lg3303 *lg, uint8_t reg, uint8_t *buf, size_t len)
135 error = iic_exec(lg->i2c, I2C_OP_WRITE, lg->i2c_addr,
139 return iic_exec(lg->i2c, I2C_OP_READ, lg->i2c_addr,
144 lg3303_reset(struct lg3303 *lg)
147 int error = lg3303_write(lg, buffer, 2);
150 error = lg3303_write(lg, buffer, 2);
156 lg3303_init(struct lg3303 *lg)
170 error = lg3303_write(lg, init_data, len);
172 lg3303_reset(lg);
178 lg3303_set_modulation(struct lg3303 *lg, fe_modulation_t modulation)
204 error = lg3303_reset(lg);
208 if (lg->flags & LG3303_CFG_SERIAL_INPUT)
214 error = lg3303_write(lg, vsb_data, sizeof(vsb_data));
222 error = lg3303_write(lg, qam_data, sizeof(qam_data));
227 device_printf(lg->parent,
232 error = lg3303_write(lg, top_ctrl, sizeof(top_ctrl));
235 lg->current_modulation = modulation;
236 lg3303_reset(lg);
242 lg3303_get_dtv_status(struct lg3303 *lg)
248 error = lg3303_read(lg, 0x58, &value, sizeof(value));
255 error = lg3303_read(lg, REG_CARRIER_LOCK, &value, sizeof(value));
259 switch (lg->current_modulation) {
272 device_printf(lg->parent,
274 lg->current_modulation);
281 error = lg3303_read(lg, reg, &value, sizeof(value));
292 lg3303_get_snr(struct lg3303 *lg)
299 switch (lg->current_modulation) {
301 error = lg3303_read(lg, REG_EQPH_ERR0, buffer, sizeof(buffer));
309 error = lg3303_read(lg, REG_CARRIER_MSEQAM1, buffer, 2);
313 if (lg->current_modulation == QAM_64)
319 device_printf(lg->parent,
321 lg->current_modulation);
334 lg3303_get_signal_strength(struct lg3303 *lg)
336 return ((uint32_t)lg3303_get_snr(lg) << 16) / 8960;
340 lg3303_get_ucblocks(struct lg3303 *lg)
345 error = lg3303_read(lg, REG_PACKET_ERR_COUNTER1, buffer, sizeof(buffer));