Lines Matching full:sd

226 	struct v4l2_subdev sd;  member
296 static inline struct tda1997x_state *to_state(struct v4l2_subdev *sd) in to_state() argument
298 return container_of(sd, struct tda1997x_state, sd); in to_state()
303 return &container_of(ctrl->handler, struct tda1997x_state, hdl)->sd; in to_sd()
306 static int tda1997x_cec_read(struct v4l2_subdev *sd, u8 reg) in tda1997x_cec_read() argument
308 struct tda1997x_state *state = to_state(sd); in tda1997x_cec_read()
320 static int tda1997x_cec_write(struct v4l2_subdev *sd, u8 reg, u8 val) in tda1997x_cec_write() argument
322 struct tda1997x_state *state = to_state(sd); in tda1997x_cec_write()
339 static int tda1997x_setpage(struct v4l2_subdev *sd, u8 page) in tda1997x_setpage() argument
341 struct tda1997x_state *state = to_state(sd); in tda1997x_setpage()
358 static inline int io_read(struct v4l2_subdev *sd, u16 reg) in io_read() argument
360 struct tda1997x_state *state = to_state(sd); in io_read()
364 if (tda1997x_setpage(sd, reg >> 8)) { in io_read()
381 static inline long io_read16(struct v4l2_subdev *sd, u16 reg) in io_read16() argument
386 val = io_read(sd, reg); in io_read16()
390 val = io_read(sd, reg + 1); in io_read16()
398 static inline long io_read24(struct v4l2_subdev *sd, u16 reg) in io_read24() argument
403 val = io_read(sd, reg); in io_read24()
407 val = io_read(sd, reg + 1); in io_read24()
411 val = io_read(sd, reg + 2); in io_read24()
419 static unsigned int io_readn(struct v4l2_subdev *sd, u16 reg, u8 len, u8 *data) in io_readn() argument
426 val = io_read(sd, reg + i); in io_readn()
436 static int io_write(struct v4l2_subdev *sd, u16 reg, u8 val) in io_write() argument
438 struct tda1997x_state *state = to_state(sd); in io_write()
442 if (tda1997x_setpage(sd, reg >> 8)) { in io_write()
460 static int io_write16(struct v4l2_subdev *sd, u16 reg, u16 val) in io_write16() argument
464 ret = io_write(sd, reg, (val >> 8) & 0xff); in io_write16()
467 ret = io_write(sd, reg + 1, val & 0xff); in io_write16()
473 static int io_write24(struct v4l2_subdev *sd, u16 reg, u32 val) in io_write24() argument
477 ret = io_write(sd, reg, (val >> 16) & 0xff); in io_write24()
480 ret = io_write(sd, reg + 1, (val >> 8) & 0xff); in io_write24()
483 ret = io_write(sd, reg + 2, val & 0xff); in io_write24()
502 static int tda1997x_manual_hpd(struct v4l2_subdev *sd, enum hpd_mode mode) in tda1997x_manual_hpd() argument
506 hpd_auto = io_read(sd, REG_HPD_AUTO_CTRL); in tda1997x_manual_hpd()
507 hpd_pwr = io_read(sd, REG_HPD_POWER); in tda1997x_manual_hpd()
508 hpd_man = io_read(sd, REG_HPD_MAN_CTRL); in tda1997x_manual_hpd()
523 io_write(sd, REG_HPD_POWER, hpd_pwr); in tda1997x_manual_hpd()
524 io_write(sd, REG_HPD_MAN_CTRL, hpd_man); in tda1997x_manual_hpd()
531 io_write(sd, REG_HPD_POWER, hpd_pwr); in tda1997x_manual_hpd()
539 io_write(sd, REG_HPD_AUTO_CTRL, hpd_auto); in tda1997x_manual_hpd()
540 io_write(sd, REG_HPD_MAN_CTRL, hpd_man); in tda1997x_manual_hpd()
545 io_write(sd, REG_HPD_AUTO_CTRL, hpd_auto); in tda1997x_manual_hpd()
551 io_write(sd, REG_HPD_MAN_CTRL, hpd_man); in tda1997x_manual_hpd()
564 struct v4l2_subdev *sd = &state->sd; in tda1997x_delayed_work_enable_hpd() local
566 v4l2_dbg(2, debug, sd, "%s\n", __func__); in tda1997x_delayed_work_enable_hpd()
569 tda1997x_manual_hpd(sd, HPD_HIGH_OTHER); in tda1997x_delayed_work_enable_hpd()
570 tda1997x_manual_hpd(sd, HPD_HIGH_BP); in tda1997x_delayed_work_enable_hpd()
575 static void tda1997x_disable_edid(struct v4l2_subdev *sd) in tda1997x_disable_edid() argument
577 struct tda1997x_state *state = to_state(sd); in tda1997x_disable_edid()
579 v4l2_dbg(1, debug, sd, "%s\n", __func__); in tda1997x_disable_edid()
583 tda1997x_manual_hpd(sd, HPD_LOW_BP); in tda1997x_disable_edid()
586 static void tda1997x_enable_edid(struct v4l2_subdev *sd) in tda1997x_enable_edid() argument
588 struct tda1997x_state *state = to_state(sd); in tda1997x_enable_edid()
590 v4l2_dbg(1, debug, sd, "%s\n", __func__); in tda1997x_enable_edid()
645 tda1997x_configure_csc(struct v4l2_subdev *sd) in tda1997x_configure_csc() argument
647 struct tda1997x_state *state = to_state(sd); in tda1997x_configure_csc()
705 reg = io_read(sd, REG_VDP_CTRL); in tda1997x_configure_csc()
707 io_write(sd, REG_VDP_CTRL, reg); in tda1997x_configure_csc()
709 io_write16(sd, REG_VDP_MATRIX + 0, state->conv->offint1); in tda1997x_configure_csc()
710 io_write16(sd, REG_VDP_MATRIX + 2, state->conv->offint2); in tda1997x_configure_csc()
711 io_write16(sd, REG_VDP_MATRIX + 4, state->conv->offint3); in tda1997x_configure_csc()
713 io_write16(sd, REG_VDP_MATRIX + 6, state->conv->p11coef); in tda1997x_configure_csc()
714 io_write16(sd, REG_VDP_MATRIX + 8, state->conv->p12coef); in tda1997x_configure_csc()
715 io_write16(sd, REG_VDP_MATRIX + 10, state->conv->p13coef); in tda1997x_configure_csc()
716 io_write16(sd, REG_VDP_MATRIX + 12, state->conv->p21coef); in tda1997x_configure_csc()
717 io_write16(sd, REG_VDP_MATRIX + 14, state->conv->p22coef); in tda1997x_configure_csc()
718 io_write16(sd, REG_VDP_MATRIX + 16, state->conv->p23coef); in tda1997x_configure_csc()
719 io_write16(sd, REG_VDP_MATRIX + 18, state->conv->p31coef); in tda1997x_configure_csc()
720 io_write16(sd, REG_VDP_MATRIX + 20, state->conv->p32coef); in tda1997x_configure_csc()
721 io_write16(sd, REG_VDP_MATRIX + 22, state->conv->p33coef); in tda1997x_configure_csc()
723 io_write16(sd, REG_VDP_MATRIX + 24, state->conv->offout1); in tda1997x_configure_csc()
724 io_write16(sd, REG_VDP_MATRIX + 26, state->conv->offout2); in tda1997x_configure_csc()
725 io_write16(sd, REG_VDP_MATRIX + 28, state->conv->offout3); in tda1997x_configure_csc()
728 reg = io_read(sd, REG_VDP_CTRL); in tda1997x_configure_csc()
730 io_write(sd, REG_VDP_CTRL, reg); in tda1997x_configure_csc()
735 io_write16(sd, REG_BLK_GY, blanking_codes->code_gy); in tda1997x_configure_csc()
736 io_write16(sd, REG_BLK_BU, blanking_codes->code_bu); in tda1997x_configure_csc()
737 io_write16(sd, REG_BLK_RV, blanking_codes->code_rv); in tda1997x_configure_csc()
743 tda1997x_configure_vhref(struct v4l2_subdev *sd) in tda1997x_configure_vhref() argument
745 struct tda1997x_state *state = to_state(sd); in tda1997x_configure_vhref()
782 io_write16(sd, REG_FDW_S, 0x2ef); /* start position */ in tda1997x_configure_vhref()
783 io_write16(sd, REG_FDW_E, 0x141); /* end position */ in tda1997x_configure_vhref()
787 io_write16(sd, REG_PXCNT_PR, 4); in tda1997x_configure_vhref()
789 io_write16(sd, REG_PXCNT_PR, 1); in tda1997x_configure_vhref()
790 io_write16(sd, REG_PXCNT_NPIX, width & MASK_VHREF); in tda1997x_configure_vhref()
791 io_write16(sd, REG_LCNT_PR, 1); in tda1997x_configure_vhref()
792 io_write16(sd, REG_LCNT_NLIN, lines & MASK_VHREF); in tda1997x_configure_vhref()
800 io_write(sd, REG_VHREF_CTRL, reg); in tda1997x_configure_vhref()
809 io_write16(sd, REG_HREF_S, href_start & MASK_VHREF); in tda1997x_configure_vhref()
810 io_write16(sd, REG_HREF_E, href_end & MASK_VHREF); in tda1997x_configure_vhref()
812 io_write16(sd, REG_VREF_F1_S, vref_f1_start & MASK_VHREF); in tda1997x_configure_vhref()
813 io_write(sd, REG_VREF_F1_WIDTH, vref_f1_width); in tda1997x_configure_vhref()
815 io_write16(sd, REG_VREF_F2_S, vref_f2_start & MASK_VHREF); in tda1997x_configure_vhref()
816 io_write(sd, REG_VREF_F2_WIDTH, vref_f2_width); in tda1997x_configure_vhref()
821 io_write16(sd, REG_FREF_F1_S, reg); in tda1997x_configure_vhref()
823 io_write16(sd, REG_FREF_F2_S, reg); in tda1997x_configure_vhref()
830 struct v4l2_subdev *sd = &state->sd; in tda1997x_configure_vidout() local
840 io_write(sd, REG_PCLK, reg); in tda1997x_configure_vidout()
851 io_write(sd, REG_FILTERS_CTRL, prefilter); in tda1997x_configure_vidout()
858 io_write(sd, REG_OF, reg); in tda1997x_configure_vidout()
861 reg = io_read(sd, REG_VDP_CTRL); in tda1997x_configure_vidout()
876 io_write(sd, REG_VDP_CTRL, reg); in tda1997x_configure_vidout()
882 io_write(sd, REG_DE_FREF, reg); in tda1997x_configure_vidout()
891 io_write(sd, REG_HS_HREF, reg); in tda1997x_configure_vidout()
900 io_write(sd, REG_VS_VREF, reg); in tda1997x_configure_vidout()
907 tda1997x_configure_audout(struct v4l2_subdev *sd, u8 channel_assignment) in tda1997x_configure_audout() argument
909 struct tda1997x_state *state = to_state(sd); in tda1997x_configure_audout()
918 io_write(sd, REG_AUDIO_PATH, channel_assignment); in tda1997x_configure_audout()
965 io_write(sd, REG_AUDCFG, reg); in tda1997x_configure_audout()
973 io_write(sd, REG_AUDIO_LAYOUT, reg); in tda1997x_configure_audout()
976 io_write(sd, REG_FIFO_LATENCY_VAL, 0x80); in tda1997x_configure_audout()
1008 io_write(sd, REG_AUDIO_OUT_ENABLE, reg); in tda1997x_configure_audout()
1011 io_write(sd, REG_TEST_MODE, 0x00); in tda1997x_configure_audout()
1018 tda1997x_hdmi_info_reset(struct v4l2_subdev *sd, u8 info_rst, bool reset_sus) in tda1997x_hdmi_info_reset() argument
1023 reg = io_read(sd, REG_HDMI_INFO_RST); in tda1997x_hdmi_info_reset()
1024 io_write(sd, REG_HDMI_INFO_RST, info_rst); in tda1997x_hdmi_info_reset()
1028 reg = io_read(sd, REG_INT_FLG_CLR_MODE); in tda1997x_hdmi_info_reset()
1029 io_write(sd, REG_INT_FLG_CLR_MODE, reg); in tda1997x_hdmi_info_reset()
1033 reg = io_read(sd, REG_RATE_CTRL); in tda1997x_hdmi_info_reset()
1037 reg = io_write(sd, REG_RATE_CTRL, reg); in tda1997x_hdmi_info_reset()
1045 struct v4l2_subdev *sd = &state->sd; in tda1997x_power_mode() local
1050 io_write(sd, REG_PON_OVR_EN, PON_DIS); in tda1997x_power_mode()
1052 io_write(sd, REG_CFG1, PON_EN); in tda1997x_power_mode()
1054 io_write(sd, REG_DEEP_PLL7_BYP, PON_DIS); in tda1997x_power_mode()
1056 reg = io_read(sd, REG_OF); in tda1997x_power_mode()
1058 io_write(sd, REG_OF, reg); in tda1997x_power_mode()
1062 reg = io_read(sd, REG_OF); in tda1997x_power_mode()
1064 io_write(sd, REG_OF, reg); in tda1997x_power_mode()
1066 io_write(sd, REG_DEEP_PLL7_BYP, PON_EN); in tda1997x_power_mode()
1068 io_write(sd, REG_CFG1, PON_DIS); in tda1997x_power_mode()
1070 io_write(sd, REG_PON_OVR_EN, PON_EN); in tda1997x_power_mode()
1075 tda1997x_detect_tx_5v(struct v4l2_subdev *sd) in tda1997x_detect_tx_5v() argument
1077 u8 reg = io_read(sd, REG_DETECT_5V); in tda1997x_detect_tx_5v()
1083 tda1997x_detect_tx_hpd(struct v4l2_subdev *sd) in tda1997x_detect_tx_hpd() argument
1085 u8 reg = io_read(sd, REG_DETECT_5V); in tda1997x_detect_tx_hpd()
1094 struct v4l2_subdev *sd = &state->sd; in tda1997x_detect_std() local
1110 vper = io_read24(sd, REG_V_PER); in tda1997x_detect_std()
1111 hper = io_read16(sd, REG_H_PER); in tda1997x_detect_std()
1112 hsper = io_read16(sd, REG_HS_WIDTH); in tda1997x_detect_std()
1119 v4l2_dbg(1, debug, sd, "Signal Timings: %u/%u/%u\n", vper, hper, hsper); in tda1997x_detect_std()
1121 htot = io_read16(sd, REG_FMT_H_TOT); in tda1997x_detect_std()
1122 hact = io_read16(sd, REG_FMT_H_ACT); in tda1997x_detect_std()
1123 hfront = io_read16(sd, REG_FMT_H_FRONT); in tda1997x_detect_std()
1124 hsync = io_read16(sd, REG_FMT_H_SYNC); in tda1997x_detect_std()
1125 hback = io_read16(sd, REG_FMT_H_BACK); in tda1997x_detect_std()
1127 vtot = io_read16(sd, REG_FMT_V_TOT); in tda1997x_detect_std()
1128 vact = io_read16(sd, REG_FMT_V_ACT); in tda1997x_detect_std()
1129 vfront1 = io_read(sd, REG_FMT_V_FRONT_F1); in tda1997x_detect_std()
1130 vfront2 = io_read(sd, REG_FMT_V_FRONT_F2); in tda1997x_detect_std()
1131 vsync = io_read(sd, REG_FMT_V_SYNC); in tda1997x_detect_std()
1132 vback1 = io_read(sd, REG_FMT_V_BACK_F1); in tda1997x_detect_std()
1133 vback2 = io_read(sd, REG_FMT_V_BACK_F2); in tda1997x_detect_std()
1135 v4l2_dbg(1, debug, sd, "Geometry: H %u %u %u %u %u Sync%c V %u %u %u %u %u %u %u Sync%c\n", in tda1997x_detect_std()
1169 v4l2_print_dv_timings(sd->name, "Detected format: ", timings, false); in tda1997x_detect_std()
1176 struct v4l2_subdev *sd = &state->sd; in tda1997x_reset_n1() local
1180 io_write(sd, REG_CLK_CFG, CLK_CFG_SEL_ACLK_EN | CLK_CFG_SEL_ACLK); in tda1997x_reset_n1()
1181 io_write(sd, REG_PON_OVR_EN, PON_EN); in tda1997x_reset_n1()
1182 io_write(sd, REG_PON_CBIAS, PON_EN); in tda1997x_reset_n1()
1183 io_write(sd, REG_PON_PLL, PON_EN); in tda1997x_reset_n1()
1185 reg = io_read(sd, REG_MODE_REC_CFG1); in tda1997x_reset_n1()
1188 io_write(sd, REG_MODE_REC_CFG1, reg); in tda1997x_reset_n1()
1189 io_write(sd, REG_CLK_CFG, CLK_CFG_DIS); in tda1997x_reset_n1()
1190 io_write(sd, REG_PON_OVR_EN, PON_DIS); in tda1997x_reset_n1()
1191 reg = io_read(sd, REG_MODE_REC_CFG1); in tda1997x_reset_n1()
1193 io_write(sd, REG_MODE_REC_CFG1, reg); in tda1997x_reset_n1()
1203 tda1997x_read_activity_status_regs(struct v4l2_subdev *sd) in tda1997x_read_activity_status_regs() argument
1208 reg = io_read(sd, REG_CLK_A_STATUS); in tda1997x_read_activity_status_regs()
1215 reg = io_read(sd, REG_CLK_B_STATUS); in tda1997x_read_activity_status_regs()
1222 reg = io_read(sd, REG_SUS_STATUS); in tda1997x_read_activity_status_regs()
1264 struct v4l2_subdev *sd = &state->sd; in tda1997x_parse_infoframe() local
1271 len = io_readn(sd, addr, sizeof(buffer), buffer); in tda1997x_parse_infoframe()
1333 tda1997x_configure_audout(sd, state->audio_ch_alloc); in tda1997x_parse_infoframe()
1335 tda1997x_hdmi_info_reset(sd, RESET_AUDIO, false); in tda1997x_parse_infoframe()
1345 reg = io_read(sd, REG_PIX_REPEAT); in tda1997x_parse_infoframe()
1349 io_write(sd, REG_PIX_REPEAT, reg); in tda1997x_parse_infoframe()
1352 reg = io_read(sd, REG_PIX_REPEAT); in tda1997x_parse_infoframe()
1355 io_write(sd, REG_PIX_REPEAT, reg); in tda1997x_parse_infoframe()
1358 tda1997x_configure_csc(sd); in tda1997x_parse_infoframe()
1368 struct v4l2_subdev *sd = &state->sd; in tda1997x_irq_sus() local
1371 source = io_read(sd, REG_INT_FLG_CLR_SUS); in tda1997x_irq_sus()
1372 io_write(sd, REG_INT_FLG_CLR_SUS, source); in tda1997x_irq_sus()
1382 reg = io_read(sd, REG_HDMI_INFO_RST); in tda1997x_irq_sus()
1384 io_write(sd, REG_HDMI_INFO_RST, reg); in tda1997x_irq_sus()
1386 io_write(sd, REG_HDMI_INFO_RST, reg); in tda1997x_irq_sus()
1393 reg = io_read(sd, REG_SUS_STATUS); in tda1997x_irq_sus()
1400 reg = io_read(sd, REG_SUS_STATUS); in tda1997x_irq_sus()
1408 v4l2_subdev_notify_event(&state->sd, &tda1997x_ev_fmt); in tda1997x_irq_sus()
1414 struct v4l2_subdev *sd = &state->sd; in tda1997x_irq_ddc() local
1417 source = io_read(sd, REG_INT_FLG_CLR_DDC); in tda1997x_irq_ddc()
1418 io_write(sd, REG_INT_FLG_CLR_DDC, source); in tda1997x_irq_ddc()
1428 tda1997x_detect_tx_5v(sd)); in tda1997x_irq_ddc()
1434 struct v4l2_subdev *sd = &state->sd; in tda1997x_irq_rate() local
1439 source = io_read(sd, REG_INT_FLG_CLR_RATE); in tda1997x_irq_rate()
1440 io_write(sd, REG_INT_FLG_CLR_RATE, source); in tda1997x_irq_rate()
1443 irq_status = tda1997x_read_activity_status_regs(sd); in tda1997x_irq_rate()
1451 irq_status = tda1997x_read_activity_status_regs(sd); in tda1997x_irq_rate()
1452 reg = io_read(sd, REG_INT_FLG_CLR_RATE); in tda1997x_irq_rate()
1453 io_write(sd, REG_INT_FLG_CLR_RATE, reg); in tda1997x_irq_rate()
1471 reg = io_read(sd, REG_PIX_REPEAT); in tda1997x_irq_rate()
1474 io_write(sd, REG_PIX_REPEAT, reg); in tda1997x_irq_rate()
1480 v4l2_subdev_notify_event(sd, &tda1997x_ev_fmt); in tda1997x_irq_rate()
1499 struct v4l2_subdev *sd = &state->sd; in tda1997x_irq_info() local
1502 source = io_read(sd, REG_INT_FLG_CLR_INFO); in tda1997x_irq_info()
1503 io_write(sd, REG_INT_FLG_CLR_INFO, source); in tda1997x_irq_info()
1526 struct v4l2_subdev *sd = &state->sd; in tda1997x_irq_audio() local
1529 source = io_read(sd, REG_INT_FLG_CLR_AUDIO); in tda1997x_irq_audio()
1530 io_write(sd, REG_INT_FLG_CLR_AUDIO, source); in tda1997x_irq_audio()
1536 reg = io_read(sd, REG_SUS_STATUS); in tda1997x_irq_audio()
1538 reg = io_read(sd, REG_HDMI_INFO_RST); in tda1997x_irq_audio()
1540 io_write(sd, REG_HDMI_INFO_RST, reg); in tda1997x_irq_audio()
1542 io_write(sd, REG_HDMI_INFO_RST, reg); in tda1997x_irq_audio()
1552 reg = io_read(sd, REG_AUDIO_FREQ); in tda1997x_irq_audio()
1558 reg = io_read(sd, REG_AUDIO_FLAGS); in tda1997x_irq_audio()
1574 struct v4l2_subdev *sd = &state->sd; in tda1997x_irq_hdcp() local
1577 source = io_read(sd, REG_INT_FLG_CLR_HDCP); in tda1997x_irq_hdcp()
1578 io_write(sd, REG_INT_FLG_CLR_HDCP, source); in tda1997x_irq_hdcp()
1585 reg = io_read(sd, REG_INT_MASK_TOP); in tda1997x_irq_hdcp()
1587 io_write(sd, REG_INT_MASK_TOP, reg); in tda1997x_irq_hdcp()
1595 struct v4l2_subdev *sd = &state->sd; in tda1997x_isr_thread() local
1601 flags = io_read(sd, REG_INT_FLG_CLR_TOP); in tda1997x_isr_thread()
1636 tda1997x_g_input_status(struct v4l2_subdev *sd, u32 *status) in tda1997x_g_input_status() argument
1638 struct tda1997x_state *state = to_state(sd); in tda1997x_g_input_status()
1644 vper = io_read24(sd, REG_V_PER) & MASK_VPER; in tda1997x_g_input_status()
1645 hper = io_read16(sd, REG_H_PER) & MASK_HPER; in tda1997x_g_input_status()
1646 hsper = io_read16(sd, REG_HS_WIDTH) & MASK_HSWIDTH; in tda1997x_g_input_status()
1658 v4l2_dbg(1, debug, sd, "inputs:%d/%d timings:%d/%d/%d\n", in tda1997x_g_input_status()
1672 static int tda1997x_s_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in tda1997x_s_dv_timings() argument
1675 struct tda1997x_state *state = to_state(sd); in tda1997x_s_dv_timings()
1689 tda1997x_configure_vhref(sd); in tda1997x_s_dv_timings()
1691 tda1997x_configure_csc(sd); in tda1997x_s_dv_timings()
1697 static int tda1997x_g_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in tda1997x_g_dv_timings() argument
1700 struct tda1997x_state *state = to_state(sd); in tda1997x_g_dv_timings()
1710 static int tda1997x_query_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in tda1997x_query_dv_timings() argument
1713 struct tda1997x_state *state = to_state(sd); in tda1997x_query_dv_timings()
1734 static int tda1997x_init_state(struct v4l2_subdev *sd, in tda1997x_init_state() argument
1737 struct tda1997x_state *state = to_state(sd); in tda1997x_init_state()
1746 static int tda1997x_enum_mbus_code(struct v4l2_subdev *sd, in tda1997x_enum_mbus_code() argument
1750 struct tda1997x_state *state = to_state(sd); in tda1997x_enum_mbus_code()
1778 static int tda1997x_get_format(struct v4l2_subdev *sd, in tda1997x_get_format() argument
1782 struct tda1997x_state *state = to_state(sd); in tda1997x_get_format()
1800 static int tda1997x_set_format(struct v4l2_subdev *sd, in tda1997x_set_format() argument
1804 struct tda1997x_state *state = to_state(sd); in tda1997x_set_format()
1834 tda1997x_configure_csc(sd); in tda1997x_set_format()
1841 static int tda1997x_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) in tda1997x_get_edid() argument
1843 struct tda1997x_state *state = to_state(sd); in tda1997x_get_edid()
1868 static int tda1997x_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) in tda1997x_set_edid() argument
1870 struct tda1997x_state *state = to_state(sd); in tda1997x_set_edid()
1882 tda1997x_disable_edid(sd); in tda1997x_set_edid()
1891 tda1997x_disable_edid(sd); in tda1997x_set_edid()
1895 io_write(sd, REG_EDID_IN_BYTE0 + i, edid->edid[i]); in tda1997x_set_edid()
1899 io_write(sd, REG_EDID_IN_BYTE128 + i, edid->edid[i+128]); in tda1997x_set_edid()
1905 tda1997x_enable_edid(sd); in tda1997x_set_edid()
1910 static int tda1997x_get_dv_timings_cap(struct v4l2_subdev *sd, in tda1997x_get_dv_timings_cap() argument
1917 static int tda1997x_enum_dv_timings(struct v4l2_subdev *sd, in tda1997x_enum_dv_timings() argument
1941 static int tda1997x_log_infoframe(struct v4l2_subdev *sd, int addr) in tda1997x_log_infoframe() argument
1943 struct tda1997x_state *state = to_state(sd); in tda1997x_log_infoframe()
1949 len = io_readn(sd, addr, sizeof(buffer), buffer); in tda1997x_log_infoframe()
1950 v4l2_dbg(1, debug, sd, "infoframe: addr=%d len=%d\n", addr, len); in tda1997x_log_infoframe()
1963 static int tda1997x_log_status(struct v4l2_subdev *sd) in tda1997x_log_status() argument
1965 struct tda1997x_state *state = to_state(sd); in tda1997x_log_status()
1969 v4l2_info(sd, "-----Chip status-----\n"); in tda1997x_log_status()
1970 v4l2_info(sd, "Chip: %s N%d\n", state->info->name, in tda1997x_log_status()
1972 v4l2_info(sd, "EDID Enabled: %s\n", state->edid.present ? "yes" : "no"); in tda1997x_log_status()
1974 v4l2_info(sd, "-----Signal status-----\n"); in tda1997x_log_status()
1975 v4l2_info(sd, "Cable detected (+5V power): %s\n", in tda1997x_log_status()
1976 tda1997x_detect_tx_5v(sd) ? "yes" : "no"); in tda1997x_log_status()
1977 v4l2_info(sd, "HPD detected: %s\n", in tda1997x_log_status()
1978 tda1997x_detect_tx_hpd(sd) ? "yes" : "no"); in tda1997x_log_status()
1980 v4l2_info(sd, "-----Video Timings-----\n"); in tda1997x_log_status()
1983 v4l2_info(sd, "No video detected\n"); in tda1997x_log_status()
1986 v4l2_info(sd, "Invalid signal detected\n"); in tda1997x_log_status()
1989 v4l2_print_dv_timings(sd->name, "Configured format: ", in tda1997x_log_status()
1992 v4l2_info(sd, "-----Color space-----\n"); in tda1997x_log_status()
1993 v4l2_info(sd, "Input color space: %s %s %s", in tda1997x_log_status()
1998 v4l2_info(sd, "Output color space: %s", in tda1997x_log_status()
2000 v4l2_info(sd, "Color space conversion: %s", state->conv ? in tda1997x_log_status()
2003 v4l2_info(sd, "-----Audio-----\n"); in tda1997x_log_status()
2005 v4l2_info(sd, "audio: %dch %dHz\n", state->audio_channels, in tda1997x_log_status()
2008 v4l2_info(sd, "audio: none\n"); in tda1997x_log_status()
2011 v4l2_info(sd, "-----Infoframes-----\n"); in tda1997x_log_status()
2012 tda1997x_log_infoframe(sd, AUD_IF); in tda1997x_log_status()
2013 tda1997x_log_infoframe(sd, SPD_IF); in tda1997x_log_status()
2014 tda1997x_log_infoframe(sd, AVI_IF); in tda1997x_log_status()
2019 static int tda1997x_subscribe_event(struct v4l2_subdev *sd, in tda1997x_subscribe_event() argument
2025 return v4l2_src_change_event_subdev_subscribe(sd, fh, sub); in tda1997x_subscribe_event()
2027 return v4l2_ctrl_subdev_subscribe_event(sd, fh, sub); in tda1997x_subscribe_event()
2059 struct v4l2_subdev *sd = to_sd(ctrl); in tda1997x_s_ctrl() local
2060 struct tda1997x_state *state = to_state(sd); in tda1997x_s_ctrl()
2067 tda1997x_configure_csc(sd); in tda1997x_s_ctrl()
2076 struct v4l2_subdev *sd = to_sd(ctrl); in tda1997x_g_volatile_ctrl() local
2077 struct tda1997x_state *state = to_state(sd); in tda1997x_g_volatile_ctrl()
2091 static int tda1997x_core_init(struct v4l2_subdev *sd) in tda1997x_core_init() argument
2093 struct tda1997x_state *state = to_state(sd); in tda1997x_core_init()
2099 io_write(sd, REG_HPD_AUTO_CTRL, HPD_AUTO_HPD_UNSEL); in tda1997x_core_init()
2101 io_write(sd, REG_MAN_SUS_HDMI_SEL, MAN_DIS_HDCP | MAN_RST_HDCP); in tda1997x_core_init()
2102 io_write(sd, REG_CGU_DBG_SEL, 1 << CGU_DBG_CLK_SEL_SHIFT); in tda1997x_core_init()
2106 io_write(sd, REG_SUS_SET_RGB2, 0x06); in tda1997x_core_init()
2107 io_write(sd, REG_SUS_SET_RGB3, 0x06); in tda1997x_core_init()
2110 io_write(sd, REG_RT_MAN_CTRL, RT_MAN_CTRL_RT | in tda1997x_core_init()
2114 tda1997x_cec_write(sd, REG_PWR_CONTROL & 0xff, 0x04); in tda1997x_core_init()
2116 tda1997x_cec_write(sd, REG_OSC_DIVIDER & 0xff, 0x03); in tda1997x_core_init()
2117 tda1997x_cec_write(sd, REG_EN_OSC_PERIOD_LSB & 0xff, 0xa0); in tda1997x_core_init()
2118 io_write(sd, REG_TIMER_D, 0x54); in tda1997x_core_init()
2120 reg = tda1997x_cec_read(sd, REG_CONTROL & 0xff); in tda1997x_core_init()
2122 tda1997x_cec_write(sd, REG_CONTROL & 0xff, reg); in tda1997x_core_init()
2126 reg = io_read(sd, REG_VERSION); in tda1997x_core_init()
2128 reg = io_read(sd, REG_CMTP_REG10); in tda1997x_core_init()
2131 io_write(sd, REG_INT_MASK_TOP, in tda1997x_core_init()
2135 io_write(sd, REG_INT_MASK_SUS, MASK_MPT | MASK_FMT | MASK_SUS_END); in tda1997x_core_init()
2137 io_write(sd, REG_INT_MASK_RATE, MASK_RATE_B_ST | MASK_RATE_A_ST); in tda1997x_core_init()
2139 io_write(sd, REG_INT_MASK_INFO, in tda1997x_core_init()
2142 io_write(sd, REG_INT_MASK_AUDIO, in tda1997x_core_init()
2146 io_write(sd, REG_INT_MASK_HDCP, MASK_STATE_C5); in tda1997x_core_init()
2148 io_write(sd, REG_INT_MASK_DDC, MASK_DET_5V); in tda1997x_core_init()
2150 io_write(sd, REG_INT_MASK_AFE, 0); in tda1997x_core_init()
2151 io_write(sd, REG_INT_MASK_MODE, 0); in tda1997x_core_init()
2154 io_write(sd, REG_INT_FLG_CLR_TOP, 0xff); in tda1997x_core_init()
2155 io_write(sd, REG_INT_FLG_CLR_SUS, 0xff); in tda1997x_core_init()
2156 io_write(sd, REG_INT_FLG_CLR_DDC, 0xff); in tda1997x_core_init()
2157 io_write(sd, REG_INT_FLG_CLR_RATE, 0xff); in tda1997x_core_init()
2158 io_write(sd, REG_INT_FLG_CLR_MODE, 0xff); in tda1997x_core_init()
2159 io_write(sd, REG_INT_FLG_CLR_INFO, 0xff); in tda1997x_core_init()
2160 io_write(sd, REG_INT_FLG_CLR_AUDIO, 0xff); in tda1997x_core_init()
2161 io_write(sd, REG_INT_FLG_CLR_HDCP, 0xff); in tda1997x_core_init()
2162 io_write(sd, REG_INT_FLG_CLR_AFE, 0xff); in tda1997x_core_init()
2166 io_write(sd, REG_CGU_DBG_SEL, 1 << CGU_DBG_CLK_SEL_SHIFT); in tda1997x_core_init()
2167 io_write24(sd, REG_CLK_MIN_RATE, CLK_MIN_RATE); in tda1997x_core_init()
2168 io_write24(sd, REG_CLK_MAX_RATE, CLK_MAX_RATE); in tda1997x_core_init()
2170 io_write(sd, REG_WDL_CFG, WDL_CFG_VAL); in tda1997x_core_init()
2172 io_write(sd, REG_DEEP_COLOR_CTRL, DC_FILTER_VAL); in tda1997x_core_init()
2174 io_write(sd, REG_SVC_MODE, 0x00); in tda1997x_core_init()
2176 io_write(sd, REG_INFO_CTRL, 0xff); in tda1997x_core_init()
2178 io_write(sd, REG_INFO_EXCEED, 3); in tda1997x_core_init()
2187 tda1997x_hdmi_info_reset(sd, NACK_HDCP, true); in tda1997x_core_init()
2190 tda1997x_manual_hpd(sd, HPD_LOW_BP); in tda1997x_core_init()
2193 io_write(sd, REG_HDCP_BCAPS, HDCP_HDMI | HDCP_FAST_REAUTH); in tda1997x_core_init()
2198 io_write(sd, REG_HDMI_CTRL, reg); in tda1997x_core_init()
2201 tda1997x_hdmi_info_reset(sd, 0, true); in tda1997x_core_init()
2204 reg = io_read(sd, REG_VDP_CTRL); in tda1997x_core_init()
2206 io_write(sd, REG_VDP_CTRL, reg); in tda1997x_core_init()
2215 io_write(sd, REG_VP35_32_CTRL + i, pdata->vidout_port_cfg[i]); in tda1997x_core_init()
2219 tda1997x_configure_audout(sd, 0); in tda1997x_core_init()
2242 io_write(sd, REG_AUDIO_CLOCK, reg); in tda1997x_core_init()
2245 tda1997x_hdmi_info_reset(sd, RESET_AI, false); in tda1997x_core_init()
2247 tda1997x_hdmi_info_reset(sd, RESET_IF, false); in tda1997x_core_init()
2249 tda1997x_hdmi_info_reset(sd, RESET_AUDIO, false); in tda1997x_core_init()
2251 tda1997x_hdmi_info_reset(sd, RESET_GAMUT, false); in tda1997x_core_init()
2254 state->hdmi_status = io_read(sd, REG_HDMI_FLAGS); in tda1997x_core_init()
2256 io_write(sd, REG_EDID_ENABLE, EDID_ENABLE_A_EN | EDID_ENABLE_B_EN); in tda1997x_core_init()
2425 struct v4l2_subdev *sd = &state->sd; in tda1997x_identify_module() local
2430 reg = io_read(sd, REG_CMTP_REG10); in tda1997x_identify_module()
2453 state->chip_revision = io_read(sd, REG_CMTP_REG11); in tda1997x_identify_module()
2471 struct v4l2_subdev *sd = snd_soc_dai_get_drvdata(dai); in tda1997x_pcm_startup() local
2472 struct tda1997x_state *state = to_state(sd); in tda1997x_pcm_startup()
2530 struct v4l2_subdev *sd; in tda1997x_probe() local
2592 sd = &state->sd; in tda1997x_probe()
2593 v4l2_i2c_subdev_init(sd, client, &tda1997x_subdev_ops); in tda1997x_probe()
2594 sd->internal_ops = &tda1997x_internal_ops; in tda1997x_probe()
2595 snprintf(sd->name, sizeof(sd->name), "%s %d-%04x", in tda1997x_probe()
2598 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; in tda1997x_probe()
2599 sd->entity.function = MEDIA_ENT_F_DV_DECODER; in tda1997x_probe()
2600 sd->entity.ops = &tda1997x_media_ops; in tda1997x_probe()
2689 io_write(sd, REG_MAN_SUS_HDMI_SEL, MAN_RST_HDCP | MAN_DIS_HDCP); in tda1997x_probe()
2696 io_write(sd, REG_MAN_SUS_HDMI_SEL, 0x00); in tda1997x_probe()
2697 io_write(sd, REG_VDP_CTRL, 0x1f); in tda1997x_probe()
2715 ret = 0x34 + ((io_read(sd, REG_SLAVE_ADDR)>>4) & 0x03); in tda1997x_probe()
2725 ret = tda1997x_core_init(sd); in tda1997x_probe()
2745 state->sd.ctrl_handler = hdl; in tda1997x_probe()
2754 ret = media_entity_pads_init(&sd->entity, TDA1997X_NUM_PADS, in tda1997x_probe()
2761 ret = v4l2_async_register_subdev(sd); in tda1997x_probe()
2797 media_entity_cleanup(&sd->entity); in tda1997x_probe()
2814 struct v4l2_subdev *sd = i2c_get_clientdata(client); in tda1997x_remove() local
2815 struct tda1997x_state *state = to_state(sd); in tda1997x_remove()
2825 v4l2_async_unregister_subdev(sd); in tda1997x_remove()
2826 media_entity_cleanup(&sd->entity); in tda1997x_remove()