All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17
@ 2020-08-28 21:32 Thomas Preston
  2020-08-28 21:32 ` [PATCH v2 1/2] pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser Thomas Preston
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Thomas Preston @ 2020-08-28 21:32 UTC (permalink / raw)
  To: linus.walleij, sre, linux-gpio, linux-kernel, andriy.shevchenko,
	jan.kundrat, preid
  Cc: 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) + 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(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser
  2020-08-28 21:32 [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Thomas Preston
@ 2020-08-28 21:32 ` Thomas Preston
  2020-08-28 21:32 ` [PATCH v2 2/2] pinctrl: mcp23s08: Fix mcp23x17 precious range Thomas Preston
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Preston @ 2020-08-28 21:32 UTC (permalink / raw)
  To: linus.walleij, sre, linux-gpio, linux-kernel, andriy.shevchenko,
	jan.kundrat, preid
  Cc: thomas.preston

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.

Fixes: 8f38910ba4f6 ("pinctrl: mcp23s08: switch to regmap caching")
Signed-off-by: Thomas Preston <thomas.preston@codethink.co.uk>
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 42b12ea14d6be..87cde8fb08dd9 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -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,
 };
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] pinctrl: mcp23s08: Fix mcp23x17 precious range
  2020-08-28 21:32 [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Thomas Preston
  2020-08-28 21:32 ` [PATCH v2 1/2] pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser Thomas Preston
@ 2020-08-28 21:32 ` Thomas Preston
  2020-08-30 17:43   ` Andy Shevchenko
  2020-08-30 17:44 ` [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Andy Shevchenko
  2020-09-12  9:31 ` Linus Walleij
  3 siblings, 1 reply; 6+ messages in thread
From: Thomas Preston @ 2020-08-28 21:32 UTC (permalink / raw)
  To: linus.walleij, sre, linux-gpio, linux-kernel, andriy.shevchenko,
	jan.kundrat, preid
  Cc: 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

Fixes: 8f38910ba4f6 ("pinctrl: mcp23s08: switch to regmap caching")
Signed-off-by: Thomas Preston <thomas.preston@codethink.co.uk>
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 87cde8fb08dd9..7edb067f5e76a 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] pinctrl: mcp23s08: Fix mcp23x17 precious range
  2020-08-28 21:32 ` [PATCH v2 2/2] pinctrl: mcp23s08: Fix mcp23x17 precious range Thomas Preston
@ 2020-08-30 17:43   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-08-30 17:43 UTC (permalink / raw)
  To: Thomas Preston
  Cc: Linus Walleij, Sebastian Reichel, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List, Andy Shevchenko, Jan Kundrát,
	Phil Reid

On Sat, Aug 29, 2020 at 12:33 AM Thomas Preston
<thomas.preston@codethink.co.uk> wrote:
>
> 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.

> Fixes: 8f38910ba4f6 ("pinctrl: mcp23s08: switch to regmap caching")
> Signed-off-by: Thomas Preston <thomas.preston@codethink.co.uk>
> ---
>  drivers/pinctrl/pinctrl-mcp23s08.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
> index 87cde8fb08dd9..7edb067f5e76a 100644
> --- a/drivers/pinctrl/pinctrl-mcp23s08.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08.c
> @@ -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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17
  2020-08-28 21:32 [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Thomas Preston
  2020-08-28 21:32 ` [PATCH v2 1/2] pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser Thomas Preston
  2020-08-28 21:32 ` [PATCH v2 2/2] pinctrl: mcp23s08: Fix mcp23x17 precious range Thomas Preston
@ 2020-08-30 17:44 ` Andy Shevchenko
  2020-09-12  9:31 ` Linus Walleij
  3 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-08-30 17:44 UTC (permalink / raw)
  To: Thomas Preston
  Cc: Linus Walleij, Sebastian Reichel, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List, Andy Shevchenko, Jan Kundrát,
	Phil Reid

On Sat, Aug 29, 2020 at 12:33 AM Thomas Preston
<thomas.preston@codethink.co.uk> wrote:
>
> Hi again,
> Second round of these mcp23s03 driver fixups.

v2 makes sense to me, thanks!
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> 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(-)
>
> --
> 2.26.2
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17
  2020-08-28 21:32 [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Thomas Preston
                   ` (2 preceding siblings ...)
  2020-08-30 17:44 ` [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Andy Shevchenko
@ 2020-09-12  9:31 ` Linus Walleij
  3 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2020-09-12  9:31 UTC (permalink / raw)
  To: Thomas Preston
  Cc: Sebastian Reichel, open list:GPIO SUBSYSTEM, linux-kernel,
	Andy Shevchenko, Jan Kundrát, Phil Reid

On Fri, Aug 28, 2020 at 11:32 PM Thomas Preston
<thomas.preston@codethink.co.uk> wrote:

> 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.

Patches applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-12  9:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 21:32 [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Thomas Preston
2020-08-28 21:32 ` [PATCH v2 1/2] pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser Thomas Preston
2020-08-28 21:32 ` [PATCH v2 2/2] pinctrl: mcp23s08: Fix mcp23x17 precious range Thomas Preston
2020-08-30 17:43   ` Andy Shevchenko
2020-08-30 17:44 ` [PATCH v2 0/2] pinctrl: mcp23s08: Fixups for mcp23x17 Andy Shevchenko
2020-09-12  9:31 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.