On Mon, Sep 29, 2008 at 10:58:43AM -0700, Troy Kisky wrote:
Mark Brown wrote:
Neither is board specific - there's no sense in having each board that needs SPI support replicate the code to register a SPI device and do the marshalling of data for SPI writes. What motivation do you see for not doing that?
It just doesn't seem to be logically a part of the codec code. And I didn't register
The data marshalling is a function of the codec hardware - whatever it has been hooked up to the register address and data values written are going to need to be in a given format when they hit the codec. The SPI and I2C APIs abstract away the details of the actual controller from the codec driver.
an spi device. I just linked the simple spi routines with my board code (separate file).
I'm not sure which simple SPI API you're referring to here? In any case, ASoC is shortly going to pretty much require a struct device for the codec so it will be required to have a device of some kind registered.
Plus, it seems a lot of code duplication if each codec registers the spi device and I2C device. Are there more boards, or more codecs???
In the device model the board registers the *device*, the codec (or whatever) driver registers the *driver* - the two are separated. The driver core then instantiates the drivers based on what the board specifies. There's not really any overlap between the two areas that I can see.
Otherwise could you explain in more detail where you see the code duplication coming from?