Lines Matching +full:vdd18 +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
35 #include <media/v4l2-fwnode.h>
36 #include <sound/hdmi-codec.h>
50 struct device *dev = &client->dev; in i2c_access_workaround()
53 if (client == ctx->last_client) in i2c_access_workaround()
56 ctx->last_client = client; in i2c_access_workaround()
58 if (client == ctx->i2c.tcpc_client) in i2c_access_workaround()
60 else if (client == ctx->i2c.tx_p0_client) in i2c_access_workaround()
62 else if (client == ctx->i2c.tx_p1_client) in i2c_access_workaround()
64 else if (client == ctx->i2c.rx_p0_client) in i2c_access_workaround()
66 else if (client == ctx->i2c.rx_p1_client) in i2c_access_workaround()
75 client->addr, offset); in i2c_access_workaround()
84 struct device *dev = &client->dev; in anx7625_reg_read()
91 client->addr, reg_addr); in anx7625_reg_read()
101 struct device *dev = &client->dev; in anx7625_reg_block_read()
108 client->addr, reg_addr); in anx7625_reg_block_read()
118 struct device *dev = &client->dev; in anx7625_reg_write()
126 client->addr, reg_addr); in anx7625_reg_write()
136 struct device *dev = &client->dev; in anx7625_reg_block_write()
143 client->addr, reg_addr); in anx7625_reg_block_write()
192 ret = anx7625_write_or(ctx, ctx->i2c.tx_p2_client, in anx7625_config_bit_matrix()
195 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_config_bit_matrix()
204 return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, AP_AUX_CTRL_STATUS); in anx7625_read_ctrl_status_p0()
209 struct device *dev = ctx->dev; in wait_aux_op_finish()
220 return -EIO; in wait_aux_op_finish()
223 val = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in wait_aux_op_finish()
227 return -EIO; in wait_aux_op_finish()
236 struct device *dev = ctx->dev; in anx7625_aux_trans()
244 return -EINVAL; in anx7625_aux_trans()
259 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
263 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
265 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
267 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
271 ret |= anx7625_reg_block_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
274 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
279 return -EIO; in anx7625_aux_trans()
293 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
297 return -EIO; in anx7625_aux_trans()
310 ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
313 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
317 ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
320 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
370 return -EINVAL; in anx7625_calculate_m_n()
378 return -EINVAL; in anx7625_calculate_m_n()
394 return -EDOM; in anx7625_calculate_m_n()
414 return -EDOM; in anx7625_calculate_m_n()
429 struct device *dev = ctx->dev; in anx7625_odfc_config()
432 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_16, in anx7625_odfc_config()
434 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_16, in anx7625_odfc_config()
437 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, in anx7625_odfc_config()
439 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_8, in anx7625_odfc_config()
442 /* Add patch for MIS2-125 (5pcs ANX7625 fail ATE MBIST test) */ in anx7625_odfc_config()
443 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7, in anx7625_odfc_config()
447 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7, in anx7625_odfc_config()
449 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7, in anx7625_odfc_config()
467 struct edid *edid = (struct edid *)ctx->slimport_edid_p.edid_raw_data; in anx7625_set_k_value()
469 if (edid->mfg_id[0] == IVO_MID0 && edid->mfg_id[1] == IVO_MID1) in anx7625_set_k_value()
470 return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_set_k_value()
473 return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_set_k_value()
479 struct device *dev = ctx->dev; in anx7625_dsi_video_timing_config()
485 ret = anx7625_calculate_m_n(ctx->dt.pixelclock.min * 1000, in anx7625_dsi_video_timing_config()
497 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, PIXEL_CLOCK_L, in anx7625_dsi_video_timing_config()
498 (ctx->dt.pixelclock.min / 1000) & 0xFF); in anx7625_dsi_video_timing_config()
499 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, PIXEL_CLOCK_H, in anx7625_dsi_video_timing_config()
500 (ctx->dt.pixelclock.min / 1000) >> 8); in anx7625_dsi_video_timing_config()
502 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
504 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
505 MIPI_LANE_CTRL_0, ctx->pdata.mipi_lanes - 1); in anx7625_dsi_video_timing_config()
508 htotal = ctx->dt.hactive.min + ctx->dt.hfront_porch.min + in anx7625_dsi_video_timing_config()
509 ctx->dt.hback_porch.min + ctx->dt.hsync_len.min; in anx7625_dsi_video_timing_config()
510 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
512 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
515 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
516 HORIZONTAL_ACTIVE_PIXELS_L, ctx->dt.hactive.min & 0xFF); in anx7625_dsi_video_timing_config()
517 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
518 HORIZONTAL_ACTIVE_PIXELS_H, ctx->dt.hactive.min >> 8); in anx7625_dsi_video_timing_config()
520 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
521 HORIZONTAL_FRONT_PORCH_L, ctx->dt.hfront_porch.min); in anx7625_dsi_video_timing_config()
522 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
524 ctx->dt.hfront_porch.min >> 8); in anx7625_dsi_video_timing_config()
526 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
527 HORIZONTAL_SYNC_WIDTH_L, ctx->dt.hsync_len.min); in anx7625_dsi_video_timing_config()
528 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
529 HORIZONTAL_SYNC_WIDTH_H, ctx->dt.hsync_len.min >> 8); in anx7625_dsi_video_timing_config()
531 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
532 HORIZONTAL_BACK_PORCH_L, ctx->dt.hback_porch.min); in anx7625_dsi_video_timing_config()
533 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
534 HORIZONTAL_BACK_PORCH_H, ctx->dt.hback_porch.min >> 8); in anx7625_dsi_video_timing_config()
536 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, ACTIVE_LINES_L, in anx7625_dsi_video_timing_config()
537 ctx->dt.vactive.min); in anx7625_dsi_video_timing_config()
538 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, ACTIVE_LINES_H, in anx7625_dsi_video_timing_config()
539 ctx->dt.vactive.min >> 8); in anx7625_dsi_video_timing_config()
541 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
542 VERTICAL_FRONT_PORCH, ctx->dt.vfront_porch.min); in anx7625_dsi_video_timing_config()
544 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
545 VERTICAL_SYNC_WIDTH, ctx->dt.vsync_len.min); in anx7625_dsi_video_timing_config()
547 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
548 VERTICAL_BACK_PORCH, ctx->dt.vback_porch.min); in anx7625_dsi_video_timing_config()
550 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
552 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
554 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
557 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
559 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
561 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, MIPI_PLL_N_NUM_7_0, in anx7625_dsi_video_timing_config()
566 ret |= anx7625_odfc_config(ctx, post_divider - 1); in anx7625_dsi_video_timing_config()
577 struct device *dev = ctx->dev; in anx7625_swap_dsi_lane3()
579 /* Swap MIPI-DSI data lane 3 P and N */ in anx7625_swap_dsi_lane3()
580 val = anx7625_reg_read(ctx, ctx->i2c.rx_p1_client, MIPI_SWAP); in anx7625_swap_dsi_lane3()
583 return -EIO; in anx7625_swap_dsi_lane3()
587 return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, MIPI_SWAP, val); in anx7625_swap_dsi_lane3()
594 struct device *dev = ctx->dev; in anx7625_api_dsi_config()
596 /* Swap MIPI-DSI data lane 3 P and N */ in anx7625_api_dsi_config()
612 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
619 * P332 D-PHY Probe) default D-PHY timing in anx7625_api_dsi_config()
622 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
626 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_18, in anx7625_api_dsi_config()
636 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_6, in anx7625_api_dsi_config()
639 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_6, in anx7625_api_dsi_config()
643 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
646 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
648 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
659 struct device *dev = ctx->dev; in anx7625_dsi_config()
665 ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dsi_config()
676 ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_dsi_config()
679 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dsi_config()
691 struct device *dev = ctx->dev; in anx7625_api_dpi_config()
692 u16 freq = ctx->dt.pixelclock.min / 1000; in anx7625_api_dpi_config()
696 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_api_dpi_config()
698 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_api_dpi_config()
703 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dpi_config()
706 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dpi_config()
709 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dpi_config()
712 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_api_dpi_config()
722 struct device *dev = ctx->dev; in anx7625_dpi_config()
728 ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dpi_config()
748 ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_dpi_config()
751 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dpi_config()
761 return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, R_RAM_CTRL); in anx7625_read_flash_status()
767 struct device *dev = ctx->dev; in anx7625_hdcp_key_probe()
770 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
772 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
779 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
780 FLASH_LEN_HIGH, (FLASH_BUF_LEN - 1) >> 8); in anx7625_hdcp_key_probe()
781 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
782 FLASH_LEN_LOW, (FLASH_BUF_LEN - 1) & 0xFF); in anx7625_hdcp_key_probe()
788 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
797 return -EIO; in anx7625_hdcp_key_probe()
800 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
805 return -EIO; in anx7625_hdcp_key_probe()
809 return -EINVAL; in anx7625_hdcp_key_probe()
817 struct device *dev = ctx->dev; in anx7625_hdcp_key_load()
820 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
822 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
824 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
826 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
828 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
831 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
833 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
836 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
845 struct device *dev = ctx->dev; in anx7625_hdcp_disable()
850 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, 0xee, 0x9f); in anx7625_hdcp_disable()
852 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); in anx7625_hdcp_disable()
854 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); in anx7625_hdcp_disable()
858 return anx7625_write_and(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_disable()
866 struct device *dev = ctx->dev; in anx7625_hdcp_enable()
887 ret = anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
892 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
897 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
900 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
908 ret = anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xee, 0x20); in anx7625_hdcp_enable()
911 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); in anx7625_hdcp_enable()
913 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); in anx7625_hdcp_enable()
917 return anx7625_write_or(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
924 struct device *dev = ctx->dev; in anx7625_dp_start()
927 if (!ctx->display_timing_valid) { in anx7625_dp_start()
940 anx7625_write_and(ctx, ctx->i2c.rx_p1_client, 0xee, 0x9f); in anx7625_dp_start()
942 if (ctx->pdata.is_dpi) in anx7625_dp_start()
950 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; in anx7625_dp_start()
952 ctx->dp_en = 1; in anx7625_dp_start()
957 struct device *dev = ctx->dev; in anx7625_dp_stop()
967 ret = anx7625_write_and(ctx, ctx->i2c.tx_p0_client, 0x87, 0xfe); in anx7625_dp_stop()
968 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, 0x08, 0x7f); in anx7625_dp_stop()
979 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; in anx7625_dp_stop()
981 ctx->dp_en = 0; in anx7625_dp_stop()
988 ret = anx7625_write_or(ctx, ctx->i2c.tx_p2_client, RST_CTRL2, in sp_tx_rst_aux()
990 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, RST_CTRL2, in sp_tx_rst_aux()
999 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_wr()
1001 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_wr()
1003 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_wr()
1012 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_rd()
1014 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_rd()
1022 struct device *dev = ctx->dev; in sp_tx_get_edid_block()
1026 c = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, AP_AUX_BUFF_START); in sp_tx_get_edid_block()
1029 return -EIO; in sp_tx_get_edid_block()
1044 struct device *dev = ctx->dev; in edid_read()
1055 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in edid_read()
1065 return -EIO; in edid_read()
1075 struct device *dev = ctx->dev; in segments_edid_read()
1078 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1080 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1082 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1090 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1106 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1115 return -EIO; in segments_edid_read()
1130 struct device *dev = ctx->dev; in sp_tx_edid_read()
1133 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_edid_read()
1135 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_edid_read()
1137 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in sp_tx_edid_read()
1141 return -EIO; in sp_tx_edid_read()
1222 return -EINVAL; in sp_tx_edid_read()
1237 struct device *dev = ctx->dev; in anx7625_power_on()
1240 if (!ctx->pdata.low_power_mode) { in anx7625_power_on()
1245 for (i = 0; i < ARRAY_SIZE(ctx->pdata.supplies); i++) { in anx7625_power_on()
1246 ret = regulator_enable(ctx->pdata.supplies[i].consumer); in anx7625_power_on()
1248 DRM_DEV_DEBUG_DRIVER(dev, "cannot enable supply %d: %d\n", in anx7625_power_on()
1258 gpiod_set_value(ctx->pdata.gpio_p_on, 1); in anx7625_power_on()
1261 gpiod_set_value(ctx->pdata.gpio_reset, 1); in anx7625_power_on()
1267 for (--i; i >= 0; i--) in anx7625_power_on()
1268 regulator_disable(ctx->pdata.supplies[i].consumer); in anx7625_power_on()
1273 struct device *dev = ctx->dev; in anx7625_power_standby()
1276 if (!ctx->pdata.low_power_mode) { in anx7625_power_standby()
1281 gpiod_set_value(ctx->pdata.gpio_reset, 0); in anx7625_power_standby()
1283 gpiod_set_value(ctx->pdata.gpio_p_on, 0); in anx7625_power_standby()
1286 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->pdata.supplies), in anx7625_power_standby()
1287 ctx->pdata.supplies); in anx7625_power_standby()
1297 anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_config()
1306 ret = anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_hpd_timer_config()
1308 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_hpd_timer_config()
1311 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_hpd_timer_config()
1320 return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, GPIO_CTRL_2); in anx7625_read_hpd_gpio_config_status()
1325 struct device *dev = ctx->dev; in anx7625_disable_pd_protocol()
1329 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, 0x88, 0x40); in anx7625_disable_pd_protocol()
1331 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_disable_pd_protocol()
1334 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, 0x88, 0x00); in anx7625_disable_pd_protocol()
1358 struct device *dev = ctx->dev; in anx7625_ocm_loading_check()
1361 ret = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in anx7625_ocm_loading_check()
1368 return -ENODEV; in anx7625_ocm_loading_check()
1374 ctx->i2c.rx_p0_client, in anx7625_ocm_loading_check()
1377 ctx->i2c.rx_p0_client, in anx7625_ocm_loading_check()
1404 struct device *dev = platform->dev; in anx7625_init_gpio()
1409 platform->pdata.gpio_p_on = in anx7625_init_gpio()
1411 if (IS_ERR_OR_NULL(platform->pdata.gpio_p_on)) { in anx7625_init_gpio()
1413 platform->pdata.gpio_p_on = NULL; in anx7625_init_gpio()
1417 platform->pdata.gpio_reset = in anx7625_init_gpio()
1419 if (IS_ERR_OR_NULL(platform->pdata.gpio_reset)) { in anx7625_init_gpio()
1421 platform->pdata.gpio_reset = NULL; in anx7625_init_gpio()
1424 if (platform->pdata.gpio_p_on && platform->pdata.gpio_reset) { in anx7625_init_gpio()
1425 platform->pdata.low_power_mode = 1; in anx7625_init_gpio()
1427 desc_to_gpio(platform->pdata.gpio_p_on), in anx7625_init_gpio()
1428 desc_to_gpio(platform->pdata.gpio_reset)); in anx7625_init_gpio()
1430 platform->pdata.low_power_mode = 0; in anx7625_init_gpio()
1437 ctx->hpd_status = 0; in anx7625_stop_dp_work()
1438 ctx->hpd_high_cnt = 0; in anx7625_stop_dp_work()
1444 struct device *dev = ctx->dev; in anx7625_start_dp_work()
1446 if (ctx->hpd_high_cnt >= 2) { in anx7625_start_dp_work()
1451 ctx->hpd_status = 1; in anx7625_start_dp_work()
1452 ctx->hpd_high_cnt++; in anx7625_start_dp_work()
1455 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, 0xee, 0x9f); in anx7625_start_dp_work()
1458 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); in anx7625_start_dp_work()
1460 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); in anx7625_start_dp_work()
1466 ret = anx7625_reg_read(ctx, ctx->i2c.rx_p1_client, 0x86); in anx7625_start_dp_work()
1475 return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, SYSTEM_STSTUS); in anx7625_read_hpd_status_p0()
1482 struct device *dev = ctx->dev; in _anx7625_hpd_polling()
1485 if (ctx->pdata.intp_irq) in _anx7625_hpd_polling()
1499 anx7625_reg_write(ctx, ctx->i2c.tcpc_client, in _anx7625_hpd_polling()
1501 anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in _anx7625_hpd_polling()
1506 if (!ctx->pdata.panel_bridge && ctx->bridge_attached) in _anx7625_hpd_polling()
1507 drm_helper_hpd_irq_event(ctx->bridge.dev); in _anx7625_hpd_polling()
1516 struct device *dev = ctx->dev; in anx7625_wait_hpd_asserted()
1529 ctx->slimport_edid_p.edid_block_num = -1; in anx7625_remove_edid()
1536 for (i = 0; i < ctx->pdata.dp_lane0_swing_reg_cnt; i++) in anx7625_dp_adjust_swing()
1537 anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, in anx7625_dp_adjust_swing()
1539 ctx->pdata.lane0_reg_data[i]); in anx7625_dp_adjust_swing()
1541 for (i = 0; i < ctx->pdata.dp_lane1_swing_reg_cnt; i++) in anx7625_dp_adjust_swing()
1542 anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, in anx7625_dp_adjust_swing()
1544 ctx->pdata.lane1_reg_data[i]); in anx7625_dp_adjust_swing()
1549 struct device *dev = ctx->dev; in dp_hpd_change_handler()
1569 struct device *dev = ctx->dev; in anx7625_hpd_change_detect()
1571 status = anx7625_reg_write(ctx, ctx->i2c.tcpc_client, in anx7625_hpd_change_detect()
1578 intr_vector = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in anx7625_hpd_change_detect()
1585 status = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hpd_change_detect()
1594 return -ENOENT; in anx7625_hpd_change_detect()
1596 status = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in anx7625_hpd_change_detect()
1615 mutex_lock(&ctx->lock); in anx7625_work_func()
1617 if (pm_runtime_suspended(ctx->dev)) { in anx7625_work_func()
1618 mutex_unlock(&ctx->lock); in anx7625_work_func()
1624 mutex_unlock(&ctx->lock); in anx7625_work_func()
1629 if (ctx->bridge_attached) in anx7625_work_func()
1630 drm_helper_hpd_irq_event(ctx->bridge.dev); in anx7625_work_func()
1637 queue_work(ctx->workqueue, &ctx->work); in anx7625_intr_hpd_isr()
1647 if (of_get_property(dev->of_node, in anx7625_get_swing_setting()
1648 "analogix,lane0-swing", &num_regs)) { in anx7625_get_swing_setting()
1652 pdata->dp_lane0_swing_reg_cnt = num_regs; in anx7625_get_swing_setting()
1653 of_property_read_u8_array(dev->of_node, "analogix,lane0-swing", in anx7625_get_swing_setting()
1654 pdata->lane0_reg_data, num_regs); in anx7625_get_swing_setting()
1657 if (of_get_property(dev->of_node, in anx7625_get_swing_setting()
1658 "analogix,lane1-swing", &num_regs)) { in anx7625_get_swing_setting()
1662 pdata->dp_lane1_swing_reg_cnt = num_regs; in anx7625_get_swing_setting()
1663 of_property_read_u8_array(dev->of_node, "analogix,lane1-swing", in anx7625_get_swing_setting()
1664 pdata->lane1_reg_data, num_regs); in anx7625_get_swing_setting()
1673 struct device_node *np = dev->of_node, *ep0; in anx7625_parse_dt()
1678 pdata->is_dpi = 0; /* default dsi mode */ in anx7625_parse_dt()
1679 of_node_put(pdata->mipi_host_node); in anx7625_parse_dt()
1680 pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0); in anx7625_parse_dt()
1681 if (!pdata->mipi_host_node) { in anx7625_parse_dt()
1683 return -ENODEV; in anx7625_parse_dt()
1690 if (of_property_read_u32(ep0, "bus-type", &bus_type)) in anx7625_parse_dt()
1698 pdata->is_dpi = 1; in anx7625_parse_dt()
1700 pdata->mipi_lanes = MAX_LANES_SUPPORT; in anx7625_parse_dt()
1702 pdata->mipi_lanes = mipi_lanes; in anx7625_parse_dt()
1704 if (pdata->is_dpi) in anx7625_parse_dt()
1709 if (of_property_read_bool(np, "analogix,audio-enable")) in anx7625_parse_dt()
1710 pdata->audio_en = 1; in anx7625_parse_dt()
1718 struct device_node *np = dev->of_node; in anx7625_parse_dt_panel()
1720 pdata->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); in anx7625_parse_dt_panel()
1721 if (IS_ERR(pdata->panel_bridge)) { in anx7625_parse_dt_panel()
1722 if (PTR_ERR(pdata->panel_bridge) == -ENODEV) { in anx7625_parse_dt_panel()
1723 pdata->panel_bridge = NULL; in anx7625_parse_dt_panel()
1727 return PTR_ERR(pdata->panel_bridge); in anx7625_parse_dt_panel()
1739 bus = of_get_child_by_name(dev->of_node, "aux-bus"); in anx7625_of_panel_on_aux_bus()
1761 struct device *dev = ctx->dev; in anx7625_aux_transfer()
1762 u8 request = msg->request & ~DP_AUX_I2C_MOT; in anx7625_aux_transfer()
1765 mutex_lock(&ctx->aux_lock); in anx7625_aux_transfer()
1767 msg->reply = 0; in anx7625_aux_transfer()
1775 ret = -EINVAL; in anx7625_aux_transfer()
1778 ret = anx7625_aux_trans(ctx, msg->request, msg->address, in anx7625_aux_transfer()
1779 msg->size, msg->buffer); in anx7625_aux_transfer()
1782 mutex_unlock(&ctx->aux_lock); in anx7625_aux_transfer()
1789 struct device *dev = ctx->dev; in anx7625_get_edid()
1790 struct s_edid_data *p_edid = &ctx->slimport_edid_p; in anx7625_get_edid()
1800 if (ctx->slimport_edid_p.edid_block_num > 0) { in anx7625_get_edid()
1801 memcpy(edid, ctx->slimport_edid_p.edid_raw_data, in anx7625_get_edid()
1808 edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data); in anx7625_get_edid()
1817 p_edid->edid_block_num = edid_num; in anx7625_get_edid()
1819 memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE); in anx7625_get_edid()
1825 struct device *dev = ctx->dev; in anx7625_sink_detect()
1829 if (ctx->pdata.panel_bridge) in anx7625_sink_detect()
1832 return ctx->hpd_status ? connector_status_connected : in anx7625_sink_detect()
1849 if (fmt->fmt != HDMI_DSP_A && fmt->fmt != HDMI_I2S) { in anx7625_audio_hw_params()
1851 return -EINVAL; in anx7625_audio_hw_params()
1855 params->sample_rate, params->sample_width, in anx7625_audio_hw_params()
1856 params->cea.channels); in anx7625_audio_hw_params()
1858 if (fmt->fmt == HDMI_DSP_A) in anx7625_audio_hw_params()
1859 ret = anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1864 ret = anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1870 switch (params->sample_width) { in anx7625_audio_hw_params()
1885 params->sample_width); in anx7625_audio_hw_params()
1886 return -EINVAL; in anx7625_audio_hw_params()
1888 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1893 switch (params->cea.channels) { in anx7625_audio_hw_params()
1908 params->cea.channels); in anx7625_audio_hw_params()
1909 return -EINVAL; in anx7625_audio_hw_params()
1911 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1914 ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1917 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1921 switch (params->sample_rate) { in anx7625_audio_hw_params()
1945 params->sample_rate); in anx7625_audio_hw_params()
1946 return -EINVAL; in anx7625_audio_hw_params()
1948 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1951 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_audio_hw_params()
1955 return -EIO; in anx7625_audio_hw_params()
1988 if (ctx->plugged_cb && ctx->codec_dev) { in anx7625_audio_update_connector_status()
1989 ctx->plugged_cb(ctx->codec_dev, in anx7625_audio_update_connector_status()
2000 ctx->plugged_cb = fn; in anx7625_audio_hook_plugged_cb()
2001 ctx->codec_dev = codec_dev; in anx7625_audio_hook_plugged_cb()
2012 if (!ctx->connector) { in anx7625_audio_get_eld()
2017 memcpy(buf, ctx->connector->eld, in anx7625_audio_get_eld()
2018 min(sizeof(ctx->connector->eld), len)); in anx7625_audio_get_eld()
2034 struct device *dev = ctx->dev; in anx7625_unregister_audio()
2036 if (ctx->audio_pdev) { in anx7625_unregister_audio()
2037 platform_device_unregister(ctx->audio_pdev); in anx7625_unregister_audio()
2038 ctx->audio_pdev = NULL; in anx7625_unregister_audio()
2053 ctx->audio_pdev = platform_device_register_data(dev, in anx7625_register_audio()
2059 if (IS_ERR(ctx->audio_pdev)) in anx7625_register_audio()
2060 return PTR_ERR(ctx->audio_pdev); in anx7625_register_audio()
2070 struct device *dev = ctx->dev; in anx7625_setup_dsi_device()
2078 host = of_find_mipi_dsi_host_by_node(ctx->pdata.mipi_host_node); in anx7625_setup_dsi_device()
2080 return dev_err_probe(dev, -EPROBE_DEFER, "fail to find dsi host.\n"); in anx7625_setup_dsi_device()
2085 return -EINVAL; in anx7625_setup_dsi_device()
2088 dsi->lanes = ctx->pdata.mipi_lanes; in anx7625_setup_dsi_device()
2089 dsi->format = MIPI_DSI_FMT_RGB888; in anx7625_setup_dsi_device()
2090 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | in anx7625_setup_dsi_device()
2095 ctx->dsi = dsi; in anx7625_setup_dsi_device()
2102 struct device *dev = ctx->dev; in anx7625_attach_dsi()
2107 ret = devm_mipi_dsi_attach(dev, ctx->dsi); in anx7625_attach_dsi()
2128 dev = ctx->dev; in hdcp_check_work_func()
2130 if (!ctx->connector) { in hdcp_check_work_func()
2135 drm_dev = ctx->connector->dev; in hdcp_check_work_func()
2136 drm_modeset_lock(&drm_dev->mode_config.connection_mutex, NULL); in hdcp_check_work_func()
2137 mutex_lock(&ctx->hdcp_wq_lock); in hdcp_check_work_func()
2139 status = anx7625_reg_read(ctx, ctx->i2c.tx_p0_client, 0); in hdcp_check_work_func()
2142 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_ENABLED; in hdcp_check_work_func()
2143 drm_hdcp_update_content_protection(ctx->connector, in hdcp_check_work_func()
2144 ctx->hdcp_cp); in hdcp_check_work_func()
2148 mutex_unlock(&ctx->hdcp_wq_lock); in hdcp_check_work_func()
2149 drm_modeset_unlock(&drm_dev->mode_config.connection_mutex); in hdcp_check_work_func()
2155 struct device *dev = ctx->dev; in anx7625_connector_atomic_check()
2159 cp = state->content_protection; in anx7625_connector_atomic_check()
2161 if (cp == ctx->hdcp_cp) in anx7625_connector_atomic_check()
2165 if (ctx->dp_en) { in anx7625_connector_atomic_check()
2169 queue_delayed_work(ctx->hdcp_workqueue, in anx7625_connector_atomic_check()
2170 &ctx->hdcp_work, in anx7625_connector_atomic_check()
2176 if (ctx->hdcp_cp != DRM_MODE_CONTENT_PROTECTION_ENABLED) { in anx7625_connector_atomic_check()
2178 return -EINVAL; in anx7625_connector_atomic_check()
2181 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; in anx7625_connector_atomic_check()
2182 drm_hdcp_update_content_protection(ctx->connector, in anx7625_connector_atomic_check()
2183 ctx->hdcp_cp); in anx7625_connector_atomic_check()
2189 return -EINVAL; in anx7625_connector_atomic_check()
2200 struct device *dev = ctx->dev; in anx7625_bridge_attach()
2204 return -EINVAL; in anx7625_bridge_attach()
2206 if (!bridge->encoder) { in anx7625_bridge_attach()
2208 return -ENODEV; in anx7625_bridge_attach()
2211 ctx->aux.drm_dev = bridge->dev; in anx7625_bridge_attach()
2212 err = drm_dp_aux_register(&ctx->aux); in anx7625_bridge_attach()
2218 if (ctx->pdata.panel_bridge) { in anx7625_bridge_attach()
2219 err = drm_bridge_attach(bridge->encoder, in anx7625_bridge_attach()
2220 ctx->pdata.panel_bridge, in anx7625_bridge_attach()
2221 &ctx->bridge, flags); in anx7625_bridge_attach()
2226 ctx->bridge_attached = 1; in anx7625_bridge_attach()
2235 drm_dp_aux_unregister(&ctx->aux); in anx7625_bridge_detach()
2244 struct device *dev = ctx->dev; in anx7625_bridge_mode_valid()
2249 if (mode->clock > SUPPORT_PIXEL_CLOCK) { in anx7625_bridge_mode_valid()
2265 struct device *dev = ctx->dev; in anx7625_bridge_mode_set()
2269 ctx->dt.pixelclock.min = mode->clock; in anx7625_bridge_mode_set()
2270 ctx->dt.hactive.min = mode->hdisplay; in anx7625_bridge_mode_set()
2271 ctx->dt.hsync_len.min = mode->hsync_end - mode->hsync_start; in anx7625_bridge_mode_set()
2272 ctx->dt.hfront_porch.min = mode->hsync_start - mode->hdisplay; in anx7625_bridge_mode_set()
2273 ctx->dt.hback_porch.min = mode->htotal - mode->hsync_end; in anx7625_bridge_mode_set()
2274 ctx->dt.vactive.min = mode->vdisplay; in anx7625_bridge_mode_set()
2275 ctx->dt.vsync_len.min = mode->vsync_end - mode->vsync_start; in anx7625_bridge_mode_set()
2276 ctx->dt.vfront_porch.min = mode->vsync_start - mode->vdisplay; in anx7625_bridge_mode_set()
2277 ctx->dt.vback_porch.min = mode->vtotal - mode->vsync_end; in anx7625_bridge_mode_set()
2279 ctx->display_timing_valid = 1; in anx7625_bridge_mode_set()
2281 DRM_DEV_DEBUG_DRIVER(dev, "pixelclock(%d).\n", ctx->dt.pixelclock.min); in anx7625_bridge_mode_set()
2283 ctx->dt.hactive.min, in anx7625_bridge_mode_set()
2284 ctx->dt.hsync_len.min, in anx7625_bridge_mode_set()
2285 ctx->dt.hfront_porch.min, in anx7625_bridge_mode_set()
2286 ctx->dt.hback_porch.min); in anx7625_bridge_mode_set()
2288 ctx->dt.vactive.min, in anx7625_bridge_mode_set()
2289 ctx->dt.vsync_len.min, in anx7625_bridge_mode_set()
2290 ctx->dt.vfront_porch.min, in anx7625_bridge_mode_set()
2291 ctx->dt.vback_porch.min); in anx7625_bridge_mode_set()
2293 mode->hdisplay, in anx7625_bridge_mode_set()
2294 mode->hsync_start); in anx7625_bridge_mode_set()
2296 mode->hsync_end, in anx7625_bridge_mode_set()
2297 mode->htotal); in anx7625_bridge_mode_set()
2299 mode->vdisplay, in anx7625_bridge_mode_set()
2300 mode->vsync_start); in anx7625_bridge_mode_set()
2302 mode->vsync_end, in anx7625_bridge_mode_set()
2303 mode->vtotal); in anx7625_bridge_mode_set()
2311 struct device *dev = ctx->dev; in anx7625_bridge_mode_fixup()
2319 if (!ctx->pdata.panel_bridge) in anx7625_bridge_mode_fixup()
2322 hsync = mode->hsync_end - mode->hsync_start; in anx7625_bridge_mode_fixup()
2323 hfp = mode->hsync_start - mode->hdisplay; in anx7625_bridge_mode_fixup()
2324 hbp = mode->htotal - mode->hsync_end; in anx7625_bridge_mode_fixup()
2325 hblanking = mode->htotal - mode->hdisplay; in anx7625_bridge_mode_fixup()
2329 hsync, hfp, hbp, adj->clock); in anx7625_bridge_mode_fixup()
2331 adj->hsync_start, adj->hsync_end, adj->htotal); in anx7625_bridge_mode_fixup()
2346 adj_hbp -= 1; in anx7625_bridge_mode_fixup()
2347 adj_hblanking -= 1; in anx7625_bridge_mode_fixup()
2355 adj_hsync -= 1; in anx7625_bridge_mode_fixup()
2360 * This adjusting made for built-in eDP panel, for the externel in anx7625_bridge_mode_fixup()
2367 vref = adj->clock * 1000 / (adj->htotal * adj->vtotal); in anx7625_bridge_mode_fixup()
2369 delta_adj = HBLANKING_MIN - hblanking; in anx7625_bridge_mode_fixup()
2370 adj_clock = vref * delta_adj * adj->vtotal; in anx7625_bridge_mode_fixup()
2371 adj->clock += DIV_ROUND_UP(adj_clock, 1000); in anx7625_bridge_mode_fixup()
2373 delta_adj = hblanking - HBLANKING_MIN; in anx7625_bridge_mode_fixup()
2374 adj_clock = vref * delta_adj * adj->vtotal; in anx7625_bridge_mode_fixup()
2375 adj->clock -= DIV_ROUND_UP(adj_clock, 1000); in anx7625_bridge_mode_fixup()
2382 delta_adj = HP_MIN - adj_hfp; in anx7625_bridge_mode_fixup()
2389 if ((adj_hbp - delta_adj) < HP_MIN) in anx7625_bridge_mode_fixup()
2391 adj_hsync -= delta_adj; in anx7625_bridge_mode_fixup()
2393 adj_hbp -= delta_adj; in anx7625_bridge_mode_fixup()
2395 delta_adj = HP_MIN - adj_hbp; in anx7625_bridge_mode_fixup()
2402 if ((adj_hfp - delta_adj) < HP_MIN) in anx7625_bridge_mode_fixup()
2404 adj_hsync -= delta_adj; in anx7625_bridge_mode_fixup()
2406 adj_hfp -= delta_adj; in anx7625_bridge_mode_fixup()
2411 adj_hsync, adj_hfp, adj_hbp, adj->clock); in anx7625_bridge_mode_fixup()
2414 adj->hsync_start = adj->hdisplay + adj_hfp; in anx7625_bridge_mode_fixup()
2415 adj->hsync_end = adj->hsync_start + adj_hsync; in anx7625_bridge_mode_fixup()
2416 adj->htotal = adj->hsync_end + adj_hbp; in anx7625_bridge_mode_fixup()
2418 adj->hsync_start, adj->hsync_end, adj->htotal); in anx7625_bridge_mode_fixup()
2429 struct device *dev = ctx->dev; in anx7625_bridge_atomic_check()
2433 anx7625_bridge_mode_fixup(bridge, &crtc_state->mode, in anx7625_bridge_atomic_check()
2434 &crtc_state->adjusted_mode); in anx7625_bridge_atomic_check()
2443 struct device *dev = ctx->dev; in anx7625_bridge_atomic_enable()
2448 if (!bridge->encoder) { in anx7625_bridge_atomic_enable()
2453 connector = drm_atomic_get_new_connector_for_encoder(state->base.state, in anx7625_bridge_atomic_enable()
2454 bridge->encoder); in anx7625_bridge_atomic_enable()
2458 ctx->connector = connector; in anx7625_bridge_atomic_enable()
2470 struct device *dev = ctx->dev; in anx7625_bridge_atomic_disable()
2474 ctx->connector = NULL; in anx7625_bridge_atomic_disable()
2477 mutex_lock(&ctx->aux_lock); in anx7625_bridge_atomic_disable()
2479 mutex_unlock(&ctx->aux_lock); in anx7625_bridge_atomic_disable()
2490 struct device *dev = ctx->dev; in anx7625_bridge_detect()
2504 struct device *dev = ctx->dev; in anx7625_bridge_get_edid()
2529 struct device *dev = ctx->dev; in anx7625_register_i2c_dummy_clients()
2531 ctx->i2c.tx_p0_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2533 if (IS_ERR(ctx->i2c.tx_p0_client)) in anx7625_register_i2c_dummy_clients()
2534 return PTR_ERR(ctx->i2c.tx_p0_client); in anx7625_register_i2c_dummy_clients()
2536 ctx->i2c.tx_p1_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2538 if (IS_ERR(ctx->i2c.tx_p1_client)) in anx7625_register_i2c_dummy_clients()
2539 return PTR_ERR(ctx->i2c.tx_p1_client); in anx7625_register_i2c_dummy_clients()
2541 ctx->i2c.tx_p2_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2543 if (IS_ERR(ctx->i2c.tx_p2_client)) in anx7625_register_i2c_dummy_clients()
2544 return PTR_ERR(ctx->i2c.tx_p2_client); in anx7625_register_i2c_dummy_clients()
2546 ctx->i2c.rx_p0_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2548 if (IS_ERR(ctx->i2c.rx_p0_client)) in anx7625_register_i2c_dummy_clients()
2549 return PTR_ERR(ctx->i2c.rx_p0_client); in anx7625_register_i2c_dummy_clients()
2551 ctx->i2c.rx_p1_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2553 if (IS_ERR(ctx->i2c.rx_p1_client)) in anx7625_register_i2c_dummy_clients()
2554 return PTR_ERR(ctx->i2c.rx_p1_client); in anx7625_register_i2c_dummy_clients()
2556 ctx->i2c.rx_p2_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2558 if (IS_ERR(ctx->i2c.rx_p2_client)) in anx7625_register_i2c_dummy_clients()
2559 return PTR_ERR(ctx->i2c.rx_p2_client); in anx7625_register_i2c_dummy_clients()
2561 ctx->i2c.tcpc_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2563 if (IS_ERR(ctx->i2c.tcpc_client)) in anx7625_register_i2c_dummy_clients()
2564 return PTR_ERR(ctx->i2c.tcpc_client); in anx7625_register_i2c_dummy_clients()
2573 mutex_lock(&ctx->lock); in anx7625_runtime_pm_suspend()
2576 if (!ctx->pdata.panel_bridge) in anx7625_runtime_pm_suspend()
2580 mutex_unlock(&ctx->lock); in anx7625_runtime_pm_suspend()
2589 mutex_lock(&ctx->lock); in anx7625_runtime_pm_resume()
2593 mutex_unlock(&ctx->lock); in anx7625_runtime_pm_resume()
2614 struct device *dev = aux->dev; in anx7625_link_bridge()
2617 ret = anx7625_parse_dt_panel(dev, &platform->pdata); in anx7625_link_bridge()
2623 platform->bridge.funcs = &anx7625_bridge_funcs; in anx7625_link_bridge()
2624 platform->bridge.of_node = dev->of_node; in anx7625_link_bridge()
2626 platform->bridge.ops |= DRM_BRIDGE_OP_EDID; in anx7625_link_bridge()
2627 if (!platform->pdata.panel_bridge) in anx7625_link_bridge()
2628 platform->bridge.ops |= DRM_BRIDGE_OP_HPD | in anx7625_link_bridge()
2630 platform->bridge.type = platform->pdata.panel_bridge ? in anx7625_link_bridge()
2634 drm_bridge_add(&platform->bridge); in anx7625_link_bridge()
2636 if (!platform->pdata.is_dpi) { in anx7625_link_bridge()
2639 drm_bridge_remove(&platform->bridge); in anx7625_link_bridge()
2650 struct device *dev = &client->dev; in anx7625_i2c_probe()
2652 if (!i2c_check_functionality(client->adapter, in anx7625_i2c_probe()
2655 return -ENODEV; in anx7625_i2c_probe()
2661 return -ENOMEM; in anx7625_i2c_probe()
2664 pdata = &platform->pdata; in anx7625_i2c_probe()
2666 platform->dev = &client->dev; in anx7625_i2c_probe()
2669 pdata->supplies[0].supply = "vdd10"; in anx7625_i2c_probe()
2670 pdata->supplies[1].supply = "vdd18"; in anx7625_i2c_probe()
2671 pdata->supplies[2].supply = "vdd33"; in anx7625_i2c_probe()
2672 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(pdata->supplies), in anx7625_i2c_probe()
2673 pdata->supplies); in anx7625_i2c_probe()
2680 mutex_init(&platform->lock); in anx7625_i2c_probe()
2681 mutex_init(&platform->hdcp_wq_lock); in anx7625_i2c_probe()
2682 mutex_init(&platform->aux_lock); in anx7625_i2c_probe()
2684 INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func); in anx7625_i2c_probe()
2685 platform->hdcp_workqueue = create_workqueue("hdcp workqueue"); in anx7625_i2c_probe()
2686 if (!platform->hdcp_workqueue) { in anx7625_i2c_probe()
2688 ret = -ENOMEM; in anx7625_i2c_probe()
2692 platform->pdata.intp_irq = client->irq; in anx7625_i2c_probe()
2693 if (platform->pdata.intp_irq) { in anx7625_i2c_probe()
2694 INIT_WORK(&platform->work, anx7625_work_func); in anx7625_i2c_probe()
2695 platform->workqueue = alloc_workqueue("anx7625_work", in anx7625_i2c_probe()
2697 if (!platform->workqueue) { in anx7625_i2c_probe()
2699 ret = -ENOMEM; in anx7625_i2c_probe()
2703 ret = devm_request_threaded_irq(dev, platform->pdata.intp_irq, in anx7625_i2c_probe()
2707 "anx7625-intp", platform); in anx7625_i2c_probe()
2714 platform->aux.name = "anx7625-aux"; in anx7625_i2c_probe()
2715 platform->aux.dev = dev; in anx7625_i2c_probe()
2716 platform->aux.transfer = anx7625_aux_transfer; in anx7625_i2c_probe()
2717 platform->aux.wait_hpd_asserted = anx7625_wait_hpd_asserted; in anx7625_i2c_probe()
2718 drm_dp_aux_init(&platform->aux); in anx7625_i2c_probe()
2722 if (ret != -EPROBE_DEFER) in anx7625_i2c_probe()
2727 if (!platform->pdata.is_dpi) { in anx7625_i2c_probe()
2739 ret = -ENOMEM; in anx7625_i2c_probe()
2757 ret = devm_of_dp_aux_populate_bus(&platform->aux, anx7625_link_bridge); in anx7625_i2c_probe()
2759 if (ret != -ENODEV) { in anx7625_i2c_probe()
2764 ret = anx7625_link_bridge(&platform->aux); in anx7625_i2c_probe()
2769 if (!platform->pdata.low_power_mode) { in anx7625_i2c_probe()
2776 if (platform->pdata.intp_irq) in anx7625_i2c_probe()
2777 queue_work(platform->workqueue, &platform->work); in anx7625_i2c_probe()
2779 if (platform->pdata.audio_en) in anx7625_i2c_probe()
2787 if (platform->workqueue) in anx7625_i2c_probe()
2788 destroy_workqueue(platform->workqueue); in anx7625_i2c_probe()
2791 if (platform->hdcp_workqueue) in anx7625_i2c_probe()
2792 destroy_workqueue(platform->hdcp_workqueue); in anx7625_i2c_probe()
2801 drm_bridge_remove(&platform->bridge); in anx7625_i2c_remove()
2803 if (platform->pdata.intp_irq) in anx7625_i2c_remove()
2804 destroy_workqueue(platform->workqueue); in anx7625_i2c_remove()
2806 if (platform->hdcp_workqueue) { in anx7625_i2c_remove()
2807 cancel_delayed_work(&platform->hdcp_work); in anx7625_i2c_remove()
2808 flush_workqueue(platform->hdcp_workqueue); in anx7625_i2c_remove()
2809 destroy_workqueue(platform->hdcp_workqueue); in anx7625_i2c_remove()
2812 if (!platform->pdata.low_power_mode) in anx7625_i2c_remove()
2813 pm_runtime_put_sync_suspend(&client->dev); in anx7625_i2c_remove()
2815 if (platform->pdata.audio_en) in anx7625_i2c_remove()