[Letux-kernel] RFC: iio input bridge

Belisko Marek marek.belisko at gmail.com
Thu Dec 22 20:21:08 CET 2016

Hi Nikolaus,

On Fri, Dec 16, 2016 at 2:59 PM, H. Nikolaus Schaller <hns at goldelico.com> wrote:
> Hi,
> we still had some trouble on the GTA04 with the accelerometer
> input driver (evtest /dev/input/accel). The reason is that it
> is some misc driver for the BMA150 and we have mis-used it for
> the bma180 although we didn't recognise that the bma180 has
> different registers. Recently it was even proposed to remove the
> (wrong) bma180 support completely.
> Additionally, for the Pyra and GTA04A5 with BMC150 accelerometer
> we even have no input compatible driver.
> Writing new input accelerometer drivers isn't a good strategy
> since this feature is considered old by kernel maintainers because
> there are already good iio drivers around and they suggest to
> use those.
> This is easy for new designs where user-space is also easily
> modifiable.
> But the problem is that some (older) user spaces (e.g. Replicant)
> assumes that device position is reported through /dev/input.
> And Linus say: "we never break user space...". Therefore
> simply dropping the bma180 support and using iio only is no
> working solution.
> A new idea was to add an iio-input bridge driver into the
> iio core framework which simply looks for iio accelerometers
> and takes the first 3 channels as X, Y and Z. It then registers
> a new /dev/input device, reads the iio channels every 1/10th
> second, scales the values and sends input events.
> An important design choice was to implement it in a way that
> we don't need any DT updates and that it is self-configuring,
> at least for boards with a single 3-axis accelerometer. And
> that the extension is completely disabled if not configured into
> the kernel.
> The result of hacking a little around is that we now have the
> /dev/input/accel for all devices (GTA04 with BMA180, GTA04A5
> and Pyra with BMC150 - if installed - and BNO055 should also
> work if configured for accelerometer).
> Code isn't clean but works:
>         http://git.goldelico.com/?p=gta04-kernel.git;a=shortlog;h=refs/heads/work/hns/iio-input-bridge
Personally I like idea and if it work we can use it. But when we would
like to post upstream I think we need to make this driver more generic
(add possibility to supply channels for reporting) to if necessary
also other iio drivers can use that interface. But as start point I
think it's great.
> Comments are welcome.
> BR,
> Nikolaus
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel



as simple and primitive as possible
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

More information about the Letux-kernel mailing list