* [PATCH] memory: tegra: Expose supported rates via debugfs
@ 2015-05-18 15:35 ` Thierry Reding
0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-05-18 15:35 UTC (permalink / raw)
To: Thierry Reding
Cc: Stephen Warren, Alexandre Courbot, Mikko Perttunen, Tomeu Vizoso,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
In order to ease testing, expose the list of supported EMC frequencies
via debugfs.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
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;
};
--
2.3.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH] memory: tegra: Expose supported rates via debugfs
@ 2015-05-18 15:35 ` Thierry Reding
0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-05-18 15:35 UTC (permalink / raw)
To: linux-arm-kernel
From: Thierry Reding <treding@nvidia.com>
In order to ease testing, expose the list of supported EMC frequencies
via debugfs.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
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;
};
--
2.3.5
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1431963330-25708-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] memory: tegra: Expose supported rates via debugfs
2015-05-18 15:35 ` Thierry Reding
@ 2015-05-19 12:21 ` Tomeu Vizoso
-1 siblings, 0 replies; 6+ messages in thread
From: Tomeu Vizoso @ 2015-05-19 12:21 UTC (permalink / raw)
To: Thierry Reding
Cc: Stephen Warren, Alexandre Courbot, Mikko Perttunen,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
On 18 May 2015 at 17:35, Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> In order to ease testing, expose the list of supported EMC frequencies
> via debugfs.
Looks good to me, but if this is for automated testing, why not just
read the timings from the DT? We would be covering more code that way.
Reviewed-by: Tomeu Vizoso <tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
Regards,
Tomeu
> Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> 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;
> };
> --
> 2.3.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH] memory: tegra: Expose supported rates via debugfs
@ 2015-05-19 12:21 ` Tomeu Vizoso
0 siblings, 0 replies; 6+ messages in thread
From: Tomeu Vizoso @ 2015-05-19 12:21 UTC (permalink / raw)
To: linux-arm-kernel
On 18 May 2015 at 17:35, Thierry Reding <thierry.reding@gmail.com> wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> In order to ease testing, expose the list of supported EMC frequencies
> via debugfs.
Looks good to me, but if this is for automated testing, why not just
read the timings from the DT? We would be covering more code that way.
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Regards,
Tomeu
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> 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;
> };
> --
> 2.3.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread[parent not found: <CAAObsKCo7x4qMdPvBb-dNoN=j7Od-eMCxw9BNoSvDR5mUZXGtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] memory: tegra: Expose supported rates via debugfs
2015-05-19 12:21 ` Tomeu Vizoso
@ 2015-05-19 14:36 ` Thierry Reding
-1 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-05-19 14:36 UTC (permalink / raw)
To: Tomeu Vizoso
Cc: Stephen Warren, Alexandre Courbot, Mikko Perttunen,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]
On Tue, May 19, 2015 at 02:21:01PM +0200, Tomeu Vizoso wrote:
> On 18 May 2015 at 17:35, Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> >
> > In order to ease testing, expose the list of supported EMC frequencies
> > via debugfs.
>
> Looks good to me, but if this is for automated testing, why not just
> read the timings from the DT? We would be covering more code that way.
>
> Reviewed-by: Tomeu Vizoso <tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
The idea is that by putting this into debugfs we have a single source of
information to use in tests.
Now if in addition to merely testing the frequencies you want to make
sure the driver has a consistent representation of what's in device tree
we could always write another test that reads the device tree nodes and
compares them to the list of supported rates from debugfs.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] memory: tegra: Expose supported rates via debugfs
@ 2015-05-19 14:36 ` Thierry Reding
0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-05-19 14:36 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, May 19, 2015 at 02:21:01PM +0200, Tomeu Vizoso wrote:
> On 18 May 2015 at 17:35, Thierry Reding <thierry.reding@gmail.com> wrote:
> > From: Thierry Reding <treding@nvidia.com>
> >
> > In order to ease testing, expose the list of supported EMC frequencies
> > via debugfs.
>
> Looks good to me, but if this is for automated testing, why not just
> read the timings from the DT? We would be covering more code that way.
>
> Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
The idea is that by putting this into debugfs we have a single source of
information to use in tests.
Now if in addition to merely testing the frequencies you want to make
sure the driver has a consistent representation of what's in device tree
we could always write another test that reads the device tree nodes and
compares them to the list of supported rates from debugfs.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150519/9abd9450/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-05-19 14:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-18 15:35 [PATCH] memory: tegra: Expose supported rates via debugfs Thierry Reding
2015-05-18 15:35 ` Thierry Reding
[not found] ` <1431963330-25708-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-19 12:21 ` Tomeu Vizoso
2015-05-19 12:21 ` Tomeu Vizoso
[not found] ` <CAAObsKCo7x4qMdPvBb-dNoN=j7Od-eMCxw9BNoSvDR5mUZXGtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-19 14:36 ` Thierry Reding
2015-05-19 14:36 ` Thierry Reding
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.