All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Dariusz Marcinkiewicz <darekm@google.com>,
	dri-devel@lists.freedesktop.org,
	Cheng-yi Chiang <cychiang@chromium.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [PATCHv8 12/13] tda998x: use cec_notifier_conn_(un)register
Date: Mon, 24 Jun 2019 18:03:29 +0200	[thread overview]
Message-ID: <20190624160330.38048-13-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20190624160330.38048-1-hverkuil-cisco@xs4all.nl>

From: Dariusz Marcinkiewicz <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.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 56 +++++++++++++++----------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 7f34601bb515..019e1f2f008c 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1253,6 +1253,8 @@ static int tda998x_connector_init(struct tda998x_priv *priv,
 				  struct drm_device *drm)
 {
 	struct drm_connector *connector = &priv->connector;
+	struct cec_connector_info conn_info;
+	struct i2c_board_info cec_info;
 	int ret;
 
 	connector->interlace_allowed = 1;
@@ -1269,6 +1271,31 @@ static int tda998x_connector_init(struct tda998x_priv *priv,
 	if (ret)
 		return ret;
 
+	/*
+	 * Some TDA998x are actually two I2C devices merged onto one piece
+	 * of silicon: TDA9989 and TDA19989 combine the HDMI transmitter
+	 * with a slightly modified TDA9950 CEC device.  The CEC device
+	 * is at the TDA9950 address, with the address pins strapped across
+	 * to the TDA998x address pins.  Hence, it always has the same
+	 * offset.
+	 */
+	memset(&cec_info, 0, sizeof(cec_info));
+	strlcpy(cec_info.type, "tda9950", sizeof(cec_info.type));
+	cec_info.addr = priv->cec_addr;
+	cec_info.platform_data = &priv->cec_glue;
+	cec_info.irq = priv->hdmi->irq;
+
+	priv->cec = i2c_new_device(priv->hdmi->adapter, &cec_info);
+	if (!priv->cec)
+		return -ENODEV;
+
+	cec_fill_conn_info_from_drm(&conn_info, connector);
+
+	priv->cec_notify = cec_notifier_conn_register(priv->cec_glue.parent,
+						      NULL, &conn_info);
+	if (!priv->cec_notify)
+		return -ENOMEM;
+
 	drm_connector_attach_encoder(&priv->connector,
 				     priv->bridge.encoder);
 
@@ -1651,14 +1678,13 @@ static void tda998x_destroy(struct device *dev)
 	i2c_unregister_device(priv->cec);
 
 	if (priv->cec_notify)
-		cec_notifier_put(priv->cec_notify);
+		cec_notifier_conn_unregister(priv->cec_notify);
 }
 
 static int tda998x_create(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct device_node *np = client->dev.of_node;
-	struct i2c_board_info cec_info;
 	struct tda998x_priv *priv;
 	u32 video;
 	int rev_lo, rev_hi, ret;
@@ -1776,12 +1802,6 @@ static int tda998x_create(struct device *dev)
 		cec_write(priv, REG_CEC_RXSHPDINTENA, CEC_RXSHPDLEV_HPD);
 	}
 
-	priv->cec_notify = cec_notifier_get(dev);
-	if (!priv->cec_notify) {
-		ret = -ENOMEM;
-		goto fail;
-	}
-
 	priv->cec_glue.parent = dev;
 	priv->cec_glue.data = priv;
 	priv->cec_glue.init = tda998x_cec_hook_init;
@@ -1789,26 +1809,6 @@ static int tda998x_create(struct device *dev)
 	priv->cec_glue.open = tda998x_cec_hook_open;
 	priv->cec_glue.release = tda998x_cec_hook_release;
 
-	/*
-	 * Some TDA998x are actually two I2C devices merged onto one piece
-	 * of silicon: TDA9989 and TDA19989 combine the HDMI transmitter
-	 * with a slightly modified TDA9950 CEC device.  The CEC device
-	 * is at the TDA9950 address, with the address pins strapped across
-	 * to the TDA998x address pins.  Hence, it always has the same
-	 * offset.
-	 */
-	memset(&cec_info, 0, sizeof(cec_info));
-	strlcpy(cec_info.type, "tda9950", sizeof(cec_info.type));
-	cec_info.addr = priv->cec_addr;
-	cec_info.platform_data = &priv->cec_glue;
-	cec_info.irq = client->irq;
-
-	priv->cec = i2c_new_device(client->adapter, &cec_info);
-	if (!priv->cec) {
-		ret = -ENODEV;
-		goto fail;
-	}
-
 	/* enable EDID read irq: */
 	reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
 
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Dariusz Marcinkiewicz <darekm@google.com>,
	dri-devel@lists.freedesktop.org,
	Cheng-yi Chiang <cychiang@chromium.org>
Subject: [PATCHv8 12/13] tda998x: use cec_notifier_conn_(un)register
Date: Mon, 24 Jun 2019 18:03:29 +0200	[thread overview]
Message-ID: <20190624160330.38048-13-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20190624160330.38048-1-hverkuil-cisco@xs4all.nl>

From: Dariusz Marcinkiewicz <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.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 56 +++++++++++++++----------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 7f34601bb515..019e1f2f008c 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1253,6 +1253,8 @@ static int tda998x_connector_init(struct tda998x_priv *priv,
 				  struct drm_device *drm)
 {
 	struct drm_connector *connector = &priv->connector;
+	struct cec_connector_info conn_info;
+	struct i2c_board_info cec_info;
 	int ret;
 
 	connector->interlace_allowed = 1;
@@ -1269,6 +1271,31 @@ static int tda998x_connector_init(struct tda998x_priv *priv,
 	if (ret)
 		return ret;
 
+	/*
+	 * Some TDA998x are actually two I2C devices merged onto one piece
+	 * of silicon: TDA9989 and TDA19989 combine the HDMI transmitter
+	 * with a slightly modified TDA9950 CEC device.  The CEC device
+	 * is at the TDA9950 address, with the address pins strapped across
+	 * to the TDA998x address pins.  Hence, it always has the same
+	 * offset.
+	 */
+	memset(&cec_info, 0, sizeof(cec_info));
+	strlcpy(cec_info.type, "tda9950", sizeof(cec_info.type));
+	cec_info.addr = priv->cec_addr;
+	cec_info.platform_data = &priv->cec_glue;
+	cec_info.irq = priv->hdmi->irq;
+
+	priv->cec = i2c_new_device(priv->hdmi->adapter, &cec_info);
+	if (!priv->cec)
+		return -ENODEV;
+
+	cec_fill_conn_info_from_drm(&conn_info, connector);
+
+	priv->cec_notify = cec_notifier_conn_register(priv->cec_glue.parent,
+						      NULL, &conn_info);
+	if (!priv->cec_notify)
+		return -ENOMEM;
+
 	drm_connector_attach_encoder(&priv->connector,
 				     priv->bridge.encoder);
 
@@ -1651,14 +1678,13 @@ static void tda998x_destroy(struct device *dev)
 	i2c_unregister_device(priv->cec);
 
 	if (priv->cec_notify)
-		cec_notifier_put(priv->cec_notify);
+		cec_notifier_conn_unregister(priv->cec_notify);
 }
 
 static int tda998x_create(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct device_node *np = client->dev.of_node;
-	struct i2c_board_info cec_info;
 	struct tda998x_priv *priv;
 	u32 video;
 	int rev_lo, rev_hi, ret;
@@ -1776,12 +1802,6 @@ static int tda998x_create(struct device *dev)
 		cec_write(priv, REG_CEC_RXSHPDINTENA, CEC_RXSHPDLEV_HPD);
 	}
 
-	priv->cec_notify = cec_notifier_get(dev);
-	if (!priv->cec_notify) {
-		ret = -ENOMEM;
-		goto fail;
-	}
-
 	priv->cec_glue.parent = dev;
 	priv->cec_glue.data = priv;
 	priv->cec_glue.init = tda998x_cec_hook_init;
@@ -1789,26 +1809,6 @@ static int tda998x_create(struct device *dev)
 	priv->cec_glue.open = tda998x_cec_hook_open;
 	priv->cec_glue.release = tda998x_cec_hook_release;
 
-	/*
-	 * Some TDA998x are actually two I2C devices merged onto one piece
-	 * of silicon: TDA9989 and TDA19989 combine the HDMI transmitter
-	 * with a slightly modified TDA9950 CEC device.  The CEC device
-	 * is at the TDA9950 address, with the address pins strapped across
-	 * to the TDA998x address pins.  Hence, it always has the same
-	 * offset.
-	 */
-	memset(&cec_info, 0, sizeof(cec_info));
-	strlcpy(cec_info.type, "tda9950", sizeof(cec_info.type));
-	cec_info.addr = priv->cec_addr;
-	cec_info.platform_data = &priv->cec_glue;
-	cec_info.irq = client->irq;
-
-	priv->cec = i2c_new_device(client->adapter, &cec_info);
-	if (!priv->cec) {
-		ret = -ENODEV;
-		goto fail;
-	}
-
 	/* enable EDID read irq: */
 	reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
 
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-06-24 16:03 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 16:03 [PATCHv8 00/13] cec: improve notifier support, add connector info Hans Verkuil
2019-06-24 16:03 ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 01/13] cec-notifier: rename variable, check kstrdup Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-25  7:07   ` [PATCHv8.1 01/13] cec-notifier: rename variables, check kstrdup and n->conn_name Hans Verkuil
2019-06-25  7:07     ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 02/13] cec: add struct cec_connector_info support Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-25  6:28   ` Hans Verkuil
2019-06-25  6:28     ` Hans Verkuil
2019-06-25 13:19   ` Dariusz Marcinkiewicz
2019-06-25 13:19     ` Dariusz Marcinkiewicz
2019-06-24 16:03 ` [PATCHv8 03/13] cec: add new notifier functions Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-25 13:48   ` Dariusz Marcinkiewicz
2019-06-25 13:48     ` Dariusz Marcinkiewicz
2019-06-25 14:26     ` Hans Verkuil
2019-06-25 14:26       ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 04/13] cec: expose the new connector info API Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-25 13:59   ` Dariusz Marcinkiewicz
2019-06-25 13:59     ` Dariusz Marcinkiewicz
2019-06-25 14:28     ` Hans Verkuil
2019-06-25 14:28       ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 05/13] cec: document CEC_ADAP_G_CONNECTOR_INFO Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 06/13] drm_dp_cec: add connector info support Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 07/13] drm/i915/intel_hdmi: use cec_notifier_conn_(un)register Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 08/13] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 09/13] dw-hdmi: use cec_notifier_conn_(un)register Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-25  0:43   ` kbuild test robot
2019-06-25  0:43     ` kbuild test robot
2019-06-24 16:03 ` [PATCHv8 10/13] meson/ao-cec: use cec_notifier_cec_adap_(un)register Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-24 16:03 ` [PATCHv8 11/13] tda9950: " Hans Verkuil
2019-06-24 16:03   ` Hans Verkuil
2019-06-24 16:03 ` Hans Verkuil [this message]
2019-06-24 16:03   ` [PATCHv8 12/13] tda998x: use cec_notifier_conn_(un)register Hans Verkuil
2019-06-24 22:37   ` kbuild test robot
2019-06-24 22:37     ` kbuild test robot
2019-06-24 16:03 ` [PATCHv8 13/13] drm/vc4/vc4_hdmi: fill in connector info Hans Verkuil
2019-06-24 16:03   ` 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=20190624160330.38048-13-hverkuil-cisco@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=cychiang@chromium.org \
    --cc=darekm@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 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.