Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3445220imm; Fri, 19 Oct 2018 10:39:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5cJim/rhVdRSRTZeOcMBwEJe4yDIXg5WymqsJLJZ1Z8oqna4ZD05ZGdShNt0b+6N8if0S3C X-Received: by 2002:a17:902:a5c3:: with SMTP id t3-v6mr870832plq.287.1539970765904; Fri, 19 Oct 2018 10:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539970765; cv=none; d=google.com; s=arc-20160816; b=S7ANsxCUcWcwEtxW+XGqwS5FGWxHWzsvFYm170MNv+P2px+ioNoHxfT1Azj+pFJwlN iLSHcOxiQIn1toCG8547GDkFLrWxStVooE0aE0SdDMv+8EpD3yQqjUNexNWe0l1dlLrl 75Ma5eERdaY16f33Ejwifunk6lWsu8iSp+CLrEua8ZcVHrUFPM4Om19pfblQdx7eR+/t atf+IdN2rxuH9B5dExbhCHnzhSoDSHHF3mUrIZZe8E954JxDxok+Cdti+/2eVQJPUafQ mMaSLy+fJNANZbtcF3NFNkmmDvDvzWaTf2Y2Zb4domVpJKnFvbPmewneMMlzo0wGFGW+ O9IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7KHiUF44bQRZmdTMHbZLI0eFZBW8U/wdhwfWfOTuAfM=; b=0dThyjT05sEv/sHrtKsSKgQXNQXWRlPArRFmN2sQhScMqNEaEyOMD68siEVUOj1WvT PRrr8CENzOKqXyoXRXm8ns+OTYPMUu+HXPbH5ZFoHffCZfJVnJG9hSvLZg0QonsMoDds 6+965PqmUd6SQH6ZPKsIhBlweb0/sIXzGWTJ3BxLq4rsKGNzYUoSXCz81UDDudjruUs3 C62A2WMEtoX4ECHhi2ZidcHfVFXGs0R6pC89W1kKHhnLjTHcmmypKROR92FwV5qXKWrc PDa/z2FDe0j24/EIRZUgOkvTpLcbH9tDX8JnW2IwEWYzmDyx18vJe55kXo9UVGbBwblO f77A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jhR9MZOC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z191-v6si23106467pgd.451.2018.10.19.10.39.10; Fri, 19 Oct 2018 10:39:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jhR9MZOC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbeJTBpX (ORCPT + 99 others); Fri, 19 Oct 2018 21:45:23 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36770 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727549AbeJTBpW (ORCPT ); Fri, 19 Oct 2018 21:45:22 -0400 Received: by mail-lj1-f194.google.com with SMTP id p89-v6so31554547ljb.3 for ; Fri, 19 Oct 2018 10:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7KHiUF44bQRZmdTMHbZLI0eFZBW8U/wdhwfWfOTuAfM=; b=jhR9MZOCo3rl8duzGeJEFSuZpC1uu4U/aOSsMgOUhkeqsaTnzZMJGu0Pkbs9obAT/6 cNjMHnP7yNHC1HyTwHO2dlYEc+JqicZuNsA5xCxYdpjOk1LnSY3xW87EaGUAst0SnIvI 3Q9z5gIlOztZV+9QYM80nv45lwMXB3XhnbLYA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7KHiUF44bQRZmdTMHbZLI0eFZBW8U/wdhwfWfOTuAfM=; b=gToaW5/vaA44XLWCJKRY44eSZm2aznPvhvs5My5CnipMCcAmVZnio7Ql6hZiMcxkM3 7eOU2U8WG4PRNkTEo3tYe5+Aqqf1qgwYUYn7mDl6nQ4ts0tTHtbnKheuXzpxAYc0MG/l /ZYl/JxBEZoQdVHJxjMMC/Xxv6Hc3BAW8ujLlODATiDOaX4674JpM21q6uOwffWUzZM3 GHMtlB8vbRR74Wymzewf0DTuo7eHO5PBQnU305QS3m9w0telHhMYFoeGb7/vE2XAIZtT mWfh+3Twc5XEh081+GCMqOd9shusYMXQIWnp2TqH8K5soJLsfkZlqGl5DqfcUQlcZNWh E4Ig== X-Gm-Message-State: ABuFfogZCcICeJigFrE0od/zyunuejx0qTx7MdiAv4mh/kvyD4LkvKll w39oJcgwli0r6ioKl5PEaLhZQDczJQo= X-Received: by 2002:a2e:2997:: with SMTP id p23-v6mr5036602ljp.12.1539970697161; Fri, 19 Oct 2018 10:38:17 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id 71-v6sm5541029lja.90.2018.10.19.10.38.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Oct 2018 10:38:14 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id a82-v6so25845629lfa.4 for ; Fri, 19 Oct 2018 10:38:12 -0700 (PDT) X-Received: by 2002:a19:1cb:: with SMTP id 194mr3571764lfb.61.1539970692112; Fri, 19 Oct 2018 10:38:12 -0700 (PDT) MIME-Version: 1.0 References: <20180920182903.19991-1-georgi.djakov@linaro.org> In-Reply-To: <20180920182903.19991-1-georgi.djakov@linaro.org> From: Evan Green Date: Fri, 19 Oct 2018 10:37:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] i2c: qup: Use the interconnect API To: georgi.djakov@linaro.org Cc: linux-pm@vger.kernel.org, gregkh@linuxfoundation.org, rjw@rjwysocki.net, robh+dt@kernel.org, Michael Turquette , khilman@baylibre.com, Vincent Guittot , Saravana Kannan , Bjorn Andersson , amit.kucheria@linaro.org, seansw@qti.qualcomm.com, daidavid1@codeaurora.org, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, Alexandre Bailon , maxime.ripard@bootlin.com, Arnd Bergmann , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, wsa@the-dreams.de, linux-i2c@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 20, 2018 at 11:29 AM Georgi Djakov wrote: > > The interconnect API provides an interface for consumer drivers to express > their bandwidth needs in the SoC. This data is aggregated and the on-chip > interconnect hardware is configured to the appropriate power/performance > profile. > > Use the interconnect API to get() the path between the endpoints used for > data transfers by the I2C QUP and report the needed bandwidth based on the > i2c mode. > > Signed-off-by: Georgi Djakov > --- > > This patch depends on the interconnect API: https://lkml.org/lkml/2018/8/31/444 > > TODO: Use a macro for converting and rounding to icc units instead of > converting between kilobits, kilobytes etc. in the consumer drivers. > > drivers/i2c/busses/i2c-qup.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c > index c86c3ae1318f..436747a74dc6 100644 > --- a/drivers/i2c/busses/i2c-qup.c > +++ b/drivers/i2c/busses/i2c-qup.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -280,6 +281,11 @@ struct qup_i2c_dev { > void (*read_rx_fifo)(struct qup_i2c_dev *qup); > /* function to write tags in tx fifo for i2c read transfer */ > void (*write_rx_tags)(struct qup_i2c_dev *qup); > + > + /* frequency mode standard */ > + u32 clk_freq; > + /* interconnect path to scale according to bandwidth needs */ > + struct icc_path *path; > }; > > static irqreturn_t qup_i2c_interrupt(int irq, void *dev) > @@ -1657,6 +1663,16 @@ static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup) > clk_disable_unprepare(qup->pclk); > } > > +static void qup_i2c_enable_icc(struct qup_i2c_dev *qup) > +{ > + icc_set(qup->path, 0, qup->clk_freq / 8000); So this specifies an average bandwidth of zero, and a peak bandwidth of freq / 8000? Can you explain why that is the right choice? Also, where is this 8000 coming from? Can that be a define, and possibly explained? > +} > + > +static void qup_i2c_disable_icc(struct qup_i2c_dev *qup) > +{ > + icc_set(qup->path, 0, 0); > +} > +