On Wed, Jul 30, 2014 at 05:56:36PM -0400, jonsmirl@gmail.com wrote:
I'm working on a TI codec attached via I2C. Just to make things interesting the registers have varying byte lengths of - 1,4,8,12,20 bytes. What's the best strategy for using regmap with it?
I'd use the reg_read() and reg_write() callbacks to hide the registers that will fit in an integer, the rest of the stack can pretend they've got 32 bit values which should improve code reuse. The larger registers are going to need custom controls I expect but that's probably a given anyway, and if they're coefficeints they'll be fairly simple binary controls.
It should be possible to write a standard ASoC control type for binary blocks that can be written with a single I2C transfer...
Also, does regmap restore MMIO registers after a suspend? Allwinner has code in their drivers for drivers for saving/restoring the DAI registers over a suspend.
It can be used to do that, same as anything else you need to a cache sync. The Tegra audio drivers do this - that's why regmap-mmio was originally written.