06 Dec, 2011

2 commits


05 Dec, 2011

2 commits


30 Nov, 2011

1 commit

  • Some users of regmap_update_bits() would like to be able to tell their
    users if they actually did an update so provide a variant which also
    returns a flag indicating if an update took place. We could return a
    tristate in the return value of regmap_update_bits() but this makes the
    API more cumbersome to use and doesn't fit with the general zero for
    success idiom we have.

    Signed-off-by: Mark Brown

    Mark Brown
     

21 Nov, 2011

1 commit


17 Nov, 2011

1 commit

  • The reg_defaults field usually points to a static per driver array, which should
    not be modified. Make requirement this explicit by making reg_defaults const.
    To allow this the regcache_init code needs some minor changes. Previoulsy the
    reg_config was not available in regcache_init and regmap->reg_defaults was used
    to pass the default register set to regcache_init. Now that the reg_config is
    available we can work on it directly.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

08 Nov, 2011

4 commits


01 Nov, 2011

1 commit

  • The pretty much brings in the kitchen sink along
    with it, so it should be avoided wherever reasonably possible in
    terms of being included from other commonly used
    files, as it results in a measureable increase on compile times.

    The worst culprit was probably device.h since it is used everywhere.
    This file also had an implicit dependency/usage of mutex.h which was
    masked by module.h, and is also fixed here at the same time.

    There are over a dozen other headers that simply declare the
    struct instead of pulling in the whole file, so follow their lead
    and simply make it a few more.

    Most of the implicit dependencies on module.h being present by
    these headers pulling it in have been now weeded out, so we can
    finally make this change with hopefully minimal breakage.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

30 Sep, 2011

1 commit


20 Sep, 2011

6 commits

  • Signed-off-by: Mark Brown

    Mark Brown
     
  • Signed-off-by: Mark Brown

    Mark Brown
     
  • This patch adds support for LZO compression when storing the register
    cache.

    For a typical device whose register map would normally occupy 25kB or 50kB
    by using the LZO compression technique, one can get down to ~5-7kB. There
    might be a performance penalty associated with each individual read/write
    due to decompressing/compressing the underlying cache, however that should not
    be noticeable. These memory benefits depend on whether the target architecture
    can get rid of the memory occupied by the original register defaults cache
    which is marked as __devinitconst. Nevertheless there will be some memory
    gain even if the target architecture can't get rid of the original register
    map, this should be around ~30-32kB instead of 50kB.

    Signed-off-by: Dimitris Papastamos
    Signed-off-by: Mark Brown

    Dimitris Papastamos
     
  • This patch adds support for the rbtree cache compression type.

    Each rbnode manages a variable length block of registers. There can be no
    two nodes with overlapping blocks. Each block has a base register and a
    currently top register, all the other registers, if any, lie in between these
    two and in ascending order.

    The reasoning behind the construction of this rbtree is simple. In the
    snd_soc_rbtree_cache_init() function, we iterate over the register defaults
    provided by the regcache core. For each register value that is non-zero we
    insert it in the rbtree. In order to determine in which rbnode we need
    to add the register, we first look if there is another register already
    added that is adjacent to the one we are about to add. If that is the case
    we append it in that rbnode block, otherwise we create a new rbnode
    with a single register in its block and add it to the tree.

    There are various optimizations across the implementation to speed up lookups
    by caching the most recently used rbnode.

    Signed-off-by: Dimitris Papastamos
    Tested-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Dimitris Papastamos
     
  • This is the simplest form of a cache available in regcache. Any
    registers whose default value is 0 are ignored. If any of those
    registers are modified in the future, they will be placed in the
    cache on demand. The cache layout is essentially using the provided
    register defaults by the regcache core directly and does not re-map
    it to another representation.

    Signed-off-by: Dimitris Papastamos
    Signed-off-by: Mark Brown

    Dimitris Papastamos
     
  • This patch introduces caching support for regmap. The regcache API
    has evolved essentially out of ASoC soc-cache so most of the actual
    caching types (except LZO) have been tested in the past.

    The purpose of regcache is to optimize in time and space the handling
    of register caches. Time optimization is achieved by not having to go
    over a slow bus like I2C to read the value of a register, instead it is
    cached locally in memory and can be retrieved faster. Regarding space
    optimization, some of the cache types are better at packing the caches,
    for e.g. the rbtree and the LZO caches. By doing this the sacrifice in
    time still wins over doing I2C transactions.

    Signed-off-by: Dimitris Papastamos
    Tested-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Dimitris Papastamos
     

06 Sep, 2011

2 commits

  • Some buses like SPI have no standard notation of read or write operations.
    The general scheme here is to set or clear specific bits in the register
    address to indicate whether the operation is a read or write. We already
    support having a read flag mask per bus, but as there is no standard
    the bits which need to be set or cleared differ between devices and vendors,
    thus we need a mechanism to specify them per device.

    This patch adds two new entries to the regmap_config struct, read_flag_mask and
    write_flag_mask. These will be or'ed onto the top byte when doing a read or
    write operation. If both masks are empty the device will fallback to the
    regmap_bus masks.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     
  • No longer used as users link directly with the bus types so the core
    module infrastructure does refcounting for us.

    Signed-off-by: Mark Brown

    Mark Brown
     

21 Aug, 2011

2 commits

  • Mark Brown
     
  • It is useful for the register cache code to be able to specify the
    default values for the device registers. The major use is when restoring
    the register cache after suspend, knowing the register defaults allows
    us to skip registers that are at their default values when we resume which
    can be a substantial win on larger modern devices. For some devices
    (mostly older ones) the hardware does not support readback so the only way we
    can know the values is from code and so initializing the cache with default
    values makes it much easier for drivers work with read/modify/write
    updates.

    Signed-off-by: Mark Brown

    Mark Brown
     

09 Aug, 2011

2 commits


08 Aug, 2011

3 commits


23 Jul, 2011

3 commits

  • Signed-off-by: Mark Brown
    Acked-by: Liam Girdwood
    Acked-by: Wolfram Sang
    Acked-by: Grant Likely

    Mark Brown
     
  • Signed-off-by: Mark Brown
    Acked-by: Liam Girdwood
    Acked-by: Wolfram Sang
    Acked-by: Grant Likely

    Mark Brown
     
  • There are many places in the tree where we implement register access for
    devices on non-memory mapped buses, especially I2C and SPI. Since hardware
    designers seem to have settled on a relatively consistent set of register
    interfaces this can be effectively factored out into shared code. There
    are a standard set of formats for marshalling data for exchange with the
    device, with the actual I/O mechanisms generally being simple byte
    streams.

    We create an abstraction for marshaling data into formats which can be
    sent on the control interfaces, and create a standard method for
    plugging in actual transport underneath that.

    This is mostly a refactoring and renaming of the bottom level of the
    existing code for sharing register I/O which we have in ASoC. A
    subsequent patch in this series converts ASoC to use this. The main
    difference in interface is that reads return values by writing to a
    location provided by a pointer rather than in the return value, ensuring
    we can use the full range of the type for register data. We also use
    unsigned types rather than ints for the same reason.

    As some of the devices can have very large register maps the existing
    ASoC code also contains infrastructure for managing register caches.
    This cache work will be moved over in a future stage to allow for
    separate review, the current patch only deals with the physical I/O.

    Signed-off-by: Mark Brown
    Acked-by: Liam Girdwood
    Acked-by: Greg Kroah-Hartman
    Acked-by: Wolfram Sang
    Acked-by: Grant Likely

    Mark Brown