Re: [PATCH v5 1/3] ASoC: rockchip: i2s: switch BCLK to GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-06-23 03:11, Judy Hsiao wrote:
[...]
@@ -736,6 +799,20 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
  	}
i2s->bclk_ratio = 64;
+	i2s->pinctrl = devm_pinctrl_get(&pdev->dev);
+	if (IS_ERR(i2s->pinctrl)) {
+		dev_err(&pdev->dev, "failed to find i2s pinctrl\n");

If we're still reworking this, it might be good to set i2s->pinctrl to NULL here, and similarly free and clear if we fail to get the states in the other path, so that everywhere else could consistently have just a simple "if (i2s->pinctrl)" check rather than the "IS_ERR() || IS_ERR_OR_NULL()" mess.

+	} else { > +		i2s->bclk_on = pinctrl_lookup_state(i2s->pinctrl, "bclk_on");
+		if (!IS_ERR_OR_NULL(i2s->bclk_on)) {
+			i2s->bclk_off = pinctrl_lookup_state(i2s->pinctrl, "bclk_off");
+			if (IS_ERR_OR_NULL(i2s->bclk_off)) {
+				dev_err(&pdev->dev, "failed to find i2s bclk_off\n");
+				goto err_clk;
+			}
+		}
+		i2s_pinctrl_select_bclk_off(i2s);

FWIW it seems a bit odd to call this in the case where we didn't even get "bclk_on".

Robin.

+	}
dev_set_drvdata(&pdev->dev, i2s);



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux