From: Jonathan Cameron <jic23@kernel.org>
To: Olivier Louvignes <olivier@mgcrea.io>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Paul Cercueil" <paul@crapouillou.net>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: adc: Add a driver for the Ingenic X1600 ADC
Date: Sun, 25 Oct 2026 23:45:43 +0000 [thread overview]
Message-ID: <20261025234543.0d5fb3db@jic23-hlaptop> (raw)
In-Reply-To: <20261024041357.34346-2-olivier@mgcrea.io>
On Sat, 24 Oct 2026 06:13:57 +0200
Olivier Louvignes <olivier@mgcrea.io> wrote:
> The X1600's SAR ADC has four auxiliary channels, each with its own start
> bit, interrupt flag and 12-bit result, and none of the touchscreen or
> battery engines of the JZ47xx ADCs that ingenic-adc drives. Add a small
> driver that exposes the four channels as voltages against the 3.3 V
> reference.
>
> There is no datasheet here: the register layout and the clock dividers
> come from the X1600 driver of the vendor's 4.4 kernel.
>
> Tested on a HiBy R1, whose play/pause and volume keys sit on channel 0
> behind adc-keys: all three read and report correctly.
>
> Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
Just one trivial things in addition to the other reviewer comments.
> diff --git a/drivers/iio/adc/ingenic-x1600-adc.c b/drivers/iio/adc/ingenic-x1600-adc.c
> new file mode 100644
> index 000000000000..60683f26c693
> --- /dev/null
> +++ b/drivers/iio/adc/ingenic-x1600-adc.c
> +static int x1600_adc_probe(struct platform_device *pdev)
> +{
> + ret = devm_request_irq(dev, irq, x1600_adc_irq, 0, dev_name(dev), adc);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to request irq\n");
> +
> + /*
> + * Powered up for good: the keys poll it every few tens of milliseconds,
> + * and powering up takes 2 ms.
The keys aren't tightly coupled to this driver so make that a little vaguer.
A typically usecase makes use of .... for which polling is every few...
Hence leave powered up.
> + */
> + writel(0, adc->base + X1600_ADC_REG_ENABLE);
> + fsleep(2000);
> + writel(0, adc->base + X1600_ADC_REG_CTRL);
> + ret = devm_add_action_or_reset(dev, x1600_adc_power_down, adc);
> + if (ret)
> + return ret;
next prev parent reply other threads:[~2026-10-25 23:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 4:13 [PATCH v2 1/2] dt-bindings: iio: adc: Add " Olivier Louvignes
2026-10-24 4:13 ` [PATCH v2 2/2] iio: adc: Add a driver for " Olivier Louvignes
2026-10-24 7:00 ` Joshua Crofts
2026-10-24 10:12 ` Andy Shevchenko
2026-10-24 8:22 ` H. Nikolaus Schaller
2026-10-24 17:57 ` H. Nikolaus Schaller
2026-10-25 23:42 ` Jonathan Cameron
2026-10-25 23:45 ` Jonathan Cameron [this message]
2026-10-24 6:38 ` [PATCH v2 1/2] dt-bindings: iio: adc: Add " Joshua Crofts
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=20261025234543.0d5fb3db@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=olivier@mgcrea.io \
--cc=paul@crapouillou.net \
--cc=robh@kernel.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
all inboxes | Powered by JetHome®