cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3MDL Linux Driver support

AKuma.20
Associate II

Hi Team,

I am trying to add support for magnetometer LIS3MDL module using the following linux driver https://github.com/STMicroelectronics/STMems_Linux_IIO_drivers/tree/linux-4.9.y-gh/drivers/iio/magnetometer. If I add interrupt in device tree the module is not registering the iio device.

lis3mdl@1c {

            compatible = "st,lis3mdl";

            reg = <0x1c>;

            interrupt-parent = <&gpio>;

            interrupts = <65 IRQ_TYPE_LEVEL_HIGH>;

            vdd-supply = <&p3449_vdd_1v8>;

            vddio-supply = <&p3449_vdd_1v8>;

        };

I got the folloiwng error.

[  5.150951] iio iio:device10: interrupts active high level

[  5.198445] iio iio:device10: failed to request trigger IRQ.

If I remove the interrupt from the devicetree the device is getting registered but I am not able to use interrupt. Is there any other way to use interrupt in magnetometer ?

Can you please help me to solve this issue,

Regards,

Ajith.

1 REPLY 1
Eleon BORLINI
ST Employee

Hi Ajith @AKuma.12esh​ ,

Are you referring to the magnetometer interrupts, such as the ones described in the application note AN5069 p.21 (it's for LIS2MDSL ok, but just for understand)

If so, I believe you should define the register and the write function, for example in the st_mag3d_core.c file.

#define ST_MAG3D_INT_CFG_ADDR		0x0f
#define ST_MAG3D_INT_CFG_VAL		0xe7

and then define the appropriate function based on:

static int st_mag3d_write_with_mask(struct st_mag3d_hw *hw, u8 addr,
				    u8 mask, u8 val)

Then you have to check the INT pin with your application processor.

-Eleon