Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4775460pxb; Tue, 5 Oct 2021 10:03:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM70pstGhQHAdrNDVyEjgIbPHMElBVClzRjITgjNlegml32mbgT5JQZXIwWKKtAbpmYpz0 X-Received: by 2002:a17:907:9870:: with SMTP id ko16mr9164516ejc.99.1633453413512; Tue, 05 Oct 2021 10:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633453413; cv=none; d=google.com; s=arc-20160816; b=saX4b5Mkgc6zfDomp6X170d9a6BKnZqrcNiX3ccpv+xicN99ORgYZiXFvJSfFGyLlX SpzbmbYyWR1yaKUsc6inE9RLtQH0nw4MCkh2fyyo8q6Z4hraP8SYaGwgg3q9PiuxddHR 4d0J2GVOFeF1jmyiRHwVi9PBrBgAqG+Od5kYbAq8THHojKN4J0mK483x+Yngx6RwdZ64 6S0rA45eCAcV0v0zAYN6gBfOn+NF4afD3qeiVYAjkSojMxFBIQcm313Hka9amnaxrBS9 n910++HcdOnc8TfmoeFukRLqJ47Wi081ZSUIcupOUJaeyVxX7gDQ5YPVge39IWAFsg7H 9TLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eT4QRWTiJcs1knqD0fms3lf+fPlsl7moqQX0wdYcY2M=; b=ieWdgd/ioG14Brx/qm4CZ7hDB21F+8BphZwlzDK4n0qmS5z9Ah5npEbSZtV2OZtDoF ACTCGyFs757KKwk6PDlFTbUwnNMo1tiQWvYxpGJ5Va5jIQnRAKcLp57UTPXsKIsrY3Ca BNv+Qnglz4Xy8UVWufLr/lmU4yfYNefeR8wHd+OCNvhUlZNvrNBPx2xbJZMS7MRl3RSP GerhA/AXp9hIpA052k8n2bdusc+qg6ehIzAJOghC8gCUADgxDBWb0yrEtpBQR7Y8A117 7yJF423dQF8H4/sWiO0FZ6EhvxciHlrHJtTmeE2CNVEIRCJ8Qk4UWJG67NQ9LROMCDlc PDpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sLzQMGXP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di7si1112551ejc.345.2021.10.05.10.03.07; Tue, 05 Oct 2021 10:03:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sLzQMGXP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235716AbhJERB5 (ORCPT + 99 others); Tue, 5 Oct 2021 13:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236585AbhJERB4 (ORCPT ); Tue, 5 Oct 2021 13:01:56 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1F89C06174E for ; Tue, 5 Oct 2021 10:00:05 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id c6-20020a9d2786000000b005471981d559so26654658otb.5 for ; Tue, 05 Oct 2021 10:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eT4QRWTiJcs1knqD0fms3lf+fPlsl7moqQX0wdYcY2M=; b=sLzQMGXP4lgmvW6RIos0qJsSgfnvDPNPlxKz2aHtLdzE6GdRTycaBnkCKNjXGOEDRC wrzfyJIZNmfz0HPapn33yfabQJTY5IZQNOzdjM3rXsVolGMtMpmAe40khV59mmixH6CM whbo3qoGSQxWG/UHNB169e90vg9khpC5JY1Zd12yJCa3tNsluVTzjHVdfKJG9eYENNBv U3gqZe+LI9wtybSg/larb2Nq2bMKax1sf1aWgwrR15QKY0l5h5ocm+Bgiskj6+NlZM4+ nu8WfFDGDV1NaNMsyKV3rlECx6QgSz7avNXjrrpIoLoMdb7LttswJTUeRvkHjnV5qB2e Cymg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eT4QRWTiJcs1knqD0fms3lf+fPlsl7moqQX0wdYcY2M=; b=Z6YVrXD58LzlcazO67SwxuEXXC4iNx7XF/sQH0yo3gR0mU1e5ysJOzoP8tcTxCaDlr 5oIgrdqEz5gQVYEbpOdd2HghiHLdNWIl6xZi3Aj3JXzf3BcqH2AYa1j+ZEKXciDXbhA1 zEgfZoyl2FwOU+iKvmVTdBdZ+19Na9grIpavqOlxv81h5KkHH4wxXW8dvCVm1iegVZS/ IthzqSYstuy+DH7d82pxBHHtrs7zTFv88rIIr5voC0XTOhjCALWTIeM8ckZZDWd8TeLn gQVOZR1OMQbj8UVJuRE6beafptOwA5T8aq7H/jUdEEcwpwMDiQlYaflcOGBd9iRPT1/Z 3VYg== X-Gm-Message-State: AOAM530Nxvs2NnlZV+7ZxWBEmm9xP3CRFB4KddwFWBGbQx+ZsnJE/CsP 3JeKkF5LUubQwtQPK1ryTeYYxg== X-Received: by 2002:a05:6830:2906:: with SMTP id z6mr15861929otu.257.1633453205311; Tue, 05 Oct 2021 10:00:05 -0700 (PDT) Received: from ripper ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id u2sm3664543otg.51.2021.10.05.10.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 10:00:04 -0700 (PDT) Date: Tue, 5 Oct 2021 10:01:47 -0700 From: Bjorn Andersson To: Srinivasa Rao Mandadapu Cc: agross@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, srinivas.kandagatla@linaro.org, rohitkr@codeaurora.org, 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, Venkata Prasad Potturu Subject: Re: [PATCH] ASoC: qcom: soundwire: Enable soundwire bus clock for version 1.6 Message-ID: References: <1633105471-30928-1-git-send-email-srivasam@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1633105471-30928-1-git-send-email-srivasam@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 01 Oct 09:24 PDT 2021, Srinivasa Rao Mandadapu wrote: > Add support for soundwire 1.6 version to gate RX/TX bus clock. > > Signed-off-by: Venkata Prasad Potturu > Signed-off-by: Srinivasa Rao Mandadapu > --- > drivers/soundwire/qcom.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c > index 0ef79d6..599b3ed 100644 > --- a/drivers/soundwire/qcom.c > +++ b/drivers/soundwire/qcom.c > @@ -127,6 +127,7 @@ struct qcom_swrm_ctrl { > struct device *dev; > struct regmap *regmap; > void __iomem *mmio; > + char __iomem *swrm_hctl_reg; > struct completion broadcast; > struct completion enumeration; > struct work_struct slave_work; > @@ -610,6 +611,12 @@ 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); > > + if (ctrl->swrm_hctl_reg) { > + val = ioread32(ctrl->swrm_hctl_reg); > + val &= 0xFFFFFFFD; That's a tricky way of saying: val &= ~BIT(1); That said, naming bit 1 is still a very good thing. > + iowrite32(val, ctrl->swrm_hctl_reg); > + } > + > ctrl->reg_write(ctrl, SWRM_MCP_FRAME_CTRL_BANK_ADDR(0), val); > > /* Enable Auto enumeration */ > @@ -1200,7 +1207,7 @@ static int qcom_swrm_probe(struct platform_device *pdev) > struct qcom_swrm_ctrl *ctrl; > const struct qcom_swrm_data *data; > int ret; > - u32 val; > + int val, swrm_hctl_reg = 0; > > ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); > if (!ctrl) > @@ -1251,6 +1258,9 @@ static int qcom_swrm_probe(struct platform_device *pdev) > ctrl->bus.port_ops = &qcom_swrm_port_ops; > ctrl->bus.compute_params = &qcom_swrm_compute_params; > > + if (!of_property_read_u32(dev->of_node, "qcom,swrm-hctl-reg", &swrm_hctl_reg)) > + ctrl->swrm_hctl_reg = devm_ioremap(&pdev->dev, swrm_hctl_reg, 0x4); Nack. You may not pull an address to a single register out of an undocumented DT property and blindly ioremap that. And you surely should check for errors here, to avoid magical errors caused by this ioremap failing and your bit not being cleared. Thanks, Bjorn > + > ret = qcom_swrm_get_port_config(ctrl); > if (ret) > goto err_clk; > -- > Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., > is a member of Code Aurora Forum, a Linux Foundation Collaborative Project. >