• Home
  • Raw
  • Download

Lines Matching refs:dp

333 static void zynqmp_dp_write(struct zynqmp_dp *dp, int offset, u32 val)  in zynqmp_dp_write()  argument
335 writel(val, dp->iomem + offset); in zynqmp_dp_write()
338 static u32 zynqmp_dp_read(struct zynqmp_dp *dp, int offset) in zynqmp_dp_read() argument
340 return readl(dp->iomem + offset); in zynqmp_dp_read()
343 static void zynqmp_dp_clr(struct zynqmp_dp *dp, int offset, u32 clr) in zynqmp_dp_clr() argument
345 zynqmp_dp_write(dp, offset, zynqmp_dp_read(dp, offset) & ~clr); in zynqmp_dp_clr()
348 static void zynqmp_dp_set(struct zynqmp_dp *dp, int offset, u32 set) in zynqmp_dp_set() argument
350 zynqmp_dp_write(dp, offset, zynqmp_dp_read(dp, offset) | set); in zynqmp_dp_set()
359 static int zynqmp_dp_reset(struct zynqmp_dp *dp, bool assert) in zynqmp_dp_reset() argument
364 reset_control_assert(dp->reset); in zynqmp_dp_reset()
366 reset_control_deassert(dp->reset); in zynqmp_dp_reset()
371 bool status = !!reset_control_status(dp->reset); in zynqmp_dp_reset()
379 dev_err(dp->dev, "reset %s timeout\n", assert ? "assert" : "deassert"); in zynqmp_dp_reset()
392 static int zynqmp_dp_phy_init(struct zynqmp_dp *dp) in zynqmp_dp_phy_init() argument
397 for (i = 0; i < dp->num_lanes; i++) { in zynqmp_dp_phy_init()
398 ret = phy_init(dp->phy[i]); in zynqmp_dp_phy_init()
400 dev_err(dp->dev, "failed to init phy lane %d\n", i); in zynqmp_dp_phy_init()
405 zynqmp_dp_clr(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET); in zynqmp_dp_phy_init()
411 for (i = dp->num_lanes - 1; i >= 0; i--) { in zynqmp_dp_phy_init()
412 ret = phy_power_on(dp->phy[i]); in zynqmp_dp_phy_init()
414 dev_err(dp->dev, "failed to power on phy lane %d\n", i); in zynqmp_dp_phy_init()
428 static void zynqmp_dp_phy_exit(struct zynqmp_dp *dp) in zynqmp_dp_phy_exit() argument
433 for (i = 0; i < dp->num_lanes; i++) { in zynqmp_dp_phy_exit()
434 ret = phy_power_off(dp->phy[i]); in zynqmp_dp_phy_exit()
436 dev_err(dp->dev, "failed to power off phy(%d) %d\n", i, in zynqmp_dp_phy_exit()
440 for (i = 0; i < dp->num_lanes; i++) { in zynqmp_dp_phy_exit()
441 ret = phy_exit(dp->phy[i]); in zynqmp_dp_phy_exit()
443 dev_err(dp->dev, "failed to exit phy(%d) %d\n", i, ret); in zynqmp_dp_phy_exit()
461 static int zynqmp_dp_phy_probe(struct zynqmp_dp *dp) in zynqmp_dp_phy_probe() argument
470 phy = devm_phy_get(dp->dev, phy_name); in zynqmp_dp_phy_probe()
475 if (dp->num_lanes) in zynqmp_dp_phy_probe()
478 dev_err(dp->dev, "no PHY found\n"); in zynqmp_dp_phy_probe()
485 dev_err(dp->dev, "failed to get PHY lane %u\n", in zynqmp_dp_phy_probe()
491 dp->phy[i] = phy; in zynqmp_dp_phy_probe()
492 dp->num_lanes++; in zynqmp_dp_phy_probe()
507 static int zynqmp_dp_phy_ready(struct zynqmp_dp *dp) in zynqmp_dp_phy_ready() argument
511 ready = (1 << dp->num_lanes) - 1; in zynqmp_dp_phy_ready()
515 reg = zynqmp_dp_read(dp, ZYNQMP_DP_PHY_STATUS); in zynqmp_dp_phy_ready()
520 dev_err(dp->dev, "PHY isn't ready\n"); in zynqmp_dp_phy_ready()
560 static int zynqmp_dp_mode_configure(struct zynqmp_dp *dp, int pclock, in zynqmp_dp_mode_configure() argument
563 int max_rate = dp->link_config.max_rate; in zynqmp_dp_mode_configure()
565 u8 max_lanes = dp->link_config.max_lanes; in zynqmp_dp_mode_configure()
567 u8 bpp = dp->config.bpp; in zynqmp_dp_mode_configure()
579 dev_err(dp->dev, "can't downshift. already lowest link rate\n"); in zynqmp_dp_mode_configure()
594 dp->mode.bw_code = bw_code; in zynqmp_dp_mode_configure()
595 dp->mode.lane_cnt = lane_cnt; in zynqmp_dp_mode_configure()
596 dp->mode.pclock = pclock; in zynqmp_dp_mode_configure()
597 return dp->mode.bw_code; in zynqmp_dp_mode_configure()
601 dev_err(dp->dev, "failed to configure link values\n"); in zynqmp_dp_mode_configure()
611 static void zynqmp_dp_adjust_train(struct zynqmp_dp *dp, in zynqmp_dp_adjust_train() argument
614 u8 *train_set = dp->train_set; in zynqmp_dp_adjust_train()
618 for (i = 0; i < dp->mode.lane_cnt; i++) { in zynqmp_dp_adjust_train()
635 for (i = 0; i < dp->mode.lane_cnt; i++) in zynqmp_dp_adjust_train()
649 static int zynqmp_dp_update_vs_emph(struct zynqmp_dp *dp) in zynqmp_dp_update_vs_emph() argument
654 ret = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET, dp->train_set, in zynqmp_dp_update_vs_emph()
655 dp->mode.lane_cnt); in zynqmp_dp_update_vs_emph()
659 for (i = 0; i < dp->mode.lane_cnt; i++) { in zynqmp_dp_update_vs_emph()
662 u8 train = dp->train_set[i]; in zynqmp_dp_update_vs_emph()
664 opts.dp.voltage[0] = (train & DP_TRAIN_VOLTAGE_SWING_MASK) in zynqmp_dp_update_vs_emph()
666 opts.dp.pre[0] = (train & DP_TRAIN_PRE_EMPHASIS_MASK) in zynqmp_dp_update_vs_emph()
669 phy_configure(dp->phy[i], &opts); in zynqmp_dp_update_vs_emph()
671 zynqmp_dp_write(dp, reg, 0x2); in zynqmp_dp_update_vs_emph()
684 static int zynqmp_dp_link_train_cr(struct zynqmp_dp *dp) in zynqmp_dp_link_train_cr() argument
687 u8 lane_cnt = dp->mode.lane_cnt; in zynqmp_dp_link_train_cr()
693 zynqmp_dp_write(dp, ZYNQMP_DP_TRAINING_PATTERN_SET, in zynqmp_dp_link_train_cr()
695 ret = drm_dp_dpcd_writeb(&dp->aux, DP_TRAINING_PATTERN_SET, in zynqmp_dp_link_train_cr()
706 ret = zynqmp_dp_update_vs_emph(dp); in zynqmp_dp_link_train_cr()
710 drm_dp_link_train_clock_recovery_delay(dp->dpcd); in zynqmp_dp_link_train_cr()
711 ret = drm_dp_dpcd_read_link_status(&dp->aux, link_status); in zynqmp_dp_link_train_cr()
720 if (!(dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED)) in zynqmp_dp_link_train_cr()
725 if ((dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == vs) in zynqmp_dp_link_train_cr()
733 vs = dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; in zynqmp_dp_link_train_cr()
734 zynqmp_dp_adjust_train(dp, link_status); in zynqmp_dp_link_train_cr()
750 static int zynqmp_dp_link_train_ce(struct zynqmp_dp *dp) in zynqmp_dp_link_train_ce() argument
753 u8 lane_cnt = dp->mode.lane_cnt; in zynqmp_dp_link_train_ce()
758 if (dp->dpcd[DP_DPCD_REV] >= DP_V1_2 && in zynqmp_dp_link_train_ce()
759 dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED) in zynqmp_dp_link_train_ce()
764 zynqmp_dp_write(dp, ZYNQMP_DP_TRAINING_PATTERN_SET, pat); in zynqmp_dp_link_train_ce()
765 ret = drm_dp_dpcd_writeb(&dp->aux, DP_TRAINING_PATTERN_SET, in zynqmp_dp_link_train_ce()
771 ret = zynqmp_dp_update_vs_emph(dp); in zynqmp_dp_link_train_ce()
775 drm_dp_link_train_channel_eq_delay(dp->dpcd); in zynqmp_dp_link_train_ce()
776 ret = drm_dp_dpcd_read_link_status(&dp->aux, link_status); in zynqmp_dp_link_train_ce()
784 zynqmp_dp_adjust_train(dp, link_status); in zynqmp_dp_link_train_ce()
799 static int zynqmp_dp_train(struct zynqmp_dp *dp) in zynqmp_dp_train() argument
802 u8 bw_code = dp->mode.bw_code; in zynqmp_dp_train()
803 u8 lane_cnt = dp->mode.lane_cnt; in zynqmp_dp_train()
808 zynqmp_dp_write(dp, ZYNQMP_DP_LANE_COUNT_SET, lane_cnt); in zynqmp_dp_train()
809 enhanced = drm_dp_enhanced_frame_cap(dp->dpcd); in zynqmp_dp_train()
811 zynqmp_dp_write(dp, ZYNQMP_DP_ENHANCED_FRAME_EN, 1); in zynqmp_dp_train()
815 if (dp->dpcd[3] & 0x1) { in zynqmp_dp_train()
816 zynqmp_dp_write(dp, ZYNQMP_DP_DOWNSPREAD_CTL, 1); in zynqmp_dp_train()
817 drm_dp_dpcd_writeb(&dp->aux, DP_DOWNSPREAD_CTRL, in zynqmp_dp_train()
820 zynqmp_dp_write(dp, ZYNQMP_DP_DOWNSPREAD_CTL, 0); in zynqmp_dp_train()
821 drm_dp_dpcd_writeb(&dp->aux, DP_DOWNSPREAD_CTRL, 0); in zynqmp_dp_train()
824 ret = drm_dp_dpcd_writeb(&dp->aux, DP_LANE_COUNT_SET, aux_lane_cnt); in zynqmp_dp_train()
826 dev_err(dp->dev, "failed to set lane count\n"); in zynqmp_dp_train()
830 ret = drm_dp_dpcd_writeb(&dp->aux, DP_MAIN_LINK_CHANNEL_CODING_SET, in zynqmp_dp_train()
833 dev_err(dp->dev, "failed to set ANSI 8B/10B encoding\n"); in zynqmp_dp_train()
837 ret = drm_dp_dpcd_writeb(&dp->aux, DP_LINK_BW_SET, bw_code); in zynqmp_dp_train()
839 dev_err(dp->dev, "failed to set DP bandwidth\n"); in zynqmp_dp_train()
843 zynqmp_dp_write(dp, ZYNQMP_DP_LINK_BW_SET, bw_code); in zynqmp_dp_train()
857 zynqmp_dp_write(dp, ZYNQMP_DP_PHY_CLOCK_SELECT, reg); in zynqmp_dp_train()
858 ret = zynqmp_dp_phy_ready(dp); in zynqmp_dp_train()
862 zynqmp_dp_write(dp, ZYNQMP_DP_SCRAMBLING_DISABLE, 1); in zynqmp_dp_train()
863 memset(dp->train_set, 0, sizeof(dp->train_set)); in zynqmp_dp_train()
864 ret = zynqmp_dp_link_train_cr(dp); in zynqmp_dp_train()
868 ret = zynqmp_dp_link_train_ce(dp); in zynqmp_dp_train()
872 ret = drm_dp_dpcd_writeb(&dp->aux, DP_TRAINING_PATTERN_SET, in zynqmp_dp_train()
875 dev_err(dp->dev, "failed to disable training pattern\n"); in zynqmp_dp_train()
878 zynqmp_dp_write(dp, ZYNQMP_DP_TRAINING_PATTERN_SET, in zynqmp_dp_train()
881 zynqmp_dp_write(dp, ZYNQMP_DP_SCRAMBLING_DISABLE, 0); in zynqmp_dp_train()
892 static void zynqmp_dp_train_loop(struct zynqmp_dp *dp) in zynqmp_dp_train_loop() argument
894 struct zynqmp_dp_mode *mode = &dp->mode; in zynqmp_dp_train_loop()
899 if (dp->status == connector_status_disconnected || in zynqmp_dp_train_loop()
900 !dp->enabled) in zynqmp_dp_train_loop()
903 ret = zynqmp_dp_train(dp); in zynqmp_dp_train_loop()
907 ret = zynqmp_dp_mode_configure(dp, mode->pclock, bw); in zynqmp_dp_train_loop()
915 dev_err(dp->dev, "failed to train the DP link\n"); in zynqmp_dp_train_loop()
946 static int zynqmp_dp_aux_cmd_submit(struct zynqmp_dp *dp, u32 cmd, u16 addr, in zynqmp_dp_aux_cmd_submit() argument
952 reg = zynqmp_dp_read(dp, ZYNQMP_DP_INTERRUPT_SIGNAL_STATE); in zynqmp_dp_aux_cmd_submit()
956 zynqmp_dp_write(dp, ZYNQMP_DP_AUX_ADDRESS, addr); in zynqmp_dp_aux_cmd_submit()
959 zynqmp_dp_write(dp, ZYNQMP_DP_AUX_WRITE_FIFO, in zynqmp_dp_aux_cmd_submit()
967 zynqmp_dp_write(dp, ZYNQMP_DP_AUX_COMMAND, reg); in zynqmp_dp_aux_cmd_submit()
971 reg = zynqmp_dp_read(dp, ZYNQMP_DP_INTERRUPT_SIGNAL_STATE); in zynqmp_dp_aux_cmd_submit()
982 reg = zynqmp_dp_read(dp, ZYNQMP_DP_AUX_REPLY_CODE); in zynqmp_dp_aux_cmd_submit()
989 reg = zynqmp_dp_read(dp, ZYNQMP_DP_REPLY_DATA_COUNT); in zynqmp_dp_aux_cmd_submit()
994 buf[i] = zynqmp_dp_read(dp, ZYNQMP_DP_AUX_REPLY_DATA); in zynqmp_dp_aux_cmd_submit()
1003 struct zynqmp_dp *dp = container_of(aux, struct zynqmp_dp, aux); in zynqmp_dp_aux_transfer() local
1012 ret = zynqmp_dp_aux_cmd_submit(dp, msg->request, msg->address, in zynqmp_dp_aux_transfer()
1016 dev_dbg(dp->dev, "aux %d retries\n", i); in zynqmp_dp_aux_transfer()
1020 if (dp->status == connector_status_disconnected) { in zynqmp_dp_aux_transfer()
1021 dev_dbg(dp->dev, "no connected aux device\n"); in zynqmp_dp_aux_transfer()
1028 dev_dbg(dp->dev, "failed to do aux transfer (%d)\n", ret); in zynqmp_dp_aux_transfer()
1041 static int zynqmp_dp_aux_init(struct zynqmp_dp *dp) in zynqmp_dp_aux_init() argument
1053 rate = clk_get_rate(dp->dpsub->apb_clk); in zynqmp_dp_aux_init()
1056 dev_err(dp->dev, "aclk frequency too high\n"); in zynqmp_dp_aux_init()
1060 zynqmp_dp_write(dp, ZYNQMP_DP_AUX_CLK_DIVIDER, in zynqmp_dp_aux_init()
1064 dp->aux.name = "ZynqMP DP AUX"; in zynqmp_dp_aux_init()
1065 dp->aux.dev = dp->dev; in zynqmp_dp_aux_init()
1066 dp->aux.transfer = zynqmp_dp_aux_transfer; in zynqmp_dp_aux_init()
1068 return drm_dp_aux_register(&dp->aux); in zynqmp_dp_aux_init()
1077 static void zynqmp_dp_aux_cleanup(struct zynqmp_dp *dp) in zynqmp_dp_aux_cleanup() argument
1079 drm_dp_aux_unregister(&dp->aux); in zynqmp_dp_aux_cleanup()
1093 static void zynqmp_dp_update_misc(struct zynqmp_dp *dp) in zynqmp_dp_update_misc() argument
1095 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_MISC0, dp->config.misc0); in zynqmp_dp_update_misc()
1096 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_MISC1, dp->config.misc1); in zynqmp_dp_update_misc()
1109 static int zynqmp_dp_set_format(struct zynqmp_dp *dp, in zynqmp_dp_set_format() argument
1114 struct zynqmp_dp_config *config = &dp->config; in zynqmp_dp_set_format()
1142 dev_err(dp->dev, "Invalid colormetry in DT\n"); in zynqmp_dp_set_format()
1146 display = &dp->connector.display_info; in zynqmp_dp_set_format()
1148 dev_warn(dp->dev, in zynqmp_dp_set_format()
1173 dev_warn(dp->dev, "Not supported bpc (%u). fall back to 8bpc\n", in zynqmp_dp_set_format()
1195 zynqmp_dp_encoder_mode_set_transfer_unit(struct zynqmp_dp *dp, in zynqmp_dp_encoder_mode_set_transfer_unit() argument
1202 zynqmp_dp_write(dp, ZYNQMP_DP_MSA_TRANSFER_UNIT_SIZE, tu); in zynqmp_dp_encoder_mode_set_transfer_unit()
1204 vid_kbytes = mode->clock * (dp->config.bpp / 8); in zynqmp_dp_encoder_mode_set_transfer_unit()
1205 bw = drm_dp_bw_code_to_link_rate(dp->mode.bw_code); in zynqmp_dp_encoder_mode_set_transfer_unit()
1206 avg_bytes_per_tu = vid_kbytes * tu / (dp->mode.lane_cnt * bw / 1000); in zynqmp_dp_encoder_mode_set_transfer_unit()
1207 zynqmp_dp_write(dp, ZYNQMP_DP_MIN_BYTES_PER_TU, in zynqmp_dp_encoder_mode_set_transfer_unit()
1209 zynqmp_dp_write(dp, ZYNQMP_DP_FRAC_BYTES_PER_TU, in zynqmp_dp_encoder_mode_set_transfer_unit()
1220 zynqmp_dp_write(dp, ZYNQMP_DP_INIT_WAIT, init_wait); in zynqmp_dp_encoder_mode_set_transfer_unit()
1231 static void zynqmp_dp_encoder_mode_set_stream(struct zynqmp_dp *dp, in zynqmp_dp_encoder_mode_set_stream() argument
1234 u8 lane_cnt = dp->mode.lane_cnt; in zynqmp_dp_encoder_mode_set_stream()
1238 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_HTOTAL, mode->htotal); in zynqmp_dp_encoder_mode_set_stream()
1239 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_VTOTAL, mode->vtotal); in zynqmp_dp_encoder_mode_set_stream()
1240 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_POLARITY, in zynqmp_dp_encoder_mode_set_stream()
1245 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_HSWIDTH, in zynqmp_dp_encoder_mode_set_stream()
1247 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_VSWIDTH, in zynqmp_dp_encoder_mode_set_stream()
1249 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_HRES, mode->hdisplay); in zynqmp_dp_encoder_mode_set_stream()
1250 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_VRES, mode->vdisplay); in zynqmp_dp_encoder_mode_set_stream()
1251 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_HSTART, in zynqmp_dp_encoder_mode_set_stream()
1253 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_VSTART, in zynqmp_dp_encoder_mode_set_stream()
1257 if (dp->config.misc0 & ZYNQMP_DP_MAIN_STREAM_MISC0_SYNC_LOCK) { in zynqmp_dp_encoder_mode_set_stream()
1258 reg = drm_dp_bw_code_to_link_rate(dp->mode.bw_code); in zynqmp_dp_encoder_mode_set_stream()
1259 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_N_VID, reg); in zynqmp_dp_encoder_mode_set_stream()
1260 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_M_VID, mode->clock); in zynqmp_dp_encoder_mode_set_stream()
1261 rate = zynqmp_disp_get_audio_clk_rate(dp->dpsub->disp); in zynqmp_dp_encoder_mode_set_stream()
1263 dev_dbg(dp->dev, "Audio rate: %d\n", rate / 512); in zynqmp_dp_encoder_mode_set_stream()
1264 zynqmp_dp_write(dp, ZYNQMP_DP_TX_N_AUD, reg); in zynqmp_dp_encoder_mode_set_stream()
1265 zynqmp_dp_write(dp, ZYNQMP_DP_TX_M_AUD, rate / 1000); in zynqmp_dp_encoder_mode_set_stream()
1270 if (zynqmp_disp_audio_enabled(dp->dpsub->disp)) in zynqmp_dp_encoder_mode_set_stream()
1271 zynqmp_dp_write(dp, ZYNQMP_DP_TX_AUDIO_CHANNELS, 1); in zynqmp_dp_encoder_mode_set_stream()
1273 zynqmp_dp_write(dp, ZYNQMP_DP_USER_PIX_WIDTH, 1); in zynqmp_dp_encoder_mode_set_stream()
1276 wpl = (mode->hdisplay * dp->config.bpp + 15) / 16; in zynqmp_dp_encoder_mode_set_stream()
1278 zynqmp_dp_write(dp, ZYNQMP_DP_USER_DATA_COUNT_PER_LANE, reg); in zynqmp_dp_encoder_mode_set_stream()
1288 struct zynqmp_dp *dp = connector_to_dp(connector); in zynqmp_dp_connector_detect() local
1289 struct zynqmp_dp_link_config *link_config = &dp->link_config; in zynqmp_dp_connector_detect()
1298 state = zynqmp_dp_read(dp, ZYNQMP_DP_INTERRUPT_SIGNAL_STATE); in zynqmp_dp_connector_detect()
1305 ret = drm_dp_dpcd_read(&dp->aux, 0x0, dp->dpcd, in zynqmp_dp_connector_detect()
1306 sizeof(dp->dpcd)); in zynqmp_dp_connector_detect()
1308 dev_dbg(dp->dev, "DPCD read failed"); in zynqmp_dp_connector_detect()
1313 drm_dp_max_link_rate(dp->dpcd), in zynqmp_dp_connector_detect()
1316 drm_dp_max_lane_count(dp->dpcd), in zynqmp_dp_connector_detect()
1317 dp->num_lanes); in zynqmp_dp_connector_detect()
1319 dp->status = connector_status_connected; in zynqmp_dp_connector_detect()
1324 dp->status = connector_status_disconnected; in zynqmp_dp_connector_detect()
1330 struct zynqmp_dp *dp = connector_to_dp(connector); in zynqmp_dp_connector_get_modes() local
1334 edid = drm_get_edid(connector, &dp->aux.ddc); in zynqmp_dp_connector_get_modes()
1348 struct zynqmp_dp *dp = connector_to_dp(connector); in zynqmp_dp_connector_best_encoder() local
1350 return &dp->encoder; in zynqmp_dp_connector_best_encoder()
1356 struct zynqmp_dp *dp = connector_to_dp(connector); in zynqmp_dp_connector_mode_valid() local
1357 u8 max_lanes = dp->link_config.max_lanes; in zynqmp_dp_connector_mode_valid()
1358 u8 bpp = dp->config.bpp; in zynqmp_dp_connector_mode_valid()
1359 int max_rate = dp->link_config.max_rate; in zynqmp_dp_connector_mode_valid()
1363 dev_dbg(dp->dev, "filtered the mode, %s,for high pixel rate\n", in zynqmp_dp_connector_mode_valid()
1372 dev_dbg(dp->dev, "filtered the mode, %s,for high pixel rate\n", in zynqmp_dp_connector_mode_valid()
1403 struct zynqmp_dp *dp = encoder_to_dp(encoder); in zynqmp_dp_encoder_enable() local
1407 pm_runtime_get_sync(dp->dev); in zynqmp_dp_encoder_enable()
1408 dp->enabled = true; in zynqmp_dp_encoder_enable()
1409 zynqmp_dp_update_misc(dp); in zynqmp_dp_encoder_enable()
1410 if (zynqmp_disp_audio_enabled(dp->dpsub->disp)) in zynqmp_dp_encoder_enable()
1411 zynqmp_dp_write(dp, ZYNQMP_DP_TX_AUDIO_CONTROL, 1); in zynqmp_dp_encoder_enable()
1412 zynqmp_dp_write(dp, ZYNQMP_DP_TX_PHY_POWER_DOWN, 0); in zynqmp_dp_encoder_enable()
1413 if (dp->status == connector_status_connected) { in zynqmp_dp_encoder_enable()
1415 ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, in zynqmp_dp_encoder_enable()
1425 dev_dbg(dp->dev, "DP aux failed\n"); in zynqmp_dp_encoder_enable()
1427 zynqmp_dp_train_loop(dp); in zynqmp_dp_encoder_enable()
1428 zynqmp_dp_write(dp, ZYNQMP_DP_SOFTWARE_RESET, in zynqmp_dp_encoder_enable()
1430 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_ENABLE, 1); in zynqmp_dp_encoder_enable()
1435 struct zynqmp_dp *dp = encoder_to_dp(encoder); in zynqmp_dp_encoder_disable() local
1437 dp->enabled = false; in zynqmp_dp_encoder_disable()
1438 cancel_delayed_work(&dp->hpd_work); in zynqmp_dp_encoder_disable()
1439 zynqmp_dp_write(dp, ZYNQMP_DP_MAIN_STREAM_ENABLE, 0); in zynqmp_dp_encoder_disable()
1440 drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, DP_SET_POWER_D3); in zynqmp_dp_encoder_disable()
1441 zynqmp_dp_write(dp, ZYNQMP_DP_TX_PHY_POWER_DOWN, in zynqmp_dp_encoder_disable()
1443 if (zynqmp_disp_audio_enabled(dp->dpsub->disp)) in zynqmp_dp_encoder_disable()
1444 zynqmp_dp_write(dp, ZYNQMP_DP_TX_AUDIO_CONTROL, 0); in zynqmp_dp_encoder_disable()
1445 pm_runtime_put_sync(dp->dev); in zynqmp_dp_encoder_disable()
1453 struct zynqmp_dp *dp = encoder_to_dp(encoder); in zynqmp_dp_encoder_atomic_mode_set() local
1456 u8 max_lanes = dp->link_config.max_lanes; in zynqmp_dp_encoder_atomic_mode_set()
1457 u8 bpp = dp->config.bpp; in zynqmp_dp_encoder_atomic_mode_set()
1458 int rate, max_rate = dp->link_config.max_rate; in zynqmp_dp_encoder_atomic_mode_set()
1461 zynqmp_dp_set_format(dp, ZYNQMP_DPSUB_FORMAT_RGB, 8); in zynqmp_dp_encoder_atomic_mode_set()
1466 dev_err(dp->dev, "the mode, %s,has too high pixel rate\n", in zynqmp_dp_encoder_atomic_mode_set()
1471 ret = zynqmp_dp_mode_configure(dp, adjusted_mode->clock, 0); in zynqmp_dp_encoder_atomic_mode_set()
1475 zynqmp_dp_encoder_mode_set_transfer_unit(dp, adjusted_mode); in zynqmp_dp_encoder_atomic_mode_set()
1476 zynqmp_dp_encoder_mode_set_stream(dp, adjusted_mode); in zynqmp_dp_encoder_atomic_mode_set()
1526 void zynqmp_dp_enable_vblank(struct zynqmp_dp *dp) in zynqmp_dp_enable_vblank() argument
1528 zynqmp_dp_write(dp, ZYNQMP_DP_INT_EN, ZYNQMP_DP_INT_VBLANK_START); in zynqmp_dp_enable_vblank()
1537 void zynqmp_dp_disable_vblank(struct zynqmp_dp *dp) in zynqmp_dp_disable_vblank() argument
1539 zynqmp_dp_write(dp, ZYNQMP_DP_INT_DS, ZYNQMP_DP_INT_VBLANK_START); in zynqmp_dp_disable_vblank()
1544 struct zynqmp_dp *dp; in zynqmp_dp_hpd_work_func() local
1546 dp = container_of(work, struct zynqmp_dp, hpd_work.work); in zynqmp_dp_hpd_work_func()
1548 if (dp->drm) in zynqmp_dp_hpd_work_func()
1549 drm_helper_hpd_irq_event(dp->drm); in zynqmp_dp_hpd_work_func()
1554 struct zynqmp_dp *dp = (struct zynqmp_dp *)data; in zynqmp_dp_irq_handler() local
1557 status = zynqmp_dp_read(dp, ZYNQMP_DP_INT_STATUS); in zynqmp_dp_irq_handler()
1558 mask = zynqmp_dp_read(dp, ZYNQMP_DP_INT_MASK); in zynqmp_dp_irq_handler()
1564 dev_dbg_ratelimited(dp->dev, "underflow interrupt\n"); in zynqmp_dp_irq_handler()
1566 dev_dbg_ratelimited(dp->dev, "overflow interrupt\n"); in zynqmp_dp_irq_handler()
1568 zynqmp_dp_write(dp, ZYNQMP_DP_INT_STATUS, status); in zynqmp_dp_irq_handler()
1571 zynqmp_disp_handle_vblank(dp->dpsub->disp); in zynqmp_dp_irq_handler()
1574 schedule_delayed_work(&dp->hpd_work, 0); in zynqmp_dp_irq_handler()
1580 ret = drm_dp_dpcd_read(&dp->aux, DP_SINK_COUNT, status, in zynqmp_dp_irq_handler()
1586 !drm_dp_clock_recovery_ok(&status[2], dp->mode.lane_cnt) || in zynqmp_dp_irq_handler()
1587 !drm_dp_channel_eq_ok(&status[2], dp->mode.lane_cnt)) { in zynqmp_dp_irq_handler()
1588 zynqmp_dp_train_loop(dp); in zynqmp_dp_irq_handler()
1602 struct zynqmp_dp *dp = dpsub->dp; in zynqmp_dp_drm_init() local
1603 struct drm_encoder *encoder = &dp->encoder; in zynqmp_dp_drm_init()
1604 struct drm_connector *connector = &dp->connector; in zynqmp_dp_drm_init()
1607 dp->config.misc0 &= ~ZYNQMP_DP_MAIN_STREAM_MISC0_SYNC_LOCK; in zynqmp_dp_drm_init()
1608 zynqmp_dp_set_format(dp, ZYNQMP_DPSUB_FORMAT_RGB, 8); in zynqmp_dp_drm_init()
1612 drm_simple_encoder_init(dp->drm, encoder, DRM_MODE_ENCODER_TMDS); in zynqmp_dp_drm_init()
1620 dev_err(dp->dev, "failed to create the DRM connector\n"); in zynqmp_dp_drm_init()
1629 ret = zynqmp_dp_aux_init(dp); in zynqmp_dp_drm_init()
1631 dev_err(dp->dev, "failed to initialize DP aux\n"); in zynqmp_dp_drm_init()
1636 zynqmp_dp_write(dp, ZYNQMP_DP_INT_EN, ZYNQMP_DP_INT_ALL); in zynqmp_dp_drm_init()
1644 struct zynqmp_dp *dp; in zynqmp_dp_probe() local
1648 dp = drmm_kzalloc(drm, sizeof(*dp), GFP_KERNEL); in zynqmp_dp_probe()
1649 if (!dp) in zynqmp_dp_probe()
1652 dp->dev = &pdev->dev; in zynqmp_dp_probe()
1653 dp->dpsub = dpsub; in zynqmp_dp_probe()
1654 dp->status = connector_status_disconnected; in zynqmp_dp_probe()
1655 dp->drm = drm; in zynqmp_dp_probe()
1657 INIT_DELAYED_WORK(&dp->hpd_work, zynqmp_dp_hpd_work_func); in zynqmp_dp_probe()
1659 dpsub->dp = dp; in zynqmp_dp_probe()
1663 dp->iomem = devm_ioremap_resource(dp->dev, res); in zynqmp_dp_probe()
1664 if (IS_ERR(dp->iomem)) in zynqmp_dp_probe()
1665 return PTR_ERR(dp->iomem); in zynqmp_dp_probe()
1667 dp->irq = platform_get_irq(pdev, 0); in zynqmp_dp_probe()
1668 if (dp->irq < 0) in zynqmp_dp_probe()
1669 return dp->irq; in zynqmp_dp_probe()
1671 dp->reset = devm_reset_control_get(dp->dev, NULL); in zynqmp_dp_probe()
1672 if (IS_ERR(dp->reset)) { in zynqmp_dp_probe()
1673 if (PTR_ERR(dp->reset) != -EPROBE_DEFER) in zynqmp_dp_probe()
1674 dev_err(dp->dev, "failed to get reset: %ld\n", in zynqmp_dp_probe()
1675 PTR_ERR(dp->reset)); in zynqmp_dp_probe()
1676 return PTR_ERR(dp->reset); in zynqmp_dp_probe()
1679 ret = zynqmp_dp_reset(dp, false); in zynqmp_dp_probe()
1683 ret = zynqmp_dp_phy_probe(dp); in zynqmp_dp_probe()
1688 zynqmp_dp_write(dp, ZYNQMP_DP_TX_PHY_POWER_DOWN, in zynqmp_dp_probe()
1690 zynqmp_dp_set(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET); in zynqmp_dp_probe()
1691 zynqmp_dp_write(dp, ZYNQMP_DP_FORCE_SCRAMBLER_RESET, 1); in zynqmp_dp_probe()
1692 zynqmp_dp_write(dp, ZYNQMP_DP_TRANSMITTER_ENABLE, 0); in zynqmp_dp_probe()
1693 zynqmp_dp_write(dp, ZYNQMP_DP_INT_DS, 0xffffffff); in zynqmp_dp_probe()
1695 ret = zynqmp_dp_phy_init(dp); in zynqmp_dp_probe()
1699 zynqmp_dp_write(dp, ZYNQMP_DP_TRANSMITTER_ENABLE, 1); in zynqmp_dp_probe()
1705 ret = devm_request_threaded_irq(dp->dev, dp->irq, NULL, in zynqmp_dp_probe()
1707 dev_name(dp->dev), dp); in zynqmp_dp_probe()
1711 dev_dbg(dp->dev, "ZynqMP DisplayPort Tx probed with %u lanes\n", in zynqmp_dp_probe()
1712 dp->num_lanes); in zynqmp_dp_probe()
1717 zynqmp_dp_phy_exit(dp); in zynqmp_dp_probe()
1719 zynqmp_dp_reset(dp, true); in zynqmp_dp_probe()
1726 struct zynqmp_dp *dp = dpsub->dp; in zynqmp_dp_remove() local
1728 zynqmp_dp_write(dp, ZYNQMP_DP_INT_DS, ZYNQMP_DP_INT_ALL); in zynqmp_dp_remove()
1729 disable_irq(dp->irq); in zynqmp_dp_remove()
1731 cancel_delayed_work_sync(&dp->hpd_work); in zynqmp_dp_remove()
1732 zynqmp_dp_aux_cleanup(dp); in zynqmp_dp_remove()
1734 zynqmp_dp_write(dp, ZYNQMP_DP_TRANSMITTER_ENABLE, 0); in zynqmp_dp_remove()
1735 zynqmp_dp_write(dp, ZYNQMP_DP_INT_DS, 0xffffffff); in zynqmp_dp_remove()
1737 zynqmp_dp_phy_exit(dp); in zynqmp_dp_remove()
1738 zynqmp_dp_reset(dp, true); in zynqmp_dp_remove()