AnsweredAssumed Answered

PCM-952: How to enable audio clock from device tree?

Question asked by mpfgregory on Feb 1, 2016
Latest reply on Feb 3, 2016 by mpfgregory

I want to enable the SGTL5000 audio codec on my PCM-952 Vybrid board from the device tree. Here's the device tree entry (adapted from the vf610 tower board) that works fine:

 

sound {
   compatible = "simple-audio-card";
   simple-audio-card,format = "i2s";
   simple-audio-card,widgets =
   "Microphone", "Microphone Jack",
   "Headphone", "Headphone Jack",
   "Speaker", "Speaker Ext",
   "Line", "Line In Jack";
   simple-audio-card,routing =
   "MIC_IN", "Microphone Jack",
   "Microphone Jack", "Mic Bias",
   "LINE_IN", "Line In Jack",
   "Headphone Jack", "HP_OUT",
   "Speaker Ext", "LINE_OUT";

 

   simple-audio-card,cpu {
   sound-dai = <&sai2>;
   frame-master;
   bitclock-master;
   };

 

   simple-audio-card,codec {
   sound-dai = <&codec>;
   frame-master;
   bitclock-master;
   clocks = <&clks VF610_CLK_SAI2>;
   };
  

    };

 

However, this only works if I use the external codec oscillator by placing the jumper instead of VF610_CLK_SAI2. The codec is probed via I2C. On success the simple-audio-card is activated, which in turn enables the unused VF610_CLK_SAI2 clock. But if I want to use the VF610_CLK_SAI2 clock for the codec, I have some kind of hen and egg problem. In order to enable VF610_CLK_SAI2, the simple-audio-card must be enabled, which in turn depends on the codec. The codec however requires VF610_CLK_SAI2 as bitclock to run. So at system start I only get some codec probe deferrals, and audio doesn't work.

 

Is there a way to tell the device tree that the codec depends on VF610_CLK_SAI2 and that this clock must be enabled first?

Outcomes