Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5758880pxu; Thu, 22 Oct 2020 10:15:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAKpqHdwwQqKNCdnJMv8PQYQ99+gGj2yKKCmApry+mRcsg1aCMLyYN7t48AqPwZwZ0pCzv X-Received: by 2002:a05:6402:1e6:: with SMTP id i6mr3275518edy.152.1603386948422; Thu, 22 Oct 2020 10:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603386948; cv=none; d=google.com; s=arc-20160816; b=qhQCdcBrB93ZTfgYQyCHRPoUWSaKiL2mVtre+u/+yvscW8KvVjbv0815qFDz9uJwcf IKZI4xESq763SnSut4l+OZGT8fIE/eTe/N5r8k/0jmDBBA9G0PF+i/gcenHJ0b2vsGMk E5q7aAqaX00/leEL4gRK0hDmUb4UUkRDomKzVLV9WwWBEgXISL2yVTibPL74uMsjJkW2 V0hHBfwYzR8CRxJrcekSvwfJDjh9Sea6+LKK331VMlbFl1vs70ak/5QdVEmZuVCb+sfI jsCg7639g6SVeI0XRuxMObV8cyDrmPdr6QIkNd+LAkJgiRMN8tz7sdsLtzjjAXYD7AXt EDKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:date:message-id:autocrypt:from:references :cc:to:subject:dkim-signature; bh=WNzAQXz3amhO6wa3kYX2lVV5iioJ9/t/YoS1l34UuYM=; b=WyV67uCIIS0D5u5Z7t759XdTBUfNnqnItJomSrohN7PQK1G4075TqYicv1OXQgDayx F/cJY7GNnXQ3yv9FQAiPw8AZPcjfUaCJBS9aoyJP0YLTHkEKQfApwxT0p/urBRLNov4L 1bDD/0u8O0TDdbNkxPv1Aay0tiMir0eSmp0xkCWBXA19nfgLFg9YcEK1mYZ0QfrkAW9x QGQ6U/rxXWAIzRFabMcVSRCzl9OuZjAW0E3dxLn0zILZ6JSnJ4artfqUO0Mc27Ux6wvW cKXAsLOt3CV+OXSRahOb7EYOibn4L0W7oWzLoSDQU2paJ6mSycpNpJzx9QGilp9z8pbu YCXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E5LppAZu; 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 ay1si1352553edb.3.2020.10.22.10.15.26; Thu, 22 Oct 2020 10:15:48 -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=E5LppAZu; 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 S2899228AbgJVNER (ORCPT + 99 others); Thu, 22 Oct 2020 09:04:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440924AbgJVNER (ORCPT ); Thu, 22 Oct 2020 09:04:17 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67858C0613CE for ; Thu, 22 Oct 2020 06:04:15 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id c194so1995525wme.2 for ; Thu, 22 Oct 2020 06:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WNzAQXz3amhO6wa3kYX2lVV5iioJ9/t/YoS1l34UuYM=; b=E5LppAZuapWnhx+KMQ3Q7N1KBxUdGcLdDkSDoW1gdkQ0Zit6yfggBP8eBJz/kAL19J eC1W0lqhBzhkLachecwM5yoEfDrs9cTuKWkMedaCE5YmJTyuAEen9P80HVa8egfU0WxE ebcozzTUCxr3LzIm7ZJx7c+I7oZGuqviSyKgwMd5Q0bIU4xriY0tLhZVymXvwpKy44zU PHk0/o6HSETktDeC5aOG96k7gHivBWtf9aC8XqaPZlkt5rsEc/2eilADNGCKKv5l0Yx1 25/Yj7zPEkzLE6k9Hd9YhfmbSg+8cgEzsZh+pColedvceqPQMjntvkiiRptb69QhXl+D pc6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WNzAQXz3amhO6wa3kYX2lVV5iioJ9/t/YoS1l34UuYM=; b=XWlhLixMB3n/cGSRpe3hfPzHJXExhlRkMIr9CwMublYU4F/P4ZJiH8IlA9Z01abcm7 0Ol8TKi80OOvDnAwtVcNefY04O5wynv8grDNVkonNkeZaJioAADYoALzlifhrBQgWUUB i2liCpr+ufZ51b5IR5yymhsTQZltzK/Ii/3qjbJ39MqikCrqv9MqlwLukUQOKP3/EMek UKpQd9B158YIrEr7xDQWGWkvfYRPdcpxk9r8bDLWUOAPGqfxnHp7hfNYKq7QzUVe3wpR mMShhrKB41bkFjzL0LbnxVIBFtZuayk6ynwYI3WxabBDxpvED1sRAnNfORkNo6EfY9/x Fghw== X-Gm-Message-State: AOAM533bRdM5SEvf9ImNpJRx6eeypJnRdyeCuni/8QKsiNXTs+wDZh13 cqiaXw5rVPD8P512CKAKZbA9Kw== X-Received: by 2002:a1c:5545:: with SMTP id j66mr2560129wmb.31.1603371852368; Thu, 22 Oct 2020 06:04:12 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id l1sm4033136wrb.1.2020.10.22.06.04.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Oct 2020 06:04:11 -0700 (PDT) Subject: Re: [PATCH 1/5] interconnect: qcom: Consolidate interconnect RPM support To: Jun Nie Cc: devicetree@vger.kernel.org, bjorn.andersson@linaro.org, agross@kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, robh@kernel.org, shawn.guo@linaro.org References: <20200930081645.3434-1-jun.nie@linaro.org> <20200930081645.3434-2-jun.nie@linaro.org> From: Georgi Djakov Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= xsFNBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamSpKOKFereIrKX2IcnZn8jyycE12zMkk+Sc ASMfXhfywB0tXRNmzsywdxQFcJ6jblPNx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gEpjnFsPsyFebzcKGbdEr6vySGa3Cof+miX06hQXKe99a5+eHNhtZJcMAIO89wZmj 7ayYJIXFqjl/X0KBcCbiAl4vbdBw1bqFnO4zd1lMXKVoa29UHqby4MPbQhjWNVv9kqp8A39+ E9xw890l1xdERkjVKX6IEJu2hf7X3MMl9tOjBK6MvdOUxvh1bNNmXh7OlBL1MpJYY/ydIm3B KEmKjLDvB0pePJkdTw== Message-ID: <8b9f06ae-f711-2e71-1e36-1f8519b52e8d@linaro.org> Date: Thu, 22 Oct 2020 16:04:09 +0300 MIME-Version: 1.0 In-Reply-To: <20200930081645.3434-2-jun.nie@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jun, Thanks for working on this. On 9/30/20 11:16, Jun Nie wrote: > Add RPM based interconnect driver implements the set and aggregate > functionalities that translates bandwidth requests into RPM messages. > These modules provide a common set of functionalities for all > Qualcomm RPM based interconnect providers and should help reduce code > duplication when adding new providers. > > Signed-off-by: Jun Nie > --- > drivers/interconnect/qcom/Makefile | 3 +- > drivers/interconnect/qcom/icc-rpm.c | 194 ++++++++++++++++++++++ > drivers/interconnect/qcom/icc-rpm.h | 73 +++++++++ > drivers/interconnect/qcom/msm8916.c | 241 ++-------------------------- > 4 files changed, 279 insertions(+), 232 deletions(-) > create mode 100644 drivers/interconnect/qcom/icc-rpm.c > create mode 100644 drivers/interconnect/qcom/icc-rpm.h > > diff --git a/drivers/interconnect/qcom/Makefile b/drivers/interconnect/qcom/Makefile > index 1702ece67dc5..f5e803489de0 100644 > --- a/drivers/interconnect/qcom/Makefile > +++ b/drivers/interconnect/qcom/Makefile > @@ -9,7 +9,7 @@ icc-rpmh-obj := icc-rpmh.o > qnoc-sc7180-objs := sc7180.o > qnoc-sdm845-objs := sdm845.o > qnoc-sm8150-objs := sm8150.o > -icc-smd-rpm-objs := smd-rpm.o > +icc-smd-rpm-objs := smd-rpm.o icc-rpm.o > > obj-$(CONFIG_INTERCONNECT_QCOM_BCM_VOTER) += icc-bcm-voter.o > obj-$(CONFIG_INTERCONNECT_QCOM_MSM8916) += qnoc-msm8916.o > @@ -21,3 +21,4 @@ obj-$(CONFIG_INTERCONNECT_QCOM_SC7180) += qnoc-sc7180.o > obj-$(CONFIG_INTERCONNECT_QCOM_SDM845) += qnoc-sdm845.o > obj-$(CONFIG_INTERCONNECT_QCOM_SM8150) += qnoc-sm8150.o > obj-$(CONFIG_INTERCONNECT_QCOM_SMD_RPM) += icc-smd-rpm.o > +obj-$(CONFIG_INTERCONNECT_QCOM_SMD_RPM) += icc-smd-rpm.o Duplicate line. > diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c > new file mode 100644 > index 000000000000..4ddcb6cd4b84 > --- /dev/null > +++ b/drivers/interconnect/qcom/icc-rpm.c [..] > +int qnoc_probe(struct platform_device *pdev, size_t cd_size, int cd_num, > + const struct clk_bulk_data *cd) > +{ > + struct device *dev = &pdev->dev; > + const struct qcom_icc_desc *desc; > + struct icc_onecell_data *data; > + struct icc_provider *provider; > + struct qcom_icc_node **qnodes; > + struct qcom_icc_provider *qp; > + struct icc_node *node; > + size_t num_nodes, i; > + int ret; > + > + /* wait for the RPM proxy */ > + if (!qcom_icc_rpm_smd_available()) > + return -EPROBE_DEFER; > + > + desc = of_device_get_match_data(dev); > + if (!desc) > + return -EINVAL; > + > + qnodes = desc->nodes; > + num_nodes = desc->num_nodes; > + > + qp = devm_kzalloc(dev, sizeof(*qp), GFP_KERNEL); > + if (!qp) > + return -ENOMEM; > + > + data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), > + GFP_KERNEL); > + if (!data) > + return -ENOMEM; > + > + qp->bus_clks = devm_kmemdup(dev, cd, cd_size, > + GFP_KERNEL); > + if (!qp->bus_clks) > + return -ENOMEM; > + > + qp->num_clks = cd_num; > + ret = devm_clk_bulk_get(dev, qp->num_clks, qp->bus_clks); > + if (ret) > + return ret; > + > + ret = clk_bulk_prepare_enable(qp->num_clks, qp->bus_clks); > + if (ret) > + return ret; > + > + provider = &qp->provider; > + INIT_LIST_HEAD(&provider->nodes); > + provider->dev = dev; > + provider->set = qcom_icc_set; > + provider->aggregate = icc_std_aggregate; > + provider->xlate = of_icc_xlate_onecell; > + provider->data = data; > + > + ret = icc_provider_add(provider); > + if (ret) { > + dev_err(dev, "error adding interconnect provider: %d\n", ret); > + clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); > + return ret; > + } > + > + for (i = 0; i < num_nodes; i++) { > + size_t j; > + > + node = icc_node_create(qnodes[i]->id); > + if (IS_ERR(node)) { > + ret = PTR_ERR(node); > + goto err; > + } > + > + node->name = qnodes[i]->name; > + node->data = qnodes[i]; > + icc_node_add(node, provider); > + > + dev_dbg(dev, "registered node %s\n", node->name); Please drop this line. > + > + /* populate links */ Please drop this comment. > + for (j = 0; j < qnodes[i]->num_links; j++) > + icc_link_create(node, qnodes[i]->links[j]); > + > + data->nodes[i] = node; > + } > + data->num_nodes = num_nodes; > + > + platform_set_drvdata(pdev, qp); > + > + return 0; > +err: > + icc_nodes_remove(provider); > + clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); > + icc_provider_del(provider); > + > + return ret; > +} > +EXPORT_SYMBOL(qnoc_probe); > + > +int qnoc_remove(struct platform_device *pdev) > +{ > + struct qcom_icc_provider *qp = platform_get_drvdata(pdev); > + > + icc_nodes_remove(&qp->provider); > + clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); > + return icc_provider_del(&qp->provider); > +} > +EXPORT_SYMBOL(qnoc_remove); > diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h > new file mode 100644 > index 000000000000..b75bb59d79b7 > --- /dev/null > +++ b/drivers/interconnect/qcom/icc-rpm.h > @@ -0,0 +1,73 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) 2020 Linaro Ltd > + */ > + > +#ifndef __DRIVERS_INTERCONNECT_QCOM_SMD_RPM_COMMON_H > +#define __DRIVERS_INTERCONNECT_QCOM_SMD_RPM_COMMON_H Would be nice if this matches with path and filename: __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H All the rest looks good. Thanks, Georgi