Devicetree
 help / color / mirror / Atom feed
From: Erikas Bitovtas <xerikasxx@gmail.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Peter Meerwald" <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	 phone-devel@vger.kernel.org,
	Erikas Bitovtas <xerikasxx@gmail.com>
Subject: [PATCH v6 3/8] iio: light: vcnl4000: move power enablement from init to probe
Date: Fri, 20 Mar 2026 18:45:38 +0200	[thread overview]
Message-ID: <20260320-vcnl4000-regulators-v6-3-0d24d20b1a5b@gmail.com> (raw)
In-Reply-To: <20260320-vcnl4000-regulators-v6-0-0d24d20b1a5b@gmail.com>

Given both vcnl4000_init() and vcnl4200_init() end with
dev->chip_spec->set_power_state(), they can be called once from the
probe to enable the sensors. Move the set_power_state function from init
and call it after init function in probe.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
 drivers/iio/light/vcnl4000.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 939ff2d65105..287ccd89cfb2 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -280,7 +280,7 @@ static int vcnl4000_init(struct vcnl4000_data *data)
 	data->rev = ret & 0xf;
 	data->al_scale = 250000;
 
-	return data->chip_spec->set_power_state(data, true);
+	return 0;
 };
 
 static ssize_t vcnl4000_write_als_enable(struct vcnl4000_data *data, bool en)
@@ -425,10 +425,6 @@ static int vcnl4200_init(struct vcnl4000_data *data)
 	if (ret < 0)
 		return ret;
 
-	ret = data->chip_spec->set_power_state(data, true);
-	if (ret < 0)
-		return ret;
-
 	return 0;
 };
 
@@ -2003,6 +1999,10 @@ static int vcnl4000_probe(struct i2c_client *client)
 	if (ret < 0)
 		return ret;
 
+	ret = data->chip_spec->set_power_state(data, true);
+	if (ret)
+		return ret;
+
 	dev_dbg(&client->dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
 		data->chip_spec->prod, data->rev);
 

-- 
2.53.0


  parent reply	other threads:[~2026-03-20 16:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 16:45 [PATCH v6 0/8] iio: light: vcnl4000: add regulator support Erikas Bitovtas
2026-03-20 16:45 ` [PATCH v6 1/8] dt-bindings: iio: light: vcnl4000: add regulators Erikas Bitovtas
2026-03-21 10:14   ` Krzysztof Kozlowski
2026-03-21 12:42   ` Jonathan Cameron
2026-03-20 16:45 ` [PATCH v6 2/8] iio: light: vcnl4000: sort includes by their name Erikas Bitovtas
2026-03-20 16:45 ` Erikas Bitovtas [this message]
2026-03-20 16:45 ` [PATCH v6 4/8] iio: light: vcnl4000: replace mutex_init() with devm_mutex_init() Erikas Bitovtas
2026-03-20 16:45 ` [PATCH v6 5/8] iio: light: vcnl4000: remove error messages for trigger and irq Erikas Bitovtas
2026-03-20 16:45 ` [PATCH v6 6/8] iio: light: vcnl4000: use variables for I2C client and device instances Erikas Bitovtas
2026-03-20 16:45 ` [PATCH v6 7/8] iio: light: vcnl4000: remove redundant check for proximity-near-level Erikas Bitovtas
2026-03-20 16:45 ` [PATCH v6 8/8] iio: light: vcnl4000: add support for regulators Erikas Bitovtas
2026-03-20 19:35 ` [PATCH v6 0/8] iio: light: vcnl4000: add regulator support Andy Shevchenko
2026-03-21 12:42   ` Jonathan Cameron

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=20260320-vcnl4000-regulators-v6-3-0d24d20b1a5b@gmail.com \
    --to=xerikasxx@gmail.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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