On Wed, Sep 04, 2013 at 19:34, Mark Brown wrote:
Personally I don't see the issue in having two I2C clients defined for the one chip, in the machine bindings. Logically it's absolutely correct for the chip, and as long as the I2C IDs for the devices make sense (which wasn't the case for DA9055, and is something I want to rectify), then it should be obvious to anyone who comes across that code. Actually having them as two separate entries in machine code helps to highlight that they are individual I2C devices in one package rather than somehow linked internally and requiring ordered initialisation. That seems right to me, and would tally with the associated datasheet for the device.
The goal is that users shouldn't even need to have to think about how the chip is constructed, they should just be able to use it with minimal thought or effort. Anything that can be encapsulated within the drivers should be.
I agree with your ideas and it's something that should be enforced, but only if it makes sense to the scenario. Taking away flexibility, functionality and logical correctness just to make things 'easier' seems a bit wrong. Also, there are many chip drivers which 'encapsulate' as you say, but they're not necessarily effortless to work with. I have spotted examples which require chunks of platform data to configure the device correctly, thus needing at least some understanding of the chip itself. But I wouldn't say that's wrong because it's needed to allow for complete usage of the device in question.
Bringing this back to DA9055 though, the current method of initialisation, for PMIC and Codec, isn't complicated or confusing nor does it require a lot of effort. As well as this the implementation is logically sound. It should remain that way in my opinion. The only thing that should be updated is the I2C Id of the Codec to make it more meaningful, and preferably sooner rather than later so the issue can be finally put to bed.