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

Robin Murphy robin.murphy at arm.com
Thu Jun 23 02:15:48 PDT 2022


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);
>   



More information about the linux-arm-kernel mailing list