Skip to contentSkip to conversation

ASoC: kirkwood: fix loss of external clock at probe time

PATCH Superseded Jean-Francois Moine 2 participants 2 messages Sep 19, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: kirkwood: fix loss of external clock at probe time

At probe time, when the clock driver is not yet initialized, the external clock of the kirkwood sound device will not be usable.

This patch fixes this problem defering the device probe.

---
 sound/soc/kirkwood/kirkwood-i2s.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/kirkwood/kirkwood-i2s.c +4 -1
index 0f3d73d..14f32d9 100644
@@ -496,7 +496,10 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 		return err;
 
 	priv->extclk = devm_clk_get(&pdev->dev, "extclk");
-	if (!IS_ERR(priv->extclk)) {
+	if (IS_ERR(priv->extclk)) {
+		if (np && of_property_match_string(np, "clock-names", "extclk") >= 0)
+			return -EPROBE_DEFER;
+	} else {
 		if (priv->extclk == priv->clk) {
 			devm_clk_put(&pdev->dev, priv->extclk);
 			priv->extclk = ERR_PTR(-EINVAL);
Signature · 6 lines
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

sound/soc/kirkwood/kirkwood-i2s.c static int kirkwood_i2s_dev_probe(struct platform_device *pdev) · line 502

Quoted 6 lines · Jean-Francois Moine
sound/soc/kirkwood/kirkwood-i2s.c +4 -1
 	priv->extclk = devm_clk_get(&pdev->dev, "extclk");
-	if (!IS_ERR(priv->extclk)) {
+	if (IS_ERR(priv->extclk)) {
+		if (np && of_property_match_string(np, "clock-names", "extclk") >= 0)
+			return -EPROBE_DEFER;
+	} else {

This one really does seem like something the clock API ought to be doing, either as standard or with a separate helper - essentially every driver ought to be doing this for robustness. Doing it on general failures is more tricky but in the specific case where we know the clock should be present but we don't have the driver loaded yet.