linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: laurent.pinchart@ideasonboard.com
Cc: hverkuil-cisco@xs4all.nl, linux-media@vger.kernel.org,
	jacopo+renesas@jmondi.org, morimoto.kuninori@renesas.com,
	Fabio Estevam <festevam@gmail.com>
Subject: [RFC 3/3] media: tw9910: Initialize the entity type
Date: Fri, 27 Aug 2021 10:01:50 -0300	[thread overview]
Message-ID: <20210827130150.909695-3-festevam@gmail.com> (raw)
In-Reply-To: <20210827130150.909695-1-festevam@gmail.com>

Currently the following warning is seen:

imx7-csi 2214000.csi: Entity type for entity tw9910 2-0044 was not initialized!

Initialize the entity type accordingly.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/media/i2c/tw9910.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index 0411b8ea9bda..ad4149073ba4 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -228,6 +228,7 @@ struct tw9910_scale_ctrl {
 
 struct tw9910_priv {
 	struct v4l2_subdev		subdev;
+	struct media_pad		pad;
 	struct clk			*clk;
 	struct tw9910_video_info	*info;
 	struct gpio_desc		*pdn_gpio;
@@ -948,6 +949,7 @@ static int tw9910_probe(struct i2c_client *client,
 {
 	struct tw9910_priv		*priv;
 	struct i2c_adapter		*adapter = client->adapter;
+	struct v4l2_subdev *sd;
 	int ret;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
@@ -973,14 +975,22 @@ static int tw9910_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 
-	v4l2_i2c_subdev_init(&priv->subdev, client, &tw9910_subdev_ops);
+	sd = &priv->subdev;
+	v4l2_i2c_subdev_init(sd, client, &tw9910_subdev_ops);
+	priv->pad.flags = MEDIA_PAD_FL_SOURCE;
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
+	sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
+	ret = media_entity_pads_init(&sd->entity, 1, &priv->pad);
+	if (ret)
+		return ret;
 
 	priv->clk = clk_get(&client->dev, "xti");
 	if (PTR_ERR(priv->clk) == -ENOENT) {
 		priv->clk = NULL;
 	} else if (IS_ERR(priv->clk)) {
 		dev_err(&client->dev, "Unable to get xti clock\n");
-		return PTR_ERR(priv->clk);
+		ret = PTR_ERR(priv->clk);
+		goto media_entity_cleanup;
 	}
 
 	priv->pdn_gpio = gpiod_get_optional(&client->dev, "pdn",
@@ -1006,7 +1016,9 @@ static int tw9910_probe(struct i2c_client *client,
 		gpiod_put(priv->pdn_gpio);
 error_clk_put:
 	clk_put(priv->clk);
-
+	
+media_entity_cleanup:
+	media_entity_cleanup(&sd->entity);
 	return ret;
 }
 
-- 
2.25.1


  parent reply	other threads:[~2021-08-27 13:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 13:01 [RFC 1/3] media: tw9910: Allow to probe from device tree Fabio Estevam
2021-08-27 13:01 ` [RFC 2/3] media: tw9910: Allow the TW9990 to probe Fabio Estevam
2021-09-13  9:00   ` Jacopo Mondi
2021-08-27 13:01 ` Fabio Estevam [this message]
2021-09-13  9:06   ` [RFC 3/3] media: tw9910: Initialize the entity type Jacopo Mondi
2021-08-28 13:58 ` [RFC 1/3] media: tw9910: Allow to probe from device tree Fabio Estevam
2021-09-13  8:59 ` Jacopo Mondi
2021-09-13 12:53   ` Fabio Estevam
2021-09-13 20:03     ` Fabio Estevam
2021-09-13 22:12       ` Rui Miguel Silva
2021-09-16 20:52         ` Fabio Estevam
2021-09-16 22:05           ` Rui Miguel Silva
2021-09-17  3:28             ` Fabio Estevam

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=20210827130150.909695-3-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=morimoto.kuninori@renesas.com \
    /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).