On Wed, Oct 7, 2009 at 06:19, Mark Brown wrote:
On Wed, Oct 07, 2009 at 04:32:06AM -0400, Mike Frysinger wrote:
hmm, that's certainly true. if we look at it as "screwed either way", then going to a generic bus indirection sounds like it'd only add runtime overhead for no real gain ?
I was mostly thinking ifdefs here - we'll always need some bus-specific stuff in the drivers to register them. It's not pretty but it meets the needs of people doing randconfig builds.
We already have as much bus indirection as ASoC needs, and there is actually already some bus access code sharing there as of 2.6.32 (in soc-cache.c) but it's optional and always will be since we need to cater for devices that are parts of MFDs which have device specific register acceses.
in the face of this proposed effort being a ways off, doesnt it make sense to still merge the original proposed patch ?
The ifdefery isn't technically hard to do and given your use case where you don't know which controller is in use it looks like the only way to go for this.
i dont think the soc-cache could be used currently by the ad1836 as it doesnt use a 7/9 split with the address/data. it uses like 6/10 (4 addr bits, one bit for read/write, one bit is always 0, and 10 data bits). guessing the write bit can be considered part of the addr as the read always comes from the cache, but that still gives us 5/10 split. maybe a new 6/10 set of funcs should be added ...
snd_soc_7_9_write() looks like it does a little more bit work than it needs to ? if data is declared as a u16, then you have: u16 data = (reg << 9) | (value & 0x01ff); this is what the ad1836 driver does now for its data split.
in the mean time, rather than adding #ifdef to the codec driver, we could create a local header like "bus-stubs.h" that stubs all the relevant functions to an error value. then all codec drivers that dont use soc-cache can use that instead and the only change needed is to add: #include "bus-stubs.h" -mike