public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Daniel Scally <dan.scally@ideasonboard.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Andy Shevchenko <andy@kernel.org>, Kate Hsuan <hpa@redhat.com>,
	Hao Yao <hao.yao@intel.com>, Bingbu Cao <bingbu.cao@intel.com>,
	linux-media@vger.kernel.org
Subject: [PATCH 12/12] [RFC] media: dw9719: Drop hack to enable "vsio" regulator
Date: Tue, 27 Jun 2023 19:56:42 +0200	[thread overview]
Message-ID: <20230627175643.114778-13-hdegoede@redhat.com> (raw)
In-Reply-To: <20230627175643.114778-1-hdegoede@redhat.com>

Drop the hack where the driver is getting + enabling a "vsio" regulator
even though the dw9719 does not have a vsio pin / power-plane at all.

Now that drivers/media/common/intel-cio2-bridge.c adds device-link
making the VCM a consumer of the sensor this hack is no longer necessary.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Note to reviewers, the dw9719 driver is not upstream yet (I plan to
resubmit it soon with this squashed in). This patch is only included
in this patch-set to illustrate how the VCM -> sensor device-link
avoids the need for hacks like this.
---
 drivers/media/i2c/dw9719.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
index 94b76b4b2463..5fe01a125c1a 100644
--- a/drivers/media/i2c/dw9719.c
+++ b/drivers/media/i2c/dw9719.c
@@ -35,14 +35,12 @@
 #define DW9719_DEFAULT_VCM_FREQ		0x60
 #define DW9719_ENABLE_RINGING		0x02
 
-#define NUM_REGULATORS			2
-
 #define to_dw9719_device(x) container_of(x, struct dw9719_device, sd)
 
 struct dw9719_device {
 	struct device *dev;
 	struct i2c_client *client;
-	struct regulator_bulk_data regulators[NUM_REGULATORS];
+	struct regulator *regulator;
 	struct v4l2_subdev sd;
 
 	struct dw9719_v4l2_ctrls {
@@ -131,14 +129,14 @@ static int dw9719_detect(struct dw9719_device *dw9719)
 
 static int dw9719_power_down(struct dw9719_device *dw9719)
 {
-	return regulator_bulk_disable(NUM_REGULATORS, dw9719->regulators);
+	return regulator_disable(dw9719->regulator);
 }
 
 static int dw9719_power_up(struct dw9719_device *dw9719)
 {
 	int ret;
 
-	ret = regulator_bulk_enable(NUM_REGULATORS, dw9719->regulators);
+	ret = regulator_enable(dw9719->regulator);
 	if (ret)
 		return ret;
 
@@ -315,21 +313,10 @@ static int dw9719_probe(struct i2c_client *client)
 	dw9719->client = client;
 	dw9719->dev = &client->dev;
 
-	dw9719->regulators[0].supply = "vdd";
-	/*
-	 * The DW9719 has only the 1 VDD voltage input, but some PMICs such as
-	 * the TPS68470 PMIC have I2C passthrough capability, to disconnect the
-	 * sensor's I2C pins from the I2C bus when the sensors VSIO (Sensor-IO)
-	 * is off, because some sensors then short these pins to ground;
-	 * and the DW9719 might sit behind this passthrough, this it needs to
-	 * enable VSIO as that will also enable the I2C passthrough.
-	 */
-	dw9719->regulators[1].supply = "vsio";
-
-	ret = devm_regulator_bulk_get(&client->dev, NUM_REGULATORS,
-				      dw9719->regulators);
-	if (ret)
-		return dev_err_probe(&client->dev, ret, "getting regulators\n");
+	dw9719->regulator = devm_regulator_get(&client->dev, "vdd");
+	if (IS_ERR(dw9719->regulator))
+		return dev_err_probe(&client->dev, PTR_ERR(dw9719->regulator),
+				     "getting regulator\n");
 
 	v4l2_i2c_subdev_init(&dw9719->sd, client, &dw9719_ops);
 	dw9719->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-- 
2.41.0


  parent reply	other threads:[~2023-06-27 17:58 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 17:56 [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-bridge code, rework VCM instantiation Hans de Goede
2023-06-27 17:56 ` [PATCH 01/12] media: ipu3-cio2: Do not use on stack memory for software_node.name field Hans de Goede
2023-06-27 17:56 ` [PATCH 02/12] media: ipu3-cio2: Move initialization of node_names.vcm to cio2_bridge_init_swnode_names() Hans de Goede
2023-06-27 17:56 ` [PATCH 03/12] media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device as argument Hans de Goede
2023-06-27 17:56 ` [PATCH 04/12] media: ipu3-cio2: Store dev pointer in struct cio2_bridge Hans de Goede
2023-06-27 17:56 ` [PATCH 05/12] media: ipu3-cio2: Only keep PLD around while parsing Hans de Goede
2023-06-27 17:56 ` [PATCH 06/12] media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper function Hans de Goede
2023-06-27 20:39   ` Andy Shevchenko
2023-06-27 17:56 ` [PATCH 07/12] media: ipu3-cio2: Add a parse_sensor_fwnode callback to cio2_bridge_init() Hans de Goede
2023-06-27 17:56 ` [PATCH 08/12] media: ipu3-cio2: Add supported_sensors parameter " Hans de Goede
2023-06-27 17:56 ` [PATCH 09/12] media: ipu3-cio2: Move cio2_bridge_init() code into a new shared intel-cio2-bridge.ko Hans de Goede
2023-06-27 20:55   ` Andy Shevchenko
2023-06-28 12:53     ` Dan Scally
2023-06-27 17:56 ` [PATCH 10/12] media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init() Hans de Goede
2023-06-27 17:56 ` [PATCH 11/12] media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and sensor Hans de Goede
2023-06-27 21:03   ` Andy Shevchenko
2023-10-30  8:30   ` Bingbu Cao
2023-10-30  8:55     ` Sakari Ailus
2023-10-30  8:58       ` Hans de Goede
2023-10-30  9:23         ` Sakari Ailus
2023-11-01  6:26           ` Cao, Bingbu
2023-11-01  7:12             ` Sakari Ailus
2023-11-01  7:38               ` Cao, Bingbu
2023-11-02 13:35                 ` Andy Shevchenko
2023-11-02 13:54                   ` Hans de Goede
2023-11-03  2:01                     ` Bingbu Cao
2023-06-27 17:56 ` Hans de Goede [this message]
2023-06-27 21:04 ` [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-bridge code, rework VCM instantiation Andy Shevchenko
2023-06-28  1:19 ` Cao, Bingbu
2023-06-28 13:57   ` Hans de Goede
2023-06-29  8:22     ` Cao, Bingbu
2023-06-29 20:45       ` Hans de Goede
2023-06-30  9:07 ` Sakari Ailus

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=20230627175643.114778-13-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@kernel.org \
    --cc=bingbu.cao@intel.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=hao.yao@intel.com \
    --cc=hpa@redhat.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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