Lines Matching full:cx
38 static void gpio_write(struct cx18 *cx) in gpio_write() argument
40 u32 dir_lo = cx->gpio_dir & 0xffff; in gpio_write()
41 u32 val_lo = cx->gpio_val & 0xffff; in gpio_write()
42 u32 dir_hi = cx->gpio_dir >> 16; in gpio_write()
43 u32 val_hi = cx->gpio_val >> 16; in gpio_write()
45 cx18_write_reg_expect(cx, dir_lo << 16, in gpio_write()
47 cx18_write_reg_expect(cx, (dir_lo << 16) | val_lo, in gpio_write()
49 cx18_write_reg_expect(cx, dir_hi << 16, in gpio_write()
51 cx18_write_reg_expect(cx, (dir_hi << 16) | val_hi, in gpio_write()
55 static void gpio_update(struct cx18 *cx, u32 mask, u32 data) in gpio_update() argument
60 mutex_lock(&cx->gpio_lock); in gpio_update()
61 cx->gpio_val = (cx->gpio_val & ~mask) | (data & mask); in gpio_update()
62 gpio_write(cx); in gpio_update()
63 mutex_unlock(&cx->gpio_lock); in gpio_update()
66 static void gpio_reset_seq(struct cx18 *cx, u32 active_lo, u32 active_hi, in gpio_reset_seq() argument
83 gpio_update(cx, mask, ~active_lo); in gpio_reset_seq()
87 gpio_update(cx, mask, ~active_hi); in gpio_reset_seq()
96 struct cx18 *cx = v4l2_get_subdevdata(sd); in gpiomux_log_status() local
98 mutex_lock(&cx->gpio_lock); in gpiomux_log_status()
100 cx->gpio_dir, cx->gpio_val); in gpiomux_log_status()
101 mutex_unlock(&cx->gpio_lock); in gpiomux_log_status()
107 struct cx18 *cx = v4l2_get_subdevdata(sd); in gpiomux_s_radio() local
110 * FIXME - work out the cx->active/audio_input mess - this is in gpiomux_s_radio()
112 * audio routing, but we need to update the state in cx in gpiomux_s_radio()
114 gpio_update(cx, cx->card->gpio_audio_input.mask, in gpiomux_s_radio()
115 cx->card->gpio_audio_input.radio); in gpiomux_s_radio()
121 struct cx18 *cx = v4l2_get_subdevdata(sd); in gpiomux_s_std() local
124 switch (cx->card->audio_inputs[cx->audio_input].muxer_input) { in gpiomux_s_std()
126 data = cx->card->gpio_audio_input.linein; in gpiomux_s_std()
129 data = cx->card->gpio_audio_input.tuner; in gpiomux_s_std()
133 * FIXME - work out the cx->active/audio_input mess - this is in gpiomux_s_std()
135 * audio routing, but we need to update the state in cx in gpiomux_s_std()
137 data = cx->card->gpio_audio_input.tuner; in gpiomux_s_std()
140 gpio_update(cx, cx->card->gpio_audio_input.mask, data); in gpiomux_s_std()
147 struct cx18 *cx = v4l2_get_subdevdata(sd); in gpiomux_s_audio_routing() local
152 data = cx->card->gpio_audio_input.tuner; in gpiomux_s_audio_routing()
155 data = cx->card->gpio_audio_input.linein; in gpiomux_s_audio_routing()
158 data = cx->card->gpio_audio_input.radio; in gpiomux_s_audio_routing()
163 gpio_update(cx, cx->card->gpio_audio_input.mask, data); in gpiomux_s_audio_routing()
195 struct cx18 *cx = v4l2_get_subdevdata(sd); in resetctrl_log_status() local
197 mutex_lock(&cx->gpio_lock); in resetctrl_log_status()
199 cx->gpio_dir, cx->gpio_val); in resetctrl_log_status()
200 mutex_unlock(&cx->gpio_lock); in resetctrl_log_status()
206 struct cx18 *cx = v4l2_get_subdevdata(sd); in resetctrl_reset() local
209 p = &cx->card->gpio_i2c_slave_reset; in resetctrl_reset()
212 gpio_reset_seq(cx, p->active_lo_mask, p->active_hi_mask, in resetctrl_reset()
230 gpio_reset_seq(cx, p->ir_reset_mask, 0, in resetctrl_reset()
234 if (cx->card->tuners[0].tuner == TUNER_XC2028) in resetctrl_reset()
235 gpio_reset_seq(cx, (1 << cx->card->xceive_pin), 0, in resetctrl_reset()
254 void cx18_gpio_init(struct cx18 *cx) in cx18_gpio_init() argument
256 mutex_lock(&cx->gpio_lock); in cx18_gpio_init()
257 cx->gpio_dir = cx->card->gpio_init.direction; in cx18_gpio_init()
258 cx->gpio_val = cx->card->gpio_init.initial_value; in cx18_gpio_init()
260 if (cx->card->tuners[0].tuner == TUNER_XC2028) { in cx18_gpio_init()
261 cx->gpio_dir |= 1 << cx->card->xceive_pin; in cx18_gpio_init()
262 cx->gpio_val |= 1 << cx->card->xceive_pin; in cx18_gpio_init()
265 if (cx->gpio_dir == 0) { in cx18_gpio_init()
266 mutex_unlock(&cx->gpio_lock); in cx18_gpio_init()
271 cx18_read_reg(cx, CX18_REG_GPIO_DIR1), in cx18_gpio_init()
272 cx18_read_reg(cx, CX18_REG_GPIO_DIR2), in cx18_gpio_init()
273 cx18_read_reg(cx, CX18_REG_GPIO_OUT1), in cx18_gpio_init()
274 cx18_read_reg(cx, CX18_REG_GPIO_OUT2)); in cx18_gpio_init()
276 gpio_write(cx); in cx18_gpio_init()
277 mutex_unlock(&cx->gpio_lock); in cx18_gpio_init()
280 int cx18_gpio_register(struct cx18 *cx, u32 hw) in cx18_gpio_register() argument
288 sd = &cx->sd_gpiomux; in cx18_gpio_register()
293 sd = &cx->sd_resetctrl; in cx18_gpio_register()
302 v4l2_set_subdevdata(sd, cx); in cx18_gpio_register()
303 snprintf(sd->name, sizeof(sd->name), "%s %s", cx->v4l2_dev.name, str); in cx18_gpio_register()
305 return v4l2_device_register_subdev(&cx->v4l2_dev, sd); in cx18_gpio_register()
310 struct cx18 *cx = to_cx18(data); in cx18_reset_ir_gpio() local
312 if (cx->card->gpio_i2c_slave_reset.ir_reset_mask == 0) in cx18_reset_ir_gpio()
317 v4l2_subdev_call(&cx->sd_resetctrl, in cx18_reset_ir_gpio()
328 struct cx18 *cx = cb_data->cx; in cx18_reset_tuner_gpio() local
331 cx->card->tuners[0].tuner != TUNER_XC2028) in cx18_reset_tuner_gpio()
335 return v4l2_subdev_call(&cx->sd_resetctrl, in cx18_reset_tuner_gpio()