[alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex

Lars-Peter Clausen lars at metafoo.de
Mon Jul 28 10:03:18 CEST 2014


On 07/28/2014 09:40 AM, Kuninori Morimoto wrote:
>
> Hi Lars
> # added Mark
>
>>> Hmm... rsnd driver is using "regmap_field".
>>> regmap-mmio  requests "offset"  on "reg"
>>> regmap-filed requests "address" on "reg"
>>>
>>> So, if rsnd driver uses regmap-mmio,
>>> then, it needs tricky initialize like...
>>>
>>>         regmap_init_mmio(dev, 0, config)
>>>
>>
>> Create one regmap instance per base address and in the regmap_fields use an
>> relative offset to the base address rather than the absolute address. That's
>> how the API is intended to be used, the current implementation is quite a hack.
>
> Hmm...
> But it (= base address mapping was not fixed between Gen1 and Gen2)
> was the reason why I was asked to use regmap_fields
>

I think that is fine. But you are only using a single regmap instance even 
though there are multiple unrelated register maps used and then you specify 
the offset in the regmap_fields as a absolute address. This is supposed to 
be a relative offset to the base address.

So basically use: ".reg = offset" instead of ".reg = (unsigned 
int)gen->base[reg_id] + offset" and when creating the field instead of 
passing a global regmap instance pass the regmap instance for the register 
map in who's range the register falls.


- Lars


More information about the Alsa-devel mailing list