Unverified Commit 8ad7f3b2 authored by Pei Xiao's avatar Pei Xiao Committed by Mark Brown
Browse files

regmap: i3c: Add non-devm regmap_init_i3c() helper



Add __regmap_init_i3c() and the corresponding regmap_init_i3c() macro to
allow creating a regmap for I3C devices without using the device-managed
version. This mirrors the pattern already established for other buses
such as I2C, SPI and so on, giving drivers more flexibility when
the regmap lifetime is not directly tied to the device.

Signed-off-by: default avatarPei Xiao <xiaopei01@kylinos.cn>
Link: https://patch.msgid.link/a81256a8866b163979a20406abf01df7d7440104.1775788105.git.xiaopei01@kylinos.cn


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7d696210
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -46,6 +46,16 @@ static const struct regmap_bus regmap_i3c = {
	.read = regmap_i3c_read,
};

struct regmap *__regmap_init_i3c(struct i3c_device *i3c,
				 const struct regmap_config *config,
				 struct lock_class_key *lock_key,
				 const char *lock_name)
{
	return __regmap_init(&i3c->dev, &regmap_i3c, &i3c->dev, config,
				  lock_key, lock_name);
}
EXPORT_SYMBOL_GPL(__regmap_init_i3c);

struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
				      const struct regmap_config *config,
				      struct lock_class_key *lock_key,
+17 −0
Original line number Diff line number Diff line
@@ -693,6 +693,10 @@ struct regmap *__regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw,
				     const struct regmap_sdw_mbq_cfg *mbq_config,
				     struct lock_class_key *lock_key,
				     const char *lock_name);
struct regmap *__regmap_init_i3c(struct i3c_device *i3c,
				 const struct regmap_config *config,
				 struct lock_class_key *lock_key,
				 const char *lock_name);
struct regmap *__regmap_init_spi_avmm(struct spi_device *spi,
				      const struct regmap_config *config,
				      struct lock_class_key *lock_key,
@@ -999,6 +1003,19 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
	__regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config,	\
				dev, sdw, config, mbq_config)

/**
 * regmap_init_i3c() - Initialise register map
 *
 * @i3c: Device that will be interacted with
 * @config: Configuration for register map
 *
 * The return value will be an ERR_PTR() on error or a valid pointer to
 * a struct regmap.
 */
#define regmap_init_i3c(i3c, config)					\
	__regmap_lockdep_wrapper(__regmap_init_i3c, #config,		\
				i3c, config)

/**
 * regmap_init_spi_avmm() - Initialize register map for Intel SPI Slave
 * to AVMM Bus Bridge