From patchwork Mon May 18 15:35:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 6430121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AE4F7C0432 for ; Mon, 18 May 2015 15:38:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7BDF205C7 for ; Mon, 18 May 2015 15:38:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B2BE201E4 for ; Mon, 18 May 2015 15:38:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YuN5H-000450-DV; Mon, 18 May 2015 15:36:03 +0000 Received: from mail-pd0-x242.google.com ([2607:f8b0:400e:c02::242]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YuN5B-0003uU-17 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2015 15:35:57 +0000 Received: by pdjp10 with SMTP id p10so721440pdj.1 for ; Mon, 18 May 2015 08:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=mvHuxrzE1kf25MLYwZ2l3I/OCM1kC6rxnZw5MtxGHoE=; b=np7Cx3uETy1T9grbyjKBUIIm86T8OPuF+PyQ4Q5jvslZ8Hcck1qB007US2gPlpk+T+ XgV/pghV6gKfh0TG49qRszGFHzDJ5P780P1InZ3/5T6GWulRyyBHnGLwW/znoPw2is7Q 8qc8d+34rCVsg2eoif/Rek5TDOipA2kfTfTrUxmV/EIlEtH2n1Yv0FmKwn93VlbLwROf lMj0I9etUG34J9jpAdW9eACVckVfcLRVPo7uITr0HHgjQCWIESQK3ePqioMEZQQSKbC3 Bk/gGBe522HPof0nraHN2sooCqDO3O568Ra8WGvTq0kCBLLragnq/fEczyvVImyS1pnu u7Ig== X-Received: by 10.68.233.71 with SMTP id tu7mr6354163pbc.14.1431963335325; Mon, 18 May 2015 08:35:35 -0700 (PDT) Received: from localhost ([216.228.120.20]) by mx.google.com with ESMTPSA id cy5sm10413392pdb.85.2015.05.18.08.35.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2015 08:35:34 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH] memory: tegra: Expose supported rates via debugfs Date: Mon, 18 May 2015 17:35:30 +0200 Message-Id: <1431963330-25708-1-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.3.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150518_083557_153339_E8113495 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -0.8 (/) Cc: Alexandre Courbot , Tomeu Vizoso , Stephen Warren , Mikko Perttunen , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding In order to ease testing, expose the list of supported EMC frequencies via debugfs. Signed-off-by: Thierry Reding Reviewed-by: Tomeu Vizoso --- drivers/memory/tegra/tegra124-emc.c | 42 +++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 8620355776fe..3dac7be39654 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -1027,7 +1027,40 @@ static int emc_debug_rate_set(void *data, u64 rate) DEFINE_SIMPLE_ATTRIBUTE(emc_debug_rate_fops, emc_debug_rate_get, emc_debug_rate_set, "%lld\n"); -static void emc_debugfs_init(struct device *dev) +static int emc_debug_supported_rates_show(struct seq_file *s, void *data) +{ + struct tegra_emc *emc = s->private; + const char *prefix = ""; + unsigned int i; + + for (i = 0; i < emc->num_timings; i++) { + struct emc_timing *timing = &emc->timings[i]; + + seq_printf(s, "%s%lu", prefix, timing->rate); + + prefix = " "; + } + + seq_puts(s, "\n"); + + return 0; +} + +static int emc_debug_supported_rates_open(struct inode *inode, + struct file *file) +{ + return single_open(file, emc_debug_supported_rates_show, + inode->i_private); +} + +static const struct file_operations emc_debug_supported_rates_fops = { + .open = emc_debug_supported_rates_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc) { struct dentry *root, *file; struct clk *clk; @@ -1048,6 +1081,11 @@ static void emc_debugfs_init(struct device *dev) &emc_debug_rate_fops); if (!file) dev_err(dev, "failed to create debugfs entry\n"); + + file = debugfs_create_file("supported_rates", S_IRUGO, root, emc, + &emc_debug_supported_rates_fops); + if (!file) + dev_err(dev, "failed to create debugfs entry\n"); } static int tegra_emc_probe(struct platform_device *pdev) @@ -1119,7 +1157,7 @@ static int tegra_emc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, emc); if (IS_ENABLED(CONFIG_DEBUG_FS)) - emc_debugfs_init(&pdev->dev); + emc_debugfs_init(&pdev->dev, emc); return 0; };