Lines Matching +full:ddc +full:- +full:i2c +full:- +full:bus

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * DesignWare High-Definition Multimedia Interface (HDMI) driver
5 * Copyright (C) 2013-2015 Mentor Graphics Inc.
6 * Copyright (C) 2011-2013 Freescale Semiconductor, Inc.
19 #include <linux/dma-mapping.h>
22 #include <media/cec-notifier.h>
24 #include <uapi/linux/media-bus-format.h>
35 #include "dw-hdmi-audio.h"
36 #include "dw-hdmi-cec.h"
37 #include "dw-hdmi.h"
43 /* DW-HDMI Controller >= 0x200a are at least compliant with SCDC version 1 */
145 struct dw_hdmi_i2c *i2c; member
163 struct i2c_adapter *ddc; member
173 enum drm_connector_force force; /* mutex-protected force state */
206 regmap_write(hdmi->regm, offset << hdmi->reg_shift, val); in hdmi_writeb()
213 regmap_read(hdmi->regm, offset << hdmi->reg_shift, &val); in hdmi_readb()
220 regmap_update_bits(hdmi->regm, reg << hdmi->reg_shift, mask, data); in hdmi_modb()
261 if (!hdmi->unwedge_state) in dw_hdmi_i2c_unwedge()
264 dev_info(hdmi->dev, "Attempting to unwedge stuck i2c bus\n"); in dw_hdmi_i2c_unwedge()
267 * This is a huge hack to workaround a problem where the dw_hdmi i2c in dw_hdmi_i2c_unwedge()
268 * bus could sometimes get wedged. Once wedged there doesn't appear in dw_hdmi_i2c_unwedge()
276 * 3. Immediately jump to remux the pin as dw_hdmi i2c again. in dw_hdmi_i2c_unwedge()
288 * no real STOP (maybe it thinks there's another master on the bus?). in dw_hdmi_i2c_unwedge()
298 pinctrl_select_state(hdmi->pinctrl, hdmi->unwedge_state); in dw_hdmi_i2c_unwedge()
300 pinctrl_select_state(hdmi->pinctrl, hdmi->default_state); in dw_hdmi_i2c_unwedge()
307 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_wait() local
310 stat = wait_for_completion_timeout(&i2c->cmp, HZ / 10); in dw_hdmi_i2c_wait()
314 return -EAGAIN; in dw_hdmi_i2c_wait()
317 stat = wait_for_completion_timeout(&i2c->cmp, HZ / 10); in dw_hdmi_i2c_wait()
319 return -EAGAIN; in dw_hdmi_i2c_wait()
322 /* Check for error condition on the bus */ in dw_hdmi_i2c_wait()
323 if (i2c->stat & HDMI_IH_I2CM_STAT0_ERROR) in dw_hdmi_i2c_wait()
324 return -EIO; in dw_hdmi_i2c_wait()
332 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_read() local
335 if (!i2c->is_regaddr) { in dw_hdmi_i2c_read()
336 dev_dbg(hdmi->dev, "set read register address to 0\n"); in dw_hdmi_i2c_read()
337 i2c->slave_reg = 0x00; in dw_hdmi_i2c_read()
338 i2c->is_regaddr = true; in dw_hdmi_i2c_read()
341 while (length--) { in dw_hdmi_i2c_read()
342 reinit_completion(&i2c->cmp); in dw_hdmi_i2c_read()
344 hdmi_writeb(hdmi, i2c->slave_reg++, HDMI_I2CM_ADDRESS); in dw_hdmi_i2c_read()
345 if (i2c->is_segment) in dw_hdmi_i2c_read()
358 i2c->is_segment = false; in dw_hdmi_i2c_read()
366 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_write() local
369 if (!i2c->is_regaddr) { in dw_hdmi_i2c_write()
371 i2c->slave_reg = buf[0]; in dw_hdmi_i2c_write()
372 length--; in dw_hdmi_i2c_write()
374 i2c->is_regaddr = true; in dw_hdmi_i2c_write()
377 while (length--) { in dw_hdmi_i2c_write()
378 reinit_completion(&i2c->cmp); in dw_hdmi_i2c_write()
381 hdmi_writeb(hdmi, i2c->slave_reg++, HDMI_I2CM_ADDRESS); in dw_hdmi_i2c_write()
397 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_xfer() local
401 dev_dbg(hdmi->dev, "xfer: num: %d, addr: %#x\n", num, addr); in dw_hdmi_i2c_xfer()
405 dev_dbg(hdmi->dev, in dw_hdmi_i2c_xfer()
408 return -EOPNOTSUPP; in dw_hdmi_i2c_xfer()
412 mutex_lock(&i2c->lock); in dw_hdmi_i2c_xfer()
417 /* Set slave device address taken from the first I2C message */ in dw_hdmi_i2c_xfer()
421 i2c->is_regaddr = false; in dw_hdmi_i2c_xfer()
423 /* Set segment pointer for I2C extended read mode operation */ in dw_hdmi_i2c_xfer()
424 i2c->is_segment = false; in dw_hdmi_i2c_xfer()
427 dev_dbg(hdmi->dev, "xfer: num: %d/%d, len: %d, flags: %#x\n", in dw_hdmi_i2c_xfer()
430 i2c->is_segment = true; in dw_hdmi_i2c_xfer()
452 mutex_unlock(&i2c->lock); in dw_hdmi_i2c_xfer()
470 struct dw_hdmi_i2c *i2c; in dw_hdmi_i2c_adapter() local
473 i2c = devm_kzalloc(hdmi->dev, sizeof(*i2c), GFP_KERNEL); in dw_hdmi_i2c_adapter()
474 if (!i2c) in dw_hdmi_i2c_adapter()
475 return ERR_PTR(-ENOMEM); in dw_hdmi_i2c_adapter()
477 mutex_init(&i2c->lock); in dw_hdmi_i2c_adapter()
478 init_completion(&i2c->cmp); in dw_hdmi_i2c_adapter()
480 adap = &i2c->adap; in dw_hdmi_i2c_adapter()
481 adap->class = I2C_CLASS_DDC; in dw_hdmi_i2c_adapter()
482 adap->owner = THIS_MODULE; in dw_hdmi_i2c_adapter()
483 adap->dev.parent = hdmi->dev; in dw_hdmi_i2c_adapter()
484 adap->algo = &dw_hdmi_algorithm; in dw_hdmi_i2c_adapter()
485 strlcpy(adap->name, "DesignWare HDMI", sizeof(adap->name)); in dw_hdmi_i2c_adapter()
490 dev_warn(hdmi->dev, "cannot add %s I2C adapter\n", adap->name); in dw_hdmi_i2c_adapter()
491 devm_kfree(hdmi->dev, i2c); in dw_hdmi_i2c_adapter()
495 hdmi->i2c = i2c; in dw_hdmi_i2c_adapter()
497 dev_info(hdmi->dev, "registered %s I2C bus driver\n", adap->name); in dw_hdmi_i2c_adapter()
599 * can be up to 20 bits in total, so we need 64-bit math. Also in hdmi_set_clk_regenerator()
608 dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n", in hdmi_set_clk_regenerator()
616 spin_lock_irq(&hdmi->audio_lock); in hdmi_set_clk_regenerator()
617 hdmi->audio_n = n; in hdmi_set_clk_regenerator()
618 hdmi->audio_cts = cts; in hdmi_set_clk_regenerator()
619 hdmi_set_cts_n(hdmi, cts, hdmi->audio_enable ? n : 0); in hdmi_set_clk_regenerator()
620 spin_unlock_irq(&hdmi->audio_lock); in hdmi_set_clk_regenerator()
625 mutex_lock(&hdmi->audio_mutex); in hdmi_init_clk_regenerator()
626 hdmi_set_clk_regenerator(hdmi, 74250000, hdmi->sample_rate); in hdmi_init_clk_regenerator()
627 mutex_unlock(&hdmi->audio_mutex); in hdmi_init_clk_regenerator()
632 mutex_lock(&hdmi->audio_mutex); in hdmi_clk_regenerator_update_pixel_clock()
633 hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mtmdsclock, in hdmi_clk_regenerator_update_pixel_clock()
634 hdmi->sample_rate); in hdmi_clk_regenerator_update_pixel_clock()
635 mutex_unlock(&hdmi->audio_mutex); in hdmi_clk_regenerator_update_pixel_clock()
640 mutex_lock(&hdmi->audio_mutex); in dw_hdmi_set_sample_rate()
641 hdmi->sample_rate = rate; in dw_hdmi_set_sample_rate()
642 hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mtmdsclock, in dw_hdmi_set_sample_rate()
643 hdmi->sample_rate); in dw_hdmi_set_sample_rate()
644 mutex_unlock(&hdmi->audio_mutex); in dw_hdmi_set_sample_rate()
652 mutex_lock(&hdmi->audio_mutex); in dw_hdmi_set_channel_count()
667 hdmi_modb(hdmi, (cnt - 1) << HDMI_FC_AUDICONF0_CC_OFFSET, in dw_hdmi_set_channel_count()
670 mutex_unlock(&hdmi->audio_mutex); in dw_hdmi_set_channel_count()
676 mutex_lock(&hdmi->audio_mutex); in dw_hdmi_set_channel_allocation()
680 mutex_unlock(&hdmi->audio_mutex); in dw_hdmi_set_channel_allocation()
687 hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE; in hdmi_enable_audio_clk()
689 hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE; in hdmi_enable_audio_clk()
690 hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); in hdmi_enable_audio_clk()
695 hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); in dw_hdmi_ahb_audio_enable()
700 hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0); in dw_hdmi_ahb_audio_disable()
705 hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); in dw_hdmi_i2s_audio_enable()
718 spin_lock_irqsave(&hdmi->audio_lock, flags); in dw_hdmi_audio_enable()
719 hdmi->audio_enable = true; in dw_hdmi_audio_enable()
720 if (hdmi->enable_audio) in dw_hdmi_audio_enable()
721 hdmi->enable_audio(hdmi); in dw_hdmi_audio_enable()
722 spin_unlock_irqrestore(&hdmi->audio_lock, flags); in dw_hdmi_audio_enable()
730 spin_lock_irqsave(&hdmi->audio_lock, flags); in dw_hdmi_audio_disable()
731 hdmi->audio_enable = false; in dw_hdmi_audio_disable()
732 if (hdmi->disable_audio) in dw_hdmi_audio_disable()
733 hdmi->disable_audio(hdmi); in dw_hdmi_audio_disable()
734 spin_unlock_irqrestore(&hdmi->audio_lock, flags); in dw_hdmi_audio_disable()
836 switch (hdmi->hdmi_data.enc_in_bus_format) { in hdmi_video_sample()
901 return hdmi->hdmi_data.enc_in_bus_format != hdmi->hdmi_data.enc_out_bus_format; in is_color_space_conversion()
906 if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) in is_color_space_decimation()
909 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format) || in is_color_space_decimation()
910 hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_in_bus_format)) in is_color_space_decimation()
918 if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_in_bus_format)) in is_color_space_interpolation()
921 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) || in is_color_space_interpolation()
922 hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)) in is_color_space_interpolation()
935 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { in dw_hdmi_update_csc_coeffs()
936 if (hdmi->hdmi_data.enc_out_encoding == in dw_hdmi_update_csc_coeffs()
942 hdmi->hdmi_data.enc_in_bus_format)) { in dw_hdmi_update_csc_coeffs()
943 if (hdmi->hdmi_data.enc_out_encoding == in dw_hdmi_update_csc_coeffs()
982 switch (hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_csc()
1018 struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data; in hdmi_video_packetize()
1021 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) || in hdmi_video_packetize()
1022 hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format) || in hdmi_video_packetize()
1023 hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1025 hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1042 } else if (hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1044 hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_video_packetize()
1067 ((hdmi_data->pix_repet_factor << in hdmi_video_packetize()
1076 if (hdmi_data->pix_repet_factor > 1) { in hdmi_video_packetize()
1122 /* -----------------------------------------------------------------------------
1138 if (msec-- == 0) in hdmi_phy_wait_i2c_done()
1165 struct drm_display_info *display = &hdmi->connector.display_info; in dw_hdmi_support_scdc()
1168 if (hdmi->version < 0x200a) in dw_hdmi_support_scdc()
1171 /* Disable if no DDC bus */ in dw_hdmi_support_scdc()
1172 if (!hdmi->ddc) in dw_hdmi_support_scdc()
1175 /* Disable if SCDC is not supported, or if an HF-VSDB block is absent */ in dw_hdmi_support_scdc()
1176 if (!display->hdmi.scdc.supported || in dw_hdmi_support_scdc()
1177 !display->hdmi.scdc.scrambling.supported) in dw_hdmi_support_scdc()
1184 if (!display->hdmi.scdc.scrambling.low_rates && in dw_hdmi_support_scdc()
1185 display->max_tmds_clock <= 340000) in dw_hdmi_support_scdc()
1193 * - The Source shall suspend transmission of the TMDS clock and data
1194 * - The Source shall write to the TMDS_Bit_Clock_Ratio bit to change it
1196 * - The Source shall allow a minimum of 1 ms and a maximum of 100 ms from
1206 unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; in dw_hdmi_set_high_tmds_clock_ratio()
1208 /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */ in dw_hdmi_set_high_tmds_clock_ratio()
1211 drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1); in dw_hdmi_set_high_tmds_clock_ratio()
1213 drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 0); in dw_hdmi_set_high_tmds_clock_ratio()
1287 const struct dw_hdmi_phy_data *phy = hdmi->phy.data; in dw_hdmi_phy_power_off()
1291 if (phy->gen == 1) { in dw_hdmi_phy_power_off()
1312 dev_warn(hdmi->dev, "PHY failed to power down\n"); in dw_hdmi_phy_power_off()
1314 dev_dbg(hdmi->dev, "PHY powered down in %u iterations\n", i); in dw_hdmi_phy_power_off()
1321 const struct dw_hdmi_phy_data *phy = hdmi->phy.data; in dw_hdmi_phy_power_on()
1325 if (phy->gen == 1) { in dw_hdmi_phy_power_on()
1347 dev_err(hdmi->dev, "PHY PLL failed to lock\n"); in dw_hdmi_phy_power_on()
1348 return -ETIMEDOUT; in dw_hdmi_phy_power_on()
1351 dev_dbg(hdmi->dev, "PHY PLL locked %u iterations\n", i); in dw_hdmi_phy_power_on()
1364 const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg; in hdmi_phy_configure_dwc_hdmi_3d_tx()
1365 const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr; in hdmi_phy_configure_dwc_hdmi_3d_tx()
1366 const struct dw_hdmi_phy_config *phy_config = pdata->phy_config; in hdmi_phy_configure_dwc_hdmi_3d_tx()
1370 /* PLL/MPLL Cfg - always match on final entry */ in hdmi_phy_configure_dwc_hdmi_3d_tx()
1371 for (; mpll_config->mpixelclock != ~0UL; mpll_config++) in hdmi_phy_configure_dwc_hdmi_3d_tx()
1372 if (mpixelclock <= mpll_config->mpixelclock) in hdmi_phy_configure_dwc_hdmi_3d_tx()
1375 for (; curr_ctrl->mpixelclock != ~0UL; curr_ctrl++) in hdmi_phy_configure_dwc_hdmi_3d_tx()
1376 if (mpixelclock <= curr_ctrl->mpixelclock) in hdmi_phy_configure_dwc_hdmi_3d_tx()
1379 for (; phy_config->mpixelclock != ~0UL; phy_config++) in hdmi_phy_configure_dwc_hdmi_3d_tx()
1380 if (mpixelclock <= phy_config->mpixelclock) in hdmi_phy_configure_dwc_hdmi_3d_tx()
1383 if (mpll_config->mpixelclock == ~0UL || in hdmi_phy_configure_dwc_hdmi_3d_tx()
1384 curr_ctrl->mpixelclock == ~0UL || in hdmi_phy_configure_dwc_hdmi_3d_tx()
1385 phy_config->mpixelclock == ~0UL) in hdmi_phy_configure_dwc_hdmi_3d_tx()
1386 return -EINVAL; in hdmi_phy_configure_dwc_hdmi_3d_tx()
1388 dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[0].cpce, in hdmi_phy_configure_dwc_hdmi_3d_tx()
1390 dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[0].gmp, in hdmi_phy_configure_dwc_hdmi_3d_tx()
1392 dw_hdmi_phy_i2c_write(hdmi, curr_ctrl->curr[0], in hdmi_phy_configure_dwc_hdmi_3d_tx()
1399 dw_hdmi_phy_i2c_write(hdmi, phy_config->term, HDMI_3D_TX_PHY_TXTERM); in hdmi_phy_configure_dwc_hdmi_3d_tx()
1400 dw_hdmi_phy_i2c_write(hdmi, phy_config->sym_ctr, in hdmi_phy_configure_dwc_hdmi_3d_tx()
1402 dw_hdmi_phy_i2c_write(hdmi, phy_config->vlev_ctr, in hdmi_phy_configure_dwc_hdmi_3d_tx()
1414 const struct dw_hdmi_phy_data *phy = hdmi->phy.data; in hdmi_phy_configure()
1415 const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; in hdmi_phy_configure()
1416 unsigned long mpixelclock = hdmi->hdmi_data.video_mode.mpixelclock; in hdmi_phy_configure()
1417 unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; in hdmi_phy_configure()
1425 if (phy->has_svsret) in hdmi_phy_configure()
1435 if (pdata->configure_phy) in hdmi_phy_configure()
1436 ret = pdata->configure_phy(hdmi, pdata, mpixelclock); in hdmi_phy_configure()
1438 ret = phy->configure(hdmi, pdata, mpixelclock); in hdmi_phy_configure()
1440 dev_err(hdmi->dev, "PHY configuration failed (clock %lu)\n", in hdmi_phy_configure()
1486 u8 old_mask = hdmi->phy_mask; in dw_hdmi_phy_update_hpd()
1489 hdmi->phy_mask |= HDMI_PHY_RX_SENSE; in dw_hdmi_phy_update_hpd()
1491 hdmi->phy_mask &= ~HDMI_PHY_RX_SENSE; in dw_hdmi_phy_update_hpd()
1493 if (old_mask != hdmi->phy_mask) in dw_hdmi_phy_update_hpd()
1494 hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); in dw_hdmi_phy_update_hpd()
1509 hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); in dw_hdmi_phy_setup_hpd()
1527 /* -----------------------------------------------------------------------------
1535 if (hdmi->hdmi_data.video_mode.mdataenablepolarity) in hdmi_tx_hdcp_config()
1557 &hdmi->connector, mode); in hdmi_config_AVI()
1559 if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_config_AVI()
1561 else if (hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_config_AVI()
1563 else if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_config_AVI()
1569 switch (hdmi->hdmi_data.enc_out_encoding) { in hdmi_config_AVI()
1571 if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) in hdmi_config_AVI()
1579 if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) in hdmi_config_AVI()
1633 /* AVI Data Byte 5- set up input and output pixel repetition */ in hdmi_config_AVI()
1634 val = (((hdmi->hdmi_data.video_mode.mpixelrepetitioninput + 1) << in hdmi_config_AVI()
1637 ((hdmi->hdmi_data.video_mode.mpixelrepetitionoutput << in hdmi_config_AVI()
1650 /* AVI Data Bytes 6-13 */ in hdmi_config_AVI()
1669 &hdmi->connector, in hdmi_config_vendor_specific_infoframe()
1682 dev_err(hdmi->dev, "Failed to pack vendor infoframe: %zd\n", in hdmi_config_vendor_specific_infoframe()
1719 struct drm_hdmi_info *hdmi_info = &hdmi->connector.display_info.hdmi; in hdmi_av_composer()
1720 struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode; in hdmi_av_composer()
1724 vmode->mtmdsclock = vmode->mpixelclock = mode->clock * 1000; in hdmi_av_composer()
1726 dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock); in hdmi_av_composer()
1728 if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) in hdmi_av_composer()
1729 vmode->mtmdsclock /= 2; in hdmi_av_composer()
1732 inv_val = (hdmi->hdmi_data.hdcp_enable || in hdmi_av_composer()
1734 (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || in hdmi_av_composer()
1735 hdmi_info->scdc.scrambling.low_rates)) ? in hdmi_av_composer()
1739 inv_val |= mode->flags & DRM_MODE_FLAG_PVSYNC ? in hdmi_av_composer()
1743 inv_val |= mode->flags & DRM_MODE_FLAG_PHSYNC ? in hdmi_av_composer()
1747 inv_val |= (vmode->mdataenablepolarity ? in hdmi_av_composer()
1751 if (hdmi->vic == 39) in hdmi_av_composer()
1754 inv_val |= mode->flags & DRM_MODE_FLAG_INTERLACE ? in hdmi_av_composer()
1758 inv_val |= mode->flags & DRM_MODE_FLAG_INTERLACE ? in hdmi_av_composer()
1762 inv_val |= hdmi->sink_is_hdmi ? in hdmi_av_composer()
1768 hdisplay = mode->hdisplay; in hdmi_av_composer()
1769 hblank = mode->htotal - mode->hdisplay; in hdmi_av_composer()
1770 h_de_hs = mode->hsync_start - mode->hdisplay; in hdmi_av_composer()
1771 hsync_len = mode->hsync_end - mode->hsync_start; in hdmi_av_composer()
1777 if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) { in hdmi_av_composer()
1784 vdisplay = mode->vdisplay; in hdmi_av_composer()
1785 vblank = mode->vtotal - mode->vdisplay; in hdmi_av_composer()
1786 v_de_vs = mode->vsync_start - mode->vdisplay; in hdmi_av_composer()
1787 vsync_len = mode->vsync_end - mode->vsync_start; in hdmi_av_composer()
1793 if (mode->flags & DRM_MODE_FLAG_INTERLACE) { in hdmi_av_composer()
1802 if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || in hdmi_av_composer()
1803 hdmi_info->scdc.scrambling.low_rates) { in hdmi_av_composer()
1813 drm_scdc_readb(hdmi->ddc, SCDC_SINK_VERSION, in hdmi_av_composer()
1815 drm_scdc_writeb(hdmi->ddc, SCDC_SOURCE_VERSION, in hdmi_av_composer()
1819 drm_scdc_set_scrambling(hdmi->ddc, 1); in hdmi_av_composer()
1823 * that the quasi-static configuration bit in hdmi_av_composer()
1835 drm_scdc_set_scrambling(hdmi->ddc, 0); in hdmi_av_composer()
1883 hdmi->mc_clkdis |= HDMI_MC_CLKDIS_HDCPCLK_DISABLE | in dw_hdmi_enable_video_path()
1888 hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE; in dw_hdmi_enable_video_path()
1889 hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1891 hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE; in dw_hdmi_enable_video_path()
1892 hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1896 hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE; in dw_hdmi_enable_video_path()
1897 hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); in dw_hdmi_enable_video_path()
1933 switch (hdmi->version) { in dw_hdmi_clear_overflow()
1969 hdmi->vic = drm_match_cea_mode(mode); in dw_hdmi_setup()
1971 if (!hdmi->vic) { in dw_hdmi_setup()
1972 dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n"); in dw_hdmi_setup()
1974 dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic); in dw_hdmi_setup()
1977 if ((hdmi->vic == 6) || (hdmi->vic == 7) || in dw_hdmi_setup()
1978 (hdmi->vic == 21) || (hdmi->vic == 22) || in dw_hdmi_setup()
1979 (hdmi->vic == 2) || (hdmi->vic == 3) || in dw_hdmi_setup()
1980 (hdmi->vic == 17) || (hdmi->vic == 18)) in dw_hdmi_setup()
1981 hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_601; in dw_hdmi_setup()
1983 hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_709; in dw_hdmi_setup()
1985 hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 0; in dw_hdmi_setup()
1986 hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; in dw_hdmi_setup()
1989 if (hdmi->plat_data->input_bus_format) in dw_hdmi_setup()
1990 hdmi->hdmi_data.enc_in_bus_format = in dw_hdmi_setup()
1991 hdmi->plat_data->input_bus_format; in dw_hdmi_setup()
1993 hdmi->hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_RGB888_1X24; in dw_hdmi_setup()
1996 if (hdmi->plat_data->input_bus_encoding) in dw_hdmi_setup()
1997 hdmi->hdmi_data.enc_in_encoding = in dw_hdmi_setup()
1998 hdmi->plat_data->input_bus_encoding; in dw_hdmi_setup()
2000 hdmi->hdmi_data.enc_in_encoding = V4L2_YCBCR_ENC_DEFAULT; in dw_hdmi_setup()
2003 hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; in dw_hdmi_setup()
2005 hdmi->hdmi_data.pix_repet_factor = 0; in dw_hdmi_setup()
2006 hdmi->hdmi_data.hdcp_enable = 0; in dw_hdmi_setup()
2007 hdmi->hdmi_data.video_mode.mdataenablepolarity = true; in dw_hdmi_setup()
2013 ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, &hdmi->previous_mode); in dw_hdmi_setup()
2016 hdmi->phy.enabled = true; in dw_hdmi_setup()
2021 if (hdmi->sink_has_audio) { in dw_hdmi_setup()
2022 dev_dbg(hdmi->dev, "sink has audio support\n"); in dw_hdmi_setup()
2024 /* HDMI Initialization Step E - Configure audio */ in dw_hdmi_setup()
2030 if (hdmi->sink_is_hdmi) { in dw_hdmi_setup()
2031 dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); in dw_hdmi_setup()
2033 /* HDMI Initialization Step F - Configure AVI InfoFrame */ in dw_hdmi_setup()
2037 dev_dbg(hdmi->dev, "%s DVI mode\n", __func__); in dw_hdmi_setup()
2103 hdmi->bridge_is_on = true; in dw_hdmi_poweron()
2104 dw_hdmi_setup(hdmi, &hdmi->previous_mode); in dw_hdmi_poweron()
2109 if (hdmi->phy.enabled) { in dw_hdmi_poweroff()
2110 hdmi->phy.ops->disable(hdmi, hdmi->phy.data); in dw_hdmi_poweroff()
2111 hdmi->phy.enabled = false; in dw_hdmi_poweroff()
2114 hdmi->bridge_is_on = false; in dw_hdmi_poweroff()
2119 int force = hdmi->force; in dw_hdmi_update_power()
2121 if (hdmi->disabled) { in dw_hdmi_update_power()
2124 if (hdmi->rxsense) in dw_hdmi_update_power()
2131 if (hdmi->bridge_is_on) in dw_hdmi_update_power()
2134 if (!hdmi->bridge_is_on) in dw_hdmi_update_power()
2153 if (hdmi->phy.ops->update_hpd) in dw_hdmi_update_phy_mask()
2154 hdmi->phy.ops->update_hpd(hdmi, hdmi->phy.data, in dw_hdmi_update_phy_mask()
2155 hdmi->force, hdmi->disabled, in dw_hdmi_update_phy_mask()
2156 hdmi->rxsense); in dw_hdmi_update_phy_mask()
2165 mutex_lock(&hdmi->mutex); in dw_hdmi_connector_detect()
2166 hdmi->force = DRM_FORCE_UNSPECIFIED; in dw_hdmi_connector_detect()
2169 mutex_unlock(&hdmi->mutex); in dw_hdmi_connector_detect()
2171 return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); in dw_hdmi_connector_detect()
2181 if (!hdmi->ddc) in dw_hdmi_connector_get_modes()
2184 edid = drm_get_edid(connector, hdmi->ddc); in dw_hdmi_connector_get_modes()
2186 dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", in dw_hdmi_connector_get_modes()
2187 edid->width_cm, edid->height_cm); in dw_hdmi_connector_get_modes()
2189 hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); in dw_hdmi_connector_get_modes()
2190 hdmi->sink_has_audio = drm_detect_monitor_audio(edid); in dw_hdmi_connector_get_modes()
2192 cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); in dw_hdmi_connector_get_modes()
2196 dev_dbg(hdmi->dev, "failed to get edid\n"); in dw_hdmi_connector_get_modes()
2207 mutex_lock(&hdmi->mutex); in dw_hdmi_connector_force()
2208 hdmi->force = connector->force; in dw_hdmi_connector_force()
2211 mutex_unlock(&hdmi->mutex); in dw_hdmi_connector_force()
2230 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_attach()
2231 struct drm_encoder *encoder = bridge->encoder; in dw_hdmi_bridge_attach()
2232 struct drm_connector *connector = &hdmi->connector; in dw_hdmi_bridge_attach()
2236 connector->interlace_allowed = 1; in dw_hdmi_bridge_attach()
2237 connector->polled = DRM_CONNECTOR_POLL_HPD; in dw_hdmi_bridge_attach()
2241 drm_connector_init_with_ddc(bridge->dev, connector, in dw_hdmi_bridge_attach()
2244 hdmi->ddc); in dw_hdmi_bridge_attach()
2250 notifier = cec_notifier_conn_register(hdmi->dev, NULL, &conn_info); in dw_hdmi_bridge_attach()
2252 return -ENOMEM; in dw_hdmi_bridge_attach()
2254 mutex_lock(&hdmi->cec_notifier_mutex); in dw_hdmi_bridge_attach()
2255 hdmi->cec_notifier = notifier; in dw_hdmi_bridge_attach()
2256 mutex_unlock(&hdmi->cec_notifier_mutex); in dw_hdmi_bridge_attach()
2263 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_detach()
2265 mutex_lock(&hdmi->cec_notifier_mutex); in dw_hdmi_bridge_detach()
2266 cec_notifier_conn_unregister(hdmi->cec_notifier); in dw_hdmi_bridge_detach()
2267 hdmi->cec_notifier = NULL; in dw_hdmi_bridge_detach()
2268 mutex_unlock(&hdmi->cec_notifier_mutex); in dw_hdmi_bridge_detach()
2275 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_mode_valid()
2276 struct drm_connector *connector = &hdmi->connector; in dw_hdmi_bridge_mode_valid()
2279 /* We don't support double-clocked modes */ in dw_hdmi_bridge_mode_valid()
2280 if (mode->flags & DRM_MODE_FLAG_DBLCLK) in dw_hdmi_bridge_mode_valid()
2283 if (hdmi->plat_data->mode_valid) in dw_hdmi_bridge_mode_valid()
2284 mode_status = hdmi->plat_data->mode_valid(connector, mode); in dw_hdmi_bridge_mode_valid()
2293 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_mode_set()
2295 mutex_lock(&hdmi->mutex); in dw_hdmi_bridge_mode_set()
2298 memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode)); in dw_hdmi_bridge_mode_set()
2300 mutex_unlock(&hdmi->mutex); in dw_hdmi_bridge_mode_set()
2305 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_disable()
2307 mutex_lock(&hdmi->mutex); in dw_hdmi_bridge_disable()
2308 hdmi->disabled = true; in dw_hdmi_bridge_disable()
2311 mutex_unlock(&hdmi->mutex); in dw_hdmi_bridge_disable()
2316 struct dw_hdmi *hdmi = bridge->driver_private; in dw_hdmi_bridge_enable()
2318 mutex_lock(&hdmi->mutex); in dw_hdmi_bridge_enable()
2319 hdmi->disabled = false; in dw_hdmi_bridge_enable()
2322 mutex_unlock(&hdmi->mutex); in dw_hdmi_bridge_enable()
2336 struct dw_hdmi_i2c *i2c = hdmi->i2c; in dw_hdmi_i2c_irq() local
2345 i2c->stat = stat; in dw_hdmi_i2c_irq()
2347 complete(&i2c->cmp); in dw_hdmi_i2c_irq()
2358 if (hdmi->i2c) in dw_hdmi_hardirq()
2372 mutex_lock(&hdmi->mutex); in dw_hdmi_setup_rx_sense()
2374 if (!hdmi->force) { in dw_hdmi_setup_rx_sense()
2380 hdmi->rxsense = false; in dw_hdmi_setup_rx_sense()
2389 hdmi->rxsense = true; in dw_hdmi_setup_rx_sense()
2394 mutex_unlock(&hdmi->mutex); in dw_hdmi_setup_rx_sense()
2424 * load - in other words, there's something listening on the in dw_hdmi_irq()
2427 * ask the source to re-read the EDID. in dw_hdmi_irq()
2436 mutex_lock(&hdmi->cec_notifier_mutex); in dw_hdmi_irq()
2437 cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); in dw_hdmi_irq()
2438 mutex_unlock(&hdmi->cec_notifier_mutex); in dw_hdmi_irq()
2443 dev_dbg(hdmi->dev, "EVENT=%s\n", in dw_hdmi_irq()
2445 if (hdmi->bridge.dev) in dw_hdmi_irq()
2446 drm_helper_hpd_irq_event(hdmi->bridge.dev); in dw_hdmi_irq()
2500 phy_type = hdmi->plat_data->phy_force_vendor ? in dw_hdmi_detect_phy()
2506 if (!hdmi->plat_data->phy_ops || !hdmi->plat_data->phy_name) { in dw_hdmi_detect_phy()
2507 dev_err(hdmi->dev, in dw_hdmi_detect_phy()
2509 return -ENODEV; in dw_hdmi_detect_phy()
2512 hdmi->phy.ops = hdmi->plat_data->phy_ops; in dw_hdmi_detect_phy()
2513 hdmi->phy.data = hdmi->plat_data->phy_data; in dw_hdmi_detect_phy()
2514 hdmi->phy.name = hdmi->plat_data->phy_name; in dw_hdmi_detect_phy()
2521 hdmi->phy.ops = &dw_hdmi_synopsys_phy_ops; in dw_hdmi_detect_phy()
2522 hdmi->phy.name = dw_hdmi_phys[i].name; in dw_hdmi_detect_phy()
2523 hdmi->phy.data = (void *)&dw_hdmi_phys[i]; in dw_hdmi_detect_phy()
2526 !hdmi->plat_data->configure_phy) { in dw_hdmi_detect_phy()
2527 dev_err(hdmi->dev, "%s requires platform support\n", in dw_hdmi_detect_phy()
2528 hdmi->phy.name); in dw_hdmi_detect_phy()
2529 return -ENODEV; in dw_hdmi_detect_phy()
2536 dev_err(hdmi->dev, "Unsupported HDMI PHY type (%02x)\n", phy_type); in dw_hdmi_detect_phy()
2537 return -ENODEV; in dw_hdmi_detect_phy()
2542 mutex_lock(&hdmi->mutex); in dw_hdmi_cec_enable()
2543 hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CECCLK_DISABLE; in dw_hdmi_cec_enable()
2544 hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); in dw_hdmi_cec_enable()
2545 mutex_unlock(&hdmi->mutex); in dw_hdmi_cec_enable()
2550 mutex_lock(&hdmi->mutex); in dw_hdmi_cec_disable()
2551 hdmi->mc_clkdis |= HDMI_MC_CLKDIS_CECCLK_DISABLE; in dw_hdmi_cec_disable()
2552 hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); in dw_hdmi_cec_disable()
2553 mutex_unlock(&hdmi->mutex); in dw_hdmi_cec_disable()
2582 * Reset HDMI DDC I2C master controller and mute I2CM interrupts. in dw_hdmi_init_hw()
2583 * Even if we are using a separate i2c adapter doing this doesn't in dw_hdmi_init_hw()
2588 if (hdmi->phy.ops->setup_hpd) in dw_hdmi_init_hw()
2589 hdmi->phy.ops->setup_hpd(hdmi, hdmi->phy.data); in dw_hdmi_init_hw()
2596 struct device *dev = &pdev->dev; in __dw_hdmi_probe()
2597 struct device_node *np = dev->of_node; in __dw_hdmi_probe()
2613 return ERR_PTR(-ENOMEM); in __dw_hdmi_probe()
2615 hdmi->plat_data = plat_data; in __dw_hdmi_probe()
2616 hdmi->dev = dev; in __dw_hdmi_probe()
2617 hdmi->sample_rate = 48000; in __dw_hdmi_probe()
2618 hdmi->disabled = true; in __dw_hdmi_probe()
2619 hdmi->rxsense = true; in __dw_hdmi_probe()
2620 hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); in __dw_hdmi_probe()
2621 hdmi->mc_clkdis = 0x7f; in __dw_hdmi_probe()
2623 mutex_init(&hdmi->mutex); in __dw_hdmi_probe()
2624 mutex_init(&hdmi->audio_mutex); in __dw_hdmi_probe()
2625 mutex_init(&hdmi->cec_notifier_mutex); in __dw_hdmi_probe()
2626 spin_lock_init(&hdmi->audio_lock); in __dw_hdmi_probe()
2628 ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0); in __dw_hdmi_probe()
2630 hdmi->ddc = of_get_i2c_adapter_by_node(ddc_node); in __dw_hdmi_probe()
2632 if (!hdmi->ddc) { in __dw_hdmi_probe()
2633 dev_dbg(hdmi->dev, "failed to read ddc node\n"); in __dw_hdmi_probe()
2634 return ERR_PTR(-EPROBE_DEFER); in __dw_hdmi_probe()
2638 dev_dbg(hdmi->dev, "no ddc property found\n"); in __dw_hdmi_probe()
2641 if (!plat_data->regm) { in __dw_hdmi_probe()
2644 of_property_read_u32(np, "reg-io-width", &val); in __dw_hdmi_probe()
2648 hdmi->reg_shift = 2; in __dw_hdmi_probe()
2654 dev_err(dev, "reg-io-width must be 1 or 4\n"); in __dw_hdmi_probe()
2655 return ERR_PTR(-EINVAL); in __dw_hdmi_probe()
2659 hdmi->regs = devm_ioremap_resource(dev, iores); in __dw_hdmi_probe()
2660 if (IS_ERR(hdmi->regs)) { in __dw_hdmi_probe()
2661 ret = PTR_ERR(hdmi->regs); in __dw_hdmi_probe()
2665 hdmi->regm = devm_regmap_init_mmio(dev, hdmi->regs, reg_config); in __dw_hdmi_probe()
2666 if (IS_ERR(hdmi->regm)) { in __dw_hdmi_probe()
2668 ret = PTR_ERR(hdmi->regm); in __dw_hdmi_probe()
2672 hdmi->regm = plat_data->regm; in __dw_hdmi_probe()
2675 hdmi->isfr_clk = devm_clk_get(hdmi->dev, "isfr"); in __dw_hdmi_probe()
2676 if (IS_ERR(hdmi->isfr_clk)) { in __dw_hdmi_probe()
2677 ret = PTR_ERR(hdmi->isfr_clk); in __dw_hdmi_probe()
2678 dev_err(hdmi->dev, "Unable to get HDMI isfr clk: %d\n", ret); in __dw_hdmi_probe()
2682 ret = clk_prepare_enable(hdmi->isfr_clk); in __dw_hdmi_probe()
2684 dev_err(hdmi->dev, "Cannot enable HDMI isfr clock: %d\n", ret); in __dw_hdmi_probe()
2688 hdmi->iahb_clk = devm_clk_get(hdmi->dev, "iahb"); in __dw_hdmi_probe()
2689 if (IS_ERR(hdmi->iahb_clk)) { in __dw_hdmi_probe()
2690 ret = PTR_ERR(hdmi->iahb_clk); in __dw_hdmi_probe()
2691 dev_err(hdmi->dev, "Unable to get HDMI iahb clk: %d\n", ret); in __dw_hdmi_probe()
2695 ret = clk_prepare_enable(hdmi->iahb_clk); in __dw_hdmi_probe()
2697 dev_err(hdmi->dev, "Cannot enable HDMI iahb clock: %d\n", ret); in __dw_hdmi_probe()
2701 hdmi->cec_clk = devm_clk_get(hdmi->dev, "cec"); in __dw_hdmi_probe()
2702 if (PTR_ERR(hdmi->cec_clk) == -ENOENT) { in __dw_hdmi_probe()
2703 hdmi->cec_clk = NULL; in __dw_hdmi_probe()
2704 } else if (IS_ERR(hdmi->cec_clk)) { in __dw_hdmi_probe()
2705 ret = PTR_ERR(hdmi->cec_clk); in __dw_hdmi_probe()
2706 if (ret != -EPROBE_DEFER) in __dw_hdmi_probe()
2707 dev_err(hdmi->dev, "Cannot get HDMI cec clock: %d\n", in __dw_hdmi_probe()
2710 hdmi->cec_clk = NULL; in __dw_hdmi_probe()
2713 ret = clk_prepare_enable(hdmi->cec_clk); in __dw_hdmi_probe()
2715 dev_err(hdmi->dev, "Cannot enable HDMI cec clock: %d\n", in __dw_hdmi_probe()
2722 hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8) in __dw_hdmi_probe()
2730 hdmi->version, prod_id0, prod_id1); in __dw_hdmi_probe()
2731 ret = -ENODEV; in __dw_hdmi_probe()
2740 hdmi->version >> 12, hdmi->version & 0xfff, in __dw_hdmi_probe()
2742 hdmi->phy.name); in __dw_hdmi_probe()
2764 /* If DDC bus is not specified, try to register HDMI I2C bus */ in __dw_hdmi_probe()
2765 if (!hdmi->ddc) { in __dw_hdmi_probe()
2767 hdmi->pinctrl = devm_pinctrl_get(dev); in __dw_hdmi_probe()
2768 if (!IS_ERR(hdmi->pinctrl)) { in __dw_hdmi_probe()
2769 hdmi->unwedge_state = in __dw_hdmi_probe()
2770 pinctrl_lookup_state(hdmi->pinctrl, "unwedge"); in __dw_hdmi_probe()
2771 hdmi->default_state = in __dw_hdmi_probe()
2772 pinctrl_lookup_state(hdmi->pinctrl, "default"); in __dw_hdmi_probe()
2774 if (IS_ERR(hdmi->default_state) || in __dw_hdmi_probe()
2775 IS_ERR(hdmi->unwedge_state)) { in __dw_hdmi_probe()
2776 if (!IS_ERR(hdmi->unwedge_state)) in __dw_hdmi_probe()
2779 hdmi->default_state = NULL; in __dw_hdmi_probe()
2780 hdmi->unwedge_state = NULL; in __dw_hdmi_probe()
2784 hdmi->ddc = dw_hdmi_i2c_adapter(hdmi); in __dw_hdmi_probe()
2785 if (IS_ERR(hdmi->ddc)) in __dw_hdmi_probe()
2786 hdmi->ddc = NULL; in __dw_hdmi_probe()
2789 hdmi->bridge.driver_private = hdmi; in __dw_hdmi_probe()
2790 hdmi->bridge.funcs = &dw_hdmi_bridge_funcs; in __dw_hdmi_probe()
2792 hdmi->bridge.of_node = pdev->dev.of_node; in __dw_hdmi_probe()
2805 audio.phys = iores->start; in __dw_hdmi_probe()
2806 audio.base = hdmi->regs; in __dw_hdmi_probe()
2809 audio.eld = hdmi->connector.eld; in __dw_hdmi_probe()
2810 hdmi->enable_audio = dw_hdmi_ahb_audio_enable; in __dw_hdmi_probe()
2811 hdmi->disable_audio = dw_hdmi_ahb_audio_disable; in __dw_hdmi_probe()
2813 pdevinfo.name = "dw-hdmi-ahb-audio"; in __dw_hdmi_probe()
2817 hdmi->audio = platform_device_register_full(&pdevinfo); in __dw_hdmi_probe()
2822 audio.eld = hdmi->connector.eld; in __dw_hdmi_probe()
2825 hdmi->enable_audio = dw_hdmi_i2s_audio_enable; in __dw_hdmi_probe()
2826 hdmi->disable_audio = dw_hdmi_i2s_audio_disable; in __dw_hdmi_probe()
2828 pdevinfo.name = "dw-hdmi-i2s-audio"; in __dw_hdmi_probe()
2832 hdmi->audio = platform_device_register_full(&pdevinfo); in __dw_hdmi_probe()
2840 pdevinfo.name = "dw-hdmi-cec"; in __dw_hdmi_probe()
2845 hdmi->cec = platform_device_register_full(&pdevinfo); in __dw_hdmi_probe()
2851 if (hdmi->i2c) { in __dw_hdmi_probe()
2852 i2c_del_adapter(&hdmi->i2c->adap); in __dw_hdmi_probe()
2853 hdmi->ddc = NULL; in __dw_hdmi_probe()
2856 clk_disable_unprepare(hdmi->iahb_clk); in __dw_hdmi_probe()
2857 if (hdmi->cec_clk) in __dw_hdmi_probe()
2858 clk_disable_unprepare(hdmi->cec_clk); in __dw_hdmi_probe()
2860 clk_disable_unprepare(hdmi->isfr_clk); in __dw_hdmi_probe()
2862 i2c_put_adapter(hdmi->ddc); in __dw_hdmi_probe()
2869 if (hdmi->audio && !IS_ERR(hdmi->audio)) in __dw_hdmi_remove()
2870 platform_device_unregister(hdmi->audio); in __dw_hdmi_remove()
2871 if (!IS_ERR(hdmi->cec)) in __dw_hdmi_remove()
2872 platform_device_unregister(hdmi->cec); in __dw_hdmi_remove()
2877 clk_disable_unprepare(hdmi->iahb_clk); in __dw_hdmi_remove()
2878 clk_disable_unprepare(hdmi->isfr_clk); in __dw_hdmi_remove()
2879 if (hdmi->cec_clk) in __dw_hdmi_remove()
2880 clk_disable_unprepare(hdmi->cec_clk); in __dw_hdmi_remove()
2882 if (hdmi->i2c) in __dw_hdmi_remove()
2883 i2c_del_adapter(&hdmi->i2c->adap); in __dw_hdmi_remove()
2885 i2c_put_adapter(hdmi->ddc); in __dw_hdmi_remove()
2888 /* -----------------------------------------------------------------------------
2900 drm_bridge_add(&hdmi->bridge); in dw_hdmi_probe()
2908 drm_bridge_remove(&hdmi->bridge); in dw_hdmi_remove()
2914 /* -----------------------------------------------------------------------------
2928 ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL); in dw_hdmi_bind()
2952 MODULE_AUTHOR("Andy Yan <andy.yan@rock-chips.com>");
2953 MODULE_AUTHOR("Yakir Yang <ykk@rock-chips.com>");
2957 MODULE_ALIAS("platform:dw-hdmi");