Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp563726iol; Thu, 9 Jun 2022 09:08:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/k7UZV1D5LqbU3lDX3h5MtstO4UQQhSVRxdtyiBtJrVSBlpvQv7EqB1aGTz6vL7fS5pB2 X-Received: by 2002:a17:90a:7606:b0:1e8:9e2a:d87c with SMTP id s6-20020a17090a760600b001e89e2ad87cmr4142581pjk.226.1654790904156; Thu, 09 Jun 2022 09:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654790904; cv=none; d=google.com; s=arc-20160816; b=xsPZwEaVHa1DJNgzPgfIr3qDprBwpMNVswn++nF1LFSzQk20idItIjwnWeS8lx6bUn V9y7y94CvHkc5mGyFCBJNYBlE74pi7P12RtgqJNGHRMeRKWkTzXlcyUMTg1iX5zfSuNf VnJxJr+eSMlrgjUtMSuv/XeWBytIwmevcCsq4ppTelW1PpVqfv7+/KNZaWzGn+49MDR7 5tk+5P7gyGY3qXtdAUv9xCNsrwgc9CQXrXkZ7A/GwkABTiXJ6lFcU8AUtNcdWxLRJKm8 7Ng3SjCUQR94ob9BDG7HZ27L0VE/GQkHmamzh7vmEb4DoKFcd9qkYgMishx6i3cMiqr8 IkEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=nRs8YO1qIIDLEzaosgIcZbcP3+4vL5dSkswqIKbz30s=; b=zaA40s8t0dvTEXKHJm/qWnqO54IU2bCZx+8efc61br8vmC8Y4MNJGS5TEobgqAc+0x UxBdxDrD2HaR1uiCQGDEif7KDpwXW53i2YBmujNGNucbGjXWFUXMDcON8J3PfmFSJrOF EEI/IYG/h3I92s5reGgkIuhoSIX8IGiEUpPVbYVi/jJiO2I9WkoqIj2wEBNi5a11zsAw Rs33PGa4TE5bVjCLjML8niQ71ZlEG/t+8xBCvqFKtt4dmLTsArJMpjDd2zMCbITdPejh Q2WA0zkbL0PDL2UrjdL02buta04spJDV+ff/ICa6xJGemQtYzyUjq55lLndgNHVNPhQy doaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VeUiBiKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l190-20020a6388c7000000b003fc66830014si32969693pgd.795.2022.06.09.09.07.50; Thu, 09 Jun 2022 09:08:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VeUiBiKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344443AbiFIPXk (ORCPT + 99 others); Thu, 9 Jun 2022 11:23:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344489AbiFIPXa (ORCPT ); Thu, 9 Jun 2022 11:23:30 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869F5B18; Thu, 9 Jun 2022 08:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654788208; x=1686324208; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=OqFF6qDwLOh06Q07Wxi7YuzZhtAUWXJ5RHWWW3Dj/IY=; b=VeUiBiKw+Eaxyb83yq9NpxMX1jKSB5jl+LTcZSlT4+U7fnss6cr7aivv DxG0fUpDg0Zs9sRb+ZGdLVnJgr1VRWxbr4lLkuoQHMVaL8AIRnSx3Sz7d BYpfM+phMKhY3gTldLAmsTJIl+f2vaz96NiI6GZhwlgNm8ME9rYn+/HAA DiEcdKNJZpACESyJWmvVbBPd5qn47oGHP2iojYvZAuoU5Ibg3dB91m3ZC WeYBSLh/2Azl+RNXcZbezgpRRIg8He7Rm1tQUYqyIS25jz1QZaLMSuXE4 u+EbH3Vv7Jm9GZQHgpr6/1vq4BiUBWi1K0f0iZCId9vv8BVPEXNrfTsXW w==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="257747930" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="257747930" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 08:23:28 -0700 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="585630710" Received: from jeremywe-mobl3.amr.corp.intel.com (HELO [10.209.173.145]) ([10.209.173.145]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 08:23:26 -0700 Message-ID: <97757ee1-2525-4e97-855e-da6fb66f01ae@linux.intel.com> Date: Thu, 9 Jun 2022 10:22:35 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.9.1 Subject: Re: [PATCH v4 1/2] soundwire: qcom: Add flag for software clock gating check Content-Language: en-US To: Srinivasa Rao Mandadapu , agross@kernel.org, bjorn.andersson@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, quic_plai@quicinc.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, srinivas.kandagatla@linaro.org, quic_rohkumar@quicinc.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, swboyd@chromium.org, judyhsiao@chromium.org, vkoul@kernel.org References: <1654785023-1667-1-git-send-email-quic_srivasam@quicinc.com> <1654785023-1667-2-git-send-email-quic_srivasam@quicinc.com> From: Pierre-Louis Bossart In-Reply-To: <1654785023-1667-2-git-send-email-quic_srivasam@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/9/22 09:30, Srinivasa Rao Mandadapu wrote: > Validate software clock gating required or not and do software > clock gating on hclk if soundwire is operational and keep it > running by adding flag in private data structure. > This is to avoid conflict between older architectures, > where software clock gating is not required and on latest > architectues, where software clock gating is mandatory. architectures. > > Signed-off-by: Srinivasa Rao Mandadapu > Reviewed-by: Srinivas Kandagatla > --- > drivers/soundwire/qcom.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c > index a3fccf0..8e163da 100644 > --- a/drivers/soundwire/qcom.c > +++ b/drivers/soundwire/qcom.c > @@ -181,6 +181,7 @@ struct qcom_swrm_ctrl { > struct qcom_swrm_data { > u32 default_cols; > u32 default_rows; > + bool sw_clk_gate_required; > }; > > static const struct qcom_swrm_data swrm_v1_3_data = { > @@ -1311,6 +1312,15 @@ static int qcom_swrm_probe(struct platform_device *pdev) > return PTR_ERR(ctrl->mmio); > } > > + if (data->sw_clk_gate_required) { > + ctrl->audio_cgcr = devm_reset_control_get_exclusive(dev, "swr_audio_cgcr"); > + if (IS_ERR(ctrl->audio_cgcr)) { You need to handle the NULL case, devm_reset_control_get_exclusive() can return ERR_OR_NULL https://elixir.bootlin.com/linux/latest/source/drivers/reset/core.c#L1045 > + dev_err(dev, "Failed to get cgcr reset ctrl required for SW gating\n"); > + ret = PTR_ERR(ctrl->audio_cgcr); > + goto err_init; > + } > + } > + > ctrl->irq = of_irq_get(dev->of_node, 0); > if (ctrl->irq < 0) { > ret = ctrl->irq; > @@ -1336,10 +1346,6 @@ static int qcom_swrm_probe(struct platform_device *pdev) > ctrl->bus.compute_params = &qcom_swrm_compute_params; > ctrl->bus.clk_stop_timeout = 300; > > - ctrl->audio_cgcr = devm_reset_control_get_exclusive(dev, "swr_audio_cgcr"); > - if (IS_ERR(ctrl->audio_cgcr)) > - dev_err(dev, "Failed to get audio_cgcr reset required for soundwire-v1.6.0\n"); > - > ret = qcom_swrm_get_port_config(ctrl); > if (ret) > goto err_clk;