diff mbox series

[v1,2/2] ASoC: sgtl5000: Introduce "mclk-rate" Property for Device Tree Configuration

Message ID 20241216110341.3707-3-quic_pkumpatl@quicinc.com (mailing list archive)
State New
Headers show
Series ASoC: sgtl5000: Introduce "mclk-rate" Property for Device Tree Configuration | expand

Commit Message

Prasad Kumpatla Dec. 16, 2024, 11:03 a.m. UTC
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@quicinc.com>
---
 sound/soc/codecs/sgtl5000.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Krzysztof Kozlowski Dec. 16, 2024, 11:21 a.m. UTC | #1
On 16/12/2024 12:03, Prasad Kumpatla wrote:
> 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@quicinc.com>
> ---
>  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)) {

No, NAK, you just reimplemented legacy clock-frequency property
duplicating existing assigned-clocks properties.

Best regards,
Krzysztof
diff mbox series

Patch

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);