From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A15CC433EF for ; Thu, 23 Jun 2022 09:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbiFWJP4 (ORCPT ); Thu, 23 Jun 2022 05:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiFWJPz (ORCPT ); Thu, 23 Jun 2022 05:15:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5126142EC4 for ; Thu, 23 Jun 2022 02:15:54 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 434D012FC; Thu, 23 Jun 2022 02:15:54 -0700 (PDT) Received: from [10.57.85.4] (unknown [10.57.85.4]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 63DC93F792; Thu, 23 Jun 2022 02:15:52 -0700 (PDT) Message-ID: <4bec03b5-c496-ec0d-b968-d4d0e5d2e782@arm.com> Date: Thu, 23 Jun 2022 10:15:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v5 1/3] ASoC: rockchip: i2s: switch BCLK to GPIO Content-Language: en-GB To: Judy Hsiao , Heiko Stuebner Cc: Liam Girdwood , Rob Herring , Brian Norris , Mark Brown , Jaroslav Kysela , Chen-Yu Tsai , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: <20220623021153.587423-1-judyhsiao@chromium.org> <20220623021153.587423-2-judyhsiao@chromium.org> From: Robin Murphy In-Reply-To: <20220623021153.587423-2-judyhsiao@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); >