From dd898b209577b83283bb62400c96426d7582e5a2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 20 Jul 2011 22:28:58 +0100 Subject: regmap: Add kerneldoc for struct regmap_config Signed-off-by: Mark Brown --- include/linux/regmap.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 60a65cd7e1a0..cf8e4cffd386 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -20,6 +20,12 @@ struct i2c_client; struct spi_device; +/** + * Configuration for the register map of a device. + * + * @reg_bits: Number of bits in a register address, mandatory. + * @val_bits: Number of bits in a register value, mandatory. + */ struct regmap_config { int reg_bits; int val_bits; -- cgit v1.2.3 From 2e2ae66df37a14c9b33889b243b0ae1352ada1dd Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 20 Jul 2011 22:33:39 +0100 Subject: regmap: Allow devices to specify which registers are accessible This is currently unused but we need to know which registers exist and their properties in order to implement diagnostics like register map dumps and the cache features. We use callbacks partly because properties can vary at runtime (eg, through access locks on registers) and partly because big switch statements are a good compromise between readable code and small data size for providing information on big register maps. Signed-off-by: Mark Brown --- include/linux/regmap.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index cf8e4cffd386..aef2b36a8ccf 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -25,10 +25,23 @@ struct spi_device; * * @reg_bits: Number of bits in a register address, mandatory. * @val_bits: Number of bits in a register value, mandatory. + * + * @max_register: Optional, specifies the maximum valid register index. + * @writeable_register: Optional callback returning true if the register + * can be written to. + * @readable_register: Optional callback returning true if the register + * can be read from. + * @volatile_register: Optional callback returning true if the register + * value can't be cached. */ struct regmap_config { int reg_bits; int val_bits; + + unsigned int max_register; + bool (*writeable_reg)(struct device *dev, unsigned int reg); + bool (*readable_reg)(struct device *dev, unsigned int reg); + bool (*volatile_reg)(struct device *dev, unsigned int reg); }; typedef int (*regmap_hw_write)(struct device *dev, const void *data, -- cgit v1.2.3 From 18694886bddb2d4d905535a0149aeef3b5f9c936 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 8 Aug 2011 15:40:22 +0900 Subject: regmap: Add precious registers to the driver interface Some devices are sensitive to reads on their registers, especially for things like clear on read interrupt status registers. Avoid creating problems with these with things like debugfs by allowing drivers to tell the core about them. If a register is marked as precious then the core will not internally generate any reads of it. Signed-off-by: Mark Brown --- include/linux/regmap.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index aef2b36a8ccf..c878a4bf717e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -33,6 +33,9 @@ struct spi_device; * can be read from. * @volatile_register: Optional callback returning true if the register * value can't be cached. + * @precious_register: Optional callback returning true if the rgister + * should not be read outside of a call from the driver + * (eg, a clear on read interrupt status register). */ struct regmap_config { int reg_bits; @@ -42,6 +45,7 @@ struct regmap_config { bool (*writeable_reg)(struct device *dev, unsigned int reg); bool (*readable_reg)(struct device *dev, unsigned int reg); bool (*volatile_reg)(struct device *dev, unsigned int reg); + bool (*precious_reg)(struct device *dev, unsigned int reg); }; typedef int (*regmap_hw_write)(struct device *dev, const void *data, -- cgit v1.2.3