From nobody Sat Oct 4 14:32:49 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43B122BE032; Fri, 15 Aug 2025 03:42:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755229349; cv=none; b=pMZ+u3YcHAJc5j8XSotZkGbYJ9r6+21or7z5P4lRZRstjcsdxDzvxXkDXOi2gjYy0zIHEVPLwk9bYpC9gGdbsnZ7ur5ckXNp4TomHC6WVsbIRFW72UmAIG1UptN8t8QRIL6aOLLBgfNTVsRpe9Na72I57D/+SOu1GUm70KKJMZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755229349; c=relaxed/simple; bh=I5dapaNLIkvMc00JO/07Q1B0pE1zKzAGg28kVhyJFvg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Y2wC+ElUuQZv2P3y/AQMIv+N5oDKnfpOrXq63jtnxfyWZCELahCnyKAXT66FXc772mgv6iYarog5iEnJ1jLuuLhSejKeLBtt7tmHCmWwoRrWsuJ0E8+S7YgSePdq5m2ZbIH0BaDv4UpHXf9bj+2b2lDcue7pMQJFS5mlz024vyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m4kkLnsj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m4kkLnsj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D69BAC4CEEB; Fri, 15 Aug 2025 03:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755229348; bh=I5dapaNLIkvMc00JO/07Q1B0pE1zKzAGg28kVhyJFvg=; h=From:To:Cc:Subject:Date:From; b=m4kkLnsjnh4uPOs14lH0FWJB2Wy/6dxQLCQXkR5x6SlqDQMBzt7mPAnrbaKJsHT6D nxbVKAkrASmSOWT/JUVRWWF2t54uMhqQ3wuL4dCP4Jb6YwwQGVOjF6+itNGGAQ5NXy BgxLnh3mkQio00qXalExqyi/nHrMaqqtEbobNNiJKZl0eRm6wjQAojdlbqQNG98XBo utLdxHGAXgZwXsCS3fdZWOJw5t/I9ZtXiP1cqbOvTCVQlZjCmGmvMqEVdNNsf5XXbx xBvzJ9MIlSVl2iwnVpH+LdumiKidR1AUEGt9lRJw0VqG4PHLWDMP7QAO99u0s9+Ha6 +hIKcRf7rQVwQ== From: Jisheng Zhang To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] gpio: fx6408: Add suspend/resume support Date: Fri, 15 Aug 2025 11:25:18 +0800 Message-ID: <20250815032518.1524-1-jszhang@kernel.org> X-Mailer: git-send-email 2.50.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add suspend and resume support to the fxl6408 gpio driver. Signed-off-by: Jisheng Zhang --- 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 86ebc66b1104..e7f92b37e060 100644 --- a/drivers/gpio/gpio-fxl6408.c +++ b/drivers/gpio/gpio-fxl6408.c @@ -43,6 +43,10 @@ =20 #define FXL6408_NGPIO 8 =20 +struct fxl6408_chip { + struct regmap *regmap; +}; + static const struct regmap_range rd_range[] =3D { { FXL6408_REG_DEVICE_ID, FXL6408_REG_DEVICE_ID }, { FXL6408_REG_IO_DIR, FXL6408_REG_OUTPUT }, @@ -103,6 +107,7 @@ static int fxl6408_identify(struct device *dev, struct = regmap *regmap) =20 static int fxl6408_probe(struct i2c_client *client) { + struct fxl6408_chip *chip; struct device *dev =3D &client->dev; int ret; struct gpio_regmap_config gpio_config =3D { @@ -114,6 +119,10 @@ static int fxl6408_probe(struct i2c_client *client) .ngpio_per_reg =3D FXL6408_NGPIO, }; =20 + chip =3D devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + gpio_config.regmap =3D devm_regmap_init_i2c(client, ®map); if (IS_ERR(gpio_config.regmap)) return dev_err_probe(dev, PTR_ERR(gpio_config.regmap), @@ -123,6 +132,9 @@ static int fxl6408_probe(struct i2c_client *client) if (ret) return ret; =20 + chip->regmap =3D gpio_config.regmap; + i2c_set_clientdata(client, chip); + /* Disable High-Z of outputs, so that our OUTPUT updates actually take ef= fect. */ ret =3D regmap_write(gpio_config.regmap, FXL6408_REG_OUTPUT_HIGH_Z, 0); if (ret) @@ -131,6 +143,16 @@ static int fxl6408_probe(struct i2c_client *client) return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_config)); } =20 +static int fxl6408_resume(struct device *dev) +{ + struct fxl6408_chip *chip =3D 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[] =3D { { .compatible =3D "fcs,fxl6408" }, { } @@ -146,6 +168,7 @@ MODULE_DEVICE_TABLE(i2c, fxl6408_id); static struct i2c_driver fxl6408_driver =3D { .driver =3D { .name =3D "fxl6408", + .pm =3D pm_sleep_ptr(&fxl6408_pm_ops), .of_match_table =3D fxl6408_dt_ids, }, .probe =3D fxl6408_probe, --=20 2.50.0