Page MenuHomeFreeBSD

Allow setting of GPIO pin names.
ClosedPublic

Authored by loos on Mar 3 2015, 1:59 PM.
Tags
None
Referenced Files
F106009740: D2002.diff
Mon, Dec 23, 8:43 PM
Unknown Object (File)
Thu, Dec 19, 4:02 PM
Unknown Object (File)
Thu, Dec 19, 3:56 PM
Unknown Object (File)
Thu, Dec 19, 3:03 PM
Unknown Object (File)
Tue, Dec 3, 7:56 PM
Unknown Object (File)
Thu, Nov 28, 6:45 PM
Unknown Object (File)
Sun, Nov 24, 2:01 AM
Unknown Object (File)
Nov 23 2024, 3:14 PM
Subscribers

Details

Summary

Add two new gpiobus methods to get and set GPIO pin names.

When a pin name is set, we do a lazy allocation and store the user supplied string.

When a pin name is read, the gpiobus getname method will return the stored value if any, and the default name otherwise.

Make the necessary modifications to libgpio and gpioctl.

When a gpiobus child is added, use its name to identify the gpio pin name.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

loos retitled this revision from to Allow setting of GPIO pin names..
loos updated this object.
loos edited the test plan for this revision. (Show Details)
rpaulo added inline comments.
lib/libgpio/gpio.c
122

I'm thinking it might be better to just write this function with a (gpio_handle_t, unsigned int pin, const char *name) instead of passing the gpio config.

sys/dev/gpio/gpiobus.c
691

This can probably be M_WAITOK.

Change the parameters of libgpio's function gpio_pin_set_name().

Change the memory allocation of GPIO pin name to M_WAITOK.

rpaulo added a reviewer: rpaulo.
rpaulo added inline comments.
lib/libgpio/gpio.c
124

Should we bzero this variable?

This revision is now accepted and ready to land.Mar 5 2015, 4:36 AM

Thanks Rui!

lib/libgpio/gpio.c
124

Yes, it is better to bzero it first. I'll fix it before commit.

loos updated this revision to Diff 4145.

Closed by commit rS279761 (authored by @loos).