iio: st_sensors: support active-low interrupts
Most ST MEMS Sensors that support interrupts can also handle sending an active low interrupt, i.e. going from high to low on data ready (or other interrupt) and thus triggering on a falling edge to the interrupt controller. Set up logic to inspect the interrupt line we get for a sensor: if it is triggering on rising edge, leave everything alone, but if it triggers on falling edges, set up active low, and if unsupported configurations appear: warn with errors and reconfigure the interrupt to a rising edge, which all interrupt generating sensors support. Create a local header for st_sensors_core.h to share functions between the sensor core and the trigger setup code. Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:

committed by
Jonathan Cameron

parent
c4f0ebd914
commit
a9fd053b56
@@ -119,6 +119,8 @@ struct st_sensor_bdu {
|
||||
* @addr: address of the register.
|
||||
* @mask_int1: mask to enable/disable IRQ on INT1 pin.
|
||||
* @mask_int2: mask to enable/disable IRQ on INT2 pin.
|
||||
* @addr_ihl: address to enable/disable active low on the INT lines.
|
||||
* @mask_ihl: mask to enable/disable active low on the INT lines.
|
||||
* struct ig1 - represents the Interrupt Generator 1 of sensors.
|
||||
* @en_addr: address of the enable ig1 register.
|
||||
* @en_mask: mask to write the on/off value for enable.
|
||||
@@ -127,6 +129,8 @@ struct st_sensor_data_ready_irq {
|
||||
u8 addr;
|
||||
u8 mask_int1;
|
||||
u8 mask_int2;
|
||||
u8 addr_ihl;
|
||||
u8 mask_ihl;
|
||||
struct {
|
||||
u8 en_addr;
|
||||
u8 en_mask;
|
||||
|
Reference in New Issue
Block a user