From: Jonathan Cameron <jic23@kernel.org>
To: Vasileios Amoiridis <vassilisamir@gmail.com>
Cc: lars@metafoo.de, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, andriy.shevchenko@linux.intel.com,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/3] iio: chemical: bme680: add regulators
Date: Sat, 30 Nov 2024 14:26:48 +0000 [thread overview]
Message-ID: <20241130142648.62ead7fe@jic23-huawei> (raw)
In-Reply-To: <20241128193246.24572-3-vassilisamir@gmail.com>
On Thu, 28 Nov 2024 20:32:45 +0100
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
> Add support for the regulators described in the dt-binding.
>
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
> ---
> drivers/iio/chemical/bme680_core.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> index 9783953e64e0..186e0a6cc2d7 100644
> --- a/drivers/iio/chemical/bme680_core.c
> +++ b/drivers/iio/chemical/bme680_core.c
> @@ -15,6 +15,7 @@
> #include <linux/log2.h>
> #include <linux/module.h>
> #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
>
> #include <linux/iio/buffer.h>
> #include <linux/iio/iio.h>
> @@ -111,6 +112,10 @@ enum bme680_scan {
> BME680_GAS,
> };
>
> +static const char *const bme680_supply_names[] = { "vdd", "vddio" };
> +
> +#define BME680_NUM_SUPPLIES ARRAY_SIZE(bme680_supply_names)
Trivial: What benefit do we get from this define that is used in one place?
> +
> struct bme680_data {
> struct regmap *regmap;
> struct bme680_calib bme680;
> @@ -1114,6 +1119,14 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap,
> data->heater_dur = 150; /* milliseconds */
> data->preheat_curr_mA = 0;
>
> + ret = devm_regulator_bulk_get_enable(dev, BME680_NUM_SUPPLIES,
ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(bme680_supply_names),
bme680_supply_names);
And don't worry about slightly over 80 chars line.
> + bme680_supply_names);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to get and enable supplies.\n");
> +
> + fsleep(BME680_STARTUP_TIME_US);
> +
> ret = regmap_write(regmap, BME680_REG_SOFT_RESET, BME680_CMD_SOFTRESET);
> if (ret < 0)
> return dev_err_probe(dev, ret, "Failed to reset chip\n");
next prev parent reply other threads:[~2024-11-30 14:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 19:32 [PATCH v4 0/3] iio: chemical bme680: 2nd round of cleanup Vasileios Amoiridis
2024-11-28 19:32 ` [PATCH v4 1/3] dt-bindings: iio: bosch,bme680: Move from trivial-devices and add supplies Vasileios Amoiridis
2024-11-29 7:12 ` Krzysztof Kozlowski
2024-11-29 23:49 ` Vasileios Amoiridis
2024-11-28 19:32 ` [PATCH v4 2/3] iio: chemical: bme680: add regulators Vasileios Amoiridis
2024-11-29 14:33 ` Andy Shevchenko
2024-11-30 14:26 ` Jonathan Cameron [this message]
2024-12-02 18:26 ` Vasileios Amoiridis
2024-11-28 19:32 ` [PATCH v4 3/3] iio: chemical: bme680: add power management Vasileios Amoiridis
2024-11-29 14:32 ` Andy Shevchenko
2024-11-29 23:50 ` Vasileios Amoiridis
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=20241130142648.62ead7fe@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=vassilisamir@gmail.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