Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: fxl6408: Add suspend/resume support

Currently, during suspend, do nothing; during resume, just sync the
regmap cache to hw regs.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://lore.kernel.org/r/20251119140455.10096-1-jszhang@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Jisheng Zhang and committed by
Bartosz Golaszewski
87100151 5dd9332c

+13
+13
drivers/gpio/gpio-fxl6408.c
··· 123 123 if (ret) 124 124 return ret; 125 125 126 + i2c_set_clientdata(client, gpio_config.regmap); 127 + 126 128 /* Disable High-Z of outputs, so that our OUTPUT updates actually take effect. */ 127 129 ret = regmap_write(gpio_config.regmap, FXL6408_REG_OUTPUT_HIGH_Z, 0); 128 130 if (ret) ··· 132 130 133 131 return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_config)); 134 132 } 133 + 134 + static int fxl6408_resume(struct device *dev) 135 + { 136 + struct regmap *regmap = dev_get_drvdata(dev); 137 + 138 + regcache_mark_dirty(regmap); 139 + return regcache_sync(regmap); 140 + } 141 + 142 + static DEFINE_SIMPLE_DEV_PM_OPS(fxl6408_pm_ops, NULL, fxl6408_resume); 135 143 136 144 static const __maybe_unused struct of_device_id fxl6408_dt_ids[] = { 137 145 { .compatible = "fcs,fxl6408" }, ··· 158 146 static struct i2c_driver fxl6408_driver = { 159 147 .driver = { 160 148 .name = "fxl6408", 149 + .pm = pm_sleep_ptr(&fxl6408_pm_ops), 161 150 .of_match_table = fxl6408_dt_ids, 162 151 }, 163 152 .probe = fxl6408_probe,