Skip to content

Commit 4e73bfa

Browse files
akaessenslinusw
authored andcommitted
pinctrl: mcp23s08: Add optional reset GPIO
The MCP23x port expander RESET# line can be connected to a host GPIO. The optional reset-gpio must be set to LOW if the reset is asserted at probing time. On page 5 in the datasheet [0] the "Device Active After Reset high" time is specified at 0 µs. Therefore no waiting is needed after the reset transition. [0] https://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf Signed-off-by: Andreas Kaessens <[email protected]> Signed-off-by: Darian Biastoch <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent ca199e1 commit 4e73bfa

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

drivers/pinctrl/pinctrl-mcp23s08.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/module.h>
1010
#include <linux/export.h>
1111
#include <linux/gpio/driver.h>
12+
#include <linux/gpio/consumer.h>
1213
#include <linux/slab.h>
1314
#include <asm/byteorder.h>
1415
#include <linux/interrupt.h>
@@ -558,6 +559,8 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
558559
mcp->chip.parent = dev;
559560
mcp->chip.owner = THIS_MODULE;
560561

562+
mcp->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
563+
561564
/* verify MCP_IOCON.SEQOP = 0, so sequential reads work,
562565
* and MCP_IOCON.HAEN = 1, so we work with all chips.
563566
*/

drivers/pinctrl/pinctrl-mcp23s08.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct mcp23s08 {
4343

4444
struct pinctrl_dev *pctldev;
4545
struct pinctrl_desc pinctrl_desc;
46+
struct gpio_desc *reset_gpio;
4647
};
4748

4849
extern const struct regmap_config mcp23x08_regmap;

0 commit comments

Comments
 (0)