1. 22 3月, 2013 1 次提交
    • S
      regmap: don't corrupt work buffer in _regmap_raw_write() · bc8ce4af
      Stephen Warren 提交于
      _regmap_raw_write() contains code to call regcache_write() to write
      values to the cache. That code calls memcpy() to copy the value data to
      the start of the work_buf. However, at least when _regmap_raw_write() is
      called from _regmap_bus_raw_write(), the value data is in the work_buf,
      and this memcpy() operation may over-write part of that value data,
      depending on the value of reg_bytes + pad_bytes. At least when using
      reg_bytes==1 and pad_bytes==0, corruption of the value data does occur.
      
      To solve this, remove the memcpy() operation, and modify the subsequent
      .parse_val() call to parse the original value buffer directly.
      
      At least in the case of 8-bit register address and 16-bit values, and
      writes of single registers at a time, this memcpy-then-parse combination
      used to cancel each-other out; for a work-buffer containing xx 89 03,
      the memcpy changed it to 89 03 03, and the parse_val changed it back to
      89 89 03, thus leaving the value uncorrupted. This appears completely
      accidental though. Since commit 8a819ff8 "regmap: core: Split out in
      place value parsing", .parse_val only returns the parsed value, and does
      not modify the buffer, and hence does not (accidentally) undo the
      corruption caused by memcpy(). This caused bogus values to get written
      to HW, thus preventing e.g. audio playback on systems with a WM8903
      CODEC. This patch fixes that.
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      bc8ce4af
  2. 13 3月, 2013 1 次提交
  3. 05 2月, 2013 1 次提交
  4. 04 2月, 2013 2 次提交
    • A
      regmap: Export regmap_async_complete_cb · f804fb56
      Axel Lin 提交于
      This fixes below build error when CONFIG_REGMAP=y && CONFIG_REGMAP_SPI=m
      
      ERROR: "regmap_async_complete_cb" [drivers/base/regmap/regmap-spi.ko] undefined!
      make[1]: *** [__modpost] Error 1
      make: *** [modules] Error 2
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      f804fb56
    • S
      regmap: include linux/sched.h to fix build · 30b2a553
      Stephen Warren 提交于
      This fixes:
      
      drivers/base/regmap/regmap.c: In function 'regmap_async_complete_cb':
      drivers/base/regmap/regmap.c:1656:3: error: 'TASK_NORMAL' undeclared (first use in this function)
      drivers/base/regmap/regmap.c:1656:3: note: each undeclared identifier is reported only once for each function it appears in
      drivers/base/regmap/regmap.c: In function 'regmap_async_complete':
      drivers/base/regmap/regmap.c:1688:2: error: 'TASK_UNINTERRUPTIBLE' undeclared (first use in this function)
      drivers/base/regmap/regmap.c:1688:2: error: implicit declaration of function 'schedule'
      
      An alternative might be to adjust linux/wait.h to include linux/sched.h,
      but since that hasn't been done before, I assume we're consciously
      avoiding doing that.
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      30b2a553
  5. 29 1月, 2013 2 次提交
  6. 22 1月, 2013 1 次提交
  7. 14 1月, 2013 2 次提交
  8. 12 1月, 2013 1 次提交
  9. 21 11月, 2012 1 次提交
  10. 30 10月, 2012 1 次提交
  11. 26 10月, 2012 1 次提交
  12. 17 10月, 2012 1 次提交
  13. 15 10月, 2012 8 次提交
  14. 04 8月, 2012 1 次提交
  15. 06 7月, 2012 1 次提交
  16. 19 6月, 2012 1 次提交
  17. 18 6月, 2012 2 次提交
  18. 08 6月, 2012 1 次提交
  19. 03 6月, 2012 3 次提交
  20. 09 5月, 2012 2 次提交
    • L
      regmap: fix possible memory corruption in regmap_bulk_read() · 6560ffd1
      Laxman Dewangan 提交于
      The function regmap_bulk_read() calls the regmap_read() for
      each register if set of register has volatile and cache is
      enabled. In this case, last few register read makes the memory
      corruption if the register size is not the size of unsigned int.
      The regam_read() takes argument as unsigned int for returning
      value and it update the value as
      	*val = map->format.parse_val(map->work_buf);
      This causes complete 4 bytes (size of unsigned int) to get written.
      Now if client pass the memory pointer for value which is equal to the
      required size of register count in regmap_bulk_read() then last few
      register read actually update the memory beyond passed pointer size.
      
      Avoid this by using local variable for read and then do memcpy()
      for actual byte copy to passed pointer based on register size.
      
      I allocated one pointer ptr and take first 16 bytes dump of that
      pointer then call regmap_bulk_read() with pointer which is just
      on top of this allocated pointer and register count of 128. Here
      register size is 1 byte.
      The memory trace of last 5 register read are as follows:
      
      [    5.438589] regmap_bulk_read after regamp_read() for register 122
      [    5.447421] 0xef993c20 0xef993c00 0x00000000 0x00000001
      [    5.467535] regmap_bulk_read after regamp_read() for register 123
      [    5.476374] 0xef993c20 0xef993c00 0x00000000 0x00000001
      [    5.496425] regmap_bulk_read after regamp_read() for register 124
      [    5.505260] 0xef993c20 0xef993c00 0x00000000 0x00000001
      [    5.525372] regmap_bulk_read after regamp_read() for register 125
      [    5.534205] 0xef993c00 0xef993c00 0x00000000 0x00000001
      [    5.554258] regmap_bulk_read after regamp_read() for register 126
      [    5.563100] 0xef990000 0xef993c00 0x00000000 0x00000001
      [    5.554258] regmap_bulk_read after regamp_read() for register 127
      [    5.587108] 0xef000000 0xef993c00 0x00000000 0x00000001
      
      Here it is observed that the memory content at first word started changing
      on last 3 regmap_read() and so corruption happened.
      Signed-off-by: NLaxman Dewangan <ldewangan@nvidia.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      6560ffd1
    • M
      regmap: Implement dev_get_regmap() · 72b39f6f
      Mark Brown 提交于
      Use devres to implement dev_get_regmap(). This should mean that in almost
      all cases devices wishing to take advantage of framework features based on
      regmap shouldn't need to explicitly pass the regmap into the framework.
      This simplifies device setup a bit.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      72b39f6f
  21. 01 5月, 2012 3 次提交
  22. 13 4月, 2012 3 次提交