diff mbox

ASoC: Atmel: ClassD: Set GCK's parent clock

Message ID 1447903590-3285-1-git-send-email-songjun.wu@atmel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Songjun Wu Nov. 19, 2015, 3:26 a.m. UTC
Set GCK's parent clock as audio clock, make
sure the GCK's parent clock is audio clock.

Signed-off-by: Songjun Wu <songjun.wu@atmel.com>
---

 sound/soc/atmel/atmel-classd.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mark Brown Nov. 20, 2015, 6:08 p.m. UTC | #1
On Thu, Nov 19, 2015 at 11:26:30AM +0800, Songjun Wu wrote:
> Set GCK's parent clock as audio clock, make
> sure the GCK's parent clock is audio clock.

> +	ret = clk_set_parent(dd->gclk, dd->aclk);
> +	if (ret) {
> +		dev_err(dev, "failed to set GCK parent clock: %d\n", ret);
> +		return ret;
> +	}

Why are we doing this in the driver?  This should be done by whatever
creates the clock tree, not by the driver that uses the clocks - that
way if some future SoC has a different clock tree the driver will
continue to work.
Songjun Wu Nov. 23, 2015, 3:01 a.m. UTC | #2
On 11/21/2015 02:08, Mark Brown wrote:
> On Thu, Nov 19, 2015 at 11:26:30AM +0800, Songjun Wu wrote:
>> Set GCK's parent clock as audio clock, make
>> sure the GCK's parent clock is audio clock.
>
>> +	ret = clk_set_parent(dd->gclk, dd->aclk);
>> +	if (ret) {
>> +		dev_err(dev, "failed to set GCK parent clock: %d\n", ret);
>> +		return ret;
>> +	}
>
> Why are we doing this in the driver?  This should be done by whatever
> creates the clock tree, not by the driver that uses the clocks - that
> way if some future SoC has a different clock tree the driver will
> continue to work.
>

You are right. The GCK's parent clock should be assigned in device tree, 
not in the driver. The DT binding for classD should be modified to set 
the GCK's parent clock as audio clock.
Thank you.
diff mbox

Patch

diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index 8276675..2f5190b 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -588,6 +588,12 @@  static int atmel_classd_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	ret = clk_set_parent(dd->gclk, dd->aclk);
+	if (ret) {
+		dev_err(dev, "failed to set GCK parent clock: %d\n", ret);
+		return ret;
+	}
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
 		dev_err(dev, "no memory resource\n");