Page MenuHomeFreeBSD

Add TCA6416 GPIO expander support.
ClosedPublic

Authored by dgr_semihalf.com on Apr 10 2020, 11:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 10 2024, 7:37 AM
Unknown Object (File)
Oct 9 2024, 8:54 PM
Unknown Object (File)
Sep 20 2024, 6:08 AM
Unknown Object (File)
Sep 19 2024, 10:31 AM
Unknown Object (File)
Sep 18 2024, 2:29 AM
Unknown Object (File)
Sep 17 2024, 7:53 PM
Unknown Object (File)
Sep 17 2024, 2:17 AM
Unknown Object (File)
Aug 30 2024, 10:58 AM
Subscribers

Details

Summary

Add basic TCA6416 GPIO expander support. The driver handles
enabling and disabling pins, setting pin mode to IN and OUT and
toggling the pins. External interrupts are not supported.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/dev/iicbus/tca6416.c
151

Are all those extern devclass needed ?
This might be our first gpio controller over i2c so maybe we need some new helpers for those.

imp added inline comments.
sys/dev/iicbus/tca6416.c
151

These aren't needed.
See sys/arm/nvidia/as3722_gpio.c for an example.

mmel requested changes to this revision.Apr 14 2020, 4:20 PM
mmel added a subscriber: mmel.
mmel added inline comments.
sys/dev/iicbus/tca6416.c
151

Exactly, The trick is that driver class name (the string in driver_t structure or first argument to DEFINE_CLASS_0) should be "gpio" while driver module name (first argument to DRIVER_MODULE) should be unique.

228

This is not a safe. Changing polarity inversion register may also changes output value for affected output pin which may drive board reset for example.

244

This looks like leftover of debug code.

290

and since many gpio controllers are required to operate before interrupts start, the only real solution is teaching iic controller how to do polled mode.

293

We have config_intrhook_oneshot() exactly for this design pattern.

This revision now requires changes to proceed.Apr 14 2020, 4:20 PM

Thanks for the comments, in the coming days I'll prepare v2 of this diff.

dgr_semihalf.com edited the summary of this revision. (Show Details)

Removed code that needed interrupts to start before executing.

Hi, if you have any more comments or remarks, please let me know. Thanks.

Would you mind moving this driver to a gpio subdirectory (sys/dev/iicbus/gpio) ?
We've been talking with @ian and @imp doing that for existing drivers.
Otherwise LGTM.

This revision is now accepted and ready to land.May 15 2020, 10:11 AM

Moved to dev/iicbus/gpio directory.

This revision now requires review to proceed.May 15 2020, 5:33 PM
This revision is now accepted and ready to land.May 15 2020, 5:49 PM
This revision was automatically updated to reflect the committed changes.