On 12/17/18 11:39 AM, Mark Brown wrote:
On Mon, Dec 17, 2018 at 09:03:33AM -0600, Pierre-Louis Bossart wrote:
I started prototyping a different approach where the codec driver passes the regmap information to the clock driver. What's missing in the patchset is the addition of a clock control in the machine driver, and logic added so that rateĀ change can only be done in a hw_params if there was a complete stop and reset on a DAPM_OFF event. compile-tested only for now. https://github.com/plbossart/sound/commits/hifiberry/clks
That looks a lot like the CODEC should be exporting a GPIO driver so the machine driver doesn't actually need the regmap? The only register touched is _GPIO_CONTROL_1.
I am not sure what you meant by 'exporting a GPIO driver' (mostly because I am not familiar with any GPIO framework) but indeed the local oscillator choice is controlled by a single register accessible through regmap - and changes to that register should only happen when the device is a specific state to prevent click/pops.
The machine driver should use clk_set_rate() and not directly handle regmap or codec stuff. If it does, or if the clock framework isn't relevant here then we can simplify all this as suggested in https://patchwork.kernel.org/patch/10444387/. What I was trying to do with the github update is to keep the clock framework, tie it closer with the codec parts with a state variable that prevents wild changes without going back to a 'safe' idle state (similar idea as PulseAudio clock changes, which can only happen when the PCM is not opened and used).