Lines Matching full:cx

15 int cx18_av_write(struct cx18 *cx, u16 addr, u8 value)  in cx18_av_write()  argument
20 u32 x = cx18_read_reg(cx, reg); in cx18_av_write()
23 cx18_write_reg(cx, x, reg); in cx18_av_write()
27 int cx18_av_write_expect(struct cx18 *cx, u16 addr, u8 value, u8 eval, u8 mask) in cx18_av_write_expect() argument
31 u32 x = cx18_read_reg(cx, reg); in cx18_av_write_expect()
34 cx18_write_reg_expect(cx, x, reg, in cx18_av_write_expect()
39 int cx18_av_write4(struct cx18 *cx, u16 addr, u32 value) in cx18_av_write4() argument
41 cx18_write_reg(cx, value, 0xc40000 + addr); in cx18_av_write4()
46 cx18_av_write4_expect(struct cx18 *cx, u16 addr, u32 value, u32 eval, u32 mask) in cx18_av_write4_expect() argument
48 cx18_write_reg_expect(cx, value, 0xc40000 + addr, eval, mask); in cx18_av_write4_expect()
52 int cx18_av_write4_noretry(struct cx18 *cx, u16 addr, u32 value) in cx18_av_write4_noretry() argument
54 cx18_write_reg_noretry(cx, value, 0xc40000 + addr); in cx18_av_write4_noretry()
58 u8 cx18_av_read(struct cx18 *cx, u16 addr) in cx18_av_read() argument
60 u32 x = cx18_read_reg(cx, 0xc40000 + (addr & ~3)); in cx18_av_read()
66 u32 cx18_av_read4(struct cx18 *cx, u16 addr) in cx18_av_read4() argument
68 return cx18_read_reg(cx, 0xc40000 + addr); in cx18_av_read4()
71 int cx18_av_and_or(struct cx18 *cx, u16 addr, unsigned and_mask, in cx18_av_and_or() argument
74 return cx18_av_write(cx, addr, in cx18_av_and_or()
75 (cx18_av_read(cx, addr) & and_mask) | in cx18_av_and_or()
79 int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 and_mask, in cx18_av_and_or4() argument
82 return cx18_av_write4(cx, addr, in cx18_av_and_or4()
83 (cx18_av_read4(cx, addr) & and_mask) | in cx18_av_and_or4()
87 static void cx18_av_init(struct cx18 *cx) in cx18_av_init() argument
99 cx18_av_write4(cx, CXADEC_PLL_CTRL1, 0x160e040f); in cx18_av_init()
103 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, 0x002be2fe); in cx18_av_init()
107 cx18_av_write4(cx, CXADEC_AUX_PLL_FRAC, 0x005227ad); in cx18_av_init()
110 cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56); in cx18_av_init()
116 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_initialize() local
120 cx18_av_loadfw(cx); in cx18_av_initialize()
122 cx18_av_write4_expect(cx, CXADEC_DL_CTL, 0x03000000, in cx18_av_initialize()
126 v = cx18_av_read4(cx, CXADEC_HOST_REG1); in cx18_av_initialize()
128 cx18_av_write4_expect(cx, CXADEC_HOST_REG1, v | 1, v, 0xfffe); in cx18_av_initialize()
130 cx18_av_write4_expect(cx, CXADEC_HOST_REG1, v & 0xfffe, in cx18_av_initialize()
134 v = cx18_av_read4(cx, CXADEC_DLL1_DIAG_CTRL) & 0xE1FFFEFF; in cx18_av_initialize()
136 cx18_av_write4(cx, CXADEC_DLL1_DIAG_CTRL, v); in cx18_av_initialize()
138 cx18_av_write4(cx, CXADEC_DLL1_DIAG_CTRL, v | 0x10000100); in cx18_av_initialize()
140 v = cx18_av_read4(cx, CXADEC_DLL2_DIAG_CTRL) & 0xE1FFFEFF; in cx18_av_initialize()
142 cx18_av_write4(cx, CXADEC_DLL2_DIAG_CTRL, v); in cx18_av_initialize()
144 cx18_av_write4(cx, CXADEC_DLL2_DIAG_CTRL, v | 0x06000100); in cx18_av_initialize()
147 cx18_av_write4(cx, CXADEC_AFE_DIAG_CTRL1, 0x000A1802); in cx18_av_initialize()
149 v = cx18_av_read4(cx, CXADEC_AFE_DIAG_CTRL3) | 1; in cx18_av_initialize()
151 cx18_av_write4_expect(cx, CXADEC_AFE_DIAG_CTRL3, v, v, 0x03009F0F); in cx18_av_initialize()
153 cx18_av_write4_expect(cx, CXADEC_AFE_DIAG_CTRL3, in cx18_av_initialize()
157 cx18_av_and_or4(cx, CXADEC_PIN_CTRL1, ~0, 0x040C00); in cx18_av_initialize()
160 cx18_av_and_or4(cx, CXADEC_PIN_CTRL2, ~0, 0x2); in cx18_av_initialize()
163 cx18_av_write4(cx, CXADEC_SOFT_RST_CTRL, 0x8000); in cx18_av_initialize()
164 cx18_av_write4(cx, CXADEC_SOFT_RST_CTRL, 0); in cx18_av_initialize()
181 cx18_av_and_or4(cx, CXADEC_CHIP_CTRL, 0xFFFBFFFF, 0x00120000); in cx18_av_initialize()
184 cx18_av_init(cx); in cx18_av_initialize()
189 cx18_av_and_or4(cx, CXADEC_MODE_CTRL, 0xFFF7E7F0, 0x02040800); in cx18_av_initialize()
193 cx18_av_and_or4(cx, CXADEC_CRUSH_CTRL, ~0, 0x00500000); in cx18_av_initialize()
196 cx18_av_and_or4(cx, CXADEC_DFE_CTRL2, 0xFFFF00FF, 0x00002000); in cx18_av_initialize()
205 cx18_av_write4(cx, CXADEC_OUT_CTRL1, 0x4013252e); in cx18_av_initialize()
228 cx18_av_and_or4(cx, CXADEC_AFE_CTRL, 0xFF000000, 0x00005D00); in cx18_av_initialize()
235 cx18_av_write4(cx, CXADEC_SRC_COMB_CFG, 0x6628021F); in cx18_av_initialize()
236 default_volume = cx18_av_read(cx, 0x8d4); in cx18_av_initialize()
244 cx18_av_write(cx, 0x8d4, 228); in cx18_av_initialize()
248 cx18_av_write(cx, 0x8d4, 20); in cx18_av_initialize()
273 void cx18_av_std_setup(struct cx18 *cx) in cx18_av_std_setup() argument
275 struct cx18_av_state *state = &cx->av_state; in cx18_av_std_setup()
292 cx18_av_write(cx, 0x49f, 0x11); in cx18_av_std_setup()
294 cx18_av_write(cx, 0x49f, 0x14); in cx18_av_std_setup()
440 pll_int = cx18_av_read(cx, 0x108); in cx18_av_std_setup()
441 pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff; in cx18_av_std_setup()
442 pll_post = cx18_av_read(cx, 0x109); in cx18_av_std_setup()
476 cx18_av_write(cx, 0x470, hblank); in cx18_av_std_setup()
477 cx18_av_write(cx, 0x471, in cx18_av_std_setup()
479 cx18_av_write(cx, 0x472, hactive >> 4); in cx18_av_std_setup()
482 cx18_av_write(cx, 0x473, burst); in cx18_av_std_setup()
485 cx18_av_write(cx, 0x474, vblank); in cx18_av_std_setup()
486 cx18_av_write(cx, 0x475, in cx18_av_std_setup()
488 cx18_av_write(cx, 0x476, vactive >> 4); in cx18_av_std_setup()
489 cx18_av_write(cx, 0x477, vblank656); in cx18_av_std_setup()
492 cx18_av_write(cx, 0x478, src_decimation & 0xff); in cx18_av_std_setup()
493 cx18_av_write(cx, 0x479, (src_decimation >> 8) & 0xff); in cx18_av_std_setup()
496 cx18_av_write(cx, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30)); in cx18_av_std_setup()
499 cx18_av_write(cx, 0x47b, comb); in cx18_av_std_setup()
502 cx18_av_write(cx, 0x47c, sc); in cx18_av_std_setup()
503 cx18_av_write(cx, 0x47d, (sc >> 8) & 0xff); in cx18_av_std_setup()
504 cx18_av_write(cx, 0x47e, (sc >> 16) & 0xff); in cx18_av_std_setup()
513 cx18_av_write(cx, 0x47f, state->slicer_line_delay); in cx18_av_std_setup()
516 static void input_change(struct cx18 *cx) in input_change() argument
518 struct cx18_av_state *state = &cx->av_state; in input_change()
523 cx18_av_write(cx, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11); in input_change()
524 cx18_av_and_or(cx, 0x401, ~0x60, 0); in input_change()
525 cx18_av_and_or(cx, 0x401, ~0x60, 0x60); in input_change()
530 cx18_av_write_expect(cx, 0x808, 0xf7, 0xf7, 0xff); in input_change()
531 cx18_av_write_expect(cx, 0x80b, 0x02, 0x02, 0x3f); in input_change()
534 cx18_av_write_expect(cx, 0x808, 0xf8, 0xf8, 0xff); in input_change()
535 cx18_av_write_expect(cx, 0x80b, 0x03, 0x03, 0x3f); in input_change()
538 cx18_av_write_expect(cx, 0x808, 0xf6, 0xf6, 0xff); in input_change()
539 cx18_av_write_expect(cx, 0x80b, 0x01, 0x01, 0x3f); in input_change()
543 cx18_av_write_expect(cx, 0x808, 0xff, 0xff, 0xff); in input_change()
544 cx18_av_write_expect(cx, 0x80b, 0x03, 0x03, 0x3f); in input_change()
547 cx18_av_write_expect(cx, 0x808, 0xff, 0xff, 0xff); in input_change()
548 cx18_av_write_expect(cx, 0x80b, 0x03, 0x03, 0x3f); in input_change()
551 v = cx18_av_read(cx, 0x803); in input_change()
555 cx18_av_write_expect(cx, 0x803, v, v, 0x1f); in input_change()
557 cx18_av_write_expect(cx, 0x803, v, v, 0x1f); in input_change()
564 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_frequency() local
565 input_change(cx); in cx18_av_s_frequency()
569 static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, in set_input() argument
572 struct cx18_av_state *state = &cx->av_state; in set_input()
676 cx18_av_write_expect(cx, 0x103, afe_mux_cfg, afe_mux_cfg, 0xf7); in set_input()
678 cx18_av_and_or(cx, 0x401, ~0x6, input_mode); in set_input()
681 adc2_cfg = cx18_av_read(cx, 0x102); in set_input()
692 cx18_av_write_expect(cx, 0x102, adc2_cfg, adc2_cfg, 0x17); in set_input()
695 afe_cfg = cx18_av_read4(cx, CXADEC_AFE_CTRL); in set_input()
733 cx18_av_write4(cx, CXADEC_AFE_CTRL, afe_cfg); in set_input()
737 cx18_av_audio_set_path(cx); in set_input()
738 input_change(cx); in set_input()
746 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_video_routing() local
747 return set_input(cx, input, state->aud_input); in cx18_av_s_video_routing()
754 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_audio_routing() local
755 return set_input(cx, state->vid_input, input); in cx18_av_s_audio_routing()
761 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_g_tuner() local
769 vpres = cx18_av_read(cx, 0x40e) & 0x20; in cx18_av_g_tuner()
776 mode = cx18_av_read(cx, 0x804); in cx18_av_g_tuner()
798 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_tuner() local
804 v = cx18_av_read(cx, 0x809); in cx18_av_s_tuner()
835 cx18_av_write_expect(cx, 0x809, v, v, 0xff); in cx18_av_s_tuner()
843 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_std() local
885 cx18_av_and_or(cx, 0x400, ~0xf, 1); in cx18_av_s_std()
887 cx18_av_and_or(cx, 0x47b, ~6, 0); in cx18_av_s_std()
889 cx18_av_and_or(cx, 0x400, ~0x2f, fmt | 0x20); in cx18_av_s_std()
890 cx18_av_and_or(cx, 0x403, ~0x3, pal_m); in cx18_av_s_std()
891 cx18_av_std_setup(cx); in cx18_av_s_std()
892 input_change(cx); in cx18_av_s_std()
906 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_ctrl() local
910 cx18_av_write(cx, 0x414, ctrl->val - 128); in cx18_av_s_ctrl()
914 cx18_av_write(cx, 0x415, ctrl->val << 1); in cx18_av_s_ctrl()
918 cx18_av_write(cx, 0x420, ctrl->val << 1); in cx18_av_s_ctrl()
919 cx18_av_write(cx, 0x421, ctrl->val << 1); in cx18_av_s_ctrl()
923 cx18_av_write(cx, 0x422, ctrl->val); in cx18_av_s_ctrl()
938 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_set_fmt() local
948 Vsrc = (cx18_av_read(cx, 0x476) & 0x3f) << 4; in cx18_av_set_fmt()
949 Vsrc |= (cx18_av_read(cx, 0x475) & 0xf0) >> 4; in cx18_av_set_fmt()
951 Hsrc = (cx18_av_read(cx, 0x472) & 0x3f) << 4; in cx18_av_set_fmt()
952 Hsrc |= (cx18_av_read(cx, 0x471) & 0xf0) >> 4; in cx18_av_set_fmt()
998 cx18_av_write(cx, 0x418, HSC & 0xff); in cx18_av_set_fmt()
999 cx18_av_write(cx, 0x419, (HSC >> 8) & 0xff); in cx18_av_set_fmt()
1000 cx18_av_write(cx, 0x41a, HSC >> 16); in cx18_av_set_fmt()
1002 cx18_av_write(cx, 0x41c, VSC & 0xff); in cx18_av_set_fmt()
1003 cx18_av_write(cx, 0x41d, VSC >> 8); in cx18_av_set_fmt()
1005 cx18_av_write(cx, 0x41e, 0x8 | filter); in cx18_av_set_fmt()
1011 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_stream() local
1015 cx18_av_write(cx, 0x115, 0x8c); in cx18_av_s_stream()
1016 cx18_av_write(cx, 0x116, 0x07); in cx18_av_s_stream()
1018 cx18_av_write(cx, 0x115, 0x00); in cx18_av_s_stream()
1019 cx18_av_write(cx, 0x116, 0x00); in cx18_av_s_stream()
1024 static void log_video_status(struct cx18 *cx) in log_video_status() argument
1035 struct cx18_av_state *state = &cx->av_state; in log_video_status()
1037 u8 vidfmt_sel = cx18_av_read(cx, 0x400) & 0xf; in log_video_status()
1038 u8 gen_stat1 = cx18_av_read(cx, 0x40d); in log_video_status()
1039 u8 gen_stat2 = cx18_av_read(cx, 0x40e); in log_video_status()
1065 static void log_audio_status(struct cx18 *cx) in log_audio_status() argument
1067 struct cx18_av_state *state = &cx->av_state; in log_audio_status()
1069 u8 download_ctl = cx18_av_read(cx, 0x803); in log_audio_status()
1070 u8 mod_det_stat0 = cx18_av_read(cx, 0x804); in log_audio_status()
1071 u8 mod_det_stat1 = cx18_av_read(cx, 0x805); in log_audio_status()
1072 u8 audio_config = cx18_av_read(cx, 0x808); in log_audio_status()
1073 u8 pref_mode = cx18_av_read(cx, 0x809); in log_audio_status()
1074 u8 afc0 = cx18_av_read(cx, 0x80b); in log_audio_status()
1075 u8 mute_ctl = cx18_av_read(cx, 0x8d3); in log_audio_status()
1216 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_log_status() local
1217 log_video_status(cx); in cx18_av_log_status()
1218 log_audio_status(cx); in cx18_av_log_status()
1226 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_g_register() local
1231 reg->val = cx18_av_read4(cx, reg->reg & 0x00000ffc); in cx18_av_g_register()
1238 struct cx18 *cx = v4l2_get_subdevdata(sd); in cx18_av_s_register() local
1242 cx18_av_write4(cx, reg->reg & 0x00000ffc, reg->val); in cx18_av_s_register()
1299 int cx18_av_probe(struct cx18 *cx) in cx18_av_probe() argument
1301 struct cx18_av_state *state = &cx->av_state; in cx18_av_probe()
1305 state->rev = cx18_av_read4(cx, CXADEC_CHIP_CTRL) & 0xffff; in cx18_av_probe()
1316 v4l2_set_subdevdata(sd, cx); in cx18_av_probe()
1318 "%s %03x", cx->v4l2_dev.name, (state->rev >> 4)); in cx18_av_probe()
1352 err = v4l2_device_register_subdev(&cx->v4l2_dev, sd); in cx18_av_probe()
1356 cx18_av_init(cx); in cx18_av_probe()