linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Dariusz Marcinkiewicz <darekm@google.com>
Cc: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
	hverkuil-cisco@xs4all.nl, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 7/9] drm: tegra: use cec_notifier_conn_(un)register
Date: Wed, 28 Aug 2019 11:36:45 +0200	[thread overview]
Message-ID: <20190828093645.GD2917@ulmo> (raw)
In-Reply-To: <20190814104520.6001-8-darekm@google.com>

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

On Wed, Aug 14, 2019 at 12:45:05PM +0200, Dariusz Marcinkiewicz wrote:
> Use the new cec_notifier_conn_(un)register() functions to
> (un)register the notifier for the HDMI connector, and fill in
> the cec_connector_info.
> 
> Changes since v4:
> 	- only create a CEC notifier for HDMI connectors
> 
> Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
> Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
>  drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
> index bdcaa4c7168cf..34373734ff689 100644
> --- a/drivers/gpu/drm/tegra/output.c
> +++ b/drivers/gpu/drm/tegra/output.c
> @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force)
>  
>  void tegra_output_connector_destroy(struct drm_connector *connector)
>  {
> +	struct tegra_output *output = connector_to_output(connector);
> +
> +	if (output->cec)
> +		cec_notifier_conn_unregister(output->cec);
> +
>  	drm_connector_unregister(connector);
>  	drm_connector_cleanup(connector);
>  }
> @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output)
>  		disable_irq(output->hpd_irq);
>  	}
>  
> -	output->cec = cec_notifier_get(output->dev);
> -	if (!output->cec)
> -		return -ENOMEM;
> -
>  	return 0;
>  }
>  
>  void tegra_output_remove(struct tegra_output *output)
>  {
> -	if (output->cec)
> -		cec_notifier_put(output->cec);
> -
>  	if (output->hpd_gpio)
>  		free_irq(output->hpd_irq, output);
>  
> @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output)
>  
>  int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
>  {
> +	int connector_type;
>  	int err;
>  
>  	if (output->panel) {
> @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
>  	if (output->hpd_gpio)
>  		enable_irq(output->hpd_irq);
>  
> +	connector_type = output->connector.connector_type;
> +	/*
> +	 * Create a CEC notifier for HDMI connector.
> +	 */
> +	if (connector_type == DRM_MODE_CONNECTOR_HDMIA ||
> +	    connector_type == DRM_MODE_CONNECTOR_HDMIB) {
> +		struct cec_connector_info conn_info;
> +
> +		cec_fill_conn_info_from_drm(&conn_info, &output->connector);
> +		output->cec = cec_notifier_conn_register(output->dev, NULL,
> +							 &conn_info);
> +		if (!output->cec)
> +			return -ENOMEM;
> +	}
> +
>  	return 0;
>  }
>  

It might be slightly cleaner to move this into the HDMI drivers
themselves, although that'd mean a bit of duplication. That could be
mitigated by moving the code into a separate helper that could be called
by the HDMI drivers.

Then again, I don't feel strongly about it, and that could always be
done as part of some later refactoring, so I think this is fine.

Thierry

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

  parent reply	other threads:[~2019-08-28  9:36 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 10:44 [PATCH v7 0/9] drm: cec: convert DRM drivers to the new notifier API Dariusz Marcinkiewicz
2019-08-14 10:44 ` [PATCH v7 1/9] drm_dp_cec: add connector info support Dariusz Marcinkiewicz
2019-08-15 18:10   ` Lyude Paul
2019-08-26  9:05     ` Ben Skeggs
2019-08-22  8:08   ` Hans Verkuil
2019-08-26  9:00     ` Hans Verkuil
2019-08-28 15:05   ` Ville Syrjälä
2019-08-14 10:45 ` [PATCH v7 2/9] drm/i915/intel_hdmi: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-08-22  8:03   ` Hans Verkuil
2019-08-26  8:59     ` Hans Verkuil
2019-08-26 12:08   ` Ville Syrjälä
2019-08-14 10:45 ` [PATCH v7 3/9] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register Dariusz Marcinkiewicz
2019-08-19 14:35   ` Neil Armstrong
2019-08-20  7:48     ` Neil Armstrong
2019-08-14 10:45 ` [PATCH v7 4/9] tda9950: " Dariusz Marcinkiewicz
2019-08-14 10:45 ` [PATCH v7 5/9] drm: tda998x: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-08-19  9:30   ` Hans Verkuil
2019-08-19 11:22   ` [PATCH v7.1 " Dariusz Marcinkiewicz
2019-08-28  7:15     ` [PATCH v7.2 " Dariusz Marcinkiewicz
2019-08-25 13:12   ` [PATCH v7 " Hans Verkuil
2019-08-28  7:18     ` Dariusz Marcinkiewicz
2019-08-14 10:45 ` [PATCH v7 6/9] drm: sti: " Dariusz Marcinkiewicz
2019-08-19  9:34   ` Hans Verkuil
2019-08-22  8:11   ` Hans Verkuil
2019-09-02 13:11     ` Benjamin Gaignard
2019-08-14 10:45 ` [PATCH v7 7/9] drm: tegra: " Dariusz Marcinkiewicz
2019-08-19  9:33   ` Hans Verkuil
2019-08-28  8:09   ` Hans Verkuil
2019-08-28  9:38     ` Thierry Reding
2019-08-28 10:06       ` Hans Verkuil
2019-08-28 11:54         ` Thierry Reding
2019-10-04  8:48           ` Hans Verkuil
2019-10-14  7:51             ` Hans Verkuil
2019-08-28  9:36   ` Thierry Reding [this message]
2019-10-14 12:17   ` Thierry Reding
2019-08-14 10:45 ` [PATCH v7 8/9] drm: dw-hdmi: " Dariusz Marcinkiewicz
2019-08-19  9:32   ` Hans Verkuil
2019-08-19 14:05     ` Hans Verkuil
2019-08-19 14:38       ` Neil Armstrong
2019-08-19 14:41         ` Hans Verkuil
2019-08-19 14:47           ` Neil Armstrong
2019-08-20  7:48             ` Neil Armstrong
2019-08-14 10:45 ` [PATCH v7 9/9] drm: exynos: exynos_hdmi: " Dariusz Marcinkiewicz
2019-08-19  9:32   ` Hans Verkuil
2019-08-28  8:39   ` Sylwester Nawrocki
2019-08-28 12:34     ` [PATCH v7.1 " Dariusz Marcinkiewicz
2019-08-28 12:38     ` [PATCH v7 " Dariusz Marcinkiewicz
2019-08-19  9:38 ` [PATCH v7 0/9] drm: cec: convert DRM drivers to the new notifier API Hans Verkuil
2019-08-19 11:28   ` Dariusz Marcinkiewicz
2019-08-19 12:00     ` Hans Verkuil
2019-08-19 14:48   ` Neil Armstrong
2019-08-19 14:55     ` 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=20190828093645.GD2917@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=darekm@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).