.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2011 Samsung Electronics Co.Ltd |
---|
3 | 4 | * Authors: |
---|
.. | .. |
---|
6 | 7 | * Joonyoung Shim <jy0922.shim@samsung.com> |
---|
7 | 8 | * |
---|
8 | 9 | * Based on drivers/media/video/s5p-tv/hdmi_drv.c |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify it |
---|
11 | | - * under the terms of the GNU General Public License as published by the |
---|
12 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
13 | | - * option) any later version. |
---|
14 | | - * |
---|
15 | 10 | */ |
---|
16 | 11 | |
---|
17 | | -#include <drm/drmP.h> |
---|
18 | | -#include <drm/drm_edid.h> |
---|
19 | | -#include <drm/drm_crtc_helper.h> |
---|
20 | | -#include <drm/drm_atomic_helper.h> |
---|
21 | | - |
---|
22 | | -#include "regs-hdmi.h" |
---|
23 | | - |
---|
24 | | -#include <linux/kernel.h> |
---|
25 | | -#include <linux/wait.h> |
---|
26 | | -#include <linux/i2c.h> |
---|
27 | | -#include <linux/platform_device.h> |
---|
28 | | -#include <linux/interrupt.h> |
---|
29 | | -#include <linux/irq.h> |
---|
30 | | -#include <linux/delay.h> |
---|
31 | | -#include <linux/pm_runtime.h> |
---|
| 12 | +#include <drm/exynos_drm.h> |
---|
32 | 13 | #include <linux/clk.h> |
---|
| 14 | +#include <linux/component.h> |
---|
| 15 | +#include <linux/delay.h> |
---|
33 | 16 | #include <linux/gpio/consumer.h> |
---|
34 | | -#include <linux/regulator/consumer.h> |
---|
| 17 | +#include <linux/hdmi.h> |
---|
| 18 | +#include <linux/i2c.h> |
---|
| 19 | +#include <linux/interrupt.h> |
---|
35 | 20 | #include <linux/io.h> |
---|
| 21 | +#include <linux/irq.h> |
---|
| 22 | +#include <linux/kernel.h> |
---|
| 23 | +#include <linux/mfd/syscon.h> |
---|
36 | 24 | #include <linux/of_address.h> |
---|
37 | 25 | #include <linux/of_device.h> |
---|
38 | 26 | #include <linux/of_graph.h> |
---|
39 | | -#include <linux/hdmi.h> |
---|
40 | | -#include <linux/component.h> |
---|
41 | | -#include <linux/mfd/syscon.h> |
---|
| 27 | +#include <linux/platform_device.h> |
---|
| 28 | +#include <linux/pm_runtime.h> |
---|
42 | 29 | #include <linux/regmap.h> |
---|
43 | | -#include <sound/hdmi-codec.h> |
---|
44 | | -#include <drm/exynos_drm.h> |
---|
| 30 | +#include <linux/regulator/consumer.h> |
---|
| 31 | +#include <linux/wait.h> |
---|
45 | 32 | |
---|
| 33 | +#include <sound/hdmi-codec.h> |
---|
46 | 34 | #include <media/cec-notifier.h> |
---|
47 | 35 | |
---|
| 36 | +#include <drm/drm_atomic_helper.h> |
---|
| 37 | +#include <drm/drm_bridge.h> |
---|
| 38 | +#include <drm/drm_edid.h> |
---|
| 39 | +#include <drm/drm_print.h> |
---|
| 40 | +#include <drm/drm_probe_helper.h> |
---|
| 41 | +#include <drm/drm_simple_kms_helper.h> |
---|
| 42 | + |
---|
48 | 43 | #include "exynos_drm_crtc.h" |
---|
| 44 | +#include "regs-hdmi.h" |
---|
49 | 45 | |
---|
50 | 46 | #define HOTPLUG_DEBOUNCE_MS 1100 |
---|
51 | 47 | |
---|
.. | .. |
---|
819 | 815 | return; |
---|
820 | 816 | } |
---|
821 | 817 | |
---|
822 | | - ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi, m, false); |
---|
| 818 | + ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi, |
---|
| 819 | + &hdata->connector, m); |
---|
823 | 820 | if (!ret) |
---|
824 | 821 | ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf)); |
---|
825 | 822 | if (ret > 0) { |
---|
.. | .. |
---|
857 | 854 | |
---|
858 | 855 | static void hdmi_connector_destroy(struct drm_connector *connector) |
---|
859 | 856 | { |
---|
| 857 | + struct hdmi_context *hdata = connector_to_hdmi(connector); |
---|
| 858 | + |
---|
| 859 | + cec_notifier_conn_unregister(hdata->notifier); |
---|
| 860 | + |
---|
860 | 861 | drm_connector_unregister(connector); |
---|
861 | 862 | drm_connector_cleanup(connector); |
---|
862 | 863 | } |
---|
.. | .. |
---|
884 | 885 | return -ENODEV; |
---|
885 | 886 | |
---|
886 | 887 | hdata->dvi_mode = !drm_detect_hdmi_monitor(edid); |
---|
887 | | - DRM_DEBUG_KMS("%s : width[%d] x height[%d]\n", |
---|
888 | | - (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), |
---|
889 | | - edid->width_cm, edid->height_cm); |
---|
| 888 | + DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n", |
---|
| 889 | + (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), |
---|
| 890 | + edid->width_cm, edid->height_cm); |
---|
890 | 891 | |
---|
891 | 892 | drm_connector_update_edid_property(connector, edid); |
---|
892 | 893 | cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid); |
---|
.. | .. |
---|
907 | 908 | if (confs->data[i].pixel_clock == pixel_clock) |
---|
908 | 909 | return i; |
---|
909 | 910 | |
---|
910 | | - DRM_DEBUG_KMS("Could not find phy config for %d\n", pixel_clock); |
---|
| 911 | + DRM_DEV_DEBUG_KMS(hdata->dev, "Could not find phy config for %d\n", |
---|
| 912 | + pixel_clock); |
---|
911 | 913 | return -EINVAL; |
---|
912 | 914 | } |
---|
913 | 915 | |
---|
.. | .. |
---|
917 | 919 | struct hdmi_context *hdata = connector_to_hdmi(connector); |
---|
918 | 920 | int ret; |
---|
919 | 921 | |
---|
920 | | - DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", |
---|
921 | | - mode->hdisplay, mode->vdisplay, mode->vrefresh, |
---|
922 | | - (mode->flags & DRM_MODE_FLAG_INTERLACE) ? true : |
---|
923 | | - false, mode->clock * 1000); |
---|
| 922 | + DRM_DEV_DEBUG_KMS(hdata->dev, |
---|
| 923 | + "xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", |
---|
| 924 | + mode->hdisplay, mode->vdisplay, |
---|
| 925 | + drm_mode_vrefresh(mode), |
---|
| 926 | + (mode->flags & DRM_MODE_FLAG_INTERLACE) ? true : |
---|
| 927 | + false, mode->clock * 1000); |
---|
924 | 928 | |
---|
925 | 929 | ret = hdmi_find_phy_conf(hdata, mode->clock * 1000); |
---|
926 | 930 | if (ret < 0) |
---|
.. | .. |
---|
938 | 942 | { |
---|
939 | 943 | struct hdmi_context *hdata = encoder_to_hdmi(encoder); |
---|
940 | 944 | struct drm_connector *connector = &hdata->connector; |
---|
| 945 | + struct cec_connector_info conn_info; |
---|
941 | 946 | int ret; |
---|
942 | 947 | |
---|
943 | 948 | connector->interlace_allowed = true; |
---|
944 | 949 | connector->polled = DRM_CONNECTOR_POLL_HPD; |
---|
945 | 950 | |
---|
946 | | - ret = drm_connector_init(hdata->drm_dev, connector, |
---|
947 | | - &hdmi_connector_funcs, DRM_MODE_CONNECTOR_HDMIA); |
---|
| 951 | + ret = drm_connector_init_with_ddc(hdata->drm_dev, connector, |
---|
| 952 | + &hdmi_connector_funcs, |
---|
| 953 | + DRM_MODE_CONNECTOR_HDMIA, |
---|
| 954 | + hdata->ddc_adpt); |
---|
948 | 955 | if (ret) { |
---|
949 | | - DRM_ERROR("Failed to initialize connector with drm\n"); |
---|
| 956 | + DRM_DEV_ERROR(hdata->dev, |
---|
| 957 | + "Failed to initialize connector with drm\n"); |
---|
950 | 958 | return ret; |
---|
951 | 959 | } |
---|
952 | 960 | |
---|
.. | .. |
---|
954 | 962 | drm_connector_attach_encoder(connector, encoder); |
---|
955 | 963 | |
---|
956 | 964 | if (hdata->bridge) { |
---|
957 | | - ret = drm_bridge_attach(encoder, hdata->bridge, NULL); |
---|
| 965 | + ret = drm_bridge_attach(encoder, hdata->bridge, NULL, 0); |
---|
958 | 966 | if (ret) |
---|
959 | | - DRM_ERROR("Failed to attach bridge\n"); |
---|
| 967 | + DRM_DEV_ERROR(hdata->dev, "Failed to attach bridge\n"); |
---|
| 968 | + } |
---|
| 969 | + |
---|
| 970 | + cec_fill_conn_info_from_drm(&conn_info, connector); |
---|
| 971 | + |
---|
| 972 | + hdata->notifier = cec_notifier_conn_register(hdata->dev, NULL, |
---|
| 973 | + &conn_info); |
---|
| 974 | + if (!hdata->notifier) { |
---|
| 975 | + ret = -ENOMEM; |
---|
| 976 | + DRM_DEV_ERROR(hdata->dev, "Failed to allocate CEC notifier\n"); |
---|
960 | 977 | } |
---|
961 | 978 | |
---|
962 | 979 | return ret; |
---|
.. | .. |
---|
1001 | 1018 | DRM_INFO("desired mode doesn't exist so\n"); |
---|
1002 | 1019 | DRM_INFO("use the most suitable mode among modes.\n"); |
---|
1003 | 1020 | |
---|
1004 | | - DRM_DEBUG_KMS("Adjusted Mode: [%d]x[%d] [%d]Hz\n", |
---|
1005 | | - m->hdisplay, m->vdisplay, m->vrefresh); |
---|
| 1021 | + DRM_DEV_DEBUG_KMS(dev->dev, |
---|
| 1022 | + "Adjusted Mode: [%d]x[%d] [%d]Hz\n", |
---|
| 1023 | + m->hdisplay, m->vdisplay, |
---|
| 1024 | + drm_mode_vrefresh(m)); |
---|
1006 | 1025 | |
---|
1007 | 1026 | drm_mode_copy(adjusted_mode, m); |
---|
1008 | 1027 | break; |
---|
.. | .. |
---|
1168 | 1187 | u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS); |
---|
1169 | 1188 | |
---|
1170 | 1189 | if (val & HDMI_PHY_STATUS_READY) { |
---|
1171 | | - DRM_DEBUG_KMS("PLL stabilized after %d tries\n", tries); |
---|
| 1190 | + DRM_DEV_DEBUG_KMS(hdata->dev, |
---|
| 1191 | + "PLL stabilized after %d tries\n", |
---|
| 1192 | + tries); |
---|
1172 | 1193 | return; |
---|
1173 | 1194 | } |
---|
1174 | 1195 | usleep_range(10, 20); |
---|
1175 | 1196 | } |
---|
1176 | 1197 | |
---|
1177 | | - DRM_ERROR("PLL could not reach steady state\n"); |
---|
| 1198 | + DRM_DEV_ERROR(hdata->dev, "PLL could not reach steady state\n"); |
---|
1178 | 1199 | } |
---|
1179 | 1200 | |
---|
1180 | 1201 | static void hdmi_v13_mode_apply(struct hdmi_context *hdata) |
---|
.. | .. |
---|
1410 | 1431 | |
---|
1411 | 1432 | ret = hdmi_find_phy_conf(hdata, m->clock * 1000); |
---|
1412 | 1433 | if (ret < 0) { |
---|
1413 | | - DRM_ERROR("failed to find hdmiphy conf\n"); |
---|
| 1434 | + DRM_DEV_ERROR(hdata->dev, "failed to find hdmiphy conf\n"); |
---|
1414 | 1435 | return; |
---|
1415 | 1436 | } |
---|
1416 | 1437 | phy_conf = hdata->drv_data->phy_confs.data[ret].conf; |
---|
.. | .. |
---|
1422 | 1443 | hdmiphy_enable_mode_set(hdata, true); |
---|
1423 | 1444 | ret = hdmiphy_reg_write_buf(hdata, 0, phy_conf, 32); |
---|
1424 | 1445 | if (ret) { |
---|
1425 | | - DRM_ERROR("failed to configure hdmiphy\n"); |
---|
| 1446 | + DRM_DEV_ERROR(hdata->dev, "failed to configure hdmiphy\n"); |
---|
1426 | 1447 | return; |
---|
1427 | 1448 | } |
---|
1428 | 1449 | hdmiphy_enable_mode_set(hdata, false); |
---|
.. | .. |
---|
1459 | 1480 | pm_runtime_get_sync(hdata->dev); |
---|
1460 | 1481 | |
---|
1461 | 1482 | if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk)) |
---|
1462 | | - DRM_DEBUG_KMS("failed to enable regulator bulk\n"); |
---|
| 1483 | + DRM_DEV_DEBUG_KMS(hdata->dev, |
---|
| 1484 | + "failed to enable regulator bulk\n"); |
---|
1463 | 1485 | |
---|
1464 | 1486 | regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL, |
---|
1465 | 1487 | PMU_HDMI_PHY_ENABLE_BIT, 1); |
---|
.. | .. |
---|
1525 | 1547 | */ |
---|
1526 | 1548 | mutex_unlock(&hdata->mutex); |
---|
1527 | 1549 | cancel_delayed_work(&hdata->hotplug_work); |
---|
1528 | | - cec_notifier_set_phys_addr(hdata->notifier, |
---|
1529 | | - CEC_PHYS_ADDR_INVALID); |
---|
| 1550 | + if (hdata->notifier) |
---|
| 1551 | + cec_notifier_phys_addr_invalidate(hdata->notifier); |
---|
1530 | 1552 | return; |
---|
1531 | 1553 | } |
---|
1532 | 1554 | |
---|
.. | .. |
---|
1537 | 1559 | .mode_fixup = hdmi_mode_fixup, |
---|
1538 | 1560 | .enable = hdmi_enable, |
---|
1539 | 1561 | .disable = hdmi_disable, |
---|
1540 | | -}; |
---|
1541 | | - |
---|
1542 | | -static const struct drm_encoder_funcs exynos_hdmi_encoder_funcs = { |
---|
1543 | | - .destroy = drm_encoder_cleanup, |
---|
1544 | 1562 | }; |
---|
1545 | 1563 | |
---|
1546 | 1564 | static void hdmi_audio_shutdown(struct device *dev, void *data) |
---|
.. | .. |
---|
1587 | 1605 | return 0; |
---|
1588 | 1606 | } |
---|
1589 | 1607 | |
---|
1590 | | -static int hdmi_audio_digital_mute(struct device *dev, void *data, bool mute) |
---|
| 1608 | +static int hdmi_audio_mute(struct device *dev, void *data, |
---|
| 1609 | + bool mute, int direction) |
---|
1591 | 1610 | { |
---|
1592 | 1611 | struct hdmi_context *hdata = dev_get_drvdata(dev); |
---|
1593 | 1612 | |
---|
.. | .. |
---|
1617 | 1636 | static const struct hdmi_codec_ops audio_codec_ops = { |
---|
1618 | 1637 | .hw_params = hdmi_audio_hw_params, |
---|
1619 | 1638 | .audio_shutdown = hdmi_audio_shutdown, |
---|
1620 | | - .digital_mute = hdmi_audio_digital_mute, |
---|
| 1639 | + .mute_stream = hdmi_audio_mute, |
---|
1621 | 1640 | .get_eld = hdmi_audio_get_eld, |
---|
| 1641 | + .no_capture_mute = 1, |
---|
1622 | 1642 | }; |
---|
1623 | 1643 | |
---|
1624 | 1644 | static int hdmi_register_audio_device(struct hdmi_context *hdata) |
---|
.. | .. |
---|
1733 | 1753 | np = of_graph_get_remote_port_parent(ep); |
---|
1734 | 1754 | of_node_put(ep); |
---|
1735 | 1755 | if (!np) { |
---|
1736 | | - DRM_ERROR("failed to get remote port parent"); |
---|
| 1756 | + DRM_DEV_ERROR(dev, "failed to get remote port parent"); |
---|
1737 | 1757 | return -EINVAL; |
---|
1738 | 1758 | } |
---|
1739 | 1759 | |
---|
.. | .. |
---|
1751 | 1771 | struct device *dev = hdata->dev; |
---|
1752 | 1772 | int i, ret; |
---|
1753 | 1773 | |
---|
1754 | | - DRM_DEBUG_KMS("HDMI resource init\n"); |
---|
| 1774 | + DRM_DEV_DEBUG_KMS(dev, "HDMI resource init\n"); |
---|
1755 | 1775 | |
---|
1756 | 1776 | hdata->hpd_gpio = devm_gpiod_get(dev, "hpd", GPIOD_IN); |
---|
1757 | 1777 | if (IS_ERR(hdata->hpd_gpio)) { |
---|
1758 | | - DRM_ERROR("cannot get hpd gpio property\n"); |
---|
| 1778 | + DRM_DEV_ERROR(dev, "cannot get hpd gpio property\n"); |
---|
1759 | 1779 | return PTR_ERR(hdata->hpd_gpio); |
---|
1760 | 1780 | } |
---|
1761 | 1781 | |
---|
1762 | 1782 | hdata->irq = gpiod_to_irq(hdata->hpd_gpio); |
---|
1763 | 1783 | if (hdata->irq < 0) { |
---|
1764 | | - DRM_ERROR("failed to get GPIO irq\n"); |
---|
| 1784 | + DRM_DEV_ERROR(dev, "failed to get GPIO irq\n"); |
---|
1765 | 1785 | return hdata->irq; |
---|
1766 | 1786 | } |
---|
1767 | 1787 | |
---|
.. | .. |
---|
1777 | 1797 | hdata->regul_bulk[i].supply = supply[i]; |
---|
1778 | 1798 | |
---|
1779 | 1799 | ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), hdata->regul_bulk); |
---|
1780 | | - if (ret) { |
---|
1781 | | - if (ret != -EPROBE_DEFER) |
---|
1782 | | - DRM_ERROR("failed to get regulators\n"); |
---|
1783 | | - return ret; |
---|
1784 | | - } |
---|
| 1800 | + if (ret) |
---|
| 1801 | + return dev_err_probe(dev, ret, "failed to get regulators\n"); |
---|
1785 | 1802 | |
---|
1786 | 1803 | hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en"); |
---|
1787 | 1804 | |
---|
1788 | | - if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) { |
---|
| 1805 | + if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) |
---|
1789 | 1806 | if (IS_ERR(hdata->reg_hdmi_en)) |
---|
1790 | 1807 | return PTR_ERR(hdata->reg_hdmi_en); |
---|
1791 | | - |
---|
1792 | | - ret = regulator_enable(hdata->reg_hdmi_en); |
---|
1793 | | - if (ret) { |
---|
1794 | | - DRM_ERROR("failed to enable hdmi-en regulator\n"); |
---|
1795 | | - return ret; |
---|
1796 | | - } |
---|
1797 | | - } |
---|
1798 | 1808 | |
---|
1799 | 1809 | return hdmi_bridge_init(hdata); |
---|
1800 | 1810 | } |
---|
.. | .. |
---|
1830 | 1840 | |
---|
1831 | 1841 | hdata->phy_clk.enable = hdmiphy_clk_enable; |
---|
1832 | 1842 | |
---|
1833 | | - drm_encoder_init(drm_dev, encoder, &exynos_hdmi_encoder_funcs, |
---|
1834 | | - DRM_MODE_ENCODER_TMDS, NULL); |
---|
| 1843 | + drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); |
---|
1835 | 1844 | |
---|
1836 | 1845 | drm_encoder_helper_add(encoder, &exynos_hdmi_encoder_helper_funcs); |
---|
1837 | 1846 | |
---|
.. | .. |
---|
1844 | 1853 | |
---|
1845 | 1854 | ret = hdmi_create_connector(encoder); |
---|
1846 | 1855 | if (ret) { |
---|
1847 | | - DRM_ERROR("failed to create connector ret = %d\n", ret); |
---|
| 1856 | + DRM_DEV_ERROR(dev, "failed to create connector ret = %d\n", |
---|
| 1857 | + ret); |
---|
1848 | 1858 | drm_encoder_cleanup(encoder); |
---|
1849 | 1859 | return ret; |
---|
1850 | 1860 | } |
---|
.. | .. |
---|
1874 | 1884 | np = of_parse_phandle(hdata->dev->of_node, "ddc", 0); |
---|
1875 | 1885 | |
---|
1876 | 1886 | if (!np) { |
---|
1877 | | - DRM_ERROR("Failed to find ddc node in device tree\n"); |
---|
| 1887 | + DRM_DEV_ERROR(hdata->dev, |
---|
| 1888 | + "Failed to find ddc node in device tree\n"); |
---|
1878 | 1889 | return -ENODEV; |
---|
1879 | 1890 | } |
---|
1880 | 1891 | |
---|
.. | .. |
---|
1901 | 1912 | if (!np) { |
---|
1902 | 1913 | np = of_parse_phandle(hdata->dev->of_node, "phy", 0); |
---|
1903 | 1914 | if (!np) { |
---|
1904 | | - DRM_ERROR("Failed to find hdmiphy node in device tree\n"); |
---|
| 1915 | + DRM_DEV_ERROR(hdata->dev, |
---|
| 1916 | + "Failed to find hdmiphy node in device tree\n"); |
---|
1905 | 1917 | return -ENODEV; |
---|
1906 | 1918 | } |
---|
1907 | 1919 | } |
---|
.. | .. |
---|
1909 | 1921 | if (hdata->drv_data->is_apb_phy) { |
---|
1910 | 1922 | hdata->regs_hdmiphy = of_iomap(np, 0); |
---|
1911 | 1923 | if (!hdata->regs_hdmiphy) { |
---|
1912 | | - DRM_ERROR("failed to ioremap hdmi phy\n"); |
---|
| 1924 | + DRM_DEV_ERROR(hdata->dev, |
---|
| 1925 | + "failed to ioremap hdmi phy\n"); |
---|
1913 | 1926 | ret = -ENOMEM; |
---|
1914 | 1927 | goto out; |
---|
1915 | 1928 | } |
---|
.. | .. |
---|
1950 | 1963 | ret = hdmi_resources_init(hdata); |
---|
1951 | 1964 | if (ret) { |
---|
1952 | 1965 | if (ret != -EPROBE_DEFER) |
---|
1953 | | - DRM_ERROR("hdmi_resources_init failed\n"); |
---|
| 1966 | + DRM_DEV_ERROR(dev, "hdmi_resources_init failed\n"); |
---|
1954 | 1967 | return ret; |
---|
1955 | 1968 | } |
---|
1956 | 1969 | |
---|
.. | .. |
---|
1976 | 1989 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
---|
1977 | 1990 | "hdmi", hdata); |
---|
1978 | 1991 | if (ret) { |
---|
1979 | | - DRM_ERROR("failed to register hdmi interrupt\n"); |
---|
| 1992 | + DRM_DEV_ERROR(dev, "failed to register hdmi interrupt\n"); |
---|
1980 | 1993 | goto err_hdmiphy; |
---|
1981 | 1994 | } |
---|
1982 | 1995 | |
---|
1983 | 1996 | hdata->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, |
---|
1984 | 1997 | "samsung,syscon-phandle"); |
---|
1985 | 1998 | if (IS_ERR(hdata->pmureg)) { |
---|
1986 | | - DRM_ERROR("syscon regmap lookup failed.\n"); |
---|
| 1999 | + DRM_DEV_ERROR(dev, "syscon regmap lookup failed.\n"); |
---|
1987 | 2000 | ret = -EPROBE_DEFER; |
---|
1988 | 2001 | goto err_hdmiphy; |
---|
1989 | 2002 | } |
---|
.. | .. |
---|
1992 | 2005 | hdata->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, |
---|
1993 | 2006 | "samsung,sysreg-phandle"); |
---|
1994 | 2007 | if (IS_ERR(hdata->sysreg)) { |
---|
1995 | | - DRM_ERROR("sysreg regmap lookup failed.\n"); |
---|
| 2008 | + DRM_DEV_ERROR(dev, "sysreg regmap lookup failed.\n"); |
---|
1996 | 2009 | ret = -EPROBE_DEFER; |
---|
1997 | 2010 | goto err_hdmiphy; |
---|
1998 | 2011 | } |
---|
1999 | 2012 | } |
---|
2000 | 2013 | |
---|
2001 | | - hdata->notifier = cec_notifier_get(&pdev->dev); |
---|
2002 | | - if (hdata->notifier == NULL) { |
---|
2003 | | - ret = -ENOMEM; |
---|
2004 | | - goto err_hdmiphy; |
---|
| 2014 | + if (!IS_ERR(hdata->reg_hdmi_en)) { |
---|
| 2015 | + ret = regulator_enable(hdata->reg_hdmi_en); |
---|
| 2016 | + if (ret) { |
---|
| 2017 | + DRM_DEV_ERROR(dev, |
---|
| 2018 | + "failed to enable hdmi-en regulator\n"); |
---|
| 2019 | + goto err_hdmiphy; |
---|
| 2020 | + } |
---|
2005 | 2021 | } |
---|
2006 | 2022 | |
---|
2007 | 2023 | pm_runtime_enable(dev); |
---|
.. | .. |
---|
2015 | 2031 | |
---|
2016 | 2032 | ret = hdmi_register_audio_device(hdata); |
---|
2017 | 2033 | if (ret) |
---|
2018 | | - goto err_notifier_put; |
---|
| 2034 | + goto err_rpm_disable; |
---|
2019 | 2035 | |
---|
2020 | 2036 | ret = component_add(&pdev->dev, &hdmi_component_ops); |
---|
2021 | 2037 | if (ret) |
---|
.. | .. |
---|
2026 | 2042 | err_unregister_audio: |
---|
2027 | 2043 | platform_device_unregister(hdata->audio.pdev); |
---|
2028 | 2044 | |
---|
2029 | | -err_notifier_put: |
---|
2030 | | - cec_notifier_put(hdata->notifier); |
---|
| 2045 | +err_rpm_disable: |
---|
2031 | 2046 | pm_runtime_disable(dev); |
---|
2032 | | - |
---|
| 2047 | + if (!IS_ERR(hdata->reg_hdmi_en)) |
---|
| 2048 | + regulator_disable(hdata->reg_hdmi_en); |
---|
2033 | 2049 | err_hdmiphy: |
---|
2034 | 2050 | if (hdata->hdmiphy_port) |
---|
2035 | 2051 | put_device(&hdata->hdmiphy_port->dev); |
---|
.. | .. |
---|
2046 | 2062 | struct hdmi_context *hdata = platform_get_drvdata(pdev); |
---|
2047 | 2063 | |
---|
2048 | 2064 | cancel_delayed_work_sync(&hdata->hotplug_work); |
---|
2049 | | - cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); |
---|
2050 | 2065 | |
---|
2051 | 2066 | component_del(&pdev->dev, &hdmi_component_ops); |
---|
2052 | 2067 | platform_device_unregister(hdata->audio.pdev); |
---|
2053 | 2068 | |
---|
2054 | | - cec_notifier_put(hdata->notifier); |
---|
2055 | 2069 | pm_runtime_disable(&pdev->dev); |
---|
2056 | 2070 | |
---|
2057 | 2071 | if (!IS_ERR(hdata->reg_hdmi_en)) |
---|