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
base: master
from

Conversation

Projects
None yet
4 participants
@cbosdo

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)

@alext-mkrs

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

Thanks for this PR!

Show outdated Hide outdated src/arm/arm.c
@@ -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

Collaborator

/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.

@alext-mkrs

alext-mkrs Feb 25, 2017

Collaborator

/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 some commits Feb 22, 2017

rpi: fix PLATFORM_RASPBERRY_PI_ZERO value
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>
examples: add return in spi_max7219.c
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>
arm: prefer /proc/device-tree
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>
rpi: use /proc/device-tree/compatible
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>
raspberrypi: add 3 model B support
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
rpi: take care of gpiochip base
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

This comment has been minimized.

Show comment
Hide comment
@cbosdo

cbosdo Feb 28, 2017

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

cbosdo commented Feb 28, 2017

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

@arfoll

This comment has been minimized.

Show comment
Hide comment
@arfoll

arfoll Mar 2, 2017

Collaborator

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.

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@cbosdo

cbosdo 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

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

This comment has been minimized.

Show comment
Hide comment
@arfoll

arfoll Mar 2, 2017

Collaborator
Collaborator

arfoll commented Mar 2, 2017

@cbosdo

This comment has been minimized.

Show comment
Hide comment
@cbosdo

cbosdo Mar 2, 2017

yeah sure, that'ld be awesome!

cbosdo commented Mar 2, 2017

yeah sure, that'ld be awesome!

@arfoll

This comment has been minimized.

Show comment
Hide comment
@arfoll

arfoll Mar 2, 2017

Collaborator
Collaborator

arfoll commented Mar 2, 2017

@cbosdo

This comment has been minimized.

Show comment
Hide comment
@cbosdo

cbosdo commented Mar 2, 2017

@arfoll done, see PR #657

@g-vidal

This comment has been minimized.

Show comment
Hide comment
@g-vidal

g-vidal Mar 2, 2017

Contributor

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

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