public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Svyatoslav Ryhel <clamor95@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>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Svyatoslav Ryhel" <clamor95@gmail.com>,
	"Randy Dunlap" <rdunlap@infradead.org>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v1 3/5] misc: apds990x: Drop Vled supply
Date: Sat, 18 Apr 2026 17:47:14 +0300	[thread overview]
Message-ID: <20260418144716.132936-4-clamor95@gmail.com> (raw)
In-Reply-To: <20260418144716.132936-1-clamor95@gmail.com>

According to the APDS9900/9901 documentation, this chip has only one
supply, VDD; hence, drop the Vled supply. Additionally, supply has been
set to lowercase for consistency.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/misc/apds990x.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 742ab331a221..264335b581c1 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -113,7 +113,7 @@ struct apds990x_chip {
 	struct apds990x_platform_data	*pdata;
 	struct i2c_client		*client;
 	struct mutex			mutex; /* avoid parallel access */
-	struct regulator_bulk_data	regs[2];
+	struct regulator		*vdd_supply;
 	wait_queue_head_t		wait;
 
 	int	prox_en;
@@ -179,10 +179,6 @@ static const u8 again[]	= {1, 8, 16, 120}; /* ALS gain steps */
 static const u16 arates_hz[] = {10, 5, 2, 1};
 static const u8 apersis[] = {1, 2, 4, 5};
 
-/* Regulators */
-static const char reg_vcc[] = "Vdd";
-static const char reg_vled[] = "Vled";
-
 static int apds990x_read_byte(struct apds990x_chip *chip, u8 reg, u8 *data)
 {
 	struct i2c_client *client = chip->client;
@@ -597,8 +593,9 @@ static int apds990x_detect(struct apds990x_chip *chip)
 #ifdef CONFIG_PM
 static int apds990x_chip_on(struct apds990x_chip *chip)
 {
-	int err	 = regulator_bulk_enable(ARRAY_SIZE(chip->regs),
-					chip->regs);
+	int err;
+
+	err = regulator_enable(chip->vdd_supply);
 	if (err < 0)
 		return err;
 
@@ -615,7 +612,7 @@ static int apds990x_chip_on(struct apds990x_chip *chip)
 static int apds990x_chip_off(struct apds990x_chip *chip)
 {
 	apds990x_write_byte(chip, APDS990X_ENABLE, APDS990X_EN_DISABLE_ALL);
-	regulator_bulk_disable(ARRAY_SIZE(chip->regs), chip->regs);
+	regulator_disable(chip->vdd_supply);
 	return 0;
 }
 
@@ -1108,14 +1105,12 @@ static int apds990x_probe(struct i2c_client *client)
 	chip->prox_persistence = APDS_DEFAULT_PROX_PERS;
 	chip->prox_continuous_mode = false;
 
-	chip->regs[0].supply = reg_vcc;
-	chip->regs[1].supply = reg_vled;
-
-	err = devm_regulator_bulk_get(dev, ARRAY_SIZE(chip->regs), chip->regs);
-	if (err)
-		return dev_err_probe(dev, err, "failed to get supplies\n");
+	chip->vdd_supply = devm_regulator_get(dev, "vdd");
+	if (IS_ERR(chip->vdd_supply))
+		return dev_err_probe(dev, PTR_ERR(chip->vdd_supply),
+				     "failed to get vdd-supply\n");
 
-	err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), chip->regs);
+	err = regulator_enable(chip->vdd_supply);
 	if (err < 0)
 		return dev_err_probe(dev, err, "cannot enable regulators\n");
 
@@ -1164,7 +1159,7 @@ static int apds990x_probe(struct i2c_client *client)
 error_pm:
 	pm_runtime_disable(dev);
 error_regulator:
-	regulator_bulk_disable(ARRAY_SIZE(chip->regs), chip->regs);
+	regulator_disable(chip->vdd_supply);
 
 	return err;
 }
-- 
2.51.0


  parent reply	other threads:[~2026-04-18 14:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
2026-04-18 14:47 ` [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor Svyatoslav Ryhel
2026-04-18 16:21   ` David Lechner
2026-04-18 14:47 ` [PATCH v1 2/5] misc: apds990x: Use more device managed approach in the probe Svyatoslav Ryhel
2026-04-18 14:47 ` Svyatoslav Ryhel [this message]
2026-04-18 14:47 ` [PATCH v1 4/5] misc: apds990x: Convert to use OF bindings Svyatoslav Ryhel
2026-04-18 14:47 ` [PATCH v1 5/5] misc: apds990x: Drop IRQF_TRIGGER_LOW trigger Svyatoslav Ryhel
2026-04-18 16:24 ` [PATCH v1 0/5] Update APDS990x ALS to support device trees David Lechner
2026-04-18 19:48   ` Svyatoslav Ryhel
2026-04-18 22:18     ` David Lechner
2026-04-18 20:18   ` Arnd Bergmann
2026-04-19  8:00     ` Svyatoslav Ryhel

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=20260418144716.132936-4-clamor95@gmail.com \
    --to=clamor95@gmail.com \
    --cc=andy@kernel.org \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --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=rdunlap@infradead.org \
    --cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox