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: Sat,  3 May 2025 15:44:12 -0300	[thread overview]
Message-ID: <20250503184800.27026-1-rodrigo.gobbi.7@gmail.com> (raw)
In-Reply-To: <20250430-folic-skittle-06b0ccbedf35@spud>

> Is 0 the default here or 1? "Single data conversion" sounds more like 1
> sample than 0, and the default of 0 is below the minimum of 1. What's
> going on there?

Good point, after I`ve submitted the patch I was double checking it and noticed 
that too. It`s stange because the public datasheet mentions "Programmable averaging of results 
from 1 (No averaging) up to 128". Meanwhile, the spear_adc.c driver at probe
stated the following:

	/*
	 * Optional avg_samples defaults to 0, resulting in single data
	 * conversion
	 */
	device_property_read_u32(dev, "average-samples", &st->avg_samples);

Since avg_samples is inside 

	struct spear_adc_state *st;

which is allocated with devm_iio_device_alloc() (which uses the kzalloc/zero filling the priv data):

	indio_dev = devm_iio_device_alloc(dev, sizeof(struct spear_adc_state));
	if (!indio_dev)
		return dev_err_probe(dev, -ENOMEM,
				     "failed allocating iio device\n");

	st = iio_priv(indio_dev);

...matches the driver comment meaning the default is actually "0", single data, but it does
not match the public datasheet in my understanding. Since I don`t have access to a more
detailed datasheet, I chose to describe "1" as a minimum value, but I agree it is weird.
Maybe we could drop the minimum constraint in this case (go with default and max)?
Tks and regards.

  reply	other threads:[~2025-05-03 18:48 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 [this message]
2025-05-06 12:50     ` Conor Dooley
2025-05-20 20:43       ` Rodrigo Gobbi
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=20250503184800.27026-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