[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85e214c8-b639-5197-70a1-7279f9418f66@metafoo.de>
Date: Thu, 20 Apr 2023 06:47:32 -0700
From: Lars-Peter Clausen <lars@...afoo.de>
To: Herve Codina <herve.codina@...tlin.com>,
Jonathan Cameron <jic23@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
Christophe Leroy <christophe.leroy@...roup.eu>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH 2/3] iio: potentiometer: Add support for the Renesas X9250
potentiometers
On 4/20/23 05:13, Herve Codina wrote:
> The Renesas X9250 integrates four digitally controlled potentiometers.
> On each potentiometer, the X9250T has a 100 kOhms total resistance and
> the X9250U has a 50 kOhms total resistance.
>
> Signed-off-by: Herve Codina <herve.codina@...tlin.com>
Hi,
Looks perfect! Just one small comment.
> +static int x9250_write8(struct x9250 *x9250, u8 cmd, u8 val)
> +{
> + struct spi_transfer xfer = {
> + .tx_buf = &x9250->spi_tx_buf,
> + .len = 3,
> + };
> + int ret;
> +
> + BUILD_BUG_ON(sizeof(x9250->spi_tx_buf) < 3);
> +
> + mutex_lock(&x9250->lock);
> +
> + x9250->spi_tx_buf[0] = 0x50;
The 0x50 shows up as a magic constant in multiple places, a define for
it would be nice.
> + x9250->spi_tx_buf[1] = cmd;
> + x9250->spi_tx_buf[2] = val;
> +
> + ret = spi_sync_transfer(x9250->spi, &xfer, 1);
> +
> + mutex_unlock(&x9250->lock);
> +
> + return ret;
> +}
Powered by blists - more mailing lists