Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2188684iof; Tue, 7 Jun 2022 22:37:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE+HMbM7YDKH7E10RZpn9oNNbHHf62XGAhJLM/7ErxUBNfaJIRmFKYskr4UNRAWl/0K1fQ X-Received: by 2002:a17:902:7205:b0:165:1717:1a4c with SMTP id ba5-20020a170902720500b0016517171a4cmr32170842plb.69.1654666630779; Tue, 07 Jun 2022 22:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666630; cv=none; d=google.com; s=arc-20160816; b=vI4o3U+zgaupnPciYzvrkeQCBGpJFja0I6gw5kiZjpjTQpZZ+MsPLNDLQf2bHQhYGv DUPR2KUG/t7Yy96v/JkjnIXpbYKoCdfPSx6QDrYshS1AOXWYP3ecb1Cj9v025nPnJac4 NG88uJyZIqx44eKFYwROJYURlQ5bW+ohe83tPRvUBWPa8I60YMZk8XR9j+f3BrTbSioR CzHvyDJA435Z5//UyWF3OdWdkYijuhNHesAFUn+oAQYracMU2u1Padw/kRm7BG2/U8a2 lr3/lxDmqbLKf8c2bTdnIG7XkCX0cDa/09wRcZHX1mtN17jkN7QRHTXYM/qwjQOv9KXp zDSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fYpPCX6VZdvNlaz5PU1EmmzGezp4ojXcHXRAL2naybc=; b=iOsn7Kh3vtd8j2in51apjSsRLHUeoGoOuHwxjNWrGW9mfD+zxffSgjdMhxBIZmJPx8 sIHCsaw47eH855jQfoopJ9DH/phzTMKvZu2xzmK58CgeSBzCOrlO22KGEoS0qKmHk844 m6856rdWsICR2cyczgdUam5jPgCzGqBRqH/jvB87Iyh6fYuYucgchc5kTnXWeExmUs6V cl21aT8GVKPLRoMkJHiMUUB4smH+6Awy/miVlXuTKjTmhs61Hv08lWqc3E4FHLynkNZB CaAiUgqF062yBgTSB2sV9ZHEHc1D440uiAoO4u3tU0o+QSAFpmnAPloZYZmDaPedfqTJ tz6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=WAdtr08V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w185-20020a6382c2000000b003fe3d4af87asi382126pgd.655.2022.06.07.22.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:37:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=WAdtr08V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78FF02D2513; Tue, 7 Jun 2022 22:03:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243865AbiFGMgV (ORCPT + 99 others); Tue, 7 Jun 2022 08:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243856AbiFGMgO (ORCPT ); Tue, 7 Jun 2022 08:36:14 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26671C4EB9; Tue, 7 Jun 2022 05:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1654605372; x=1686141372; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=fYpPCX6VZdvNlaz5PU1EmmzGezp4ojXcHXRAL2naybc=; b=WAdtr08VdHF0FaoCNYSI3IjbIWdRE0OWKShlPAGcCv6s9+LD0IOTMQGe /WHZTnK/nb4EjByDLNHFQ8HhHRFLvtEwKVswmKdw80OTqSIjEXobgrC9f a/Yk4LGkurTYgvGK7OjYIPjbT4TYADnq8AbFqxu6v2a2XlerKWuJnoR7h s=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 07 Jun 2022 05:36:12 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 05:36:11 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 7 Jun 2022 05:36:10 -0700 Received: from hu-srivasam-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 7 Jun 2022 05:36:04 -0700 From: Srinivasa Rao Mandadapu To: , , , , , , , , , , , , , , , , , CC: Srinivasa Rao Mandadapu Subject: [PATCH 2/2] ASoC: qcom: soundwire: Add software clock gating requirement check Date: Tue, 7 Jun 2022 18:05:34 +0530 Message-ID: <1654605334-32030-3-git-send-email-quic_srivasam@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1654605334-32030-1-git-send-email-quic_srivasam@quicinc.com> References: <1654605334-32030-1-git-send-email-quic_srivasam@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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 dat 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. Signed-off-by: Srinivasa Rao Mandadapu --- drivers/soundwire/qcom.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 38c3bf5..4896e92 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -194,6 +194,12 @@ static const struct qcom_swrm_data swrm_v1_5_data = { .default_cols = 16, }; +static const struct qcom_swrm_data swrm_v1_6_data = { + .default_rows = 50, + .default_cols = 16, + .sw_clk_gate_required = 1, +}; + #define to_qcom_sdw(b) container_of(b, struct qcom_swrm_ctrl, bus) static int qcom_swrm_ahb_reg_read(struct qcom_swrm_ctrl *ctrl, int reg, @@ -659,7 +665,8 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) val = FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK, ctrl->rows_index); val |= FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK, ctrl->cols_index); - reset_control_reset(ctrl->audio_cgcr); + if (data->sw_clk_gate_required) + reset_control_reset(ctrl->audio_cgcr); ctrl->reg_write(ctrl, SWRM_MCP_FRAME_CTRL_BANK_ADDR(0), val); @@ -1312,6 +1319,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)) { + 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; @@ -1337,10 +1353,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; @@ -1494,7 +1506,8 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev) qcom_swrm_get_device_status(ctrl); sdw_handle_slave_status(&ctrl->bus, ctrl->status); } else { - reset_control_reset(ctrl->audio_cgcr); + if (data->sw_clk_gate_required) + reset_control_reset(ctrl->audio_cgcr); ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START); ctrl->reg_write(ctrl, SWRM_INTERRUPT_CLEAR, @@ -1559,7 +1572,7 @@ static const struct dev_pm_ops swrm_dev_pm_ops = { static const struct of_device_id qcom_swrm_of_match[] = { { .compatible = "qcom,soundwire-v1.3.0", .data = &swrm_v1_3_data }, { .compatible = "qcom,soundwire-v1.5.1", .data = &swrm_v1_5_data }, - { .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_5_data }, + { .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_6_data }, {/* sentinel */}, }; -- 2.7.4