Lines Matching +full:aux +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0-only
37 #include <media/v4l2-fwnode.h>
38 #include <sound/hdmi-codec.h>
52 struct device *dev = &client->dev; in i2c_access_workaround()
55 if (client == ctx->last_client) in i2c_access_workaround()
58 ctx->last_client = client; in i2c_access_workaround()
60 if (client == ctx->i2c.tcpc_client) in i2c_access_workaround()
62 else if (client == ctx->i2c.tx_p0_client) in i2c_access_workaround()
64 else if (client == ctx->i2c.tx_p1_client) in i2c_access_workaround()
66 else if (client == ctx->i2c.rx_p0_client) in i2c_access_workaround()
68 else if (client == ctx->i2c.rx_p1_client) in i2c_access_workaround()
77 client->addr, offset); in i2c_access_workaround()
86 struct device *dev = &client->dev; in anx7625_reg_read()
93 client->addr, reg_addr); in anx7625_reg_read()
103 struct device *dev = &client->dev; in anx7625_reg_block_read()
110 client->addr, reg_addr); in anx7625_reg_block_read()
120 struct device *dev = &client->dev; in anx7625_reg_write()
128 client->addr, reg_addr); in anx7625_reg_write()
138 struct device *dev = &client->dev; in anx7625_reg_block_write()
145 client->addr, reg_addr); in anx7625_reg_block_write()
194 ret = anx7625_write_or(ctx, ctx->i2c.tx_p2_client, in anx7625_config_bit_matrix()
197 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_config_bit_matrix()
206 return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, AP_AUX_CTRL_STATUS); in anx7625_read_ctrl_status_p0()
211 struct device *dev = &ctx->client->dev; in wait_aux_op_finish()
221 DRM_DEV_ERROR(dev, "aux operation fail!\n"); in wait_aux_op_finish()
222 return -EIO; in wait_aux_op_finish()
225 val = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in wait_aux_op_finish()
228 DRM_DEV_ERROR(dev, "aux status %02x\n", val); in wait_aux_op_finish()
229 return -EIO; in wait_aux_op_finish()
238 struct device *dev = &ctx->client->dev; in anx7625_aux_trans()
245 dev_err(dev, "exceed aux buffer len.\n"); in anx7625_aux_trans()
246 return -EINVAL; in anx7625_aux_trans()
261 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
264 /* Set aux access address */ 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()
269 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
273 ret |= anx7625_reg_block_write(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
275 /* Enable aux access */ in anx7625_aux_trans()
276 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
280 dev_err(dev, "cannot access aux related register.\n"); in anx7625_aux_trans()
281 return -EIO; in anx7625_aux_trans()
286 dev_err(dev, "aux IO error: wait aux op finish.\n"); in anx7625_aux_trans()
295 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in anx7625_aux_trans()
299 return -EIO; in anx7625_aux_trans()
312 ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
315 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
319 ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
322 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_video_mute_control()
372 return -EINVAL; in anx7625_calculate_m_n()
380 return -EINVAL; in anx7625_calculate_m_n()
396 return -EDOM; in anx7625_calculate_m_n()
416 return -EDOM; in anx7625_calculate_m_n()
431 struct device *dev = &ctx->client->dev; in anx7625_odfc_config()
434 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_16, in anx7625_odfc_config()
436 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_16, in anx7625_odfc_config()
439 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, in anx7625_odfc_config()
441 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_8, in anx7625_odfc_config()
444 /* Add patch for MIS2-125 (5pcs ANX7625 fail ATE MBIST test) */ in anx7625_odfc_config()
445 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7, in anx7625_odfc_config()
449 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7, in anx7625_odfc_config()
451 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7, in anx7625_odfc_config()
469 struct edid *edid = (struct edid *)ctx->slimport_edid_p.edid_raw_data; in anx7625_set_k_value()
471 if (edid->mfg_id[0] == IVO_MID0 && edid->mfg_id[1] == IVO_MID1) in anx7625_set_k_value()
472 return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_set_k_value()
475 return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_set_k_value()
481 struct device *dev = &ctx->client->dev; in anx7625_dsi_video_timing_config()
487 ret = anx7625_calculate_m_n(ctx->dt.pixelclock.min * 1000, in anx7625_dsi_video_timing_config()
499 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, PIXEL_CLOCK_L, in anx7625_dsi_video_timing_config()
500 (ctx->dt.pixelclock.min / 1000) & 0xFF); in anx7625_dsi_video_timing_config()
501 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, PIXEL_CLOCK_H, in anx7625_dsi_video_timing_config()
502 (ctx->dt.pixelclock.min / 1000) >> 8); in anx7625_dsi_video_timing_config()
504 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
506 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, in anx7625_dsi_video_timing_config()
507 MIPI_LANE_CTRL_0, ctx->pdata.mipi_lanes - 1); in anx7625_dsi_video_timing_config()
510 htotal = ctx->dt.hactive.min + ctx->dt.hfront_porch.min + in anx7625_dsi_video_timing_config()
511 ctx->dt.hback_porch.min + ctx->dt.hsync_len.min; in anx7625_dsi_video_timing_config()
512 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
514 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, 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_L, ctx->dt.hactive.min & 0xFF); in anx7625_dsi_video_timing_config()
519 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
520 HORIZONTAL_ACTIVE_PIXELS_H, ctx->dt.hactive.min >> 8); in anx7625_dsi_video_timing_config()
522 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
523 HORIZONTAL_FRONT_PORCH_L, ctx->dt.hfront_porch.min); in anx7625_dsi_video_timing_config()
524 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
526 ctx->dt.hfront_porch.min >> 8); 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_L, ctx->dt.hsync_len.min); in anx7625_dsi_video_timing_config()
530 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
531 HORIZONTAL_SYNC_WIDTH_H, ctx->dt.hsync_len.min >> 8); 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_L, ctx->dt.hback_porch.min); in anx7625_dsi_video_timing_config()
535 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
536 HORIZONTAL_BACK_PORCH_H, ctx->dt.hback_porch.min >> 8); in anx7625_dsi_video_timing_config()
538 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, ACTIVE_LINES_L, in anx7625_dsi_video_timing_config()
539 ctx->dt.vactive.min); in anx7625_dsi_video_timing_config()
540 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, ACTIVE_LINES_H, in anx7625_dsi_video_timing_config()
541 ctx->dt.vactive.min >> 8); in anx7625_dsi_video_timing_config()
543 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
544 VERTICAL_FRONT_PORCH, ctx->dt.vfront_porch.min); in anx7625_dsi_video_timing_config()
546 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
547 VERTICAL_SYNC_WIDTH, ctx->dt.vsync_len.min); in anx7625_dsi_video_timing_config()
549 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p2_client, in anx7625_dsi_video_timing_config()
550 VERTICAL_BACK_PORCH, ctx->dt.vback_porch.min); 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()
556 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, in anx7625_dsi_video_timing_config()
563 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, MIPI_PLL_N_NUM_7_0, in anx7625_dsi_video_timing_config()
568 ret |= anx7625_odfc_config(ctx, post_divider - 1); in anx7625_dsi_video_timing_config()
579 struct device *dev = &ctx->client->dev; in anx7625_swap_dsi_lane3()
581 /* Swap MIPI-DSI data lane 3 P and N */ in anx7625_swap_dsi_lane3()
582 val = anx7625_reg_read(ctx, ctx->i2c.rx_p1_client, MIPI_SWAP); in anx7625_swap_dsi_lane3()
585 return -EIO; in anx7625_swap_dsi_lane3()
589 return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, MIPI_SWAP, val); in anx7625_swap_dsi_lane3()
596 struct device *dev = &ctx->client->dev; in anx7625_api_dsi_config()
598 /* Swap MIPI-DSI data lane 3 P and N */ in anx7625_api_dsi_config()
614 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
621 * P332 D-PHY Probe) default D-PHY timing in anx7625_api_dsi_config()
624 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
628 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_18, in anx7625_api_dsi_config()
638 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_6, in anx7625_api_dsi_config()
641 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_6, in anx7625_api_dsi_config()
645 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()
650 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dsi_config()
661 struct device *dev = &ctx->client->dev; in anx7625_dsi_config()
667 ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dsi_config()
678 ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_dsi_config()
681 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dsi_config()
693 struct device *dev = &ctx->client->dev; in anx7625_api_dpi_config()
694 u16 freq = ctx->dt.pixelclock.min / 1000; in anx7625_api_dpi_config()
698 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_api_dpi_config()
700 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_api_dpi_config()
705 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dpi_config()
708 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dpi_config()
711 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, in anx7625_api_dpi_config()
714 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_api_dpi_config()
724 struct device *dev = &ctx->client->dev; in anx7625_dpi_config()
730 ret = anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dpi_config()
750 ret = anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_dpi_config()
753 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in anx7625_dpi_config()
763 return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, R_RAM_CTRL); in anx7625_read_flash_status()
769 struct device *dev = &ctx->client->dev; in anx7625_hdcp_key_probe()
772 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
774 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
781 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
782 FLASH_LEN_HIGH, (FLASH_BUF_LEN - 1) >> 8); in anx7625_hdcp_key_probe()
783 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
784 FLASH_LEN_LOW, (FLASH_BUF_LEN - 1) & 0xFF); in anx7625_hdcp_key_probe()
790 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
799 return -EIO; in anx7625_hdcp_key_probe()
802 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_probe()
807 return -EIO; in anx7625_hdcp_key_probe()
811 return -EINVAL; in anx7625_hdcp_key_probe()
819 struct device *dev = &ctx->client->dev; 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()
830 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()
835 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
838 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hdcp_key_load()
847 struct device *dev = &ctx->client->dev; in anx7625_hdcp_disable()
852 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, 0xee, 0x9f); in anx7625_hdcp_disable()
854 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); in anx7625_hdcp_disable()
856 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); in anx7625_hdcp_disable()
860 return anx7625_write_and(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_disable()
868 struct device *dev = &ctx->client->dev; in anx7625_hdcp_enable()
889 ret = anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
894 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
899 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
902 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
910 ret = anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xee, 0x20); in anx7625_hdcp_enable()
913 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); in anx7625_hdcp_enable()
915 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); in anx7625_hdcp_enable()
919 return anx7625_write_or(ctx, ctx->i2c.tx_p0_client, in anx7625_hdcp_enable()
926 struct device *dev = &ctx->client->dev; in anx7625_dp_start()
929 if (!ctx->display_timing_valid) { in anx7625_dp_start()
942 anx7625_write_and(ctx, ctx->i2c.rx_p1_client, 0xee, 0x9f); in anx7625_dp_start()
944 if (ctx->pdata.is_dpi) in anx7625_dp_start()
952 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; in anx7625_dp_start()
954 ctx->dp_en = 1; in anx7625_dp_start()
959 struct device *dev = &ctx->client->dev; in anx7625_dp_stop()
969 ret = anx7625_write_and(ctx, ctx->i2c.tx_p0_client, 0x87, 0xfe); in anx7625_dp_stop()
970 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, 0x08, 0x7f); in anx7625_dp_stop()
981 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; in anx7625_dp_stop()
983 ctx->dp_en = 0; in anx7625_dp_stop()
990 ret = anx7625_write_or(ctx, ctx->i2c.tx_p2_client, RST_CTRL2, in sp_tx_rst_aux()
992 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, RST_CTRL2, in sp_tx_rst_aux()
1001 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_wr()
1003 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_wr()
1005 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_wr()
1014 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_rd()
1016 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in sp_tx_aux_rd()
1024 struct device *dev = &ctx->client->dev; in sp_tx_get_edid_block()
1028 c = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, AP_AUX_BUFF_START); in sp_tx_get_edid_block()
1030 DRM_DEV_ERROR(dev, "IO error : access AUX BUFF.\n"); in sp_tx_get_edid_block()
1031 return -EIO; in sp_tx_get_edid_block()
1046 struct device *dev = &ctx->client->dev; in edid_read()
1057 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in edid_read()
1067 return -EIO; in edid_read()
1077 struct device *dev = &ctx->client->dev; 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()
1084 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1092 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1095 DRM_DEV_ERROR(dev, "IO error : aux initial fail.\n"); in segments_edid_read()
1108 ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client, in segments_edid_read()
1117 return -EIO; in segments_edid_read()
1132 struct device *dev = &ctx->client->dev; in sp_tx_edid_read()
1135 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_edid_read()
1137 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in sp_tx_edid_read()
1139 ret |= anx7625_write_and(ctx, ctx->i2c.rx_p0_client, in sp_tx_edid_read()
1142 DRM_DEV_ERROR(dev, "access aux channel IO error.\n"); in sp_tx_edid_read()
1143 return -EIO; in sp_tx_edid_read()
1224 return -EINVAL; in sp_tx_edid_read()
1227 /* Reset aux channel */ in sp_tx_edid_read()
1230 DRM_DEV_ERROR(dev, "Failed to reset aux channel!\n"); in sp_tx_edid_read()
1239 struct device *dev = &ctx->client->dev; in anx7625_power_on()
1242 if (!ctx->pdata.low_power_mode) { in anx7625_power_on()
1247 for (i = 0; i < ARRAY_SIZE(ctx->pdata.supplies); i++) { in anx7625_power_on()
1248 ret = regulator_enable(ctx->pdata.supplies[i].consumer); in anx7625_power_on()
1260 gpiod_set_value(ctx->pdata.gpio_p_on, 1); in anx7625_power_on()
1263 gpiod_set_value(ctx->pdata.gpio_reset, 1); in anx7625_power_on()
1269 for (--i; i >= 0; i--) in anx7625_power_on()
1270 regulator_disable(ctx->pdata.supplies[i].consumer); in anx7625_power_on()
1275 struct device *dev = &ctx->client->dev; in anx7625_power_standby()
1278 if (!ctx->pdata.low_power_mode) { in anx7625_power_standby()
1283 gpiod_set_value(ctx->pdata.gpio_reset, 0); in anx7625_power_standby()
1285 gpiod_set_value(ctx->pdata.gpio_p_on, 0); in anx7625_power_standby()
1288 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->pdata.supplies), in anx7625_power_standby()
1289 ctx->pdata.supplies); in anx7625_power_standby()
1299 anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_config()
1305 struct device *dev = &ctx->client->dev; in anx7625_disable_pd_protocol()
1309 ret = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, 0x88, 0x40); in anx7625_disable_pd_protocol()
1311 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_disable_pd_protocol()
1314 ret |= anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, 0x88, 0x00); in anx7625_disable_pd_protocol()
1325 struct device *dev = &ctx->client->dev; in anx7625_ocm_loading_check()
1328 ret = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in anx7625_ocm_loading_check()
1335 return -ENODEV; in anx7625_ocm_loading_check()
1341 ctx->i2c.rx_p0_client, in anx7625_ocm_loading_check()
1344 ctx->i2c.rx_p0_client, in anx7625_ocm_loading_check()
1371 struct device *dev = &platform->client->dev; in anx7625_init_gpio()
1376 platform->pdata.gpio_p_on = in anx7625_init_gpio()
1378 if (IS_ERR_OR_NULL(platform->pdata.gpio_p_on)) { in anx7625_init_gpio()
1380 platform->pdata.gpio_p_on = NULL; in anx7625_init_gpio()
1384 platform->pdata.gpio_reset = in anx7625_init_gpio()
1386 if (IS_ERR_OR_NULL(platform->pdata.gpio_reset)) { in anx7625_init_gpio()
1388 platform->pdata.gpio_reset = NULL; in anx7625_init_gpio()
1391 if (platform->pdata.gpio_p_on && platform->pdata.gpio_reset) { in anx7625_init_gpio()
1392 platform->pdata.low_power_mode = 1; in anx7625_init_gpio()
1394 desc_to_gpio(platform->pdata.gpio_p_on), in anx7625_init_gpio()
1395 desc_to_gpio(platform->pdata.gpio_reset)); in anx7625_init_gpio()
1397 platform->pdata.low_power_mode = 0; in anx7625_init_gpio()
1404 ctx->hpd_status = 0; in anx7625_stop_dp_work()
1405 ctx->hpd_high_cnt = 0; in anx7625_stop_dp_work()
1406 ctx->display_timing_valid = 0; in anx7625_stop_dp_work()
1412 struct device *dev = &ctx->client->dev; in anx7625_start_dp_work()
1414 if (ctx->hpd_high_cnt >= 2) { in anx7625_start_dp_work()
1419 ctx->hpd_status = 1; in anx7625_start_dp_work()
1420 ctx->hpd_high_cnt++; in anx7625_start_dp_work()
1423 ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, 0xee, 0x9f); in anx7625_start_dp_work()
1426 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xec, 0x10); in anx7625_start_dp_work()
1428 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, 0xff, 0x01); in anx7625_start_dp_work()
1434 ret = anx7625_reg_read(ctx, ctx->i2c.rx_p1_client, 0x86); in anx7625_start_dp_work()
1446 ret = anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_read_hpd_status_p0()
1448 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_read_hpd_status_p0()
1451 ret |= anx7625_reg_write(ctx, ctx->i2c.tx_p2_client, in anx7625_read_hpd_status_p0()
1457 return anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, SYSTEM_STSTUS); in anx7625_read_hpd_status_p0()
1464 struct device *dev = &ctx->client->dev; in _anx7625_hpd_polling()
1467 if (ctx->pdata.intp_irq) in _anx7625_hpd_polling()
1481 anx7625_reg_write(ctx, ctx->i2c.tcpc_client, in _anx7625_hpd_polling()
1483 anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in _anx7625_hpd_polling()
1488 if (!ctx->pdata.panel_bridge && ctx->bridge_attached) in _anx7625_hpd_polling()
1489 drm_helper_hpd_irq_event(ctx->bridge.dev); in _anx7625_hpd_polling()
1494 static int anx7625_wait_hpd_asserted(struct drm_dp_aux *aux, in anx7625_wait_hpd_asserted() argument
1497 struct anx7625_data *ctx = container_of(aux, struct anx7625_data, aux); in anx7625_wait_hpd_asserted()
1498 struct device *dev = &ctx->client->dev; in anx7625_wait_hpd_asserted()
1511 ctx->slimport_edid_p.edid_block_num = -1; in anx7625_remove_edid()
1518 for (i = 0; i < ctx->pdata.dp_lane0_swing_reg_cnt; i++) in anx7625_dp_adjust_swing()
1519 anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, in anx7625_dp_adjust_swing()
1521 ctx->pdata.lane0_reg_data[i]); in anx7625_dp_adjust_swing()
1523 for (i = 0; i < ctx->pdata.dp_lane1_swing_reg_cnt; i++) in anx7625_dp_adjust_swing()
1524 anx7625_reg_write(ctx, ctx->i2c.tx_p1_client, in anx7625_dp_adjust_swing()
1526 ctx->pdata.lane1_reg_data[i]); in anx7625_dp_adjust_swing()
1531 struct device *dev = &ctx->client->dev; in dp_hpd_change_handler()
1551 struct device *dev = &ctx->client->dev; in anx7625_hpd_change_detect()
1553 status = anx7625_reg_write(ctx, ctx->i2c.tcpc_client, in anx7625_hpd_change_detect()
1560 intr_vector = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in anx7625_hpd_change_detect()
1567 status = anx7625_reg_write(ctx, ctx->i2c.rx_p0_client, in anx7625_hpd_change_detect()
1576 return -ENOENT; in anx7625_hpd_change_detect()
1578 status = anx7625_reg_read(ctx, ctx->i2c.rx_p0_client, in anx7625_hpd_change_detect()
1597 mutex_lock(&ctx->lock); in anx7625_work_func()
1599 if (pm_runtime_suspended(&ctx->client->dev)) in anx7625_work_func()
1606 if (ctx->bridge_attached) in anx7625_work_func()
1607 drm_helper_hpd_irq_event(ctx->bridge.dev); in anx7625_work_func()
1610 mutex_unlock(&ctx->lock); in anx7625_work_func()
1617 queue_work(ctx->workqueue, &ctx->work); in anx7625_intr_hpd_isr()
1627 if (of_get_property(dev->of_node, in anx7625_get_swing_setting()
1628 "analogix,lane0-swing", &num_regs)) { in anx7625_get_swing_setting()
1632 pdata->dp_lane0_swing_reg_cnt = num_regs; in anx7625_get_swing_setting()
1633 of_property_read_u8_array(dev->of_node, "analogix,lane0-swing", in anx7625_get_swing_setting()
1634 pdata->lane0_reg_data, num_regs); in anx7625_get_swing_setting()
1637 if (of_get_property(dev->of_node, in anx7625_get_swing_setting()
1638 "analogix,lane1-swing", &num_regs)) { in anx7625_get_swing_setting()
1642 pdata->dp_lane1_swing_reg_cnt = num_regs; in anx7625_get_swing_setting()
1643 of_property_read_u8_array(dev->of_node, "analogix,lane1-swing", in anx7625_get_swing_setting()
1644 pdata->lane1_reg_data, num_regs); in anx7625_get_swing_setting()
1653 struct device_node *np = dev->of_node, *ep0; in anx7625_parse_dt()
1658 pdata->is_dpi = 0; /* default dsi mode */ in anx7625_parse_dt()
1659 of_node_put(pdata->mipi_host_node); in anx7625_parse_dt()
1660 pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0); in anx7625_parse_dt()
1661 if (!pdata->mipi_host_node) { in anx7625_parse_dt()
1663 return -ENODEV; in anx7625_parse_dt()
1670 if (of_property_read_u32(ep0, "bus-type", &bus_type)) in anx7625_parse_dt()
1677 if (bus_type == V4L2_FWNODE_BUS_TYPE_DPI) /* bus type is DPI */ in anx7625_parse_dt()
1678 pdata->is_dpi = 1; in anx7625_parse_dt()
1680 pdata->mipi_lanes = MAX_LANES_SUPPORT; in anx7625_parse_dt()
1682 pdata->mipi_lanes = mipi_lanes; in anx7625_parse_dt()
1684 if (pdata->is_dpi) in anx7625_parse_dt()
1689 if (of_property_read_bool(np, "analogix,audio-enable")) in anx7625_parse_dt()
1690 pdata->audio_en = 1; in anx7625_parse_dt()
1692 pdata->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); in anx7625_parse_dt()
1693 if (IS_ERR(pdata->panel_bridge)) { in anx7625_parse_dt()
1694 if (PTR_ERR(pdata->panel_bridge) == -ENODEV) { in anx7625_parse_dt()
1695 pdata->panel_bridge = NULL; in anx7625_parse_dt()
1699 return PTR_ERR(pdata->panel_bridge); in anx7625_parse_dt()
1709 struct device_node *bus, *panel; in anx7625_of_panel_on_aux_bus() local
1711 bus = of_get_child_by_name(dev->of_node, "aux-bus"); in anx7625_of_panel_on_aux_bus()
1712 if (!bus) in anx7625_of_panel_on_aux_bus()
1715 panel = of_get_child_by_name(bus, "panel"); in anx7625_of_panel_on_aux_bus()
1716 of_node_put(bus); in anx7625_of_panel_on_aux_bus()
1729 static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, in anx7625_aux_transfer() argument
1732 struct anx7625_data *ctx = container_of(aux, struct anx7625_data, aux); in anx7625_aux_transfer()
1733 struct device *dev = &ctx->client->dev; in anx7625_aux_transfer()
1734 u8 request = msg->request & ~DP_AUX_I2C_MOT; in anx7625_aux_transfer()
1738 msg->reply = 0; in anx7625_aux_transfer()
1746 ret = -EINVAL; in anx7625_aux_transfer()
1749 ret = anx7625_aux_trans(ctx, msg->request, msg->address, in anx7625_aux_transfer()
1750 msg->size, msg->buffer); in anx7625_aux_transfer()
1759 struct device *dev = &ctx->client->dev; in anx7625_get_edid()
1760 struct s_edid_data *p_edid = &ctx->slimport_edid_p; in anx7625_get_edid()
1770 if (ctx->slimport_edid_p.edid_block_num > 0) { in anx7625_get_edid()
1771 memcpy(edid, ctx->slimport_edid_p.edid_raw_data, in anx7625_get_edid()
1778 edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data); in anx7625_get_edid()
1787 p_edid->edid_block_num = edid_num; in anx7625_get_edid()
1789 memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE); in anx7625_get_edid()
1795 struct device *dev = &ctx->client->dev; in anx7625_sink_detect()
1799 if (ctx->pdata.panel_bridge) in anx7625_sink_detect()
1802 return ctx->hpd_status ? connector_status_connected : in anx7625_sink_detect()
1819 if (fmt->fmt != HDMI_DSP_A && fmt->fmt != HDMI_I2S) { in anx7625_audio_hw_params()
1821 return -EINVAL; in anx7625_audio_hw_params()
1825 params->sample_rate, params->sample_width, in anx7625_audio_hw_params()
1826 params->cea.channels); in anx7625_audio_hw_params()
1828 if (fmt->fmt == HDMI_DSP_A) in anx7625_audio_hw_params()
1829 ret = anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1834 ret = anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1840 switch (params->sample_width) { in anx7625_audio_hw_params()
1855 params->sample_width); in anx7625_audio_hw_params()
1856 return -EINVAL; in anx7625_audio_hw_params()
1858 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1863 switch (params->cea.channels) { in anx7625_audio_hw_params()
1878 params->cea.channels); in anx7625_audio_hw_params()
1879 return -EINVAL; in anx7625_audio_hw_params()
1881 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1884 ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1887 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1891 switch (params->sample_rate) { in anx7625_audio_hw_params()
1915 params->sample_rate); in anx7625_audio_hw_params()
1916 return -EINVAL; in anx7625_audio_hw_params()
1918 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client, in anx7625_audio_hw_params()
1921 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client, in anx7625_audio_hw_params()
1925 return -EIO; in anx7625_audio_hw_params()
1958 if (ctx->plugged_cb && ctx->codec_dev) { in anx7625_audio_update_connector_status()
1959 ctx->plugged_cb(ctx->codec_dev, in anx7625_audio_update_connector_status()
1970 ctx->plugged_cb = fn; in anx7625_audio_hook_plugged_cb()
1971 ctx->codec_dev = codec_dev; in anx7625_audio_hook_plugged_cb()
1982 if (!ctx->connector) { in anx7625_audio_get_eld()
1987 memcpy(buf, ctx->connector->eld, in anx7625_audio_get_eld()
1988 min(sizeof(ctx->connector->eld), len)); in anx7625_audio_get_eld()
2004 struct device *dev = &ctx->client->dev; in anx7625_unregister_audio()
2006 if (ctx->audio_pdev) { in anx7625_unregister_audio()
2007 platform_device_unregister(ctx->audio_pdev); in anx7625_unregister_audio()
2008 ctx->audio_pdev = NULL; in anx7625_unregister_audio()
2023 ctx->audio_pdev = platform_device_register_data(dev, in anx7625_register_audio()
2029 if (IS_ERR(ctx->audio_pdev)) in anx7625_register_audio()
2030 return PTR_ERR(ctx->audio_pdev); in anx7625_register_audio()
2040 struct device *dev = &ctx->client->dev; in anx7625_attach_dsi()
2051 host = of_find_mipi_dsi_host_by_node(ctx->pdata.mipi_host_node); in anx7625_attach_dsi()
2054 return -EPROBE_DEFER; in anx7625_attach_dsi()
2060 return -EINVAL; in anx7625_attach_dsi()
2063 dsi->lanes = ctx->pdata.mipi_lanes; in anx7625_attach_dsi()
2064 dsi->format = MIPI_DSI_FMT_RGB888; in anx7625_attach_dsi()
2065 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | in anx7625_attach_dsi()
2076 ctx->dsi = dsi; in anx7625_attach_dsi()
2093 dev = &ctx->client->dev; in hdcp_check_work_func()
2095 if (!ctx->connector) { in hdcp_check_work_func()
2100 drm_dev = ctx->connector->dev; in hdcp_check_work_func()
2101 drm_modeset_lock(&drm_dev->mode_config.connection_mutex, NULL); in hdcp_check_work_func()
2102 mutex_lock(&ctx->hdcp_wq_lock); in hdcp_check_work_func()
2104 status = anx7625_reg_read(ctx, ctx->i2c.tx_p0_client, 0); in hdcp_check_work_func()
2107 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_ENABLED; in hdcp_check_work_func()
2108 drm_hdcp_update_content_protection(ctx->connector, in hdcp_check_work_func()
2109 ctx->hdcp_cp); in hdcp_check_work_func()
2113 mutex_unlock(&ctx->hdcp_wq_lock); in hdcp_check_work_func()
2114 drm_modeset_unlock(&drm_dev->mode_config.connection_mutex); in hdcp_check_work_func()
2120 struct device *dev = &ctx->client->dev; in anx7625_connector_atomic_check()
2124 cp = state->content_protection; in anx7625_connector_atomic_check()
2126 if (cp == ctx->hdcp_cp) in anx7625_connector_atomic_check()
2130 if (ctx->dp_en) { in anx7625_connector_atomic_check()
2134 queue_delayed_work(ctx->hdcp_workqueue, in anx7625_connector_atomic_check()
2135 &ctx->hdcp_work, in anx7625_connector_atomic_check()
2141 if (ctx->hdcp_cp != DRM_MODE_CONTENT_PROTECTION_ENABLED) { in anx7625_connector_atomic_check()
2143 return -EINVAL; in anx7625_connector_atomic_check()
2146 ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; in anx7625_connector_atomic_check()
2147 drm_hdcp_update_content_protection(ctx->connector, in anx7625_connector_atomic_check()
2148 ctx->hdcp_cp); in anx7625_connector_atomic_check()
2154 return -EINVAL; in anx7625_connector_atomic_check()
2165 struct device *dev = &ctx->client->dev; in anx7625_bridge_attach()
2169 return -EINVAL; in anx7625_bridge_attach()
2171 if (!bridge->encoder) { in anx7625_bridge_attach()
2173 return -ENODEV; in anx7625_bridge_attach()
2176 ctx->aux.drm_dev = bridge->dev; in anx7625_bridge_attach()
2177 err = drm_dp_aux_register(&ctx->aux); in anx7625_bridge_attach()
2179 dev_err(dev, "failed to register aux channel: %d\n", err); in anx7625_bridge_attach()
2183 if (ctx->pdata.panel_bridge) { in anx7625_bridge_attach()
2184 err = drm_bridge_attach(bridge->encoder, in anx7625_bridge_attach()
2185 ctx->pdata.panel_bridge, in anx7625_bridge_attach()
2186 &ctx->bridge, flags); in anx7625_bridge_attach()
2191 ctx->bridge_attached = 1; in anx7625_bridge_attach()
2200 drm_dp_aux_unregister(&ctx->aux); in anx7625_bridge_detach()
2209 struct device *dev = &ctx->client->dev; in anx7625_bridge_mode_valid()
2214 if (mode->clock > SUPPORT_PIXEL_CLOCK) { in anx7625_bridge_mode_valid()
2230 struct device *dev = &ctx->client->dev; in anx7625_bridge_mode_set()
2234 ctx->dt.pixelclock.min = mode->clock; in anx7625_bridge_mode_set()
2235 ctx->dt.hactive.min = mode->hdisplay; in anx7625_bridge_mode_set()
2236 ctx->dt.hsync_len.min = mode->hsync_end - mode->hsync_start; in anx7625_bridge_mode_set()
2237 ctx->dt.hfront_porch.min = mode->hsync_start - mode->hdisplay; in anx7625_bridge_mode_set()
2238 ctx->dt.hback_porch.min = mode->htotal - mode->hsync_end; in anx7625_bridge_mode_set()
2239 ctx->dt.vactive.min = mode->vdisplay; in anx7625_bridge_mode_set()
2240 ctx->dt.vsync_len.min = mode->vsync_end - mode->vsync_start; in anx7625_bridge_mode_set()
2241 ctx->dt.vfront_porch.min = mode->vsync_start - mode->vdisplay; in anx7625_bridge_mode_set()
2242 ctx->dt.vback_porch.min = mode->vtotal - mode->vsync_end; in anx7625_bridge_mode_set()
2244 ctx->display_timing_valid = 1; in anx7625_bridge_mode_set()
2246 DRM_DEV_DEBUG_DRIVER(dev, "pixelclock(%d).\n", ctx->dt.pixelclock.min); in anx7625_bridge_mode_set()
2248 ctx->dt.hactive.min, in anx7625_bridge_mode_set()
2249 ctx->dt.hsync_len.min, in anx7625_bridge_mode_set()
2250 ctx->dt.hfront_porch.min, in anx7625_bridge_mode_set()
2251 ctx->dt.hback_porch.min); in anx7625_bridge_mode_set()
2253 ctx->dt.vactive.min, in anx7625_bridge_mode_set()
2254 ctx->dt.vsync_len.min, in anx7625_bridge_mode_set()
2255 ctx->dt.vfront_porch.min, in anx7625_bridge_mode_set()
2256 ctx->dt.vback_porch.min); in anx7625_bridge_mode_set()
2258 mode->hdisplay, in anx7625_bridge_mode_set()
2259 mode->hsync_start); in anx7625_bridge_mode_set()
2261 mode->hsync_end, in anx7625_bridge_mode_set()
2262 mode->htotal); in anx7625_bridge_mode_set()
2264 mode->vdisplay, in anx7625_bridge_mode_set()
2265 mode->vsync_start); in anx7625_bridge_mode_set()
2267 mode->vsync_end, in anx7625_bridge_mode_set()
2268 mode->vtotal); in anx7625_bridge_mode_set()
2276 struct device *dev = &ctx->client->dev; in anx7625_bridge_mode_fixup()
2284 if (!ctx->pdata.panel_bridge) in anx7625_bridge_mode_fixup()
2287 hsync = mode->hsync_end - mode->hsync_start; in anx7625_bridge_mode_fixup()
2288 hfp = mode->hsync_start - mode->hdisplay; in anx7625_bridge_mode_fixup()
2289 hbp = mode->htotal - mode->hsync_end; in anx7625_bridge_mode_fixup()
2290 hblanking = mode->htotal - mode->hdisplay; in anx7625_bridge_mode_fixup()
2294 hsync, hfp, hbp, adj->clock); in anx7625_bridge_mode_fixup()
2296 adj->hsync_start, adj->hsync_end, adj->htotal); in anx7625_bridge_mode_fixup()
2311 adj_hbp -= 1; in anx7625_bridge_mode_fixup()
2312 adj_hblanking -= 1; in anx7625_bridge_mode_fixup()
2320 adj_hsync -= 1; in anx7625_bridge_mode_fixup()
2325 * This adjusting made for built-in eDP panel, for the externel in anx7625_bridge_mode_fixup()
2332 vref = adj->clock * 1000 / (adj->htotal * adj->vtotal); in anx7625_bridge_mode_fixup()
2334 delta_adj = HBLANKING_MIN - hblanking; in anx7625_bridge_mode_fixup()
2335 adj_clock = vref * delta_adj * adj->vtotal; in anx7625_bridge_mode_fixup()
2336 adj->clock += DIV_ROUND_UP(adj_clock, 1000); in anx7625_bridge_mode_fixup()
2338 delta_adj = hblanking - HBLANKING_MIN; in anx7625_bridge_mode_fixup()
2339 adj_clock = vref * delta_adj * adj->vtotal; in anx7625_bridge_mode_fixup()
2340 adj->clock -= DIV_ROUND_UP(adj_clock, 1000); in anx7625_bridge_mode_fixup()
2347 delta_adj = HP_MIN - adj_hfp; in anx7625_bridge_mode_fixup()
2354 if ((adj_hbp - delta_adj) < HP_MIN) in anx7625_bridge_mode_fixup()
2356 adj_hsync -= delta_adj; in anx7625_bridge_mode_fixup()
2358 adj_hbp -= delta_adj; in anx7625_bridge_mode_fixup()
2360 delta_adj = HP_MIN - adj_hbp; in anx7625_bridge_mode_fixup()
2367 if ((adj_hfp - delta_adj) < HP_MIN) in anx7625_bridge_mode_fixup()
2369 adj_hsync -= delta_adj; in anx7625_bridge_mode_fixup()
2371 adj_hfp -= delta_adj; in anx7625_bridge_mode_fixup()
2376 adj_hsync, adj_hfp, adj_hbp, adj->clock); in anx7625_bridge_mode_fixup()
2379 adj->hsync_start = adj->hdisplay + adj_hfp; in anx7625_bridge_mode_fixup()
2380 adj->hsync_end = adj->hsync_start + adj_hsync; in anx7625_bridge_mode_fixup()
2381 adj->htotal = adj->hsync_end + adj_hbp; in anx7625_bridge_mode_fixup()
2383 adj->hsync_start, adj->hsync_end, adj->htotal); in anx7625_bridge_mode_fixup()
2394 struct device *dev = &ctx->client->dev; in anx7625_bridge_atomic_check()
2398 anx7625_bridge_mode_fixup(bridge, &crtc_state->mode, in anx7625_bridge_atomic_check()
2399 &crtc_state->adjusted_mode); in anx7625_bridge_atomic_check()
2408 struct device *dev = &ctx->client->dev; in anx7625_bridge_atomic_enable()
2413 if (!bridge->encoder) { in anx7625_bridge_atomic_enable()
2418 connector = drm_atomic_get_new_connector_for_encoder(state->base.state, in anx7625_bridge_atomic_enable()
2419 bridge->encoder); in anx7625_bridge_atomic_enable()
2423 ctx->connector = connector; in anx7625_bridge_atomic_enable()
2435 struct device *dev = &ctx->client->dev; in anx7625_bridge_atomic_disable()
2439 ctx->connector = NULL; in anx7625_bridge_atomic_disable()
2449 struct device *dev = &ctx->client->dev; in anx7625_bridge_detect()
2460 struct device *dev = &ctx->client->dev; in anx7625_bridge_get_edid()
2485 struct device *dev = &ctx->client->dev; in anx7625_register_i2c_dummy_clients()
2487 ctx->i2c.tx_p0_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2489 if (IS_ERR(ctx->i2c.tx_p0_client)) in anx7625_register_i2c_dummy_clients()
2490 return PTR_ERR(ctx->i2c.tx_p0_client); in anx7625_register_i2c_dummy_clients()
2492 ctx->i2c.tx_p1_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2494 if (IS_ERR(ctx->i2c.tx_p1_client)) in anx7625_register_i2c_dummy_clients()
2495 return PTR_ERR(ctx->i2c.tx_p1_client); in anx7625_register_i2c_dummy_clients()
2497 ctx->i2c.tx_p2_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2499 if (IS_ERR(ctx->i2c.tx_p2_client)) in anx7625_register_i2c_dummy_clients()
2500 return PTR_ERR(ctx->i2c.tx_p2_client); in anx7625_register_i2c_dummy_clients()
2502 ctx->i2c.rx_p0_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2504 if (IS_ERR(ctx->i2c.rx_p0_client)) in anx7625_register_i2c_dummy_clients()
2505 return PTR_ERR(ctx->i2c.rx_p0_client); in anx7625_register_i2c_dummy_clients()
2507 ctx->i2c.rx_p1_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2509 if (IS_ERR(ctx->i2c.rx_p1_client)) in anx7625_register_i2c_dummy_clients()
2510 return PTR_ERR(ctx->i2c.rx_p1_client); in anx7625_register_i2c_dummy_clients()
2512 ctx->i2c.rx_p2_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2514 if (IS_ERR(ctx->i2c.rx_p2_client)) in anx7625_register_i2c_dummy_clients()
2515 return PTR_ERR(ctx->i2c.rx_p2_client); in anx7625_register_i2c_dummy_clients()
2517 ctx->i2c.tcpc_client = devm_i2c_new_dummy_device(dev, client->adapter, in anx7625_register_i2c_dummy_clients()
2519 if (IS_ERR(ctx->i2c.tcpc_client)) in anx7625_register_i2c_dummy_clients()
2520 return PTR_ERR(ctx->i2c.tcpc_client); in anx7625_register_i2c_dummy_clients()
2529 mutex_lock(&ctx->lock); in anx7625_runtime_pm_suspend()
2534 mutex_unlock(&ctx->lock); in anx7625_runtime_pm_suspend()
2543 mutex_lock(&ctx->lock); in anx7625_runtime_pm_resume()
2547 mutex_unlock(&ctx->lock); in anx7625_runtime_pm_resume()
2571 struct device *dev = &client->dev; in anx7625_i2c_probe()
2573 if (!i2c_check_functionality(client->adapter, in anx7625_i2c_probe()
2575 DRM_DEV_ERROR(dev, "anx7625's i2c bus doesn't support\n"); in anx7625_i2c_probe()
2576 return -ENODEV; in anx7625_i2c_probe()
2582 return -ENOMEM; in anx7625_i2c_probe()
2585 pdata = &platform->pdata; in anx7625_i2c_probe()
2587 platform->client = client; in anx7625_i2c_probe()
2590 pdata->supplies[0].supply = "vdd10"; in anx7625_i2c_probe()
2591 pdata->supplies[1].supply = "vdd18"; in anx7625_i2c_probe()
2592 pdata->supplies[2].supply = "vdd33"; in anx7625_i2c_probe()
2593 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(pdata->supplies), in anx7625_i2c_probe()
2594 pdata->supplies); in anx7625_i2c_probe()
2601 mutex_init(&platform->lock); in anx7625_i2c_probe()
2602 mutex_init(&platform->hdcp_wq_lock); in anx7625_i2c_probe()
2604 INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func); in anx7625_i2c_probe()
2605 platform->hdcp_workqueue = create_workqueue("hdcp workqueue"); in anx7625_i2c_probe()
2606 if (!platform->hdcp_workqueue) { in anx7625_i2c_probe()
2608 ret = -ENOMEM; in anx7625_i2c_probe()
2612 platform->pdata.intp_irq = client->irq; in anx7625_i2c_probe()
2613 if (platform->pdata.intp_irq) { in anx7625_i2c_probe()
2614 INIT_WORK(&platform->work, anx7625_work_func); in anx7625_i2c_probe()
2615 platform->workqueue = alloc_workqueue("anx7625_work", in anx7625_i2c_probe()
2617 if (!platform->workqueue) { in anx7625_i2c_probe()
2619 ret = -ENOMEM; in anx7625_i2c_probe()
2623 ret = devm_request_threaded_irq(dev, platform->pdata.intp_irq, in anx7625_i2c_probe()
2627 "anx7625-intp", platform); in anx7625_i2c_probe()
2634 platform->aux.name = "anx7625-aux"; in anx7625_i2c_probe()
2635 platform->aux.dev = dev; in anx7625_i2c_probe()
2636 platform->aux.transfer = anx7625_aux_transfer; in anx7625_i2c_probe()
2637 platform->aux.wait_hpd_asserted = anx7625_wait_hpd_asserted; in anx7625_i2c_probe()
2638 drm_dp_aux_init(&platform->aux); in anx7625_i2c_probe()
2641 ret = -ENOMEM; in anx7625_i2c_probe()
2642 DRM_DEV_ERROR(dev, "fail to reserve I2C bus.\n"); in anx7625_i2c_probe()
2654 devm_of_dp_aux_populate_ep_devices(&platform->aux); in anx7625_i2c_probe()
2658 if (ret != -EPROBE_DEFER) in anx7625_i2c_probe()
2663 if (!platform->pdata.low_power_mode) { in anx7625_i2c_probe()
2670 if (platform->pdata.intp_irq) in anx7625_i2c_probe()
2671 queue_work(platform->workqueue, &platform->work); in anx7625_i2c_probe()
2673 platform->bridge.funcs = &anx7625_bridge_funcs; in anx7625_i2c_probe()
2674 platform->bridge.of_node = client->dev.of_node; in anx7625_i2c_probe()
2675 if (!anx7625_of_panel_on_aux_bus(&client->dev)) in anx7625_i2c_probe()
2676 platform->bridge.ops |= DRM_BRIDGE_OP_EDID; in anx7625_i2c_probe()
2677 if (!platform->pdata.panel_bridge) in anx7625_i2c_probe()
2678 platform->bridge.ops |= DRM_BRIDGE_OP_HPD | in anx7625_i2c_probe()
2680 platform->bridge.type = platform->pdata.panel_bridge ? in anx7625_i2c_probe()
2684 drm_bridge_add(&platform->bridge); in anx7625_i2c_probe()
2686 if (!platform->pdata.is_dpi) { in anx7625_i2c_probe()
2694 if (platform->pdata.audio_en) in anx7625_i2c_probe()
2702 drm_bridge_remove(&platform->bridge); in anx7625_i2c_probe()
2704 if (!platform->pdata.low_power_mode) in anx7625_i2c_probe()
2705 pm_runtime_put_sync_suspend(&client->dev); in anx7625_i2c_probe()
2708 if (platform->workqueue) in anx7625_i2c_probe()
2709 destroy_workqueue(platform->workqueue); in anx7625_i2c_probe()
2712 if (platform->hdcp_workqueue) in anx7625_i2c_probe()
2713 destroy_workqueue(platform->hdcp_workqueue); in anx7625_i2c_probe()
2722 drm_bridge_remove(&platform->bridge); in anx7625_i2c_remove()
2724 if (platform->pdata.intp_irq) in anx7625_i2c_remove()
2725 destroy_workqueue(platform->workqueue); in anx7625_i2c_remove()
2727 if (platform->hdcp_workqueue) { in anx7625_i2c_remove()
2728 cancel_delayed_work(&platform->hdcp_work); in anx7625_i2c_remove()
2729 flush_workqueue(platform->hdcp_workqueue); in anx7625_i2c_remove()
2730 destroy_workqueue(platform->hdcp_workqueue); in anx7625_i2c_remove()
2733 if (!platform->pdata.low_power_mode) in anx7625_i2c_remove()
2734 pm_runtime_put_sync_suspend(&client->dev); in anx7625_i2c_remove()
2736 if (platform->pdata.audio_en) in anx7625_i2c_remove()