[PATCH v1 2/2] ASoC: sgtl5000: Introduce "mclk-rate" Property for Device Tree Configuration
From: Prasad Kumpatla
Date: Mon Dec 16 2024 - 06:04:53 EST
Introduce the "mclk-rate" property, enabling the configuration of the
Master Clock (MCLK) via the device tree. The Codec Slave supports
a defined range of frequencies, and users can request the desired rate
from the Master, using `clk_set_rate()`. If the property is not specified,
the default MCLK frequency will be applied.
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@xxxxxxxxxxx>
---
sound/soc/codecs/sgtl5000.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 7aa89e34657e..7e134a3219c7 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1615,6 +1615,16 @@ static int sgtl5000_i2c_probe(struct i2c_client *client)
goto disable_regs;
}
+ if (!of_property_read_u32(np, "mclk-rate", &value)) {
+ if (value > 0) {
+ ret = clk_set_rate(sgtl5000->mclk, value);
+ if (ret) {
+ dev_err(&client->dev, "Failed to set mclock\n");
+ goto disable_regs;
+ }
+ }
+ }
+
ret = clk_prepare_enable(sgtl5000->mclk);
if (ret) {
dev_err(&client->dev, "Error enabling clock %d\n", ret);
--
2.17.1