Re: [PATCH] leds: tlc591xx: SW reset during initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jan,

On 08/28/2018 04:02 PM, Jan Kundrát wrote:
> On sobota 25. srpna 2018 18:11:17 CEST, Andrew Lunn wrote:
>>> Explicitely initializing all registers sounds reasonable. Should work
>>> even on unusual i2c designs.
>>
>> And it is not so hard to do. There are 30 writable registers on the 16
>> LED variant. But a lot of them are identical, one per LED.
> 
> I looked at regmap, and I am confused by its regmap_defaults and the
> notion of a cache. I would like to just add some default values and let
> the regmap infrastructure copy them into the device for me.

I'm not a regmap expert, but have looked into its internals several
times and this is how I understand it:

- the purpose of regmap cache is to minimize the I2C traffic on the bus
- this is especially vital in case of regmap_update_bits(), which
  without the cache would incur an additional I2C readout to get the
  current register state
- of course it also allows to avoid redundant register updates, that
  wouldn't change its state

Regarding reg_defaults the doc says:

 * @reg_defaults: Power on reset values for registers (for use with
 *                register cache support).

In your case you'd need to initialize this array with the register
values you want, and then call regcache_sync().

> 
> - Is this supported by the regmap core?
> 
> - Do I need to enable some regmap cache for this? (Probably a flat one.)

Right, REGCACHE_FLAT is reasonable choice in case of relatively small
amount of registers.

> - Are there some side effects of the regmap cache?

A little bit greater memory usage, and time overhead due to
the need for finding relevant cache entry. This can be however
alleviated by using rbtree cache. I haven't looked at what
REGCACHE_COMPRESSED offers.

> I'm asking because the documentation in the .h files does not answer
> these questions for me.

Analysis of drivers/base/regmap directory contents allows to gain more
understanding in this matter.

-- 
Best regards,
Jacek Anaszewski



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux