From patchwork Thu Jul 9 11:07:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 235136 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1297960ilg; Thu, 9 Jul 2020 04:07:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3/suIiKPYdbKxzLJ6/hlZIU7XOj3l9ZPuMjnE6luqeuXeVUHiKyy816oyJE/biE7BDoGG X-Received: by 2002:a17:906:c209:: with SMTP id d9mr32027457ejz.449.1594292849209; Thu, 09 Jul 2020 04:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594292849; cv=none; d=google.com; s=arc-20160816; b=IgBSvIvVptw8NG+uc/5o4hbRypnlbrdSpJnGTpkVDL7sKiHXcUYNvSsw1Fyrls7d+9 37j3PopSzDHxNz0666nLuAl41KMa5/w5trkqdJHDgFixYxiu6YQC2zpbHAR9Jz1GqDnz xwlbcrK8hEgrWJEqddA1A824+CQT1HAJubv3EqpRcb7tVs9AFdjN9X9JaEoRKt38seRa ATIB8gPWydEKPn3RDfF+P0aaOKIK4I1zJAzmIJIKBCaAP12kXXvV/KMSyVtfPdjbr9yw s4uZAFrQLP7PIAODZHhhe5Z4PpL3TcdwIJmPQ8B8HNFI6PNwqWTJCTMbGGBUgmEX/75Y O92w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QO3JZKihtso+39nMH2ykv6IniQvYNe/2WheGTzYpPuE=; b=xiHuPUJUlpTvGFNsdVAWHDWpoW/xQTk7wY9vnb1tct9RZjFmuIsIt3pA3gRQ7AMQON 5gSSNhpHxAMuHTHuwyS7XwN76i5wVX0ARalclRNO6NOsp6JHt6jMycZr/TMgXI06lDEM m/wZ/QhIC+9bcM97ZLi747a4Ry5VAPvgpCxqrSrbmwcimaZHAHitfYp4BR1GzNUWEplM xSB81d5uNzHsP2e3mqAXnJfF11plwcRMghNRc2OQTr6ys7BwAbz5kmgmPUHtVWIty5Hc FTFz9dg/PjdV8mlK2oW2RfIgdq2JHul9pFcQ7IM52Ma09yY2TPMqbvsBCAPrJ+G+CyYd U2+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=miAQ6xvF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 br6si1658518ejb.203.2020.07.09.04.07.29; Thu, 09 Jul 2020 04:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-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=miAQ6xvF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1727795AbgGILHQ (ORCPT + 10 others); Thu, 9 Jul 2020 07:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727798AbgGILHO (ORCPT ); Thu, 9 Jul 2020 07:07:14 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B40C08C5DC for ; Thu, 9 Jul 2020 04:07:13 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id f2so1879863wrp.7 for ; Thu, 09 Jul 2020 04:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QO3JZKihtso+39nMH2ykv6IniQvYNe/2WheGTzYpPuE=; b=miAQ6xvFBcDyc81YMANaoJ8Vj2T+Y6Y4oRgP4DbaKNUZ60jc3Qw5eTnj/8OtFHT9Fw uUD2LrGi6v1GF4Ec9zvV9DwiO0ym1tgQmXcJancBs4W3QengAkduEuW2v+fTrFqqgsge G84AfYwE3GEp4Tx18wngoP8y20BwEbFYuJX6g5vqabGW7kTrWJGHebcQr6b1w3zwCWep ibchTQ4ucOuKtxwNWcEd/nHpzH5hUsk+hz3y1WIx/0veCqUpm7l3n3lcnj7ArlyPkBOx U0XpHZsh+Z1vVze0HNdaJH4fut7gQ6KAUayCYYNsTzUIPEGZmyb8kVfeD9wmZ5EWCoYD MaFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QO3JZKihtso+39nMH2ykv6IniQvYNe/2WheGTzYpPuE=; b=RVO02XQxVb1U70LY2kcwvnGkkZOLl+MKdhrOGT48UfUAboHibrL6AQR0m35UQPGHmu 6FIyPJ0M+bpVQ7HGShNKILCJHOAPV8utz2IMEnJPvQkzfMOh+VtXvEuD5MvyTpw3iRpT Qo3GuKEYkMeZLwEpQ1cKw+9U5eXtSBToqKSz6E054adhB0zvKskh3eCgxeUJRqa9CZ7H 8zoIVXpflrJCtsY6DRIITgD+WV3pQLQv538jtbLLqs/2GnjzPcu6fW90syqIN1yr/65V FaYVb4a4mTA0u0B41+JzR+p5SfnpbG1zW/mpZxKl3c0EVnapMcWu057PliZNqtHwSHFW TeyA== X-Gm-Message-State: AOAM531wFtMpzRTufpUoWXXH6FhiDB1RTPe/9vL2v6u2svu1aYzqfqN9 6sYkhVri9gqTG/4OlHwKPmmwdElILg4= X-Received: by 2002:adf:e944:: with SMTP id m4mr64207464wrn.252.1594292832314; Thu, 09 Jul 2020 04:07:12 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id q7sm5375578wrs.27.2020.07.09.04.07.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2020 04:07:11 -0700 (PDT) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: saravanak@google.com, mdtipton@codeaurora.org, okukatla@codeaurora.org, bjorn.andersson@linaro.org, vincent.guittot@linaro.org, georgi.djakov@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] interconnect: Add get_bw() callback Date: Thu, 9 Jul 2020 14:07:03 +0300 Message-Id: <20200709110705.30359-3-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200709110705.30359-1-georgi.djakov@linaro.org> References: <20200709110705.30359-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The interconnect controller hardware may support querying the current bandwidth settings, so add a callback for providers to implement this functionality if supported. Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 3 ++- include/linux/interconnect-provider.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index e53adfee1ee3..edbfe8380e83 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -926,7 +926,8 @@ void icc_node_add(struct icc_node *node, struct icc_provider *provider) list_add_tail(&node->node_list, &provider->nodes); /* get the bandwidth value and sync it with the hardware */ - if (node->init_bw && provider->set) { + if (provider->get_bw && provider->set) { + provider->get_bw(node, &node->init_bw); node->peak_bw = node->init_bw; provider->set(node, node); } diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h index 153fb7616f96..329eccb19f58 100644 --- a/include/linux/interconnect-provider.h +++ b/include/linux/interconnect-provider.h @@ -38,6 +38,7 @@ struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec, * @aggregate: pointer to device specific aggregate operation function * @pre_aggregate: pointer to device specific function that is called * before the aggregation begins (optional) + * @get_bw: pointer to device specific function to get current bandwidth * @xlate: provider-specific callback for mapping nodes from phandle arguments * @dev: the device this interconnect provider belongs to * @users: count of active users @@ -50,6 +51,7 @@ struct icc_provider { int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw, u32 peak_bw, u32 *agg_avg, u32 *agg_peak); void (*pre_aggregate)(struct icc_node *node); + int (*get_bw)(struct icc_node *node, u32 *bw); struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data); struct device *dev; int users;