Lines Matching refs:hdmi

148 	int (*configure)(struct dw_hdmi *hdmi,
206 void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
207 u8 (*read)(struct dw_hdmi *hdmi, int offset);
215 static void dw_hdmi_writel(struct dw_hdmi *hdmi, u8 val, int offset) in dw_hdmi_writel() argument
217 writel(val, hdmi->regs + (offset << 2)); in dw_hdmi_writel()
220 static u8 dw_hdmi_readl(struct dw_hdmi *hdmi, int offset) in dw_hdmi_readl() argument
222 return readl(hdmi->regs + (offset << 2)); in dw_hdmi_readl()
225 static void dw_hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) in dw_hdmi_writeb() argument
227 writeb(val, hdmi->regs + offset); in dw_hdmi_writeb()
230 static u8 dw_hdmi_readb(struct dw_hdmi *hdmi, int offset) in dw_hdmi_readb() argument
232 return readb(hdmi->regs + offset); in dw_hdmi_readb()
235 static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) in hdmi_writeb() argument
237 hdmi->write(hdmi, val, offset); in hdmi_writeb()
240 static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset) in hdmi_readb() argument
242 return hdmi->read(hdmi, offset); in hdmi_readb()
245 static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg) in hdmi_modb() argument
247 u8 val = hdmi_readb(hdmi, reg) & ~mask; in hdmi_modb()
250 hdmi_writeb(hdmi, val, reg); in hdmi_modb()
253 static void hdmi_mask_writeb(struct dw_hdmi *hdmi, u8 data, unsigned int reg, in hdmi_mask_writeb() argument
256 hdmi_modb(hdmi, data << shift, mask, reg); in hdmi_mask_writeb()
345 static int is_color_space_conversion(struct dw_hdmi *hdmi) in is_color_space_conversion() argument
348 hdmi->edid_data.preferred_mode; in is_color_space_conversion()
352 (hdmi->hdmi_data.quant_range == in is_color_space_conversion()
359 if (hdmi->hdmi_data.enc_in_bus_format != in is_color_space_conversion()
360 hdmi->hdmi_data.enc_out_bus_format || in is_color_space_conversion()
361 ((hdmi->hdmi_data.quant_range == HDMI_QUANTIZATION_RANGE_LIMITED || in is_color_space_conversion()
363 hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format))) in is_color_space_conversion()
369 static int is_color_space_decimation(struct dw_hdmi *hdmi) in is_color_space_decimation() argument
371 if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) in is_color_space_decimation()
374 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format) || in is_color_space_decimation()
375 hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_in_bus_format)) in is_color_space_decimation()
381 static inline void hdmi_phy_test_clear(struct dw_hdmi *hdmi, in hdmi_phy_test_clear() argument
384 hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTCLR_OFFSET, in hdmi_phy_test_clear()
388 static inline void hdmi_phy_test_enable(struct dw_hdmi *hdmi, in hdmi_phy_test_enable() argument
391 hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTEN_OFFSET, in hdmi_phy_test_enable()
395 static inline void hdmi_phy_test_clock(struct dw_hdmi *hdmi, in hdmi_phy_test_clock() argument
398 hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTCLK_OFFSET, in hdmi_phy_test_clock()
402 static inline void hdmi_phy_test_din(struct dw_hdmi *hdmi, in hdmi_phy_test_din() argument
405 hdmi_writeb(hdmi, bit, HDMI_PHY_TST1); in hdmi_phy_test_din()
408 static inline void hdmi_phy_test_dout(struct dw_hdmi *hdmi, in hdmi_phy_test_dout() argument
411 hdmi_writeb(hdmi, bit, HDMI_PHY_TST2); in hdmi_phy_test_dout()
414 static int dw_hdmi_i2c_read(struct dw_hdmi *hdmi, in dw_hdmi_i2c_read() argument
417 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_read()
432 hdmi_writeb(hdmi, i2c->slave_reg, HDMI_I2CM_ADDRESS); in dw_hdmi_i2c_read()
444 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_READ8_EXT, in dw_hdmi_i2c_read()
447 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_READ_EXT, in dw_hdmi_i2c_read()
451 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_READ8, in dw_hdmi_i2c_read()
454 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_READ, in dw_hdmi_i2c_read()
460 interrupt = hdmi_readb(hdmi, HDMI_IH_I2CM_STAT0); in dw_hdmi_i2c_read()
462 hdmi_writeb(hdmi, interrupt, in dw_hdmi_i2c_read()
472 hdmi_writeb(hdmi, 0, HDMI_I2CM_SOFTRSTZ); in dw_hdmi_i2c_read()
473 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_BUS_CLEAR, in dw_hdmi_i2c_read()
483 hdmi_writeb(hdmi, 0, HDMI_I2CM_SOFTRSTZ); in dw_hdmi_i2c_read()
484 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_BUS_CLEAR, in dw_hdmi_i2c_read()
493 *buf++ = hdmi_readb(hdmi, HDMI_I2CM_READ_BUFF0 + i); in dw_hdmi_i2c_read()
495 *buf++ = hdmi_readb(hdmi, HDMI_I2CM_DATAI); in dw_hdmi_i2c_read()
502 static int dw_hdmi_i2c_write(struct dw_hdmi *hdmi, in dw_hdmi_i2c_write() argument
505 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_write()
518 hdmi_writeb(hdmi, *buf++, HDMI_I2CM_DATAO); in dw_hdmi_i2c_write()
519 hdmi_writeb(hdmi, i2c->slave_reg++, HDMI_I2CM_ADDRESS); in dw_hdmi_i2c_write()
520 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_WRITE, in dw_hdmi_i2c_write()
525 interrupt = hdmi_readb(hdmi, HDMI_IH_I2CM_STAT0); in dw_hdmi_i2c_write()
527 hdmi_writeb(hdmi, in dw_hdmi_i2c_write()
538 hdmi_writeb(hdmi, 0, HDMI_I2CM_SOFTRSTZ); in dw_hdmi_i2c_write()
539 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_BUS_CLEAR, in dw_hdmi_i2c_write()
547 hdmi_writeb(hdmi, 0, HDMI_I2CM_SOFTRSTZ); in dw_hdmi_i2c_write()
548 hdmi_writeb(hdmi, HDMI_I2CM_OPERATION_BUS_CLEAR, in dw_hdmi_i2c_write()
567 struct dw_hdmi *hdmi = container_of(adap, struct dw_hdmi, adap); in dw_hdmi_i2c_xfer() local
568 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_xfer()
581 hdmi_writeb(hdmi, 0x00, HDMI_IH_MUTE_I2CM_STAT0); in dw_hdmi_i2c_xfer()
586 hdmi_writeb(hdmi, addr, HDMI_I2CM_SLAVE); in dw_hdmi_i2c_xfer()
599 hdmi_writeb(hdmi, DDC_SEGMENT_ADDR, HDMI_I2CM_SEGADDR); in dw_hdmi_i2c_xfer()
600 hdmi_writeb(hdmi, *msgs[i].buf, HDMI_I2CM_SEGPTR); in dw_hdmi_i2c_xfer()
603 ret = dw_hdmi_i2c_read(hdmi, msgs[i].buf, in dw_hdmi_i2c_xfer()
606 ret = dw_hdmi_i2c_write(hdmi, msgs[i].buf, in dw_hdmi_i2c_xfer()
617 hdmi_writeb(hdmi, HDMI_IH_I2CM_STAT0_ERROR | HDMI_IH_I2CM_STAT0_DONE, in dw_hdmi_i2c_xfer()
623 static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, int msec) in hdmi_phy_wait_i2c_done() argument
627 while ((val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) { in hdmi_phy_wait_i2c_done()
632 hdmi_writeb(hdmi, val, HDMI_IH_I2CMPHY_STAT0); in hdmi_phy_wait_i2c_done()
637 static void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, in dw_hdmi_phy_i2c_write() argument
640 hdmi_writeb(hdmi, 0xFF, HDMI_IH_I2CMPHY_STAT0); in dw_hdmi_phy_i2c_write()
641 hdmi_writeb(hdmi, addr, HDMI_PHY_I2CM_ADDRESS_ADDR); in dw_hdmi_phy_i2c_write()
642 hdmi_writeb(hdmi, (unsigned char)(data >> 8), in dw_hdmi_phy_i2c_write()
644 hdmi_writeb(hdmi, (unsigned char)(data >> 0), in dw_hdmi_phy_i2c_write()
646 hdmi_writeb(hdmi, HDMI_PHY_I2CM_OPERATION_ADDR_WRITE, in dw_hdmi_phy_i2c_write()
648 hdmi_phy_wait_i2c_done(hdmi, 1000); in dw_hdmi_phy_i2c_write()
651 static void dw_hdmi_phy_enable_powerdown(struct dw_hdmi *hdmi, bool enable) in dw_hdmi_phy_enable_powerdown() argument
653 hdmi_mask_writeb(hdmi, !enable, HDMI_PHY_CONF0, in dw_hdmi_phy_enable_powerdown()
658 static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_enable_tmds() argument
660 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_enable_tmds()
665 static void dw_hdmi_phy_enable_svsret(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_enable_svsret() argument
667 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_enable_svsret()
672 static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_gen2_pddq() argument
674 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_gen2_pddq()
679 static void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_gen2_txpwron() argument
681 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_gen2_txpwron()
686 static void dw_hdmi_phy_sel_data_en_pol(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_sel_data_en_pol() argument
688 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_sel_data_en_pol()
693 static void dw_hdmi_phy_sel_interface_control(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_sel_interface_control() argument
695 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_sel_interface_control()
700 static void dw_hdmi_phy_power_off(struct dw_hdmi *hdmi) in dw_hdmi_phy_power_off() argument
702 const struct dw_hdmi_phy_data *phy = hdmi->phy.data; in dw_hdmi_phy_power_off()
707 dw_hdmi_phy_enable_tmds(hdmi, 0); in dw_hdmi_phy_power_off()
708 dw_hdmi_phy_enable_powerdown(hdmi, true); in dw_hdmi_phy_power_off()
712 dw_hdmi_phy_gen2_txpwron(hdmi, 0); in dw_hdmi_phy_power_off()
719 val = hdmi_readb(hdmi, HDMI_PHY_STAT0); in dw_hdmi_phy_power_off()
731 dw_hdmi_phy_gen2_pddq(hdmi, 1); in dw_hdmi_phy_power_off()
734 static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi) in dw_hdmi_phy_power_on() argument
736 const struct dw_hdmi_phy_data *phy = hdmi->phy.data; in dw_hdmi_phy_power_on()
741 dw_hdmi_phy_enable_powerdown(hdmi, false); in dw_hdmi_phy_power_on()
744 dw_hdmi_phy_enable_tmds(hdmi, 0); in dw_hdmi_phy_power_on()
745 dw_hdmi_phy_enable_tmds(hdmi, 1); in dw_hdmi_phy_power_on()
749 dw_hdmi_phy_gen2_txpwron(hdmi, 1); in dw_hdmi_phy_power_on()
750 dw_hdmi_phy_gen2_pddq(hdmi, 0); in dw_hdmi_phy_power_on()
754 val = hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_TX_PHY_LOCK; in dw_hdmi_phy_power_on()
776 int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, in hdmi_phy_configure_dwc_hdmi_3d_tx() argument
783 unsigned int tmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; in hdmi_phy_configure_dwc_hdmi_3d_tx()
785 hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format); in hdmi_phy_configure_dwc_hdmi_3d_tx()
787 if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format) && in hdmi_phy_configure_dwc_hdmi_3d_tx()
809 if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_phy_configure_dwc_hdmi_3d_tx()
816 dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].cpce, in hdmi_phy_configure_dwc_hdmi_3d_tx()
819 dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].gmp, in hdmi_phy_configure_dwc_hdmi_3d_tx()
821 dw_hdmi_phy_i2c_write(hdmi, curr_ctrl->curr[depth], in hdmi_phy_configure_dwc_hdmi_3d_tx()
824 dw_hdmi_phy_i2c_write(hdmi, 0, HDMI_3D_TX_PHY_PLLPHBYCTRL); in hdmi_phy_configure_dwc_hdmi_3d_tx()
825 dw_hdmi_phy_i2c_write(hdmi, HDMI_3D_TX_PHY_MSM_CTRL_CKO_SEL_FB_CLK, in hdmi_phy_configure_dwc_hdmi_3d_tx()
828 dw_hdmi_phy_i2c_write(hdmi, phy_config->term, HDMI_3D_TX_PHY_TXTERM); in hdmi_phy_configure_dwc_hdmi_3d_tx()
829 dw_hdmi_phy_i2c_write(hdmi, phy_config->sym_ctr, in hdmi_phy_configure_dwc_hdmi_3d_tx()
831 dw_hdmi_phy_i2c_write(hdmi, phy_config->vlev_ctr, in hdmi_phy_configure_dwc_hdmi_3d_tx()
876 static int rockchip_dw_hdmi_scrambling_enable(struct dw_hdmi *hdmi, in rockchip_dw_hdmi_scrambling_enable() argument
881 drm_scdc_readb(&hdmi->adap, SCDC_TMDS_CONFIG, &stat); in rockchip_dw_hdmi_scrambling_enable()
883 if (stat < 0 && !hdmi->force_output) { in rockchip_dw_hdmi_scrambling_enable()
891 drm_scdc_writeb(&hdmi->adap, SCDC_TMDS_CONFIG, stat); in rockchip_dw_hdmi_scrambling_enable()
893 hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, in rockchip_dw_hdmi_scrambling_enable()
896 hdmi_writeb(hdmi, 1, HDMI_FC_SCRAMBLER_CTRL); in rockchip_dw_hdmi_scrambling_enable()
899 hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL); in rockchip_dw_hdmi_scrambling_enable()
901 hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, in rockchip_dw_hdmi_scrambling_enable()
905 drm_scdc_writeb(&hdmi->adap, SCDC_TMDS_CONFIG, stat); in rockchip_dw_hdmi_scrambling_enable()
911 static void rockchip_dw_hdmi_scdc_set_tmds_rate(struct dw_hdmi *hdmi) in rockchip_dw_hdmi_scdc_set_tmds_rate() argument
915 drm_scdc_readb(&hdmi->adap, SCDC_TMDS_CONFIG, &stat); in rockchip_dw_hdmi_scdc_set_tmds_rate()
916 if (hdmi->hdmi_data.video_mode.mtmdsclock > 340000000) in rockchip_dw_hdmi_scdc_set_tmds_rate()
920 drm_scdc_writeb(&hdmi->adap, SCDC_TMDS_CONFIG, stat); in rockchip_dw_hdmi_scdc_set_tmds_rate()
923 static int hdmi_phy_configure(struct dw_hdmi *hdmi) in hdmi_phy_configure() argument
925 const struct dw_hdmi_phy_data *phy = hdmi->phy.data; in hdmi_phy_configure()
926 const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; in hdmi_phy_configure()
927 unsigned long mpixelclock = hdmi->hdmi_data.video_mode.mpixelclock; in hdmi_phy_configure()
928 unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; in hdmi_phy_configure()
931 dw_hdmi_phy_power_off(hdmi); in hdmi_phy_configure()
934 if (hdmi->edid_data.display_info.hdmi.scdc.supported) in hdmi_phy_configure()
935 rockchip_dw_hdmi_scdc_set_tmds_rate(hdmi); in hdmi_phy_configure()
939 dw_hdmi_phy_enable_svsret(hdmi, 1); in hdmi_phy_configure()
942 hdmi_writeb(hdmi, HDMI_MC_PHYRSTZ_PHYRSTZ, HDMI_MC_PHYRSTZ); in hdmi_phy_configure()
943 hdmi_writeb(hdmi, 0, HDMI_MC_PHYRSTZ); in hdmi_phy_configure()
945 hdmi_writeb(hdmi, HDMI_MC_HEACPHY_RST_ASSERT, HDMI_MC_HEACPHY_RST); in hdmi_phy_configure()
947 hdmi_phy_test_clear(hdmi, 1); in hdmi_phy_configure()
948 hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, in hdmi_phy_configure()
950 hdmi_phy_test_clear(hdmi, 0); in hdmi_phy_configure()
954 ret = pdata->configure_phy(hdmi, pdata, mpixelclock); in hdmi_phy_configure()
956 ret = phy->configure(hdmi, pdata, mpixelclock); in hdmi_phy_configure()
967 return dw_hdmi_phy_power_on(hdmi); in hdmi_phy_configure()
970 static int dw_hdmi_phy_init(struct rockchip_connector *conn, struct dw_hdmi *hdmi, in dw_hdmi_phy_init() argument
977 dw_hdmi_phy_sel_data_en_pol(hdmi, 1); in dw_hdmi_phy_init()
978 dw_hdmi_phy_sel_interface_control(hdmi, 0); in dw_hdmi_phy_init()
979 ret = hdmi_phy_configure(hdmi); in dw_hdmi_phy_init()
987 static void dw_hdmi_phy_disable(struct rockchip_connector *conn, struct dw_hdmi *hdmi, in dw_hdmi_phy_disable() argument
990 dw_hdmi_phy_power_off(hdmi); in dw_hdmi_phy_disable()
994 dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi, void *data) in dw_hdmi_phy_read_hpd() argument
996 return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ? in dw_hdmi_phy_read_hpd()
1006 static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi) in dw_hdmi_detect_phy() argument
1011 phy_type = hdmi_readb(hdmi, HDMI_CONFIG2_ID); in dw_hdmi_detect_phy()
1018 hdmi->dev_type == RK3528_HDMI || in dw_hdmi_detect_phy()
1019 hdmi->dev_type == RK3328_HDMI || in dw_hdmi_detect_phy()
1020 hdmi->dev_type == RK3228_HDMI) { in dw_hdmi_detect_phy()
1022 if (!hdmi->plat_data->phy_ops || !hdmi->plat_data->phy_name) { in dw_hdmi_detect_phy()
1028 hdmi->phy.ops = hdmi->plat_data->phy_ops; in dw_hdmi_detect_phy()
1029 hdmi->phy.data = hdmi->plat_data->phy_data; in dw_hdmi_detect_phy()
1030 hdmi->phy.name = hdmi->plat_data->phy_name; in dw_hdmi_detect_phy()
1037 hdmi->phy.ops = &dw_hdmi_synopsys_phy_ops; in dw_hdmi_detect_phy()
1038 hdmi->phy.name = dw_hdmi_phys[i].name; in dw_hdmi_detect_phy()
1039 hdmi->phy.data = (void *)&dw_hdmi_phys[i]; in dw_hdmi_detect_phy()
1042 !hdmi->plat_data->configure_phy) { in dw_hdmi_detect_phy()
1044 hdmi->phy.name); in dw_hdmi_detect_phy()
1057 hdmi_get_tmdsclock(struct dw_hdmi *hdmi, unsigned long mpixelclock) in hdmi_get_tmdsclock() argument
1061 hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format); in hdmi_get_tmdsclock()
1063 if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_get_tmdsclock()
1082 static void hdmi_av_composer(struct dw_hdmi *hdmi, in hdmi_av_composer() argument
1086 struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode; in hdmi_av_composer()
1087 struct drm_hdmi_info *hdmi_info = &hdmi->edid_data.display_info.hdmi; in hdmi_av_composer()
1095 vmode->mtmdsclock = hdmi_get_tmdsclock(hdmi, vmode->mpixelclock); in hdmi_av_composer()
1096 if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_av_composer()
1120 if (hdmi->vic == 39) in hdmi_av_composer()
1131 inv_val |= hdmi->sink_is_hdmi ? in hdmi_av_composer()
1135 hdmi_writeb(hdmi, inv_val, HDMI_FC_INVIDCONF); in hdmi_av_composer()
1146 if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_av_composer()
1173 if (hdmi_info->scdc.supported || hdmi->force_output) { in hdmi_av_composer()
1176 hdmi->scramble_low_rates)) { in hdmi_av_composer()
1177 drm_scdc_readb(&hdmi->adap, SCDC_SINK_VERSION, &bytes); in hdmi_av_composer()
1178 drm_scdc_writeb(&hdmi->adap, SCDC_SOURCE_VERSION, in hdmi_av_composer()
1180 rockchip_dw_hdmi_scrambling_enable(hdmi, 1); in hdmi_av_composer()
1182 rockchip_dw_hdmi_scrambling_enable(hdmi, 0); in hdmi_av_composer()
1187 hdmi_writeb(hdmi, hdisplay >> 8, HDMI_FC_INHACTV1); in hdmi_av_composer()
1188 hdmi_writeb(hdmi, hdisplay, HDMI_FC_INHACTV0); in hdmi_av_composer()
1191 hdmi_writeb(hdmi, vdisplay >> 8, HDMI_FC_INVACTV1); in hdmi_av_composer()
1192 hdmi_writeb(hdmi, vdisplay, HDMI_FC_INVACTV0); in hdmi_av_composer()
1195 hdmi_writeb(hdmi, hblank >> 8, HDMI_FC_INHBLANK1); in hdmi_av_composer()
1196 hdmi_writeb(hdmi, hblank, HDMI_FC_INHBLANK0); in hdmi_av_composer()
1199 hdmi_writeb(hdmi, vblank, HDMI_FC_INVBLANK); in hdmi_av_composer()
1202 hdmi_writeb(hdmi, h_de_hs >> 8, HDMI_FC_HSYNCINDELAY1); in hdmi_av_composer()
1203 hdmi_writeb(hdmi, h_de_hs, HDMI_FC_HSYNCINDELAY0); in hdmi_av_composer()
1206 hdmi_writeb(hdmi, v_de_vs, HDMI_FC_VSYNCINDELAY); in hdmi_av_composer()
1209 hdmi_writeb(hdmi, hsync_len >> 8, HDMI_FC_HSYNCINWIDTH1); in hdmi_av_composer()
1210 hdmi_writeb(hdmi, hsync_len, HDMI_FC_HSYNCINWIDTH0); in hdmi_av_composer()
1213 hdmi_writeb(hdmi, vsync_len, HDMI_FC_VSYNCINWIDTH); in hdmi_av_composer()
1216 static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi) in dw_hdmi_update_csc_coeffs() argument
1223 enc_out_rgb = hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format); in dw_hdmi_update_csc_coeffs()
1224 enc_in_rgb = hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format); in dw_hdmi_update_csc_coeffs()
1226 if (is_color_space_conversion(hdmi)) { in dw_hdmi_update_csc_coeffs()
1231 if (hdmi->hdmi_data.enc_out_encoding == in dw_hdmi_update_csc_coeffs()
1237 if (hdmi->hdmi_data.enc_out_encoding == in dw_hdmi_update_csc_coeffs()
1252 hdmi_writeb(hdmi, coeff_a & 0xff, HDMI_CSC_COEF_A1_LSB + i * 2); in dw_hdmi_update_csc_coeffs()
1253 hdmi_writeb(hdmi, coeff_a >> 8, HDMI_CSC_COEF_A1_MSB + i * 2); in dw_hdmi_update_csc_coeffs()
1254 hdmi_writeb(hdmi, coeff_b & 0xff, HDMI_CSC_COEF_B1_LSB + i * 2); in dw_hdmi_update_csc_coeffs()
1255 hdmi_writeb(hdmi, coeff_b >> 8, HDMI_CSC_COEF_B1_MSB + i * 2); in dw_hdmi_update_csc_coeffs()
1256 hdmi_writeb(hdmi, coeff_c & 0xff, HDMI_CSC_COEF_C1_LSB + i * 2); in dw_hdmi_update_csc_coeffs()
1257 hdmi_writeb(hdmi, coeff_c >> 8, HDMI_CSC_COEF_C1_MSB + i * 2); in dw_hdmi_update_csc_coeffs()
1260 hdmi_modb(hdmi, csc_scale, HDMI_CSC_SCALE_CSCSCALE_MASK, in dw_hdmi_update_csc_coeffs()
1264 static int is_color_space_interpolation(struct dw_hdmi *hdmi) in is_color_space_interpolation() argument
1266 if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_in_bus_format)) in is_color_space_interpolation()
1269 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) || in is_color_space_interpolation()
1270 hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)) in is_color_space_interpolation()
1276 static void hdmi_video_csc(struct dw_hdmi *hdmi) in hdmi_video_csc() argument
1283 if (is_color_space_interpolation(hdmi)) in hdmi_video_csc()
1285 else if (is_color_space_decimation(hdmi)) in hdmi_video_csc()
1288 switch (hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_csc()
1307 hdmi_writeb(hdmi, interpolation | decimation, HDMI_CSC_CFG); in hdmi_video_csc()
1308 hdmi_modb(hdmi, color_depth, HDMI_CSC_SCALE_CSC_COLORDE_PTH_MASK, in hdmi_video_csc()
1311 dw_hdmi_update_csc_coeffs(hdmi); in hdmi_video_csc()
1314 static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) in dw_hdmi_enable_video_path() argument
1319 hdmi_writeb(hdmi, 12, HDMI_FC_CTRLDUR); in dw_hdmi_enable_video_path()
1320 hdmi_writeb(hdmi, 32, HDMI_FC_EXCTRLDUR); in dw_hdmi_enable_video_path()
1321 hdmi_writeb(hdmi, 1, HDMI_FC_EXCTRLSPAC); in dw_hdmi_enable_video_path()
1324 hdmi_writeb(hdmi, 0x0B, HDMI_FC_CH0PREAM); in dw_hdmi_enable_video_path()
1325 hdmi_writeb(hdmi, 0x16, HDMI_FC_CH1PREAM); in dw_hdmi_enable_video_path()
1326 hdmi_writeb(hdmi, 0x21, HDMI_FC_CH2PREAM); in dw_hdmi_enable_video_path()
1331 hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1334 hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1337 if (is_color_space_conversion(hdmi)) { in dw_hdmi_enable_video_path()
1339 hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1343 if (hdmi->hdmi_data.video_mode.mpixelrepetitioninput) { in dw_hdmi_enable_video_path()
1345 hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1349 if (is_color_space_conversion(hdmi)) in dw_hdmi_enable_video_path()
1350 hdmi_writeb(hdmi, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_IN_PATH, in dw_hdmi_enable_video_path()
1353 hdmi_writeb(hdmi, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_BYPASS, in dw_hdmi_enable_video_path()
1357 static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) in dw_hdmi_clear_overflow() argument
1375 switch (hdmi->version) { in dw_hdmi_clear_overflow()
1390 hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, HDMI_MC_SWRSTZ); in dw_hdmi_clear_overflow()
1392 val = hdmi_readb(hdmi, HDMI_FC_INVIDCONF); in dw_hdmi_clear_overflow()
1394 hdmi_writeb(hdmi, val, HDMI_FC_INVIDCONF); in dw_hdmi_clear_overflow()
1397 static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) in hdmi_disable_overflow_interrupts() argument
1399 hdmi_writeb(hdmi, HDMI_IH_MUTE_FC_STAT2_OVERFLOW_MASK, in hdmi_disable_overflow_interrupts()
1403 static void hdmi_video_packetize(struct dw_hdmi *hdmi) in hdmi_video_packetize() argument
1408 struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data; in hdmi_video_packetize()
1411 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) || in hdmi_video_packetize()
1412 hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format) || in hdmi_video_packetize()
1413 hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1415 hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1432 } else if (hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1434 hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1457 hdmi_writeb(hdmi, val, HDMI_VP_PR_CD); in hdmi_video_packetize()
1459 hdmi_modb(hdmi, HDMI_VP_STUFF_PR_STUFFING_STUFFING_MODE, in hdmi_video_packetize()
1471 hdmi_modb(hdmi, vp_conf, in hdmi_video_packetize()
1475 hdmi_modb(hdmi, 0, HDMI_VP_STUFF_IDEFAULT_PHASE_MASK, in hdmi_video_packetize()
1478 hdmi_writeb(hdmi, remap_size, HDMI_VP_REMAP); in hdmi_video_packetize()
1496 hdmi_modb(hdmi, vp_conf, in hdmi_video_packetize()
1500 hdmi_modb(hdmi, HDMI_VP_STUFF_PP_STUFFING_STUFFING_MODE | in hdmi_video_packetize()
1505 hdmi_modb(hdmi, output_select, HDMI_VP_CONF_OUTPUT_SELECTOR_MASK, in hdmi_video_packetize()
1509 static void hdmi_video_sample(struct dw_hdmi *hdmi) in hdmi_video_sample() argument
1514 switch (hdmi->hdmi_data.enc_in_bus_format) { in hdmi_video_sample()
1562 hdmi_writeb(hdmi, val, HDMI_TX_INVID0); in hdmi_video_sample()
1568 hdmi_writeb(hdmi, val, HDMI_TX_INSTUFFING); in hdmi_video_sample()
1569 hdmi_writeb(hdmi, 0x0, HDMI_TX_GYDATA0); in hdmi_video_sample()
1570 hdmi_writeb(hdmi, 0x0, HDMI_TX_GYDATA1); in hdmi_video_sample()
1571 hdmi_writeb(hdmi, 0x0, HDMI_TX_RCRDATA0); in hdmi_video_sample()
1572 hdmi_writeb(hdmi, 0x0, HDMI_TX_RCRDATA1); in hdmi_video_sample()
1573 hdmi_writeb(hdmi, 0x0, HDMI_TX_BCBDATA0); in hdmi_video_sample()
1574 hdmi_writeb(hdmi, 0x0, HDMI_TX_BCBDATA1); in hdmi_video_sample()
1577 static void dw_hdmi_disable(struct rockchip_connector *conn, struct dw_hdmi *hdmi, in dw_hdmi_disable() argument
1580 if (hdmi->phy.enabled) { in dw_hdmi_disable()
1581 hdmi->phy.ops->disable(conn, hdmi, state); in dw_hdmi_disable()
1582 hdmi->phy.enabled = false; in dw_hdmi_disable()
1586 static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) in hdmi_config_AVI() argument
1592 hdmi->hdmi_data.quant_range; in hdmi_config_AVI()
1594 if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format) || in hdmi_config_AVI()
1595 hdmi->edid_data.display_info.hdmi.scdc.supported) in hdmi_config_AVI()
1606 if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_config_AVI()
1608 else if (hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_config_AVI()
1610 else if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_config_AVI()
1616 switch (hdmi->hdmi_data.enc_out_encoding) { in hdmi_config_AVI()
1618 if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) in hdmi_config_AVI()
1626 if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) in hdmi_config_AVI()
1659 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF0); in hdmi_config_AVI()
1665 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF1); in hdmi_config_AVI()
1673 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF2); in hdmi_config_AVI()
1677 hdmi_writeb(hdmi, val, HDMI_FC_AVIVID); in hdmi_config_AVI()
1680 val = (((hdmi->hdmi_data.video_mode.mpixelrepetitioninput + 1) << in hdmi_config_AVI()
1683 ((hdmi->hdmi_data.video_mode.mpixelrepetitionoutput << in hdmi_config_AVI()
1686 hdmi_writeb(hdmi, val, HDMI_FC_PRCONF); in hdmi_config_AVI()
1694 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF3); in hdmi_config_AVI()
1697 hdmi_writeb(hdmi, frame.top_bar & 0xff, HDMI_FC_AVIETB0); in hdmi_config_AVI()
1698 hdmi_writeb(hdmi, (frame.top_bar >> 8) & 0xff, HDMI_FC_AVIETB1); in hdmi_config_AVI()
1699 hdmi_writeb(hdmi, frame.bottom_bar & 0xff, HDMI_FC_AVISBB0); in hdmi_config_AVI()
1700 hdmi_writeb(hdmi, (frame.bottom_bar >> 8) & 0xff, HDMI_FC_AVISBB1); in hdmi_config_AVI()
1701 hdmi_writeb(hdmi, frame.left_bar & 0xff, HDMI_FC_AVIELB0); in hdmi_config_AVI()
1702 hdmi_writeb(hdmi, (frame.left_bar >> 8) & 0xff, HDMI_FC_AVIELB1); in hdmi_config_AVI()
1703 hdmi_writeb(hdmi, frame.right_bar & 0xff, HDMI_FC_AVISRB0); in hdmi_config_AVI()
1704 hdmi_writeb(hdmi, (frame.right_bar >> 8) & 0xff, HDMI_FC_AVISRB1); in hdmi_config_AVI()
1707 static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi, in hdmi_config_vendor_specific_infoframe() argument
1715 hdmi_mask_writeb(hdmi, 0, HDMI_FC_DATAUTO0, HDMI_FC_DATAUTO0_VSD_OFFSET, in hdmi_config_vendor_specific_infoframe()
1735 hdmi_writeb(hdmi, buffer[2], HDMI_FC_VSDSIZE); in hdmi_config_vendor_specific_infoframe()
1738 hdmi_writeb(hdmi, buffer[4], HDMI_FC_VSDIEEEID0); in hdmi_config_vendor_specific_infoframe()
1739 hdmi_writeb(hdmi, buffer[5], HDMI_FC_VSDIEEEID1); in hdmi_config_vendor_specific_infoframe()
1740 hdmi_writeb(hdmi, buffer[6], HDMI_FC_VSDIEEEID2); in hdmi_config_vendor_specific_infoframe()
1743 hdmi_writeb(hdmi, buffer[7], HDMI_FC_VSDPAYLOAD0); in hdmi_config_vendor_specific_infoframe()
1744 hdmi_writeb(hdmi, buffer[8], HDMI_FC_VSDPAYLOAD1); in hdmi_config_vendor_specific_infoframe()
1747 hdmi_writeb(hdmi, buffer[9], HDMI_FC_VSDPAYLOAD2); in hdmi_config_vendor_specific_infoframe()
1750 hdmi_writeb(hdmi, 1, HDMI_FC_DATAUTO1); in hdmi_config_vendor_specific_infoframe()
1753 hdmi_writeb(hdmi, 0x11, HDMI_FC_DATAUTO2); in hdmi_config_vendor_specific_infoframe()
1756 hdmi_mask_writeb(hdmi, 1, HDMI_FC_DATAUTO0, HDMI_FC_DATAUTO0_VSD_OFFSET, in hdmi_config_vendor_specific_infoframe()
1760 static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts, in hdmi_set_cts_n() argument
1764 hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); in hdmi_set_cts_n()
1767 hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3); in hdmi_set_cts_n()
1769 hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) | in hdmi_set_cts_n()
1771 hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2); in hdmi_set_cts_n()
1772 hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1); in hdmi_set_cts_n()
1774 hdmi_writeb(hdmi, (n >> 16) & 0x0f, HDMI_AUD_N3); in hdmi_set_cts_n()
1775 hdmi_writeb(hdmi, (n >> 8) & 0xff, HDMI_AUD_N2); in hdmi_set_cts_n()
1776 hdmi_writeb(hdmi, n & 0xff, HDMI_AUD_N1); in hdmi_set_cts_n()
1779 static int hdmi_match_tmds_n_table(struct dw_hdmi *hdmi, in hdmi_match_tmds_n_table() argument
1783 const struct dw_hdmi_plat_data *plat_data = hdmi->plat_data; in hdmi_match_tmds_n_table()
1840 static unsigned int hdmi_compute_n(struct dw_hdmi *hdmi, in hdmi_compute_n() argument
1877 static unsigned int hdmi_find_n(struct dw_hdmi *hdmi, unsigned long pixel_clk, in hdmi_find_n() argument
1882 n = hdmi_match_tmds_n_table(hdmi, pixel_clk, sample_rate); in hdmi_find_n()
1889 return hdmi_compute_n(hdmi, pixel_clk, sample_rate); in hdmi_find_n()
1893 void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi, unsigned long pixel_clk, in hdmi_set_clk_regenerator() argument
1900 n = hdmi_find_n(hdmi, pixel_clk, sample_rate); in hdmi_set_clk_regenerator()
1916 hdmi->audio_n = n; in hdmi_set_clk_regenerator()
1917 hdmi->audio_cts = cts; in hdmi_set_clk_regenerator()
1918 hdmi_set_cts_n(hdmi, cts, hdmi->audio_enable ? n : 0); in hdmi_set_clk_regenerator()
1921 static void hdmi_clk_regenerator_update_pixel_clock(struct dw_hdmi *hdmi) in hdmi_clk_regenerator_update_pixel_clock() argument
1923 hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mtmdsclock, in hdmi_clk_regenerator_update_pixel_clock()
1924 hdmi->sample_rate); in hdmi_clk_regenerator_update_pixel_clock()
1927 static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi) in hdmi_enable_audio_clk() argument
1929 hdmi_modb(hdmi, 0, HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS); in hdmi_enable_audio_clk()
1932 void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) in dw_hdmi_set_sample_rate() argument
1934 hdmi->sample_rate = rate; in dw_hdmi_set_sample_rate()
1935 hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mtmdsclock, in dw_hdmi_set_sample_rate()
1936 hdmi->sample_rate); in dw_hdmi_set_sample_rate()
1940 static int dw_hdmi_hdcp_load_key(struct dw_hdmi *hdmi) in dw_hdmi_hdcp_load_key() argument
1970 hdmi_writeb(hdmi, 0, HDMI_HDCPREG_RMCTL); in dw_hdmi_hdcp_load_key()
1973 val = hdmi_readb(hdmi, HDMI_HDCPREG_RMSTS); in dw_hdmi_hdcp_load_key()
1976 hdmi_writeb(hdmi, 0, HDMI_HDCPREG_DPK6); in dw_hdmi_hdcp_load_key()
1977 hdmi_writeb(hdmi, 0, HDMI_HDCPREG_DPK5); in dw_hdmi_hdcp_load_key()
1981 hdmi_writeb(hdmi, hdcp_keys->KSV[i], HDMI_HDCPREG_DPK0 + i); in dw_hdmi_hdcp_load_key()
1984 val = hdmi_readb(hdmi, HDMI_HDCPREG_RMSTS); in dw_hdmi_hdcp_load_key()
1988 hdmi_writeb(hdmi, 1, HDMI_HDCPREG_RMCTL); in dw_hdmi_hdcp_load_key()
1989 hdmi_writeb(hdmi, hdcp_keys->seeds[0], HDMI_HDCPREG_SEED1); in dw_hdmi_hdcp_load_key()
1990 hdmi_writeb(hdmi, hdcp_keys->seeds[1], HDMI_HDCPREG_SEED0); in dw_hdmi_hdcp_load_key()
1995 hdmi_writeb(hdmi, hdcp_keys->devicekey[i + j], in dw_hdmi_hdcp_load_key()
1998 val = hdmi_readb(hdmi, HDMI_HDCPREG_RMSTS); in dw_hdmi_hdcp_load_key()
2007 static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi, in hdmi_tx_hdcp_config() argument
2012 if (!hdmi->hdcp1x_enable) in hdmi_tx_hdcp_config()
2023 hdmi_modb(hdmi, vsync_pol | hsync_pol | data_pol, in hdmi_tx_hdcp_config()
2030 hdmi_dvi = hdmi->sink_is_hdmi ? HDMI_A_HDCPCFG0_HDMIDVI_HDMI : in hdmi_tx_hdcp_config()
2032 hdmi_modb(hdmi, hdmi_dvi, HDMI_A_HDCPCFG0_HDMIDVI_MASK, in hdmi_tx_hdcp_config()
2036 if (!(hdmi_readb(hdmi, HDMI_HDCPREG_RMSTS) & 0x3f)) in hdmi_tx_hdcp_config()
2037 dw_hdmi_hdcp_load_key(hdmi); in hdmi_tx_hdcp_config()
2040 hdmi_modb(hdmi, HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE, in hdmi_tx_hdcp_config()
2044 if (hdmi_readb(hdmi, HDMI_CONFIG1_ID) & HDMI_A_HDCP22_MASK) { in hdmi_tx_hdcp_config()
2045 hdmi_modb(hdmi, HDMI_HDCP2_OVR_ENABLE | in hdmi_tx_hdcp_config()
2050 hdmi_writeb(hdmi, 0xff, HDMI_HDCP2REG_MASK); in hdmi_tx_hdcp_config()
2051 hdmi_writeb(hdmi, 0xff, HDMI_HDCP2REG_MUTE); in hdmi_tx_hdcp_config()
2054 hdmi_writeb(hdmi, 0x40, HDMI_A_OESSWCFG); in hdmi_tx_hdcp_config()
2055 hdmi_modb(hdmi, HDMI_A_HDCPCFG0_BYPENCRYPTION_DISABLE | in hdmi_tx_hdcp_config()
2062 hdmi_modb(hdmi, HDMI_A_HDCPCFG1_ENCRYPTIONDISABLE_ENABLE | in hdmi_tx_hdcp_config()
2068 if (hdmi_readb(hdmi, HDMI_MC_CLKDIS) & HDMI_MC_CLKDIS_HDCPCLK_MASK) { in hdmi_tx_hdcp_config()
2069 hdmi_modb(hdmi, HDMI_A_HDCPCFG1_SWRESET_ASSERT, in hdmi_tx_hdcp_config()
2073 hdmi_writeb(hdmi, 0x00, HDMI_A_APIINTMSK); in hdmi_tx_hdcp_config()
2074 hdmi_modb(hdmi, HDMI_A_HDCPCFG0_RXDETECT_ENABLE, in hdmi_tx_hdcp_config()
2077 hdmi_modb(hdmi, HDMI_MC_CLKDIS_HDCPCLK_ENABLE, in hdmi_tx_hdcp_config()
2083 static int dw_hdmi_setup(struct dw_hdmi *hdmi, in dw_hdmi_setup() argument
2089 void *data = hdmi->plat_data->phy_data; in dw_hdmi_setup()
2091 hdmi_disable_overflow_interrupts(hdmi); in dw_hdmi_setup()
2092 if (!hdmi->vic) in dw_hdmi_setup()
2095 printf("CEA mode used vic=%d\n", hdmi->vic); in dw_hdmi_setup()
2097 if (hdmi->plat_data->get_enc_out_encoding) in dw_hdmi_setup()
2098 hdmi->hdmi_data.enc_out_encoding = in dw_hdmi_setup()
2099 hdmi->plat_data->get_enc_out_encoding(data); in dw_hdmi_setup()
2100 else if (hdmi->vic == 6 || hdmi->vic == 7 || in dw_hdmi_setup()
2101 hdmi->vic == 21 || hdmi->vic == 22 || in dw_hdmi_setup()
2102 hdmi->vic == 2 || hdmi->vic == 3 || in dw_hdmi_setup()
2103 hdmi->vic == 17 || hdmi->vic == 18) in dw_hdmi_setup()
2104 hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_601; in dw_hdmi_setup()
2106 hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_709; in dw_hdmi_setup()
2109 hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 1; in dw_hdmi_setup()
2110 hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 1; in dw_hdmi_setup()
2112 hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 0; in dw_hdmi_setup()
2113 hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; in dw_hdmi_setup()
2117 if (hdmi->plat_data->get_enc_in_encoding) in dw_hdmi_setup()
2118 hdmi->hdmi_data.enc_in_encoding = in dw_hdmi_setup()
2119 hdmi->plat_data->get_enc_in_encoding(data); in dw_hdmi_setup()
2120 else if (hdmi->plat_data->input_bus_encoding) in dw_hdmi_setup()
2121 hdmi->hdmi_data.enc_in_encoding = in dw_hdmi_setup()
2122 hdmi->plat_data->input_bus_encoding; in dw_hdmi_setup()
2124 hdmi->hdmi_data.enc_in_encoding = V4L2_YCBCR_ENC_DEFAULT; in dw_hdmi_setup()
2126 if (hdmi->plat_data->get_quant_range) in dw_hdmi_setup()
2127 hdmi->hdmi_data.quant_range = in dw_hdmi_setup()
2128 hdmi->plat_data->get_quant_range(data); in dw_hdmi_setup()
2130 hdmi->hdmi_data.quant_range = HDMI_QUANTIZATION_RANGE_DEFAULT; in dw_hdmi_setup()
2138 hdmi->hdmi_data.pix_repet_factor = in dw_hdmi_setup()
2140 hdmi->hdmi_data.video_mode.mdataenablepolarity = true; in dw_hdmi_setup()
2143 hdmi_av_composer(hdmi, mode); in dw_hdmi_setup()
2146 ret = hdmi->phy.ops->init(conn, hdmi, state); in dw_hdmi_setup()
2149 hdmi->phy.enabled = true; in dw_hdmi_setup()
2152 dw_hdmi_enable_video_path(hdmi); in dw_hdmi_setup()
2155 if (hdmi->sink_has_audio) { in dw_hdmi_setup()
2157 hdmi_clk_regenerator_update_pixel_clock(hdmi); in dw_hdmi_setup()
2158 hdmi_enable_audio_clk(hdmi); in dw_hdmi_setup()
2162 if (hdmi->sink_is_hdmi) { in dw_hdmi_setup()
2164 hdmi_config_AVI(hdmi, mode); in dw_hdmi_setup()
2165 hdmi_config_vendor_specific_infoframe(hdmi, mode); in dw_hdmi_setup()
2166 hdmi_modb(hdmi, HDMI_A_HDCPCFG0_HDMIDVI_HDMI, in dw_hdmi_setup()
2170 hdmi_modb(hdmi, HDMI_A_HDCPCFG0_HDMIDVI_DVI, in dw_hdmi_setup()
2176 hdmi_video_packetize(hdmi); in dw_hdmi_setup()
2177 hdmi_video_csc(hdmi); in dw_hdmi_setup()
2178 hdmi_video_sample(hdmi); in dw_hdmi_setup()
2179 hdmi_tx_hdcp_config(hdmi, mode); in dw_hdmi_setup()
2180 dw_hdmi_clear_overflow(hdmi); in dw_hdmi_setup()
2185 int dw_hdmi_detect_hotplug(struct dw_hdmi *hdmi, in dw_hdmi_detect_hotplug() argument
2192 ret = hdmi->phy.ops->read_hpd(hdmi, state); in dw_hdmi_detect_hotplug()
2201 static int dw_hdmi_set_reg_wr(struct dw_hdmi *hdmi) in dw_hdmi_set_reg_wr() argument
2203 switch (hdmi->io_width) { in dw_hdmi_set_reg_wr()
2205 hdmi->write = dw_hdmi_writel; in dw_hdmi_set_reg_wr()
2206 hdmi->read = dw_hdmi_readl; in dw_hdmi_set_reg_wr()
2209 hdmi->write = dw_hdmi_writeb; in dw_hdmi_set_reg_wr()
2210 hdmi->read = dw_hdmi_readb; in dw_hdmi_set_reg_wr()
2220 static void initialize_hdmi_mutes(struct dw_hdmi *hdmi) in initialize_hdmi_mutes() argument
2223 hdmi_writeb(hdmi, 0xff, HDMI_FC_MASK0); in initialize_hdmi_mutes()
2224 hdmi_writeb(hdmi, 0xff, HDMI_FC_MASK1); in initialize_hdmi_mutes()
2225 hdmi_writeb(hdmi, 0xff, HDMI_FC_MASK2); in initialize_hdmi_mutes()
2226 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_FC_STAT0); in initialize_hdmi_mutes()
2227 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_FC_STAT1); in initialize_hdmi_mutes()
2228 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_FC_STAT2); in initialize_hdmi_mutes()
2229 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_AS_STAT0); in initialize_hdmi_mutes()
2230 hdmi_writeb(hdmi, 0xfe, HDMI_IH_MUTE_PHY_STAT0); in initialize_hdmi_mutes()
2231 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_I2CM_STAT0); in initialize_hdmi_mutes()
2232 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_CEC_STAT0); in initialize_hdmi_mutes()
2233 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_VP_STAT0); in initialize_hdmi_mutes()
2234 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_I2CMPHY_STAT0); in initialize_hdmi_mutes()
2235 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_AHBDMAAUD_STAT0); in initialize_hdmi_mutes()
2236 hdmi_writeb(hdmi, 0xf1, HDMI_PHY_MASK0); in initialize_hdmi_mutes()
2239 dw_hdmi_writel(hdmi, 0x00, HDMI_FC_DBGTMDS2); in initialize_hdmi_mutes()
2240 dw_hdmi_writel(hdmi, 0x00, HDMI_FC_DBGTMDS1); in initialize_hdmi_mutes()
2241 dw_hdmi_writel(hdmi, 0x00, HDMI_FC_DBGTMDS0); in initialize_hdmi_mutes()
2244 static void dw_hdmi_dev_init(struct dw_hdmi *hdmi) in dw_hdmi_dev_init() argument
2246 hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8) in dw_hdmi_dev_init()
2247 | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0); in dw_hdmi_dev_init()
2249 initialize_hdmi_mutes(hdmi); in dw_hdmi_dev_init()
2252 static void dw_hdmi_i2c_set_divs(struct dw_hdmi *hdmi) in dw_hdmi_i2c_set_divs() argument
2258 if (hdmi->i2c->scl_high_ns < 4000) in dw_hdmi_i2c_set_divs()
2261 high_ns = hdmi->i2c->scl_high_ns; in dw_hdmi_i2c_set_divs()
2263 if (hdmi->i2c->scl_low_ns < 4700) in dw_hdmi_i2c_set_divs()
2266 low_ns = hdmi->i2c->scl_low_ns; in dw_hdmi_i2c_set_divs()
2283 hdmi_writeb(hdmi, div_high & 0xff, HDMI_I2CM_SS_SCL_HCNT_0_ADDR); in dw_hdmi_i2c_set_divs()
2284 hdmi_writeb(hdmi, (div_high >> 8) & 0xff, in dw_hdmi_i2c_set_divs()
2286 hdmi_writeb(hdmi, div_low & 0xff, HDMI_I2CM_SS_SCL_LCNT_0_ADDR); in dw_hdmi_i2c_set_divs()
2287 hdmi_writeb(hdmi, (div_low >> 8) & 0xff, in dw_hdmi_i2c_set_divs()
2291 static void dw_hdmi_i2c_init(struct dw_hdmi *hdmi) in dw_hdmi_i2c_init() argument
2294 hdmi_writeb(hdmi, 0x00, HDMI_I2CM_SOFTRSTZ); in dw_hdmi_i2c_init()
2297 hdmi_modb(hdmi, HDMI_I2CM_DIV_STD_MODE, in dw_hdmi_i2c_init()
2301 hdmi_writeb(hdmi, HDMI_I2CM_INT_DONE_POL, HDMI_I2CM_INT); in dw_hdmi_i2c_init()
2302 hdmi_writeb(hdmi, HDMI_I2CM_CTLINT_NAC_POL | HDMI_I2CM_CTLINT_ARB_POL, in dw_hdmi_i2c_init()
2306 hdmi_writeb(hdmi, HDMI_IH_I2CM_STAT0_ERROR | HDMI_IH_I2CM_STAT0_DONE, in dw_hdmi_i2c_init()
2310 hdmi_writeb(hdmi, HDMI_IH_I2CM_STAT0_ERROR | HDMI_IH_I2CM_STAT0_DONE, in dw_hdmi_i2c_init()
2314 hdmi_writeb(hdmi, 0x48, HDMI_I2CM_SDA_HOLD); in dw_hdmi_i2c_init()
2316 dw_hdmi_i2c_set_divs(hdmi); in dw_hdmi_i2c_init()
2319 void dw_hdmi_audio_enable(struct dw_hdmi *hdmi) in dw_hdmi_audio_enable() argument
2321 hdmi->audio_enable = true; in dw_hdmi_audio_enable()
2322 hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); in dw_hdmi_audio_enable()
2325 void dw_hdmi_audio_disable(struct dw_hdmi *hdmi) in dw_hdmi_audio_disable() argument
2327 hdmi->audio_enable = false; in dw_hdmi_audio_disable()
2328 hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0); in dw_hdmi_audio_disable()
2344 struct dw_hdmi *hdmi; in rockchip_dw_hdmi_init() local
2348 hdmi = malloc(sizeof(struct dw_hdmi)); in rockchip_dw_hdmi_init()
2349 if (!hdmi) in rockchip_dw_hdmi_init()
2352 memset(hdmi, 0, sizeof(struct dw_hdmi)); in rockchip_dw_hdmi_init()
2358 hdmi->id = 0; in rockchip_dw_hdmi_init()
2359 hdmi->regs = (void *)RK3528_HDMI_BASE; in rockchip_dw_hdmi_init()
2360 hdmi->io_width = 4; in rockchip_dw_hdmi_init()
2361 hdmi->scramble_low_rates = false; in rockchip_dw_hdmi_init()
2362 hdmi->hdcp1x_enable = false; in rockchip_dw_hdmi_init()
2363 hdmi->output_bus_format_rgb = false; in rockchip_dw_hdmi_init()
2366 hdmi->id = of_alias_get_id(ofnode_to_np(hdmi_node), "hdmi"); in rockchip_dw_hdmi_init()
2367 if (hdmi->id < 0) in rockchip_dw_hdmi_init()
2368 hdmi->id = 0; in rockchip_dw_hdmi_init()
2369 conn_state->disp_info = rockchip_get_disp_info(conn_state->type, hdmi->id); in rockchip_dw_hdmi_init()
2374 hdmi->dev_type = pdata->dev_type; in rockchip_dw_hdmi_init()
2375 hdmi->plat_data = pdata; in rockchip_dw_hdmi_init()
2378 hdmi->regs = dev_read_addr_ptr(conn->dev); in rockchip_dw_hdmi_init()
2379 hdmi->io_width = ofnode_read_s32_default(hdmi_node, "reg-io-width", -1); in rockchip_dw_hdmi_init()
2382 hdmi->scramble_low_rates = true; in rockchip_dw_hdmi_init()
2385 hdmi->hdcp1x_enable = true; in rockchip_dw_hdmi_init()
2387 hdmi->hdcp1x_enable = false; in rockchip_dw_hdmi_init()
2391 hdmi->output_bus_format_rgb = true; in rockchip_dw_hdmi_init()
2393 hdmi->output_bus_format_rgb = false; in rockchip_dw_hdmi_init()
2396 if (ret > 0 && hdmi->plat_data->phy_config) { in rockchip_dw_hdmi_init()
2404 hdmi->plat_data->phy_config[i].mpixelclock = (u64)phy_config[i * 4]; in rockchip_dw_hdmi_init()
2406 hdmi->plat_data->phy_config[i].mpixelclock = ~0UL; in rockchip_dw_hdmi_init()
2407 hdmi->plat_data->phy_config[i].sym_ctr = (u16)phy_config[i * 4 + 1]; in rockchip_dw_hdmi_init()
2408 hdmi->plat_data->phy_config[i].term = (u16)phy_config[i * 4 + 2]; in rockchip_dw_hdmi_init()
2409 hdmi->plat_data->phy_config[i].vlev_ctr = (u16)phy_config[i * 4 + 3]; in rockchip_dw_hdmi_init()
2416 &hdmi->adap.i2c_bus); in rockchip_dw_hdmi_init()
2417 if (hdmi->adap.i2c_bus) in rockchip_dw_hdmi_init()
2418 hdmi->adap.ops = i2c_get_ops(hdmi->adap.i2c_bus); in rockchip_dw_hdmi_init()
2422 hdmi->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); in rockchip_dw_hdmi_init()
2423 if (hdmi->grf <= 0) { in rockchip_dw_hdmi_init()
2425 __func__, hdmi->grf); in rockchip_dw_hdmi_init()
2430 hdmi->gpio_base = (void *)RK3528_GPIO_BASE; in rockchip_dw_hdmi_init()
2433 &hdmi->hpd_gpiod, GPIOD_IS_IN); in rockchip_dw_hdmi_init()
2438 hdmi->gpio_base = (void *)dev_read_addr_index(conn->dev, 1); in rockchip_dw_hdmi_init()
2440 if (!hdmi->gpio_base) in rockchip_dw_hdmi_init()
2443 dw_hdmi_set_reg_wr(hdmi); in rockchip_dw_hdmi_init()
2452 writel(val, hdmi->grf + pdata->grf_vop_sel_reg); in rockchip_dw_hdmi_init()
2455 hdmi->i2c = malloc(sizeof(struct dw_hdmi_i2c)); in rockchip_dw_hdmi_init()
2456 if (!hdmi->i2c) in rockchip_dw_hdmi_init()
2458 hdmi->adap.ddc_xfer = dw_hdmi_i2c_xfer; in rockchip_dw_hdmi_init()
2465 hdmi->i2c->scl_high_ns = 9625; in rockchip_dw_hdmi_init()
2466 hdmi->i2c->scl_low_ns = 10000; in rockchip_dw_hdmi_init()
2468 hdmi->i2c->scl_high_ns = in rockchip_dw_hdmi_init()
2471 hdmi->i2c->scl_low_ns = in rockchip_dw_hdmi_init()
2476 dw_hdmi_i2c_init(hdmi); in rockchip_dw_hdmi_init()
2480 hdmi->edid_data.mode_buf = mode_buf; in rockchip_dw_hdmi_init()
2481 hdmi->sample_rate = 48000; in rockchip_dw_hdmi_init()
2483 conn->data = hdmi; in rockchip_dw_hdmi_init()
2484 dw_hdmi_set_iomux(hdmi->grf, hdmi->gpio_base, in rockchip_dw_hdmi_init()
2485 &hdmi->hpd_gpiod, hdmi->dev_type); in rockchip_dw_hdmi_init()
2486 dw_hdmi_detect_phy(hdmi); in rockchip_dw_hdmi_init()
2487 dw_hdmi_dev_init(hdmi); in rockchip_dw_hdmi_init()
2494 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_deinit() local
2496 if (hdmi->i2c) in rockchip_dw_hdmi_deinit()
2497 free(hdmi->i2c); in rockchip_dw_hdmi_deinit()
2498 if (hdmi->edid_data.mode_buf) in rockchip_dw_hdmi_deinit()
2499 free(hdmi->edid_data.mode_buf); in rockchip_dw_hdmi_deinit()
2500 if (hdmi) in rockchip_dw_hdmi_deinit()
2501 free(hdmi); in rockchip_dw_hdmi_deinit()
2509 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_config_output() local
2514 drm_rk_selete_output(&hdmi->edid_data, conn_state, &bus_format, in rockchip_dw_hdmi_config_output()
2515 overscan, hdmi->dev_type, hdmi->output_bus_format_rgb); in rockchip_dw_hdmi_config_output()
2517 *mode = *hdmi->edid_data.preferred_mode; in rockchip_dw_hdmi_config_output()
2518 hdmi->vic = drm_match_cea_mode(mode); in rockchip_dw_hdmi_config_output()
2521 hdmi->force_output = state->force_output; in rockchip_dw_hdmi_config_output()
2522 hdmi->sink_is_hdmi = true; in rockchip_dw_hdmi_config_output()
2523 hdmi->sink_has_audio = true; in rockchip_dw_hdmi_config_output()
2527 hdmi->hdmi_data.enc_in_bus_format = bus_format; in rockchip_dw_hdmi_config_output()
2528 hdmi->hdmi_data.enc_out_bus_format = bus_format; in rockchip_dw_hdmi_config_output()
2533 hdmi->hdmi_data.enc_in_bus_format = in rockchip_dw_hdmi_config_output()
2538 hdmi->hdmi_data.enc_in_bus_format = in rockchip_dw_hdmi_config_output()
2547 if (hdmi->vic == 6 || hdmi->vic == 7 || hdmi->vic == 21 || in rockchip_dw_hdmi_config_output()
2548 hdmi->vic == 22 || hdmi->vic == 2 || hdmi->vic == 3 || in rockchip_dw_hdmi_config_output()
2549 hdmi->vic == 17 || hdmi->vic == 18) in rockchip_dw_hdmi_config_output()
2566 conn_state->color_range = hdmi->hdmi_data.quant_range == in rockchip_dw_hdmi_config_output()
2571 conn_state->color_range = hdmi->hdmi_data.quant_range == in rockchip_dw_hdmi_config_output()
2581 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_prepare() local
2583 if (!hdmi->edid_data.preferred_mode && conn->bridge) { in rockchip_dw_hdmi_prepare()
2584 drm_add_hdmi_modes(&hdmi->edid_data, mode); in rockchip_dw_hdmi_prepare()
2585 drm_mode_sort(&hdmi->edid_data); in rockchip_dw_hdmi_prepare()
2586 hdmi->sink_is_hdmi = true; in rockchip_dw_hdmi_prepare()
2587 hdmi->sink_has_audio = true; in rockchip_dw_hdmi_prepare()
2598 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_enable() local
2600 if (!hdmi) in rockchip_dw_hdmi_enable()
2604 memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode)); in rockchip_dw_hdmi_enable()
2606 dw_hdmi_setup(hdmi, conn, mode, state); in rockchip_dw_hdmi_enable()
2613 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_disable() local
2615 dw_hdmi_disable(conn, hdmi, state); in rockchip_dw_hdmi_disable()
2619 static void rockchip_dw_hdmi_mode_valid(struct dw_hdmi *hdmi) in rockchip_dw_hdmi_mode_valid() argument
2621 struct hdmi_edid_data *edid_data = &hdmi->edid_data; in rockchip_dw_hdmi_mode_valid()
2637 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_get_timing() local
2641 if (!hdmi) in rockchip_dw_hdmi_get_timing()
2644 conn_state->edid = drm_do_get_edid(&hdmi->adap); in rockchip_dw_hdmi_get_timing()
2647 hdmi->sink_has_audio = drm_detect_monitor_audio(edid); in rockchip_dw_hdmi_get_timing()
2648 if (hdmi->sink_has_audio) in rockchip_dw_hdmi_get_timing()
2649 hdmi->sink_is_hdmi = true; in rockchip_dw_hdmi_get_timing()
2651 hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); in rockchip_dw_hdmi_get_timing()
2653 ret = drm_add_edid_modes(&hdmi->edid_data, conn_state->edid); in rockchip_dw_hdmi_get_timing()
2656 hdmi->sink_is_hdmi = true; in rockchip_dw_hdmi_get_timing()
2657 hdmi->sink_has_audio = true; in rockchip_dw_hdmi_get_timing()
2658 do_cea_modes(&hdmi->edid_data, def_modes_vic, in rockchip_dw_hdmi_get_timing()
2660 hdmi->edid_data.mode_buf[0].type |= DRM_MODE_TYPE_PREFERRED; in rockchip_dw_hdmi_get_timing()
2661 hdmi->edid_data.preferred_mode = &hdmi->edid_data.mode_buf[0]; in rockchip_dw_hdmi_get_timing()
2665 conn_state->disp_info = rockchip_get_disp_info(conn_state->type, hdmi->id); in rockchip_dw_hdmi_get_timing()
2667 drm_rk_filter_whitelist(&hdmi->edid_data); in rockchip_dw_hdmi_get_timing()
2668 rockchip_dw_hdmi_mode_valid(hdmi); in rockchip_dw_hdmi_get_timing()
2669 if (hdmi->phy.ops->mode_valid) in rockchip_dw_hdmi_get_timing()
2670 hdmi->phy.ops->mode_valid(conn, hdmi, state); in rockchip_dw_hdmi_get_timing()
2671 drm_mode_max_resolution_filter(&hdmi->edid_data, in rockchip_dw_hdmi_get_timing()
2673 if (!drm_mode_prune_invalid(&hdmi->edid_data)) { in rockchip_dw_hdmi_get_timing()
2678 for (i = 0; i < hdmi->edid_data.modes; i++) { in rockchip_dw_hdmi_get_timing()
2679 hdmi->edid_data.mode_buf[i].vrefresh = in rockchip_dw_hdmi_get_timing()
2680 drm_mode_vrefresh(&hdmi->edid_data.mode_buf[i]); in rockchip_dw_hdmi_get_timing()
2682 vic = drm_match_cea_mode(&hdmi->edid_data.mode_buf[i]); in rockchip_dw_hdmi_get_timing()
2683 if (hdmi->edid_data.mode_buf[i].picture_aspect_ratio == HDMI_PICTURE_ASPECT_NONE) { in rockchip_dw_hdmi_get_timing()
2685 hdmi->edid_data.mode_buf[i].picture_aspect_ratio = in rockchip_dw_hdmi_get_timing()
2688 hdmi->edid_data.mode_buf[i].picture_aspect_ratio = in rockchip_dw_hdmi_get_timing()
2693 drm_mode_sort(&hdmi->edid_data); in rockchip_dw_hdmi_get_timing()
2702 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_detect() local
2704 if (!hdmi) in rockchip_dw_hdmi_detect()
2707 ret = dw_hdmi_detect_hotplug(hdmi, state); in rockchip_dw_hdmi_detect()
2716 struct dw_hdmi *hdmi = conn->data; in rockchip_dw_hdmi_get_edid() local
2718 conn_state->edid = drm_do_get_edid(&hdmi->adap); in rockchip_dw_hdmi_get_edid()
2725 int inno_dw_hdmi_phy_init(struct rockchip_connector *conn, struct dw_hdmi *hdmi, void *data) in inno_dw_hdmi_phy_init() argument
2732 hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format); in inno_dw_hdmi_phy_init()
2734 if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) in inno_dw_hdmi_phy_init()
2736 else if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) in inno_dw_hdmi_phy_init()
2743 if (hdmi->edid_data.display_info.hdmi.scdc.supported) in inno_dw_hdmi_phy_init()
2744 rockchip_dw_hdmi_scdc_set_tmds_rate(hdmi); in inno_dw_hdmi_phy_init()
2750 void inno_dw_hdmi_phy_disable(struct rockchip_connector *conn, struct dw_hdmi *hdmi, void *data) in inno_dw_hdmi_phy_disable() argument
2755 inno_dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi, void *data) in inno_dw_hdmi_phy_read_hpd() argument
2760 status = dw_hdmi_phy_read_hpd(hdmi, state); in inno_dw_hdmi_phy_read_hpd()
2762 if (hdmi->dev_type == RK3328_HDMI) { in inno_dw_hdmi_phy_read_hpd()
2764 inno_dw_hdmi_set_domain(hdmi->grf, 1); in inno_dw_hdmi_phy_read_hpd()
2766 inno_dw_hdmi_set_domain(hdmi->grf, 0); in inno_dw_hdmi_phy_read_hpd()
2772 void inno_dw_hdmi_mode_valid(struct rockchip_connector *conn, struct dw_hdmi *hdmi, void *data) in inno_dw_hdmi_mode_valid() argument
2774 struct hdmi_edid_data *edid_data = &hdmi->edid_data; in inno_dw_hdmi_mode_valid()