lkml.org 
[lkml]   [2022]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 1/3] ASoC: rockchip: i2s: switch BCLK to GPIO
From
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);
>

\
 
 \ /
  Last update: 2022-06-23 11:17    [W:0.065 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site