linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Using a GPIO as an interrupt line
@ 2019-11-19  9:28 Marc Gonzalez
  2019-11-19  9:57 ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 11+ messages in thread
From: Marc Gonzalez @ 2019-11-19  9:28 UTC (permalink / raw)
  To: GPIO, MSM, Linux ARM; +Cc: Linus Walleij, Marc Zyngier

Hello,

The board I'm working on provides a TCA9539 I/O expander.
Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
and Configuration Registers"

(*) http://www.ti.com/lit/ds/symlink/tca9539.pdf

The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt

I have some doubts about the interrupt output, described as:

Optional properties:
 - interrupts: interrupt specifier for the device's interrupt output.

In my board's DT, the I/O expander is described as:

	exp1: gpio@74 {
		compatible = "ti,tca9539";
		reg = <0x74>;
		gpio-controller;
		#gpio-cells = <2>;
		reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&top_exp_rst>;
		interrupt-parent = <&tlmm>;
		interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
	};


("tlmm" is a pinctrl for qualcomm SoCs.)

The problem with this DT node is that nowhere have I specified that
the interrupt output is itself a GPIO line... I see other drivers
calling gpiod_to_irq() to handle this kind of setup. I assume this
function marks the GPIO as "used for interrupt, no longer available
as software-controlled GPIO"?

The tlmm node has the following properties:

	tlmm: pinctrl@03400000 {
		compatible = "qcom,msm8998-pinctrl";
		reg = <0x03400000 0xc00000>;
		interrupts = <0 208 0>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-controller;
		#interrupt-cells = <2>;

Does gpio-controller and/or interrupt-controller mean something
is automagically happening when exp1's interrupts = <42 IRQ_TYPE_LEVEL_HIGH>
prop is being processed?

Or maybe I just have no idea what gpiod_to_irq() is used for?

I'd appreciate any help clearing my confusion.

Regards.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19  9:28 Using a GPIO as an interrupt line Marc Gonzalez
@ 2019-11-19  9:57 ` Russell King - ARM Linux admin
  2019-11-19 10:46   ` Marc Gonzalez
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux admin @ 2019-11-19  9:57 UTC (permalink / raw)
  To: Marc Gonzalez; +Cc: GPIO, MSM, Linux ARM, Marc Zyngier, Linus Walleij

On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
> Hello,
> 
> The board I'm working on provides a TCA9539 I/O expander.
> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
> and Configuration Registers"
> 
> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
> 
> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
> 
> I have some doubts about the interrupt output, described as:
> 
> Optional properties:
>  - interrupts: interrupt specifier for the device's interrupt output.
> 
> In my board's DT, the I/O expander is described as:
> 
> 	exp1: gpio@74 {
> 		compatible = "ti,tca9539";
> 		reg = <0x74>;
> 		gpio-controller;
> 		#gpio-cells = <2>;
> 		reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
> 		pinctrl-names = "default";
> 		pinctrl-0 = <&top_exp_rst>;
> 		interrupt-parent = <&tlmm>;
> 		interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;

This specifies an interrupt signal, number 42, on the tlmm interrupt
controller. It isn't a GPIO specification. Not every interrupt is a
GPIO, and some SoCs can have dedicated interrupt pins that are
exactly that.

Hence, needlessly limiting an external device to requiring a GPIO for
its interrupt is detrimental.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19  9:57 ` Russell King - ARM Linux admin
@ 2019-11-19 10:46   ` Marc Gonzalez
  2019-11-19 10:56     ` Uwe Kleine-König
  2019-11-19 10:58     ` Russell King - ARM Linux admin
  0 siblings, 2 replies; 11+ messages in thread
From: Marc Gonzalez @ 2019-11-19 10:46 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: GPIO, MSM, Linux ARM, Marc Zyngier, Linus Walleij, Uwe Kleine-Konig

On 19/11/2019 10:57, Russell King - ARM Linux admin wrote:

> On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
> 
>> The board I'm working on provides a TCA9539 I/O expander.
>> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
>> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
>> and Configuration Registers"
>>
>> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
>>
>> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
>>
>> I have some doubts about the interrupt output, described as:
>>
>> Optional properties:
>>  - interrupts: interrupt specifier for the device's interrupt output.
>>
>> In my board's DT, the I/O expander is described as:
>>
>> 	exp1: gpio@74 {
>> 		compatible = "ti,tca9539";
>> 		reg = <0x74>;
>> 		gpio-controller;
>> 		#gpio-cells = <2>;
>> 		reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
>> 		pinctrl-names = "default";
>> 		pinctrl-0 = <&top_exp_rst>;
>> 		interrupt-parent = <&tlmm>;
>> 		interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;

As pointed out by ukleinek on IRC, I might have (??) specified the wrong
trigger type. The data-sheet states:
"The TCA9539 open-drain interrupt (INTn) output is activated when any input state
differs from its corresponding Input Port register state, and is used to indicate
to the system master that an input state has changed."
(The data sheet speaks of "INT with a line on top"; what is the typical way to
write that in ASCII? I was told that adding a trailing 'n' or 'b' was common.)

According to that description, it looks like IRQ_TYPE_LEVEL_LOW?
(Weird, because it worked well with IRQ_TYPE_LEVEL_HIGH.)

> This specifies an interrupt signal, number 42, on the tlmm interrupt
> controller. It isn't a GPIO specification. Not every interrupt is a
> GPIO, and some SoCs can have dedicated interrupt pins that are
> exactly that.
> 
> Hence, needlessly limiting an external device to requiring a GPIO for
> its interrupt is detrimental.

That makes complete sense.

IIUC, what is missing in my DT spec is defining pin 42 as a GPIO pin.
Looking more closely at top_exp_rst:

	top_exp_rst: top_exp_rst {
		mux {
			pins = "gpio96";
			function = "gpio";
		};

		config {
			pins = "gpio96";
			drive-strength = <2>;
			bias-pull-down;
		};
	};

IIUC, this defines pin 96 as a GPIO pin (as well as defining some low-level
properties of the pin). Likely I need something similar for pin 42?

Regards.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 10:46   ` Marc Gonzalez
@ 2019-11-19 10:56     ` Uwe Kleine-König
  2019-11-19 11:00       ` Russell King - ARM Linux admin
  2019-11-19 10:58     ` Russell King - ARM Linux admin
  1 sibling, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2019-11-19 10:56 UTC (permalink / raw)
  To: Marc Gonzalez
  Cc: Russell King - ARM Linux admin, GPIO, MSM, Linux ARM,
	Marc Zyngier, Linus Walleij

Hello Marc,

On Tue, Nov 19, 2019 at 11:46:21AM +0100, Marc Gonzalez wrote:
> On 19/11/2019 10:57, Russell King - ARM Linux admin wrote:
> 
> > On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
> > 
> >> The board I'm working on provides a TCA9539 I/O expander.
> >> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
> >> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
> >> and Configuration Registers"
> >>
> >> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
> >>
> >> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
> >>
> >> I have some doubts about the interrupt output, described as:
> >>
> >> Optional properties:
> >>  - interrupts: interrupt specifier for the device's interrupt output.
> >>
> >> In my board's DT, the I/O expander is described as:
> >>
> >> 	exp1: gpio@74 {
> >> 		compatible = "ti,tca9539";
> >> 		reg = <0x74>;
> >> 		gpio-controller;
> >> 		#gpio-cells = <2>;
> >> 		reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
> >> 		pinctrl-names = "default";
> >> 		pinctrl-0 = <&top_exp_rst>;
> >> 		interrupt-parent = <&tlmm>;
> >> 		interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
> 
> As pointed out by ukleinek on IRC, I might have (??) specified the wrong
> trigger type. The data-sheet states:
> "The TCA9539 open-drain interrupt (INTn) output is activated when any input state
> differs from its corresponding Input Port register state, and is used to indicate
> to the system master that an input state has changed."
> (The data sheet speaks of "INT with a line on top"; what is the typical way to
> write that in ASCII? I was told that adding a trailing 'n' or 'b' was common.)

Or a # as pre- or suffix ... (Didn't know about 'b')

> According to that description, it looks like IRQ_TYPE_LEVEL_LOW?
> (Weird, because it worked well with IRQ_TYPE_LEVEL_HIGH.)
> 
> > This specifies an interrupt signal, number 42, on the tlmm interrupt
> > controller. It isn't a GPIO specification. Not every interrupt is a
> > GPIO, and some SoCs can have dedicated interrupt pins that are
> > exactly that.
> > 
> > Hence, needlessly limiting an external device to requiring a GPIO for
> > its interrupt is detrimental.
> 
> That makes complete sense.
> 
> IIUC, what is missing in my DT spec is defining pin 42 as a GPIO pin.
> Looking more closely at top_exp_rst:
> 
> 	top_exp_rst: top_exp_rst {
> 		mux {
> 			pins = "gpio96";
> 			function = "gpio";
> 		};
> 
> 		config {
> 			pins = "gpio96";
> 			drive-strength = <2>;
> 			bias-pull-down;
> 		};
> 	};
> 
> IIUC, this defines pin 96 as a GPIO pin (as well as defining some low-level
> properties of the pin). Likely I need something similar for pin 42?

Having a pin configured as GPIO is the boot default setting for many
SoCs/pins. So you might get away with not specifying a setting for pin
42, but that's not as robust as configuring that explicitly.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 10:46   ` Marc Gonzalez
  2019-11-19 10:56     ` Uwe Kleine-König
@ 2019-11-19 10:58     ` Russell King - ARM Linux admin
  2019-11-19 11:46       ` Marc Gonzalez
  1 sibling, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux admin @ 2019-11-19 10:58 UTC (permalink / raw)
  To: Marc Gonzalez
  Cc: GPIO, MSM, Linux ARM, Marc Zyngier, Linus Walleij, Uwe Kleine-Konig

On Tue, Nov 19, 2019 at 11:46:21AM +0100, Marc Gonzalez wrote:
> On 19/11/2019 10:57, Russell King - ARM Linux admin wrote:
> 
> > On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
> > 
> >> The board I'm working on provides a TCA9539 I/O expander.
> >> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
> >> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
> >> and Configuration Registers"
> >>
> >> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
> >>
> >> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
> >>
> >> I have some doubts about the interrupt output, described as:
> >>
> >> Optional properties:
> >>  - interrupts: interrupt specifier for the device's interrupt output.
> >>
> >> In my board's DT, the I/O expander is described as:
> >>
> >> 	exp1: gpio@74 {
> >> 		compatible = "ti,tca9539";
> >> 		reg = <0x74>;
> >> 		gpio-controller;
> >> 		#gpio-cells = <2>;
> >> 		reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
> >> 		pinctrl-names = "default";
> >> 		pinctrl-0 = <&top_exp_rst>;
> >> 		interrupt-parent = <&tlmm>;
> >> 		interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
> 
> As pointed out by ukleinek on IRC, I might have (??) specified the wrong
> trigger type. The data-sheet states:
> "The TCA9539 open-drain interrupt (INTn) output is activated when any input state
> differs from its corresponding Input Port register state, and is used to indicate
> to the system master that an input state has changed."
> (The data sheet speaks of "INT with a line on top"; what is the typical way to
> write that in ASCII? I was told that adding a trailing 'n' or 'b' was common.)

/INT or nINT are commonly used - I've never heard or seen 'b' (which is
commonly used as a suffix on binary numbers) or a trailing 'n'.

> According to that description, it looks like IRQ_TYPE_LEVEL_LOW?

Yes.

> > This specifies an interrupt signal, number 42, on the tlmm interrupt
> > controller. It isn't a GPIO specification. Not every interrupt is a
> > GPIO, and some SoCs can have dedicated interrupt pins that are
> > exactly that.
> > 
> > Hence, needlessly limiting an external device to requiring a GPIO for
> > its interrupt is detrimental.
> 
> That makes complete sense.
> 
> IIUC, what is missing in my DT spec is defining pin 42 as a GPIO pin.
> Looking more closely at top_exp_rst:
> 
> 	top_exp_rst: top_exp_rst {
> 		mux {
> 			pins = "gpio96";
> 			function = "gpio";
> 		};
> 
> 		config {
> 			pins = "gpio96";
> 			drive-strength = <2>;
> 			bias-pull-down;
> 		};
> 	};
> 
> IIUC, this defines pin 96 as a GPIO pin (as well as defining some low-level
> properties of the pin). Likely I need something similar for pin 42?

Is pin 42 something that can be muxed?  If so, it seems sane to specify
configuration for it.  Whether it needs to be a GPIO or whether it has
a specific "interrupt" function mux state depends on the SoC.

For example, on the LX2160A, there are a bunch of pins that can be muxed
as one of:
- gpio
- interrupt
- something else

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 10:56     ` Uwe Kleine-König
@ 2019-11-19 11:00       ` Russell King - ARM Linux admin
  2019-11-19 11:03         ` Uwe Kleine-König
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux admin @ 2019-11-19 11:00 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Marc Gonzalez, Marc Zyngier, MSM, Linus Walleij, GPIO, Linux ARM

On Tue, Nov 19, 2019 at 11:56:19AM +0100, Uwe Kleine-König wrote:
> Having a pin configured as GPIO is the boot default setting for many
> SoCs/pins. So you might get away with not specifying a setting for pin
> 42, but that's not as robust as configuring that explicitly.

If only that was universally true - the LX2160A as an example doesn't
default to GPIO mode... just be very aware of what the documentation,
and, as the saying goes "if there is any doubt, there is no doubt".

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 11:00       ` Russell King - ARM Linux admin
@ 2019-11-19 11:03         ` Uwe Kleine-König
  0 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2019-11-19 11:03 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Marc Gonzalez, Marc Zyngier, MSM, Linus Walleij, GPIO, Linux ARM

Hello Russell,

On Tue, Nov 19, 2019 at 11:00:31AM +0000, Russell King - ARM Linux admin wrote:
> On Tue, Nov 19, 2019 at 11:56:19AM +0100, Uwe Kleine-König wrote:
> > Having a pin configured as GPIO is the boot default setting for many
> > SoCs/pins. So you might get away with not specifying a setting for pin
> > 42, but that's not as robust as configuring that explicitly.
> 
> If only that was universally true - the LX2160A as an example doesn't
> default to GPIO mode...

FTR: My statement is universally true. Note I wrote "many" not "all"
SoCs/pins :-)

SCNR
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 10:58     ` Russell King - ARM Linux admin
@ 2019-11-19 11:46       ` Marc Gonzalez
  2019-11-19 19:19         ` Bjorn Andersson
  0 siblings, 1 reply; 11+ messages in thread
From: Marc Gonzalez @ 2019-11-19 11:46 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: GPIO, MSM, Linux ARM, Marc Zyngier, Linus Walleij,
	Uwe Kleine-Konig, Bjorn Andersson

On 19/11/2019 11:58, Russell King - ARM Linux admin wrote:

> On Tue, Nov 19, 2019 at 11:46:21AM +0100, Marc Gonzalez wrote:
>
>> On 19/11/2019 10:57, Russell King - ARM Linux admin wrote:
>>
>>> On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
>>>
>>>> The board I'm working on provides a TCA9539 I/O expander.
>>>> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
>>>> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
>>>> and Configuration Registers"
>>>>
>>>> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
>>>>
>>>> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
>>>>
>>>> I have some doubts about the interrupt output, described as:
>>>>
>>>> Optional properties:
>>>>  - interrupts: interrupt specifier for the device's interrupt output.
>>>>
>>>> In my board's DT, the I/O expander is described as:
>>>>
>>>> 	exp1: gpio@74 {
>>>> 		compatible = "ti,tca9539";
>>>> 		reg = <0x74>;
>>>> 		gpio-controller;
>>>> 		#gpio-cells = <2>;
>>>> 		reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
>>>> 		pinctrl-names = "default";
>>>> 		pinctrl-0 = <&top_exp_rst>;
>>>> 		interrupt-parent = <&tlmm>;
>>>> 		interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
>>
>> As pointed out by ukleinek on IRC, I might have (??) specified the wrong
>> trigger type. The data-sheet states:
>> "The TCA9539 open-drain interrupt (INTn) output is activated when any input state
>> differs from its corresponding Input Port register state, and is used to indicate
>> to the system master that an input state has changed."
>> (The data sheet speaks of "INT with a line on top"; what is the typical way to
>> write that in ASCII? I was told that adding a trailing 'n' or 'b' was common.)
> 
> /INT or nINT are commonly used - I've never heard or seen 'b' (which is
> commonly used as a suffix on binary numbers) or a trailing 'n'.

Perhaps the 'b' suffix is only used in French...
'b' might stand for "barre" (i.e. the line above the symbol).


> Is pin 42 something that can be muxed?  If so, it seems sane to specify
> configuration for it.  Whether it needs to be a GPIO or whether it has
> a specific "interrupt" function mux state depends on the SoC.

According to drivers/pinctrl/qcom/pinctrl-msm8998.c
PINGROUP(42, EAST, blsp_spi6, blsp_uart3_b, blsp_uim3_b, _, qdss, _, _, _, _)

I don't think there is an explicit "interrupt" function in
this pinctrl driver... except FUNCTION(ssc_irq).

static const char * const ssc_irq_groups[] = {
	"gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63", "gpio78",
	"gpio79", "gpio80", "gpio117", "gpio118", "gpio119", "gpio120",
	"gpio121", "gpio122", "gpio123", "gpio124", "gpio125",
};

@Bjorn, do you know what these are used for?

Regards.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 11:46       ` Marc Gonzalez
@ 2019-11-19 19:19         ` Bjorn Andersson
  2019-11-19 19:23           ` Jeffrey Hugo
  0 siblings, 1 reply; 11+ messages in thread
From: Bjorn Andersson @ 2019-11-19 19:19 UTC (permalink / raw)
  To: Marc Gonzalez
  Cc: Russell King - ARM Linux admin, GPIO, MSM, Linux ARM,
	Marc Zyngier, Linus Walleij, Uwe Kleine-Konig

On Tue 19 Nov 03:46 PST 2019, Marc Gonzalez wrote:

> On 19/11/2019 11:58, Russell King - ARM Linux admin wrote:
> 
> > On Tue, Nov 19, 2019 at 11:46:21AM +0100, Marc Gonzalez wrote:
> >
> >> On 19/11/2019 10:57, Russell King - ARM Linux admin wrote:
> >>
> >>> On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
> >>>
> >>>> The board I'm working on provides a TCA9539 I/O expander.
> >>>> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
> >>>> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
> >>>> and Configuration Registers"
> >>>>
> >>>> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
> >>>>
> >>>> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
> >>>>
> >>>> I have some doubts about the interrupt output, described as:
> >>>>
> >>>> Optional properties:
> >>>>  - interrupts: interrupt specifier for the device's interrupt output.
> >>>>
> >>>> In my board's DT, the I/O expander is described as:
> >>>>
> >>>> 	exp1: gpio@74 {
> >>>> 		compatible = "ti,tca9539";
> >>>> 		reg = <0x74>;
> >>>> 		gpio-controller;
> >>>> 		#gpio-cells = <2>;
> >>>> 		reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
> >>>> 		pinctrl-names = "default";
> >>>> 		pinctrl-0 = <&top_exp_rst>;
> >>>> 		interrupt-parent = <&tlmm>;
> >>>> 		interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
> >>
> >> As pointed out by ukleinek on IRC, I might have (??) specified the wrong
> >> trigger type. The data-sheet states:
> >> "The TCA9539 open-drain interrupt (INTn) output is activated when any input state
> >> differs from its corresponding Input Port register state, and is used to indicate
> >> to the system master that an input state has changed."
> >> (The data sheet speaks of "INT with a line on top"; what is the typical way to
> >> write that in ASCII? I was told that adding a trailing 'n' or 'b' was common.)
> > 
> > /INT or nINT are commonly used - I've never heard or seen 'b' (which is
> > commonly used as a suffix on binary numbers) or a trailing 'n'.
> 
> Perhaps the 'b' suffix is only used in French...
> 'b' might stand for "barre" (i.e. the line above the symbol).
> 
> 
> > Is pin 42 something that can be muxed?  If so, it seems sane to specify
> > configuration for it.  Whether it needs to be a GPIO or whether it has
> > a specific "interrupt" function mux state depends on the SoC.
> 
> According to drivers/pinctrl/qcom/pinctrl-msm8998.c
> PINGROUP(42, EAST, blsp_spi6, blsp_uart3_b, blsp_uim3_b, _, qdss, _, _, _, _)
> 
> I don't think there is an explicit "interrupt" function in
> this pinctrl driver... except FUNCTION(ssc_irq).
> 

No there's no "interrupt" function, the function to be used is "gpio",
which will ensure that the irq logic is available. But in a modern
kernel we're implicitly selecting the "gpio" function if you're
requesting an interrupt. So you shouldn't need to specify this even.

> static const char * const ssc_irq_groups[] = {
> 	"gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63", "gpio78",
> 	"gpio79", "gpio80", "gpio117", "gpio118", "gpio119", "gpio120",
> 	"gpio121", "gpio122", "gpio123", "gpio124", "gpio125",
> };
> 
> @Bjorn, do you know what these are used for?
> 

The "ssc" would imply that it relates to the secure coprocessor somehow.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 19:19         ` Bjorn Andersson
@ 2019-11-19 19:23           ` Jeffrey Hugo
  2019-11-19 19:35             ` Bjorn Andersson
  0 siblings, 1 reply; 11+ messages in thread
From: Jeffrey Hugo @ 2019-11-19 19:23 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Marc Gonzalez, Marc Zyngier, Linus Walleij, Uwe Kleine-Konig,
	Russell King - ARM Linux admin, GPIO, MSM, Linux ARM

On Tue, Nov 19, 2019 at 12:20 PM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On Tue 19 Nov 03:46 PST 2019, Marc Gonzalez wrote:
>
> > On 19/11/2019 11:58, Russell King - ARM Linux admin wrote:
> >
> > > On Tue, Nov 19, 2019 at 11:46:21AM +0100, Marc Gonzalez wrote:
> > >
> > >> On 19/11/2019 10:57, Russell King - ARM Linux admin wrote:
> > >>
> > >>> On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
> > >>>
> > >>>> The board I'm working on provides a TCA9539 I/O expander.
> > >>>> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
> > >>>> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
> > >>>> and Configuration Registers"
> > >>>>
> > >>>> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
> > >>>>
> > >>>> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
> > >>>>
> > >>>> I have some doubts about the interrupt output, described as:
> > >>>>
> > >>>> Optional properties:
> > >>>>  - interrupts: interrupt specifier for the device's interrupt output.
> > >>>>
> > >>>> In my board's DT, the I/O expander is described as:
> > >>>>
> > >>>>  exp1: gpio@74 {
> > >>>>          compatible = "ti,tca9539";
> > >>>>          reg = <0x74>;
> > >>>>          gpio-controller;
> > >>>>          #gpio-cells = <2>;
> > >>>>          reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
> > >>>>          pinctrl-names = "default";
> > >>>>          pinctrl-0 = <&top_exp_rst>;
> > >>>>          interrupt-parent = <&tlmm>;
> > >>>>          interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
> > >>
> > >> As pointed out by ukleinek on IRC, I might have (??) specified the wrong
> > >> trigger type. The data-sheet states:
> > >> "The TCA9539 open-drain interrupt (INTn) output is activated when any input state
> > >> differs from its corresponding Input Port register state, and is used to indicate
> > >> to the system master that an input state has changed."
> > >> (The data sheet speaks of "INT with a line on top"; what is the typical way to
> > >> write that in ASCII? I was told that adding a trailing 'n' or 'b' was common.)
> > >
> > > /INT or nINT are commonly used - I've never heard or seen 'b' (which is
> > > commonly used as a suffix on binary numbers) or a trailing 'n'.
> >
> > Perhaps the 'b' suffix is only used in French...
> > 'b' might stand for "barre" (i.e. the line above the symbol).
> >
> >
> > > Is pin 42 something that can be muxed?  If so, it seems sane to specify
> > > configuration for it.  Whether it needs to be a GPIO or whether it has
> > > a specific "interrupt" function mux state depends on the SoC.
> >
> > According to drivers/pinctrl/qcom/pinctrl-msm8998.c
> > PINGROUP(42, EAST, blsp_spi6, blsp_uart3_b, blsp_uim3_b, _, qdss, _, _, _, _)
> >
> > I don't think there is an explicit "interrupt" function in
> > this pinctrl driver... except FUNCTION(ssc_irq).
> >
>
> No there's no "interrupt" function, the function to be used is "gpio",
> which will ensure that the irq logic is available. But in a modern
> kernel we're implicitly selecting the "gpio" function if you're
> requesting an interrupt. So you shouldn't need to specify this even.
>
> > static const char * const ssc_irq_groups[] = {
> >       "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63", "gpio78",
> >       "gpio79", "gpio80", "gpio117", "gpio118", "gpio119", "gpio120",
> >       "gpio121", "gpio122", "gpio123", "gpio124", "gpio125",
> > };
> >
> > @Bjorn, do you know what these are used for?
> >
>
> The "ssc" would imply that it relates to the secure coprocessor somehow.

Are you sure?  "SSC" is the short hand for the sensor subsystem in the
documentation I see.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Using a GPIO as an interrupt line
  2019-11-19 19:23           ` Jeffrey Hugo
@ 2019-11-19 19:35             ` Bjorn Andersson
  0 siblings, 0 replies; 11+ messages in thread
From: Bjorn Andersson @ 2019-11-19 19:35 UTC (permalink / raw)
  To: Jeffrey Hugo
  Cc: Marc Gonzalez, Marc Zyngier, Linus Walleij, Uwe Kleine-Konig,
	Russell King - ARM Linux admin, GPIO, MSM, Linux ARM

On Tue 19 Nov 11:23 PST 2019, Jeffrey Hugo wrote:

> On Tue, Nov 19, 2019 at 12:20 PM Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> >
> > On Tue 19 Nov 03:46 PST 2019, Marc Gonzalez wrote:
> >
> > > On 19/11/2019 11:58, Russell King - ARM Linux admin wrote:
> > >
> > > > On Tue, Nov 19, 2019 at 11:46:21AM +0100, Marc Gonzalez wrote:
> > > >
> > > >> On 19/11/2019 10:57, Russell King - ARM Linux admin wrote:
> > > >>
> > > >>> On Tue, Nov 19, 2019 at 10:28:15AM +0100, Marc Gonzalez wrote:
> > > >>>
> > > >>>> The board I'm working on provides a TCA9539 I/O expander.
> > > >>>> Or, as the datasheet(*) calls it, a "Low Voltage 16-Bit I2C and
> > > >>>> SMBus Low-Power I/O Expander with Interrupt Output, Reset Pin,
> > > >>>> and Configuration Registers"
> > > >>>>
> > > >>>> (*) http://www.ti.com/lit/ds/symlink/tca9539.pdf
> > > >>>>
> > > >>>> The binding is documented in Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
> > > >>>>
> > > >>>> I have some doubts about the interrupt output, described as:
> > > >>>>
> > > >>>> Optional properties:
> > > >>>>  - interrupts: interrupt specifier for the device's interrupt output.
> > > >>>>
> > > >>>> In my board's DT, the I/O expander is described as:
> > > >>>>
> > > >>>>  exp1: gpio@74 {
> > > >>>>          compatible = "ti,tca9539";
> > > >>>>          reg = <0x74>;
> > > >>>>          gpio-controller;
> > > >>>>          #gpio-cells = <2>;
> > > >>>>          reset-gpios = <&tlmm 96 GPIO_ACTIVE_LOW>;
> > > >>>>          pinctrl-names = "default";
> > > >>>>          pinctrl-0 = <&top_exp_rst>;
> > > >>>>          interrupt-parent = <&tlmm>;
> > > >>>>          interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
> > > >>
> > > >> As pointed out by ukleinek on IRC, I might have (??) specified the wrong
> > > >> trigger type. The data-sheet states:
> > > >> "The TCA9539 open-drain interrupt (INTn) output is activated when any input state
> > > >> differs from its corresponding Input Port register state, and is used to indicate
> > > >> to the system master that an input state has changed."
> > > >> (The data sheet speaks of "INT with a line on top"; what is the typical way to
> > > >> write that in ASCII? I was told that adding a trailing 'n' or 'b' was common.)
> > > >
> > > > /INT or nINT are commonly used - I've never heard or seen 'b' (which is
> > > > commonly used as a suffix on binary numbers) or a trailing 'n'.
> > >
> > > Perhaps the 'b' suffix is only used in French...
> > > 'b' might stand for "barre" (i.e. the line above the symbol).
> > >
> > >
> > > > Is pin 42 something that can be muxed?  If so, it seems sane to specify
> > > > configuration for it.  Whether it needs to be a GPIO or whether it has
> > > > a specific "interrupt" function mux state depends on the SoC.
> > >
> > > According to drivers/pinctrl/qcom/pinctrl-msm8998.c
> > > PINGROUP(42, EAST, blsp_spi6, blsp_uart3_b, blsp_uim3_b, _, qdss, _, _, _, _)
> > >
> > > I don't think there is an explicit "interrupt" function in
> > > this pinctrl driver... except FUNCTION(ssc_irq).
> > >
> >
> > No there's no "interrupt" function, the function to be used is "gpio",
> > which will ensure that the irq logic is available. But in a modern
> > kernel we're implicitly selecting the "gpio" function if you're
> > requesting an interrupt. So you shouldn't need to specify this even.
> >
> > > static const char * const ssc_irq_groups[] = {
> > >       "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63", "gpio78",
> > >       "gpio79", "gpio80", "gpio117", "gpio118", "gpio119", "gpio120",
> > >       "gpio121", "gpio122", "gpio123", "gpio124", "gpio125",
> > > };
> > >
> > > @Bjorn, do you know what these are used for?
> > >
> >
> > The "ssc" would imply that it relates to the secure coprocessor somehow.
> 
> Are you sure?  "SSC" is the short hand for the sensor subsystem in the
> documentation I see.

No, you're right. I guess the last two abbreviations where getting
old...

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-11-19 19:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19  9:28 Using a GPIO as an interrupt line Marc Gonzalez
2019-11-19  9:57 ` Russell King - ARM Linux admin
2019-11-19 10:46   ` Marc Gonzalez
2019-11-19 10:56     ` Uwe Kleine-König
2019-11-19 11:00       ` Russell King - ARM Linux admin
2019-11-19 11:03         ` Uwe Kleine-König
2019-11-19 10:58     ` Russell King - ARM Linux admin
2019-11-19 11:46       ` Marc Gonzalez
2019-11-19 19:19         ` Bjorn Andersson
2019-11-19 19:23           ` Jeffrey Hugo
2019-11-19 19:35             ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).