9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] devgpio.c patch (Raspberry Pi3/4, revision 2 , bcm scheme)
@ 2022-12-16 10:54 Matt Galvin
  2022-12-18 16:47 ` cinap_lenrek
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Galvin @ 2022-12-16 10:54 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 1955 bytes --]

Hello,
I'd like to submit a patch:

```

diff 0e66f87316e571f7edf5274369ec69a5905507aa uncommitted
--- a/sys/src/9/bcm/devgpio.c
+++ b/sys/src/9/bcm/devgpio.c
@@ -159,7 +159,7 @@

 static char *bcmtableR2[PIN_TABLE_SIZE] = {
  0, 0, "2", "3", // 0-3
- "4", 0, 0, "7", // 4-7
+ "4", "5", "6", "7", // 4-7
  "8", "9", "10", "11", // 8-11
  0, 0, "14", "15", // 12-15
  0, "17", "18", 0, // 16-19

```

Per the patch submission docs here
<http://fqa.9front.org/dash1.goldenageofballooning.pdf>:
*Explain the problem that your change solves. Explain why your change
solves the problem well.*

The problem is that when using 9front on an Rpi3/Rpi4, on a revision 2
board, in bcm scheme, you cannot use GPIO5 nor GPIO6. If you look at the
pinout, https://pinout.xyz/pinout/, you can see GPIO5 and GPIO6 are both
GPIO pins - so, you should be able to use them. As you can see in the
patch, "5" and "6" were both missing from the bcmtableR2 definition. The
changes noted above fix this issue by adding GPIO5  ("5") and GPIO6 ("6")
to the bcmtableR2 definition. I specifically only addressed r2 boards b/c I
don't have an r1 board and don't want to make any speculations.

* If applicable, explain how you tested the patch, and give us a way of
reproducing the issue.*

I tested this / you can reproduce this by:
- Trying using GPIO5 and GPIO6 without the patch. You can do this by:
  bind -a '#G' /dev
  cd /dev/gpio
  echo 'scheme bcm' > ctl
  echo 'function out 5' > ctl
  echo 'function out 6' > ctl
  read -c 1 5
  read -c 1 6
- Note that the `read` command above reads '0' from file 5 and from file 6.
- Now try to change the GPIO pins from 0 (off) to 1 (on)
  echo '1' > 5
  echo '1' > 6
  read -c 1 5
  read -c 1 6
- Note that the pins still read '0'
- Now, apply the patch and repeat the steps above. Except, after you `echo
'1' > 5` and `echo '1'  > 6`, and then read files "5" and "6", you will see
that the pins now read "1" as intended.

Thanks,
Matt

[-- Attachment #2: Type: text/html, Size: 2709 bytes --]

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

* Re: [9front] devgpio.c patch (Raspberry Pi3/4, revision 2 , bcm scheme)
  2022-12-16 10:54 [9front] devgpio.c patch (Raspberry Pi3/4, revision 2 , bcm scheme) Matt Galvin
@ 2022-12-18 16:47 ` cinap_lenrek
  2022-12-19 15:19   ` Matt Galvin
  0 siblings, 1 reply; 3+ messages in thread
From: cinap_lenrek @ 2022-12-18 16:47 UTC (permalink / raw)
  To: 9front

Applied! Thanks!

--
cinap

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

* Re: [9front] devgpio.c patch (Raspberry Pi3/4, revision 2 , bcm scheme)
  2022-12-18 16:47 ` cinap_lenrek
@ 2022-12-19 15:19   ` Matt Galvin
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Galvin @ 2022-12-19 15:19 UTC (permalink / raw)
  To: 9front

My pleasure, thank you for reviewing and applying it!

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

end of thread, other threads:[~2022-12-19 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 10:54 [9front] devgpio.c patch (Raspberry Pi3/4, revision 2 , bcm scheme) Matt Galvin
2022-12-18 16:47 ` cinap_lenrek
2022-12-19 15:19   ` Matt Galvin

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