04 Oct, 2016

1 commit


16 Sep, 2016

1 commit

  • We currently only support masking the top bit for read and write
    flags. Let's make the mask unsigned long and mask the bytes based
    on the configured register length to make things more generic.

    This allows using regmap for more exotic combinations like SPI
    devices that need little endian addressing.

    Signed-off-by: Tony Lindgren
    Signed-off-by: Mark Brown

    Tony Lindgren
     

09 Aug, 2016

1 commit


30 Mar, 2016

1 commit


20 Feb, 2016

2 commits


05 Nov, 2015

1 commit

  • Pull driver core updates from Greg KH:
    "Here's the "big" driver core updates for 4.4-rc1. Primarily a bunch
    of debugfs updates, with a smattering of minor driver core fixes and
    updates as well.

    All have been in linux-next for a long time"

    * tag 'driver-core-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    debugfs: Add debugfs_create_ulong()
    of: to support binding numa node to specified device in devicetree
    debugfs: Add read-only/write-only bool file ops
    debugfs: Add read-only/write-only size_t file ops
    debugfs: Add read-only/write-only x64 file ops
    debugfs: Consolidate file mode checks in debugfs_create_*()
    Revert "mm: Check if section present during memory block (un)registering"
    driver-core: platform: Provide helpers for multi-driver modules
    mm: Check if section present during memory block (un)registering
    devres: fix a for loop bounds check
    CMA: fix CONFIG_CMA_SIZE_MBYTES overflow in 64bit
    base/platform: assert that dev_pm_domain callbacks are called unconditionally
    sysfs: correctly handle short reads on PREALLOC attrs.
    base: soc: siplify ida usage
    kobject: move EXPORT_SYMBOL() macros next to corresponding definitions
    kobject: explain what kobject's sd field is
    debugfs: document that debugfs_remove*() accepts NULL and error values
    debugfs: Pass bool pointer to debugfs_create_bool()
    ACPI / EC: Fix broken 64bit big-endian users of 'global_lock'

    Linus Torvalds
     

13 Oct, 2015

1 commit


06 Oct, 2015

1 commit

  • This commit allows installing a custom reg_update_bits function for cases where
    the hardware provides a mechanism to set or clear register bits without a
    read/modify/write cycle. Such is the case with the Microchip ENCX24J600.

    If a custom reg_update_bits function is provided, it will only be used against
    volatile registers.

    Signed-off-by: Jon Ringle
    Signed-off-by: Mark Brown

    Jon Ringle
     

04 Oct, 2015

1 commit

  • Its a bit odd that debugfs_create_bool() takes 'u32 *' as an argument,
    when all it needs is a boolean pointer.

    It would be better to update this API to make it accept 'bool *'
    instead, as that will make it more consistent and often more convenient.
    Over that bool takes just a byte.

    That required updates to all user sites as well, in the same commit
    updating the API. regmap core was also using
    debugfs_{read|write}_file_bool(), directly and variable types were
    updated for that to be bool as well.

    Signed-off-by: Viresh Kumar
    Acked-by: Mark Brown
    Acked-by: Charles Keepax
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

15 Sep, 2015

1 commit


05 Sep, 2015

1 commit


30 Aug, 2015

1 commit

  • There are some buses which have a limit on the maximum number of bytes
    that can be send/received. An example for this is
    I2C_FUNC_SMBUS_I2C_BLOCK which does not support any reads/writes of more
    than 32 bytes. The regmap_bulk operations should still be able to
    utilize the full 32 bytes in this case.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Mark Brown

    Markus Pargmann
     

22 Aug, 2015

1 commit

  • use_single_rw currently reflects the capabilities of the connected
    device. The capabilities of the bus are currently missing for this
    variable.

    As there are read only and write only buses we need seperate values for
    use_single_rw to also reflect tha capabilities of the bus.

    This patch splits use_single_rw into use_single_read and
    use_single_write. The initialization is changed to check the
    configuration for use_single_rw and to check the capabilities of the
    used bus.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Mark Brown

    Markus Pargmann
     

17 Jul, 2015

1 commit

  • Separate the functionality using sequences of register writes from the
    functions that take register defaults. This change renames the arguments
    in order to support the extension of reg_sequence to take an optional
    delay to be applied after any given register in a sequence is written.
    This avoids adding an int to all register defaults, which could
    substantially increase memory usage for regmaps with large default tables.

    This also updates all the clients of multi_reg_write/register_patch.

    Signed-off-by: Nariman Poushin
    Signed-off-by: Mark Brown

    Nariman Poushin
     

06 May, 2015

1 commit

  • Existing regmap users call regcache_mark_dirty() as part of the
    suspend/resume sequence, to tell regcache that non-default values need to
    be resynced post-resume. Add an internal "no_sync_defaults" regmap flag
    to remember this state, so that regcache_sync() can differentiate between
    these two cases:

    1) HW was reset, so any cache values that match map->reg_defaults can be
    safely skipped. On some chips there are a lot of registers in the
    reg_defaults list, so this optimization speeds things up quite a bit.

    2) HW was not reset (maybe it was just clock-gated), so if we cached
    any writes, they should be sent to the hardware regardless of whether
    they match the HW default. Currently this will write out all values in
    the regcache, since we don't maintain per-register dirty bits.

    Suggested-by: Mark Brown
    Signed-off-by: Kevin Cernekee
    Signed-off-by: Mark Brown

    Kevin Cernekee
     

20 Mar, 2015

1 commit

  • This patch fixes a NULL pointer dereference when enabling regmap event
    tracing in the presence of a syscon regmap, introduced by commit bdb0066df96e
    ("mfd: syscon: Decouple syscon interface from platform devices").
    That patch introduced syscon regmaps that have their dev field set to NULL.
    The regmap trace events expect it to point to a valid struct device and feed
    it to dev_name():

    $ echo 1 > /sys/kernel/debug/tracing/events/regmap/enable

    Unable to handle kernel NULL pointer dereference at virtual address 0000002c
    pgd = 80004000
    [0000002c] *pgd=00000000
    Internal error: Oops: 17 [#1] SMP ARM
    Modules linked in: coda videobuf2_vmalloc
    CPU: 0 PID: 304 Comm: kworker/0:2 Not tainted 4.0.0-rc2+ #9197
    Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
    Workqueue: events_freezable thermal_zone_device_check
    task: 9f25a200 ti: 9f1ee000 task.ti: 9f1ee000
    PC is at ftrace_raw_event_regmap_block+0x3c/0xe4
    LR is at _regmap_raw_read+0x1bc/0x1cc
    pc : [] lr : [] psr: 600f0093
    sp : 9f1efd78 ip : 9f1efdb8 fp : 9f1efdb4
    r10: 00000004 r9 : 00000001 r8 : 00000001
    r7 : 00000180 r6 : 00000000 r5 : 9f00e3c0 r4 : 00000003
    r3 : 00000001 r2 : 00000180 r1 : 00000000 r0 : 9f00e3c0
    Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
    Control: 10c5387d Table: 2d91004a DAC: 00000015
    Process kworker/0:2 (pid: 304, stack limit = 0x9f1ee210)
    Stack: (0x9f1efd78 to 0x9f1f0000)
    fd60: 9f1efda4 9f1efd88
    fd80: 800708c0 805f9510 80927140 800f0013 9f1fc800 9eb2f490 00000000 00000180
    fda0: 808e3840 00000001 9f1efdfc 9f1efdb8 80365f2c 803636b8 805f8958 800708e0
    fdc0: a00f0013 803636ac 9f16de00 00000180 80927140 9f1fc800 9f1fc800 9f1efe6c
    fde0: 9f1efe6c 9f732400 00000000 00000000 9f1efe1c 9f1efe00 80365f70 80365d7c
    fe00: 80365f3c 9f1fc800 9f1fc800 00000180 9f1efe44 9f1efe20 803656a4 80365f48
    fe20: 9f1fc800 00000180 9f1efe6c 9f1efe6c 9f732400 00000000 9f1efe64 9f1efe48
    fe40: 803657bc 80365634 00000001 9e95f910 9f1fc800 9f1efeb4 9f1efe8c 9f1efe68
    fe60: 80452ac0 80365778 9f1efe8c 9f1efe78 9e93d400 9e93d5e8 9f1efeb4 9f72ef40
    fe80: 9f1efeac 9f1efe90 8044e11c 80452998 8045298c 9e93d608 9e93d400 808e1978
    fea0: 9f1efecc 9f1efeb0 8044fd14 8044e0d0 ffffffff 9f25a200 9e93d608 9e481380
    fec0: 9f1efedc 9f1efed0 8044fde8 8044fcec 9f1eff1c 9f1efee0 80038d50 8044fdd8
    fee0: 9f1ee020 9f72ef40 9e481398 00000000 00000008 9f72ef54 9f1ee020 9f72ef40
    ff00: 9e481398 9e481380 00000008 9f72ef40 9f1eff5c 9f1eff20 80039754 80038bfc
    ff20: 00000000 9e481380 80894100 808e1662 00000000 9e4f2ec0 00000000 9e481380
    ff40: 800396f8 00000000 00000000 00000000 9f1effac 9f1eff60 8003e020 80039704
    ff60: ffffffff 00000000 ffffffff 9e481380 00000000 00000000 9f1eff78 9f1eff78
    ff80: 00000000 00000000 9f1eff88 9f1eff88 9e4f2ec0 8003df30 00000000 00000000
    ffa0: 00000000 9f1effb0 8000eb60 8003df3c 00000000 00000000 00000000 00000000
    ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff ffffffff
    Backtrace:
    [] (ftrace_raw_event_regmap_block) from [] (_regmap_raw_read+0x1bc/0x1cc)
    r9:00000001 r8:808e3840 r7:00000180 r6:00000000 r5:9eb2f490 r4:9f1fc800
    [] (_regmap_raw_read) from [] (_regmap_bus_read+0x34/0x6c)
    r10:00000000 r9:00000000 r8:9f732400 r7:9f1efe6c r6:9f1efe6c r5:9f1fc800
    r4:9f1fc800
    [] (_regmap_bus_read) from [] (_regmap_read+0x7c/0x144)
    r6:00000180 r5:9f1fc800 r4:9f1fc800 r3:80365f3c
    [] (_regmap_read) from [] (regmap_read+0x50/0x70)
    r9:00000000 r8:9f732400 r7:9f1efe6c r6:9f1efe6c r5:00000180 r4:9f1fc800
    [] (regmap_read) from [] (imx_get_temp+0x134/0x1a4)
    r6:9f1efeb4 r5:9f1fc800 r4:9e95f910 r3:00000001
    [] (imx_get_temp) from [] (thermal_zone_get_temp+0x58/0x74)
    r7:9f72ef40 r6:9f1efeb4 r5:9e93d5e8 r4:9e93d400
    [] (thermal_zone_get_temp) from [] (thermal_zone_device_update+0x34/0xec)
    r6:808e1978 r5:9e93d400 r4:9e93d608 r3:8045298c
    [] (thermal_zone_device_update) from [] (thermal_zone_device_check+0x1c/0x20)
    r5:9e481380 r4:9e93d608
    [] (thermal_zone_device_check) from [] (process_one_work+0x160/0x3d4)
    [] (process_one_work) from [] (worker_thread+0x5c/0x4f4)
    r10:9f72ef40 r9:00000008 r8:9e481380 r7:9e481398 r6:9f72ef40 r5:9f1ee020
    r4:9f72ef54
    [] (worker_thread) from [] (kthread+0xf0/0x108)
    r10:00000000 r9:00000000 r8:00000000 r7:800396f8 r6:9e481380 r5:00000000
    r4:9e4f2ec0
    [] (kthread) from [] (ret_from_fork+0x14/0x34)
    r7:00000000 r6:00000000 r5:8003df30 r4:9e4f2ec0
    Code: e3140040 1a00001a e3140020 1a000016 (e596002c)
    ---[ end trace 193c15c2494ec960 ]---

    Fixes: bdb0066df96e (mfd: syscon: Decouple syscon interface from platform devices)
    Signed-off-by: Philipp Zabel
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Philipp Zabel
     

08 Feb, 2015

1 commit


05 Feb, 2015

1 commit


16 Dec, 2014

1 commit


30 Sep, 2014

1 commit


12 Sep, 2014

1 commit


26 Aug, 2014

1 commit

  • Commit 6cfec04bcc05 ("regmap: Separate regmap dev initialization") moved the
    regmap debugfs initialization after regcache initialization. This means
    that the regmap debugfs directory is not created yet when the cache
    initialization runs and so any debugfs files registered by the regcache are
    created in the debugfs root directory rather than the debugfs directory of
    the regmap instance. Fix this by adding a separate callback for the
    regcache debugfs initialization which will be called after the parent
    debugfs entry has been created.

    Fixes: 6cfec04bcc05 (regmap: Separate regmap dev initialization)
    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Lars-Peter Clausen
     

11 Mar, 2014

1 commit


29 Oct, 2013

1 commit


09 Oct, 2013

1 commit

  • Rather than passing a flag around through the entire call stack store it
    in the regmap struct and read it when required. This minimises the
    visibility of the feature through the API, minimising the code updates
    needed to use it more widely.

    Signed-off-by: Mark Brown

    Mark Brown
     

08 Oct, 2013

1 commit

  • Rather than allocating and deallocating the structures used to manage async
    transfers each time we do one keep the structures around as long as the
    regmap is around. This should provide a small performance improvement.

    Signed-off-by: Mark Brown

    Mark Brown
     

17 Sep, 2013

1 commit

  • Current Linux kernel is supporting regmap_field method
    and it is very useful feature.
    It needs one regmap_filed for one register access.

    OTOH, there is multi port device which
    has many same registers in the market.
    The difference for each register access is
    only its address offset.

    Current API needs many regmap_field for such device,
    but it is not good.
    This patch adds new regmap_fileds API which can care
    about multi port/offset access via regmap.

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     

29 Aug, 2013

1 commit

  • With devices which have a dense and small register map but placed at a large
    offset the global cache_present bitmap imposes a huge memory overhead. Making
    the cache_present per rbtree node avoids the issue and easily reduces the memory
    footprint by a factor of ten. For devices with a more sparse map or without a
    large base register offset the memory usage might increase slightly by a few
    bytes, but not significantly. E.g. for a device which has ~50 registers at
    offset 0x4000 the memory footprint of the register cache goes down form 2496
    bytes to 175 bytes.

    Moving the bitmap to a per node basis means that the handling of the bitmap is
    now cache implementation specific and can no longer be managed by the core. The
    regcache_sync_block() function is extended by a additional parameter so that the
    cache implementation can tell the core which registers in the block are set and
    which are not. The parameter is optional and if NULL the core assumes that all
    registers are set. The rbtree cache also needs to implement its own drop
    callback instead of relying on the core to handle this.

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

    Lars-Peter Clausen
     

09 Aug, 2013

1 commit

  • In the initial case when no reg_defaults values are
    provided and no register value was added to the cache
    yet, the cache_present bitmap is NULL. If this function
    is invoked for any register it should return false
    (i.e. the register is not cached) instead of true.

    Signed-off-by: Ionut Nicu
    Signed-off-by: Mark Brown

    Ionut Nicu
     

30 Jun, 2013

1 commit


12 Jun, 2013

1 commit

  • It is common to access regmap registers at bit level, using
    regmap_update_bits or regmap_read functions, however the end user has to
    take care of a mask or shifting. This becomes overhead when such use
    cases are high. Having a common function to do this is much convenient
    and less error prone.

    The idea of regmap_field is simple, regmap_field gives a logical
    structure to bits of the regmap register, and the driver can use this
    logical entity without the knowledge of the bit positions and masks all
    over the code. This way code looks much neat and it need not handle the
    masks, shifts every time it access the those entities.

    With this new regmap_field_read/write apis the end user can setup a
    regmap field using regmap_field_init and use the return regmap_field to
    read write the register field without worrying about the masks or
    shifts.

    Also this apis will be useful for drivers which are based on regmaps,
    like some clocks or pinctrls which can work on the regmap_fields
    directly without having to worry about bit positions.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Mark Brown

    Srinivas Kandagatla
     

25 May, 2013

1 commit

  • regmap-mmio uses a spinlock with spin_lock() and spin_unlock() for locking.
    To be able to use the regmap API from different contexts (atomic vs non-atomic),
    without the risk of race conditions, we need to use spin_lock_irqsave() and
    spin_lock_irqrestore() instead. A new field, the spinlock_flags field, is added
    to regmap struct to store the flags between regmap_{,un}lock_spinlock(). The
    spinlock_flags field itself is also protected by the spinlock.

    Thanks to Stephen Warren for the suggestion of this particular solution.

    Signed-off-by: Lars-Peter Clausen
    Reviewed-by: Stephen Warren
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

12 May, 2013

1 commit


16 Apr, 2013

1 commit


30 Mar, 2013

2 commits

  • The idea of holding blocks of registers in device format is shared between
    at least rbtree and lzo cache formats so split out the loop that does the
    sync from the rbtree code so optimisations on it can be reused.

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

    Mark Brown
     
  • The idea of maintaining a bitmap of present registers is something that
    can usefully be used by other cache types that maintain blocks of cached
    registers so move the code out of the rbtree cache and into the generic
    regcache code.

    Refactor the interface slightly as we go to wrap the set bit and enlarge
    bitmap operations (since we never do one without the other) and make it
    more robust for reads of uncached registers by bounds checking before we
    look at the bitmap.

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

    Mark Brown
     

27 Mar, 2013

2 commits


04 Mar, 2013

1 commit

  • This file lists the register ranges in the register map. The condition
    to split the range is based on whether the block is readable or not.

    Ensure that we lock the `debugfs_off_cache' list whenever we access
    and modify the list. There is a possible race otherwise between the
    read() operations of the `registers' file and the `range' file.

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

    Dimitris Papastamos