memory-hotplug: remove sysfs file of node
[cascardo/linux.git] / include / linux / regmap.h
index f9b7fbe..bf77dfd 100644 (file)
@@ -28,7 +28,8 @@ struct regmap_range_cfg;
 enum regcache_type {
        REGCACHE_NONE,
        REGCACHE_RBTREE,
-       REGCACHE_COMPRESSED
+       REGCACHE_COMPRESSED,
+       REGCACHE_FLAT,
 };
 
 /**
@@ -127,7 +128,18 @@ typedef void (*regmap_unlock)(void *);
  * @lock_arg:    this field is passed as the only argument of lock/unlock
  *               functions (ignored in case regular lock/unlock functions
  *               are not overridden).
- *
+ * @reg_read:    Optional callback that if filled will be used to perform
+ *               all the reads from the registers. Should only be provided for
+ *               devices whos read operation cannot be represented as a simple read
+ *               operation on a bus such as SPI, I2C, etc. Most of the devices do
+ *               not need this.
+ * @reg_write:   Same as above for writing.
+ * @fast_io:     Register IO is fast. Use a spinlock instead of a mutex
+ *               to perform locking. This field is ignored if custom lock/unlock
+ *               functions are used (see fields lock/unlock of struct regmap_config).
+ *               This field is a duplicate of a similar file in
+ *               'struct regmap_bus' and serves exact same purpose.
+ *                Use it only for "no-bus" cases.
  * @max_register: Optional, specifies the maximum valid register index.
  * @wr_table:     Optional, points to a struct regmap_access_table specifying
  *                valid ranges for write access.
@@ -177,6 +189,11 @@ struct regmap_config {
        regmap_unlock unlock;
        void *lock_arg;
 
+       int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
+       int (*reg_write)(void *context, unsigned int reg, unsigned int val);
+
+       bool fast_io;
+
        unsigned int max_register;
        const struct regmap_access_table *wr_table;
        const struct regmap_access_table *rd_table;
@@ -298,9 +315,9 @@ 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_mmio(struct device *dev,
-                               void __iomem *regs,
-                               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 *devm_regmap_init(struct device *dev,
                                const struct regmap_bus *bus,
@@ -310,9 +327,44 @@ 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_mmio(struct device *dev,
-                                    void __iomem *regs,
-                                    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);
+
+/**
+ * regmap_init_mmio(): Initialise register map
+ *
+ * @dev: Device that will be interacted with
+ * @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.
+ */
+static inline struct regmap *regmap_init_mmio(struct device *dev,
+                                       void __iomem *regs,
+                                       const struct regmap_config *config)
+{
+       return regmap_init_mmio_clk(dev, NULL, regs, config);
+}
+
+/**
+ * devm_regmap_init_mmio(): Initialise managed register map
+ *
+ * @dev: Device that will be interacted with
+ * @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.  The regmap will be automatically freed by the
+ * device management code.
+ */
+static inline struct regmap *devm_regmap_init_mmio(struct device *dev,
+                                       void __iomem *regs,
+                                       const struct regmap_config *config)
+{
+       return devm_regmap_init_mmio_clk(dev, NULL, regs, config);
+}
 
 void regmap_exit(struct regmap *map);
 int regmap_reinit_cache(struct regmap *map,
@@ -397,6 +449,7 @@ struct regmap_irq_chip {
        unsigned int wake_base;
        unsigned int irq_reg_stride;
        unsigned int mask_invert;
+       unsigned int wake_invert;
        bool runtime_pm;
 
        int num_regs;