]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branches 'regmap-core', 'regmap-stride', 'regmap-mmio' and 'regmap-irq' into...
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 13 May 2012 18:20:47 +0000 (19:20 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 13 May 2012 18:20:47 +0000 (19:20 +0100)
1  2  3  4 
drivers/base/regmap/internal.h
drivers/base/regmap/regmap-irq.c
drivers/base/regmap/regmap.c
include/linux/regmap.h

index 606b83d7545825e6da000a13bd145b71ce5e3c33,2eb719704885cbfe9497e0c04de7f5d088d990a6,c994bc9bc04ffc9d82392bdde4547aa6aed2461d,fcafc5b2e65113e36e496079ec2e20c93e20abb3..b986b8660b0c4e72da132a0a32ab2960ca99e183
@@@@@ -38,6 -44,7 -44,8 -38,6 +44,8 @@@@@ struct regmap 
        void *work_buf;     /* Scratch buffer used to format I/O */
        struct regmap_format format;  /* Buffer format */
        const struct regmap_bus *bus;
+  +    void *bus_context;
++ +    const char *name;
    
    #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs;
        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;
Simple merge
index 3e551223f4dff9d0e870aae8c993948b090c8d49,357294905793c840aea6826262bbab4dda2d3660,618173e4c2b147c3c6a4b534462065d65a9653a6,7a3f535e481c69ac31254b84bc6111e0d9793814..0bcda488f11cd45e6252e113ffd025b058309e99
@@@@@ -179,6 -179,26 -158,35 -158,6 +179,35 @@@@@ static unsigned int regmap_parse_32(voi
        return b[0];
    }
    
+  +static void regmap_lock_mutex(struct regmap *map)
+  +{
+  +    mutex_lock(&map->mutex);
+  +}
+  +
+  +static void regmap_unlock_mutex(struct regmap *map)
+  +{
+  +    mutex_unlock(&map->mutex);
+  +}
+  +
+  +static void regmap_lock_spinlock(struct regmap *map)
+  +{
+  +    spin_lock(&map->spinlock);
+  +}
+  +
+  +static void regmap_unlock_spinlock(struct regmap *map)
+  +{
+  +    spin_unlock(&map->spinlock);
+  +}
+  +
++ +static void dev_get_regmap_release(struct device *dev, void *res)
++ +{
++ +    /*
++ +     * We don't actually have anything to do here; the goal here
++ +     * is not to manage the regmap but to provide a simple way to
++ +     * get the regmap back given a struct device.
++ +     */
++ +}
++ +
    /**
     * regmap_init(): Initialise register map
     *
     */
    struct regmap *regmap_init(struct device *dev,
                           const struct regmap_bus *bus,
+  +                       void *bus_context,
                           const struct regmap_config *config)
    {
-- -    struct regmap *map;
++ +    struct regmap *map, **m;
        int ret = -EINVAL;
    
        if (!bus || !config)
        map->format.pad_bytes = config->pad_bits / 8;
        map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8);
        map->format.buf_size += map->format.pad_bytes;
  ++    map->reg_shift = config->pad_bits % 8;
+ ++    if (config->reg_stride)
+ ++            map->reg_stride = config->reg_stride;
+ ++    else
+ ++            map->reg_stride = 1;
+ ++    map->use_single_rw = config->use_single_rw;
        map->dev = dev;
        map->bus = bus;
+  +    map->bus_context = bus_context;
        map->max_register = config->max_register;
        map->writeable_reg = config->writeable_reg;
        map->readable_reg = config->readable_reg;
@@@@@ -555,7 -600,10 -623,7 -529,7 +659,10 @@@@@ int regmap_write(struct regmap *map, un
    {
        int ret;
    
-  -    mutex_lock(&map->lock);
+ ++    if (reg % map->reg_stride)
+ ++            return -EINVAL;
+ ++
+  +    map->lock(map);
    
        ret = _regmap_write(map, reg, val);
    
@@@@@ -586,7 -634,12 -654,10 -560,7 +693,12 @@@@@ int regmap_raw_write(struct regmap *map
    {
        int ret;
    
-  -    mutex_lock(&map->lock);
+  +    if (val_len % map->format.val_bytes)
+  +            return -EINVAL;
+ ++    if (reg % map->reg_stride)
+ ++            return -EINVAL;
+  +
+  +    map->lock(map);
    
        ret = _regmap_raw_write(map, reg, val, val_len);
    
@@@@@ -619,8 -672,10 -690,8 -593,8 +731,10 @@@@@ int regmap_bulk_write(struct regmap *ma
    
        if (!map->format.parse_val)
                return -EINVAL;
+ ++    if (reg % map->reg_stride)
+ ++            return -EINVAL;
    
-  -    mutex_lock(&map->lock);
+  +    map->lock(map);
    
        /* No formatting is require if val_byte is 1 */
        if (val_bytes == 1) {
@@@@@ -718,7 -785,10 -786,7 -689,7 +847,10 @@@@@ int regmap_read(struct regmap *map, uns
    {
        int ret;
    
-  -    mutex_lock(&map->lock);
+ ++    if (reg % map->reg_stride)
+ ++            return -EINVAL;
+ ++
+  +    map->lock(map);
    
        ret = _regmap_read(map, reg, val);
    
@@@@@ -747,7 -817,12 -815,10 -718,7 +879,12 @@@@@ int regmap_raw_read(struct regmap *map
        unsigned int v;
        int ret, i;
    
-  -    mutex_lock(&map->lock);
+  +    if (val_len % map->format.val_bytes)
+  +            return -EINVAL;
+ ++    if (reg % map->reg_stride)
+ ++            return -EINVAL;
+  +
+  +    map->lock(map);
    
        if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass ||
            map->cache_type == REGCACHE_NONE) {
index a90abb6bfa6400402b516865df47db182dd5e0a0,ae797b142aa8cb5f5eeb2fda088f6a5ee30426da,90a4652eaaea61124fa5e8ada2395fe817678145,a90abb6bfa6400402b516865df47db182dd5e0a0..9dbc9a1bec43b9de67e12e526f663739195b1685
@@@@@ -95,16 -107,19 -95,17 -95,16 +107,19 @@@@@ struct regmap_config 
    
        u8 read_flag_mask;
        u8 write_flag_mask;
+ ++
+ ++    bool use_single_rw;
    };
    
-  -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.