summaryrefslogtreecommitdiff
path: root/sound/soc/rockchip/rockchip_sai.c
AgeCommit message (Collapse)AuthorFilesLines
2025-07-04ASoC: codec: rockchip_sai: Remove including of_gpio.hPeng Fan1-1/+0
of_gpio.h is deprecated. And there is no user in this driver using API in of_gpio.h, so remove it. Signed-off-by: Peng Fan <peng.fan@nxp.com> Acked-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20250704130906.1207134-1-peng.fan@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-09ASOC: rockchip: Use helper function devm_clk_get_enabled()Pei Xiao1-25/+10
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enables the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn> Acked-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Tested-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/84bc40641d05596f1edf4f01d1e6aea16bdbeeb5.1749201126.git.xiaopei01@kylinos.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-09ASOC: rockchip: fix capture stream handling in rockchip_sai_xfer_stopPei Xiao1-13/+3
Correcting the capture stream handling which was incorrectly setting playback=true for capture streams. The original code mistakenly set playback=true for capture streams, causing incorrect behavior. Fixes: cc78d1eaabad ("ASoC: rockchip: add Serial Audio Interface (SAI) driver") Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn> Tested-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Acked-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/c374aae92c177aaf42c0f1371eccdbc7e9615786.1749201126.git.xiaopei01@kylinos.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-22ASoC: rockchip: add Serial Audio Interface (SAI) driverNicolas Frattaroli1-0/+1555
The Rockchip RK3576 SoC features a new audio controller, the Serial Audio Interface, or SAI for short. It is capable of both sending and receiving audio over up to 4 lanes for each direction using the I2S, PCM or TDM formats. This driver is derived from the downstream vendor driver. That is why its original author, Sugar Zhang, is listed as a Co-developer, with their signoff. Since adjustments to make the driver suitable for upstream were quite extensive, I've added myself to the authors and put myself as the commit author; all added bugs are my fault alone, and not that of the original author at Rockchip. The hardware is somewhat similar to the Rockchip I2S-TDM hardware when judged based on their register map, except it uses the same mclk for tx and rx. It appears to be much more flexible with regards to TDM. The loopback stuff and mono mode are new as well. In line with the changes that were made to the Rockchip I2S-TDM driver after upstreaming, the mclk-calibrate functionality was dropped, and setting the mclk rate properly is now left up to the Common Clock Framework, similar to how it is in the upstream I2S-TDM driver now. A spinlock has been introduced to protect register write accesses that depend on the bclk/fs to be stopped, i.e. XFER[1:0] being 0. I couldn't find whether the asoc core held a per-instance lock so only one callback can run at a time, and so it seemed prudent to add this. I couldn't successfully test whether TDM was working, though I've tried with a TAS6424 codec board. I'm not sure yet whether to blame the codec driver, this version of the SAI driver, or the vendor implementation of the SAI driver. The TDM mask registers remain untouched in both this version and the downstream vendor version, which is suspicious, though the Linux ASoC core wouldn't be able to support the 128 (!!!) slots of TDM the hardware supports anyway. Regular old 2-channel stereo I2S thrown at an I2S stereo codec works well though. I tested with the CPU-side SAI controller in provider mode and an Everest ES8388 codec as the consumer. Some vendor driver features (no-dmaengine, fifo rockchip performance monitoring, many kcontrols) were dropped for this initial upstream version. They can always be added later if they make sense for upstream. Co-developed-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20250410-rk3576-sai-v2-6-c64608346be3@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>