Lines Matching +full:exynos5420 +full:- +full:i2s
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Seung-Woo Kim <[email protected]>
9 * Based on drivers/media/video/s5p-tv/hdmi_drv.c
33 #include <sound/hdmi-codec.h>
34 #include <media/cec-notifier.h>
44 #include "regs-hdmi.h"
105 * required parents of clock when HDMI-PHY is respectively off or on.
680 return hdmi_reg_map[reg_id & 0xffff][hdata->drv_data->type]; in hdmi_map_reg()
686 return readl(hdata->regs + hdmi_map_reg(hdata, reg_id)); in hdmi_reg_read()
692 writel(value, hdata->regs + hdmi_map_reg(hdata, reg_id)); in hdmi_reg_writeb()
700 while (--bytes >= 0) { in hdmi_reg_writev()
701 writel(val & 0xff, hdata->regs + reg_id); in hdmi_reg_writev()
710 for (reg_id = hdmi_map_reg(hdata, reg_id); size; --size, reg_id += 4) in hdmi_reg_write_buf()
711 writel(*buf++, hdata->regs + reg_id); in hdmi_reg_write_buf()
720 old = readl(hdata->regs + reg_id); in hdmi_reg_writemask()
722 writel(value, hdata->regs + reg_id); in hdmi_reg_writemask()
729 return -EINVAL; in hdmiphy_reg_write_buf()
731 if (hdata->hdmiphy_port) { in hdmiphy_reg_write_buf()
734 ret = i2c_master_send(hdata->hdmiphy_port, buf, len); in hdmiphy_reg_write_buf()
741 writel(buf[i], hdata->regs_hdmiphy + in hdmiphy_reg_write_buf()
751 for (i = 0; i < hdata->drv_data->clk_gates.count; ++i) { in hdmi_clk_enable_gates()
752 ret = clk_prepare_enable(hdata->clk_gates[i]); in hdmi_clk_enable_gates()
756 dev_err(hdata->dev, "Cannot enable clock '%s', %d\n", in hdmi_clk_enable_gates()
757 hdata->drv_data->clk_gates.data[i], ret); in hdmi_clk_enable_gates()
758 while (i--) in hdmi_clk_enable_gates()
759 clk_disable_unprepare(hdata->clk_gates[i]); in hdmi_clk_enable_gates()
768 int i = hdata->drv_data->clk_gates.count; in hdmi_clk_disable_gates()
770 while (i--) in hdmi_clk_disable_gates()
771 clk_disable_unprepare(hdata->clk_gates[i]); in hdmi_clk_disable_gates()
776 struct device *dev = hdata->dev; in hdmi_clk_set_parents()
780 for (i = 0; i < hdata->drv_data->clk_muxes.count; i += 3) { in hdmi_clk_set_parents()
781 struct clk **c = &hdata->clk_muxes[i]; in hdmi_clk_set_parents()
788 hdata->drv_data->clk_muxes.data[i + 2], in hdmi_clk_set_parents()
789 hdata->drv_data->clk_muxes.data[i + to_phy], ret); in hdmi_clk_set_parents()
797 struct hdmi_audio_infoframe *infoframe = &hdata->audio.infoframe; in hdmi_audio_infoframe_apply()
813 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmi_reg_infoframes()
818 if (hdata->dvi_mode) { in hdmi_reg_infoframes()
828 &hdata->connector, m); in hdmi_reg_infoframes()
839 &hdata->connector, m); in hdmi_reg_infoframes()
846 hdmi_reg_write_buf(hdata, HDMI_VSI_DATA(0), buf + 3, ret - 3); in hdmi_reg_infoframes()
857 if (gpiod_get_value(hdata->hpd_gpio)) in hdmi_detect()
860 cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); in hdmi_detect()
868 cec_notifier_conn_unregister(hdata->notifier); in hdmi_connector_destroy()
886 const struct drm_display_info *info = &connector->display_info; in hdmi_get_modes()
890 if (!hdata->ddc_adpt) in hdmi_get_modes()
893 drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt); in hdmi_get_modes()
899 cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address); in hdmi_get_modes()
904 hdata->dvi_mode = !info->is_hdmi; in hdmi_get_modes()
905 DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n", in hdmi_get_modes()
906 (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), in hdmi_get_modes()
907 info->width_mm / 10, info->height_mm / 10); in hdmi_get_modes()
921 const struct hdmiphy_configs *confs = &hdata->drv_data->phy_confs; in hdmi_find_phy_conf()
924 for (i = 0; i < confs->count; i++) in hdmi_find_phy_conf()
925 if (confs->data[i].pixel_clock == pixel_clock) in hdmi_find_phy_conf()
928 DRM_DEV_DEBUG_KMS(hdata->dev, "Could not find phy config for %d\n", in hdmi_find_phy_conf()
930 return -EINVAL; in hdmi_find_phy_conf()
939 DRM_DEV_DEBUG_KMS(hdata->dev, in hdmi_mode_valid()
941 mode->hdisplay, mode->vdisplay, in hdmi_mode_valid()
943 (mode->flags & DRM_MODE_FLAG_INTERLACE) ? true : in hdmi_mode_valid()
944 false, mode->clock * 1000); in hdmi_mode_valid()
946 ret = hdmi_find_phy_conf(hdata, mode->clock * 1000); in hdmi_mode_valid()
961 struct drm_connector *connector = &hdata->connector; in hdmi_create_connector()
965 connector->interlace_allowed = true; in hdmi_create_connector()
966 connector->polled = DRM_CONNECTOR_POLL_HPD; in hdmi_create_connector()
968 ret = drm_connector_init_with_ddc(hdata->drm_dev, connector, in hdmi_create_connector()
971 hdata->ddc_adpt); in hdmi_create_connector()
973 DRM_DEV_ERROR(hdata->dev, in hdmi_create_connector()
981 if (hdata->bridge) in hdmi_create_connector()
982 ret = drm_bridge_attach(encoder, hdata->bridge, NULL, 0); in hdmi_create_connector()
986 hdata->notifier = cec_notifier_conn_register(hdata->dev, NULL, in hdmi_create_connector()
988 if (!hdata->notifier) { in hdmi_create_connector()
989 ret = -ENOMEM; in hdmi_create_connector()
990 DRM_DEV_ERROR(hdata->dev, "Failed to allocate CEC notifier\n"); in hdmi_create_connector()
1000 struct drm_device *dev = encoder->dev; in hdmi_mode_fixup()
1010 if (connector->encoder == encoder) in hdmi_mode_fixup()
1028 list_for_each_entry(m, &connector->modes, head) { in hdmi_mode_fixup()
1035 DRM_DEV_DEBUG_KMS(dev->dev, in hdmi_mode_fixup()
1037 m->hdisplay, m->vdisplay, in hdmi_mode_fixup()
1070 switch (hdata->audio.params.sample_width) { in hdmi_audio_config()
1083 hdmi_reg_acr(hdata, hdata->audio.params.sample_rate); in hdmi_audio_config()
1099 /* Configuration I2S input ports. Configure I2S_PIN_SEL_0~4 */ in hdmi_audio_config()
1122 hdata->audio.params.iec.status[i]); in hdmi_audio_config()
1129 bool enable = !hdata->audio.mute; in hdmi_audio_control()
1131 if (hdata->dvi_mode) in hdmi_audio_control()
1142 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmi_start()
1145 if (m->flags & DRM_MODE_FLAG_INTERLACE) in hdmi_start()
1161 /* apply video pre-amble and guard band in HDMI mode only */ in hdmi_conf_init()
1166 if (hdata->dvi_mode) { in hdmi_conf_init()
1173 if (hdata->drv_data->type == HDMI_TYPE13) { in hdmi_conf_init()
1181 /* force RGB, look to CEA-861-D, table 7 for more detail */ in hdmi_conf_init()
1204 DRM_DEV_DEBUG_KMS(hdata->dev, in hdmiphy_wait_for_pll()
1212 DRM_DEV_ERROR(hdata->dev, "PLL could not reach steady state\n"); in hdmiphy_wait_for_pll()
1217 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmi_v13_mode_apply()
1220 hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); in hdmi_v13_mode_apply()
1222 (m->htotal << 12) | m->vtotal); in hdmi_v13_mode_apply()
1224 val = (m->flags & DRM_MODE_FLAG_NVSYNC) ? 1 : 0; in hdmi_v13_mode_apply()
1227 val = (m->flags & DRM_MODE_FLAG_INTERLACE) ? 1 : 0; in hdmi_v13_mode_apply()
1230 val = (m->hsync_start - m->hdisplay - 2); in hdmi_v13_mode_apply()
1231 val |= ((m->hsync_end - m->hdisplay - 2) << 10); in hdmi_v13_mode_apply()
1232 val |= ((m->flags & DRM_MODE_FLAG_NHSYNC) ? 1 : 0)<<20; in hdmi_v13_mode_apply()
1242 if (m->flags & DRM_MODE_FLAG_INTERLACE) { in hdmi_v13_mode_apply()
1243 val = ((m->vsync_end - m->vdisplay) / 2); in hdmi_v13_mode_apply()
1244 val |= ((m->vsync_start - m->vdisplay) / 2) << 12; in hdmi_v13_mode_apply()
1247 val = m->vtotal / 2; in hdmi_v13_mode_apply()
1248 val |= ((m->vtotal - m->vdisplay) / 2) << 11; in hdmi_v13_mode_apply()
1251 val = (m->vtotal + in hdmi_v13_mode_apply()
1252 ((m->vsync_end - m->vsync_start) * 4) + 5) / 2; in hdmi_v13_mode_apply()
1253 val |= m->vtotal << 11; in hdmi_v13_mode_apply()
1256 val = ((m->vtotal / 2) + 7); in hdmi_v13_mode_apply()
1257 val |= ((m->vtotal / 2) + 2) << 12; in hdmi_v13_mode_apply()
1260 val = ((m->htotal / 2) + (m->hsync_start - m->hdisplay)); in hdmi_v13_mode_apply()
1261 val |= ((m->htotal / 2) + in hdmi_v13_mode_apply()
1262 (m->hsync_start - m->hdisplay)) << 12; in hdmi_v13_mode_apply()
1266 (m->vtotal - m->vdisplay) / 2); in hdmi_v13_mode_apply()
1267 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay / 2); in hdmi_v13_mode_apply()
1271 val = m->vtotal; in hdmi_v13_mode_apply()
1272 val |= (m->vtotal - m->vdisplay) << 11; in hdmi_v13_mode_apply()
1277 val = (m->vsync_end - m->vdisplay); in hdmi_v13_mode_apply()
1278 val |= ((m->vsync_start - m->vdisplay) << 12); in hdmi_v13_mode_apply()
1284 m->vtotal - m->vdisplay); in hdmi_v13_mode_apply()
1285 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay); in hdmi_v13_mode_apply()
1288 hdmi_reg_writev(hdata, HDMI_TG_H_FSZ_L, 2, m->htotal); in hdmi_v13_mode_apply()
1289 hdmi_reg_writev(hdata, HDMI_TG_HACT_ST_L, 2, m->htotal - m->hdisplay); in hdmi_v13_mode_apply()
1290 hdmi_reg_writev(hdata, HDMI_TG_HACT_SZ_L, 2, m->hdisplay); in hdmi_v13_mode_apply()
1291 hdmi_reg_writev(hdata, HDMI_TG_V_FSZ_L, 2, m->vtotal); in hdmi_v13_mode_apply()
1296 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmi_v14_mode_apply()
1298 &hdata->encoder.crtc->state->adjusted_mode; in hdmi_v14_mode_apply()
1303 * sometimes is able to almost properly perform conversion - only in hdmi_v14_mode_apply()
1306 if ((m->vdisplay != am->vdisplay) && in hdmi_v14_mode_apply()
1307 (m->hdisplay == 1280 || m->hdisplay == 1024 || m->hdisplay == 1366)) in hdmi_v14_mode_apply()
1310 hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); in hdmi_v14_mode_apply()
1311 hdmi_reg_writev(hdata, HDMI_V_LINE_0, 2, m->vtotal); in hdmi_v14_mode_apply()
1312 hdmi_reg_writev(hdata, HDMI_H_LINE_0, 2, m->htotal); in hdmi_v14_mode_apply()
1314 (m->flags & DRM_MODE_FLAG_NHSYNC) ? 1 : 0); in hdmi_v14_mode_apply()
1316 (m->flags & DRM_MODE_FLAG_NVSYNC) ? 1 : 0); in hdmi_v14_mode_apply()
1318 (m->flags & DRM_MODE_FLAG_INTERLACE) ? 1 : 0); in hdmi_v14_mode_apply()
1327 if (m->flags & DRM_MODE_FLAG_INTERLACE) { in hdmi_v14_mode_apply()
1329 (m->vsync_end - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1331 (m->vsync_start - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1332 hdmi_reg_writev(hdata, HDMI_V2_BLANK_0, 2, m->vtotal / 2); in hdmi_v14_mode_apply()
1334 (m->vtotal - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1336 m->vtotal - m->vdisplay / 2); in hdmi_v14_mode_apply()
1337 hdmi_reg_writev(hdata, HDMI_V_BLANK_F1_0, 2, m->vtotal); in hdmi_v14_mode_apply()
1339 (m->vtotal / 2) + 7); in hdmi_v14_mode_apply()
1341 (m->vtotal / 2) + 2); in hdmi_v14_mode_apply()
1343 (m->htotal / 2) + (m->hsync_start - m->hdisplay)); in hdmi_v14_mode_apply()
1345 (m->htotal / 2) + (m->hsync_start - m->hdisplay)); in hdmi_v14_mode_apply()
1347 (m->vtotal - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1348 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay / 2); in hdmi_v14_mode_apply()
1350 m->vtotal - m->vdisplay / 2); in hdmi_v14_mode_apply()
1352 (m->vtotal / 2) + 1); in hdmi_v14_mode_apply()
1354 (m->vtotal / 2) + 1); in hdmi_v14_mode_apply()
1356 (m->vtotal / 2) + 1); in hdmi_v14_mode_apply()
1361 m->vsync_end - m->vdisplay); in hdmi_v14_mode_apply()
1363 m->vsync_start - m->vdisplay); in hdmi_v14_mode_apply()
1364 hdmi_reg_writev(hdata, HDMI_V2_BLANK_0, 2, m->vtotal); in hdmi_v14_mode_apply()
1366 m->vtotal - m->vdisplay); in hdmi_v14_mode_apply()
1374 m->vtotal - m->vdisplay); in hdmi_v14_mode_apply()
1375 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay); in hdmi_v14_mode_apply()
1379 m->hsync_start - m->hdisplay - 2); in hdmi_v14_mode_apply()
1381 m->hsync_end - m->hdisplay - 2); in hdmi_v14_mode_apply()
1401 hdmi_reg_writev(hdata, HDMI_TG_H_FSZ_L, 2, m->htotal); in hdmi_v14_mode_apply()
1403 m->htotal - m->hdisplay - hquirk); in hdmi_v14_mode_apply()
1404 hdmi_reg_writev(hdata, HDMI_TG_HACT_SZ_L, 2, m->hdisplay + hquirk); in hdmi_v14_mode_apply()
1405 hdmi_reg_writev(hdata, HDMI_TG_V_FSZ_L, 2, m->vtotal); in hdmi_v14_mode_apply()
1406 if (hdata->drv_data == &exynos5433_hdmi_driver_data) in hdmi_v14_mode_apply()
1412 if (hdata->drv_data->type == HDMI_TYPE13) in hdmi_mode_apply()
1436 if (hdata->drv_data == &exynos5433_hdmi_driver_data) in hdmiphy_enable_mode_set()
1437 writel(v, hdata->regs_hdmiphy + HDMIPHY5433_MODE_SET_DONE); in hdmiphy_enable_mode_set()
1442 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmiphy_conf_apply()
1446 ret = hdmi_find_phy_conf(hdata, m->clock * 1000); in hdmiphy_conf_apply()
1448 DRM_DEV_ERROR(hdata->dev, "failed to find hdmiphy conf\n"); in hdmiphy_conf_apply()
1451 phy_conf = hdata->drv_data->phy_confs.data[ret].conf; in hdmiphy_conf_apply()
1460 DRM_DEV_ERROR(hdata->dev, "failed to configure hdmiphy\n"); in hdmiphy_conf_apply()
1469 /* Should be called with hdata->mutex mutex held */
1481 if (!hdata->sysreg) in hdmi_set_refclk()
1484 regmap_update_bits(hdata->sysreg, EXYNOS5433_SYSREG_DISP_HDMI_PHY, in hdmi_set_refclk()
1488 /* Should be called with hdata->mutex mutex held. */
1493 if (hdata->powered) in hdmiphy_enable()
1496 ret = pm_runtime_resume_and_get(hdata->dev); in hdmiphy_enable()
1498 dev_err(hdata->dev, "failed to enable HDMIPHY device.\n"); in hdmiphy_enable()
1502 if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk)) in hdmiphy_enable()
1503 DRM_DEV_DEBUG_KMS(hdata->dev, in hdmiphy_enable()
1506 regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL, in hdmiphy_enable()
1515 hdata->powered = true; in hdmiphy_enable()
1518 /* Should be called with hdata->mutex mutex held. */
1521 if (!hdata->powered) in hdmiphy_disable()
1530 regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL, in hdmiphy_disable()
1533 regulator_bulk_disable(ARRAY_SIZE(supply), hdata->regul_bulk); in hdmiphy_disable()
1535 pm_runtime_put_sync(hdata->dev); in hdmiphy_disable()
1537 hdata->powered = false; in hdmiphy_disable()
1544 mutex_lock(&hdata->mutex); in hdmi_enable()
1549 mutex_unlock(&hdata->mutex); in hdmi_enable()
1556 mutex_lock(&hdata->mutex); in hdmi_disable()
1558 if (hdata->powered) { in hdmi_disable()
1563 * VP -> Mixer -> HDMI in hdmi_disable()
1568 mutex_unlock(&hdata->mutex); in hdmi_disable()
1569 cancel_delayed_work(&hdata->hotplug_work); in hdmi_disable()
1570 if (hdata->notifier) in hdmi_disable()
1571 cec_notifier_phys_addr_invalidate(hdata->notifier); in hdmi_disable()
1575 mutex_unlock(&hdata->mutex); in hdmi_disable()
1588 mutex_lock(&hdata->mutex); in hdmi_audio_shutdown()
1590 hdata->audio.mute = true; in hdmi_audio_shutdown()
1592 if (hdata->powered) in hdmi_audio_shutdown()
1595 mutex_unlock(&hdata->mutex); in hdmi_audio_shutdown()
1604 if (daifmt->fmt != HDMI_I2S || daifmt->bit_clk_inv || in hdmi_audio_hw_params()
1605 daifmt->frame_clk_inv || daifmt->bit_clk_provider || in hdmi_audio_hw_params()
1606 daifmt->frame_clk_provider) { in hdmi_audio_hw_params()
1608 daifmt->bit_clk_inv, daifmt->frame_clk_inv, in hdmi_audio_hw_params()
1609 daifmt->bit_clk_provider, in hdmi_audio_hw_params()
1610 daifmt->frame_clk_provider); in hdmi_audio_hw_params()
1611 return -EINVAL; in hdmi_audio_hw_params()
1614 mutex_lock(&hdata->mutex); in hdmi_audio_hw_params()
1616 hdata->audio.params = *params; in hdmi_audio_hw_params()
1618 if (hdata->powered) { in hdmi_audio_hw_params()
1623 mutex_unlock(&hdata->mutex); in hdmi_audio_hw_params()
1633 mutex_lock(&hdata->mutex); in hdmi_audio_mute()
1635 hdata->audio.mute = mute; in hdmi_audio_mute()
1637 if (hdata->powered) in hdmi_audio_mute()
1640 mutex_unlock(&hdata->mutex); in hdmi_audio_mute()
1649 struct drm_connector *connector = &hdata->connector; in hdmi_audio_get_eld()
1651 mutex_lock(&connector->eld_mutex); in hdmi_audio_get_eld()
1652 memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); in hdmi_audio_get_eld()
1653 mutex_unlock(&connector->eld_mutex); in hdmi_audio_get_eld()
1670 .i2s = 1, in hdmi_register_audio_device()
1674 hdata->audio.pdev = platform_device_register_data( in hdmi_register_audio_device()
1675 hdata->dev, HDMI_CODEC_DRV_NAME, PLATFORM_DEVID_AUTO, in hdmi_register_audio_device()
1678 return PTR_ERR_OR_ZERO(hdata->audio.pdev); in hdmi_register_audio_device()
1687 if (hdata->drm_dev) in hdmi_hotplug_work_func()
1688 drm_helper_hpd_irq_event(hdata->drm_dev); in hdmi_hotplug_work_func()
1695 mod_delayed_work(system_wq, &hdata->hotplug_work, in hdmi_irq_thread()
1705 struct device *dev = hdata->dev; in hdmi_clks_get()
1708 for (i = 0; i < names->count; ++i) { in hdmi_clks_get()
1709 struct clk *clk = devm_clk_get(dev, names->data[i]); in hdmi_clks_get()
1715 names->data[i], ret); in hdmi_clks_get()
1728 const struct hdmi_driver_data *drv_data = hdata->drv_data; in hdmi_clk_init()
1729 int count = drv_data->clk_gates.count + drv_data->clk_muxes.count; in hdmi_clk_init()
1730 struct device *dev = hdata->dev; in hdmi_clk_init()
1739 return -ENOMEM; in hdmi_clk_init()
1741 hdata->clk_gates = clks; in hdmi_clk_init()
1742 hdata->clk_muxes = clks + drv_data->clk_gates.count; in hdmi_clk_init()
1744 ret = hdmi_clks_get(hdata, &drv_data->clk_gates, hdata->clk_gates); in hdmi_clk_init()
1748 return hdmi_clks_get(hdata, &drv_data->clk_muxes, hdata->clk_muxes); in hdmi_clk_init()
1756 mutex_lock(&hdata->mutex); in hdmiphy_clk_enable()
1763 mutex_unlock(&hdata->mutex); in hdmiphy_clk_enable()
1768 struct device *dev = hdata->dev; in hdmi_bridge_init()
1771 ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1); in hdmi_bridge_init()
1779 return -EINVAL; in hdmi_bridge_init()
1782 hdata->bridge = of_drm_find_bridge(np); in hdmi_bridge_init()
1785 if (!hdata->bridge) in hdmi_bridge_init()
1786 return -EPROBE_DEFER; in hdmi_bridge_init()
1793 struct device *dev = hdata->dev; in hdmi_resources_init()
1798 hdata->hpd_gpio = devm_gpiod_get(dev, "hpd", GPIOD_IN); in hdmi_resources_init()
1799 if (IS_ERR(hdata->hpd_gpio)) { in hdmi_resources_init()
1801 return PTR_ERR(hdata->hpd_gpio); in hdmi_resources_init()
1804 hdata->irq = gpiod_to_irq(hdata->hpd_gpio); in hdmi_resources_init()
1805 if (hdata->irq < 0) { in hdmi_resources_init()
1807 return hdata->irq; in hdmi_resources_init()
1819 hdata->regul_bulk[i].supply = supply[i]; in hdmi_resources_init()
1821 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), hdata->regul_bulk); in hdmi_resources_init()
1825 hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en"); in hdmi_resources_init()
1827 if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) in hdmi_resources_init()
1828 if (IS_ERR(hdata->reg_hdmi_en)) in hdmi_resources_init()
1829 return PTR_ERR(hdata->reg_hdmi_en); in hdmi_resources_init()
1836 .compatible = "samsung,exynos4210-hdmi",
1839 .compatible = "samsung,exynos4212-hdmi",
1842 .compatible = "samsung,exynos5420-hdmi",
1845 .compatible = "samsung,exynos5433-hdmi",
1857 struct drm_encoder *encoder = &hdata->encoder; in hdmi_bind()
1861 hdata->drm_dev = drm_dev; in hdmi_bind()
1863 hdata->phy_clk.enable = hdmiphy_clk_enable; in hdmi_bind()
1876 crtc->pipe_clk = &hdata->phy_clk; in hdmi_bind()
1900 const char *compatible_str = "samsung,exynos4210-hdmiddc"; in hdmi_get_ddc_adapter()
1908 np = of_parse_phandle(hdata->dev->of_node, "ddc", 0); in hdmi_get_ddc_adapter()
1911 DRM_DEV_ERROR(hdata->dev, in hdmi_get_ddc_adapter()
1913 return -ENODEV; in hdmi_get_ddc_adapter()
1921 return -EPROBE_DEFER; in hdmi_get_ddc_adapter()
1924 hdata->ddc_adpt = adpt; in hdmi_get_ddc_adapter()
1931 const char *compatible_str = "samsung,exynos4212-hdmiphy"; in hdmi_get_phy_io()
1936 np = of_parse_phandle(hdata->dev->of_node, "phy", 0); in hdmi_get_phy_io()
1938 DRM_DEV_ERROR(hdata->dev, in hdmi_get_phy_io()
1940 return -ENODEV; in hdmi_get_phy_io()
1944 if (hdata->drv_data->is_apb_phy) { in hdmi_get_phy_io()
1945 hdata->regs_hdmiphy = of_iomap(np, 0); in hdmi_get_phy_io()
1946 if (!hdata->regs_hdmiphy) { in hdmi_get_phy_io()
1947 DRM_DEV_ERROR(hdata->dev, in hdmi_get_phy_io()
1949 return -ENOMEM; in hdmi_get_phy_io()
1952 hdata->hdmiphy_port = of_find_i2c_device_by_node(np); in hdmi_get_phy_io()
1953 if (!hdata->hdmiphy_port) { in hdmi_get_phy_io()
1955 return -EPROBE_DEFER; in hdmi_get_phy_io()
1965 struct device *dev = &pdev->dev; in hdmi_probe()
1971 return -ENOMEM; in hdmi_probe()
1973 hdata->drv_data = of_device_get_match_data(dev); in hdmi_probe()
1977 hdata->dev = dev; in hdmi_probe()
1979 mutex_init(&hdata->mutex); in hdmi_probe()
1983 if (ret != -EPROBE_DEFER) in hdmi_probe()
1988 hdata->regs = devm_platform_ioremap_resource(pdev, 0); in hdmi_probe()
1989 if (IS_ERR(hdata->regs)) { in hdmi_probe()
1990 ret = PTR_ERR(hdata->regs); in hdmi_probe()
2002 INIT_DELAYED_WORK(&hdata->hotplug_work, hdmi_hotplug_work_func); in hdmi_probe()
2004 ret = devm_request_threaded_irq(dev, hdata->irq, NULL, in hdmi_probe()
2013 hdata->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, in hdmi_probe()
2014 "samsung,syscon-phandle"); in hdmi_probe()
2015 if (IS_ERR(hdata->pmureg)) { in hdmi_probe()
2017 ret = -EPROBE_DEFER; in hdmi_probe()
2021 if (hdata->drv_data->has_sysreg) { in hdmi_probe()
2022 hdata->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, in hdmi_probe()
2023 "samsung,sysreg-phandle"); in hdmi_probe()
2024 if (IS_ERR(hdata->sysreg)) { in hdmi_probe()
2026 ret = -EPROBE_DEFER; in hdmi_probe()
2031 if (!IS_ERR(hdata->reg_hdmi_en)) { in hdmi_probe()
2032 ret = regulator_enable(hdata->reg_hdmi_en); in hdmi_probe()
2035 "failed to enable hdmi-en regulator\n"); in hdmi_probe()
2042 audio_infoframe = &hdata->audio.infoframe; in hdmi_probe()
2044 audio_infoframe->coding_type = HDMI_AUDIO_CODING_TYPE_STREAM; in hdmi_probe()
2045 audio_infoframe->sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM; in hdmi_probe()
2046 audio_infoframe->sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM; in hdmi_probe()
2047 audio_infoframe->channels = 2; in hdmi_probe()
2053 ret = component_add(&pdev->dev, &hdmi_component_ops); in hdmi_probe()
2060 platform_device_unregister(hdata->audio.pdev); in hdmi_probe()
2064 if (!IS_ERR(hdata->reg_hdmi_en)) in hdmi_probe()
2065 regulator_disable(hdata->reg_hdmi_en); in hdmi_probe()
2067 if (hdata->hdmiphy_port) in hdmi_probe()
2068 put_device(&hdata->hdmiphy_port->dev); in hdmi_probe()
2069 if (hdata->regs_hdmiphy) in hdmi_probe()
2070 iounmap(hdata->regs_hdmiphy); in hdmi_probe()
2072 put_device(&hdata->ddc_adpt->dev); in hdmi_probe()
2081 cancel_delayed_work_sync(&hdata->hotplug_work); in hdmi_remove()
2083 component_del(&pdev->dev, &hdmi_component_ops); in hdmi_remove()
2084 platform_device_unregister(hdata->audio.pdev); in hdmi_remove()
2086 pm_runtime_disable(&pdev->dev); in hdmi_remove()
2088 if (!IS_ERR(hdata->reg_hdmi_en)) in hdmi_remove()
2089 regulator_disable(hdata->reg_hdmi_en); in hdmi_remove()
2091 if (hdata->hdmiphy_port) in hdmi_remove()
2092 put_device(&hdata->hdmiphy_port->dev); in hdmi_remove()
2094 if (hdata->regs_hdmiphy) in hdmi_remove()
2095 iounmap(hdata->regs_hdmiphy); in hdmi_remove()
2097 put_device(&hdata->ddc_adpt->dev); in hdmi_remove()
2099 mutex_destroy(&hdata->mutex); in hdmi_remove()
2133 .name = "exynos-hdmi",