mcp23s08: add get_direction and PIN_CONFIG_OUTPUT support.
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | pinctrl: mcp23s08: implement get_direction()drivers/ | +24 | 0 replies | |
| 2/2 | pinctrl: mcp23s08: support for PIN_CONFIG_OUTPUT.Documentation/ drivers/ | +49 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] mcp23s08: add get_direction and PIN_CONFIG_OUTPUT support.
Motivation for these two patches is setting mcp23s08 outputs on boot from the device tree.
gpio-hog was already functional with mcp23s08, however libgpio incorrectly showed pins with output-high or output-low hogs as inputs since the driver did not implement gpio_chip->get_direction().
Many other drivers also support setting pins to output-high or output-low via pinmux. In contrast to gpio-hog, using pinmux to set the pin state on boot allows the state to be changed later from user space. mcp23s08 did not support this since PIN_CONFIG_OUTPUT was not implemented in pinconf_ops->pin_config_set().
One issue with the second patch is that pins set to output-high or output-low via pinmux still show up as inputs in libgpio after boot. This is because the pin direction gets cached in gpio_desc.flags in devm_gpiochip_add_data(). However output-high/-low in pimux only gets applied after that. I am not sure what would be the best approach to fix this.
Tomaz Solc (2):
pinctrl: mcp23s08: implement get_direction()
pinctrl: mcp23s08: support for PIN_CONFIG_OUTPUT.
.../bindings/pinctrl/pinctrl-mcp23s08.txt | 12 ++-- drivers/pinctrl/pinctrl-mcp23s08.c | 72 ++++++++++++++++--- 2 files changed, 68 insertions(+), 16 deletions(-)
Signature · 1 line
2.20.1