pinctrl: mcp23s08: Fixups for mcp23x17
Subsystems (2)
v2 cover pinctrl: mcp23s08: Fixups for mcp23x17
Hi again,
Second round of these mcp23s03 driver fixups.
Changes since v1:
- Split up the fixups patch.
- I'm pretty certain the "mcp23x16" structs are typos, so I put it as 0001, because the second patch doesn't really make sense without it.
- I lost the (MCP_GPIO << 1) + 1 changes because the regmap handles GPIOB 0x13 with .val_bits = 16.
- Dropped the interrupt-controller changes.
Thanks again,
Thomas
Thomas Preston (2):
pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser
pinctrl: mcp23s08: Fix mcp23x17 precious range
drivers/pinctrl/pinctrl-mcp23s08.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Signature · 1 line
2.26.2
PATCH v2 1/2 pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser
The mcp23x17_regmap is initialised with structs named "mcp23x16". However, the mcp23s08 driver doesn't support the MCP23016 device yet, so this appears to be a typo.
--- drivers/pinctrl/pinctrl-mcp23s08.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/pinctrl/pinctrl-mcp23s08.c +11 -11
@@ -87,7 +87,7 @@ const struct regmap_config mcp23x08_regmap = { };EXPORT_SYMBOL_GPL (mcp23x08_regmap); -static const struct reg_default mcp23x16_defaults[] = { +static const struct reg_default mcp23x17_defaults[] = { {.reg =MCP_IODIR <<1 , .def =0xffff }, {.reg =MCP_IPOL <<1 , .def =0x0000 }, {.reg =MCP_GPINTEN <<1 , .def =0x0000 },
@@ -98,23 +98,23 @@ static const struct reg_default mcp23x16_defaults[] = { {.reg = MCP_OLAT << 1, .def = 0x0000}, }; -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 , }; -static const struct regmap_access_table mcp23x16_volatile_table = { - .yes_ranges = &mcp23x16_volatile_range, +static const struct regmap_access_table mcp23x17_volatile_table = { + .yes_ranges = &mcp23x17_volatile_range, .n_yes_ranges =1 , }; -static const struct regmap_range mcp23x16_precious_range = { +static const struct regmap_range mcp23x17_precious_range = { .range_min =MCP_GPIO <<1 , .range_max =MCP_GPIO <<1 , }; -static const struct regmap_access_table mcp23x16_precious_table = { - .yes_ranges = &mcp23x16_precious_range, +static const struct regmap_access_table mcp23x17_precious_table = { + .yes_ranges = &mcp23x17_precious_range, .n_yes_ranges =1 , };
@@ -124,10 +124,10 @@ const struct regmap_config mcp23x17_regmap = { .reg_stride = 2, .max_register = MCP_OLAT << 1, - .volatile_table = &mcp23x16_volatile_table, - .precious_table = &mcp23x16_precious_table, - .reg_defaults = mcp23x16_defaults, - .num_reg_defaults = ARRAY_SIZE(mcp23x16_defaults), + .volatile_table = &mcp23x17_volatile_table, + .precious_table = &mcp23x17_precious_table, + .reg_defaults = mcp23x17_defaults, + .num_reg_defaults = ARRAY_SIZE(mcp23x17_defaults), .cache_type = REGCACHE_FLAT, .val_format_endian = REGMAP_ENDIAN_LITTLE, };
Signature · 1 line
2.26.2
PATCH v2 2/2 pinctrl: mcp23s08: Fix mcp23x17 precious range
In reply to Thomas PrestonOn page 23 of the datasheet [0] it says "The register remains unchanged until the interrupt is cleared via a read of INTCAP or GPIO." Include INTCAPA and INTCAPB registers in precious range, so that they aren't accidentally cleared when we read via debugfs.
[0] https://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf
--- drivers/pinctrl/pinctrl-mcp23s08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-mcp23s08.c +1 -1
@@ -109,7 +109,7 @@ static const struct regmap_access_table mcp23x17_volatile_table = { };static const struct regmap_range mcp23x17_precious_range = { - .range_min =MCP_GPIO <<1 , + .range_min =MCP_INTCAP <<1 , .range_max =MCP_GPIO <<1 , };
Signature · 1 line
2.26.2
Re: [PATCH v2 2/2] pinctrl: mcp23s08: Fix mcp23x17 precious range
Quoted 8 lines · Thomas Preston
On page 23 of the datasheet [0] it says "The register remains unchanged until the interrupt is cleared via a read of INTCAP or GPIO." Include INTCAPA and INTCAPB registers in precious range, so that they aren't accidentally cleared when we read via debugfs.
[0] https://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf
I would convert it to tag Datasheet: https://...
Maybe Linus can amend this when applying.
Quoted 22 lines
Fixes 8f38910ba4f6 ("pinctrl: mcp23s08: switch to regmap caching")Signed-off-by Thomas Preston <[email protected]>--- drivers/pinctrl/pinctrl-mcp23s08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/pinctrl-mcp23s08.c +1
-2@@ -109,7 +109,7 @@ static const struct regmap_access_table mcp23x17_volatile_table = { };static const struct regmap_range mcp23x17_precious_range = { - .range_min =MCP_GPIO <<1 , + .range_min =MCP_INTCAP <<1 , .range_max =MCP_GPIO <<1 , }; --2.26.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Thomas Preston
Hi again,
Second round of these mcp23s03 driver fixups.
v2 makes sense to me, thanks!
Quoted 21 lines
Changes since v1:
- Split up the fixups patch.
- I'm pretty certain the "mcp23x16" structs are typos, so I put it as 0001, because the second patch doesn't really make sense without it.
- I lost the(MCP_GPIO << 1) + 1changes because the regmap handles GPIOB0x13with.val_bits = 16.
- Dropped the interrupt-controller changes.Thanks again,
ThomasThomas Preston (2):
pinctrl: mcp23s08: Fixmcp23x17_regmapinitialiser
pinctrl: mcp23s08: Fix mcp23x17 precious rangedrivers/pinctrl/pinctrl-mcp23s08.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)--
2.26.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Thomas Preston
Hi again,
Second round of these mcp23s03 driver fixups.Changes since v1:
- Split up the fixups patch.
- I'm pretty certain the "mcp23x16" structs are typos, so I put it as 0001, because the second patch doesn't really make sense without it.
- I lost the(MCP_GPIO << 1) + 1changes because the regmap handles GPIOB0x13with.val_bits = 16.
- Dropped the interrupt-controller changes.
Patches applied!
Yours,
Linus Walleij