Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/tegra: hdmi: Add cec-notifier support

In order to support CEC the HDMI driver has to inform the CEC driver
whenever the physical address changes. So when the EDID is read the
CEC driver has to be informed and whenever the hotplug detect goes
away.

This is done through the cec-notifier framework.

The link between the HDMI driver and the CEC driver is done through
the hdmi-phandle property in the tegra-cec node in the device tree.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Hans Verkuil and committed by
Thierry Reding
fb83be88 a2f2f740

+19
+1
drivers/gpu/drm/tegra/Kconfig
··· 9 9 select DRM_PANEL 10 10 select TEGRA_HOST1X 11 11 select IOMMU_IOVA if IOMMU_SUPPORT 12 + select CEC_CORE if CEC_NOTIFIER 12 13 help 13 14 Choose this option if you have an NVIDIA Tegra SoC. 14 15
+3
drivers/gpu/drm/tegra/drm.h
··· 119 119 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, 120 120 dma_addr_t iova); 121 121 122 + struct cec_notifier; 123 + 122 124 struct tegra_output { 123 125 struct device_node *of_node; 124 126 struct device *dev; ··· 128 126 struct drm_panel *panel; 129 127 struct i2c_adapter *ddc; 130 128 const struct edid *edid; 129 + struct cec_notifier *notifier; 131 130 unsigned int hpd_irq; 132 131 int hpd_gpio; 133 132 enum of_gpio_flags hpd_gpio_flags;
+9
drivers/gpu/drm/tegra/hdmi.c
··· 22 22 23 23 #include <sound/hda_verbs.h> 24 24 25 + #include <media/cec-notifier.h> 26 + 25 27 #include "hdmi.h" 26 28 #include "drm.h" 27 29 #include "dc.h" ··· 1723 1721 return PTR_ERR(hdmi->vdd); 1724 1722 } 1725 1723 1724 + hdmi->output.notifier = cec_notifier_get(&pdev->dev); 1725 + if (hdmi->output.notifier == NULL) 1726 + return -ENOMEM; 1727 + 1726 1728 hdmi->output.dev = &pdev->dev; 1727 1729 1728 1730 err = tegra_output_probe(&hdmi->output); ··· 1784 1778 } 1785 1779 1786 1780 tegra_output_remove(&hdmi->output); 1781 + 1782 + if (hdmi->output.notifier) 1783 + cec_notifier_put(hdmi->output.notifier); 1787 1784 1788 1785 return 0; 1789 1786 }
+6
drivers/gpu/drm/tegra/output.c
··· 11 11 #include <drm/drm_panel.h> 12 12 #include "drm.h" 13 13 14 + #include <media/cec-notifier.h> 15 + 14 16 int tegra_output_connector_get_modes(struct drm_connector *connector) 15 17 { 16 18 struct tegra_output *output = connector_to_output(connector); ··· 34 32 else if (output->ddc) 35 33 edid = drm_get_edid(connector, output->ddc); 36 34 35 + cec_notifier_set_phys_addr_from_edid(output->notifier, edid); 37 36 drm_mode_connector_update_edid_property(connector, edid); 38 37 39 38 if (edid) { ··· 70 67 else 71 68 status = connector_status_connected; 72 69 } 70 + 71 + if (status != connector_status_connected) 72 + cec_notifier_phys_addr_invalidate(output->notifier); 73 73 74 74 return status; 75 75 }