From: Herve Codina <herve.codina@bootlin.com>
To: David Lechner <dlechner@baylibre.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Ian Ray <ian.ray@gehealthcare.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 3/4] iio: adc: Add support for the GE HealthCare PMC ADC
Date: Wed, 2 Oct 2024 09:37:49 +0200 [thread overview]
Message-ID: <20241002093749.17f6f239@bootlin.com> (raw)
In-Reply-To: <CAMknhBHRY=MKmpiMnwHk8Gpdi5pWaUOZosyKTzX=83DuAxBvOA@mail.gmail.com>
Hi David,
On Tue, 1 Oct 2024 12:19:16 -0500
David Lechner <dlechner@baylibre.com> wrote:
> On Tue, Oct 1, 2024 at 2:47 AM Herve Codina <herve.codina@bootlin.com> wrote:
> >
> > The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel
> > (voltage and current), 16-Bit ADC with an I2C Interface.
> >
> > Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> > ---
>
> ...
>
> > +static int pmc_adc_read_raw_ch(struct pmc_adc *pmc_adc, u8 cmd, int *val)
> > +{
> > + s32 ret;
> > +
> > + ret = i2c_smbus_read_word_swapped(pmc_adc->client, cmd);
> > + if (ret < 0) {
> > + dev_err(&pmc_adc->client->dev, "i2c read word failed (%d)\n", ret);
> > + return ret;
> > + }
> > +
> > + *val = sign_extend32(ret, 16);
>
> Shouldn't this be 15, not 16?
Yes, indeed, I double checked on my side and it should be 15!
Thanks for catching it. It will be fixed in the next iteration.
>
> > + return 0;
> > +}
> > +
>
> ...
>
> > +
> > +static int pmc_adc_probe(struct i2c_client *client)
> > +{
> > + struct iio_dev *indio_dev;
> > + struct pmc_adc *pmc_adc;
> > + struct clk *clk;
> > + s32 val;
> > + int ret;
> > +
> > + ret = devm_regulator_bulk_get_enable(&client->dev, ARRAY_SIZE(pmc_adc_regulator_names),
> > + pmc_adc_regulator_names);
> > + if (ret)
> > + return dev_err_probe(&client->dev, ret, "Failed to get regulators\n");
> > +
> > + clk = devm_clk_get_optional_enabled(&client->dev, "osc");
> > + if (IS_ERR(clk))
> > + return dev_err_probe(&client->dev, PTR_ERR(clk), "Failed to get osc clock\n");
> > +
> > + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*pmc_adc));
> > + if (!indio_dev)
> > + return -ENOMEM;
> > +
> > + pmc_adc = iio_priv(indio_dev);
> > + pmc_adc->client = client;
> > +
> > + val = i2c_smbus_read_byte_data(pmc_adc->client, PMC_ADC_CMD_REQUEST_PROTOCOL_VERSION);
> > + if (val < 0)
> > + return dev_err_probe(&client->dev, val, "Failed to get protocol version\n");
> > +
> > + if (val != 0x01) {
> > + dev_err(&client->dev, "Unsupported protocol version 0x%02x\n", val);
>
> Use dev_err_probe?
Yes, will be changed in the next iteration.
>
> > + return -EINVAL;
> > + }
> > +
Best regards,
Hervé
next prev parent reply other threads:[~2024-10-02 7:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 7:46 [PATCH 0/4] Add support for the GE HealthCare PMC ADC Herve Codina
2024-10-01 7:46 ` [PATCH 1/4] dt-bindings: vendor-prefixes: Add an entry for GE HealthCare Herve Codina
2024-10-01 16:31 ` Conor Dooley
2024-10-01 7:46 ` [PATCH 2/4] dt-bindings: iio: adc: Add the GE HealthCare PMC ADC Herve Codina
2024-10-01 16:18 ` Conor Dooley
2024-10-01 16:46 ` Herve Codina
2024-10-01 17:03 ` Conor Dooley
2024-10-02 7:04 ` Herve Codina
2024-10-02 14:53 ` Conor Dooley
2024-10-01 7:46 ` [PATCH 3/4] iio: adc: Add support for " Herve Codina
2024-10-01 17:19 ` David Lechner
2024-10-02 7:37 ` Herve Codina [this message]
2024-10-01 19:24 ` Jonathan Cameron
2024-10-02 8:23 ` Herve Codina
2024-10-06 11:15 ` Jonathan Cameron
2024-10-01 7:46 ` [PATCH 4/4] MAINTAINERS: add the GE HealthCare PMC ADC driver entry Herve Codina
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=20241002093749.17f6f239@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=ian.ray@gehealthcare.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.