All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: "Paul J . Murphy" <paul.j.murphy@intel.com>,
	Daniele Alessandrelli <daniele.alessandrelli@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	Sakari Ailus <sakari.ailus@iki.fi>
Subject: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
Date: Thu, 28 Jul 2022 15:02:36 +0200	[thread overview]
Message-ID: <20220728130237.3396663-7-alexander.stein@ew.tq-group.com> (raw)
In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com>

To distinguish ov9281 & ov9282 the name has to be explicitly set.
Provide a fixed string using platform data.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v4:
* Replaced v4l2_i2c_subdev_set_name with device_get_match_data and added
  platform data containing the sensor name

 drivers/media/i2c/ov9282.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
index 352dbe21a902..f79bdfa821e8 100644
--- a/drivers/media/i2c/ov9282.c
+++ b/drivers/media/i2c/ov9282.c
@@ -1037,6 +1037,7 @@ static int ov9282_get_regulators(struct ov9282 *ov9282)
 static int ov9282_probe(struct i2c_client *client)
 {
 	struct ov9282 *ov9282;
+	const char *sensor_name;
 	int ret;
 
 	ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL);
@@ -1047,6 +1048,12 @@ static int ov9282_probe(struct i2c_client *client)
 
 	/* Initialize subdev */
 	v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops);
+	sensor_name = device_get_match_data(ov9282->dev);
+	if (!sensor_name) {
+		dev_err(ov9282->dev, "Sensor name is missing");
+		return ret;
+	}
+	v4l2_i2c_subdev_set_name(&ov9282->sd, client, sensor_name, NULL);
 
 	ret = ov9282_parse_hw_config(ov9282);
 	if (ret) {
@@ -1152,8 +1159,8 @@ static const struct dev_pm_ops ov9282_pm_ops = {
 };
 
 static const struct of_device_id ov9282_of_match[] = {
-	{ .compatible = "ovti,ov9281" },
-	{ .compatible = "ovti,ov9282" },
+	{ .compatible = "ovti,ov9281", .data = "ov9281" },
+	{ .compatible = "ovti,ov9282", .data = "ov9282" },
 	{ }
 };
 
-- 
2.25.1


  parent reply	other threads:[~2022-07-28 13:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 13:02 [PATCH v4 0/7] OV9281 support Alexander Stein
2022-07-28 13:02 ` [PATCH v4 1/7] media: i2c: ov9282: remove unused and unset i2c_client member Alexander Stein
2022-07-28 13:02 ` [PATCH v4 2/7] media: dt-bindings: media: Add compatible for ov9281 Alexander Stein
2022-07-28 13:02 ` [PATCH v4 3/7] media: i2c: ov9282: Add ov9281 compatible Alexander Stein
2022-07-28 13:13   ` Krzysztof Kozlowski
2022-07-29  7:07     ` Sakari Ailus
2022-07-29  8:18       ` Laurent Pinchart
2022-08-01 18:07         ` Krzysztof Kozlowski
2022-08-01 18:08           ` Krzysztof Kozlowski
2022-08-02  8:23             ` Sakari Ailus
2022-08-02  8:30               ` Krzysztof Kozlowski
2022-08-15 11:19                 ` Alexander Stein
2022-08-16  7:16                   ` Krzysztof Kozlowski
2022-08-16  7:21                     ` Alexander Stein
2022-08-16  7:35                       ` Krzysztof Kozlowski
     [not found]   ` <166821050429.550668.2828222448343135143@Monstersaurus>
2022-11-24  9:45     ` Alexander Stein
2022-07-28 13:02 ` [PATCH v4 4/7] media: dt-bindings: media: ov9282: Add power supply properties Alexander Stein
2022-07-28 13:02 ` [PATCH v4 5/7] media: i2c: ov9282: Add regulator support Alexander Stein
2022-07-28 13:02 ` Alexander Stein [this message]
2022-07-28 21:10   ` [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model kernel test robot
2022-07-29  8:23     ` Alexander Stein
2022-07-29  8:23       ` Alexander Stein
2022-08-01 12:16       ` Sakari Ailus
2022-08-01 12:16         ` Sakari Ailus
2022-07-28 13:02 ` [PATCH v4 7/7] media: i2c: ov9282: Add regmap support Alexander Stein
2022-08-02 23:12 [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model kernel test robot

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=20220728130237.3396663-7-alexander.stein@ew.tq-group.com \
    --to=alexander.stein@ew.tq-group.com \
    --cc=daniele.alessandrelli@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=paul.j.murphy@intel.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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.