[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250201130743.5ac0b86d@jic23-huawei>
Date: Sat, 1 Feb 2025 13:07:43 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Angelo Dureghello <adureghello@...libre.com>
Cc: Michael Hennerich <michael.hennerich@...log.com>, Lars-Peter Clausen
<lars@...afoo.de>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Alexandru
Ardelean <aardelean@...libre.com>, David Lechner <dlechner@...libre.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-fbdev@...r.kernel.org, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, Guillaume Stols
<gstols@...libre.com>
Subject: Re: [PATCH v3 07/10] iio: adc: adi-axi-adc: add support for AD7606
register writing
> +static int ad7606_bus_reg_read(struct iio_backend *back, u32 reg, u32 *val)
> +{
> + struct adi_axi_adc_state *st = iio_backend_get_priv(back);
> + u32 buf;
> +
> + guard(mutex)(&st->lock);
> +
> + /*
> + * The address is written on the highest weight byte, and the MSB set
> + * at 1 indicates a read operation.
> + */
> + buf = FIELD_PREP(ADI_AXI_REG_ADDRESS_MASK, reg) | ADI_AXI_REG_READ_BIT;
> + axi_adc_raw_write(back, &buf, sizeof(buf));
> + axi_adc_raw_read(back, val, 4);
sizeof(*val)
> +
> + /* Write 0x0 on the bus to get back to ADC mode */
> + buf = 0;
> + axi_adc_raw_write(back, &buf, sizeof(buf));
> + return 0;
> +}
Powered by blists - more mailing lists