Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754565AbaKRMYN (ORCPT ); Tue, 18 Nov 2014 07:24:13 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]:44349 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754505AbaKRMYK (ORCPT ); Tue, 18 Nov 2014 07:24:10 -0500 From: Tomeu Vizoso To: linux-tegra@vger.kernel.org Cc: Javier Martinez Canillas , mikko.perttunen@kapsi.fi, acourbot@nvidia.com, Mikko Perttunen , Tomeu Vizoso , Stephen Warren , Thierry Reding , Alexandre Courbot , linux-kernel@vger.kernel.org Subject: [PATCH v5 13/14] memory: tegra: Add debugfs entry for getting and setting the EMC rate Date: Tue, 18 Nov 2014 13:13:15 +0100 Message-Id: <1416312860-4446-14-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1416312860-4446-1-git-send-email-tomeu.vizoso@collabora.com> References: <1416312860-4446-1-git-send-email-tomeu.vizoso@collabora.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikko Perttunen Will be very useful when tuning memory scaling. Signed-off-by: Mikko Perttunen Signed-off-by: Tomeu Vizoso --- drivers/memory/tegra/tegra124-emc.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 7036ad5..d4817b6 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1036,6 +1037,38 @@ static struct device_node *tegra_emc_find_node_by_ram_code( return NULL; } +/* Debugfs entry */ + +static int emc_debug_rate_get(void *data, u64 *rate) +{ + struct clk *c = data; + + *rate = clk_get_rate(c); + + return 0; +} + +static int emc_debug_rate_set(void *data, u64 rate) +{ + struct clk *c = data; + + return clk_set_rate(c, rate); +} + +DEFINE_SIMPLE_ATTRIBUTE(emc_debug_rate_fops, emc_debug_rate_get, + emc_debug_rate_set, "%lld\n"); + +void emc_debugfs_init(void) +{ + struct dentry *d; + + d = debugfs_create_file("emc_rate", S_IRUGO | S_IWUSR, NULL, + clk_get_sys("tegra-clk-debug", "emc"), + &emc_debug_rate_fops); + if (!d) + pr_warn("failed to create debugfs entries\n"); +} + static int tegra_emc_probe(struct platform_device *pdev) { struct tegra_emc *tegra; @@ -1106,6 +1139,8 @@ static int tegra_emc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, tegra); + emc_debugfs_init(); + return 0; }; -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/