aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-mcp23s08.c
diff options
context:
space:
mode:
authorPhil Reid <preid@electromag.com.au>2018-02-19 17:25:20 +0800
committerLinus Walleij <linus.walleij@linaro.org>2018-02-22 16:08:59 +0100
commitfa2b7fae8426e2cd690278e514abcc09e4f89a8f (patch)
tree2869ac85c88bbd39c84532d0b2a913f37451c5da /drivers/pinctrl/pinctrl-mcp23s08.c
parentdt-bindings: pinctrl: mcp23s08: add documentation for drive-open-drain (diff)
downloadlinux-dev-fa2b7fae8426e2cd690278e514abcc09e4f89a8f.tar.xz
linux-dev-fa2b7fae8426e2cd690278e514abcc09e4f89a8f.zip
pinctrl: mcp23s08: add open drain configuration for irq output
The mcp23s08 series device can be configured for wired and interrupts using an external pull-up and open drain output via the IOCON_ODR bit. And "drive-open-drain" property to enable this. Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Phil Reid <preid@electromag.com.au> Reviewed-by: Jan Kundrát <jan.kundrat@cesnet.cz> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-mcp23s08.c')
-rw-r--r--drivers/pinctrl/pinctrl-mcp23s08.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 832775709eff..022307dd4b54 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -771,6 +771,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
{
int status, ret;
bool mirror = false;
+ bool open_drain = false;
struct regmap_config *one_regmap_config = NULL;
int raw_chip_address = (addr & ~0x40) >> 1;
@@ -883,10 +884,11 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
"microchip,irq-active-high");
mirror = device_property_read_bool(dev, "microchip,irq-mirror");
+ open_drain = device_property_read_bool(dev, "drive-open-drain");
}
if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror ||
- mcp->irq_active_high) {
+ mcp->irq_active_high || open_drain) {
/* mcp23s17 has IOCON twice, make sure they are in sync */
status &= ~(IOCON_SEQOP | (IOCON_SEQOP << 8));
status |= IOCON_HAEN | (IOCON_HAEN << 8);
@@ -898,6 +900,9 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
if (mirror)
status |= IOCON_MIRROR | (IOCON_MIRROR << 8);
+ if (open_drain)
+ status |= IOCON_ODR | (IOCON_ODR << 8);
+
if (type == MCP_TYPE_S18 || type == MCP_TYPE_018)
status |= IOCON_INTCC | (IOCON_INTCC << 8);