.../iio/magnetometer/infineon,tlv493d.yaml | 45 ++ .../devicetree/bindings/trivial-devices.yaml | 2 - drivers/iio/magnetometer/Kconfig | 13 + drivers/iio/magnetometer/Makefile | 2 + drivers/iio/magnetometer/tlv493d.c | 556 +++++++++++++++++++++ 5 files changed, 616 insertions(+), 2 deletions(-)
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. 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[Link]. Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf Link: https://www.mouser.com/pdfDocs/Infineon-TLV493D-A1B6_3DMagnetic-UserManual-v01_03-EN.pdf Signed-off-by: Dixit Parmar <dixitparmar19@gmail.com> --- Changes in v2: - Drop regmap implementation in favor of using direct i2c APIs to have uniform communication APIs across the driver. - Remove custom device-tree properties as suggested and hardcode setting operating mode in probe(). - Derive and hardcode temperature offset from raw offset and compensation. - Add missing device name(tlv493_) prefix in global variables. - Change float operation with multiplier to fixed value(1100). - Change Magnetic field reporting to Guass SI unit. - User FIELD_PREP instead of direct bitwise ops. - Convert sensor channel parsing logic from Macro to function for better readability. - Discard unused #define's. - Discard IIO_CHAN_INFO_PROCESSED. - Maintain alphabetical order of config options in Makefile and Kconfig. - Readability fixes. - Link to v1: https://lore.kernel.org/r/20250726-tlv493d-sensor-v6_16-rc5-v1-0-deac027e6f32@gmail.com --- Dixit Parmar (2): iio: magnetometer: add support for Infineon TLV493D 3D Magentic sensor dt-bindings: iio: magnetometer: document Infineon TLV493D 3D Magnetic sensor .../iio/magnetometer/infineon,tlv493d.yaml | 45 ++ .../devicetree/bindings/trivial-devices.yaml | 2 - drivers/iio/magnetometer/Kconfig | 13 + drivers/iio/magnetometer/Makefile | 2 + drivers/iio/magnetometer/tlv493d.c | 556 +++++++++++++++++++++ 5 files changed, 616 insertions(+), 2 deletions(-) --- base-commit: d7b8f8e20813f0179d8ef519541a3527e7661d3a change-id: 20250726-tlv493d-sensor-v6_16-rc5-18c712093b27 Best regards, -- Dixit Parmar <dixitparmar19@gmail.com>
On Sat, Aug 2, 2025 at 8:44 AM Dixit Parmar <dixitparmar19@gmail.com> 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. > > While sensor has interrupt pin multiplexed with I2C SCL pin. But for bus the sensor an interrupt an I2C > 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[Link]. Replace Link here with 1... > Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf > Link: https://www.mouser.com/pdfDocs/Infineon-TLV493D-A1B6_3DMagnetic-UserManual-v01_03-EN.pdf ...and add space followed by [1] here. ... > Changes in v2: > - Drop regmap implementation in favor of using direct i2c APIs to > have uniform communication APIs across the driver. This I don't understand. I mean the motivation behind this. Usually direct I2C communication is used to do some initial checks and configuration and rarely for the actuall run-time driver functionality. Otherwise it means that the regmap may be used with a customised read and write methods. -- With Best Regards, Andy Shevchenko
On Sat, 2 Aug 2025 10:53:30 +0200 Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > On Sat, Aug 2, 2025 at 8:44 AM Dixit Parmar <dixitparmar19@gmail.com> 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. > > > > While sensor has interrupt pin multiplexed with I2C SCL pin. But for bus > > the sensor > an interrupt > an I2C > > > 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[Link]. > > Replace Link here with 1... > > > Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf > > Link: https://www.mouser.com/pdfDocs/Infineon-TLV493D-A1B6_3DMagnetic-UserManual-v01_03-EN.pdf > > ...and add space followed by [1] here. > > ... > > > Changes in v2: > > - Drop regmap implementation in favor of using direct i2c APIs to > > have uniform communication APIs across the driver. > > This I don't understand. I mean the motivation behind this. Usually > direct I2C communication is used to do some initial checks and > configuration and rarely for the actuall run-time driver > functionality. Otherwise it means that the regmap may be used with a > customised read and write methods. > This was my suggestion. The device has very odd characteristics that means writes really are not register based. You have to write them all every time with now addressing. So to me regmap just wasn't a good choice here. You could do something some nasty stuff to hammer it into a custom regmap, but to me it's just not a good fit. Jonathan >
On Sat, Aug 2, 2025 at 1:16 PM Jonathan Cameron <jic23@kernel.org> wrote: > > On Sat, 2 Aug 2025 10:53:30 +0200 > Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > > On Sat, Aug 2, 2025 at 8:44 AM Dixit Parmar <dixitparmar19@gmail.com> 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. > > > > > > While sensor has interrupt pin multiplexed with I2C SCL pin. But for bus > > > > the sensor > > an interrupt > > an I2C > > > > > 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[Link]. > > > > Replace Link here with 1... > > > > > Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf > > > Link: https://www.mouser.com/pdfDocs/Infineon-TLV493D-A1B6_3DMagnetic-UserManual-v01_03-EN.pdf > > > > ...and add space followed by [1] here. Note, my above comment also applies to the actual patch. ... > > > Changes in v2: > > > - Drop regmap implementation in favor of using direct i2c APIs to > > > have uniform communication APIs across the driver. > > > > This I don't understand. I mean the motivation behind this. Usually > > direct I2C communication is used to do some initial checks and > > configuration and rarely for the actuall run-time driver > > functionality. Otherwise it means that the regmap may be used with a > > customised read and write methods. > > This was my suggestion. The device has very odd characteristics that > means writes really are not register based. You have to write them all > every time with now addressing. > > So to me regmap just wasn't a good choice here. You could do something > some nasty stuff to hammer it into a custom regmap, but to me it's just > not a good fit. I see, thanks for explaining this to me. Okay, let's leave for now with the direct use of I2C APIs. -- With Best Regards, Andy Shevchenko
On Sat, Aug 02, 2025 at 10:53:30AM +0200, Andy Shevchenko wrote: > On Sat, Aug 2, 2025 at 8:44 AM Dixit Parmar <dixitparmar19@gmail.com> 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. > > > > While sensor has interrupt pin multiplexed with I2C SCL pin. But for bus > > the sensor > an interrupt > an I2C > > > 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[Link]. > > Replace Link here with 1... > > > Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf > > Link: https://www.mouser.com/pdfDocs/Infineon-TLV493D-A1B6_3DMagnetic-UserManual-v01_03-EN.pdf > > ...and add space followed by [1] here. > Orginally it was with [1] only. But I thought I should use known standard tag here so came up with link. For my understanding, what is the standard practice for this? > ... > > > Changes in v2: > > - Drop regmap implementation in favor of using direct i2c APIs to > > have uniform communication APIs across the driver. > > This I don't understand. I mean the motivation behind this. Usually > direct I2C communication is used to do some initial checks and > configuration and rarely for the actuall run-time driver > functionality. Otherwise it means that the regmap may be used with a > customised read and write methods. > On addition to what Jonathan explained, reading from sensor also is not addressable. i.e. To read any sensor register the read op must be performed to read starting from 0 always, without specifying reg address. > > -- > With Best Regards, > Andy Shevchenko
On Mon, Aug 4, 2025 at 4:53 AM Dixit Parmar <dixitparmar19@gmail.com> wrote: > On Sat, Aug 02, 2025 at 10:53:30AM +0200, Andy Shevchenko wrote: > > On Sat, Aug 2, 2025 at 8:44 AM Dixit Parmar <dixitparmar19@gmail.com> wrote: ... > > > The Sensor's I2C register map and mode information is described in product > > > User Manual[Link]. > > > > Replace Link here with 1... > > > > > Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf > > > Link: https://www.mouser.com/pdfDocs/Infineon-TLV493D-A1B6_3DMagnetic-UserManual-v01_03-EN.pdf > > > > ...and add space followed by [1] here. > > > Orginally it was with [1] only. But I thought I should use known standard tag here > so came up with link. For my understanding, what is the standard practice for this? The expected format is Link: $URL [1] where $URL is the above URL. ... > > > Changes in v2: > > > - Drop regmap implementation in favor of using direct i2c APIs to > > > have uniform communication APIs across the driver. > > > > This I don't understand. I mean the motivation behind this. Usually > > direct I2C communication is used to do some initial checks and > > configuration and rarely for the actuall run-time driver > > functionality. Otherwise it means that the regmap may be used with a > > customised read and write methods. > > > On addition to what Jonathan explained, reading from sensor also is not addressable. > i.e. To read any sensor register the read op must be performed to read starting from 0 > always, without specifying reg address. Okay, if not yet commented in the code, please add that somewhere in the top comment of the file. -- With Best Regards, Andy Shevchenko
© 2016 - 2025 Red Hat, Inc.