* [PATCH v2 0/2] gpio: fxl6408: add optional reset and suspend/resume
@ 2025-11-17 0:15 Jisheng Zhang
2025-11-17 0:15 ` [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control Jisheng Zhang
2025-11-17 0:15 ` [PATCH v2 2/2] gpio: fxl6408: Add suspend/resume support Jisheng Zhang
0 siblings, 2 replies; 6+ messages in thread
From: Jisheng Zhang @ 2025-11-17 0:15 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel
Two improvements to the fxl6408 gpio driver:
Add opitonal reset gpio control.
Add suspend/resume support.
since v1:
-fix W=1 build error on nios2 platform
Jisheng Zhang (2):
gpio: fxl6408: Add optional reset gpio control
gpio: fxl6408: Add suspend/resume support
drivers/gpio/gpio-fxl6408.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control
2025-11-17 0:15 [PATCH v2 0/2] gpio: fxl6408: add optional reset and suspend/resume Jisheng Zhang
@ 2025-11-17 0:15 ` Jisheng Zhang
2025-11-17 10:01 ` Bartosz Golaszewski
2025-11-18 9:50 ` kernel test robot
2025-11-17 0:15 ` [PATCH v2 2/2] gpio: fxl6408: Add suspend/resume support Jisheng Zhang
1 sibling, 2 replies; 6+ messages in thread
From: Jisheng Zhang @ 2025-11-17 0:15 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel
Add optional active low reset-gpios pin control. If present, de-assert
the specified reset gpio pin to bring the chip out of reset.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
drivers/gpio/gpio-fxl6408.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpio/gpio-fxl6408.c b/drivers/gpio/gpio-fxl6408.c
index 86ebc66b1104..7074831639ce 100644
--- a/drivers/gpio/gpio-fxl6408.c
+++ b/drivers/gpio/gpio-fxl6408.c
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#define FXL6408_REG_DEVICE_ID 0x01
#define FXL6408_MF_FAIRCHILD 0b101
@@ -104,6 +105,7 @@ static int fxl6408_identify(struct device *dev, struct regmap *regmap)
static int fxl6408_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
+ struct gpio_desc *reset_gpio;
int ret;
struct gpio_regmap_config gpio_config = {
.parent = dev,
@@ -114,6 +116,10 @@ static int fxl6408_probe(struct i2c_client *client)
.ngpio_per_reg = FXL6408_NGPIO,
};
+ reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(reset_gpio), "Failed to get reset gpio\n");
+
gpio_config.regmap = devm_regmap_init_i2c(client, ®map);
if (IS_ERR(gpio_config.regmap))
return dev_err_probe(dev, PTR_ERR(gpio_config.regmap),
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] gpio: fxl6408: Add suspend/resume support
2025-11-17 0:15 [PATCH v2 0/2] gpio: fxl6408: add optional reset and suspend/resume Jisheng Zhang
2025-11-17 0:15 ` [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control Jisheng Zhang
@ 2025-11-17 0:15 ` Jisheng Zhang
1 sibling, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2025-11-17 0:15 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel
Currently, during suspend, do nothing; during resume, just sync the
regmap cache to hw regs.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
drivers/gpio/gpio-fxl6408.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/gpio/gpio-fxl6408.c b/drivers/gpio/gpio-fxl6408.c
index 7074831639ce..89cf14b5e3a2 100644
--- a/drivers/gpio/gpio-fxl6408.c
+++ b/drivers/gpio/gpio-fxl6408.c
@@ -44,6 +44,10 @@
#define FXL6408_NGPIO 8
+struct fxl6408_chip {
+ struct regmap *regmap;
+};
+
static const struct regmap_range rd_range[] = {
{ FXL6408_REG_DEVICE_ID, FXL6408_REG_DEVICE_ID },
{ FXL6408_REG_IO_DIR, FXL6408_REG_OUTPUT },
@@ -106,6 +110,7 @@ static int fxl6408_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct gpio_desc *reset_gpio;
+ struct fxl6408_chip *chip;
int ret;
struct gpio_regmap_config gpio_config = {
.parent = dev,
@@ -116,6 +121,10 @@ static int fxl6408_probe(struct i2c_client *client)
.ngpio_per_reg = FXL6408_NGPIO,
};
+ chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
+ if (!chip)
+ return -ENOMEM;
+
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(reset_gpio))
return dev_err_probe(dev, PTR_ERR(reset_gpio), "Failed to get reset gpio\n");
@@ -129,6 +138,9 @@ static int fxl6408_probe(struct i2c_client *client)
if (ret)
return ret;
+ chip->regmap = gpio_config.regmap;
+ i2c_set_clientdata(client, chip);
+
/* Disable High-Z of outputs, so that our OUTPUT updates actually take effect. */
ret = regmap_write(gpio_config.regmap, FXL6408_REG_OUTPUT_HIGH_Z, 0);
if (ret)
@@ -137,6 +149,16 @@ static int fxl6408_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_config));
}
+static int fxl6408_resume(struct device *dev)
+{
+ struct fxl6408_chip *chip = dev_get_drvdata(dev);
+
+ regcache_mark_dirty(chip->regmap);
+ return regcache_sync(chip->regmap);
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(fxl6408_pm_ops, NULL, fxl6408_resume);
+
static const __maybe_unused struct of_device_id fxl6408_dt_ids[] = {
{ .compatible = "fcs,fxl6408" },
{ }
@@ -152,6 +174,7 @@ MODULE_DEVICE_TABLE(i2c, fxl6408_id);
static struct i2c_driver fxl6408_driver = {
.driver = {
.name = "fxl6408",
+ .pm = pm_sleep_ptr(&fxl6408_pm_ops),
.of_match_table = fxl6408_dt_ids,
},
.probe = fxl6408_probe,
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control
2025-11-17 0:15 ` [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control Jisheng Zhang
@ 2025-11-17 10:01 ` Bartosz Golaszewski
2025-11-19 12:13 ` Jisheng Zhang
2025-11-18 9:50 ` kernel test robot
1 sibling, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-11-17 10:01 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: Linus Walleij, linux-gpio, linux-kernel
On Mon, Nov 17, 2025 at 1:32 AM Jisheng Zhang <jszhang@kernel.org> wrote:
>
> Add optional active low reset-gpios pin control. If present, de-assert
> the specified reset gpio pin to bring the chip out of reset.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
This is covered by the bindings at gpio/trivial-gpio.yaml but the
document does not describe a reset-gpios pin. This series doesn't add
any users of it either. What platform do you want to use it on?
Bartosz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control
2025-11-17 0:15 ` [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control Jisheng Zhang
2025-11-17 10:01 ` Bartosz Golaszewski
@ 2025-11-18 9:50 ` kernel test robot
1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-11-18 9:50 UTC (permalink / raw)
To: Jisheng Zhang, Linus Walleij, Bartosz Golaszewski
Cc: oe-kbuild-all, linux-gpio, linux-kernel
Hi Jisheng,
kernel test robot noticed the following build errors:
[auto build test ERROR on brgl/gpio/for-next]
[also build test ERROR on linus/master v6.18-rc6 next-20251118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jisheng-Zhang/gpio-fxl6408-Add-optional-reset-gpio-control/20251117-083516
base: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
patch link: https://lore.kernel.org/r/20251117001502.12618-2-jszhang%40kernel.org
patch subject: [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control
config: riscv-randconfig-001-20251118 (https://download.01.org/0day-ci/archive/20251118/202511181705.QWVZhvN1-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251118/202511181705.QWVZhvN1-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511181705.QWVZhvN1-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/gpio/gpio-fxl6408.c: In function 'fxl6408_probe':
>> drivers/gpio/gpio-fxl6408.c:119:15: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_regulator_get_optional'? [-Werror=implicit-function-declaration]
119 | reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
| ^~~~~~~~~~~~~~~~~~~~~~~
| devm_regulator_get_optional
>> drivers/gpio/gpio-fxl6408.c:119:53: error: 'GPIOD_OUT_LOW' undeclared (first use in this function)
119 | reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
| ^~~~~~~~~~~~~
drivers/gpio/gpio-fxl6408.c:119:53: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
vim +119 drivers/gpio/gpio-fxl6408.c
104
105 static int fxl6408_probe(struct i2c_client *client)
106 {
107 struct device *dev = &client->dev;
108 struct gpio_desc *reset_gpio;
109 int ret;
110 struct gpio_regmap_config gpio_config = {
111 .parent = dev,
112 .ngpio = FXL6408_NGPIO,
113 .reg_dat_base = GPIO_REGMAP_ADDR(FXL6408_REG_INPUT_STATUS),
114 .reg_set_base = GPIO_REGMAP_ADDR(FXL6408_REG_OUTPUT),
115 .reg_dir_out_base = GPIO_REGMAP_ADDR(FXL6408_REG_IO_DIR),
116 .ngpio_per_reg = FXL6408_NGPIO,
117 };
118
> 119 reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
120 if (IS_ERR(reset_gpio))
121 return dev_err_probe(dev, PTR_ERR(reset_gpio), "Failed to get reset gpio\n");
122
123 gpio_config.regmap = devm_regmap_init_i2c(client, ®map);
124 if (IS_ERR(gpio_config.regmap))
125 return dev_err_probe(dev, PTR_ERR(gpio_config.regmap),
126 "failed to allocate register map\n");
127
128 ret = fxl6408_identify(dev, gpio_config.regmap);
129 if (ret)
130 return ret;
131
132 /* Disable High-Z of outputs, so that our OUTPUT updates actually take effect. */
133 ret = regmap_write(gpio_config.regmap, FXL6408_REG_OUTPUT_HIGH_Z, 0);
134 if (ret)
135 return dev_err_probe(dev, ret, "failed to write 'output high Z' register\n");
136
137 return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_config));
138 }
139
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control
2025-11-17 10:01 ` Bartosz Golaszewski
@ 2025-11-19 12:13 ` Jisheng Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2025-11-19 12:13 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: Linus Walleij, linux-gpio, linux-kernel
On Mon, Nov 17, 2025 at 11:01:47AM +0100, Bartosz Golaszewski wrote:
> On Mon, Nov 17, 2025 at 1:32 AM Jisheng Zhang <jszhang@kernel.org> wrote:
> >
> > Add optional active low reset-gpios pin control. If present, de-assert
> > the specified reset gpio pin to bring the chip out of reset.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> > ---
>
> This is covered by the bindings at gpio/trivial-gpio.yaml but the
> document does not describe a reset-gpios pin. This series doesn't add
> any users of it either. What platform do you want to use it on?
the platform hasn't been upstreamed, but you raise a good question, let
me drop this patch now. Will send out a v2.
>
> Bartosz
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-11-19 12:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 0:15 [PATCH v2 0/2] gpio: fxl6408: add optional reset and suspend/resume Jisheng Zhang
2025-11-17 0:15 ` [PATCH v2 1/2] gpio: fxl6408: Add optional reset gpio control Jisheng Zhang
2025-11-17 10:01 ` Bartosz Golaszewski
2025-11-19 12:13 ` Jisheng Zhang
2025-11-18 9:50 ` kernel test robot
2025-11-17 0:15 ` [PATCH v2 2/2] gpio: fxl6408: Add suspend/resume support Jisheng Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).