From: Mark Brown Date: Fri, 4 Sep 2015 16:22:10 +0000 (+0100) Subject: Merge remote-tracking branches 'regmap/topic/lockdep' and 'regmap/topic/seq-delay... X-Git-Tag: Ubuntu-5.10.0-12.13~14122^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=072502a67c9164625288cca17704808e6c06273f;p=mirror_ubuntu-hirsute-kernel.git Merge remote-tracking branches 'regmap/topic/lockdep' and 'regmap/topic/seq-delay' into regmap-next --- 072502a67c9164625288cca17704808e6c06273f diff --cc drivers/base/regmap/internal.h index fc554e357c5d,b2b2849fc6d3,873ddf91c9d3..cc557886ab23 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@@@ -136,13 -136,11 -136,11 +136,13 @@@@ struct regmap /* if set, the HW registers are known to match map->reg_defaults */ bool no_sync_defaults; -- struct reg_default *patch; ++ struct reg_sequence *patch; int patch_regs; -- /* if set, converts bulk rw to single rw */ -- bool use_single_rw; ++ /* if set, converts bulk read to single read */ ++ bool use_single_read; ++ /* if set, converts bulk read to single read */ ++ bool use_single_write; /* if set, the device supports multi write mode */ bool can_multi_write; diff --cc drivers/base/regmap/regmap.c index 4dd571f9d4c2,53ba9d9e17d1,b3a5aa5cd580..afaf56200674 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@@@ -1824,10 -1724,10 -1741,10 +1809,10 @@@@ EXPORT_SYMBOL_GPL(regmap_bulk_write) * * the (register,newvalue) pairs in regs have not been formatted, but * they are all in the same page and have been changed to being page -- * relative. The page register has been written if that was neccessary. ++ * relative. The page register has been written if that was necessary. */ static int _regmap_raw_multi_reg_write(struct regmap *map, -- const struct reg_default *regs, ++ const struct reg_sequence *regs, size_t num_regs) { int ret; diff --cc include/linux/regmap.h index e0fb86bfaafd,ee032eca630d,5a7cf2136c81..8fc0bfd8edc4 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@@@ -327,49 -323,184 -336,47 +342,186 @@@@ struct regmap_bus u8 read_flag_mask; enum regmap_endian reg_format_endian_default; enum regmap_endian val_format_endian_default; ++ size_t max_raw_read; ++ size_t max_raw_write; }; - -struct regmap *regmap_init(struct device *dev, - - const struct regmap_bus *bus, - - void *bus_context, - - const struct regmap_config *config); + +/* + + * __regmap_init functions. + + * + + * These functions take a lock key and name parameter, and should not be called + + * directly. Instead, use the regmap_init macros that generate a key and name + + * for each call. + + */ + +struct regmap *__regmap_init(struct device *dev, + + const struct regmap_bus *bus, + + void *bus_context, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__regmap_init_i2c(struct i2c_client *i2c, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__regmap_init_spi(struct spi_device *dev, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__regmap_init_spmi_base(struct spmi_device *dev, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__regmap_init_spmi_ext(struct spmi_device *dev, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__regmap_init_mmio_clk(struct device *dev, const char *clk_id, + + void __iomem *regs, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + + + +struct regmap *__devm_regmap_init(struct device *dev, + + const struct regmap_bus *bus, + + void *bus_context, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__devm_regmap_init_spi(struct spi_device *dev, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__devm_regmap_init_spmi_base(struct spmi_device *dev, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__devm_regmap_init_spmi_ext(struct spmi_device *dev, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__devm_regmap_init_mmio_clk(struct device *dev, + + const char *clk_id, + + void __iomem *regs, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + +struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97, + + const struct regmap_config *config, + + struct lock_class_key *lock_key, + + const char *lock_name); + + + +/* + + * Wrapper for regmap_init macros to include a unique lockdep key and name + + * for each call. No-op if CONFIG_LOCKDEP is not set. + + * + + * @fn: Real function to call (in the form __[*_]regmap_init[_*]) + + * @name: Config variable name (#config in the calling macro) + + **/ + +#ifdef CONFIG_LOCKDEP + +#define __regmap_lockdep_wrapper(fn, name, ...) \ + +( \ + + ({ \ + + static struct lock_class_key _key; \ + + fn(__VA_ARGS__, &_key, \ + + KBUILD_BASENAME ":" \ + + __stringify(__LINE__) ":" \ + + "(" name ")->lock"); \ + + }) \ + +) + +#else + +#define __regmap_lockdep_wrapper(fn, name, ...) fn(__VA_ARGS__, NULL, NULL) + +#endif + + + +/** + + * regmap_init(): Initialise register map + + * + + * @dev: Device that will be interacted with + + * @bus: Bus-specific callbacks to use with device + + * @bus_context: Data passed to bus-specific callbacks + + * @config: Configuration for register map + + * + + * The return value will be an ERR_PTR() on error or a valid pointer to + + * a struct regmap. This function should generally not be called + + * directly, it should be called by bus-specific init functions. + + */ + +#define regmap_init(dev, bus, bus_context, config) \ + + __regmap_lockdep_wrapper(__regmap_init, #config, \ + + dev, bus, bus_context, config) int regmap_attach_dev(struct device *dev, struct regmap *map, - - const struct regmap_config *config); - -struct regmap *regmap_init_i2c(struct i2c_client *i2c, - - const struct regmap_config *config); - -struct regmap *regmap_init_spi(struct spi_device *dev, - - const struct regmap_config *config); - -struct regmap *regmap_init_spmi_base(struct spmi_device *dev, - - const struct regmap_config *config); - -struct regmap *regmap_init_spmi_ext(struct spmi_device *dev, - - const struct regmap_config *config); - -struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, - - void __iomem *regs, - - const struct regmap_config *config); - -struct regmap *regmap_init_ac97(struct snd_ac97 *ac97, - - const struct regmap_config *config); - - - -struct regmap *devm_regmap_init(struct device *dev, - - const struct regmap_bus *bus, - - void *bus_context, - - const struct regmap_config *config); - -struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, - - const struct regmap_config *config); - -struct regmap *devm_regmap_init_spi(struct spi_device *dev, - - const struct regmap_config *config); - -struct regmap *devm_regmap_init_spmi_base(struct spmi_device *dev, - - const struct regmap_config *config); - -struct regmap *devm_regmap_init_spmi_ext(struct spmi_device *dev, - - const struct regmap_config *config); - -struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, - - void __iomem *regs, - - const struct regmap_config *config); - -struct regmap *devm_regmap_init_ac97(struct snd_ac97 *ac97, - - const struct regmap_config *config); + + const struct regmap_config *config); - -bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); + +/** + + * regmap_init_i2c(): Initialise register map + + * + + * @i2c: 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_i2c(i2c, config) \ + + __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \ + + i2c, config) + + + +/** + + * regmap_init_spi(): Initialise register map + + * + + * @spi: 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_spi(dev, config) \ + + __regmap_lockdep_wrapper(__regmap_init_spi, #config, \ + + dev, config) + + + +/** + + * regmap_init_spmi_base(): Create regmap for the Base register space + + * @sdev: SPMI 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_spmi_base(dev, config) \ + + __regmap_lockdep_wrapper(__regmap_init_spmi_base, #config, \ + + dev, config) + + + +/** + + * regmap_init_spmi_ext(): Create regmap for Ext register space + + * @sdev: 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_spmi_ext(dev, config) \ + + __regmap_lockdep_wrapper(__regmap_init_spmi_ext, #config, \ + + dev, config) + + + +/** + + * regmap_init_mmio_clk(): Initialise register map with register clock + + * + + * @dev: Device that will be interacted with + + * @clk_id: register clock consumer ID + + * @regs: Pointer to memory-mapped IO region + + * @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_mmio_clk(dev, clk_id, regs, config) \ + + __regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \ + + dev, clk_id, regs, config) /** * regmap_init_mmio(): Initialise register map