Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp624489ybl; Fri, 24 Jan 2020 06:38:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwmqhnksJATfpDkr5UTb5EFV1gCiNm8l3efPZ+/5Zv9I5VQSoOwyfs+UtS0F6WstKu3f3Mf X-Received: by 2002:a9d:6c0d:: with SMTP id f13mr2816673otq.354.1579876707140; Fri, 24 Jan 2020 06:38:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579876707; cv=none; d=google.com; s=arc-20160816; b=g9tX3Ks+ms+TMZ+R8UbiVttQ8hbbMqpeM6cGbthElWmM4bIQ+QXFE3N7+ZbfhpM0nF 3GAumO6AfCwmR1WZU40pT9BlzlW2yN1ZcinXR58OaisApd2fi+U1eH8sscNlPwr15ToD kOwQuDT+lMt2fUAW2t3AkvM17RCHO0eX1IxirpCYPQJ5JEK/303gmFz9hJNOCssQvFxj VXdCRHecDa4WoVYCNLatIMJcPDL4bGpB/3AivzQFjk42qUN8naKXyON2HcyIJ2p465Jp toCJrl36/KGEpxc79VDW8XOIsRBTBwA/5Z7S3x30PSOAxwQx0TxKl8p6lyvt6Dwx43v+ WqEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=SyUER5XtPQaR5PqGkKYS+jSgkqDS6pK5BSu+qlUCJYk=; b=jjD10HYV42Bbquybxcd1vbsM/vOLuiJrrbR7gntdtlYuRhpFQzOUU68DTLV9cEugAo XCscnoglCYbh9tCsWqBv3ExD6DmzWdU6ELQK2jkQxHf0uoLlGlTFLoR/RIBsAOBxjI2r Yv467kdTF3Va5j381o5v6wm7h9TGyC39PodQyZMeA3715DX6oFdiL6aMZGJP4NPlr+/9 LM2wheddMzyN/Tl0vlLeE7OWleCteJrNEqXGEtlb1+MB8QP+NGvdlo0wC5af1hsQoZkw ZRW7rJbKyaycVNSKMw8Wt8TcXKACIej+ndhIhg1atTUbr56Sfig4WIFDh9/dresGdjiH XHpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=oZ7Y+9+B; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si2363836oic.72.2020.01.24.06.38.15; Fri, 24 Jan 2020 06:38:27 -0800 (PST) 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=@samsung.com header.s=mail20170921 header.b=oZ7Y+9+B; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390333AbgAXOPL (ORCPT + 99 others); Fri, 24 Jan 2020 09:15:11 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:60352 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388791AbgAXOPI (ORCPT ); Fri, 24 Jan 2020 09:15:08 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200124141507euoutp0137b794377794909bdeb8673d70f371eb~s2DizxWjr1495614956euoutp01f for ; Fri, 24 Jan 2020 14:15:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200124141507euoutp0137b794377794909bdeb8673d70f371eb~s2DizxWjr1495614956euoutp01f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1579875307; bh=SyUER5XtPQaR5PqGkKYS+jSgkqDS6pK5BSu+qlUCJYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZ7Y+9+BtznngctigeIfqyrwg73fDmKNSzev+TZGgrOmkuD1XrvefeVkQTA4XQG2p t34FzZxTyiGW0RiWgSE7LRQh5xhpF0OztPvbknyrJ9MhKDhEO0o8yn4u37vfljbK+K b4IkfRw7Wb/IesdBLZJaalAQXy+XpJgfwEHwOGaE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200124141507eucas1p172a87a1033df439ed837dc0b47b57b1b~s2DinRh-E2191621916eucas1p1q; Fri, 24 Jan 2020 14:15:07 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id B6.5F.61286.BEBFA2E5; Fri, 24 Jan 2020 14:15:07 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200124141506eucas1p1d2fdb3b5d26d123272cafeddecd5708a~s2DiVyscR2198621986eucas1p1z; Fri, 24 Jan 2020 14:15:06 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200124141506eusmtrp135a260c16c8b2bb95fb23a90621d2573~s2DiVJB9j1786817868eusmtrp1e; Fri, 24 Jan 2020 14:15:06 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-4c-5e2afbeb61a9 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A6.C2.07950.AEBFA2E5; Fri, 24 Jan 2020 14:15:06 +0000 (GMT) Received: from AMDC3218.digital.local (unknown [106.120.51.18]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200124141506eusmtip1eea5f29f451889f60fd8d12840c623cc~s2DhoZx_00071400714eusmtip1C; Fri, 24 Jan 2020 14:15:06 +0000 (GMT) From: Kamil Konieczny To: k.konieczny@samsung.com Cc: Bartlomiej Zolnierkiewicz , Chanwoo Choi , Krzysztof Kozlowski , Kukjin Kim , Kyungmin Park , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski , MyungJoo Ham Subject: [PATCH RESEND 2/3] PM / devfreq: exynos-bus: prepare for change in load calc in exynos-nocp Date: Fri, 24 Jan 2020 15:14:48 +0100 Message-Id: <20200124141449.19844-3-k.konieczny@samsung.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124141449.19844-1-k.konieczny@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAKsWRmVeSWpSXmKPExsWy7djPc7qvf2vFGbx9zWaxccZ6VovrX56z Wiz4NIPVov/xa2aL8+c3sFucbXrDbrHp8TVWi8u75rBZfO49wmgx4/w+Jou1R+6yW9xuXMHm wOOxaVUnm8fmJfUefVtWMXp83iQXwBLFZZOSmpNZllqkb5fAlXGxYzZzwT+Rij0rVjA2ME4T 7GLk5JAQMJE4duIeM4gtJLCCUaJ7p3cXIxeQ/YVR4tmDVlYI5zOjxL65PYwwHSsmrWeGSCxn lJi8egYjXMua9r3sIFVsAvoSB8+eZAGxRQSkJToXTWQCKWIW2MQsceDpFCaQhLBAmsTk2UfA bBYBVYltZ5rBDuEVsJHY1XKOGWKdvMTsxtNsIDangK3EqjOr2CFqBCVOznwCtoAZqKZ562yo +nXsEn92+EDYLhIfHjxgh7CFJV4d3wJly0icntzDAmGXSzxd2McOcpyEQAujxIP2j1AJa4k7 534BLeYAWqApsX6XPkTYUWLOjf1gYQkBPokbbwUhTuCTmLRtOjNEmFeio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uK8HQIH Y4QE0hNLUrNTUwtSi2D6mDg4pRoYG8Kn690oDXPpdLE3amA8Ea/Uf8lGNcevhZvBc8HDpgPz eBdvFRH9onn29Kfncqaiy/5KT3G5cTK5R7ddicF86W1BtXQ7Zd2szMW/jtb9rmY//+/8t8OL 1XZEKuqn3rwsYvFnz6nURw+Vpsf4aR+c41cUJNw//+mOJqlm9d2L5ISybtx6en+CEktxRqKh FnNRcSIAEuiY97QCAAA= X-CMS-MailID: 20200124141506eucas1p1d2fdb3b5d26d123272cafeddecd5708a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200124141506eucas1p1d2fdb3b5d26d123272cafeddecd5708a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200124141506eucas1p1d2fdb3b5d26d123272cafeddecd5708a References: <20200124141449.19844-1-k.konieczny@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add time to struct exynos_bus and time and current frequency to struct devfreq_event_data. This will allow to calculate load and max bandwidth in exynos-nocp driver. Signed-off-by: Kamil Konieczny --- drivers/devfreq/exynos-bus.c | 21 ++++++++++++++++++++- include/linux/devfreq-event.h | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 8fa8eb541373..f04ce5b84e75 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +32,7 @@ struct exynos_bus { struct mutex lock; unsigned long curr_freq; + unsigned long prev_time; struct opp_table *opp_table; struct clk *clk; @@ -57,7 +59,22 @@ static int exynos_bus_##ops(struct exynos_bus *bus) \ } exynos_bus_ops_edev(enable_edev); exynos_bus_ops_edev(disable_edev); -exynos_bus_ops_edev(set_event); + +static int exynos_bus_set_event(struct exynos_bus *bus) +{ + int i, ret; + + bus->prev_time = jiffies; + for (i = 0; i < bus->edev_count; i++) { + if (!bus->edev[i]) + continue; + ret = devfreq_event_set_event(bus->edev[i]); + if (ret < 0) + return ret; + } + + return 0; +} static int exynos_bus_get_event(struct exynos_bus *bus, struct devfreq_event_data *edata) @@ -66,6 +83,8 @@ static int exynos_bus_get_event(struct exynos_bus *bus, unsigned long load_count = 0, total_count = 0; int i, ret = 0; + event_data.curr_freq = bus->curr_freq; + event_data.prev_time = bus->prev_time; for (i = 0; i < bus->edev_count; i++) { if (!bus->edev[i]) continue; diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h index f14f17f8cb7f..b57ccfcb775b 100644 --- a/include/linux/devfreq-event.h +++ b/include/linux/devfreq-event.h @@ -41,12 +41,16 @@ struct devfreq_event_dev { * each count may represent a clock cycle, a time unit * (ns/us/...), or anything the device driver wants. * Generally, utilization is load_count / total_count. + * @prev_time : jiffies for interval calculations with polling. + * @curr_freq : current frequency for calculating max bandwidth. * * This structure contains the data of devfreq-event device for polling period. */ struct devfreq_event_data { unsigned long load_count; unsigned long total_count; + unsigned long prev_time; + unsigned long curr_freq; }; /** -- 2.25.0