From: Joshua Crofts <crofts@kernel.org>
To: Maxime Chevallier <maxime.chevallier@bootlin.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>,
"Matti Vaittinen" <mazziesaccount@gmail.com>,
"Rodolfo Giometti" <giometti@enneenne.com>,
"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Angelo Dureghello" <adureghello@baylibre.com>,
"Tobias Sperling" <tobias.sperling@softing.com>,
"Eason Yang" <j2anfernee@gmail.com>,
"Marilene Andrade Garcia" <marilene.agarcia@gmail.com>,
"Cosmin Tanislav" <cosmin-gabriel.tanislav.xa@renesas.com>,
duje@dujemihanovic.xyz, herve.codina@bootlin.com,
thomas.petazzoni@bootlin.com, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: adc: add driver for Texas Instruments TLA2528 adc
Date: Wed, 4 Nov 2026 14:56:41 +0100 [thread overview]
Message-ID: <20261104145641.000070f2@kernel.org> (raw)
In-Reply-To: <20261104125726.1754980-3-maxime.chevallier@bootlin.com>
On Wed, 4 Nov 2026 13:57:25 +0100
Maxime Chevallier <maxime.chevallier@bootlin.com> wrote:
...
> diff --git a/drivers/iio/adc/ti-tla2528.c b/drivers/iio/adc/ti-tla2528.c
> new file mode 100644
> index 000000000000..ec754ec43d7c
> --- /dev/null
> +++ b/drivers/iio/adc/ti-tla2528.c
> @@ -0,0 +1,215 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Driver for Texas Instruments TLA2528 ADC
> + *
> + * Copyright (C) 2020-2021 Rodolfo Giometti <giometti@enneenne.com>
> + * Copyright (C) 2025 Maxime Chevallier <maxime.chevallier@bootlin.com>
> + * Datasheet: https://www.ti.com/lit/gpn/tla2528
> + */
> +
> +#include <linux/bits.h>
> +#include <linux/cleanup.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/mod_devicetable.h>
Remove mod_devicetable.h, now i2c.h supplies this. See Uwe Kleine-Konig's
work on this.
> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/types.h>
> +#include <linux/units.h>
> +
> +#include <linux/iio/adc-helpers.h>
> +#include <linux/iio/iio.h>
> +
+ #include <asm/byteorder.h> for be16_to_cpu()
> +#define TLA2528_OP_WRITE_REG 0x08
> +#define TLA2528_OP_READ_REG 0x10
> +
> +#define TLA2528_GENERAL_CFG_ADR 0x01
> +#define TLA2528_GENERAL_CFG_RST BIT(0)
> +#define TLA2528_CHANNEL_SEL_ADR 0x11
> +#define TLA2528_CHANNEL_SEL_MANUAL_CHID GENMASK(3, 0)
> +#define TLA2528_AUTO_SEQ_CH_SEL_ADR 0x12
> +
> +#define TLA2528_NUM_CHANNELS 8
> +
> +struct tla2528 {
> + struct i2c_client *client;
> + struct regmap *regmap;
> + int vref_mv;
Slight nit, but _mV so we emphasize this is a SI unit.
> +
> + /* Protects manual channel selection */
> + struct mutex lock;
> +};
> +
...
> +static int tla2528_read(struct tla2528 *tla2528, u8 channel, int *val)
> +{
> + __be16 data;
> + int ret;
> +
> + guard(mutex)(&tla2528->lock);
> +
> + ret = regmap_update_bits(tla2528->regmap, TLA2528_CHANNEL_SEL_ADR,
> + TLA2528_CHANNEL_SEL_MANUAL_CHID, channel);
> + if (ret)
> + return ret;
> +
> + ret = i2c_master_recv(tla2528->client, (char *)&data, sizeof(data));
> + if (ret < 0)
> + return ret;
>
As rare as short reads may be, perhaps add a check whether the expected amount
of bits have been returned from the device?
--
Kind regards,
Joshua Crofts
next prev parent reply other threads:[~2026-11-04 13:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 12:57 [PATCH v3 0/2] iio: adc: add driver for Texas Instruments TLA2528 adc Maxime Chevallier
2026-11-04 12:57 ` [PATCH v3 1/2] dt-bindings: iio: adc: add Texas Instruments TLA2528 Maxime Chevallier
2026-11-04 13:58 ` Joshua Crofts
2026-11-04 12:57 ` [PATCH v3 2/2] iio: adc: add driver for Texas Instruments TLA2528 adc Maxime Chevallier
2026-11-04 13:05 ` sashiko-bot
2026-11-04 13:56 ` Joshua Crofts [this message]
2026-11-04 15:41 ` Andy Shevchenko
2026-11-04 15:45 ` Joshua Crofts
2026-11-04 18:06 ` Maxime Chevallier
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=20261104145641.000070f2@kernel.org \
--to=crofts@kernel.org \
--cc=adureghello@baylibre.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=conor+dt@kernel.org \
--cc=cosmin-gabriel.tanislav.xa@renesas.com \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=duje@dujemihanovic.xyz \
--cc=giometti@enneenne.com \
--cc=herve.codina@bootlin.com \
--cc=j2anfernee@gmail.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=marilene.agarcia@gmail.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mazziesaccount@gmail.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=tobias.sperling@softing.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