All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Leitner <richard.leitner@linux.dev>
To: Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Dave Stevenson <dave.stevenson@raspberrypi.com>,
	 Alexander Stein <alexander.stein@ew.tq-group.com>,
	 linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	 driver-core@lists.linux.dev,
	Richard Leitner <richard.leitner@linux.dev>
Subject: [PATCH RFC 2/2] regmap: implement no-sequential-read firmware property
Date: Wed, 22 Jul 2026 10:42:47 +0200	[thread overview]
Message-ID: <20260722-regmap-single-read-v1-2-aaaf31591669@linux.dev> (raw)
In-Reply-To: <20260722-regmap-single-read-v1-0-aaaf31591669@linux.dev>

Some devices are integrated in hardware modules where incrementing
multi-register reads are not reliable, even though the underlying chip
normally supports them.

regmap already owns a configuration that selects between bulk reads and
single-register reads. Letting regmap consume this firmware property
makes use of this configuration and therefore keeps the override in the
actual layer of implementation.

If the property is absent, existing behaviour is unchanged.

Signed-off-by: Richard Leitner <richard.leitner@linux.dev>
---
 drivers/base/regmap/regmap.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e6e022b026375..ed08db764cdcb 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -674,6 +674,18 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(regmap_get_val_endian);
 
+static bool regmap_get_use_single_read(struct device *dev,
+				       const struct regmap_bus *bus,
+				       const struct regmap_config *config)
+{
+	struct fwnode_handle *fwnode = dev ? dev_fwnode(dev) : NULL;
+
+	if (fwnode_property_read_bool(fwnode, "no-sequential-read"))
+		return true;
+
+	return config->use_single_read || !(config->read || (bus && bus->read));
+}
+
 struct regmap *__regmap_init(struct device *dev,
 			     const struct regmap_bus *bus,
 			     void *bus_context,
@@ -786,7 +798,7 @@ struct regmap *__regmap_init(struct device *dev,
 		map->reg_stride_order = ilog2(map->reg_stride);
 	else
 		map->reg_stride_order = -1;
-	map->use_single_read = config->use_single_read || !(config->read || (bus && bus->read));
+	map->use_single_read = regmap_get_use_single_read(dev, bus, config);
 	map->use_single_write = config->use_single_write || !(config->write || (bus && bus->write));
 	map->can_multi_write = config->can_multi_write && (config->write || (bus && bus->write));
 	if (bus) {

-- 
2.53.0



      parent reply	other threads:[~2026-07-22  8:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  8:42 [PATCH RFC 0/2] regmap: support firmware-described non-sequential register reads Richard Leitner
2026-07-22  8:42 ` [PATCH RFC 1/2] dt-bindings: regmap: add common schema for no-sequential-read Richard Leitner
2026-07-22  8:49   ` sashiko-bot
2026-07-22 13:59   ` Mark Brown
2026-07-22  8:42 ` Richard Leitner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260722-regmap-single-read-v1-2-aaaf31591669@linux.dev \
    --to=richard.leitner@linux.dev \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.