Reusing GPIOs with the net/phylink/sfp
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Reusing GPIOs with the net/phylink/sfp
- From: Jan Kundrát <jan.kundrat@xxxxxxxxx>
- Date: Wed, 05 Sep 2018 10:29:25 +0200
- Organization: CESNET
- User-agent: Trojita/v0.7-361-gfee56b6f-dirty; Qt/5.11.0; xcb; Linux; Gentoo Base System release 2.4.1
Hi,
the kernel recently gained support for SFP cages. These cages use a few
GPIOs for signaling some out-of-band information ("input signal lost", "tx
laser failure", etc). There is also the GPIO LED trigger which can be used
to drive a LED in response to an input GPIO's state changes. It seems that
I cannot use both together.
I've verified that it is possible to use a GPIO LED trigger together with a
`gpio-event-mon` userspace application, i.e., the GPIO's input is reflected
in a LED, and the userspace can access the GPIO as an input at the same
time.
Is it possible to use one physical GPIO pin from both the SFP driver *and*
the GPIO LED trigger or userspace? I just wasn't able to grep/search for
anything related to shared GPIO access.
I dug into the source a bit, and it seems that *just* calling
request_threaded_irq(gpio_to_irq(gpio), ...) is OK (that's what the GPIO
LED trigger is doing. On the other hand, the SFP code first requests a GPIO
via devm_gpiod_get_optional(), then it tries to call gpiod_to_irq() and
reverts to polling if that fails, and finally it calls
devm_request_threaded_irq(...). Within the IRQ handler then (or in a
delayed work thing when polling), the code calls
gpiod_get_value_cansleep(). This means that I cannot "just unregister" the
GPIO after the IRQ was set up :].
My end goal is to have both a LED for SFP state indication, *and* userspace
access for reacting to that. I can already drive the LED for link up/down
via the "netdev" trigger, but that's not all (and I am not thrilled by the
idea of having to parse netlink messages when I already have a GPIO
signal).
Is there a way of changing the SFP driver to support shared access to
GPIOs? I have not found a "SHARED" flag for requesting GPIOs.
With kind regards,
Jan
[Index of Archives]
[Linux SPI]
[Linux Kernel]
[Linux ARM (vger)]
[Linux ARM MSM]
[Linux Omap]
[Linux Arm]
[Linux Tegra]
[Fedora ARM]
[Linux for Samsung SOC]
[eCos]
[Linux Fastboot]
[Gcc Help]
[Git]
[DCCP]
[IETF Announce]
[Security]
[Linux MIPS]
[Yosemite Campsites]
|