aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-09-11 08:29:52 -0400
committerThierry Reding <treding@nvidia.com>2017-10-20 08:19:54 -0400
commitfb83be8873909ba7c089d1c5cb72873cc2cce7d1 (patch)
tree1e20d25f0278a82b32780ca998861257edfde498
parenta2f2f7403e1ea192ce79584d7050c46e455409dd (diff)
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>
-rw-r--r--drivers/gpu/drm/tegra/Kconfig1
-rw-r--r--drivers/gpu/drm/tegra/drm.h3
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c9
-rw-r--r--drivers/gpu/drm/tegra/output.c6
4 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
index dc58ab140151..cf54847a8bd1 100644
--- a/drivers/gpu/drm/tegra/Kconfig
+++ b/drivers/gpu/drm/tegra/Kconfig
@@ -9,6 +9,7 @@ config DRM_TEGRA
9 select DRM_PANEL 9 select DRM_PANEL
10 select TEGRA_HOST1X 10 select TEGRA_HOST1X
11 select IOMMU_IOVA if IOMMU_SUPPORT 11 select IOMMU_IOVA if IOMMU_SUPPORT
12 select CEC_CORE if CEC_NOTIFIER
12 help 13 help
13 Choose this option if you have an NVIDIA Tegra SoC. 14 Choose this option if you have an NVIDIA Tegra SoC.
14 15
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 9bb6e8ebe40c..ddae331ad8b6 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -119,6 +119,8 @@ void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *iova);
119void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, 119void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt,
120 dma_addr_t iova); 120 dma_addr_t iova);
121 121
122struct cec_notifier;
123
122struct tegra_output { 124struct tegra_output {
123 struct device_node *of_node; 125 struct device_node *of_node;
124 struct device *dev; 126 struct device *dev;
@@ -126,6 +128,7 @@ struct tegra_output {
126 struct drm_panel *panel; 128 struct drm_panel *panel;
127 struct i2c_adapter *ddc; 129 struct i2c_adapter *ddc;
128 const struct edid *edid; 130 const struct edid *edid;
131 struct cec_notifier *notifier;
129 unsigned int hpd_irq; 132 unsigned int hpd_irq;
130 int hpd_gpio; 133 int hpd_gpio;
131 enum of_gpio_flags hpd_gpio_flags; 134 enum of_gpio_flags hpd_gpio_flags;
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index a4e9c769fc7a..6434b3d3d1ba 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -22,6 +22,8 @@
22 22
23#include <sound/hda_verbs.h> 23#include <sound/hda_verbs.h>
24 24
25#include <media/cec-notifier.h>
26
25#include "hdmi.h" 27#include "hdmi.h"
26#include "drm.h" 28#include "drm.h"
27#include "dc.h" 29#include "dc.h"
@@ -1721,6 +1723,10 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
1721 return PTR_ERR(hdmi->vdd); 1723 return PTR_ERR(hdmi->vdd);
1722 } 1724 }
1723 1725
1726 hdmi->output.notifier = cec_notifier_get(&pdev->dev);
1727 if (hdmi->output.notifier == NULL)
1728 return -ENOMEM;
1729
1724 hdmi->output.dev = &pdev->dev; 1730 hdmi->output.dev = &pdev->dev;
1725 1731
1726 err = tegra_output_probe(&hdmi->output); 1732 err = tegra_output_probe(&hdmi->output);
@@ -1779,6 +1785,9 @@ static int tegra_hdmi_remove(struct platform_device *pdev)
1779 1785
1780 tegra_output_remove(&hdmi->output); 1786 tegra_output_remove(&hdmi->output);
1781 1787
1788 if (hdmi->output.notifier)
1789 cec_notifier_put(hdmi->output.notifier);
1790
1782 return 0; 1791 return 0;
1783} 1792}
1784 1793
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index 595d1ec3e02e..1cfbacea8113 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -11,6 +11,8 @@
11#include <drm/drm_panel.h> 11#include <drm/drm_panel.h>
12#include "drm.h" 12#include "drm.h"
13 13
14#include <media/cec-notifier.h>
15
14int tegra_output_connector_get_modes(struct drm_connector *connector) 16int tegra_output_connector_get_modes(struct drm_connector *connector)
15{ 17{
16 struct tegra_output *output = connector_to_output(connector); 18 struct tegra_output *output = connector_to_output(connector);
@@ -32,6 +34,7 @@ int tegra_output_connector_get_modes(struct drm_connector *connector)
32 else if (output->ddc) 34 else if (output->ddc)
33 edid = drm_get_edid(connector, output->ddc); 35 edid = drm_get_edid(connector, output->ddc);
34 36
37 cec_notifier_set_phys_addr_from_edid(output->notifier, edid);
35 drm_mode_connector_update_edid_property(connector, edid); 38 drm_mode_connector_update_edid_property(connector, edid);
36 39
37 if (edid) { 40 if (edid) {
@@ -68,6 +71,9 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force)
68 status = connector_status_connected; 71 status = connector_status_connected;
69 } 72 }
70 73
74 if (status != connector_status_connected)
75 cec_notifier_phys_addr_invalidate(output->notifier);
76
71 return status; 77 return status;
72} 78}
73 79