Re: [PATCH][RESEND] New driver for TLV493D-A1B6 I2C chip, input and hwmon class device.
From: Jonathan Cameron
Date: Mon Oct 28 2019 - 09:05:37 EST
On Fri, 18 Oct 2019 13:56:37 -0700
Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote:
> Hi Jakub,
>
> On Fri, Oct 18, 2019 at 10:10:19PM +0200, Jakub Ladman wrote:
> > Dear maintainers.
> >
> > As a linux-patch newbie i made some mistakes in my first attempt to send
> > this patch.
> > This patch contains a new driver for i2c connected chip, Infineon
> > TLV493D-A1B6.
> > The chip is 3D hall-effect sensor with thermometer.
> >
> > This particular driver senses magnetic field rotation in X/Y plane with 1
> > degree resolution and +/- 1 degree error.
> >
> > Input device is created for the angle sensing part.
> > Hwmon device is created for the thermometer part.
> >
> > Input device axis must be configured by device-tree. There are also optional
> > parameters regarding absolute/relative mode switching, minimum step in
> > relative mode, filtering and thermometer calibration.
> >
> > We are using that device as high reliability rotary encoder.
>
> I wonder if IIO subsystem that support s magnetometers and temperature
> sensors would not be a better hone for this.
>
> CC-ing Jonathan.
>
Hi Jakub, Dmitry,
Sorry for slow reply, was on vacation.
Anyhow, from a quick glance at the datasheet this looks like a fairly standard
magnetometer, be it one designed for use with an associated magnet, rather than
intended for use to measure the earths magnetic field (compass type chips).
These devices only become an 'input device' once the relative positioning relative
to the magnet is known. We should probably figure out a way to represent that
in DT etc for devices where it is known. Whether we then do a bridge to input
using that info in kernel or pass it all up to userspace to deal with is a
separate issue, that position information needs to be described first. My suspicion
is that it would be hard to handle the maths in kernel, but I've not tried
working it out!
So this would fit in IIO, even if the eventual 'use case' is classic input
(I'm guessing a rotary dial).
We have a driver for a part with similar support undergoing revisions at the
moment:
https://www.azoteq.com/images/stories/pdf/iqs624_datasheet.pdf
There might be other hall effect devices like this in IIO, I can't recall but
I certainly have one in my todo pile.
+CC linux-iio
Thanks,
Jonathan
> Also, your mailer mangled your patch pretty badly, please consider using
> git send-email next time.
>
> Thanks.
>