Re: [PATCH v2 2/6] iio: adc: ti-ads1298: fix power-up and clock handling
From: Jonathan Cameron
Date: Sun Oct 25 2026 - 19:08:03 EST
On Sat, 24 Oct 2026 20:13:31 -0300
Stephan Costa Barros <stephanbrrs8@xxxxxxxxx> wrote:
> Fix three issues with the power-up sequence and the device clock:
>
> - The datasheet powers up the supplies first, then the clock, then
> waits t_POR = 2^18 clock cycles (128 ms at 2.048 MHz) before the
> reset. The driver enabled an external clock and the vref supply
> before AVDD, reset right away, and did not wait for the 150 ms
> start-up of the internal reference. Follow the datasheet. Probe takes
> about 280 ms longer.
>
> - The binding describes one optional clock and no clock-names, but the
> driver asked for the clock named "clk". With a device tree that
> follows the binding, the lookup fails, the optional getter returns
> NULL, and a clock given in the device tree is never enabled, while the
> sampling frequency is computed from the nominal 2.048 MHz. Ask for the
> first clock of the node; a device tree with clock-names = "clk" still
> gets the same clock.
>
> - A command takes 4 cycles of the device clock to decode, the minimum
> reset pulse is 2 cycles, and the reset takes 18 more. These were
> converted with the nominal 2.048 MHz, so a command ends after a fixed
> 2 us, short of 4 cycles with an external clock below 2 MHz, which the
> ADS129x allows down to 1.94 MHz. Convert them with the rate of the
> clock in use. At 2.048 MHz the delays do not change.
>
> The clock lookup was seen to fail on a Raspberry Pi 4, with a
> fixed-clock in the device tree. The power-up order was found by review
> and reproduced on an emulated device only. The decode time was found
> with an emulated device; it is not seen on hardware running at
> 2.048 MHz.
>
> Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver")
> Signed-off-by: Stephan Costa Barros <stephanbrrs8@xxxxxxxxx>
As before, this is multiple issues so needs breaking into more
focused patches. That may come at the cost of some code
churn but it will make them easier to review.
Jonathan