Issue in I2C IO expander (max7310) interrupt handling in linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue in I2C IO expander (max7310) interrupt handling in linux

589 Views
Amine_Ferchichi
Contributor I

Hi,
I am using linux 20.04 to build an image for the IMX8QXP, the image is based on kernel SUMO 4.14.98.
I am using one of the I2C IO expander supported (max7310) by the linux driver gpio-pca953x.c.

 

My need is to change the state of a pin connected to the i2C exponder (max7310) when the interrupt is triggered.
Implementation of the hard interrupt, Once the interrupt is added, it must appear in /proc/interrupt this step is done and i have my new interrupt in /proc/interrupt.
Now when it interrupt is triggered and when changing PIN state on I2C expponder I have kernel panic in rt_mutex_trylock() function.

 

According to the forums the problem that change pin state on the i2C exponder (max7310) cannot be safely used in hardware or software interrupt.

https://stackoverflow.com/questions/36815420/why-isnt-mutex-trylock-safe-for-use-in-interrupts

My questions are :
Why isn't mutex_trylock safe for use in interrupts?
Why A mutex cannot be acquired by an interrupt handler or bottom half, even with mutex_trylock()?

0 Kudos
1 Reply

537 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

mutex_trylock could sleep , this can't exists in interrupt handling.You can use spin lock.

0 Kudos