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?
Solved! Go to Solution.
Hi,
On different Vybrid hardware, we have been able to use the internal clock to drive the audio codec. This involves changing the clock parent of SAI2 to PLL4. Please see the attached patch for the relevant changes to the device tree and clock source. This patch should apply cleanly to the 3.13 pcm052 kernel source.
Thanks,
Timesys Support
Hi,
On different Vybrid hardware, we have been able to use the internal clock to drive the audio codec. This involves changing the clock parent of SAI2 to PLL4. Please see the attached patch for the relevant changes to the device tree and clock source. This patch should apply cleanly to the 3.13 pcm052 kernel source.
Thanks,
Timesys Support
Thanks, this works. On the PCM-952 you also need to route the SAI2 clock to PTB11. First you have to enable CKO2 in the CCM_CCOSR register. Unfortunately there is no device tree binding for this register. Currently I do this in u-boot using the physical address of CCM_CCOSR. Maybe a device tree binding should be officially added?
Then you have to set-up PTB11 for CKO2. This needs to be done before the codec is probed. I have added :
VF610_PAD_PTB11__CKO2 | 0x02ee |
to the i2c pinctrl. With this configuration it works. Thanks for the support!
timesyssupport can you help to review this case?