[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160702110227.GB4604@lukather>
Date: Sat, 2 Jul 2016 13:02:27 +0200
From: Maxime Ripard <maxime.ripard@...e-electrons.com>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Chen-Yu Tsai <wens@...e.org>,
Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
Jonathan Cameron <jic23@...nel.org>, linux-iio@...r.kernel.org,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Rob Herring <robh+dt@...nel.org>,
devicetree <devicetree@...r.kernel.org>
Subject: Re: [PATCH 1/2] iio: sun4i-lradc: Add binding documentation
On Sat, Jul 02, 2016 at 11:32:07AM +0200, Hans de Goede wrote:
> Hi,
>
> On 02-07-16 11:12, Chen-Yu Tsai wrote:
> >Hi,
> >
> >On Sat, Jul 2, 2016 at 5:00 AM, Alexandre Belloni
> ><alexandre.belloni@...e-electrons.com> wrote:
> >>Document the bindings for the Allwinner LRADC.
> >
> >We already have Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
> >and I'm pretty sure Hans (CC-ed) argued that this is not a generic ADC
> >block.
>
> Right, this block is used on many tablets and some dev boards to
> provide buttons (as in the hid type) and the block is designed for
> this purpose, giving an irq when the adc level crosses a certain
> threshold.
>
> Sure it can be used in a more generic way, but that is not its
> primary goal.
We've always had a different view on this, but it's a detail :)
> So any generic purpose adc driver must not break the current
> use-case (which is already used in mainline kernel dts files
> in plenty of cases).
Yep.
> I believe that the best way to deal with this is to add an
> "allwinner,general-purpose-mode" flag to the existing binding
> (as well as document general purpose mode in the existing
> binding rather then in a new binding doc).
>
> That seems to be the right thing to do purely looking at this
> from a dt binding pov.
There's a way simpler solution: if there's no child nodes, it's meant
to be used as an ADC, otherwise, as input.
The logic will have to be a bit more complex than that, since there's
two channels, and you could only require one for the buttons, leaving
the other one available as an ADC.
But that doesn't require any new property.
> For the implementation of this we can simpy have 2 drivers,
> then both drivers can check the flag and if present return
> -ENODEV from the existing input driver and likewise if not
> present return -ENODEV from the iio driver.
>
> We may actually use a similar solution for the touchscreen
> controller which can also be alternatively used as a generic
> purpose adc.
There's no need to keep both drivers as long as we keep the features
and bindings.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists