linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dariusz Marcinkiewicz <darekm@google.com>
To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl
Cc: Dariusz Marcinkiewicz <darekm@google.com>
Subject: [PATCH v4 6/9] drm: sti: use cec_notifier_conn_(un)register
Date: Tue, 16 Jul 2019 14:27:15 +0200	[thread overview]
Message-ID: <20190716122718.125993-7-darekm@google.com> (raw)
In-Reply-To: <20190716122718.125993-1-darekm@google.com>

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 v2:
	Don't invalidate physical address before unregistering the
	notifier.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
---
 drivers/gpu/drm/sti/sti_hdmi.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 6000df6249807..6de30c0eee9e1 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1250,6 +1250,7 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
 	struct drm_device *drm_dev = data;
 	struct drm_encoder *encoder;
 	struct sti_hdmi_connector *connector;
+	struct cec_connector_info conn_info;
 	struct drm_connector *drm_connector;
 	struct drm_bridge *bridge;
 	int err;
@@ -1310,6 +1311,14 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
 		goto err_sysfs;
 	}
 
+	cec_fill_conn_info_from_drm(&conn_info, drm_connector);
+	hdmi->notifier = cec_notifier_conn_register(&hdmi->dev, NULL,
+						    &conn_info);
+	if (!hdmi->notifier) {
+		hdmi->drm_connector = NULL;
+		return -ENOMEM;
+	}
+
 	/* Enable default interrupts */
 	hdmi_write(hdmi, HDMI_DEFAULT_INT, HDMI_INT_EN);
 
@@ -1323,6 +1332,9 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
 static void sti_hdmi_unbind(struct device *dev,
 		struct device *master, void *data)
 {
+	struct sti_hdmi *hdmi = dev_get_drvdata(dev);
+
+	cec_notifier_conn_unregister(hdmi->notifier);
 }
 
 static const struct component_ops sti_hdmi_ops = {
@@ -1428,10 +1440,6 @@ static int sti_hdmi_probe(struct platform_device *pdev)
 		goto release_adapter;
 	}
 
-	hdmi->notifier = cec_notifier_get(&pdev->dev);
-	if (!hdmi->notifier)
-		goto release_adapter;
-
 	hdmi->reset = devm_reset_control_get(dev, "hdmi");
 	/* Take hdmi out of reset */
 	if (!IS_ERR(hdmi->reset))
@@ -1451,14 +1459,11 @@ static int sti_hdmi_remove(struct platform_device *pdev)
 {
 	struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev);
 
-	cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID);
-
 	i2c_put_adapter(hdmi->ddc_adapt);
 	if (hdmi->audio_pdev)
 		platform_device_unregister(hdmi->audio_pdev);
 	component_del(&pdev->dev, &sti_hdmi_ops);
 
-	cec_notifier_put(hdmi->notifier);
 	return 0;
 }
 
-- 
2.22.0.510.g264f2c817a-goog


  parent reply	other threads:[~2019-07-16 12:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 12:27 [PATCH v4 0/9] drm: cec: convert DRM drivers to the new notifier API Dariusz Marcinkiewicz
2019-07-16 12:27 ` [PATCH v4 1/9] drm_dp_cec: add connector info support Dariusz Marcinkiewicz
2019-07-16 12:27 ` [PATCH v4 2/9] drm/i915/intel_hdmi: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-07-16 12:27 ` [PATCH v4 3/9] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register Dariusz Marcinkiewicz
2019-07-16 12:27 ` [PATCH v4 4/9] tda9950: " Dariusz Marcinkiewicz
2019-07-16 12:27 ` [PATCH v4 5/9] drm: tda998x: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-07-16 12:27 ` Dariusz Marcinkiewicz [this message]
2019-07-16 12:27 ` [PATCH v4 7/9] drm: tegra: " Dariusz Marcinkiewicz
2019-07-30 12:17   ` Hans Verkuil
2019-08-07  9:05     ` Dariusz Marcinkiewicz
2019-07-16 12:27 ` [PATCH v4 8/9] drm: dw-hdmi: " Dariusz Marcinkiewicz
2019-07-30 12:19   ` Hans Verkuil
2019-07-16 12:27 ` [PATCH v4 9/9] drm: exynos: exynos_hdmi: " Dariusz Marcinkiewicz
2019-07-30 12:23 ` [PATCH v4 0/9] drm: cec: convert DRM drivers to the new notifier API 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=20190716122718.125993-7-darekm@google.com \
    --to=darekm@google.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@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).