summaryrefslogtreecommitdiff
path: root/include/linux/regmap.h
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-04-04 15:48:30 -0600
committerSimone Willett <swillett@nvidia.com>2012-04-15 14:12:19 -0700
commitd5a70b9a3304ef71b0a0ba97a9933c579b1fa6b0 (patch)
tree1c94fb3df65799a62dae4a542699b9ed3213efe6 /include/linux/regmap.h
parent88deb440c6cea0709f3118d9727d925b632612a3 (diff)
regmap: introduce explicit bus_context for bus callbacks
The only context needed by I2C and SPI bus definitions is the device itself; this can be converted to an i2c_client or spi_device in order to perform IO on the device. However, other bus types may need more context in order to perform IO. Enable this by having regmap_init accept a bus_context parameter, and pass this to all bus callbacks. The existing callbacks simply pass the struct device here. Future bus types may pass something else. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 0135bbcc7a0cc056f0203ff839466236b8e3dc19) Change-Id: I36b3fb3433af6e6f1e673fc6c73ba21f7eb4d054 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96502 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'include/linux/regmap.h')
-rw-r--r--include/linux/regmap.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index eb0a600fccd2..e3ed73658e12 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -94,14 +94,15 @@ struct regmap_config {
u8 write_flag_mask;
};
-typedef int (*regmap_hw_write)(struct device *dev, const void *data,
+typedef int (*regmap_hw_write)(void *context, const void *data,
size_t count);
-typedef int (*regmap_hw_gather_write)(struct device *dev,
+typedef int (*regmap_hw_gather_write)(void *context,
const void *reg, size_t reg_len,
const void *val, size_t val_len);
-typedef int (*regmap_hw_read)(struct device *dev,
+typedef int (*regmap_hw_read)(void *context,
const void *reg_buf, size_t reg_size,
void *val_buf, size_t val_size);
+typedef void (*regmap_hw_free_context)(void *context);
/**
* Description of a hardware bus for the register map infrastructure.
@@ -118,11 +119,13 @@ struct regmap_bus {
regmap_hw_write write;
regmap_hw_gather_write gather_write;
regmap_hw_read read;
+ regmap_hw_free_context free_context;
u8 read_flag_mask;
};
struct regmap *regmap_init(struct device *dev,
const struct regmap_bus *bus,
+ void *bus_context,
const struct regmap_config *config);
struct regmap *regmap_init_i2c(struct i2c_client *i2c,
const struct regmap_config *config);
@@ -131,6 +134,7 @@ struct regmap *regmap_init_spi(struct spi_device *dev,
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);