[alsa-devel] [PATCH v4] ASoC: simple-card: add Device Tree support

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu Nov 21 01:12:13 CET 2013

Hi Mark Rutland

> > --------------------
> > So, ideally.  However we have to consider the fact that the clock API
> > isn't reliably available makes this harder than it should be.  Even
> > among the DT using platforms at least PowerPC still uses a custom clock
> > API.  We could just use this as a carrot to push people to convert
> > though.
> > ---------------------
> I would be happier if we could unify the common clock infrastructure, it
> would make this kind of thing a lot lessy messy. However, I'm not
> against the system-clock-frequency property for now.

Thank you

> > OK, sorry for my English
> Sorry for the confusion, I'll try to be less ambiguous in future :)
> What I was trying to get at here is that if there is neither a clock or
> a system-clock-frequency property in the device tree, dai->sysclk will
> not have been initialised in this path. Is this a valid case, and will
> dai->sysclk have a well-defined, sane value?

My understanding, this "dai" itself is created by devm_kzalloc()
So, default dai->sysclk is 0.
And, if there is no clocks, no system-clock-frequency property,
it try of_property_read_u32() side. but it will do nothing to dai->sysclk
in such case. so dai->sysclk is still 0, and it is very sane on this driver.
Is this good answer ?

+	clk = of_clk_get(np, 0);
+	if (IS_ERR(clk))
+		of_property_read_u32(np,
+				     "system-clock-frequency",
+				     &dai->sysclk);
+	else
+		dai->sysclk = clk_get_rate(clk);

Best regards
Kuninori Morimoto

More information about the Alsa-devel mailing list