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

mraa's GPIO to work on SLES for Raspberry Pi #655

Closed
wants to merge 6 commits into from
Closed

Conversation

@cbosdo
Copy link

cbosdo commented Feb 23, 2017

There are a number of things that are different between raspbian and other distros on Raspberry Pi. Overcame these to get mraa's gpio working on SLES (and openSUSE)

Copy link
Contributor

alext-mkrs left a comment

Overall LGTM, just one minor styling fix would be in order.

Thanks for this PR!

@@ -87,6 +87,8 @@ mraa_arm_platform()
platform_type = MRAA_96BOARDS;
else if (mraa_file_contains("/proc/device-tree/model", "s900"))
platform_type = MRAA_96BOARDS;
else if (mraa_file_contains("/sys/firmware/devicetree/base/compatible", "raspberrypi,"))

This comment has been minimized.

@alext-mkrs

alext-mkrs Feb 25, 2017 Contributor

/sys/firmware/devicetree/base should be /proc/device-tree to align with the kernel recommendation and the very change one of the other patches in this PR introduces.

cbosdo added 6 commits Feb 22, 2017
Change PLATFORM_RASPBERRY_PI_ZERO into an integer to avoid
build error when comparing it to integer platform_detected.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Some compilers are raising an error if no value is returned in main.
Add a return 0 in spi_max7219.c main to quiet them.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
As per Documentation/ABI/testing/sysfs-firmware-ofw, perfer
/proc/device-tree over /sys/firmware/devicetree/base as this
is the stable one.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
While some distributions have a modified /proc/cpuinfo including
the board revision for raspberry pi, most distributions don't
have this.

In order to guess the raspberry pi version in such cases, use
the /proc/device-tree/compatible content as a fallback solution.
The values expected from this file have been taken from
upstream kernel documentation:

Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
The gpio pins numbers aren't just matching the physical pin numbers...
on some distros like raspbian, with a kernel explicitly setting the
base to 0, it works, but for kernels using the first free slot it
doesn't (see gpiochip_find_base() in kernel's gpiolib.c).

To get the proper gpio pin value, we thus need to find the base for
the corresponding gpiochip. For the raspberry pi, we search for the
chip with a label containing 'bcm2835'.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
@cbosdo cbosdo force-pushed the cbosdo:master branch from c09c415 to b7c15c7 Feb 27, 2017
@cbosdo
Copy link
Author

cbosdo commented Feb 28, 2017

@alext-mkrs nice catch! I forgot about this one, and updated my branch with the proper value.

@arfoll
Copy link
Contributor

arfoll commented Mar 2, 2017

Merged! This is awesome, thanks alot for this.

Btw do you have a mraa project on suse's OBS? Myself and @tingleby where discussing doing this but if you have something already we could just link to it in our front page where we have our PPA link.

@arfoll arfoll closed this Mar 2, 2017
@cbosdo
Copy link
Author

cbosdo commented Mar 2, 2017

Btw do you have a mraa project on suse's OBS?

We have one with the patches from this PR in the hardware project

@arfoll
Copy link
Contributor

arfoll commented Mar 2, 2017

@cbosdo
Copy link
Author

cbosdo commented Mar 2, 2017

yeah sure, that'ld be awesome!

@arfoll
Copy link
Contributor

arfoll commented Mar 2, 2017

@cbosdo
Copy link
Author

cbosdo commented Mar 2, 2017

@arfoll done, see PR #657

@g-vidal
Copy link
Contributor

g-vidal commented Mar 2, 2017

Hello,
I have been using mraa on a raspberrypi 3 with a debian stretch without anay problem for months, but I have not been able to get an mraa functional image with a kernel younger than 4.4.37-v7+ . Issue #620 was closed without solution. I hoped these contributions may have helped but no change. Could you have please some advice or hint on how to compile an image with mraa and a more recent kernel on araspberrypi ? I do not want to go back to the dark corners of raspbian and things are working very well with the old kernel raspi3image I have merged swig latest version with @arfoll amandments and the compilation works with Node 7.7.

Thanks for any help
I have found a solution that seems to work see #659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.