Devicetree
 help / color / mirror / Atom feed
From: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
To: conor@kernel.org
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
	jic23@kernel.org, krzk+dt@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh@kernel.org,
	rodrigo.gobbi.7@gmail.com, ~lkcamp/patches@lists.sr.ht
Subject: Re: [PATCH v2] dt-bindings:iio:adc:st,spear600-adc: txt to yaml format conversion.
Date: Tue, 20 May 2025 17:43:45 -0300	[thread overview]
Message-ID: <20250520204720.11448-1-rodrigo.gobbi.7@gmail.com> (raw)
In-Reply-To: <20250506-equivocal-snooper-8a7d1ce931c8@spud>

> 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.

  reply	other threads:[~2025-05-20 20:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30  1:50 [PATCH v2] dt-bindings:iio:adc:st,spear600-adc: txt to yaml format conversion Rodrigo Gobbi
2025-04-30 15:42 ` Conor Dooley
2025-05-03 18:44   ` Rodrigo Gobbi
2025-05-06 12:50     ` Conor Dooley
2025-05-20 20:43       ` Rodrigo Gobbi [this message]
2025-05-21 15:50         ` Conor Dooley
2025-05-04 16:53 ` Jonathan Cameron

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=20250520204720.11448-1-rodrigo.gobbi.7@gmail.com \
    --to=rodrigo.gobbi.7@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=~lkcamp/patches@lists.sr.ht \
    /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