Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1538913 > unrolled thread

Re: [PATCH 2/3] ASoC: simple-card: use devm_get_clk_from_child()

Started byStephen Boyd <sboyd@codeaurora.org>
First post2016-12-08 23:10 +0100
Last post2016-12-09 01:30 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/3] ASoC: simple-card: use devm_get_clk_from_child() Stephen Boyd <sboyd@codeaurora.org> - 2016-12-08 23:10 +0100
    Re: [PATCH 2/3] ASoC: simple-card: use devm_get_clk_from_child() Stephen Boyd <sboyd@codeaurora.org> - 2016-12-09 01:30 +0100

#1538913 — Re: [PATCH 2/3] ASoC: simple-card: use devm_get_clk_from_child()

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-12-08 23:10 +0100
SubjectRe: [PATCH 2/3] ASoC: simple-card: use devm_get_clk_from_child()
Message-ID<sMf33-3iT-7@gated-at.bofh.it>
On 12/05, Kuninori Morimoto wrote:
> diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
> index cf02625..4924575 100644
> --- a/sound/soc/generic/simple-card-utils.c
> +++ b/sound/soc/generic/simple-card-utils.c
> @@ -98,7 +98,8 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
>  }
>  EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
>  
> -int asoc_simple_card_parse_clk(struct device_node *node,
> +int asoc_simple_card_parse_clk(struct device *dev,
> +			       struct device_node *node,
>  			       struct device_node *dai_of_node,
>  			       struct asoc_simple_dai *simple_dai)
>  {
> @@ -111,14 +112,13 @@ int asoc_simple_card_parse_clk(struct device_node *node,
>  	 *  or "system-clock-frequency = <xxx>"
>  	 *  or device's module clock.
>  	 */
> -	clk = of_clk_get(node, 0);
> +	clk = devm_get_clk_from_child(dev, node, NULL);
>  	if (!IS_ERR(clk)) {
>  		simple_dai->sysclk = clk_get_rate(clk);
> -		simple_dai->clk = clk;
>  	} else if (!of_property_read_u32(node, "system-clock-frequency", &val)) {
>  		simple_dai->sysclk = val;
>  	} else {
> -		clk = of_clk_get(dai_of_node, 0);
> +		clk = devm_get_clk_from_child(dev, dai_of_node, NULL);


I was confused for a minute about how the second of_clk_get()
call with the dai_link node could work. Is that documented
anywhere or used by anyone? It seems like it's at least another
child node of the sound node (which is dev here) so it seems ok.


>  		if (!IS_ERR(clk))
>  			simple_dai->sysclk = clk_get_rate(clk);
>  	}

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [next] | [standalone]


#1538976

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-12-09 01:30 +0100
Message-ID<sMhex-4yz-9@gated-at.bofh.it>
In reply to#1538913
On 12/09, Kuninori Morimoto wrote:
> 
> Hi Stephen
> 
> > > @@ -111,14 +112,13 @@ int asoc_simple_card_parse_clk(struct device_node *node,
> > >  	 *  or "system-clock-frequency = <xxx>"
> > >  	 *  or device's module clock.
> > >  	 */
> > > -	clk = of_clk_get(node, 0);
> > > +	clk = devm_get_clk_from_child(dev, node, NULL);
> > >  	if (!IS_ERR(clk)) {
> > >  		simple_dai->sysclk = clk_get_rate(clk);
> > > -		simple_dai->clk = clk;
> > >  	} else if (!of_property_read_u32(node, "system-clock-frequency", &val)) {
> > >  		simple_dai->sysclk = val;
> > >  	} else {
> > > -		clk = of_clk_get(dai_of_node, 0);
> > > +		clk = devm_get_clk_from_child(dev, dai_of_node, NULL);
> > 
> > 
> > I was confused for a minute about how the second of_clk_get()
> > call with the dai_link node could work. Is that documented
> > anywhere or used by anyone? It seems like it's at least another
> > child node of the sound node (which is dev here) so it seems ok.
> 
> Documentation/devicetree/bindings/sound/simple-card.txt
> explains 1st of_clk_get will be used as "if needed",
> 2nd of_clk_get will be used as "not needed pattern".
> 1st pattern will use specific clock, 2nd pattern will use
> "cpu" or "codec" clock.
> 2nd one was added by someone (I forgot), and many driver is
> based on this feature.
> 

Can you point to some dts file in the kernel that falls into the
devm_get_clk_from_child(dev, dai_of_node, NULL) part?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web