Re: [PATCH 1/3] pinctrl: mcp23s08: Fixup mcp23x17 regmap_config

From: Andy Shevchenko
Date: Fri Aug 28 2020 - 06:09:25 EST


On Fri, Aug 14, 2020 at 1:35 PM Thomas Preston
<thomas.preston@xxxxxxxxxxxxxxx> wrote:
>
> - Fix a typo where mcp23x17 configs are referred to as mcp23x16.

I'm not sure it's correct. MPC23016 is an existing I²C IO expander.

> - Fix precious range to include INTCAP{A,B}, which clear on read.
> - Fix precious range to include GPIOB, which clears on read.
> - Fix volatile range to include GPIOB, to fix debugfs registers
> reporting different values than `gpioget gpiochip2 {0..15}`.

I'm wondering if you read all the datasheets before doing these changes.
MPC2308
MPC23016
MPC23017
...

> -static const struct regmap_range mcp23x16_volatile_range = {
> +static const struct regmap_range mcp23x17_volatile_range = {
> .range_min = MCP_INTF << 1,
> - .range_max = MCP_GPIO << 1,
> + .range_max = (MCP_GPIO << 1) + 1,

This looks weird. Usually we do a mask or a bit based mask, like (1 << x) - 1.

> };

...

> +static const struct regmap_range mcp23x17_precious_range = {
> + .range_min = MCP_INTCAP << 1,
> + .range_max = (MCP_GPIO << 1) + 1,

Ditto.

> };

--
With Best Regards,
Andy Shevchenko