[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250520204720.11448-1-rodrigo.gobbi.7@gmail.com>
Date: Tue, 20 May 2025 17:43:45 -0300
From: Rodrigo Gobbi <rodrigo.gobbi.7@...il.com>
To: conor@...nel.org
Cc: conor+dt@...nel.org,
devicetree@...r.kernel.org,
jic23@...nel.org,
krzk+dt@...nel.org,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org,
robh@...nel.org,
rodrigo.gobbi.7@...il.com,
~lkcamp/patches@...ts.sr.ht
Subject: Re: [PATCH v2] dt-bindings:iio:adc:st,spear600-adc: txt to yaml format conversion.
> Sounds like it's a 4-bit register where the samples is (1 + written value),
> and the property is expected to be written directly to the register.
> I'd then expect the property to be min 0, default 0, max 127. If you
> write 128 to the register, you'll accidentally set the external vref
> bit. I'd maybe go as far as &ing the value to make sure out of range
> stuff is not permitted?
Well, it looks like 4bit as you said (bits 5,6,7 and 8) and 9th bit is vref.
But, in this case, it looks to me that we can only configure 0x15 as a max value,
(didn`t see that before) which doesn`t fit the datasheet sentence that I`ve mentioned before:
"Programmable averaging of results from 1 (No averaging) up to 128"
I mean, I`m not sure how many samples are configured when using
SPEAR_ADC_STATUS_AVG_SAMPLE(0xD) since we don`t have a register map describing
how it encodes that internally. Maybe we can change the requirements for this field to be
min 0, default 0, max 15?
And at the drive side, we could use &ing as you said with 0xf before shiffting?
If you have a different suggestion, I would appreciate it.
...
#define SPEAR_ADC_STATUS_AVG_SAMPLE(x) ((x) << 5)
#define SPEAR_ADC_STATUS_VREF_INTERNAL BIT(9)
...
status = SPEAR_ADC_STATUS_CHANNEL_NUM(chan->channel) |
SPEAR_ADC_STATUS_AVG_SAMPLE(st->avg_samples) |
SPEAR_ADC_STATUS_START_CONVERSION |
SPEAR_ADC_STATUS_ADC_ENABLE;
Tks and regards.
Powered by blists - more mailing lists