Lines Matching full:cx
69 static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, in cx18_i2c_new_ir() argument
73 struct IR_i2c_init_data *init_data = &cx->ir_i2c_init_data; in cx18_i2c_new_ir()
86 init_data->name = cx->card_name; in cx18_i2c_new_ir()
95 int cx18_i2c_register(struct cx18 *cx, unsigned idx) in cx18_i2c_register() argument
99 struct i2c_adapter *adap = &cx->i2c_adap[bus]; in cx18_i2c_register()
105 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, in cx18_i2c_register()
106 adap, type, 0, cx->card_i2c->radio); in cx18_i2c_register()
109 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, in cx18_i2c_register()
110 adap, type, 0, cx->card_i2c->demod); in cx18_i2c_register()
113 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, in cx18_i2c_register()
114 adap, type, 0, cx->card_i2c->tv); in cx18_i2c_register()
121 return cx18_i2c_new_ir(cx, adap, hw, type, hw_addrs[idx]); in cx18_i2c_register()
128 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, type, hw_addrs[idx], in cx18_i2c_register()
136 struct v4l2_subdev *cx18_find_hw(struct cx18 *cx, u32 hw) in cx18_find_hw() argument
141 spin_lock(&cx->v4l2_dev.lock); in cx18_find_hw()
142 v4l2_device_for_each_subdev(sd, &cx->v4l2_dev) { in cx18_find_hw()
148 spin_unlock(&cx->v4l2_dev.lock); in cx18_find_hw()
154 struct cx18 *cx = ((struct cx18_i2c_algo_callback_data *)data)->cx; in cx18_setscl() local
157 u32 r = cx18_read_reg(cx, addr); in cx18_setscl()
160 cx18_write_reg(cx, r | SETSCL_BIT, addr); in cx18_setscl()
162 cx18_write_reg(cx, r & ~SETSCL_BIT, addr); in cx18_setscl()
167 struct cx18 *cx = ((struct cx18_i2c_algo_callback_data *)data)->cx; in cx18_setsda() local
170 u32 r = cx18_read_reg(cx, addr); in cx18_setsda()
173 cx18_write_reg(cx, r | SETSDL_BIT, addr); in cx18_setsda()
175 cx18_write_reg(cx, r & ~SETSDL_BIT, addr); in cx18_setsda()
180 struct cx18 *cx = ((struct cx18_i2c_algo_callback_data *)data)->cx; in cx18_getscl() local
184 return cx18_read_reg(cx, addr) & GETSCL_BIT; in cx18_getscl()
189 struct cx18 *cx = ((struct cx18_i2c_algo_callback_data *)data)->cx; in cx18_getsda() local
193 return cx18_read_reg(cx, addr) & GETSDL_BIT; in cx18_getsda()
217 int init_cx18_i2c(struct cx18 *cx) in init_cx18_i2c() argument
224 cx->i2c_algo[i] = cx18_i2c_algo_template; in init_cx18_i2c()
225 cx->i2c_algo_cb_data[i].cx = cx; in init_cx18_i2c()
226 cx->i2c_algo_cb_data[i].bus_index = i; in init_cx18_i2c()
227 cx->i2c_algo[i].data = &cx->i2c_algo_cb_data[i]; in init_cx18_i2c()
230 cx->i2c_adap[i] = cx18_i2c_adap_template; in init_cx18_i2c()
231 cx->i2c_adap[i].algo_data = &cx->i2c_algo[i]; in init_cx18_i2c()
232 sprintf(cx->i2c_adap[i].name + strlen(cx->i2c_adap[i].name), in init_cx18_i2c()
233 " #%d-%d", cx->instance, i); in init_cx18_i2c()
234 i2c_set_adapdata(&cx->i2c_adap[i], &cx->v4l2_dev); in init_cx18_i2c()
235 cx->i2c_adap[i].dev.parent = &cx->pci_dev->dev; in init_cx18_i2c()
238 if (cx18_read_reg(cx, CX18_REG_I2C_2_WR) != 0x0003c02f) { in init_cx18_i2c()
241 cx18_write_reg_expect(cx, 0x10000000, 0xc71004, in init_cx18_i2c()
244 cx18_write_reg_expect(cx, 0x10001000, 0xc71024, in init_cx18_i2c()
248 cx18_write_reg_expect(cx, 0x00c00000, 0xc7001c, 0x00000000, 0x00c000c0); in init_cx18_i2c()
250 cx18_write_reg_expect(cx, 0x00c000c0, 0xc7001c, 0x000000c0, 0x00c000c0); in init_cx18_i2c()
252 cx18_write_reg_expect(cx, 0x00c00000, 0xc7001c, 0x00000000, 0x00c000c0); in init_cx18_i2c()
256 cx18_write_reg(cx, 0x00c00000, 0xc730c8); in init_cx18_i2c()
258 cx18_write_reg_expect(cx, HW2_I2C1_INT|HW2_I2C2_INT, HW2_INT_CLR_STATUS, in init_cx18_i2c()
262 cx18_write_reg(cx, 0x00021c0f & ~4, CX18_REG_I2C_1_WR); in init_cx18_i2c()
263 cx18_setscl(&cx->i2c_algo_cb_data[0], 1); in init_cx18_i2c()
264 cx18_setsda(&cx->i2c_algo_cb_data[0], 1); in init_cx18_i2c()
267 cx18_write_reg(cx, 0x00021c0f & ~4, CX18_REG_I2C_2_WR); in init_cx18_i2c()
268 cx18_setscl(&cx->i2c_algo_cb_data[1], 1); in init_cx18_i2c()
269 cx18_setsda(&cx->i2c_algo_cb_data[1], 1); in init_cx18_i2c()
271 cx18_call_hw(cx, CX18_HW_GPIO_RESET_CTRL, in init_cx18_i2c()
274 err = i2c_bit_add_bus(&cx->i2c_adap[0]); in init_cx18_i2c()
277 err = i2c_bit_add_bus(&cx->i2c_adap[1]); in init_cx18_i2c()
283 i2c_del_adapter(&cx->i2c_adap[0]); in init_cx18_i2c()
288 void exit_cx18_i2c(struct cx18 *cx) in exit_cx18_i2c() argument
292 cx18_write_reg(cx, cx18_read_reg(cx, CX18_REG_I2C_1_WR) | 4, in exit_cx18_i2c()
294 cx18_write_reg(cx, cx18_read_reg(cx, CX18_REG_I2C_2_WR) | 4, in exit_cx18_i2c()
298 i2c_del_adapter(&cx->i2c_adap[i]); in exit_cx18_i2c()