All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Hans Verkuil
	<hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCHv4 4/4] drm/tegra: add cec-notifier support
Date: Thu, 19 Oct 2017 15:30:07 +0200	[thread overview]
Message-ID: <20171019133007.GU9005@ulmo> (raw)
In-Reply-To: <20171019131716.GT9005@ulmo>

[-- Attachment #1: Type: text/plain, Size: 5172 bytes --]

On Thu, Oct 19, 2017 at 03:17:16PM +0200, Thierry Reding wrote:
> On Mon, Sep 11, 2017 at 02:29:52PM +0200, Hans Verkuil wrote:
> > From: Hans Verkuil <hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
> > 
> > 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 in the tegra-cec node in the device tree.
> > 
> > Signed-off-by: Hans Verkuil <hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
> > ---
> >  drivers/gpu/drm/tegra/Kconfig  | 1 +
> >  drivers/gpu/drm/tegra/drm.h    | 3 +++
> >  drivers/gpu/drm/tegra/hdmi.c   | 9 +++++++++
> >  drivers/gpu/drm/tegra/output.c | 6 ++++++
> >  4 files changed, 19 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
> > index 2db29d67193d..c882918c2024 100644
> > --- a/drivers/gpu/drm/tegra/Kconfig
> > +++ b/drivers/gpu/drm/tegra/Kconfig
> > @@ -8,6 +8,7 @@ config DRM_TEGRA
> >  	select DRM_PANEL
> >  	select TEGRA_HOST1X
> >  	select IOMMU_IOVA if IOMMU_SUPPORT
> > +	select CEC_CORE if CEC_NOTIFIER
> >  	help
> >  	  Choose this option if you have an NVIDIA Tegra SoC.
> >  
> > diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
> > index 6d6da01282f3..c0a18b60caf1 100644
> > --- a/drivers/gpu/drm/tegra/drm.h
> > +++ b/drivers/gpu/drm/tegra/drm.h
> > @@ -212,6 +212,8 @@ int tegra_dc_state_setup_clock(struct tegra_dc *dc,
> >  			       struct clk *clk, unsigned long pclk,
> >  			       unsigned int div);
> >  
> > +struct cec_notifier;
> > +
> >  struct tegra_output {
> >  	struct device_node *of_node;
> >  	struct device *dev;
> > @@ -219,6 +221,7 @@ struct tegra_output {
> >  	struct drm_panel *panel;
> >  	struct i2c_adapter *ddc;
> >  	const struct edid *edid;
> > +	struct cec_notifier *notifier;
> >  	unsigned int hpd_irq;
> >  	int hpd_gpio;
> >  	enum of_gpio_flags hpd_gpio_flags;
> > diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
> > index cda0491ed6bf..fbf14e1efd0e 100644
> > --- a/drivers/gpu/drm/tegra/hdmi.c
> > +++ b/drivers/gpu/drm/tegra/hdmi.c
> > @@ -21,6 +21,8 @@
> >  
> >  #include <sound/hda_verbs.h>
> >  
> > +#include <media/cec-notifier.h>
> > +
> >  #include "hdmi.h"
> >  #include "drm.h"
> >  #include "dc.h"
> > @@ -1720,6 +1722,10 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
> >  		return PTR_ERR(hdmi->vdd);
> >  	}
> >  
> > +	hdmi->output.notifier = cec_notifier_get(&pdev->dev);
> > +	if (hdmi->output.notifier == NULL)
> > +		return -ENOMEM;
> > +
> >  	hdmi->output.dev = &pdev->dev;
> >  
> >  	err = tegra_output_probe(&hdmi->output);
> > @@ -1778,6 +1784,9 @@ static int tegra_hdmi_remove(struct platform_device *pdev)
> >  
> >  	tegra_output_remove(&hdmi->output);
> >  
> > +	if (hdmi->output.notifier)
> > +		cec_notifier_put(hdmi->output.notifier);
> > +
> >  	return 0;
> >  }
> >  
> > diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
> > index 595d1ec3e02e..57c052521a44 100644
> > --- a/drivers/gpu/drm/tegra/output.c
> > +++ b/drivers/gpu/drm/tegra/output.c
> > @@ -11,6 +11,8 @@
> >  #include <drm/drm_panel.h>
> >  #include "drm.h"
> >  
> > +#include <media/cec-notifier.h>
> > +
> >  int tegra_output_connector_get_modes(struct drm_connector *connector)
> >  {
> >  	struct tegra_output *output = connector_to_output(connector);
> > @@ -33,6 +35,7 @@ int tegra_output_connector_get_modes(struct drm_connector *connector)
> >  		edid = drm_get_edid(connector, output->ddc);
> >  
> >  	drm_mode_connector_update_edid_property(connector, edid);
> > +	cec_notifier_set_phys_addr_from_edid(output->notifier, edid);
> 
> I had to guard this with:
> 
> 	#if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER)
> 	...
> 	#endif
> 
> to enable this driver to be built without CEC_NOTIFIER enabled. I see
> that there are stubs defined if the above is false, but for some reason
> they don't seem to be there for me either.

Nevermind that. This was not actually failing. However, ...

> >  
> >  	if (edid) {
> >  		err = drm_add_edid_modes(connector, edid);
> > @@ -68,6 +71,9 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force)
> >  			status = connector_status_connected;
> >  	}
> >  
> > +	if (status != connector_status_connected)
> > +		cec_notifier_phys_addr_invalidate(output->notifier);

This doesn't seem to exist in v4.14-rc1 which is the base for the
drm/tegra tree for v4.15. I see this function will be introduced in
v4.15 via the media tree.

How about if I replace this by:

	cec_notifier_set_phys(output->notifier, CEC_PHYS_ADDR_INVALID);

for now and switch it over to the new function after v4.15-rc1? That way
we can avoid the extra dependency between the media and drm trees.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org,
	devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCHv4 4/4] drm/tegra: add cec-notifier support
Date: Thu, 19 Oct 2017 15:30:07 +0200	[thread overview]
Message-ID: <20171019133007.GU9005@ulmo> (raw)
In-Reply-To: <20171019131716.GT9005@ulmo>

[-- Attachment #1: Type: text/plain, Size: 5112 bytes --]

On Thu, Oct 19, 2017 at 03:17:16PM +0200, Thierry Reding wrote:
> On Mon, Sep 11, 2017 at 02:29:52PM +0200, Hans Verkuil wrote:
> > From: Hans Verkuil <hans.verkuil@cisco.com>
> > 
> > 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 in the tegra-cec node in the device tree.
> > 
> > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> > ---
> >  drivers/gpu/drm/tegra/Kconfig  | 1 +
> >  drivers/gpu/drm/tegra/drm.h    | 3 +++
> >  drivers/gpu/drm/tegra/hdmi.c   | 9 +++++++++
> >  drivers/gpu/drm/tegra/output.c | 6 ++++++
> >  4 files changed, 19 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
> > index 2db29d67193d..c882918c2024 100644
> > --- a/drivers/gpu/drm/tegra/Kconfig
> > +++ b/drivers/gpu/drm/tegra/Kconfig
> > @@ -8,6 +8,7 @@ config DRM_TEGRA
> >  	select DRM_PANEL
> >  	select TEGRA_HOST1X
> >  	select IOMMU_IOVA if IOMMU_SUPPORT
> > +	select CEC_CORE if CEC_NOTIFIER
> >  	help
> >  	  Choose this option if you have an NVIDIA Tegra SoC.
> >  
> > diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
> > index 6d6da01282f3..c0a18b60caf1 100644
> > --- a/drivers/gpu/drm/tegra/drm.h
> > +++ b/drivers/gpu/drm/tegra/drm.h
> > @@ -212,6 +212,8 @@ int tegra_dc_state_setup_clock(struct tegra_dc *dc,
> >  			       struct clk *clk, unsigned long pclk,
> >  			       unsigned int div);
> >  
> > +struct cec_notifier;
> > +
> >  struct tegra_output {
> >  	struct device_node *of_node;
> >  	struct device *dev;
> > @@ -219,6 +221,7 @@ struct tegra_output {
> >  	struct drm_panel *panel;
> >  	struct i2c_adapter *ddc;
> >  	const struct edid *edid;
> > +	struct cec_notifier *notifier;
> >  	unsigned int hpd_irq;
> >  	int hpd_gpio;
> >  	enum of_gpio_flags hpd_gpio_flags;
> > diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
> > index cda0491ed6bf..fbf14e1efd0e 100644
> > --- a/drivers/gpu/drm/tegra/hdmi.c
> > +++ b/drivers/gpu/drm/tegra/hdmi.c
> > @@ -21,6 +21,8 @@
> >  
> >  #include <sound/hda_verbs.h>
> >  
> > +#include <media/cec-notifier.h>
> > +
> >  #include "hdmi.h"
> >  #include "drm.h"
> >  #include "dc.h"
> > @@ -1720,6 +1722,10 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
> >  		return PTR_ERR(hdmi->vdd);
> >  	}
> >  
> > +	hdmi->output.notifier = cec_notifier_get(&pdev->dev);
> > +	if (hdmi->output.notifier == NULL)
> > +		return -ENOMEM;
> > +
> >  	hdmi->output.dev = &pdev->dev;
> >  
> >  	err = tegra_output_probe(&hdmi->output);
> > @@ -1778,6 +1784,9 @@ static int tegra_hdmi_remove(struct platform_device *pdev)
> >  
> >  	tegra_output_remove(&hdmi->output);
> >  
> > +	if (hdmi->output.notifier)
> > +		cec_notifier_put(hdmi->output.notifier);
> > +
> >  	return 0;
> >  }
> >  
> > diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
> > index 595d1ec3e02e..57c052521a44 100644
> > --- a/drivers/gpu/drm/tegra/output.c
> > +++ b/drivers/gpu/drm/tegra/output.c
> > @@ -11,6 +11,8 @@
> >  #include <drm/drm_panel.h>
> >  #include "drm.h"
> >  
> > +#include <media/cec-notifier.h>
> > +
> >  int tegra_output_connector_get_modes(struct drm_connector *connector)
> >  {
> >  	struct tegra_output *output = connector_to_output(connector);
> > @@ -33,6 +35,7 @@ int tegra_output_connector_get_modes(struct drm_connector *connector)
> >  		edid = drm_get_edid(connector, output->ddc);
> >  
> >  	drm_mode_connector_update_edid_property(connector, edid);
> > +	cec_notifier_set_phys_addr_from_edid(output->notifier, edid);
> 
> I had to guard this with:
> 
> 	#if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER)
> 	...
> 	#endif
> 
> to enable this driver to be built without CEC_NOTIFIER enabled. I see
> that there are stubs defined if the above is false, but for some reason
> they don't seem to be there for me either.

Nevermind that. This was not actually failing. However, ...

> >  
> >  	if (edid) {
> >  		err = drm_add_edid_modes(connector, edid);
> > @@ -68,6 +71,9 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force)
> >  			status = connector_status_connected;
> >  	}
> >  
> > +	if (status != connector_status_connected)
> > +		cec_notifier_phys_addr_invalidate(output->notifier);

This doesn't seem to exist in v4.14-rc1 which is the base for the
drm/tegra tree for v4.15. I see this function will be introduced in
v4.15 via the media tree.

How about if I replace this by:

	cec_notifier_set_phys(output->notifier, CEC_PHYS_ADDR_INVALID);

for now and switch it over to the new function after v4.15-rc1? That way
we can avoid the extra dependency between the media and drm trees.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-10-19 13:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 12:29 [PATCHv4 0/4] tegra-cec: add Tegra HDMI CEC support Hans Verkuil
2017-09-11 12:29 ` Hans Verkuil
2017-09-11 12:29 ` [PATCHv4 2/4] ARM: tegra: add CEC support to tegra124.dtsi Hans Verkuil
2017-09-11 12:29   ` Hans Verkuil
     [not found]   ` <20170911122952.33980-3-hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-10-19  9:23     ` Thierry Reding
2017-10-19  9:23       ` Thierry Reding
     [not found] ` <20170911122952.33980-1-hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-09-11 12:29   ` [PATCHv4 1/4] dt-bindings: document the tegra CEC bindings Hans Verkuil
2017-09-11 12:29     ` Hans Verkuil
     [not found]     ` <20170911122952.33980-2-hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-10-19  9:22       ` Thierry Reding
2017-10-19  9:22         ` Thierry Reding
2017-09-11 12:29   ` [PATCHv4 3/4] tegra-cec: add Tegra HDMI CEC driver Hans Verkuil
2017-09-11 12:29     ` Hans Verkuil
     [not found]     ` <20170911122952.33980-4-hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-10-19  9:37       ` Thierry Reding
2017-10-19  9:37         ` Thierry Reding
2017-09-11 12:29   ` [PATCHv4 4/4] drm/tegra: add cec-notifier support Hans Verkuil
2017-09-11 12:29     ` Hans Verkuil
     [not found]     ` <20170911122952.33980-5-hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-10-19  9:38       ` Thierry Reding
2017-10-19  9:38         ` Thierry Reding
2017-10-19 13:17     ` Thierry Reding
2017-10-19 13:30       ` Thierry Reding [this message]
2017-10-19 13:30         ` Thierry Reding
2017-10-19 13:37         ` Hans Verkuil
     [not found]           ` <7e1fcffd-76dc-c4f2-942c-b9872f73fff0-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2017-10-19 14:01             ` Thierry Reding
2017-10-19 14:01               ` Thierry Reding
2017-10-19  9:20   ` [PATCHv4 0/4] tegra-cec: add Tegra HDMI CEC support Thierry Reding
2017-10-19  9:20     ` Thierry Reding
2017-10-19  9:36     ` Hans Verkuil
     [not found]       ` <0f43276f-0a89-8caa-6522-253458e3ad08-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-10-19  9:39         ` Thierry Reding
2017-10-19  9:39           ` Thierry Reding
2017-10-14 12:08 ` Hans Verkuil
2017-10-14 12:08   ` Hans Verkuil
     [not found]   ` <9314614a-446d-b76d-640b-033cc74e3879-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-10-14 13:34     ` Thierry Reding
2017-10-14 13:34       ` Thierry Reding
2017-10-14 13:48       ` Hans Verkuil
2017-10-14 13:48         ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171019133007.GU9005@ulmo \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org \
    --cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.