regmap: Converts group operation into single read write operations
[deliverable/linux.git] / drivers / base / regmap / internal.h
index fcafc5b2e65113e36e496079ec2e20c93e20abb3..2eb719704885cbfe9497e0c04de7f5d088d990a6 100644 (file)
@@ -26,21 +26,29 @@ struct regmap_format {
        size_t val_bytes;
        void (*format_write)(struct regmap *map,
                             unsigned int reg, unsigned int val);
-       void (*format_reg)(void *buf, unsigned int reg);
-       void (*format_val)(void *buf, unsigned int val);
+       void (*format_reg)(void *buf, unsigned int reg, unsigned int shift);
+       void (*format_val)(void *buf, unsigned int val, unsigned int shift);
        unsigned int (*parse_val)(void *buf);
 };
 
+typedef void (*regmap_lock)(struct regmap *map);
+typedef void (*regmap_unlock)(struct regmap *map);
+
 struct regmap {
-       struct mutex lock;
+       struct mutex mutex;
+       spinlock_t spinlock;
+       regmap_lock lock;
+       regmap_unlock unlock;
 
        struct device *dev; /* Device we do I/O on */
        void *work_buf;     /* Scratch buffer used to format I/O */
        struct regmap_format format;  /* Buffer format */
        const struct regmap_bus *bus;
+       void *bus_context;
 
 #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs;
+       const char *debugfs_name;
 #endif
 
        unsigned int max_register;
@@ -52,6 +60,10 @@ struct regmap {
        u8 read_flag_mask;
        u8 write_flag_mask;
 
+       /* number of bits to (left) shift the reg value when formatting*/
+       int reg_shift;
+       int reg_stride;
+
        /* regcache specific members */
        const struct regcache_ops *cache_ops;
        enum regcache_type cache_type;
@@ -79,6 +91,9 @@ struct regmap {
 
        struct reg_default *patch;
        int patch_regs;
+
+       /* if set, converts bulk rw to single rw */
+       bool use_single_rw;
 };
 
 struct regcache_ops {
@@ -101,11 +116,11 @@ int _regmap_write(struct regmap *map, unsigned int reg,
 
 #ifdef CONFIG_DEBUG_FS
 extern void regmap_debugfs_initcall(void);
-extern void regmap_debugfs_init(struct regmap *map);
+extern void regmap_debugfs_init(struct regmap *map, const char *name);
 extern void regmap_debugfs_exit(struct regmap *map);
 #else
 static inline void regmap_debugfs_initcall(void) { }
-static inline void regmap_debugfs_init(struct regmap *map) { }
+static inline void regmap_debugfs_init(struct regmap *map, const char *name) { }
 static inline void regmap_debugfs_exit(struct regmap *map) { }
 #endif
 
This page took 0.025352 seconds and 5 git commands to generate.