The Allegro MicroSystems ALS31300 is a 3-D Linear Hall Effect Sensor mainly used in 3D sensing applications for head-on motion. The device is configured over I2C, and as part of the Sensor data the temperature core is also provided. While the device provides an IRQ gpio, it depends on a configuration programmed into the internal EEPROM, thus only the default mode is supported and buffered input via trigger is also supported to allow streaming values with the same sensing timestamp. The device can be configured with different sensitivities in factory, but the sensitivity value used to calculate value into the Gauss unit is not available from registers, thus the sensitivity is provided by the compatible/device-id string which is based on the part number as described in the datasheet page 2. The datasheet is available on the product website at [1]. [1] https://www.allegromicro.com/en/products/sense/linear-and-angular-position/linear-position-sensor-ics/als31300 Signed-off-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx> --- Changes in v3: - Add missing includes - Use read_poll_timeout() in als31300_get_measure() - Use MILLI instead of 1000 - Remove __packed attribute - Return 0 at the end of als31300_set_operating_mode() - Use devm_mutex_init - Use dev_err_probe() to handle devm_iio_triggered_buffer_setup() error - Link to v2: https://lore.kernel.org/r/20241021-topic-input-upstream-als31300-v2-0-36a4278a528e@xxxxxxxxxx Changes in v2: - Add rob's Ack on patch 1 - Fix commit message layout on patches 2 & 3 - Use Datasheet tag on patch 2 - Fix bindings file name, add options interrupts, fix example node name & compatible - Fix driver with Jonathan's advices: - Reword top file comments - Reduce VOLATILE defines - Move registers values next to register define and add an indent - Use sign_extend32() to X/Y/Z macro, dtop cast on temperature macro - Add als31300_variant_info to pass to i2c/of device_id - Move scan buffer to irq function - Use guard(mutex) - Return fractional for millicelcius - switch to aligned_s64 - use index 4 for IIO_CHAN_SOFT_TIMESTAMP - Add usleep after switching to ACTIVE state to avoid hitting read errors after wake up - simplify suspend/resume functions by returning als31300_set_operating_mode() - Link to v1: https://lore.kernel.org/r/20241007-topic-input-upstream-als31300-v1-0-2c240ea5cb77@xxxxxxxxxx --- Neil Armstrong (3): dt-bindings: vendor-prefixes: Add Allegro MicroSystems, Inc dt-bindings: iio: magnetometer: document the Allegro MicroSystems ALS31300 3-D Linear Hall Effect Sensor iio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect driver .../iio/magnetometer/allegromicro,als31300.yaml | 46 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + drivers/iio/magnetometer/Kconfig | 13 + drivers/iio/magnetometer/Makefile | 1 + drivers/iio/magnetometer/als31300.c | 493 +++++++++++++++++++++ 5 files changed, 555 insertions(+) --- base-commit: 57573ace0c1b142433dfe3d63ebf375269c80fc1 change-id: 20241002-topic-input-upstream-als31300-ca7404eb4ab0 Best regards, -- Neil Armstrong <neil.armstrong@xxxxxxxxxx>