[v3,1/4] gpio: pca953x: set the PCA_PCAL flag also when matching by DT

Message ID a5b37e5feff8a58dc63799ec76ef906695fd7239.1523376423.git.hns@goldelico.com
State New
Headers show
Series
  • pcal6524 extensions and fixes for pca953x driver
Related show

Commit Message

H. Nikolaus Schaller April 10, 2018, 4:07 p.m.
The of_device_table is missing the PCA_PCAL flag so the
pcal6524 would be operated in tca6424 compatibility mode which
does not handle the new interrupt mask registers.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/gpio/gpio-pca953x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko April 10, 2018, 6:08 p.m. | #1
On Tue, Apr 10, 2018 at 7:07 PM, H. Nikolaus Schaller <hns@goldelico.com> wrote:
> The of_device_table is missing the PCA_PCAL flag so the
> pcal6524 would be operated in tca6424 compatibility mode which
> does not handle the new interrupt mask registers.


> +       { .compatible = "nxp,pcal6524", .data = OF_953X(24, PCA_INT |
> +                                                           PCA_PCAL), },
> +       { .compatible = "nxp,pcal9555a", .data = OF_953X(16, PCA_INT |
> +                                                            PCA_PCAL), },

Sorry didn't comment this earlier, though I think one line still
better to read disregard of 80 char limit.
Andy Shevchenko April 10, 2018, 6:10 p.m. | #2
On Tue, Apr 10, 2018 at 9:08 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Tue, Apr 10, 2018 at 7:07 PM, H. Nikolaus Schaller <hns@goldelico.com> wrote:
>> The of_device_table is missing the PCA_PCAL flag so the
>> pcal6524 would be operated in tca6424 compatibility mode which
>> does not handle the new interrupt mask registers.
>
>
>> +       { .compatible = "nxp,pcal6524", .data = OF_953X(24, PCA_INT |
>> +                                                           PCA_PCAL), },
>> +       { .compatible = "nxp,pcal9555a", .data = OF_953X(16, PCA_INT |
>> +                                                            PCA_PCAL), },
>
> Sorry didn't comment this earlier, though I think one line still
> better to read disregard of 80 char limit.

Another possible solution:

#define PCA_LATCH_INT (PCA_PCAL | PCA_INT)

or alike
H. Nikolaus Schaller April 11, 2018, 4:57 a.m. | #3
> Am 10.04.2018 um 20:10 schrieb Andy Shevchenko <andy.shevchenko@gmail.com>:
> 
> #define PCA_LATCH_INT (PCA_PCAL | PCA_INT)

Looks the best.

I have queued it for v4.

BR and thanks,
Nikolaus

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index d2ead4b1cf61..4a075619b93e 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -936,8 +936,10 @@  static const struct of_device_id pca953x_dt_ids[] = {
 	{ .compatible = "nxp,pca9575", .data = OF_957X(16, PCA_INT), },
 	{ .compatible = "nxp,pca9698", .data = OF_953X(40, 0), },
 
-	{ .compatible = "nxp,pcal6524", .data = OF_953X(24, PCA_INT), },
-	{ .compatible = "nxp,pcal9555a", .data = OF_953X(16, PCA_INT), },
+	{ .compatible = "nxp,pcal6524", .data = OF_953X(24, PCA_INT |
+							    PCA_PCAL), },
+	{ .compatible = "nxp,pcal9555a", .data = OF_953X(16, PCA_INT |
+							     PCA_PCAL), },
 
 	{ .compatible = "maxim,max7310", .data = OF_953X( 8, 0), },
 	{ .compatible = "maxim,max7312", .data = OF_953X(16, PCA_INT), },