Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lirc_rpi gpio_in_pull parameter is ignored by module and only useful via device tree #1711

Closed
dreamlayers opened this issue Nov 5, 2016 · 3 comments

Comments

@dreamlayers
Copy link

For lirc_rpi it is possible to use internal pull-up or pull-down on the LIRC input GPIO pin. The module accepts a gpio_in_pull parameter, with "(0 = off, 1 = up, 2 = down, default down)". However, this parameter is ignored. It seems like the module code does absolutely nothing with this parameter. It has a comment saying "Because of the lack of a setpull function, only support pinctrl-bcm2835 if using device tree.". I only got pull up to work by adding a dtparam=gpio_in_pull=up line after the dtoverlay=lirc-rpi line in /boot/config.txt. This still leaves /sys/module/lirc_rpi/parameters/gpio_in_pull set to the default of 2, but that's irrelevant; pull up is actually enabled.

Another possible workaround is to turn on the pull-up in Python, using something like:

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18,GPIO.IN,pull_up_down=GPIO.PUD_UP)

I feel this is a bug because accepting and then ignoring a module parameter is misleading. People will waste time on this. Documenting the issue in a module source comment is insufficient.

@pelwell
Copy link
Contributor

pelwell commented Nov 6, 2016

Bizarrely, the standard Linux GPIO API does not include a way of setting pulls dynamically. Instead one has to set pulls using the pinctrl mechanism, declaring the pin requirements for device using Device Tree. The only runtime pinctrl interface is the selection of a named state for a set of pins - as far as I know this feature isn't used within our tree, but it should work.

The old bcm2708_gpio driver had a non-standard "setpull" method, but now we are using the upstream driver the old downstream implementation has been removed from the tree. The Python RPi GPIO library directly manipulates the GPIO hardware, rather than go through a kernel driver. The raspi-gpio utility works the same way and has the same capabilities.

The only way I can resolve this issue without adding lots of non-standard downstream code is to delete the vestigial module parameter and any remaining references to the bcm2708 driver.

pelwell pushed a commit that referenced this issue Dec 5, 2016
The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: #1711

Signed-off-by: Phil Elwell <[email protected]>
@pelwell
Copy link
Contributor

pelwell commented Dec 5, 2016

I've deleted the module parameter. The bcm2708 and general gpiochip cleanup can be done separately.

@dreamlayers
Copy link
Author

Thank you! :)

popcornmix added a commit to raspberrypi/firmware that referenced this issue Dec 9, 2016
kernel: Revert HID: dragonrise: fix HID Descriptor for 0x0006 PID
See: raspberrypi/linux#1755

kernel: BCM270X_DT: Add i2c-sensor overlay
See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=167207

kernel: lirc_rpi: Delete vestigial gpio_in_pull parameter
See: raspberrypi/linux#1711

kernel: BCM270X_DT: Add overlay for enc28j60 on SPI2
See: raspberrypi/linux#1735

kernel: bcm2835-rng: Avoid initialising if already enabled

bootcode: Enable the RNG as early as possible
firmware: rng: Avoid initialising if already enabled

powerman: Force a PVT calibration if aphy/dphy settings don't seem correct
See: #684
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Dec 9, 2016
kernel: Revert HID: dragonrise: fix HID Descriptor for 0x0006 PID
See: raspberrypi/linux#1755

kernel: BCM270X_DT: Add i2c-sensor overlay
See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=167207

kernel: lirc_rpi: Delete vestigial gpio_in_pull parameter
See: raspberrypi/linux#1711

kernel: BCM270X_DT: Add overlay for enc28j60 on SPI2
See: raspberrypi/linux#1735

kernel: bcm2835-rng: Avoid initialising if already enabled

bootcode: Enable the RNG as early as possible
firmware: rng: Avoid initialising if already enabled

powerman: Force a PVT calibration if aphy/dphy settings don't seem correct
See: raspberrypi/firmware#684
angyalp pushed a commit to angyalp/kernel_rpi that referenced this issue Dec 19, 2016
The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi#1711

Signed-off-by: Phil Elwell <[email protected]>
@pelwell pelwell closed this as completed Jan 6, 2017
Noltari pushed a commit to Noltari/linux that referenced this issue Feb 6, 2017
The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this issue Feb 27, 2017
kernel: Revert HID: dragonrise: fix HID Descriptor for 0x0006 PID
See: raspberrypi/linux#1755

kernel: BCM270X_DT: Add i2c-sensor overlay
See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=167207

kernel: lirc_rpi: Delete vestigial gpio_in_pull parameter
See: raspberrypi/linux#1711

kernel: BCM270X_DT: Add overlay for enc28j60 on SPI2
See: raspberrypi/linux#1735

kernel: bcm2835-rng: Avoid initialising if already enabled

bootcode: Enable the RNG as early as possible
firmware: rng: Avoid initialising if already enabled

powerman: Force a PVT calibration if aphy/dphy settings don't seem correct
See: raspberrypi#684
woshihuangzhijie pushed a commit to woshihuangzhijie/linuxcode that referenced this issue Sep 20, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 7f7add4fb95315a58acae146a0eef2448f711390)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
amichelotti pushed a commit to amichelotti/ubuntu-vme-xenial that referenced this issue Oct 19, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 7f7add4fb95315a58acae146a0eef2448f711390)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
lianhaidong pushed a commit to lianhaidong/ubuntu-xenial that referenced this issue Nov 6, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 7f7add4fb95315a58acae146a0eef2448f711390)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 14, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 7f7add4fb95315a58acae146a0eef2448f711390)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 20, 2017
BugLink: https://bugs.launchpad.net/bugs/1691407

The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 7f7add4fb95315a58acae146a0eef2448f711390)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
polceanum pushed a commit to polceanum/ubuntu-xenial that referenced this issue Feb 6, 2018
BugLink: https://bugs.launchpad.net/bugs/1691407

The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 7f7add4fb95315a58acae146a0eef2448f711390)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
APokorny pushed a commit to ubports/ubuntu_kernel_xenial that referenced this issue Oct 11, 2018
BugLink: https://bugs.launchpad.net/bugs/1691407

The RPi GPIO no longer support run-time "pull" settings - one should
Device Tree and pinctrl instead - so remove the parameter to avoid
confusion.

See: raspberrypi/linux#1711

Signed-off-by: Phil Elwell <[email protected]>

(cherry picked from commit 7f7add4fb95315a58acae146a0eef2448f711390)
Signed-off-by: Paolo Pisati <[email protected]>
Acked-by: Colin King <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants