On Thu, 19 Sep 2019 at 14:49, Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx> wrote: > > On 9/19/19 09:59, Krzysztof Kozlowski wrote: > > On Wed, Sep 18, 2019 at 12:46:27PM +0200, Sylwester Nawrocki wrote: > >> The WM1811/WM8994/WM8958 audio CODEC DT bindings specify two optional > >> clocks: "MCLK1", "MCLK2". Add code for getting those clocks in the MFD > >> part of the wm8994 driver so they can be further handled in the audio > >> CODEC part. > > > > I think these are needed only for the codec so how about getting them in > > codec's probe? > > The clocks are specified in the (I2C slave device) DT node which corresponds > to the device as a whole and to which binds the MFD driver. AFAICT those > clocks are only needed by the CODEC sub-driver but in general such clocks > could be used to provide device's system clock used by other functionalities > than audio. We are doing something similar for other MFD drivers already > and I would rather stick to one pattern. IMHO it's clearer to see what > device the clocks belong to that way. The existing pattern is not an excuse for doing some things in a uglier way... If we agree that these are codec-only resources, then they should be acquired by codec driver. This is one minor step to solve difficult inter-device dependencies which stops from reusing parts of the code (some child of MFD heavily depends on parent). Existing MFD drivers sometimes follow this pattern but that's wrong. They follow the ugly or even crappy pattern. Your codec driver still refers to parent and it has its resources, e.g. parent's device node pointer. Best regards, Krzysztof