From nobody Fri Oct 3 23:09:47 2025 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 A67842DAFA2; Sun, 24 Aug 2025 11:58:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756036698; cv=none; b=RtqYQo6xYZCM0ClMN2fXvAmkFJ2KZ6RPokg0RHM1y1ouyKrRSfx8CSsMyOOxz33kS1CyzH631lsb9jqZYH+Lc/OuDka+Z8vI+YQ00DDW7C2ELThlJcLlO5QNr47s0aK6aEIBbCfRve41AJjDzL18tGwK48LfQ5dhIrjOU9xr0Os= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756036698; c=relaxed/simple; bh=q1airdugxwHpSHZaquYOnigvKVWeL4MThI2AcUjshfs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VZJ247f5c0U7LFAaafOUAIosMQ6ocnz089urPbbv324kYRxjIXfmDTOCXs7d3UkdrbBXIkqeYFos1RLVL2sq7adqUIcNyul9y0FkM8X+gQyKzVtHVDBO7fIofMAXXKir+HaAZrZNEJJvnWNAM1PVGU81jUcC2g3hh81J8ZglB7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=iFFu4LxO; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="iFFu4LxO" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 3710BC8F1CD; Sun, 24 Aug 2025 11:58:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3BB25605F1; Sun, 24 Aug 2025 11:58:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id CE0AF1C22D26C; Sun, 24 Aug 2025 13:58:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1756036693; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=qI7mJ5hYt2a9bdMcNUlHFLpCQX0FFw4F2X/vURBNFY8=; b=iFFu4LxObGgeJDS2wLViuRQSfFtDlUygOXNpcVt+L/gq0ExITANSz7MlTyAA2vGFtV08Oa htkZKhM595R/utOg5JE2RRGIYHIqINYQroPLOMmYedAWLORCmyabraQr7B2e2TvIPZw6s1 clSpapvKNUhjK+YCGnuLfk9n+BqLeGINE+5K+orAggc6/g//IK//rclXcbHhS9rAyZHGIN 8pjVuip/IrbCL+uoXyfkFr4oXwmlBKaC0OU3Kcq3s6CsaUIPehgcohyBJJcHOWrIvFGcae Y4kNQGF5EdWrlcBiYUUZBvznjzd2H61MCp/tzyGbmwLuneSp4SuOae5KnX45iQ== From: Mathieu Dubois-Briand Date: Sun, 24 Aug 2025 13:57:25 +0200 Subject: [PATCH v14 06/10] gpio: regmap: Allow to provide init_valid_mask callback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250824-mdb-max7360-support-v14-6-435cfda2b1ea@bootlin.com> References: <20250824-mdb-max7360-support-v14-0-435cfda2b1ea@bootlin.com> In-Reply-To: <20250824-mdb-max7360-support-v14-0-435cfda2b1ea@bootlin.com> To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Kamel Bouhara , Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Michael Walle , Mark Brown , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-input@vger.kernel.org, linux-pwm@vger.kernel.org, andriy.shevchenko@intel.com, =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , Mathieu Dubois-Briand , Andy Shevchenko , Bartosz Golaszewski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756036647; l=2233; i=mathieu.dubois-briand@bootlin.com; s=20241219; h=from:subject:message-id; bh=q1airdugxwHpSHZaquYOnigvKVWeL4MThI2AcUjshfs=; b=WqkzbUAN1dGCG9kc5w2kg9ayeK2ntKAoX0WXnpajrhuKoY4uuxmv441KKhpZM0qsT5tyqSnqs LFgvOvkgnM+AlFmD7zvFu7n2CPyb4FXbpy3ppH45NePDiHkUVrLOUUQ X-Developer-Key: i=mathieu.dubois-briand@bootlin.com; a=ed25519; pk=1PVTmzPXfKvDwcPUzG0aqdGoKZJA3b9s+3DqRlm0Lww= X-Last-TLS-Session-Version: TLSv1.3 Allows to populate the gpio_regmap_config structure with init_valid_mask() callback to set on the final gpio_chip structure. Reviewed-by: Michael Walle Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Reviewed-by: Bartosz Golaszewski Signed-off-by: Mathieu Dubois-Briand --- drivers/gpio/gpio-regmap.c | 1 + include/linux/gpio/regmap.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index e1944931ee7c..d9d23853e032 100644 --- a/drivers/gpio/gpio-regmap.c +++ b/drivers/gpio/gpio-regmap.c @@ -261,6 +261,7 @@ struct gpio_regmap *gpio_regmap_register(const struct g= pio_regmap_config *config chip->names =3D config->names; chip->label =3D config->label ?: dev_name(config->parent); chip->can_sleep =3D regmap_might_sleep(config->regmap); + chip->init_valid_mask =3D config->init_valid_mask; =20 chip->request =3D gpiochip_generic_request; chip->free =3D gpiochip_generic_free; diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h index 19b52ac03a5d..622a2939ebe0 100644 --- a/include/linux/gpio/regmap.h +++ b/include/linux/gpio/regmap.h @@ -6,6 +6,7 @@ struct device; struct fwnode_handle; struct gpio_regmap; +struct gpio_chip; struct irq_domain; struct regmap; =20 @@ -40,6 +41,8 @@ struct regmap; * @drvdata: (Optional) Pointer to driver specific data which is * not used by gpio-remap but is provided "as is" to the * driver callback(s). + * @init_valid_mask: (Optional) Routine to initialize @valid_mask, to be u= sed + * if not all GPIOs are valid. * @regmap_irq_chip: (Optional) Pointer on an regmap_irq_chip structure. If * set, a regmap-irq device will be created and the IRQ * domain will be set accordingly. @@ -93,6 +96,10 @@ struct gpio_regmap_config { unsigned int offset, unsigned int *reg, unsigned int *mask); =20 + int (*init_valid_mask)(struct gpio_chip *gc, + unsigned long *valid_mask, + unsigned int ngpios); + void *drvdata; }; =20 --=20 2.39.5