public inbox for linux-sunxi@lists.linux.dev
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Hugo Villeneuve <hvilleneuve@dimonoff.com>,
	Nuno Sa <nuno.sa@analog.com>,
	David Lechner <dlechner@baylibre.com>,
	Javier Carrasco <javier.carrasco.cruz@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v3 3/9] iio: adc: Support ROHM BD79124 ADC
Date: Sun, 2 Mar 2025 02:44:34 +0000	[thread overview]
Message-ID: <20250302024434.67ef4c90@jic23-huawei> (raw)
In-Reply-To: <125ab96e-1e92-4022-95fe-324cd47ce1d9@gmail.com>

On Mon, 24 Feb 2025 08:14:23 +0200
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> On 23/02/2025 18:28, Jonathan Cameron wrote:
> > On Wed, 19 Feb 2025 14:30:43 +0200
> > Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> >   
> >> The ROHM BD79124 is a 12-bit, 8-channel, SAR ADC. The ADC supports
> >> an automatic measurement mode, with an alarm interrupt for out-of-window
> >> measurements. The window is configurable for each channel.
> >>
> >> The I2C protocol for manual start of the measurement and data reading is
> >> somewhat peculiar. It requires the master to do clock stretching after
> >> sending the I2C slave-address until the slave has captured the data.
> >> Needless to say this is not well suopported by the I2C controllers.
> >>
> >> Thus the driver does not support the BD79124's manual measurement mode
> >> but implements the measurements using automatic measurement mode relying
> >> on the BD79124's ability of storing latest measurements into register.
> >>
> >> The driver does also support configuring the threshold events for
> >> detecting the out-of-window events.
> >>
> >> The BD79124 keeps asserting IRQ for as long as the measured voltage is
> >> out of the configured window. Thus the driver masks the received event
> >> for a fixed duration (1 second) when an event is handled. This prevents
> >> the user-space from choking on the events
> >>
> >> The ADC input pins can be also configured as general purpose outputs.
> >> Those pins which don't have corresponding ADC channel node in the
> >> device-tree will be controllable as GPO.
> >>
> >> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> >>  
> > Hi Matti,
> > 
> > Some fairly superficial review follows. I'm travelling for next few weeks
> > so not sure when I'll get time to take a more thorough look.  
> 
> Yeah, unfortunately people are allowed to have other life beyond the 
> ROHM drivers :D
> Enjoy your journey(s) ;)

So far so good.  Hi from Shenzhen.  Obligatory pilgrimage to SEG market
done ;)

> >> +	/* Set no channels to be manually measured */
> >> +	ret = regmap_write(data->map, BD79124_REG_MANUAL_CHANNELS, 0x0);
> >> +	if (ret)
> >> +		return ret;
> >> +
> >> +	/* Set the measurement interval to 0.75 mS */
> >> +	regval = FIELD_PREP(BD79124_MASK_AUTO_INTERVAL, BD79124_INTERVAL_075);
> >> +	ret = regmap_update_bits(data->map, BD79124_REG_OPMODE_CFG,
> >> +			BD79124_MASK_AUTO_INTERVAL, regval);  
> > 
> > Where it doesn't make any other difference, align after (
> > 
> > If you are going shorter, single tab only.  
> 
> Single tab only? You mean like:
> 
> ret = regmap_update_bits(data->map, BD79124_REG_OPMODE_CFG,
> 	BD79124_MASK_AUTO_INTERVAL, regval);
> 
> Do you prefer that even if the variable holding the return value was 
> longer than 8 chars? To me it looks odd if arguments on the next line 
> begin earlier than the function on previous line:
> 
> longvariable = regmap_update_bits(data->map, BD79124_REG_OPMODE_CFG,
> 	BD79124_MASK_AUTO_INTERVAL, regval);
> 
> (Just ensuring I understood your preference).
It's hard to come up with an absolute policy / preference on this but
whilst I agree it looks a bit odd, I think it's easier to say one
tab as 'default' choice.  Obviously if it's really hideous for some
reason feel free to do something else ;)

Jonathan

  reply	other threads:[~2025-03-02  2:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19 12:29 [PATCH v3 0/9] Support ROHM BD79124 ADC Matti Vaittinen
2025-02-19 12:30 ` [PATCH v3 1/9] dt-bindings: ROHM BD79124 ADC/GPO Matti Vaittinen
2025-02-19 12:30 ` [PATCH v3 2/9] iio: adc: add helpers for parsing ADC nodes Matti Vaittinen
2025-02-19 20:41   ` Andy Shevchenko
2025-02-20  7:13     ` Matti Vaittinen
2025-02-20 12:41       ` Andy Shevchenko
2025-02-20 13:40         ` Matti Vaittinen
2025-02-20 14:04           ` Andy Shevchenko
2025-02-20 14:21             ` Matti Vaittinen
2025-02-20 14:56               ` Andy Shevchenko
2025-02-21 10:10                 ` Matti Vaittinen
2025-02-21 16:41                   ` Andy Shevchenko
2025-02-22 14:34                     ` Matti Vaittinen
2025-02-22 17:48                     ` Jonathan Cameron
2025-02-23 16:13   ` Jonathan Cameron
2025-02-24 13:45     ` Matti Vaittinen
2025-02-19 12:30 ` [PATCH v3 3/9] iio: adc: Support ROHM BD79124 ADC Matti Vaittinen
2025-02-23 16:28   ` Jonathan Cameron
2025-02-24  6:14     ` Matti Vaittinen
2025-03-02  2:44       ` Jonathan Cameron [this message]
2025-02-19 12:30 ` [PATCH v3 4/9] MAINTAINERS: Add IIO ADC helpers Matti Vaittinen
2025-02-19 12:31 ` [PATCH v3 5/9] MAINTAINERS: Add ROHM BD79124 ADC/GPO Matti Vaittinen
2025-02-19 12:31 ` [PATCH v3 6/9] iio: adc: rzg2l_adc: Use adc-helpers Matti Vaittinen
2025-02-19 13:36   ` Matti Vaittinen
2025-02-20 16:07   ` kernel test robot
2025-02-23 16:30   ` Jonathan Cameron
2025-02-24  5:40     ` Matti Vaittinen
2025-02-19 12:31 ` [PATCH v3 7/9] iio: adc: sun20i-gpadc: " Matti Vaittinen
2025-02-20 16:17   ` kernel test robot
2025-02-19 12:32 ` [PATCH v3 8/9] iio: adc: ti-ads7924 Drop unnecessary function parameters Matti Vaittinen
2025-02-19 12:32 ` [PATCH v3 9/9] iio: adc: ti-ads7924: Respect device tree config Matti Vaittinen
2025-03-01  3:06   ` 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=20250302024434.67ef4c90@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=hvilleneuve@dimonoff.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /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