From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org,
stefan.popa@analog.com, alexandru.Ardelean@analog.com
Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com
Subject: [PATCH 1/3] staging: iio: ad5933: change regulator binging for vref
Date: Sat, 8 Dec 2018 16:19:08 -0200 [thread overview]
Message-ID: <06caedbbe394a76feedbc77edb0df2c6109217bd.1544292845.git.marcelo.schmitt1@gmail.com> (raw)
In-Reply-To: <cover.1544292845.git.marcelo.schmitt1@gmail.com>
Set a single voltage regulator for all voltage references.
Remove voltage reference value from default platafrom data struct.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Gabriel Capella <gabriel@capella.pro>
Co-Developed-by: Gabriel Capella <gabriel@capella.pro>
---
drivers/staging/iio/impedance-analyzer/ad5933.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 9e52384f5370..730bc397a26b 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -91,7 +91,6 @@
struct ad5933_platform_data {
unsigned long ext_clk_hz;
- unsigned short vref_mv;
};
struct ad5933_state {
@@ -113,7 +112,6 @@ struct ad5933_state {
};
static struct ad5933_platform_data ad5933_default_pdata = {
- .vref_mv = 3300,
};
#define AD5933_CHANNEL(_type, _extend_name, _info_mask_separate, _address, \
@@ -691,7 +689,7 @@ static void ad5933_work(struct work_struct *work)
static int ad5933_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- int ret, voltage_uv = 0;
+ int ret;
struct ad5933_platform_data *pdata = dev_get_platdata(&client->dev);
struct ad5933_state *st;
struct iio_dev *indio_dev;
@@ -718,12 +716,12 @@ static int ad5933_probe(struct i2c_client *client,
dev_err(&client->dev, "Failed to enable specified VDD supply\n");
return ret;
}
- voltage_uv = regulator_get_voltage(st->reg);
+ ret = regulator_get_voltage(st->reg);
+
+ if (ret < 0)
+ goto error_disable_reg;
- if (voltage_uv)
- st->vref_mv = voltage_uv / 1000;
- else
- st->vref_mv = pdata->vref_mv;
+ st->vref_mv = ret / 1000;
if (pdata->ext_clk_hz) {
st->mclk_hz = pdata->ext_clk_hz;
--
2.17.1
next prev parent reply other threads:[~2018-12-08 18:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-08 18:18 [PATCH 0/3] Add devicetree support for ad5933 Marcelo Schmitt
2018-12-08 18:19 ` Marcelo Schmitt [this message]
2018-12-16 12:13 ` [PATCH 1/3] staging: iio: ad5933: change regulator binging for vref Jonathan Cameron
2018-12-08 18:19 ` [PATCH 2/3] staging: iio: ad5933: use clock framework for clock reference Marcelo Schmitt
2018-12-16 12:14 ` Jonathan Cameron
2018-12-08 18:19 ` [PATCH 3/3] staging: iio: ad5933: add binding doc for ad5933 Marcelo Schmitt
2018-12-10 21:27 ` Jonathan Cameron
2018-12-16 12:16 ` Jonathan Cameron
2018-12-08 18:56 ` [PATCH 0/3] Add devicetree support " Marcelo Schmitt
2018-12-08 21:10 ` Greg KH
2018-12-10 21:27 ` Jonathan Cameron
2018-12-11 10:31 ` Ardelean, Alexandru
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=06caedbbe394a76feedbc77edb0df2c6109217bd.1544292845.git.marcelo.schmitt1@gmail.com \
--to=marcelo.schmitt1@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexandru.Ardelean@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=kernel-usp@googlegroups.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=stefan.popa@analog.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;
as well as URLs for NNTP newsgroup(s).