From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "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>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: dac: mcp47a1: add support for new device
Date: Wed, 22 Jul 2026 08:30:16 +0200 [thread overview]
Message-ID: <20260722083016.000062c4@gmail.com> (raw)
In-Reply-To: <al_a_pbITuYMg0KH@ashevche-desk.local>
On Tue, 21 Jul 2026 23:47:58 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Tue, Jul 21, 2026 at 08:24:39PM +0200, Joshua Crofts wrote:
> > The Microchip MCP47A1 is a 6-bit volatile Digital-to-Analog converted
> > which communicates via I2C.
>
> ...
>
> > +#include <linux/array_size.h>
> > +#include <linux/err.h>
> > +#include <linux/i2c.h>
> > +#include <linux/module.h>
> > +#include <linux/regmap.h>
> > +#include <linux/regulator/consumer.h>
> > +#include <linux/types.h>
> > +#include <linux/units.h>
>
>
> > +struct mcp47a1_data {
> > + struct regmap *regmap;
> > + int vref_mv;
>
> _mV
ACK.
>
> ...
>
> > +static const struct regmap_config mcp47a1_regmap_config = {
> > + .name = "mcp47a1",
> > + .reg_bits = 8,
> > + .val_bits = 8,
> > + .max_register = MCP47A1_CMD_CODE,
> > +};
>
> No cache?
Hmmm, could you elaborate a bit more? I assume you're talking about
regcache but I'm not sure on how to use it here.
>
> ...
>
> > +static int mcp47a1_probe(struct i2c_client *client)
> > +{
> > + struct device *dev = &client->dev;
> > + struct mcp47a1_data *data;
> > + struct iio_dev *indio_dev;
> > + int reg_val;
> > + int ret;
> > +
> > + indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> > + if (!indio_dev)
> > + return -ENOMEM;
> > +
> > + data = iio_priv(indio_dev);
>
> > + i2c_set_clientdata(client, indio_dev);
>
> Is it used?
Nope, it isn't, good catch.
>
> > + data->regmap = devm_regmap_init_i2c(client, &mcp47a1_regmap_config);
> > + if (IS_ERR(data->regmap))
> > + return dev_err_probe(dev, PTR_ERR(data->regmap),
> > + "Failed to initialize regmap\n");
> > +
> > + ret = devm_regulator_get_enable(dev, "vdd");
> > + if (ret)
> > + return dev_err_probe(dev, ret, "Failed to enable regulator\n");
> > +
> > + ret = devm_regulator_get_enable_read_voltage(dev, "vref");
> > + if (ret < 0)
> > + return dev_err_probe(dev, ret, "Failed to read vref\n");
> > +
> > + data->vref_mv = ret / MILLI;
>
> (MICRO / MILLI)
ACK.
--
Kind regards,
Joshua Crofts
prev parent reply other threads:[~2026-07-22 6:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 18:24 [PATCH 0/2] iio: dac: mcp47a1: add support for new device Joshua Crofts
2026-07-21 18:24 ` [PATCH 1/2] dt-bindings: iio: dac: add support for mcp47a1 Joshua Crofts
2026-07-22 16:47 ` Conor Dooley
2026-07-21 18:24 ` [PATCH 2/2] iio: dac: mcp47a1: add support for new device Joshua Crofts
2026-07-21 20:47 ` Andy Shevchenko
2026-07-22 6:30 ` Joshua Crofts [this message]
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=20260722083016.000062c4@gmail.com \
--to=joshua.crofts1@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--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=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