From: Jonathan Cameron <jic23@kernel.org>
To: Gregor Boirie <gregor.boirie@parrot.com>, linux-iio@vger.kernel.org
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Irina Tirdea <irina.tirdea@intel.com>,
Cristina Moraru <cristina.moraru09@gmail.com>,
Daniel Baluta <daniel.baluta@intel.com>,
Julia Lawall <Julia.Lawall@lip6.fr>
Subject: Re: [PATCH v2 3/5] iio:magnetometer:ak8975: power regulator support
Date: Sat, 5 Mar 2016 15:26:14 +0000 [thread overview]
Message-ID: <56DAFA96.5090605@kernel.org> (raw)
In-Reply-To: <436d3e01c4aab954bc836454c95360489b03f34b.1457001111.git.gregor.boirie@parrot.com>
On 03/03/16 10:44, Gregor Boirie wrote:
> Add support for an optional regulator which, if found into device-tree,
> will power on device at probing time.
> The regulator is declared into ak8975 DTS entry as a "vdd-supply" property.
>
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Applied.
> ---
> .../devicetree/bindings/iio/magnetometer/ak8975.txt | 2 ++
> drivers/iio/magnetometer/ak8975.c | 16 ++++++++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt
> index 011679f..34a3206 100644
> --- a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt
> +++ b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt
> @@ -8,6 +8,7 @@ Required properties:
> Optional properties:
>
> - gpios : should be device tree identifier of the magnetometer DRDY pin
> + - vdd-supply: an optional regulator that needs to be on to provide VDD
>
> Example:
>
> @@ -15,4 +16,5 @@ ak8975@0c {
> compatible = "asahi-kasei,ak8975";
> reg = <0x0c>;
> gpios = <&gpj0 7 0>;
> + vdd-supply = <&ldo_3v3_gnss>;
> };
> diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
> index 896b13e3..72c03d9 100644
> --- a/drivers/iio/magnetometer/ak8975.c
> +++ b/drivers/iio/magnetometer/ak8975.c
> @@ -32,6 +32,7 @@
> #include <linux/gpio.h>
> #include <linux/of_gpio.h>
> #include <linux/acpi.h>
> +#include <linux/regulator/consumer.h>
>
> #include <linux/iio/iio.h>
> #include <linux/iio/sysfs.h>
> @@ -379,8 +380,23 @@ static int ak8975_who_i_am(struct i2c_client *client,
> enum asahi_compass_chipset type)
> {
> u8 wia_val[2];
> + struct regulator *vdd = devm_regulator_get_optional(&client->dev,
> + "vdd");
> int ret;
>
> + /* Enable attached regulator if any. */
> + if (!IS_ERR(vdd)) {
> + ret = regulator_enable(vdd);
> + if (ret) {
> + dev_err(&client->dev, "Failed to enable Vdd supply\n");
> + return ret;
> + }
> + } else {
> + ret = PTR_ERR(vdd);
> + if (ret != -ENODEV)
> + return ret;
> + }
> +
> /*
> * Signature for each device:
> * Device | WIA1 | WIA2
>
next prev parent reply other threads:[~2016-03-05 15:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 10:44 [PATCH v2 0/5] iio:magnetometer:ak8975: fix and enhancements Gregor Boirie
2016-03-03 10:44 ` [PATCH v2 1/5] iio:magnetometer:ak8975: fix uninitialized chipset Gregor Boirie
2016-03-05 15:24 ` Jonathan Cameron
2016-03-03 10:44 ` [PATCH v2 2/5] iio:magnetometer:ak8975: remove unused field Gregor Boirie
2016-03-05 15:25 ` Jonathan Cameron
2016-03-03 10:44 ` [PATCH v2 3/5] iio:magnetometer:ak8975: power regulator support Gregor Boirie
2016-03-05 15:26 ` Jonathan Cameron [this message]
2016-03-03 10:44 ` [PATCH v2 4/5] iio:magnetometer:ak8975: mounting matrix support Gregor Boirie
2016-03-05 15:36 ` Jonathan Cameron
2016-03-09 10:56 ` Gregor Boirie
2016-03-09 20:46 ` Jonathan Cameron
2016-03-10 2:15 ` Rob Herring
2016-03-12 9:44 ` Jonathan Cameron
2016-03-14 17:19 ` Gregor Boirie
2016-03-15 21:56 ` Jonathan Cameron
2016-03-17 16:15 ` Gregor Boirie
2016-03-03 10:44 ` [PATCH v2 5/5] iio:magnetometer:ak8975: triggered buffer support Gregor Boirie
2016-03-05 15:45 ` 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=56DAFA96.5090605@kernel.org \
--to=jic23@kernel.org \
--cc=Julia.Lawall@lip6.fr \
--cc=cristina.moraru09@gmail.com \
--cc=daniel.baluta@intel.com \
--cc=geert@linux-m68k.org \
--cc=gregor.boirie@parrot.com \
--cc=irina.tirdea@intel.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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;
as well as URLs for NNTP newsgroup(s).