Re: [PATCH v3 3/5] pinctrl: mcp23s08: add open drain configuration for irq output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi,

On Tue, Nov 21, 2017 at 04:21:29PM +0800, Phil Reid wrote:
> 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.
> 
> Signed-off-by: Phil Reid <preid@xxxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx>

-- Sebastian

>  drivers/pinctrl/pinctrl-mcp23s08.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
> index cc1f9f6..8ff9b77 100644
> --- a/drivers/pinctrl/pinctrl-mcp23s08.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08.c
> @@ -772,6 +772,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
>  	int status, ret;
>  	bool mirror = false;
>  	bool irq_active_high = false;
> +	bool open_drain = false;
>  
>  	mutex_init(&mcp->lock);
>  
> @@ -867,10 +868,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 ||
> -	     irq_active_high) {
> +	     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);
> @@ -882,6 +884,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);
>  
> -- 
> 1.8.3.1
> 

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux