Lines Matching refs:state

205 static bool adv76xx_has_afe(struct adv76xx_state *state)  in adv76xx_has_afe()  argument
207 return state->info->has_afe; in adv76xx_has_afe()
382 static int adv76xx_read_check(struct adv76xx_state *state, in adv76xx_read_check() argument
385 struct i2c_client *client = state->i2c_clients[client_page]; in adv76xx_read_check()
389 err = regmap_read(state->regmap[client_page], reg, &val); in adv76xx_read_check()
405 static int adv76xx_write_block(struct adv76xx_state *state, int client_page, in adv76xx_write_block() argument
409 struct regmap *regmap = state->regmap[client_page]; in adv76xx_write_block()
421 struct adv76xx_state *state = to_state(sd); in io_read() local
423 return adv76xx_read_check(state, ADV76XX_PAGE_IO, reg); in io_read()
428 struct adv76xx_state *state = to_state(sd); in io_write() local
430 return regmap_write(state->regmap[ADV76XX_PAGE_IO], reg, val); in io_write()
440 struct adv76xx_state *state = to_state(sd); in avlink_read() local
442 return adv76xx_read_check(state, ADV7604_PAGE_AVLINK, reg); in avlink_read()
447 struct adv76xx_state *state = to_state(sd); in avlink_write() local
449 return regmap_write(state->regmap[ADV7604_PAGE_AVLINK], reg, val); in avlink_write()
454 struct adv76xx_state *state = to_state(sd); in cec_read() local
456 return adv76xx_read_check(state, ADV76XX_PAGE_CEC, reg); in cec_read()
461 struct adv76xx_state *state = to_state(sd); in cec_write() local
463 return regmap_write(state->regmap[ADV76XX_PAGE_CEC], reg, val); in cec_write()
468 struct adv76xx_state *state = to_state(sd); in infoframe_read() local
470 return adv76xx_read_check(state, ADV76XX_PAGE_INFOFRAME, reg); in infoframe_read()
475 struct adv76xx_state *state = to_state(sd); in infoframe_write() local
477 return regmap_write(state->regmap[ADV76XX_PAGE_INFOFRAME], reg, val); in infoframe_write()
482 struct adv76xx_state *state = to_state(sd); in afe_read() local
484 return adv76xx_read_check(state, ADV76XX_PAGE_AFE, reg); in afe_read()
489 struct adv76xx_state *state = to_state(sd); in afe_write() local
491 return regmap_write(state->regmap[ADV76XX_PAGE_AFE], reg, val); in afe_write()
496 struct adv76xx_state *state = to_state(sd); in rep_read() local
498 return adv76xx_read_check(state, ADV76XX_PAGE_REP, reg); in rep_read()
503 struct adv76xx_state *state = to_state(sd); in rep_write() local
505 return regmap_write(state->regmap[ADV76XX_PAGE_REP], reg, val); in rep_write()
515 struct adv76xx_state *state = to_state(sd); in edid_read() local
517 return adv76xx_read_check(state, ADV76XX_PAGE_EDID, reg); in edid_read()
522 struct adv76xx_state *state = to_state(sd); in edid_write() local
524 return regmap_write(state->regmap[ADV76XX_PAGE_EDID], reg, val); in edid_write()
530 struct adv76xx_state *state = to_state(sd); in edid_write_block() local
543 err = adv76xx_write_block(state, ADV76XX_PAGE_EDID, in edid_write_block()
551 static void adv76xx_set_hpd(struct adv76xx_state *state, unsigned int hpd) in adv76xx_set_hpd() argument
555 for (i = 0; i < state->info->num_dv_ports; ++i) in adv76xx_set_hpd()
556 gpiod_set_value_cansleep(state->hpd_gpio[i], hpd & BIT(i)); in adv76xx_set_hpd()
558 v4l2_subdev_notify(&state->sd, ADV76XX_HOTPLUG, &hpd); in adv76xx_set_hpd()
564 struct adv76xx_state *state = container_of(dwork, struct adv76xx_state, in adv76xx_delayed_work_enable_hotplug() local
566 struct v4l2_subdev *sd = &state->sd; in adv76xx_delayed_work_enable_hotplug()
570 adv76xx_set_hpd(state, state->edid.present); in adv76xx_delayed_work_enable_hotplug()
575 struct adv76xx_state *state = to_state(sd); in hdmi_read() local
577 return adv76xx_read_check(state, ADV76XX_PAGE_HDMI, reg); in hdmi_read()
587 struct adv76xx_state *state = to_state(sd); in hdmi_write() local
589 return regmap_write(state->regmap[ADV76XX_PAGE_HDMI], reg, val); in hdmi_write()
599 struct adv76xx_state *state = to_state(sd); in test_write() local
601 return regmap_write(state->regmap[ADV76XX_PAGE_TEST], reg, val); in test_write()
606 struct adv76xx_state *state = to_state(sd); in cp_read() local
608 return adv76xx_read_check(state, ADV76XX_PAGE_CP, reg); in cp_read()
618 struct adv76xx_state *state = to_state(sd); in cp_write() local
620 return regmap_write(state->regmap[ADV76XX_PAGE_CP], reg, val); in cp_write()
630 struct adv76xx_state *state = to_state(sd); in vdp_read() local
632 return adv76xx_read_check(state, ADV7604_PAGE_VDP, reg); in vdp_read()
637 struct adv76xx_state *state = to_state(sd); in vdp_write() local
639 return regmap_write(state->regmap[ADV7604_PAGE_VDP], reg, val); in vdp_write()
648 struct adv76xx_state *state = to_state(sd); in adv76xx_read_reg() local
653 if (!(BIT(page) & state->info->page_mask)) in adv76xx_read_reg()
657 err = regmap_read(state->regmap[page], reg, &val); in adv76xx_read_reg()
665 struct adv76xx_state *state = to_state(sd); in adv76xx_write_reg() local
668 if (!(BIT(page) & state->info->page_mask)) in adv76xx_write_reg()
673 return regmap_write(state->regmap[page], reg, val); in adv76xx_write_reg()
777 adv76xx_format_info(struct adv76xx_state *state, u32 code) in adv76xx_format_info() argument
781 for (i = 0; i < state->info->nformats; ++i) { in adv76xx_format_info()
782 if (state->info->formats[i].code == code) in adv76xx_format_info()
783 return &state->info->formats[i]; in adv76xx_format_info()
793 struct adv76xx_state *state = to_state(sd); in is_analog_input() local
795 return state->selected_input == ADV7604_PAD_VGA_RGB || in is_analog_input()
796 state->selected_input == ADV7604_PAD_VGA_COMP; in is_analog_input()
801 struct adv76xx_state *state = to_state(sd); in is_digital_input() local
803 return state->selected_input == ADV76XX_PAD_HDMI_PORT_A || in is_digital_input()
804 state->selected_input == ADV7604_PAD_HDMI_PORT_B || in is_digital_input()
805 state->selected_input == ADV7604_PAD_HDMI_PORT_C || in is_digital_input()
806 state->selected_input == ADV7604_PAD_HDMI_PORT_D; in is_digital_input()
892 struct adv76xx_state *state = to_state(sd); in adv76xx_s_detect_tx_5v_ctrl() local
893 const struct adv76xx_chip_info *info = state->info; in adv76xx_s_detect_tx_5v_ctrl()
895 return v4l2_ctrl_s_ctrl(state->detect_tx_5v_ctrl, in adv76xx_s_detect_tx_5v_ctrl()
922 struct adv76xx_state *state = to_state(sd); in configure_predefined_video_timings() local
927 if (adv76xx_has_afe(state)) { in configure_predefined_video_timings()
959 __func__, state->selected_input); in configure_predefined_video_timings()
970 struct adv76xx_state *state = to_state(sd); in configure_custom_video_timings() local
996 if (regmap_raw_write(state->regmap[ADV76XX_PAGE_IO], in configure_custom_video_timings()
1018 __func__, state->selected_input); in configure_custom_video_timings()
1029 struct adv76xx_state *state = to_state(sd); in adv76xx_set_offset() local
1048 if (regmap_raw_write(state->regmap[ADV76XX_PAGE_CP], in adv76xx_set_offset()
1055 struct adv76xx_state *state = to_state(sd); in adv76xx_set_gain() local
1078 if (regmap_raw_write(state->regmap[ADV76XX_PAGE_CP], in adv76xx_set_gain()
1085 struct adv76xx_state *state = to_state(sd); in set_rgb_quantization_range() local
1090 __func__, state->rgb_quantization_range, in set_rgb_quantization_range()
1096 switch (state->rgb_quantization_range) { in set_rgb_quantization_range()
1098 if (state->selected_input == ADV7604_PAD_VGA_RGB) { in set_rgb_quantization_range()
1105 if (state->selected_input == ADV7604_PAD_VGA_COMP) { in set_rgb_quantization_range()
1122 if (state->timings.bt.flags & V4L2_DV_FL_IS_CE_VIDEO) { in set_rgb_quantization_range()
1138 if (state->selected_input == ADV7604_PAD_VGA_COMP) { in set_rgb_quantization_range()
1149 if (state->selected_input == ADV7604_PAD_VGA_COMP) { in set_rgb_quantization_range()
1177 struct adv76xx_state *state = to_state(sd); in adv76xx_s_ctrl() local
1193 state->rgb_quantization_range = ctrl->val; in adv76xx_s_ctrl()
1197 if (!adv76xx_has_afe(state)) in adv76xx_s_ctrl()
1229 struct adv76xx_state *state = to_state(sd); in no_signal_tmds() local
1231 return !(io_read(sd, 0x6a) & (0x10 >> state->selected_input)); in no_signal_tmds()
1236 struct adv76xx_state *state = to_state(sd); in no_lock_tmds() local
1237 const struct adv76xx_chip_info *info = state->info; in no_lock_tmds()
1249 struct adv76xx_state *state = to_state(sd); in no_lock_sspd() local
1255 if (adv76xx_has_afe(state)) in no_lock_sspd()
1287 struct adv76xx_state *state = to_state(sd); in no_lock_cp() local
1289 if (!adv76xx_has_afe(state)) in no_lock_cp()
1328 struct adv76xx_state *state = to_state(sd); in stdi2dv_timings() local
1356 false, state->aspect_ratio, timings)) in stdi2dv_timings()
1369 struct adv76xx_state *state = to_state(sd); in read_stdi() local
1370 const struct adv76xx_chip_info *info = state->info; in read_stdi()
1384 if (adv76xx_has_afe(state)) { in read_stdi()
1426 struct adv76xx_state *state = to_state(sd); in adv76xx_enum_dv_timings() local
1431 if (timings->pad >= state->source_pad) in adv76xx_enum_dv_timings()
1442 struct adv76xx_state *state = to_state(sd); in adv76xx_dv_timings_cap() local
1444 if (cap->pad >= state->source_pad) in adv76xx_dv_timings_cap()
1524 struct adv76xx_state *state = to_state(sd); in adv76xx_query_dv_timings() local
1525 const struct adv76xx_chip_info *info = state->info; in adv76xx_query_dv_timings()
1535 state->restart_stdi_once = true; in adv76xx_query_dv_timings()
1598 if (state->restart_stdi_once) { in adv76xx_query_dv_timings()
1607 state->restart_stdi_once = false; in adv76xx_query_dv_timings()
1613 state->restart_stdi_once = true; in adv76xx_query_dv_timings()
1640 struct adv76xx_state *state = to_state(sd); in adv76xx_s_dv_timings() local
1647 if (v4l2_match_dv_timings(&state->timings, timings, 0)) { in adv76xx_s_dv_timings()
1663 state->timings = *timings; in adv76xx_s_dv_timings()
1686 struct adv76xx_state *state = to_state(sd); in adv76xx_g_dv_timings() local
1688 *timings = state->timings; in adv76xx_g_dv_timings()
1704 struct adv76xx_state *state = to_state(sd); in enable_input() local
1709 hdmi_write_clr_set(sd, 0x00, 0x03, state->selected_input); in enable_input()
1710 state->info->set_termination(sd, true); in enable_input()
1715 __func__, state->selected_input); in enable_input()
1721 struct adv76xx_state *state = to_state(sd); in disable_input() local
1726 state->info->set_termination(sd, false); in disable_input()
1731 struct adv76xx_state *state = to_state(sd); in select_input() local
1732 const struct adv76xx_chip_info *info = state->info; in select_input()
1741 hdmi_write(sd, 0x00, state->selected_input & 0x03); in select_input()
1745 if (adv76xx_has_afe(state)) { in select_input()
1756 __func__, state->selected_input); in select_input()
1763 struct adv76xx_state *state = to_state(sd); in adv76xx_s_routing() local
1766 __func__, input, state->selected_input); in adv76xx_s_routing()
1768 if (input == state->selected_input) in adv76xx_s_routing()
1771 if (input > state->info->max_port) in adv76xx_s_routing()
1774 state->selected_input = input; in adv76xx_s_routing()
1789 struct adv76xx_state *state = to_state(sd); in adv76xx_enum_mbus_code() local
1791 if (code->index >= state->info->nformats) in adv76xx_enum_mbus_code()
1794 code->code = state->info->formats[code->index].code; in adv76xx_enum_mbus_code()
1799 static void adv76xx_fill_format(struct adv76xx_state *state, in adv76xx_fill_format() argument
1804 format->width = state->timings.bt.width; in adv76xx_fill_format()
1805 format->height = state->timings.bt.height; in adv76xx_fill_format()
1809 if (state->timings.bt.flags & V4L2_DV_FL_IS_CE_VIDEO) in adv76xx_fill_format()
1810 format->colorspace = (state->timings.bt.height <= 576) ? in adv76xx_fill_format()
1832 static unsigned int adv76xx_op_ch_sel(struct adv76xx_state *state) in adv76xx_op_ch_sel() argument
1848 return op_ch_sel[state->pdata.bus_order][state->format->op_ch_sel >> 5]; in adv76xx_op_ch_sel()
1851 static void adv76xx_setup_format(struct adv76xx_state *state) in adv76xx_setup_format() argument
1853 struct v4l2_subdev *sd = &state->sd; in adv76xx_setup_format()
1856 state->format->rgb_out ? ADV76XX_RGB_OUT : 0); in adv76xx_setup_format()
1857 io_write(sd, 0x03, state->format->op_format_sel | in adv76xx_setup_format()
1858 state->pdata.op_format_mode_sel); in adv76xx_setup_format()
1859 io_write_clr_set(sd, 0x04, 0xe0, adv76xx_op_ch_sel(state)); in adv76xx_setup_format()
1861 state->format->swap_cb_cr ? ADV76XX_OP_SWAP_CB_CR : 0); in adv76xx_setup_format()
1868 struct adv76xx_state *state = to_state(sd); in adv76xx_get_format() local
1870 if (format->pad != state->source_pad) in adv76xx_get_format()
1873 adv76xx_fill_format(state, &format->format); in adv76xx_get_format()
1881 format->format.code = state->format->code; in adv76xx_get_format()
1891 struct adv76xx_state *state = to_state(sd); in adv76xx_set_format() local
1894 if (format->pad != state->source_pad) in adv76xx_set_format()
1897 info = adv76xx_format_info(state, format->format.code); in adv76xx_set_format()
1899 info = adv76xx_format_info(state, MEDIA_BUS_FMT_YUYV8_2X8); in adv76xx_set_format()
1901 adv76xx_fill_format(state, &format->format); in adv76xx_set_format()
1910 state->format = info; in adv76xx_set_format()
1911 adv76xx_setup_format(state); in adv76xx_set_format()
1919 struct adv76xx_state *state = to_state(sd); in adv76xx_isr() local
1920 const struct adv76xx_chip_info *info = state->info; in adv76xx_isr()
1975 struct adv76xx_state *state = to_state(sd); in adv76xx_get_edid() local
1985 if (state->edid.present & (1 << edid->pad)) in adv76xx_get_edid()
1986 data = state->edid.edid; in adv76xx_get_edid()
1993 edid->blocks = data ? state->edid.blocks : 0; in adv76xx_get_edid()
2000 if (edid->start_block >= state->edid.blocks) in adv76xx_get_edid()
2003 if (edid->start_block + edid->blocks > state->edid.blocks) in adv76xx_get_edid()
2004 edid->blocks = state->edid.blocks - edid->start_block; in adv76xx_get_edid()
2041 struct adv76xx_state *state = to_state(sd); in adv76xx_set_edid() local
2042 const struct adv76xx_chip_info *info = state->info; in adv76xx_set_edid()
2055 state->edid.present &= ~(1 << edid->pad); in adv76xx_set_edid()
2056 adv76xx_set_hpd(state, state->edid.present); in adv76xx_set_edid()
2057 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, state->edid.present); in adv76xx_set_edid()
2060 state->aspect_ratio.numerator = 16; in adv76xx_set_edid()
2061 state->aspect_ratio.denominator = 9; in adv76xx_set_edid()
2063 if (!state->edid.present) in adv76xx_set_edid()
2064 state->edid.blocks = 0; in adv76xx_set_edid()
2067 __func__, edid->pad, state->edid.present); in adv76xx_set_edid()
2076 __func__, edid->pad, state->edid.present); in adv76xx_set_edid()
2079 cancel_delayed_work_sync(&state->delayed_work_enable_hotplug); in adv76xx_set_edid()
2080 adv76xx_set_hpd(state, 0); in adv76xx_set_edid()
2089 state->spa_port_a[0] = edid->edid[spa_loc]; in adv76xx_set_edid()
2090 state->spa_port_a[1] = edid->edid[spa_loc + 1]; in adv76xx_set_edid()
2116 edid->edid[spa_loc] = state->spa_port_a[0]; in adv76xx_set_edid()
2117 edid->edid[spa_loc + 1] = state->spa_port_a[1]; in adv76xx_set_edid()
2119 memcpy(state->edid.edid, edid->edid, 128 * edid->blocks); in adv76xx_set_edid()
2120 state->edid.blocks = edid->blocks; in adv76xx_set_edid()
2121 state->aspect_ratio = v4l2_calc_aspect_ratio(edid->edid[0x15], in adv76xx_set_edid()
2123 state->edid.present |= 1 << edid->pad; in adv76xx_set_edid()
2125 err = edid_write_block(sd, 128 * edid->blocks, state->edid.edid); in adv76xx_set_edid()
2133 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, state->edid.present); in adv76xx_set_edid()
2136 if (rep_read(sd, info->edid_status_reg) & state->edid.present) in adv76xx_set_edid()
2141 v4l2_err(sd, "error enabling edid (0x%x)\n", state->edid.present); in adv76xx_set_edid()
2146 queue_delayed_work(state->work_queues, in adv76xx_set_edid()
2147 &state->delayed_work_enable_hotplug, HZ / 10); in adv76xx_set_edid()
2218 struct adv76xx_state *state = to_state(sd); in adv76xx_log_status() local
2219 const struct adv76xx_chip_info *info = state->info; in adv76xx_log_status()
2305 &state->timings, true); in adv76xx_log_status()
2312 rgb_quantization_range_txt[state->rgb_quantization_range]); in adv76xx_log_status()
2459 struct adv76xx_state *state = to_state(sd); in adv76xx_core_init() local
2460 const struct adv76xx_chip_info *info = state->info; in adv76xx_core_init()
2461 struct adv76xx_platform_data *pdata = &state->pdata; in adv76xx_core_init()
2470 pdata->default_input < state->source_pad) { in adv76xx_core_init()
2471 state->selected_input = pdata->default_input; in adv76xx_core_init()
2489 adv76xx_setup_format(state); in adv76xx_core_init()
2519 if (adv76xx_has_afe(state)) { in adv76xx_core_init()
2549 static void adv76xx_unregister_clients(struct adv76xx_state *state) in adv76xx_unregister_clients() argument
2553 for (i = 1; i < ARRAY_SIZE(state->i2c_clients); ++i) { in adv76xx_unregister_clients()
2554 if (state->i2c_clients[i]) in adv76xx_unregister_clients()
2555 i2c_unregister_device(state->i2c_clients[i]); in adv76xx_unregister_clients()
2795 static int adv76xx_parse_dt(struct adv76xx_state *state) in adv76xx_parse_dt() argument
2803 np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node; in adv76xx_parse_dt()
2813 state->pdata.default_input = v; in adv76xx_parse_dt()
2815 state->pdata.default_input = -1; in adv76xx_parse_dt()
2822 state->pdata.inv_hs_pol = 1; in adv76xx_parse_dt()
2825 state->pdata.inv_vs_pol = 1; in adv76xx_parse_dt()
2828 state->pdata.inv_llc_pol = 1; in adv76xx_parse_dt()
2831 state->pdata.insert_av_codes = 1; in adv76xx_parse_dt()
2832 state->pdata.op_656_range = 1; in adv76xx_parse_dt()
2836 state->pdata.int1_config = ADV76XX_INT1_CONFIG_DISABLED; in adv76xx_parse_dt()
2839 state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42; in adv76xx_parse_dt()
2840 state->pdata.i2c_addresses[ADV76XX_PAGE_CEC] = 0x40; in adv76xx_parse_dt()
2841 state->pdata.i2c_addresses[ADV76XX_PAGE_INFOFRAME] = 0x3e; in adv76xx_parse_dt()
2842 state->pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38; in adv76xx_parse_dt()
2843 state->pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c; in adv76xx_parse_dt()
2844 state->pdata.i2c_addresses[ADV76XX_PAGE_AFE] = 0x26; in adv76xx_parse_dt()
2845 state->pdata.i2c_addresses[ADV76XX_PAGE_REP] = 0x32; in adv76xx_parse_dt()
2846 state->pdata.i2c_addresses[ADV76XX_PAGE_EDID] = 0x36; in adv76xx_parse_dt()
2847 state->pdata.i2c_addresses[ADV76XX_PAGE_HDMI] = 0x34; in adv76xx_parse_dt()
2848 state->pdata.i2c_addresses[ADV76XX_PAGE_TEST] = 0x30; in adv76xx_parse_dt()
2849 state->pdata.i2c_addresses[ADV76XX_PAGE_CP] = 0x22; in adv76xx_parse_dt()
2850 state->pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24; in adv76xx_parse_dt()
2853 state->pdata.disable_pwrdnb = 0; in adv76xx_parse_dt()
2854 state->pdata.disable_cable_det_rst = 0; in adv76xx_parse_dt()
2855 state->pdata.blank_data = 1; in adv76xx_parse_dt()
2856 state->pdata.alt_data_sat = 1; in adv76xx_parse_dt()
2857 state->pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0; in adv76xx_parse_dt()
2858 state->pdata.bus_order = ADV7604_BUS_ORDER_RGB; in adv76xx_parse_dt()
2971 static int configure_regmap(struct adv76xx_state *state, int region) in configure_regmap() argument
2975 if (!state->i2c_clients[region]) in configure_regmap()
2978 state->regmap[region] = in configure_regmap()
2979 devm_regmap_init_i2c(state->i2c_clients[region], in configure_regmap()
2982 if (IS_ERR(state->regmap[region])) { in configure_regmap()
2983 err = PTR_ERR(state->regmap[region]); in configure_regmap()
2984 v4l_err(state->i2c_clients[region], in configure_regmap()
2993 static int configure_regmaps(struct adv76xx_state *state) in configure_regmaps() argument
2998 err = configure_regmap(state, i); in configure_regmaps()
3010 struct adv76xx_state *state; in adv76xx_probe() local
3023 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); in adv76xx_probe()
3024 if (!state) { in adv76xx_probe()
3029 state->i2c_clients[ADV76XX_PAGE_IO] = client; in adv76xx_probe()
3032 state->restart_stdi_once = true; in adv76xx_probe()
3033 state->selected_input = ~0; in adv76xx_probe()
3039 state->info = oid->data; in adv76xx_probe()
3041 err = adv76xx_parse_dt(state); in adv76xx_probe()
3049 state->info = (const struct adv76xx_chip_info *)id->driver_data; in adv76xx_probe()
3050 state->pdata = *pdata; in adv76xx_probe()
3057 for (i = 0; i < state->info->num_dv_ports; ++i) { in adv76xx_probe()
3058 state->hpd_gpio[i] = in adv76xx_probe()
3061 if (IS_ERR(state->hpd_gpio[i])) in adv76xx_probe()
3062 return PTR_ERR(state->hpd_gpio[i]); in adv76xx_probe()
3064 if (state->hpd_gpio[i]) in adv76xx_probe()
3068 state->timings = cea640x480; in adv76xx_probe()
3069 state->format = adv76xx_format_info(state, MEDIA_BUS_FMT_YUYV8_2X8); in adv76xx_probe()
3071 sd = &state->sd; in adv76xx_probe()
3079 err = configure_regmap(state, ADV76XX_PAGE_IO); in adv76xx_probe()
3091 switch (state->info->type) { in adv76xx_probe()
3093 err = regmap_read(state->regmap[ADV76XX_PAGE_IO], 0xfb, &val); in adv76xx_probe()
3106 err = regmap_read(state->regmap[ADV76XX_PAGE_IO], in adv76xx_probe()
3114 err = regmap_read(state->regmap[ADV76XX_PAGE_IO], in adv76xx_probe()
3122 if ((state->info->type == ADV7611 && val != 0x2051) || in adv76xx_probe()
3123 (state->info->type == ADV7612 && val != 0x2041)) { in adv76xx_probe()
3132 hdl = &state->hdl; in adv76xx_probe()
3133 v4l2_ctrl_handler_init(hdl, adv76xx_has_afe(state) ? 9 : 8); in adv76xx_probe()
3145 state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL, in adv76xx_probe()
3147 (1 << state->info->num_dv_ports) - 1, 0, 0); in adv76xx_probe()
3148 state->rgb_quantization_range_ctrl = in adv76xx_probe()
3154 if (adv76xx_has_afe(state)) in adv76xx_probe()
3155 state->analog_sampling_phase_ctrl = in adv76xx_probe()
3157 state->free_run_color_manual_ctrl = in adv76xx_probe()
3159 state->free_run_color_ctrl = in adv76xx_probe()
3167 state->detect_tx_5v_ctrl->is_private = true; in adv76xx_probe()
3168 state->rgb_quantization_range_ctrl->is_private = true; in adv76xx_probe()
3169 if (adv76xx_has_afe(state)) in adv76xx_probe()
3170 state->analog_sampling_phase_ctrl->is_private = true; in adv76xx_probe()
3171 state->free_run_color_manual_ctrl->is_private = true; in adv76xx_probe()
3172 state->free_run_color_ctrl->is_private = true; in adv76xx_probe()
3180 if (!(BIT(i) & state->info->page_mask)) in adv76xx_probe()
3183 state->i2c_clients[i] = in adv76xx_probe()
3184 adv76xx_dummy_client(sd, state->pdata.i2c_addresses[i], in adv76xx_probe()
3186 if (state->i2c_clients[i] == NULL) { in adv76xx_probe()
3194 state->work_queues = create_singlethread_workqueue(client->name); in adv76xx_probe()
3195 if (!state->work_queues) { in adv76xx_probe()
3201 INIT_DELAYED_WORK(&state->delayed_work_enable_hotplug, in adv76xx_probe()
3204 state->source_pad = state->info->num_dv_ports in adv76xx_probe()
3205 + (state->info->has_afe ? 2 : 0); in adv76xx_probe()
3206 for (i = 0; i < state->source_pad; ++i) in adv76xx_probe()
3207 state->pads[i].flags = MEDIA_PAD_FL_SINK; in adv76xx_probe()
3208 state->pads[state->source_pad].flags = MEDIA_PAD_FL_SOURCE; in adv76xx_probe()
3210 err = media_entity_init(&sd->entity, state->source_pad + 1, in adv76xx_probe()
3211 state->pads, 0); in adv76xx_probe()
3216 err = configure_regmaps(state); in adv76xx_probe()
3235 cancel_delayed_work(&state->delayed_work_enable_hotplug); in adv76xx_probe()
3236 destroy_workqueue(state->work_queues); in adv76xx_probe()
3238 adv76xx_unregister_clients(state); in adv76xx_probe()
3249 struct adv76xx_state *state = to_state(sd); in adv76xx_remove() local
3251 cancel_delayed_work(&state->delayed_work_enable_hotplug); in adv76xx_remove()
3252 destroy_workqueue(state->work_queues); in adv76xx_remove()