Re: [PATCH 1/2] iio: magnetometer: add support for Infineon TLV493D 3D Magentic sensor
From: David Lechner
Date: Tue Jul 29 2025 - 14:52:02 EST
On 7/28/25 10:26 PM, Dixit Parmar wrote:
...
>>> + 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?
>>> + return IIO_VAL_FRACTIONAL;
Most of the sysfs attribute documentation is in
Documentation/ABI/testing/sysfs-bus-iio. Specifically for this
case, it says:
What: /sys/bus/iio/devices/iio:deviceX/in_magn_x_raw
What: /sys/bus/iio/devices/iio:deviceX/in_magn_y_raw
What: /sys/bus/iio/devices/iio:deviceX/in_magn_z_raw
KernelVersion: 2.6.35
Contact: linux-iio@xxxxxxxxxxxxxxx
Description:
Magnetic field along axis x, y or z (may be arbitrarily
assigned). Data converted by application of offset
then scale to Gauss.