ramips: pinctrl-aw9523: update to current upstream
Various cleanups and bugfixes were applied. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://github.com/openwrt/openwrt/pull/16215 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
39d0fd6a36
commit
8e6543fae5
14 changed files with 1744 additions and 1200 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,26 @@
|
|||
From 52279c3d50d964c646692c42a0db87ef7bb451cc Mon Sep 17 00:00:00 2001
|
||||
From: Linus Walleij <linus.walleij@linaro.org>
|
||||
Date: Wed, 6 Mar 2024 08:54:25 +0100
|
||||
Subject: [PATCH] pinctrl: aw9523: Add proper terminator
|
||||
|
||||
The of_device_id array needs to be terminated with a NULL
|
||||
entry.
|
||||
|
||||
Reported-by: kernel test robot <lkp@intel.com>
|
||||
Closes: https://lore.kernel.org/oe-kbuild-all/202403061147.85XYVsk3-lkp@intel.com/
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20240306-fix-aw9523-terminator-v1-1-13f90f87a7f6@linaro.org
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -1099,6 +1099,7 @@ MODULE_DEVICE_TABLE(i2c, aw9523_i2c_id_t
|
||||
|
||||
static const struct of_device_id of_aw9523_i2c_match[] = {
|
||||
{ .compatible = "awinic,aw9523-pinctrl", },
|
||||
+ { }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_aw9523_i2c_match);
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
From e5e8a58023707472e5dbe9bc7b473a8703b401e0 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:15 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Destroy mutex on ->remove()
|
||||
|
||||
If aw9523_hw_init() fails on ->remove() the mutex left alive.
|
||||
Destroy it in that case as well. While at it, remove never
|
||||
true check at the beginning of the function.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-2-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 8 +-------
|
||||
1 file changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -1067,10 +1067,6 @@ err_disable_vregs:
|
||||
static void aw9523_remove(struct i2c_client *client)
|
||||
{
|
||||
struct aw9523 *awi = i2c_get_clientdata(client);
|
||||
- int ret;
|
||||
-
|
||||
- if (!awi)
|
||||
- return;
|
||||
|
||||
/*
|
||||
* If the chip VIO is connected to a regulator that we can turn
|
||||
@@ -1082,10 +1078,8 @@ static void aw9523_remove(struct i2c_cli
|
||||
regulator_disable(awi->vio_vreg);
|
||||
} else {
|
||||
mutex_lock(&awi->i2c_lock);
|
||||
- ret = aw9523_hw_init(awi);
|
||||
+ aw9523_hw_init(awi);
|
||||
mutex_unlock(&awi->i2c_lock);
|
||||
- if (ret)
|
||||
- return;
|
||||
}
|
||||
|
||||
mutex_destroy(&awi->i2c_lock);
|
|
@ -0,0 +1,62 @@
|
|||
From f91eafcb18e096108cd19d24ab71a0db5bc12416 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:16 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Use correct error code for not supported
|
||||
functionality
|
||||
|
||||
The pin control subsystem internally uses ENOTSUPP for the not supported
|
||||
functionality. The checkpatch is false positive about this error code.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-3-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
+#include <linux/errno.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -239,7 +240,7 @@ static int aw9523_pcfg_param_to_reg(enum
|
||||
reg = AW9523_REG_OUT_STATE(pin);
|
||||
break;
|
||||
default:
|
||||
- return -EOPNOTSUPP;
|
||||
+ return -ENOTSUPP;
|
||||
}
|
||||
*r = reg;
|
||||
|
||||
@@ -290,7 +291,7 @@ static int aw9523_pconf_get(struct pinct
|
||||
val = FIELD_GET(AW9523_GCR_GPOMD_MASK, val);
|
||||
break;
|
||||
default:
|
||||
- return -EOPNOTSUPP;
|
||||
+ return -ENOTSUPP;
|
||||
}
|
||||
if (val < 1)
|
||||
return -EINVAL;
|
||||
@@ -344,7 +345,7 @@ static int aw9523_pconf_set(struct pinct
|
||||
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
|
||||
/* Open-Drain is supported only on port 0 */
|
||||
if (pin >= AW9523_PINS_PER_PORT) {
|
||||
- rc = -EOPNOTSUPP;
|
||||
+ rc = -ENOTSUPP;
|
||||
goto end;
|
||||
}
|
||||
mask = AW9523_GCR_GPOMD_MASK;
|
||||
@@ -361,7 +362,7 @@ static int aw9523_pconf_set(struct pinct
|
||||
val = AW9523_GCR_GPOMD_MASK;
|
||||
break;
|
||||
default:
|
||||
- rc = -EOPNOTSUPP;
|
||||
+ rc = -ENOTSUPP;
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
From 091655b9285d837db520381924c689bd5dc5d286 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:17 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Always try both ports in
|
||||
aw9523_gpio_set_multiple()
|
||||
|
||||
The ports are equivalent from the user's point of view. Don't limit
|
||||
trying them both if writing to one fails.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-4-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -653,7 +653,7 @@ static void aw9523_gpio_set_multiple(str
|
||||
struct aw9523 *awi = gpiochip_get_data(chip);
|
||||
u8 mask_lo, mask_hi, bits_lo, bits_hi;
|
||||
unsigned int reg;
|
||||
- int ret = 0;
|
||||
+ int ret;
|
||||
|
||||
mask_lo = *mask & U8_MAX;
|
||||
mask_hi = (*mask >> 8) & U8_MAX;
|
||||
@@ -663,10 +663,8 @@ static void aw9523_gpio_set_multiple(str
|
||||
bits_hi = (*bits >> 8) & U8_MAX;
|
||||
|
||||
ret = regmap_write_bits(awi->regmap, reg, mask_hi, bits_hi);
|
||||
- if (ret) {
|
||||
+ if (ret)
|
||||
dev_warn(awi->dev, "Cannot write port1 out level\n");
|
||||
- goto out;
|
||||
- }
|
||||
}
|
||||
if (mask_lo) {
|
||||
reg = AW9523_REG_OUT_STATE(0);
|
||||
@@ -675,7 +673,6 @@ static void aw9523_gpio_set_multiple(str
|
||||
if (ret)
|
||||
dev_warn(awi->dev, "Cannot write port0 out level\n");
|
||||
}
|
||||
-out:
|
||||
mutex_unlock(&awi->i2c_lock);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
From 418ee9488ff74ab4ada3a539a2840dda9e56f847 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:18 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Make use of struct pinfunction and
|
||||
PINCTRL_PINFUNCTION()
|
||||
|
||||
Since pin control provides a generic data type and a macro for
|
||||
the pin function definition, use them in the driver.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-5-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 32 ++++++--------------------------
|
||||
1 file changed, 6 insertions(+), 26 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -67,18 +67,6 @@ struct aw9523_irq {
|
||||
};
|
||||
|
||||
/*
|
||||
- * struct aw9523_pinmux - Pin mux params
|
||||
- * @name: Name of the mux
|
||||
- * @grps: Groups of the mux
|
||||
- * @num_grps: Number of groups (sizeof array grps)
|
||||
- */
|
||||
-struct aw9523_pinmux {
|
||||
- const char *name;
|
||||
- const char * const *grps;
|
||||
- const u8 num_grps;
|
||||
-};
|
||||
-
|
||||
-/*
|
||||
* struct aw9523 - Main driver structure
|
||||
* @dev: device handle
|
||||
* @regmap: regmap handle for current device
|
||||
@@ -158,17 +146,9 @@ static const char * const gpio_pwm_group
|
||||
};
|
||||
|
||||
/* Warning: Do NOT reorder this array */
|
||||
-static const struct aw9523_pinmux aw9523_pmx[] = {
|
||||
- {
|
||||
- .name = "pwm",
|
||||
- .grps = gpio_pwm_groups,
|
||||
- .num_grps = ARRAY_SIZE(gpio_pwm_groups),
|
||||
- },
|
||||
- {
|
||||
- .name = "gpio",
|
||||
- .grps = gpio_pwm_groups,
|
||||
- .num_grps = ARRAY_SIZE(gpio_pwm_groups),
|
||||
- },
|
||||
+static const struct pinfunction aw9523_pmx[] = {
|
||||
+ PINCTRL_PINFUNCTION("pwm", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
|
||||
+ PINCTRL_PINFUNCTION("gpio", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
|
||||
};
|
||||
|
||||
static int aw9523_pmx_get_funcs_count(struct pinctrl_dev *pctl)
|
||||
@@ -184,10 +164,10 @@ static const char *aw9523_pmx_get_fname(
|
||||
|
||||
static int aw9523_pmx_get_groups(struct pinctrl_dev *pctl, unsigned int sel,
|
||||
const char * const **groups,
|
||||
- unsigned int * const num_groups)
|
||||
+ unsigned int * const ngroups)
|
||||
{
|
||||
- *groups = aw9523_pmx[sel].grps;
|
||||
- *num_groups = aw9523_pmx[sel].num_grps;
|
||||
+ *groups = aw9523_pmx[sel].groups;
|
||||
+ *ngroups = aw9523_pmx[sel].ngroups;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
From 66413f0468d35adb352c76bc286bf6f6746ba354 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:19 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Use temporary variable for HW IRQ number
|
||||
|
||||
There are two different ways on how to get HW IRQ number in some functions.
|
||||
Unify that by using temporary variable and irqd_to_hwirq() call.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-6-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -428,12 +428,12 @@ static int aw9523_gpio_irq_type(struct i
|
||||
static void aw9523_irq_mask(struct irq_data *d)
|
||||
{
|
||||
struct aw9523 *awi = gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
||||
- unsigned int n = d->hwirq % AW9523_PINS_PER_PORT;
|
||||
+ irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||
+ unsigned int n = hwirq % AW9523_PINS_PER_PORT;
|
||||
|
||||
- regmap_update_bits(awi->regmap,
|
||||
- AW9523_REG_INTR_DIS(d->hwirq),
|
||||
+ regmap_update_bits(awi->regmap, AW9523_REG_INTR_DIS(hwirq),
|
||||
BIT(n), BIT(n));
|
||||
- gpiochip_disable_irq(&awi->gpio, irqd_to_hwirq(d));
|
||||
+ gpiochip_disable_irq(&awi->gpio, hwirq);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -446,11 +446,11 @@ static void aw9523_irq_mask(struct irq_d
|
||||
static void aw9523_irq_unmask(struct irq_data *d)
|
||||
{
|
||||
struct aw9523 *awi = gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
||||
- unsigned int n = d->hwirq % AW9523_PINS_PER_PORT;
|
||||
+ irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||
+ unsigned int n = hwirq % AW9523_PINS_PER_PORT;
|
||||
|
||||
- gpiochip_enable_irq(&awi->gpio, irqd_to_hwirq(d));
|
||||
- regmap_update_bits(awi->regmap,
|
||||
- AW9523_REG_INTR_DIS(d->hwirq),
|
||||
+ gpiochip_enable_irq(&awi->gpio, hwirq);
|
||||
+ regmap_update_bits(awi->regmap, AW9523_REG_INTR_DIS(hwirq),
|
||||
BIT(n), 0);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From 4210ef801a248223a0ea5f47b5446081b4925e10 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:20 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Get rid of redundant ' & U8_MAX' pieces
|
||||
|
||||
When the variable is declared as u8, no need to perform ' & U8_MAX'
|
||||
as it's implied anyway.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-7-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -603,7 +603,7 @@ static int aw9523_gpio_get_multiple(stru
|
||||
mutex_lock(&awi->i2c_lock);
|
||||
|
||||
/* Port 0 (gpio 0-7) */
|
||||
- m = *mask & U8_MAX;
|
||||
+ m = *mask;
|
||||
if (m) {
|
||||
ret = _aw9523_gpio_get_multiple(awi, 0, &state, m);
|
||||
if (ret)
|
||||
@@ -612,7 +612,7 @@ static int aw9523_gpio_get_multiple(stru
|
||||
*bits = state;
|
||||
|
||||
/* Port 1 (gpio 8-15) */
|
||||
- m = (*mask >> 8) & U8_MAX;
|
||||
+ m = *mask >> 8;
|
||||
if (m) {
|
||||
ret = _aw9523_gpio_get_multiple(awi, AW9523_PINS_PER_PORT,
|
||||
&state, m);
|
||||
@@ -635,20 +635,20 @@ static void aw9523_gpio_set_multiple(str
|
||||
unsigned int reg;
|
||||
int ret;
|
||||
|
||||
- mask_lo = *mask & U8_MAX;
|
||||
- mask_hi = (*mask >> 8) & U8_MAX;
|
||||
+ mask_lo = *mask;
|
||||
+ mask_hi = *mask >> 8;
|
||||
+ bits_lo = *bits;
|
||||
+ bits_hi = *bits >> 8;
|
||||
+
|
||||
mutex_lock(&awi->i2c_lock);
|
||||
if (mask_hi) {
|
||||
reg = AW9523_REG_OUT_STATE(AW9523_PINS_PER_PORT);
|
||||
- bits_hi = (*bits >> 8) & U8_MAX;
|
||||
-
|
||||
ret = regmap_write_bits(awi->regmap, reg, mask_hi, bits_hi);
|
||||
if (ret)
|
||||
dev_warn(awi->dev, "Cannot write port1 out level\n");
|
||||
}
|
||||
if (mask_lo) {
|
||||
reg = AW9523_REG_OUT_STATE(0);
|
||||
- bits_lo = *bits & U8_MAX;
|
||||
ret = regmap_write_bits(awi->regmap, reg, mask_lo, bits_lo);
|
||||
if (ret)
|
||||
dev_warn(awi->dev, "Cannot write port0 out level\n");
|
|
@ -0,0 +1,52 @@
|
|||
From 6bf270863ade776485d1c6bdb8f69d642b0e5f64 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:21 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Remove unused irqchip field in struct
|
||||
aw9523_irq
|
||||
|
||||
The irqchip field is allocated, assigned but never used. Remove it.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-8-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -57,12 +57,10 @@
|
||||
/*
|
||||
* struct aw9523_irq - Interrupt controller structure
|
||||
* @lock: mutex locking for the irq bus
|
||||
- * @irqchip: structure holding irqchip params
|
||||
* @cached_gpio: stores the previous gpio status for bit comparison
|
||||
*/
|
||||
struct aw9523_irq {
|
||||
struct mutex lock;
|
||||
- struct irq_chip *irqchip;
|
||||
u16 cached_gpio;
|
||||
};
|
||||
|
||||
@@ -805,21 +803,15 @@ static int aw9523_init_irq(struct aw9523
|
||||
{
|
||||
struct device *dev = awi->dev;
|
||||
struct gpio_irq_chip *girq;
|
||||
- struct irq_chip *irqchip;
|
||||
int ret;
|
||||
|
||||
if (!device_property_read_bool(dev, "interrupt-controller"))
|
||||
return 0;
|
||||
|
||||
- irqchip = devm_kzalloc(dev, sizeof(*irqchip), GFP_KERNEL);
|
||||
- if (!irqchip)
|
||||
- return -ENOMEM;
|
||||
-
|
||||
awi->irq = devm_kzalloc(dev, sizeof(*awi->irq), GFP_KERNEL);
|
||||
if (!awi->irq)
|
||||
return -ENOMEM;
|
||||
|
||||
- awi->irq->irqchip = irqchip;
|
||||
mutex_init(&awi->irq->lock);
|
||||
|
||||
ret = devm_request_threaded_irq(dev, irq, NULL, aw9523_irq_thread_func,
|
|
@ -0,0 +1,40 @@
|
|||
From c567b00cc3d73f3ce4e92126731545d177262090 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:22 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Make use of dev_err_probe()
|
||||
|
||||
Simplify the error handling in probe function by switching from
|
||||
dev_err() to dev_err_probe().
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-9-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 9 +++------
|
||||
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -816,10 +816,8 @@ static int aw9523_init_irq(struct aw9523
|
||||
|
||||
ret = devm_request_threaded_irq(dev, irq, NULL, aw9523_irq_thread_func,
|
||||
IRQF_ONESHOT, dev_name(dev), awi);
|
||||
- if (ret) {
|
||||
- dev_err(dev, "Failed to request irq %d\n", irq);
|
||||
- return ret;
|
||||
- }
|
||||
+ if (ret)
|
||||
+ return dev_err_probe(dev, ret, "Failed to request irq %d\n", irq);
|
||||
|
||||
girq = &awi->gpio.irq;
|
||||
gpio_irq_chip_set_chip(girq, &aw9523_irq_chip);
|
||||
@@ -1016,8 +1014,7 @@ static int aw9523_probe(struct i2c_clien
|
||||
|
||||
awi->pctl = devm_pinctrl_register(dev, pdesc, awi);
|
||||
if (IS_ERR(awi->pctl)) {
|
||||
- ret = PTR_ERR(awi->pctl);
|
||||
- dev_err(dev, "Cannot register pinctrl: %d", ret);
|
||||
+ ret = dev_err_probe(dev, PTR_ERR(awi->pctl), "Cannot register pinctrl");
|
||||
goto err_disable_vregs;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
From 7b8b9b5450b89d01e4b8f120b903cee85b529231 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:23 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Sort headers and group pinctrl/*
|
||||
|
||||
One header was misplaced and group pinctrl/* ones to show the relation
|
||||
with the pin control subsystem.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-10-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -13,17 +13,18 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
-#include <linux/mutex.h>
|
||||
#include <linux/module.h>
|
||||
-#include <linux/pinctrl/pinconf.h>
|
||||
-#include <linux/pinctrl/pinctrl.h>
|
||||
-#include <linux/pinctrl/pinmux.h>
|
||||
-#include <linux/pinctrl/pinconf-generic.h>
|
||||
+#include <linux/mutex.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
+#include <linux/pinctrl/pinconf-generic.h>
|
||||
+#include <linux/pinctrl/pinconf.h>
|
||||
+#include <linux/pinctrl/pinctrl.h>
|
||||
+#include <linux/pinctrl/pinmux.h>
|
||||
+
|
||||
#define AW9523_MAX_FUNCS 2
|
||||
#define AW9523_NUM_PORTS 2
|
||||
#define AW9523_PINS_PER_PORT 8
|
|
@ -0,0 +1,62 @@
|
|||
From 4aad0ad20f4ea80180a3e58b04b701728541c0f7 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Date: Fri, 29 Mar 2024 12:55:24 +0200
|
||||
Subject: [PATCH] pinctrl: aw9523: Fix indentation in a few places
|
||||
|
||||
In the comment, function prototype, and array of strings indentation
|
||||
is kinda broken. Reindent that.
|
||||
|
||||
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||||
Message-ID: <20240329105634.712457-11-andy.shevchenko@gmail.com>
|
||||
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 17 ++++++++---------
|
||||
1 file changed, 8 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||||
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||||
@@ -1,8 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Awinic AW9523B i2c pin controller driver
|
||||
- * Copyright (c) 2020, AngeloGioacchino Del Regno
|
||||
- * <angelogioacchino.delregno@somainline.org>
|
||||
+ * Copyright (c) 2020, AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
@@ -139,9 +138,10 @@ static const struct pinctrl_ops aw9523_p
|
||||
};
|
||||
|
||||
static const char * const gpio_pwm_groups[] = {
|
||||
- "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5",
|
||||
- "gpio6", "gpio7", "gpio8", "gpio9", "gpio10", "gpio11",
|
||||
- "gpio12", "gpio13", "gpio14", "gpio15"
|
||||
+ "gpio0", "gpio1", "gpio2", "gpio3", /* 0-3 */
|
||||
+ "gpio4", "gpio5", "gpio6", "gpio7", /* 4-7 */
|
||||
+ "gpio8", "gpio9", "gpio10", "gpio11", /* 8-11 */
|
||||
+ "gpio12", "gpio13", "gpio14", "gpio15", /* 11-15 */
|
||||
};
|
||||
|
||||
/* Warning: Do NOT reorder this array */
|
||||
@@ -388,8 +388,8 @@ static int aw9523_get_pin_direction(stru
|
||||
*
|
||||
* Return: Zero for success or negative number for error
|
||||
*/
|
||||
-static int aw9523_get_port_state(struct regmap *regmap, u8 pin,
|
||||
- u8 regbit, unsigned int *state)
|
||||
+static int aw9523_get_port_state(struct regmap *regmap, u8 pin, u8 regbit,
|
||||
+ unsigned int *state)
|
||||
{
|
||||
u8 reg;
|
||||
int dir;
|
||||
@@ -984,8 +984,7 @@ static int aw9523_probe(struct i2c_clien
|
||||
}
|
||||
|
||||
mutex_init(&awi->i2c_lock);
|
||||
- lockdep_set_subclass(&awi->i2c_lock,
|
||||
- i2c_adapter_depth(client->adapter));
|
||||
+ lockdep_set_subclass(&awi->i2c_lock, i2c_adapter_depth(client->adapter));
|
||||
|
||||
pdesc = devm_kzalloc(dev, sizeof(*pdesc), GFP_KERNEL);
|
||||
if (!pdesc)
|
|
@ -1,72 +0,0 @@
|
|||
From: AngeloGioacchino Del Regno
|
||||
<angelogioacchino.delregno@somainline.org>
|
||||
To: linus.walleij@linaro.org
|
||||
Cc: linux-kernel@vger.kernel.org, konrad.dybcio@somainline.org,
|
||||
marijn.suijten@somainline.org, martin.botka@somainline.org,
|
||||
phone-devel@vger.kernel.org, linux-gpio@vger.kernel.org,
|
||||
devicetree@vger.kernel.org, robh+dt@kernel.org,
|
||||
AngeloGioacchino Del Regno
|
||||
<angelogioacchino.delregno@somainline.org>
|
||||
Subject: [PATCH v5 1/2] pinctrl: Add driver for Awinic AW9523/B I2C GPIO
|
||||
Expander
|
||||
Date: Mon, 25 Jan 2021 19:22:18 +0100
|
||||
|
||||
The Awinic AW9523(B) is a multi-function I2C gpio expander in a
|
||||
TQFN-24L package, featuring PWM (max 37mA per pin, or total max
|
||||
power 3.2Watts) for LED driving capability.
|
||||
|
||||
It has two ports with 8 pins per port (for a total of 16 pins),
|
||||
configurable as either PWM with 1/256 stepping or GPIO input/output,
|
||||
1.8V logic input; each GPIO can be configured as input or output
|
||||
independently from each other.
|
||||
|
||||
This IC also has an internal interrupt controller, which is capable
|
||||
of generating an interrupt for each GPIO, depending on the
|
||||
configuration, and will raise an interrupt on the INTN pin to
|
||||
advertise this to an external interrupt controller.
|
||||
|
||||
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
|
||||
---
|
||||
drivers/pinctrl/Kconfig | 17 +
|
||||
drivers/pinctrl/Makefile | 1 +
|
||||
drivers/pinctrl/pinctrl-aw9523.c | 1122 ++++++++++++++++++++++++++++++
|
||||
3 files changed, 1140 insertions(+)
|
||||
create mode 100644 drivers/pinctrl/pinctrl-aw9523.c
|
||||
|
||||
--- a/drivers/pinctrl/Kconfig
|
||||
+++ b/drivers/pinctrl/Kconfig
|
||||
@@ -113,6 +113,24 @@ config PINCTRL_AT91PIO4
|
||||
Say Y here to enable the at91 pinctrl/gpio driver for Atmel PIO4
|
||||
controller available on sama5d2 SoC.
|
||||
|
||||
+config PINCTRL_AW9523
|
||||
+ bool "Awinic AW9523/AW9523B I2C GPIO expander pinctrl driver"
|
||||
+ depends on OF && I2C
|
||||
+ select PINMUX
|
||||
+ select PINCONF
|
||||
+ select GENERIC_PINCONF
|
||||
+ select GPIOLIB
|
||||
+ select GPIOLIB_IRQCHIP
|
||||
+ select REGMAP
|
||||
+ select REGMAP_I2C
|
||||
+ help
|
||||
+ The Awinic AW9523/AW9523B is a multi-function I2C GPIO
|
||||
+ expander with PWM functionality. This driver bundles a
|
||||
+ pinctrl driver to select the function muxing and a GPIO
|
||||
+ driver to handle GPIO, when the GPIO function is selected.
|
||||
+
|
||||
+ Say yes to enable pinctrl and GPIO support for the AW9523(B).
|
||||
+
|
||||
config PINCTRL_AXP209
|
||||
tristate "X-Powers AXP209 PMIC pinctrl and GPIO Support"
|
||||
depends on MFD_AXP20X
|
||||
--- a/drivers/pinctrl/Makefile
|
||||
+++ b/drivers/pinctrl/Makefile
|
||||
@@ -15,6 +15,7 @@ obj-$(CONFIG_PINCTRL_ARTPEC6) += pinctrl
|
||||
obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o
|
||||
obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o
|
||||
obj-$(CONFIG_PINCTRL_AT91PIO4) += pinctrl-at91-pio4.o
|
||||
+obj-$(CONFIG_PINCTRL_AW9523) += pinctrl-aw9523.o
|
||||
obj-$(CONFIG_PINCTRL_AXP209) += pinctrl-axp209.o
|
||||
obj-$(CONFIG_PINCTRL_BM1880) += pinctrl-bm1880.o
|
||||
obj-$(CONFIG_PINCTRL_CY8C95X0) += pinctrl-cy8c95x0.o
|
Loading…
Reference in a new issue