Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754936AbaJJMwc (ORCPT ); Fri, 10 Oct 2014 08:52:32 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:58605 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754815AbaJJMwL (ORCPT ); Fri, 10 Oct 2014 08:52:11 -0400 From: Tomeu Vizoso To: Stephen Warren Cc: Rhyland Klein , Mikko Perttunen , Thierry Reding , Javier Martinez Canillas , Tomeu Vizoso , Stephen Warren , Thierry Reding , Mikko Perttunen , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/10] memory: tegra: Add debugfs entry for getting and setting the EMC rate Date: Fri, 10 Oct 2014 14:47:01 +0200 Message-Id: <1412945262-6068-11-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1412945262-6068-1-git-send-email-tomeu.vizoso@collabora.com> References: <1412945262-6068-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 Will be very useful when tuning memory scaling. Signed-off-by: Tomeu Vizoso --- drivers/memory/tegra/tegra124-emc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index e70ca55..ed36534 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1034,6 +1035,39 @@ void tegra_emc_complete_timing_change(unsigned long rate) emc_complete_timing_change(emc_instance, emc_instance->timings + i); } +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * 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; @@ -1111,6 +1145,8 @@ static int tegra_emc_probe(struct platform_device *pdev) emc_instance = 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/