Skip to contentSkip to conversation

Requesting different interrupt triggers for the same device type

DISCUSSION Alexander Stein 2 participants 4 messages Dec 2, 2014 – Dec 4, 2014 GPIO

lore
Share & tools
lore
#0 lore raw

Hi,

I have a board which has two PCA9555 attached. Due to hardware wirings each has a different interrupt trigger. One is active low and one is active high and each has a different interrupt parent. How can I specify this in the device tree? Do I need to set IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_LEVEL_HIGH approriately? How can this work, when the driver requests the interrupt like this?

Quoted 7 lines

ret = devm_request_threaded_irq(&client->dev,

			client->irq,
			NULL,
			pca953x_irq_handler,
			IRQF_TRIGGER_LOW | IRQF_ONESHOT |
			IRQF_SHARED,
			dev_name(&client->dev), chip);

The interrupt flags seem rather fixed. Any comments/hints?

Best regards,
Alexander

Signature · 12 lines
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: [email protected]
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082
#1 lore raw
Quoted 12 lines · Alexander Stein

Hi,

I have a board which has two PCA9555 attached. Due to hardware wirings each has a different interrupt trigger. One is active low and one is active high and each has a different interrupt parent. How can I specify this in the device tree? Do I need to set IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_LEVEL_HIGH approriately? How can this work, when the driver requests the interrupt like this?

Quoted 7 lines

ret = devm_request_threaded_irq(&client->dev,

			client->irq,
			NULL,
			pca953x_irq_handler,
			IRQF_TRIGGER_LOW | IRQF_ONESHOT |
			IRQF_SHARED,
			dev_name(&client->dev), chip);
Quoted 1 line

The interrupt flags seem rather fixed. Any comments/hints?

See, http://www.spinics.net/lists/linux-gpio/msg02731.html
It may help.

regards,
-grygorii

#2 lore raw

Hello Grygorii,

Quoted 13 lines · Grygorii Strashko
Quoted 12 lines · Alexander Stein

Hi,

I have a board which has two PCA9555 attached. Due to hardware wirings each has a different interrupt trigger. One is active low and one is active high and each has a different interrupt parent. How can I specify this in the device tree? Do I need to set IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_LEVEL_HIGH approriately? How can this work, when the driver requests the interrupt like this?

Quoted 7 lines

ret = devm_request_threaded_irq(&client->dev,

			client->irq,
			NULL,
			pca953x_irq_handler,
			IRQF_TRIGGER_LOW | IRQF_ONESHOT |
			IRQF_SHARED,
			dev_name(&client->dev), chip);
Quoted 4 lines
Quoted 1 line

The interrupt flags seem rather fixed. Any comments/hints?

See, http://www.spinics.net/lists/linux-gpio/msg02731.html
It may help.

Well, removing that trigger here (and in another driver where INT line is shared) it "works". It seems that each (DT-) driver should remove those explicit flags, no?

Best regards,
Alexander

Signature · 12 lines
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: [email protected]
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082
#3 lore raw
Quoted 16 lines · Alexander Stein

Hello Grygorii,

Quoted 13 lines · Grygorii Strashko
Quoted 12 lines · Alexander Stein

Hi,

I have a board which has two PCA9555 attached. Due to hardware wirings each has a different interrupt trigger. One is active low and one is active high and each has a different interrupt parent. How can I specify this in the device tree? Do I need to set IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_LEVEL_HIGH approriately? How can this work, when the driver requests the interrupt like this?

Quoted 7 lines

ret = devm_request_threaded_irq(&client->dev,

			client->irq,
			NULL,
			pca953x_irq_handler,
			IRQF_TRIGGER_LOW | IRQF_ONESHOT |
			IRQF_SHARED,
			dev_name(&client->dev), chip);
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

The interrupt flags seem rather fixed. Any comments/hints?

See, http://www.spinics.net/lists/linux-gpio/msg02731.html
It may help.

Well, removing that trigger here (and in another driver where INT line is shared) it "works". It seems that each (DT-) driver should remove those explicit flags, no?

Hm. I think yes, in general. But problem is compatibility with non-DT builds and it should be solved somehow in per-driver specific way.

probably simplest way would be smth. like this:

unsigned long irqflags = 0;

if (!dev->of_node)

	irqflags = IRQF_TRIGGER_LOW;

devm_request_threaded_irq(.., irqflags | IRQF_ONESHOT | IRQF_SHARED, ..);

regards,
-grygorii