Lines Matching +full:exynos5420 +full:- +full:i2s

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Seung-Woo Kim <sw0312.kim@samsung.com>
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()
889 if (!hdata->ddc_adpt) in hdmi_get_modes()
892 edid = drm_get_edid(connector, hdata->ddc_adpt); in hdmi_get_modes()
896 hdata->dvi_mode = !connector->display_info.is_hdmi; in hdmi_get_modes()
897 DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n", in hdmi_get_modes()
898 (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), in hdmi_get_modes()
899 edid->width_cm, edid->height_cm); in hdmi_get_modes()
902 cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid); in hdmi_get_modes()
916 const struct hdmiphy_configs *confs = &hdata->drv_data->phy_confs; in hdmi_find_phy_conf()
919 for (i = 0; i < confs->count; i++) in hdmi_find_phy_conf()
920 if (confs->data[i].pixel_clock == pixel_clock) in hdmi_find_phy_conf()
923 DRM_DEV_DEBUG_KMS(hdata->dev, "Could not find phy config for %d\n", in hdmi_find_phy_conf()
925 return -EINVAL; in hdmi_find_phy_conf()
934 DRM_DEV_DEBUG_KMS(hdata->dev, in hdmi_mode_valid()
936 mode->hdisplay, mode->vdisplay, in hdmi_mode_valid()
938 (mode->flags & DRM_MODE_FLAG_INTERLACE) ? true : in hdmi_mode_valid()
939 false, mode->clock * 1000); in hdmi_mode_valid()
941 ret = hdmi_find_phy_conf(hdata, mode->clock * 1000); in hdmi_mode_valid()
956 struct drm_connector *connector = &hdata->connector; in hdmi_create_connector()
960 connector->interlace_allowed = true; in hdmi_create_connector()
961 connector->polled = DRM_CONNECTOR_POLL_HPD; in hdmi_create_connector()
963 ret = drm_connector_init_with_ddc(hdata->drm_dev, connector, in hdmi_create_connector()
966 hdata->ddc_adpt); in hdmi_create_connector()
968 DRM_DEV_ERROR(hdata->dev, in hdmi_create_connector()
976 if (hdata->bridge) in hdmi_create_connector()
977 ret = drm_bridge_attach(encoder, hdata->bridge, NULL, 0); in hdmi_create_connector()
981 hdata->notifier = cec_notifier_conn_register(hdata->dev, NULL, in hdmi_create_connector()
983 if (!hdata->notifier) { in hdmi_create_connector()
984 ret = -ENOMEM; in hdmi_create_connector()
985 DRM_DEV_ERROR(hdata->dev, "Failed to allocate CEC notifier\n"); in hdmi_create_connector()
995 struct drm_device *dev = encoder->dev; in hdmi_mode_fixup()
1005 if (connector->encoder == encoder) in hdmi_mode_fixup()
1023 list_for_each_entry(m, &connector->modes, head) { in hdmi_mode_fixup()
1030 DRM_DEV_DEBUG_KMS(dev->dev, in hdmi_mode_fixup()
1032 m->hdisplay, m->vdisplay, in hdmi_mode_fixup()
1065 switch (hdata->audio.params.sample_width) { in hdmi_audio_config()
1078 hdmi_reg_acr(hdata, hdata->audio.params.sample_rate); in hdmi_audio_config()
1094 /* Configuration I2S input ports. Configure I2S_PIN_SEL_0~4 */ in hdmi_audio_config()
1117 hdata->audio.params.iec.status[i]); in hdmi_audio_config()
1124 bool enable = !hdata->audio.mute; in hdmi_audio_control()
1126 if (hdata->dvi_mode) in hdmi_audio_control()
1137 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmi_start()
1140 if (m->flags & DRM_MODE_FLAG_INTERLACE) in hdmi_start()
1156 /* apply video pre-amble and guard band in HDMI mode only */ in hdmi_conf_init()
1161 if (hdata->dvi_mode) { in hdmi_conf_init()
1168 if (hdata->drv_data->type == HDMI_TYPE13) { in hdmi_conf_init()
1176 /* force RGB, look to CEA-861-D, table 7 for more detail */ in hdmi_conf_init()
1199 DRM_DEV_DEBUG_KMS(hdata->dev, in hdmiphy_wait_for_pll()
1207 DRM_DEV_ERROR(hdata->dev, "PLL could not reach steady state\n"); in hdmiphy_wait_for_pll()
1212 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmi_v13_mode_apply()
1215 hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); in hdmi_v13_mode_apply()
1217 (m->htotal << 12) | m->vtotal); in hdmi_v13_mode_apply()
1219 val = (m->flags & DRM_MODE_FLAG_NVSYNC) ? 1 : 0; in hdmi_v13_mode_apply()
1222 val = (m->flags & DRM_MODE_FLAG_INTERLACE) ? 1 : 0; in hdmi_v13_mode_apply()
1225 val = (m->hsync_start - m->hdisplay - 2); in hdmi_v13_mode_apply()
1226 val |= ((m->hsync_end - m->hdisplay - 2) << 10); in hdmi_v13_mode_apply()
1227 val |= ((m->flags & DRM_MODE_FLAG_NHSYNC) ? 1 : 0)<<20; in hdmi_v13_mode_apply()
1237 if (m->flags & DRM_MODE_FLAG_INTERLACE) { in hdmi_v13_mode_apply()
1238 val = ((m->vsync_end - m->vdisplay) / 2); in hdmi_v13_mode_apply()
1239 val |= ((m->vsync_start - m->vdisplay) / 2) << 12; in hdmi_v13_mode_apply()
1242 val = m->vtotal / 2; in hdmi_v13_mode_apply()
1243 val |= ((m->vtotal - m->vdisplay) / 2) << 11; in hdmi_v13_mode_apply()
1246 val = (m->vtotal + in hdmi_v13_mode_apply()
1247 ((m->vsync_end - m->vsync_start) * 4) + 5) / 2; in hdmi_v13_mode_apply()
1248 val |= m->vtotal << 11; in hdmi_v13_mode_apply()
1251 val = ((m->vtotal / 2) + 7); in hdmi_v13_mode_apply()
1252 val |= ((m->vtotal / 2) + 2) << 12; in hdmi_v13_mode_apply()
1255 val = ((m->htotal / 2) + (m->hsync_start - m->hdisplay)); in hdmi_v13_mode_apply()
1256 val |= ((m->htotal / 2) + in hdmi_v13_mode_apply()
1257 (m->hsync_start - m->hdisplay)) << 12; in hdmi_v13_mode_apply()
1261 (m->vtotal - m->vdisplay) / 2); in hdmi_v13_mode_apply()
1262 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay / 2); in hdmi_v13_mode_apply()
1266 val = m->vtotal; in hdmi_v13_mode_apply()
1267 val |= (m->vtotal - m->vdisplay) << 11; in hdmi_v13_mode_apply()
1272 val = (m->vsync_end - m->vdisplay); in hdmi_v13_mode_apply()
1273 val |= ((m->vsync_start - m->vdisplay) << 12); in hdmi_v13_mode_apply()
1279 m->vtotal - m->vdisplay); in hdmi_v13_mode_apply()
1280 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay); in hdmi_v13_mode_apply()
1283 hdmi_reg_writev(hdata, HDMI_TG_H_FSZ_L, 2, m->htotal); in hdmi_v13_mode_apply()
1284 hdmi_reg_writev(hdata, HDMI_TG_HACT_ST_L, 2, m->htotal - m->hdisplay); in hdmi_v13_mode_apply()
1285 hdmi_reg_writev(hdata, HDMI_TG_HACT_SZ_L, 2, m->hdisplay); in hdmi_v13_mode_apply()
1286 hdmi_reg_writev(hdata, HDMI_TG_V_FSZ_L, 2, m->vtotal); in hdmi_v13_mode_apply()
1291 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmi_v14_mode_apply()
1293 &hdata->encoder.crtc->state->adjusted_mode; in hdmi_v14_mode_apply()
1298 * sometimes is able to almost properly perform conversion - only in hdmi_v14_mode_apply()
1301 if ((m->vdisplay != am->vdisplay) && in hdmi_v14_mode_apply()
1302 (m->hdisplay == 1280 || m->hdisplay == 1024 || m->hdisplay == 1366)) in hdmi_v14_mode_apply()
1305 hdmi_reg_writev(hdata, HDMI_H_BLANK_0, 2, m->htotal - m->hdisplay); in hdmi_v14_mode_apply()
1306 hdmi_reg_writev(hdata, HDMI_V_LINE_0, 2, m->vtotal); in hdmi_v14_mode_apply()
1307 hdmi_reg_writev(hdata, HDMI_H_LINE_0, 2, m->htotal); in hdmi_v14_mode_apply()
1309 (m->flags & DRM_MODE_FLAG_NHSYNC) ? 1 : 0); in hdmi_v14_mode_apply()
1311 (m->flags & DRM_MODE_FLAG_NVSYNC) ? 1 : 0); in hdmi_v14_mode_apply()
1313 (m->flags & DRM_MODE_FLAG_INTERLACE) ? 1 : 0); in hdmi_v14_mode_apply()
1322 if (m->flags & DRM_MODE_FLAG_INTERLACE) { in hdmi_v14_mode_apply()
1324 (m->vsync_end - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1326 (m->vsync_start - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1327 hdmi_reg_writev(hdata, HDMI_V2_BLANK_0, 2, m->vtotal / 2); in hdmi_v14_mode_apply()
1329 (m->vtotal - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1331 m->vtotal - m->vdisplay / 2); in hdmi_v14_mode_apply()
1332 hdmi_reg_writev(hdata, HDMI_V_BLANK_F1_0, 2, m->vtotal); in hdmi_v14_mode_apply()
1334 (m->vtotal / 2) + 7); in hdmi_v14_mode_apply()
1336 (m->vtotal / 2) + 2); in hdmi_v14_mode_apply()
1338 (m->htotal / 2) + (m->hsync_start - m->hdisplay)); in hdmi_v14_mode_apply()
1340 (m->htotal / 2) + (m->hsync_start - m->hdisplay)); in hdmi_v14_mode_apply()
1342 (m->vtotal - m->vdisplay) / 2); in hdmi_v14_mode_apply()
1343 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay / 2); in hdmi_v14_mode_apply()
1345 m->vtotal - m->vdisplay / 2); in hdmi_v14_mode_apply()
1347 (m->vtotal / 2) + 1); in hdmi_v14_mode_apply()
1349 (m->vtotal / 2) + 1); in hdmi_v14_mode_apply()
1351 (m->vtotal / 2) + 1); in hdmi_v14_mode_apply()
1356 m->vsync_end - m->vdisplay); in hdmi_v14_mode_apply()
1358 m->vsync_start - m->vdisplay); in hdmi_v14_mode_apply()
1359 hdmi_reg_writev(hdata, HDMI_V2_BLANK_0, 2, m->vtotal); in hdmi_v14_mode_apply()
1361 m->vtotal - m->vdisplay); in hdmi_v14_mode_apply()
1369 m->vtotal - m->vdisplay); in hdmi_v14_mode_apply()
1370 hdmi_reg_writev(hdata, HDMI_TG_VACT_SZ_L, 2, m->vdisplay); in hdmi_v14_mode_apply()
1374 m->hsync_start - m->hdisplay - 2); in hdmi_v14_mode_apply()
1376 m->hsync_end - m->hdisplay - 2); in hdmi_v14_mode_apply()
1396 hdmi_reg_writev(hdata, HDMI_TG_H_FSZ_L, 2, m->htotal); in hdmi_v14_mode_apply()
1398 m->htotal - m->hdisplay - hquirk); in hdmi_v14_mode_apply()
1399 hdmi_reg_writev(hdata, HDMI_TG_HACT_SZ_L, 2, m->hdisplay + hquirk); in hdmi_v14_mode_apply()
1400 hdmi_reg_writev(hdata, HDMI_TG_V_FSZ_L, 2, m->vtotal); in hdmi_v14_mode_apply()
1401 if (hdata->drv_data == &exynos5433_hdmi_driver_data) in hdmi_v14_mode_apply()
1407 if (hdata->drv_data->type == HDMI_TYPE13) in hdmi_mode_apply()
1431 if (hdata->drv_data == &exynos5433_hdmi_driver_data) in hdmiphy_enable_mode_set()
1432 writel(v, hdata->regs_hdmiphy + HDMIPHY5433_MODE_SET_DONE); in hdmiphy_enable_mode_set()
1437 struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; in hdmiphy_conf_apply()
1441 ret = hdmi_find_phy_conf(hdata, m->clock * 1000); in hdmiphy_conf_apply()
1443 DRM_DEV_ERROR(hdata->dev, "failed to find hdmiphy conf\n"); in hdmiphy_conf_apply()
1446 phy_conf = hdata->drv_data->phy_confs.data[ret].conf; in hdmiphy_conf_apply()
1455 DRM_DEV_ERROR(hdata->dev, "failed to configure hdmiphy\n"); in hdmiphy_conf_apply()
1464 /* Should be called with hdata->mutex mutex held */
1476 if (!hdata->sysreg) in hdmi_set_refclk()
1479 regmap_update_bits(hdata->sysreg, EXYNOS5433_SYSREG_DISP_HDMI_PHY, in hdmi_set_refclk()
1483 /* Should be called with hdata->mutex mutex held. */
1488 if (hdata->powered) in hdmiphy_enable()
1491 ret = pm_runtime_resume_and_get(hdata->dev); in hdmiphy_enable()
1493 dev_err(hdata->dev, "failed to enable HDMIPHY device.\n"); in hdmiphy_enable()
1497 if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk)) in hdmiphy_enable()
1498 DRM_DEV_DEBUG_KMS(hdata->dev, in hdmiphy_enable()
1501 regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL, in hdmiphy_enable()
1510 hdata->powered = true; in hdmiphy_enable()
1513 /* Should be called with hdata->mutex mutex held. */
1516 if (!hdata->powered) in hdmiphy_disable()
1525 regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL, in hdmiphy_disable()
1528 regulator_bulk_disable(ARRAY_SIZE(supply), hdata->regul_bulk); in hdmiphy_disable()
1530 pm_runtime_put_sync(hdata->dev); in hdmiphy_disable()
1532 hdata->powered = false; in hdmiphy_disable()
1539 mutex_lock(&hdata->mutex); in hdmi_enable()
1544 mutex_unlock(&hdata->mutex); in hdmi_enable()
1551 mutex_lock(&hdata->mutex); in hdmi_disable()
1553 if (hdata->powered) { in hdmi_disable()
1558 * VP -> Mixer -> HDMI in hdmi_disable()
1563 mutex_unlock(&hdata->mutex); in hdmi_disable()
1564 cancel_delayed_work(&hdata->hotplug_work); in hdmi_disable()
1565 if (hdata->notifier) in hdmi_disable()
1566 cec_notifier_phys_addr_invalidate(hdata->notifier); in hdmi_disable()
1570 mutex_unlock(&hdata->mutex); in hdmi_disable()
1583 mutex_lock(&hdata->mutex); in hdmi_audio_shutdown()
1585 hdata->audio.mute = true; in hdmi_audio_shutdown()
1587 if (hdata->powered) in hdmi_audio_shutdown()
1590 mutex_unlock(&hdata->mutex); in hdmi_audio_shutdown()
1599 if (daifmt->fmt != HDMI_I2S || daifmt->bit_clk_inv || in hdmi_audio_hw_params()
1600 daifmt->frame_clk_inv || daifmt->bit_clk_provider || in hdmi_audio_hw_params()
1601 daifmt->frame_clk_provider) { in hdmi_audio_hw_params()
1603 daifmt->bit_clk_inv, daifmt->frame_clk_inv, in hdmi_audio_hw_params()
1604 daifmt->bit_clk_provider, in hdmi_audio_hw_params()
1605 daifmt->frame_clk_provider); in hdmi_audio_hw_params()
1606 return -EINVAL; in hdmi_audio_hw_params()
1609 mutex_lock(&hdata->mutex); in hdmi_audio_hw_params()
1611 hdata->audio.params = *params; in hdmi_audio_hw_params()
1613 if (hdata->powered) { in hdmi_audio_hw_params()
1618 mutex_unlock(&hdata->mutex); in hdmi_audio_hw_params()
1628 mutex_lock(&hdata->mutex); in hdmi_audio_mute()
1630 hdata->audio.mute = mute; in hdmi_audio_mute()
1632 if (hdata->powered) in hdmi_audio_mute()
1635 mutex_unlock(&hdata->mutex); in hdmi_audio_mute()
1644 struct drm_connector *connector = &hdata->connector; in hdmi_audio_get_eld()
1646 memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); in hdmi_audio_get_eld()
1664 .i2s = 1, in hdmi_register_audio_device()
1667 hdata->audio.pdev = platform_device_register_data( in hdmi_register_audio_device()
1668 hdata->dev, HDMI_CODEC_DRV_NAME, PLATFORM_DEVID_AUTO, in hdmi_register_audio_device()
1671 return PTR_ERR_OR_ZERO(hdata->audio.pdev); in hdmi_register_audio_device()
1680 if (hdata->drm_dev) in hdmi_hotplug_work_func()
1681 drm_helper_hpd_irq_event(hdata->drm_dev); in hdmi_hotplug_work_func()
1688 mod_delayed_work(system_wq, &hdata->hotplug_work, in hdmi_irq_thread()
1698 struct device *dev = hdata->dev; in hdmi_clks_get()
1701 for (i = 0; i < names->count; ++i) { in hdmi_clks_get()
1702 struct clk *clk = devm_clk_get(dev, names->data[i]); in hdmi_clks_get()
1708 names->data[i], ret); in hdmi_clks_get()
1721 const struct hdmi_driver_data *drv_data = hdata->drv_data; in hdmi_clk_init()
1722 int count = drv_data->clk_gates.count + drv_data->clk_muxes.count; in hdmi_clk_init()
1723 struct device *dev = hdata->dev; in hdmi_clk_init()
1732 return -ENOMEM; in hdmi_clk_init()
1734 hdata->clk_gates = clks; in hdmi_clk_init()
1735 hdata->clk_muxes = clks + drv_data->clk_gates.count; in hdmi_clk_init()
1737 ret = hdmi_clks_get(hdata, &drv_data->clk_gates, hdata->clk_gates); in hdmi_clk_init()
1741 return hdmi_clks_get(hdata, &drv_data->clk_muxes, hdata->clk_muxes); in hdmi_clk_init()
1749 mutex_lock(&hdata->mutex); in hdmiphy_clk_enable()
1756 mutex_unlock(&hdata->mutex); in hdmiphy_clk_enable()
1761 struct device *dev = hdata->dev; in hdmi_bridge_init()
1764 ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1); in hdmi_bridge_init()
1772 return -EINVAL; in hdmi_bridge_init()
1775 hdata->bridge = of_drm_find_bridge(np); in hdmi_bridge_init()
1778 if (!hdata->bridge) in hdmi_bridge_init()
1779 return -EPROBE_DEFER; in hdmi_bridge_init()
1786 struct device *dev = hdata->dev; in hdmi_resources_init()
1791 hdata->hpd_gpio = devm_gpiod_get(dev, "hpd", GPIOD_IN); in hdmi_resources_init()
1792 if (IS_ERR(hdata->hpd_gpio)) { in hdmi_resources_init()
1794 return PTR_ERR(hdata->hpd_gpio); in hdmi_resources_init()
1797 hdata->irq = gpiod_to_irq(hdata->hpd_gpio); in hdmi_resources_init()
1798 if (hdata->irq < 0) { in hdmi_resources_init()
1800 return hdata->irq; in hdmi_resources_init()
1812 hdata->regul_bulk[i].supply = supply[i]; in hdmi_resources_init()
1814 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), hdata->regul_bulk); in hdmi_resources_init()
1818 hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en"); in hdmi_resources_init()
1820 if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) in hdmi_resources_init()
1821 if (IS_ERR(hdata->reg_hdmi_en)) in hdmi_resources_init()
1822 return PTR_ERR(hdata->reg_hdmi_en); in hdmi_resources_init()
1829 .compatible = "samsung,exynos4210-hdmi",
1832 .compatible = "samsung,exynos4212-hdmi",
1835 .compatible = "samsung,exynos5420-hdmi",
1838 .compatible = "samsung,exynos5433-hdmi",
1850 struct drm_encoder *encoder = &hdata->encoder; in hdmi_bind()
1854 hdata->drm_dev = drm_dev; in hdmi_bind()
1856 hdata->phy_clk.enable = hdmiphy_clk_enable; in hdmi_bind()
1869 crtc->pipe_clk = &hdata->phy_clk; in hdmi_bind()
1893 const char *compatible_str = "samsung,exynos4210-hdmiddc"; in hdmi_get_ddc_adapter()
1901 np = of_parse_phandle(hdata->dev->of_node, "ddc", 0); in hdmi_get_ddc_adapter()
1904 DRM_DEV_ERROR(hdata->dev, in hdmi_get_ddc_adapter()
1906 return -ENODEV; in hdmi_get_ddc_adapter()
1914 return -EPROBE_DEFER; in hdmi_get_ddc_adapter()
1917 hdata->ddc_adpt = adpt; in hdmi_get_ddc_adapter()
1924 const char *compatible_str = "samsung,exynos4212-hdmiphy"; in hdmi_get_phy_io()
1929 np = of_parse_phandle(hdata->dev->of_node, "phy", 0); in hdmi_get_phy_io()
1931 DRM_DEV_ERROR(hdata->dev, in hdmi_get_phy_io()
1933 return -ENODEV; in hdmi_get_phy_io()
1937 if (hdata->drv_data->is_apb_phy) { in hdmi_get_phy_io()
1938 hdata->regs_hdmiphy = of_iomap(np, 0); in hdmi_get_phy_io()
1939 if (!hdata->regs_hdmiphy) { in hdmi_get_phy_io()
1940 DRM_DEV_ERROR(hdata->dev, in hdmi_get_phy_io()
1942 return -ENOMEM; in hdmi_get_phy_io()
1945 hdata->hdmiphy_port = of_find_i2c_device_by_node(np); in hdmi_get_phy_io()
1946 if (!hdata->hdmiphy_port) { in hdmi_get_phy_io()
1948 return -EPROBE_DEFER; in hdmi_get_phy_io()
1958 struct device *dev = &pdev->dev; in hdmi_probe()
1964 return -ENOMEM; in hdmi_probe()
1966 hdata->drv_data = of_device_get_match_data(dev); in hdmi_probe()
1970 hdata->dev = dev; in hdmi_probe()
1972 mutex_init(&hdata->mutex); in hdmi_probe()
1976 if (ret != -EPROBE_DEFER) in hdmi_probe()
1981 hdata->regs = devm_platform_ioremap_resource(pdev, 0); in hdmi_probe()
1982 if (IS_ERR(hdata->regs)) { in hdmi_probe()
1983 ret = PTR_ERR(hdata->regs); in hdmi_probe()
1995 INIT_DELAYED_WORK(&hdata->hotplug_work, hdmi_hotplug_work_func); in hdmi_probe()
1997 ret = devm_request_threaded_irq(dev, hdata->irq, NULL, in hdmi_probe()
2006 hdata->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, in hdmi_probe()
2007 "samsung,syscon-phandle"); in hdmi_probe()
2008 if (IS_ERR(hdata->pmureg)) { in hdmi_probe()
2010 ret = -EPROBE_DEFER; in hdmi_probe()
2014 if (hdata->drv_data->has_sysreg) { in hdmi_probe()
2015 hdata->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, in hdmi_probe()
2016 "samsung,sysreg-phandle"); in hdmi_probe()
2017 if (IS_ERR(hdata->sysreg)) { in hdmi_probe()
2019 ret = -EPROBE_DEFER; in hdmi_probe()
2024 if (!IS_ERR(hdata->reg_hdmi_en)) { in hdmi_probe()
2025 ret = regulator_enable(hdata->reg_hdmi_en); in hdmi_probe()
2028 "failed to enable hdmi-en regulator\n"); in hdmi_probe()
2035 audio_infoframe = &hdata->audio.infoframe; in hdmi_probe()
2037 audio_infoframe->coding_type = HDMI_AUDIO_CODING_TYPE_STREAM; in hdmi_probe()
2038 audio_infoframe->sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM; in hdmi_probe()
2039 audio_infoframe->sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM; in hdmi_probe()
2040 audio_infoframe->channels = 2; in hdmi_probe()
2046 ret = component_add(&pdev->dev, &hdmi_component_ops); in hdmi_probe()
2053 platform_device_unregister(hdata->audio.pdev); in hdmi_probe()
2057 if (!IS_ERR(hdata->reg_hdmi_en)) in hdmi_probe()
2058 regulator_disable(hdata->reg_hdmi_en); in hdmi_probe()
2060 if (hdata->hdmiphy_port) in hdmi_probe()
2061 put_device(&hdata->hdmiphy_port->dev); in hdmi_probe()
2062 if (hdata->regs_hdmiphy) in hdmi_probe()
2063 iounmap(hdata->regs_hdmiphy); in hdmi_probe()
2065 put_device(&hdata->ddc_adpt->dev); in hdmi_probe()
2074 cancel_delayed_work_sync(&hdata->hotplug_work); in hdmi_remove()
2076 component_del(&pdev->dev, &hdmi_component_ops); in hdmi_remove()
2077 platform_device_unregister(hdata->audio.pdev); in hdmi_remove()
2079 pm_runtime_disable(&pdev->dev); in hdmi_remove()
2081 if (!IS_ERR(hdata->reg_hdmi_en)) in hdmi_remove()
2082 regulator_disable(hdata->reg_hdmi_en); in hdmi_remove()
2084 if (hdata->hdmiphy_port) in hdmi_remove()
2085 put_device(&hdata->hdmiphy_port->dev); in hdmi_remove()
2087 if (hdata->regs_hdmiphy) in hdmi_remove()
2088 iounmap(hdata->regs_hdmiphy); in hdmi_remove()
2090 put_device(&hdata->ddc_adpt->dev); in hdmi_remove()
2092 mutex_destroy(&hdata->mutex); in hdmi_remove()
2126 .name = "exynos-hdmi",