[alsa-devel] [PATCH v6] ASoC: add RT286 CODEC driver

Lars-Peter Clausen lars at metafoo.de
Wed May 7 20:21:02 CEST 2014

On 05/07/2014 08:07 PM, Mark Brown wrote:
> On Wed, May 07, 2014 at 07:46:09PM +0200, Lars-Peter Clausen wrote:
>> I don't think virtual controls are the right approach here. Virtual controls
>> are for controls where the state is completely in software, but here the
>> state is still in hardware. It's just that there is no uniform hardware map.
>> But there is still some structure. So you'd have controls with custom put
>> and get handlers and for DAPM widgets use the event handler.
> What you just described is what I'd consider a virtual control - I don't
> consider the fact that the put callbacks end up writing to the hardware
> particularly substantial, as far as the framework is concerned some
> driver specific thing goes off and does something but it could be
> setting a variable just as well as writing to hardware.

Ok, but we have controls that have virtual in their name, so I think it 
should be made clear that you are not talking about those.

>> But I still think that the best and easiest solution is to have custom
>> regmap read/write function that do the translation of logical registers to
>> physical read/write operations.
> That's the first time this idea has been mentioned that I recall.  I
> have to say I'm really not keen on pushing non-physical registers
> through regmap, all the drivers that have done that previously have
> ended up causing problems though if the registers were *all* fake then
> there would be less issue (most of the issues have been due to having
> extra registers that don't really exist).  It does still feel like it's
> a layering problem though.

I think the drivers you are thinking of are those which had physical 
register which were backed by hardware and virtual register which were 
backed by software. For the later we introduced the virtual controls, so 
that such hacks are no longer necessary in driver. But in the case of the 
RT286 all the register all still backed by hardware except that the way they 
are accessed is not very uniform (different types of registers use a 
different message format, there is a asymmetry between reading and writing 
the same data). In a sense this is similar to devices which have registers 
with different sizes, we also support these with custom regmap callbacks.

- Lars

More information about the Alsa-devel mailing list