Re: [PATCH 1/2] iio: magnetometer: add support for Infineon TLV493D 3D Magentic sensor

Jonathan Cameron
2025-07-29T18:47:49Z

On Tue, 29 Jul 2025 08:56:00 +0530
Dixit Parmar <dixitparmar19@gmail.com> wrote:

> On Sat, Jul 26, 2025 at 03:44:03PM -0500, David Lechner wrote:
> > On 7/26/25 4:37 AM, Dixit Parmar wrote:
> > > The Infineon TLV493D is a Low-Power 3D Magnetic Sensor. The Sensor
> > > applications includes joysticks, control elements (white goods,
> > > multifunction knops), or electric meters (anti tampering) and any
> > > other application that requires accurate angular measurements at
> > > low power consumptions.
> > >
> > > The Sensor is configured over I2C, and as part of Sensor measurement
> > > data it provides 3-Axis magnetic fields and temperature core measurement.
> > >
> > > The driver supports raw value read and buffered input via external trigger
> > > to allow streaming values with the same sensing timestamp.
> > >
> > > The device can be configured in to different operating modes by optional
> > > device-tree "mode" property. Also, the temperature sensing part requires
> > > raw offset captured at 25°C and that can be specified by "temp-offset"
> > > optional device-tree property.
> > >
> > > While sensor has interrupt pin multiplexed with I2C SCL pin. But for bus
> > > configurations interrupt(INT) is not recommended, unless timing constraints
> > > between I2C data transfers and interrupt pulses are monitored and aligned.
> > >
> > > The Sensor's I2C register map and mode information is described in product
> > > User Manual[1].
> > >
> > > Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf
> > > [1] https://www.mouser.com/pdfDocs/Infineon-TLV493D-A1B6_3DMagnetic-UserManual-v01_03-EN.pdf
> > >
> > > Signed-off-by: Dixit Parmar <dixitparmar19@gmail.com>

Picking out one question for a quick answer...
> > > + return ret;
> > > + }
> > > + /* Return raw values for requested channel */
> > > + switch (chan->address) {
> > > + case AXIS_X:
> > > + *val = x;
> > > + return IIO_VAL_INT;
> > > + case AXIS_Y:
> > > + *val = y;
> > > + return IIO_VAL_INT;
> > > + case AXIS_Z:
> > > + *val = z;
> > > + return IIO_VAL_INT;
> > > + case TEMPERATURE:
> > > + *val = t;
> > > + return IIO_VAL_INT;
> > > + default:
> > > + return -EINVAL;
> > > + }
> > > + case IIO_CHAN_INFO_SCALE:
> > > + switch (chan->type) {
> > > + case IIO_MAGN:
> > > + /*
> > > + * Magnetic field scale: 0.0098 mTesla (i.e. 9.8 µT)
> > > + * Expressed as fractional: 98/10 = 9.8 µT.
> > > + */
> > > + *val = 98;
> > > + *val2 = 10;
> >
> > We use SI units, so this needs to be gauss, not tesela.
> >
> Sure, Is there any documentation/reference this details are mentioned?

Documentation/ABI/testing/sysfs-bus-iio

https://elixir.bootlin.com/linux/v6.16/source/Documentation/ABI/testing/sysfs-bus-iio#L342
is the specific entry for magnetic fields.

Otherwise a small process thing - where you are agreeing with review
feedback, no need to put it in your reply. Much better to just fix
it and have it in the change log for the next version. That will let
you crop away much more of the thread, so we can focus in on questions.

Jonathan