Lines Matching refs:hdmi
134 void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
135 u8 (*read)(struct dw_hdmi *hdmi, int offset);
138 static void dw_hdmi_writel(struct dw_hdmi *hdmi, u8 val, int offset) in dw_hdmi_writel() argument
140 writel(val, hdmi->regs + (offset << 2)); in dw_hdmi_writel()
143 static u8 dw_hdmi_readl(struct dw_hdmi *hdmi, int offset) in dw_hdmi_readl() argument
145 return readl(hdmi->regs + (offset << 2)); in dw_hdmi_readl()
148 static void dw_hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) in dw_hdmi_writeb() argument
150 writeb(val, hdmi->regs + offset); in dw_hdmi_writeb()
153 static u8 dw_hdmi_readb(struct dw_hdmi *hdmi, int offset) in dw_hdmi_readb() argument
155 return readb(hdmi->regs + offset); in dw_hdmi_readb()
158 static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) in hdmi_writeb() argument
160 hdmi->write(hdmi, val, offset); in hdmi_writeb()
163 static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset) in hdmi_readb() argument
165 return hdmi->read(hdmi, offset); in hdmi_readb()
168 static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg) in hdmi_modb() argument
170 u8 val = hdmi_readb(hdmi, reg) & ~mask; in hdmi_modb()
173 hdmi_writeb(hdmi, val, reg); in hdmi_modb()
176 static void hdmi_mask_writeb(struct dw_hdmi *hdmi, u8 data, unsigned int reg, in hdmi_mask_writeb() argument
179 hdmi_modb(hdmi, data << shift, mask, reg); in hdmi_mask_writeb()
182 static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts, in hdmi_set_cts_n() argument
186 hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); in hdmi_set_cts_n()
189 hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3); in hdmi_set_cts_n()
191 hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) | in hdmi_set_cts_n()
193 hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2); in hdmi_set_cts_n()
194 hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1); in hdmi_set_cts_n()
196 hdmi_writeb(hdmi, (n >> 16) & 0x0f, HDMI_AUD_N3); in hdmi_set_cts_n()
197 hdmi_writeb(hdmi, (n >> 8) & 0xff, HDMI_AUD_N2); in hdmi_set_cts_n()
198 hdmi_writeb(hdmi, n & 0xff, HDMI_AUD_N1); in hdmi_set_cts_n()
337 static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi, in hdmi_set_clk_regenerator() argument
342 clk_n = hdmi_compute_n(hdmi->sample_rate, pixel_clk, in hdmi_set_clk_regenerator()
343 hdmi->ratio); in hdmi_set_clk_regenerator()
344 clk_cts = hdmi_compute_cts(hdmi->sample_rate, pixel_clk, in hdmi_set_clk_regenerator()
345 hdmi->ratio); in hdmi_set_clk_regenerator()
348 dev_dbg(hdmi->dev, "%s: pixel clock not supported: %lu\n", in hdmi_set_clk_regenerator()
353 dev_dbg(hdmi->dev, "%s: samplerate=%d ratio=%d pixelclk=%lu N=%d cts=%d\n", in hdmi_set_clk_regenerator()
354 __func__, hdmi->sample_rate, hdmi->ratio, in hdmi_set_clk_regenerator()
357 hdmi_set_cts_n(hdmi, clk_cts, clk_n); in hdmi_set_clk_regenerator()
360 static void hdmi_init_clk_regenerator(struct dw_hdmi *hdmi) in hdmi_init_clk_regenerator() argument
362 mutex_lock(&hdmi->audio_mutex); in hdmi_init_clk_regenerator()
363 hdmi_set_clk_regenerator(hdmi, 74250000); in hdmi_init_clk_regenerator()
364 mutex_unlock(&hdmi->audio_mutex); in hdmi_init_clk_regenerator()
367 static void hdmi_clk_regenerator_update_pixel_clock(struct dw_hdmi *hdmi) in hdmi_clk_regenerator_update_pixel_clock() argument
369 mutex_lock(&hdmi->audio_mutex); in hdmi_clk_regenerator_update_pixel_clock()
370 hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mpixelclock); in hdmi_clk_regenerator_update_pixel_clock()
371 mutex_unlock(&hdmi->audio_mutex); in hdmi_clk_regenerator_update_pixel_clock()
381 static void hdmi_video_sample(struct dw_hdmi *hdmi) in hdmi_video_sample() argument
386 if (hdmi->hdmi_data.enc_in_format == RGB) { in hdmi_video_sample()
387 if (hdmi->hdmi_data.enc_color_depth == 8) in hdmi_video_sample()
389 else if (hdmi->hdmi_data.enc_color_depth == 10) in hdmi_video_sample()
391 else if (hdmi->hdmi_data.enc_color_depth == 12) in hdmi_video_sample()
393 else if (hdmi->hdmi_data.enc_color_depth == 16) in hdmi_video_sample()
397 } else if (hdmi->hdmi_data.enc_in_format == YCBCR444) { in hdmi_video_sample()
398 if (hdmi->hdmi_data.enc_color_depth == 8) in hdmi_video_sample()
400 else if (hdmi->hdmi_data.enc_color_depth == 10) in hdmi_video_sample()
402 else if (hdmi->hdmi_data.enc_color_depth == 12) in hdmi_video_sample()
404 else if (hdmi->hdmi_data.enc_color_depth == 16) in hdmi_video_sample()
408 } else if (hdmi->hdmi_data.enc_in_format == YCBCR422_8BITS) { in hdmi_video_sample()
409 if (hdmi->hdmi_data.enc_color_depth == 8) in hdmi_video_sample()
411 else if (hdmi->hdmi_data.enc_color_depth == 10) in hdmi_video_sample()
413 else if (hdmi->hdmi_data.enc_color_depth == 12) in hdmi_video_sample()
422 hdmi_writeb(hdmi, val, HDMI_TX_INVID0); in hdmi_video_sample()
428 hdmi_writeb(hdmi, val, HDMI_TX_INSTUFFING); in hdmi_video_sample()
429 hdmi_writeb(hdmi, 0x0, HDMI_TX_GYDATA0); in hdmi_video_sample()
430 hdmi_writeb(hdmi, 0x0, HDMI_TX_GYDATA1); in hdmi_video_sample()
431 hdmi_writeb(hdmi, 0x0, HDMI_TX_RCRDATA0); in hdmi_video_sample()
432 hdmi_writeb(hdmi, 0x0, HDMI_TX_RCRDATA1); in hdmi_video_sample()
433 hdmi_writeb(hdmi, 0x0, HDMI_TX_BCBDATA0); in hdmi_video_sample()
434 hdmi_writeb(hdmi, 0x0, HDMI_TX_BCBDATA1); in hdmi_video_sample()
437 static int is_color_space_conversion(struct dw_hdmi *hdmi) in is_color_space_conversion() argument
439 return hdmi->hdmi_data.enc_in_format != hdmi->hdmi_data.enc_out_format; in is_color_space_conversion()
442 static int is_color_space_decimation(struct dw_hdmi *hdmi) in is_color_space_decimation() argument
444 if (hdmi->hdmi_data.enc_out_format != YCBCR422_8BITS) in is_color_space_decimation()
446 if (hdmi->hdmi_data.enc_in_format == RGB || in is_color_space_decimation()
447 hdmi->hdmi_data.enc_in_format == YCBCR444) in is_color_space_decimation()
452 static int is_color_space_interpolation(struct dw_hdmi *hdmi) in is_color_space_interpolation() argument
454 if (hdmi->hdmi_data.enc_in_format != YCBCR422_8BITS) in is_color_space_interpolation()
456 if (hdmi->hdmi_data.enc_out_format == RGB || in is_color_space_interpolation()
457 hdmi->hdmi_data.enc_out_format == YCBCR444) in is_color_space_interpolation()
462 static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi) in dw_hdmi_update_csc_coeffs() argument
468 if (is_color_space_conversion(hdmi)) { in dw_hdmi_update_csc_coeffs()
469 if (hdmi->hdmi_data.enc_out_format == RGB) { in dw_hdmi_update_csc_coeffs()
470 if (hdmi->hdmi_data.colorimetry == in dw_hdmi_update_csc_coeffs()
475 } else if (hdmi->hdmi_data.enc_in_format == RGB) { in dw_hdmi_update_csc_coeffs()
476 if (hdmi->hdmi_data.colorimetry == in dw_hdmi_update_csc_coeffs()
491 hdmi_writeb(hdmi, coeff_a & 0xff, HDMI_CSC_COEF_A1_LSB + i * 2); in dw_hdmi_update_csc_coeffs()
492 hdmi_writeb(hdmi, coeff_a >> 8, HDMI_CSC_COEF_A1_MSB + i * 2); in dw_hdmi_update_csc_coeffs()
493 hdmi_writeb(hdmi, coeff_b & 0xff, HDMI_CSC_COEF_B1_LSB + i * 2); in dw_hdmi_update_csc_coeffs()
494 hdmi_writeb(hdmi, coeff_b >> 8, HDMI_CSC_COEF_B1_MSB + i * 2); in dw_hdmi_update_csc_coeffs()
495 hdmi_writeb(hdmi, coeff_c & 0xff, HDMI_CSC_COEF_C1_LSB + i * 2); in dw_hdmi_update_csc_coeffs()
496 hdmi_writeb(hdmi, coeff_c >> 8, HDMI_CSC_COEF_C1_MSB + i * 2); in dw_hdmi_update_csc_coeffs()
499 hdmi_modb(hdmi, csc_scale, HDMI_CSC_SCALE_CSCSCALE_MASK, in dw_hdmi_update_csc_coeffs()
503 static void hdmi_video_csc(struct dw_hdmi *hdmi) in hdmi_video_csc() argument
510 if (is_color_space_interpolation(hdmi)) in hdmi_video_csc()
512 else if (is_color_space_decimation(hdmi)) in hdmi_video_csc()
515 if (hdmi->hdmi_data.enc_color_depth == 8) in hdmi_video_csc()
517 else if (hdmi->hdmi_data.enc_color_depth == 10) in hdmi_video_csc()
519 else if (hdmi->hdmi_data.enc_color_depth == 12) in hdmi_video_csc()
521 else if (hdmi->hdmi_data.enc_color_depth == 16) in hdmi_video_csc()
527 hdmi_writeb(hdmi, interpolation | decimation, HDMI_CSC_CFG); in hdmi_video_csc()
528 hdmi_modb(hdmi, color_depth, HDMI_CSC_SCALE_CSC_COLORDE_PTH_MASK, in hdmi_video_csc()
531 dw_hdmi_update_csc_coeffs(hdmi); in hdmi_video_csc()
539 static void hdmi_video_packetize(struct dw_hdmi *hdmi) in hdmi_video_packetize() argument
544 struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data; in hdmi_video_packetize()
584 hdmi_writeb(hdmi, val, HDMI_VP_PR_CD); in hdmi_video_packetize()
586 hdmi_modb(hdmi, HDMI_VP_STUFF_PR_STUFFING_STUFFING_MODE, in hdmi_video_packetize()
598 hdmi_modb(hdmi, vp_conf, in hdmi_video_packetize()
602 hdmi_modb(hdmi, 1 << HDMI_VP_STUFF_IDEFAULT_PHASE_OFFSET, in hdmi_video_packetize()
605 hdmi_writeb(hdmi, remap_size, HDMI_VP_REMAP); in hdmi_video_packetize()
623 hdmi_modb(hdmi, vp_conf, in hdmi_video_packetize()
627 hdmi_modb(hdmi, HDMI_VP_STUFF_PP_STUFFING_STUFFING_MODE | in hdmi_video_packetize()
632 hdmi_modb(hdmi, output_select, HDMI_VP_CONF_OUTPUT_SELECTOR_MASK, in hdmi_video_packetize()
636 static inline void hdmi_phy_test_clear(struct dw_hdmi *hdmi, in hdmi_phy_test_clear() argument
639 hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTCLR_OFFSET, in hdmi_phy_test_clear()
643 static inline void hdmi_phy_test_enable(struct dw_hdmi *hdmi, in hdmi_phy_test_enable() argument
646 hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTEN_OFFSET, in hdmi_phy_test_enable()
650 static inline void hdmi_phy_test_clock(struct dw_hdmi *hdmi, in hdmi_phy_test_clock() argument
653 hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTCLK_OFFSET, in hdmi_phy_test_clock()
657 static inline void hdmi_phy_test_din(struct dw_hdmi *hdmi, in hdmi_phy_test_din() argument
660 hdmi_writeb(hdmi, bit, HDMI_PHY_TST1); in hdmi_phy_test_din()
663 static inline void hdmi_phy_test_dout(struct dw_hdmi *hdmi, in hdmi_phy_test_dout() argument
666 hdmi_writeb(hdmi, bit, HDMI_PHY_TST2); in hdmi_phy_test_dout()
669 static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, int msec) in hdmi_phy_wait_i2c_done() argument
673 while ((val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) { in hdmi_phy_wait_i2c_done()
678 hdmi_writeb(hdmi, val, HDMI_IH_I2CMPHY_STAT0); in hdmi_phy_wait_i2c_done()
683 static void __hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, in __hdmi_phy_i2c_write() argument
686 hdmi_writeb(hdmi, 0xFF, HDMI_IH_I2CMPHY_STAT0); in __hdmi_phy_i2c_write()
687 hdmi_writeb(hdmi, addr, HDMI_PHY_I2CM_ADDRESS_ADDR); in __hdmi_phy_i2c_write()
688 hdmi_writeb(hdmi, (unsigned char)(data >> 8), in __hdmi_phy_i2c_write()
690 hdmi_writeb(hdmi, (unsigned char)(data >> 0), in __hdmi_phy_i2c_write()
692 hdmi_writeb(hdmi, HDMI_PHY_I2CM_OPERATION_ADDR_WRITE, in __hdmi_phy_i2c_write()
694 hdmi_phy_wait_i2c_done(hdmi, 1000); in __hdmi_phy_i2c_write()
697 static int hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, in hdmi_phy_i2c_write() argument
700 __hdmi_phy_i2c_write(hdmi, data, addr); in hdmi_phy_i2c_write()
704 static void dw_hdmi_phy_enable_power(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_enable_power() argument
706 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_enable_power()
711 static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_enable_tmds() argument
713 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_enable_tmds()
718 static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_enable_spare() argument
720 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_enable_spare()
725 static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_gen2_pddq() argument
727 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_gen2_pddq()
732 static void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_gen2_txpwron() argument
734 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_gen2_txpwron()
739 static void dw_hdmi_phy_sel_data_en_pol(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_sel_data_en_pol() argument
741 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_sel_data_en_pol()
746 static void dw_hdmi_phy_sel_interface_control(struct dw_hdmi *hdmi, u8 enable) in dw_hdmi_phy_sel_interface_control() argument
748 hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, in dw_hdmi_phy_sel_interface_control()
753 static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep, in hdmi_phy_configure() argument
758 const struct dw_hdmi_plat_data *plat_data = hdmi->plat_data; in hdmi_phy_configure()
787 hdmi_writeb(hdmi, val, HDMI_MC_FLOWCTRL); in hdmi_phy_configure()
790 dw_hdmi_phy_gen2_txpwron(hdmi, 0); in hdmi_phy_configure()
793 dw_hdmi_phy_gen2_pddq(hdmi, 1); in hdmi_phy_configure()
796 hdmi_writeb(hdmi, HDMI_MC_PHYRSTZ_DEASSERT, HDMI_MC_PHYRSTZ); in hdmi_phy_configure()
797 hdmi_writeb(hdmi, HDMI_MC_PHYRSTZ_ASSERT, HDMI_MC_PHYRSTZ); in hdmi_phy_configure()
799 hdmi_writeb(hdmi, HDMI_MC_HEACPHY_RST_ASSERT, HDMI_MC_HEACPHY_RST); in hdmi_phy_configure()
801 hdmi_phy_test_clear(hdmi, 1); in hdmi_phy_configure()
802 hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, in hdmi_phy_configure()
804 hdmi_phy_test_clear(hdmi, 0); in hdmi_phy_configure()
808 if (hdmi->hdmi_data.video_mode.mpixelclock <= in hdmi_phy_configure()
812 hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].cpce, 0x06); in hdmi_phy_configure()
813 hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].gmp, 0x15); in hdmi_phy_configure()
816 if (hdmi->hdmi_data.video_mode.mpixelclock <= in hdmi_phy_configure()
821 dev_err(hdmi->dev, "Pixel clock %d - unsupported by HDMI\n", in hdmi_phy_configure()
822 hdmi->hdmi_data.video_mode.mpixelclock); in hdmi_phy_configure()
827 hdmi_phy_i2c_write(hdmi, curr_ctrl[i].curr[res_idx], 0x10); in hdmi_phy_configure()
829 hdmi_phy_i2c_write(hdmi, 0x0000, 0x13); /* PLLPHBYCTRL */ in hdmi_phy_configure()
830 hdmi_phy_i2c_write(hdmi, 0x0006, 0x17); in hdmi_phy_configure()
833 if (hdmi->hdmi_data.video_mode.mpixelclock <= in hdmi_phy_configure()
838 hdmi_phy_i2c_write(hdmi, phy_config[i].term, 0x19); /* TXTERM */ in hdmi_phy_configure()
840 hdmi_phy_i2c_write(hdmi, phy_config[i].sym_ctr, 0x09); /* CKSYMTXCTRL */ in hdmi_phy_configure()
842 hdmi_phy_i2c_write(hdmi, phy_config[i].vlev_ctr, 0x0E); /* VLEVCTRL */ in hdmi_phy_configure()
845 hdmi_phy_i2c_write(hdmi, 0x8000, 0x05); /* CKCALCTRL */ in hdmi_phy_configure()
847 dw_hdmi_phy_enable_power(hdmi, 1); in hdmi_phy_configure()
850 dw_hdmi_phy_enable_tmds(hdmi, 0); in hdmi_phy_configure()
851 dw_hdmi_phy_enable_tmds(hdmi, 1); in hdmi_phy_configure()
854 dw_hdmi_phy_gen2_txpwron(hdmi, 1); in hdmi_phy_configure()
855 dw_hdmi_phy_gen2_pddq(hdmi, 0); in hdmi_phy_configure()
857 if (hdmi->dev_type == RK3288_HDMI) in hdmi_phy_configure()
858 dw_hdmi_phy_enable_spare(hdmi, 1); in hdmi_phy_configure()
863 val = hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_TX_PHY_LOCK; in hdmi_phy_configure()
868 dev_err(hdmi->dev, "PHY PLL not locked\n"); in hdmi_phy_configure()
879 static int dw_hdmi_phy_init(struct dw_hdmi *hdmi) in dw_hdmi_phy_init() argument
885 cscon = (is_color_space_conversion(hdmi) && in dw_hdmi_phy_init()
886 !hdmi->hdmi_data.video_mode.mdvi); in dw_hdmi_phy_init()
890 dw_hdmi_phy_sel_data_en_pol(hdmi, 1); in dw_hdmi_phy_init()
891 dw_hdmi_phy_sel_interface_control(hdmi, 0); in dw_hdmi_phy_init()
892 dw_hdmi_phy_enable_tmds(hdmi, 0); in dw_hdmi_phy_init()
893 dw_hdmi_phy_enable_power(hdmi, 0); in dw_hdmi_phy_init()
896 ret = hdmi_phy_configure(hdmi, 0, 8, cscon); in dw_hdmi_phy_init()
901 hdmi->phy_enabled = true; in dw_hdmi_phy_init()
905 static void hdmi_tx_hdcp_config(struct dw_hdmi *hdmi) in hdmi_tx_hdcp_config() argument
909 if (hdmi->hdmi_data.video_mode.mdataenablepolarity) in hdmi_tx_hdcp_config()
915 hdmi_modb(hdmi, HDMI_A_HDCPCFG0_RXDETECT_DISABLE, in hdmi_tx_hdcp_config()
918 hdmi_modb(hdmi, de, HDMI_A_VIDPOLCFG_DATAENPOL_MASK, HDMI_A_VIDPOLCFG); in hdmi_tx_hdcp_config()
920 hdmi_modb(hdmi, HDMI_A_HDCPCFG1_ENCRYPTIONDISABLE_DISABLE, in hdmi_tx_hdcp_config()
924 static void hdmi_config_AVI(struct dw_hdmi *hdmi) in hdmi_config_AVI() argument
933 if (hdmi->hdmi_data.enc_out_format == YCBCR444) in hdmi_config_AVI()
935 else if (hdmi->hdmi_data.enc_out_format == YCBCR422_8BITS) in hdmi_config_AVI()
950 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF0); in hdmi_config_AVI()
962 if (hdmi->hdmi_data.enc_out_format == XVYCC444) { in hdmi_config_AVI()
964 if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601) in hdmi_config_AVI()
970 } else if (hdmi->hdmi_data.enc_out_format != RGB) { in hdmi_config_AVI()
971 if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601) in hdmi_config_AVI()
982 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF1); in hdmi_config_AVI()
988 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF2); in hdmi_config_AVI()
991 hdmi_writeb(hdmi, hdmi->vic, HDMI_FC_AVIVID); in hdmi_config_AVI()
994 val = (((hdmi->hdmi_data.video_mode.mpixelrepetitioninput + 1) << in hdmi_config_AVI()
997 ((hdmi->hdmi_data.video_mode.mpixelrepetitionoutput << in hdmi_config_AVI()
1000 hdmi_writeb(hdmi, val, HDMI_FC_PRCONF); in hdmi_config_AVI()
1005 hdmi_writeb(hdmi, val, HDMI_FC_AVICONF3); in hdmi_config_AVI()
1008 hdmi_writeb(hdmi, 0, HDMI_FC_AVIETB0); in hdmi_config_AVI()
1009 hdmi_writeb(hdmi, 0, HDMI_FC_AVIETB1); in hdmi_config_AVI()
1010 hdmi_writeb(hdmi, 0, HDMI_FC_AVISBB0); in hdmi_config_AVI()
1011 hdmi_writeb(hdmi, 0, HDMI_FC_AVISBB1); in hdmi_config_AVI()
1012 hdmi_writeb(hdmi, 0, HDMI_FC_AVIELB0); in hdmi_config_AVI()
1013 hdmi_writeb(hdmi, 0, HDMI_FC_AVIELB1); in hdmi_config_AVI()
1014 hdmi_writeb(hdmi, 0, HDMI_FC_AVISRB0); in hdmi_config_AVI()
1015 hdmi_writeb(hdmi, 0, HDMI_FC_AVISRB1); in hdmi_config_AVI()
1018 static void hdmi_av_composer(struct dw_hdmi *hdmi, in hdmi_av_composer() argument
1022 struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode; in hdmi_av_composer()
1030 dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock); in hdmi_av_composer()
1033 inv_val = (hdmi->hdmi_data.hdcp_enable ? in hdmi_av_composer()
1049 if (hdmi->vic == 39) in hdmi_av_composer()
1064 hdmi_writeb(hdmi, inv_val, HDMI_FC_INVIDCONF); in hdmi_av_composer()
1067 hdmi_writeb(hdmi, mode->hdisplay >> 8, HDMI_FC_INHACTV1); in hdmi_av_composer()
1068 hdmi_writeb(hdmi, mode->hdisplay, HDMI_FC_INHACTV0); in hdmi_av_composer()
1071 hdmi_writeb(hdmi, mode->vdisplay >> 8, HDMI_FC_INVACTV1); in hdmi_av_composer()
1072 hdmi_writeb(hdmi, mode->vdisplay, HDMI_FC_INVACTV0); in hdmi_av_composer()
1076 hdmi_writeb(hdmi, hblank >> 8, HDMI_FC_INHBLANK1); in hdmi_av_composer()
1077 hdmi_writeb(hdmi, hblank, HDMI_FC_INHBLANK0); in hdmi_av_composer()
1081 hdmi_writeb(hdmi, vblank, HDMI_FC_INVBLANK); in hdmi_av_composer()
1085 hdmi_writeb(hdmi, h_de_hs >> 8, HDMI_FC_HSYNCINDELAY1); in hdmi_av_composer()
1086 hdmi_writeb(hdmi, h_de_hs, HDMI_FC_HSYNCINDELAY0); in hdmi_av_composer()
1090 hdmi_writeb(hdmi, v_de_vs, HDMI_FC_VSYNCINDELAY); in hdmi_av_composer()
1094 hdmi_writeb(hdmi, hsync_len >> 8, HDMI_FC_HSYNCINWIDTH1); in hdmi_av_composer()
1095 hdmi_writeb(hdmi, hsync_len, HDMI_FC_HSYNCINWIDTH0); in hdmi_av_composer()
1099 hdmi_writeb(hdmi, vsync_len, HDMI_FC_VSYNCINWIDTH); in hdmi_av_composer()
1102 static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi) in dw_hdmi_phy_disable() argument
1104 if (!hdmi->phy_enabled) in dw_hdmi_phy_disable()
1107 dw_hdmi_phy_enable_tmds(hdmi, 0); in dw_hdmi_phy_disable()
1108 dw_hdmi_phy_enable_power(hdmi, 0); in dw_hdmi_phy_disable()
1110 hdmi->phy_enabled = false; in dw_hdmi_phy_disable()
1114 static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) in dw_hdmi_enable_video_path() argument
1119 hdmi_writeb(hdmi, 12, HDMI_FC_CTRLDUR); in dw_hdmi_enable_video_path()
1120 hdmi_writeb(hdmi, 32, HDMI_FC_EXCTRLDUR); in dw_hdmi_enable_video_path()
1121 hdmi_writeb(hdmi, 1, HDMI_FC_EXCTRLSPAC); in dw_hdmi_enable_video_path()
1124 hdmi_writeb(hdmi, 0x0B, HDMI_FC_CH0PREAM); in dw_hdmi_enable_video_path()
1125 hdmi_writeb(hdmi, 0x16, HDMI_FC_CH1PREAM); in dw_hdmi_enable_video_path()
1126 hdmi_writeb(hdmi, 0x21, HDMI_FC_CH2PREAM); in dw_hdmi_enable_video_path()
1131 hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1134 hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1137 if (is_color_space_conversion(hdmi)) { in dw_hdmi_enable_video_path()
1139 hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1143 static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi) in hdmi_enable_audio_clk() argument
1145 hdmi_modb(hdmi, 0, HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS); in hdmi_enable_audio_clk()
1149 static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) in dw_hdmi_clear_overflow() argument
1155 hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, HDMI_MC_SWRSTZ); in dw_hdmi_clear_overflow()
1157 val = hdmi_readb(hdmi, HDMI_FC_INVIDCONF); in dw_hdmi_clear_overflow()
1158 if (hdmi->dev_type == IMX6DL_HDMI) { in dw_hdmi_clear_overflow()
1159 hdmi_writeb(hdmi, val, HDMI_FC_INVIDCONF); in dw_hdmi_clear_overflow()
1164 hdmi_writeb(hdmi, val, HDMI_FC_INVIDCONF); in dw_hdmi_clear_overflow()
1167 static void hdmi_enable_overflow_interrupts(struct dw_hdmi *hdmi) in hdmi_enable_overflow_interrupts() argument
1169 hdmi_writeb(hdmi, 0, HDMI_FC_MASK2); in hdmi_enable_overflow_interrupts()
1170 hdmi_writeb(hdmi, 0, HDMI_IH_MUTE_FC_STAT2); in hdmi_enable_overflow_interrupts()
1173 static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) in hdmi_disable_overflow_interrupts() argument
1175 hdmi_writeb(hdmi, HDMI_IH_MUTE_FC_STAT2_OVERFLOW_MASK, in hdmi_disable_overflow_interrupts()
1179 static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) in dw_hdmi_setup() argument
1183 hdmi_disable_overflow_interrupts(hdmi); in dw_hdmi_setup()
1185 hdmi->vic = drm_match_cea_mode(mode); in dw_hdmi_setup()
1187 if (!hdmi->vic) { in dw_hdmi_setup()
1188 dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n"); in dw_hdmi_setup()
1189 hdmi->hdmi_data.video_mode.mdvi = true; in dw_hdmi_setup()
1191 dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic); in dw_hdmi_setup()
1192 hdmi->hdmi_data.video_mode.mdvi = false; in dw_hdmi_setup()
1195 if ((hdmi->vic == 6) || (hdmi->vic == 7) || in dw_hdmi_setup()
1196 (hdmi->vic == 21) || (hdmi->vic == 22) || in dw_hdmi_setup()
1197 (hdmi->vic == 2) || (hdmi->vic == 3) || in dw_hdmi_setup()
1198 (hdmi->vic == 17) || (hdmi->vic == 18)) in dw_hdmi_setup()
1199 hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601; in dw_hdmi_setup()
1201 hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709; in dw_hdmi_setup()
1203 if ((hdmi->vic == 10) || (hdmi->vic == 11) || in dw_hdmi_setup()
1204 (hdmi->vic == 12) || (hdmi->vic == 13) || in dw_hdmi_setup()
1205 (hdmi->vic == 14) || (hdmi->vic == 15) || in dw_hdmi_setup()
1206 (hdmi->vic == 25) || (hdmi->vic == 26) || in dw_hdmi_setup()
1207 (hdmi->vic == 27) || (hdmi->vic == 28) || in dw_hdmi_setup()
1208 (hdmi->vic == 29) || (hdmi->vic == 30) || in dw_hdmi_setup()
1209 (hdmi->vic == 35) || (hdmi->vic == 36) || in dw_hdmi_setup()
1210 (hdmi->vic == 37) || (hdmi->vic == 38)) in dw_hdmi_setup()
1211 hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 1; in dw_hdmi_setup()
1213 hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 0; in dw_hdmi_setup()
1215 hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; in dw_hdmi_setup()
1218 hdmi->hdmi_data.enc_in_format = RGB; in dw_hdmi_setup()
1220 hdmi->hdmi_data.enc_out_format = RGB; in dw_hdmi_setup()
1222 hdmi->hdmi_data.enc_color_depth = 8; in dw_hdmi_setup()
1223 hdmi->hdmi_data.pix_repet_factor = 0; in dw_hdmi_setup()
1224 hdmi->hdmi_data.hdcp_enable = 0; in dw_hdmi_setup()
1225 hdmi->hdmi_data.video_mode.mdataenablepolarity = true; in dw_hdmi_setup()
1228 hdmi_av_composer(hdmi, mode); in dw_hdmi_setup()
1231 ret = dw_hdmi_phy_init(hdmi); in dw_hdmi_setup()
1236 dw_hdmi_enable_video_path(hdmi); in dw_hdmi_setup()
1239 if (hdmi->hdmi_data.video_mode.mdvi) { in dw_hdmi_setup()
1240 dev_dbg(hdmi->dev, "%s DVI mode\n", __func__); in dw_hdmi_setup()
1242 dev_dbg(hdmi->dev, "%s CEA mode\n", __func__); in dw_hdmi_setup()
1245 hdmi_clk_regenerator_update_pixel_clock(hdmi); in dw_hdmi_setup()
1246 hdmi_enable_audio_clk(hdmi); in dw_hdmi_setup()
1249 hdmi_config_AVI(hdmi); in dw_hdmi_setup()
1252 hdmi_video_packetize(hdmi); in dw_hdmi_setup()
1253 hdmi_video_csc(hdmi); in dw_hdmi_setup()
1254 hdmi_video_sample(hdmi); in dw_hdmi_setup()
1255 hdmi_tx_hdcp_config(hdmi); in dw_hdmi_setup()
1257 dw_hdmi_clear_overflow(hdmi); in dw_hdmi_setup()
1258 if (hdmi->cable_plugin && !hdmi->hdmi_data.video_mode.mdvi) in dw_hdmi_setup()
1259 hdmi_enable_overflow_interrupts(hdmi); in dw_hdmi_setup()
1265 static int dw_hdmi_fb_registered(struct dw_hdmi *hdmi) in dw_hdmi_fb_registered() argument
1267 hdmi_writeb(hdmi, HDMI_PHY_I2CM_INT_ADDR_DONE_POL, in dw_hdmi_fb_registered()
1270 hdmi_writeb(hdmi, HDMI_PHY_I2CM_CTLINT_ADDR_NAC_POL | in dw_hdmi_fb_registered()
1275 hdmi_writeb(hdmi, (u8)~HDMI_PHY_HPD, HDMI_PHY_MASK0); in dw_hdmi_fb_registered()
1278 hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); in dw_hdmi_fb_registered()
1283 static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) in initialize_hdmi_ih_mutes() argument
1294 ih_mute = hdmi_readb(hdmi, HDMI_IH_MUTE) | in initialize_hdmi_ih_mutes()
1298 hdmi_writeb(hdmi, ih_mute, HDMI_IH_MUTE); in initialize_hdmi_ih_mutes()
1301 hdmi_writeb(hdmi, 0xff, HDMI_VP_MASK); in initialize_hdmi_ih_mutes()
1302 hdmi_writeb(hdmi, 0xff, HDMI_FC_MASK0); in initialize_hdmi_ih_mutes()
1303 hdmi_writeb(hdmi, 0xff, HDMI_FC_MASK1); in initialize_hdmi_ih_mutes()
1304 hdmi_writeb(hdmi, 0xff, HDMI_FC_MASK2); in initialize_hdmi_ih_mutes()
1305 hdmi_writeb(hdmi, 0xff, HDMI_PHY_MASK0); in initialize_hdmi_ih_mutes()
1306 hdmi_writeb(hdmi, 0xff, HDMI_PHY_I2CM_INT_ADDR); in initialize_hdmi_ih_mutes()
1307 hdmi_writeb(hdmi, 0xff, HDMI_PHY_I2CM_CTLINT_ADDR); in initialize_hdmi_ih_mutes()
1308 hdmi_writeb(hdmi, 0xff, HDMI_AUD_INT); in initialize_hdmi_ih_mutes()
1309 hdmi_writeb(hdmi, 0xff, HDMI_AUD_SPDIFINT); in initialize_hdmi_ih_mutes()
1310 hdmi_writeb(hdmi, 0xff, HDMI_AUD_HBR_MASK); in initialize_hdmi_ih_mutes()
1311 hdmi_writeb(hdmi, 0xff, HDMI_GP_MASK); in initialize_hdmi_ih_mutes()
1312 hdmi_writeb(hdmi, 0xff, HDMI_A_APIINTMSK); in initialize_hdmi_ih_mutes()
1313 hdmi_writeb(hdmi, 0xff, HDMI_CEC_MASK); in initialize_hdmi_ih_mutes()
1314 hdmi_writeb(hdmi, 0xff, HDMI_I2CM_INT); in initialize_hdmi_ih_mutes()
1315 hdmi_writeb(hdmi, 0xff, HDMI_I2CM_CTLINT); in initialize_hdmi_ih_mutes()
1318 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_FC_STAT0); in initialize_hdmi_ih_mutes()
1319 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_FC_STAT1); in initialize_hdmi_ih_mutes()
1320 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_FC_STAT2); in initialize_hdmi_ih_mutes()
1321 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_AS_STAT0); in initialize_hdmi_ih_mutes()
1322 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_PHY_STAT0); in initialize_hdmi_ih_mutes()
1323 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_I2CM_STAT0); in initialize_hdmi_ih_mutes()
1324 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_CEC_STAT0); in initialize_hdmi_ih_mutes()
1325 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_VP_STAT0); in initialize_hdmi_ih_mutes()
1326 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_I2CMPHY_STAT0); in initialize_hdmi_ih_mutes()
1327 hdmi_writeb(hdmi, 0xff, HDMI_IH_MUTE_AHBDMAAUD_STAT0); in initialize_hdmi_ih_mutes()
1332 hdmi_writeb(hdmi, ih_mute, HDMI_IH_MUTE); in initialize_hdmi_ih_mutes()
1335 static void dw_hdmi_poweron(struct dw_hdmi *hdmi) in dw_hdmi_poweron() argument
1337 dw_hdmi_setup(hdmi, &hdmi->previous_mode); in dw_hdmi_poweron()
1340 static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) in dw_hdmi_poweroff() argument
1342 dw_hdmi_phy_disable(hdmi); in dw_hdmi_poweroff()
1349 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_mode_set() local
1351 dw_hdmi_setup(hdmi, mode); in dw_hdmi_bridge_mode_set()
1354 memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode)); in dw_hdmi_bridge_mode_set()
1366 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_disable() local
1368 dw_hdmi_poweroff(hdmi); in dw_hdmi_bridge_disable()
1373 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_enable() local
1375 dw_hdmi_poweron(hdmi); in dw_hdmi_bridge_enable()
1386 struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, in dw_hdmi_connector_detect() local
1389 return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ? in dw_hdmi_connector_detect()
1395 struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, in dw_hdmi_connector_get_modes() local
1400 if (!hdmi->ddc) in dw_hdmi_connector_get_modes()
1403 edid = drm_get_edid(connector, hdmi->ddc); in dw_hdmi_connector_get_modes()
1405 dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", in dw_hdmi_connector_get_modes()
1412 dev_dbg(hdmi->dev, "failed to get edid\n"); in dw_hdmi_connector_get_modes()
1422 struct dw_hdmi *hdmi = container_of(connector, in dw_hdmi_connector_mode_valid() local
1426 if (hdmi->plat_data->mode_valid) in dw_hdmi_connector_mode_valid()
1427 mode_status = hdmi->plat_data->mode_valid(connector, mode); in dw_hdmi_connector_mode_valid()
1435 struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, in dw_hdmi_connector_best_encoder() local
1438 return hdmi->encoder; in dw_hdmi_connector_best_encoder()
1471 struct dw_hdmi *hdmi = dev_id; in dw_hdmi_hardirq() local
1474 intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); in dw_hdmi_hardirq()
1476 hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); in dw_hdmi_hardirq()
1483 struct dw_hdmi *hdmi = dev_id; in dw_hdmi_irq() local
1487 intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); in dw_hdmi_irq()
1489 phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0); in dw_hdmi_irq()
1493 dev_dbg(hdmi->dev, "EVENT=plugin\n"); in dw_hdmi_irq()
1495 hdmi_modb(hdmi, 0, HDMI_PHY_HPD, HDMI_PHY_POL0); in dw_hdmi_irq()
1497 dw_hdmi_poweron(hdmi); in dw_hdmi_irq()
1499 dev_dbg(hdmi->dev, "EVENT=plugout\n"); in dw_hdmi_irq()
1501 hdmi_modb(hdmi, HDMI_PHY_HPD, HDMI_PHY_HPD, in dw_hdmi_irq()
1504 dw_hdmi_poweroff(hdmi); in dw_hdmi_irq()
1506 drm_helper_hpd_irq_event(hdmi->connector.dev); in dw_hdmi_irq()
1509 hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); in dw_hdmi_irq()
1510 hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); in dw_hdmi_irq()
1515 static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi) in dw_hdmi_register() argument
1517 struct drm_encoder *encoder = hdmi->encoder; in dw_hdmi_register()
1527 hdmi->bridge = bridge; in dw_hdmi_register()
1528 bridge->driver_private = hdmi; in dw_hdmi_register()
1537 hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; in dw_hdmi_register()
1539 drm_connector_helper_add(&hdmi->connector, in dw_hdmi_register()
1541 drm_connector_init(drm, &hdmi->connector, &dw_hdmi_connector_funcs, in dw_hdmi_register()
1544 hdmi->connector.encoder = encoder; in dw_hdmi_register()
1546 drm_mode_connector_attach_encoder(&hdmi->connector, encoder); in dw_hdmi_register()
1559 struct dw_hdmi *hdmi; in dw_hdmi_bind() local
1563 hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); in dw_hdmi_bind()
1564 if (!hdmi) in dw_hdmi_bind()
1567 hdmi->plat_data = plat_data; in dw_hdmi_bind()
1568 hdmi->dev = dev; in dw_hdmi_bind()
1569 hdmi->dev_type = plat_data->dev_type; in dw_hdmi_bind()
1570 hdmi->sample_rate = 48000; in dw_hdmi_bind()
1571 hdmi->ratio = 100; in dw_hdmi_bind()
1572 hdmi->encoder = encoder; in dw_hdmi_bind()
1574 mutex_init(&hdmi->audio_mutex); in dw_hdmi_bind()
1580 hdmi->write = dw_hdmi_writel; in dw_hdmi_bind()
1581 hdmi->read = dw_hdmi_readl; in dw_hdmi_bind()
1584 hdmi->write = dw_hdmi_writeb; in dw_hdmi_bind()
1585 hdmi->read = dw_hdmi_readb; in dw_hdmi_bind()
1594 hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node); in dw_hdmi_bind()
1596 if (!hdmi->ddc) { in dw_hdmi_bind()
1597 dev_dbg(hdmi->dev, "failed to read ddc node\n"); in dw_hdmi_bind()
1602 dev_dbg(hdmi->dev, "no ddc property found\n"); in dw_hdmi_bind()
1605 hdmi->regs = devm_ioremap_resource(dev, iores); in dw_hdmi_bind()
1606 if (IS_ERR(hdmi->regs)) in dw_hdmi_bind()
1607 return PTR_ERR(hdmi->regs); in dw_hdmi_bind()
1609 hdmi->isfr_clk = devm_clk_get(hdmi->dev, "isfr"); in dw_hdmi_bind()
1610 if (IS_ERR(hdmi->isfr_clk)) { in dw_hdmi_bind()
1611 ret = PTR_ERR(hdmi->isfr_clk); in dw_hdmi_bind()
1612 dev_err(hdmi->dev, "Unable to get HDMI isfr clk: %d\n", ret); in dw_hdmi_bind()
1616 ret = clk_prepare_enable(hdmi->isfr_clk); in dw_hdmi_bind()
1618 dev_err(hdmi->dev, "Cannot enable HDMI isfr clock: %d\n", ret); in dw_hdmi_bind()
1622 hdmi->iahb_clk = devm_clk_get(hdmi->dev, "iahb"); in dw_hdmi_bind()
1623 if (IS_ERR(hdmi->iahb_clk)) { in dw_hdmi_bind()
1624 ret = PTR_ERR(hdmi->iahb_clk); in dw_hdmi_bind()
1625 dev_err(hdmi->dev, "Unable to get HDMI iahb clk: %d\n", ret); in dw_hdmi_bind()
1629 ret = clk_prepare_enable(hdmi->iahb_clk); in dw_hdmi_bind()
1631 dev_err(hdmi->dev, "Cannot enable HDMI iahb clock: %d\n", ret); in dw_hdmi_bind()
1638 hdmi_readb(hdmi, HDMI_DESIGN_ID), in dw_hdmi_bind()
1639 hdmi_readb(hdmi, HDMI_REVISION_ID), in dw_hdmi_bind()
1640 hdmi_readb(hdmi, HDMI_PRODUCT_ID0), in dw_hdmi_bind()
1641 hdmi_readb(hdmi, HDMI_PRODUCT_ID1)); in dw_hdmi_bind()
1643 initialize_hdmi_ih_mutes(hdmi); in dw_hdmi_bind()
1647 dev_name(dev), hdmi); in dw_hdmi_bind()
1655 hdmi_init_clk_regenerator(hdmi); in dw_hdmi_bind()
1661 hdmi_writeb(hdmi, HDMI_PHY_HPD, HDMI_PHY_POL0); in dw_hdmi_bind()
1664 hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); in dw_hdmi_bind()
1666 ret = dw_hdmi_fb_registered(hdmi); in dw_hdmi_bind()
1670 ret = dw_hdmi_register(drm, hdmi); in dw_hdmi_bind()
1675 hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); in dw_hdmi_bind()
1677 dev_set_drvdata(dev, hdmi); in dw_hdmi_bind()
1682 clk_disable_unprepare(hdmi->iahb_clk); in dw_hdmi_bind()
1684 clk_disable_unprepare(hdmi->isfr_clk); in dw_hdmi_bind()
1692 struct dw_hdmi *hdmi = dev_get_drvdata(dev); in dw_hdmi_unbind() local
1695 hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); in dw_hdmi_unbind()
1697 hdmi->connector.funcs->destroy(&hdmi->connector); in dw_hdmi_unbind()
1698 hdmi->encoder->funcs->destroy(hdmi->encoder); in dw_hdmi_unbind()
1700 clk_disable_unprepare(hdmi->iahb_clk); in dw_hdmi_unbind()
1701 clk_disable_unprepare(hdmi->isfr_clk); in dw_hdmi_unbind()
1702 i2c_put_adapter(hdmi->ddc); in dw_hdmi_unbind()