All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  2:38 ` Pankaj Dev
  0 siblings, 0 replies; 12+ messages in thread
From: Pankaj Dev @ 2016-02-26  2:38 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: mturquette, sboyd, lee.jones, kernel, devicetree,
	laurent.meunier, maxime.coquelin, pankaj.dev

To enhance debug interface for clocks, we add the following
interfaces to the clock nodes created at
/sys/kernel/debug/clk/CLOCK_NAME

1. clk_set_rate : Set new rate to value. Reading returns the
current rate
2. clk_set_parent : Set new parent to parent-name. Reading
returns the current parent
3. clk_prepare_enable : Call clk_prepare_enable X times,
X is the input value
4. clk_disable_unprepare : Call clk_disable_unprepare X
times, X is the input value

This is particularly useful during SoC bring-up phase, and also when
drivers want to verify if some issue is caused by clocks turning off at
wrong moments.

Signed-off-by: Pankaj Dev <pankaj.dev@st.com>

---
 drivers/clk/clk.c |  143 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index cbc72a1..aa08023 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -21,6 +21,7 @@
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/uaccess.h>
 
 #include "clk.h"
 
@@ -348,6 +349,128 @@ static const struct file_operations clk_dump_fops = {
 	.release	= single_release,
 };
 
+/* Debugfs set_rate entry */
+static int clk_debug_rate_get(void *data, u64 *rate)
+{
+	struct clk_core *c = data;
+
+	*rate = clk_get_rate(c->hw->clk);
+
+	return 0;
+}
+
+static int clk_debug_rate_set(void *data, u64 rate)
+{
+	struct clk_core *c = data;
+
+	return clk_set_rate(c->hw->clk, rate);
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_rate_fops, clk_debug_rate_get,
+			clk_debug_rate_set, "%lld\n");
+
+/* Debugfs prepare_enable entry */
+static int clk_debug_prep_enable(void *data, u64 count)
+{
+	struct clk_core *c = data;
+	int i, ret = 0;
+
+	for (i = 0; i < count; i++) {
+		ret = clk_prepare_enable(c->hw->clk);
+		if (ret)
+			return ret;
+	}
+
+	return ret;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_prep_enable_fops, NULL,
+			clk_debug_prep_enable, "%lld\n");
+
+/* Debugfs disable_unprepare entry */
+static int clk_debug_disable_unprep(void *data, u64 count)
+{
+	struct clk_core *c = data;
+	int i;
+
+	for (i = 0; i < count; i++)
+		clk_disable_unprepare(c->hw->clk);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_disable_unprep_fops, NULL,
+			clk_debug_disable_unprep, "%lld\n");
+
+/* Debugfs set_parent entry */
+static int clk_debug_parent_get(struct file *file,
+					char __user *user_buf,
+					size_t count, loff_t *ppos)
+{
+	struct clk_core *c = file->private_data;
+	struct clk *p;
+	int ret;
+
+	if (*ppos)		/* continued read */
+		return 0;
+
+	p = clk_get_parent(c->hw->clk);
+	count = min(strlen(__clk_get_name(p)), count);
+
+	ret = copy_to_user(user_buf, __clk_get_name(p), count);
+	if (ret) {
+		pr_err("%s: error reading data\n", __func__);
+		return -EINVAL;
+	}
+
+	/* Add \n */
+	ret = copy_to_user(user_buf + count, "\n", 1);
+	if (ret) {
+		pr_err("%s: error reading data\n", __func__);
+		return -EINVAL;
+	}
+	count++;
+
+	*ppos += count;
+
+	return count;
+}
+
+static int clk_debug_parent_set(struct file *file,
+					const char __user *user_buf,
+					size_t count, loff_t *ppos)
+{
+	struct clk_core *c = file->private_data;
+	struct clk *p;
+	char pname[50]; /* 50 char shud be enough for clock name + \0 */
+	int ret;
+
+	count = min(sizeof(pname), count);
+	strncpy_from_user(pname, user_buf, count);
+	pname[count - 1] = 0; /* NULL terminate */
+
+	p = __clk_lookup(pname);
+	if (!p) {
+			pr_err("%s: %s not found\n", __func__, pname);
+			return -EINVAL;
+	}
+
+	ret = clk_set_parent(c->hw->clk, p);
+	if (ret) {
+		pr_err("%s: %s Incorrect Argument\n", __func__, pname);
+		return -EINVAL;
+	}
+
+	return count;
+}
+
+static const struct file_operations clk_debug_parent_fops = {
+	.open = simple_open,
+	.read		= clk_debug_parent_get,
+	.write		= clk_debug_parent_set,
+};
+
+/* caller must hold prepare_lock */
 static int clk_debug_create_one(struct clk_core *clk, struct dentry *pdentry)
 {
 	struct dentry *d;
@@ -405,6 +528,26 @@ static int clk_debug_create_one(struct clk_core *clk, struct dentry *pdentry)
 			goto err_out;
 	}
 
+	d = debugfs_create_file("clk_set_rate", S_IRUGO | S_IWUSR, clk->dentry,
+				clk, &clk_debug_rate_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_set_parent", S_IRUGO | S_IWUSR,
+				clk->dentry, clk, &clk_debug_parent_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_prepare_enable", S_IWUSR, clk->dentry,
+				clk, &clk_debug_prep_enable_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_disable_unprepare", S_IWUSR, clk->dentry,
+				clk, &clk_debug_disable_unprep_fops);
+	if (!d)
+		goto err_out;
+
 	ret = 0;
 	goto out;
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  2:38 ` Pankaj Dev
  0 siblings, 0 replies; 12+ messages in thread
From: Pankaj Dev @ 2016-02-26  2:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: mturquette-QSEj5FYQhm4dnm+yROfE0A, sboyd-sgV2jX0FEOL9JmXXK+q4OQ,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A, kernel-F5mvAk5X5gdBDgjK7y7TUQ,
	devicetree-u79uwXL29TY76Z2rM5mHXA, laurent.meunier-qxv4g6HH51o,
	maxime.coquelin-qxv4g6HH51o, pankaj.dev-qxv4g6HH51o

To enhance debug interface for clocks, we add the following
interfaces to the clock nodes created at
/sys/kernel/debug/clk/CLOCK_NAME

1. clk_set_rate : Set new rate to value. Reading returns the
current rate
2. clk_set_parent : Set new parent to parent-name. Reading
returns the current parent
3. clk_prepare_enable : Call clk_prepare_enable X times,
X is the input value
4. clk_disable_unprepare : Call clk_disable_unprepare X
times, X is the input value

This is particularly useful during SoC bring-up phase, and also when
drivers want to verify if some issue is caused by clocks turning off at
wrong moments.

Signed-off-by: Pankaj Dev <pankaj.dev-qxv4g6HH51o@public.gmane.org>

---
 drivers/clk/clk.c |  143 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index cbc72a1..aa08023 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -21,6 +21,7 @@
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/uaccess.h>
 
 #include "clk.h"
 
@@ -348,6 +349,128 @@ static const struct file_operations clk_dump_fops = {
 	.release	= single_release,
 };
 
+/* Debugfs set_rate entry */
+static int clk_debug_rate_get(void *data, u64 *rate)
+{
+	struct clk_core *c = data;
+
+	*rate = clk_get_rate(c->hw->clk);
+
+	return 0;
+}
+
+static int clk_debug_rate_set(void *data, u64 rate)
+{
+	struct clk_core *c = data;
+
+	return clk_set_rate(c->hw->clk, rate);
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_rate_fops, clk_debug_rate_get,
+			clk_debug_rate_set, "%lld\n");
+
+/* Debugfs prepare_enable entry */
+static int clk_debug_prep_enable(void *data, u64 count)
+{
+	struct clk_core *c = data;
+	int i, ret = 0;
+
+	for (i = 0; i < count; i++) {
+		ret = clk_prepare_enable(c->hw->clk);
+		if (ret)
+			return ret;
+	}
+
+	return ret;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_prep_enable_fops, NULL,
+			clk_debug_prep_enable, "%lld\n");
+
+/* Debugfs disable_unprepare entry */
+static int clk_debug_disable_unprep(void *data, u64 count)
+{
+	struct clk_core *c = data;
+	int i;
+
+	for (i = 0; i < count; i++)
+		clk_disable_unprepare(c->hw->clk);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_disable_unprep_fops, NULL,
+			clk_debug_disable_unprep, "%lld\n");
+
+/* Debugfs set_parent entry */
+static int clk_debug_parent_get(struct file *file,
+					char __user *user_buf,
+					size_t count, loff_t *ppos)
+{
+	struct clk_core *c = file->private_data;
+	struct clk *p;
+	int ret;
+
+	if (*ppos)		/* continued read */
+		return 0;
+
+	p = clk_get_parent(c->hw->clk);
+	count = min(strlen(__clk_get_name(p)), count);
+
+	ret = copy_to_user(user_buf, __clk_get_name(p), count);
+	if (ret) {
+		pr_err("%s: error reading data\n", __func__);
+		return -EINVAL;
+	}
+
+	/* Add \n */
+	ret = copy_to_user(user_buf + count, "\n", 1);
+	if (ret) {
+		pr_err("%s: error reading data\n", __func__);
+		return -EINVAL;
+	}
+	count++;
+
+	*ppos += count;
+
+	return count;
+}
+
+static int clk_debug_parent_set(struct file *file,
+					const char __user *user_buf,
+					size_t count, loff_t *ppos)
+{
+	struct clk_core *c = file->private_data;
+	struct clk *p;
+	char pname[50]; /* 50 char shud be enough for clock name + \0 */
+	int ret;
+
+	count = min(sizeof(pname), count);
+	strncpy_from_user(pname, user_buf, count);
+	pname[count - 1] = 0; /* NULL terminate */
+
+	p = __clk_lookup(pname);
+	if (!p) {
+			pr_err("%s: %s not found\n", __func__, pname);
+			return -EINVAL;
+	}
+
+	ret = clk_set_parent(c->hw->clk, p);
+	if (ret) {
+		pr_err("%s: %s Incorrect Argument\n", __func__, pname);
+		return -EINVAL;
+	}
+
+	return count;
+}
+
+static const struct file_operations clk_debug_parent_fops = {
+	.open = simple_open,
+	.read		= clk_debug_parent_get,
+	.write		= clk_debug_parent_set,
+};
+
+/* caller must hold prepare_lock */
 static int clk_debug_create_one(struct clk_core *clk, struct dentry *pdentry)
 {
 	struct dentry *d;
@@ -405,6 +528,26 @@ static int clk_debug_create_one(struct clk_core *clk, struct dentry *pdentry)
 			goto err_out;
 	}
 
+	d = debugfs_create_file("clk_set_rate", S_IRUGO | S_IWUSR, clk->dentry,
+				clk, &clk_debug_rate_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_set_parent", S_IRUGO | S_IWUSR,
+				clk->dentry, clk, &clk_debug_parent_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_prepare_enable", S_IWUSR, clk->dentry,
+				clk, &clk_debug_prep_enable_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_disable_unprepare", S_IWUSR, clk->dentry,
+				clk, &clk_debug_disable_unprep_fops);
+	if (!d)
+		goto err_out;
+
 	ret = 0;
 	goto out;
 
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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 related	[flat|nested] 12+ messages in thread

* [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  2:38 ` Pankaj Dev
  0 siblings, 0 replies; 12+ messages in thread
From: Pankaj Dev @ 2016-02-26  2:38 UTC (permalink / raw)
  To: linux-arm-kernel

To enhance debug interface for clocks, we add the following
interfaces to the clock nodes created at
/sys/kernel/debug/clk/CLOCK_NAME

1. clk_set_rate : Set new rate to value. Reading returns the
current rate
2. clk_set_parent : Set new parent to parent-name. Reading
returns the current parent
3. clk_prepare_enable : Call clk_prepare_enable X times,
X is the input value
4. clk_disable_unprepare : Call clk_disable_unprepare X
times, X is the input value

This is particularly useful during SoC bring-up phase, and also when
drivers want to verify if some issue is caused by clocks turning off at
wrong moments.

Signed-off-by: Pankaj Dev <pankaj.dev@st.com>

---
 drivers/clk/clk.c |  143 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index cbc72a1..aa08023 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -21,6 +21,7 @@
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/uaccess.h>
 
 #include "clk.h"
 
@@ -348,6 +349,128 @@ static const struct file_operations clk_dump_fops = {
 	.release	= single_release,
 };
 
+/* Debugfs set_rate entry */
+static int clk_debug_rate_get(void *data, u64 *rate)
+{
+	struct clk_core *c = data;
+
+	*rate = clk_get_rate(c->hw->clk);
+
+	return 0;
+}
+
+static int clk_debug_rate_set(void *data, u64 rate)
+{
+	struct clk_core *c = data;
+
+	return clk_set_rate(c->hw->clk, rate);
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_rate_fops, clk_debug_rate_get,
+			clk_debug_rate_set, "%lld\n");
+
+/* Debugfs prepare_enable entry */
+static int clk_debug_prep_enable(void *data, u64 count)
+{
+	struct clk_core *c = data;
+	int i, ret = 0;
+
+	for (i = 0; i < count; i++) {
+		ret = clk_prepare_enable(c->hw->clk);
+		if (ret)
+			return ret;
+	}
+
+	return ret;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_prep_enable_fops, NULL,
+			clk_debug_prep_enable, "%lld\n");
+
+/* Debugfs disable_unprepare entry */
+static int clk_debug_disable_unprep(void *data, u64 count)
+{
+	struct clk_core *c = data;
+	int i;
+
+	for (i = 0; i < count; i++)
+		clk_disable_unprepare(c->hw->clk);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_debug_disable_unprep_fops, NULL,
+			clk_debug_disable_unprep, "%lld\n");
+
+/* Debugfs set_parent entry */
+static int clk_debug_parent_get(struct file *file,
+					char __user *user_buf,
+					size_t count, loff_t *ppos)
+{
+	struct clk_core *c = file->private_data;
+	struct clk *p;
+	int ret;
+
+	if (*ppos)		/* continued read */
+		return 0;
+
+	p = clk_get_parent(c->hw->clk);
+	count = min(strlen(__clk_get_name(p)), count);
+
+	ret = copy_to_user(user_buf, __clk_get_name(p), count);
+	if (ret) {
+		pr_err("%s: error reading data\n", __func__);
+		return -EINVAL;
+	}
+
+	/* Add \n */
+	ret = copy_to_user(user_buf + count, "\n", 1);
+	if (ret) {
+		pr_err("%s: error reading data\n", __func__);
+		return -EINVAL;
+	}
+	count++;
+
+	*ppos += count;
+
+	return count;
+}
+
+static int clk_debug_parent_set(struct file *file,
+					const char __user *user_buf,
+					size_t count, loff_t *ppos)
+{
+	struct clk_core *c = file->private_data;
+	struct clk *p;
+	char pname[50]; /* 50 char shud be enough for clock name + \0 */
+	int ret;
+
+	count = min(sizeof(pname), count);
+	strncpy_from_user(pname, user_buf, count);
+	pname[count - 1] = 0; /* NULL terminate */
+
+	p = __clk_lookup(pname);
+	if (!p) {
+			pr_err("%s: %s not found\n", __func__, pname);
+			return -EINVAL;
+	}
+
+	ret = clk_set_parent(c->hw->clk, p);
+	if (ret) {
+		pr_err("%s: %s Incorrect Argument\n", __func__, pname);
+		return -EINVAL;
+	}
+
+	return count;
+}
+
+static const struct file_operations clk_debug_parent_fops = {
+	.open = simple_open,
+	.read		= clk_debug_parent_get,
+	.write		= clk_debug_parent_set,
+};
+
+/* caller must hold prepare_lock */
 static int clk_debug_create_one(struct clk_core *clk, struct dentry *pdentry)
 {
 	struct dentry *d;
@@ -405,6 +528,26 @@ static int clk_debug_create_one(struct clk_core *clk, struct dentry *pdentry)
 			goto err_out;
 	}
 
+	d = debugfs_create_file("clk_set_rate", S_IRUGO | S_IWUSR, clk->dentry,
+				clk, &clk_debug_rate_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_set_parent", S_IRUGO | S_IWUSR,
+				clk->dentry, clk, &clk_debug_parent_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_prepare_enable", S_IWUSR, clk->dentry,
+				clk, &clk_debug_prep_enable_fops);
+	if (!d)
+		goto err_out;
+
+	d = debugfs_create_file("clk_disable_unprepare", S_IWUSR, clk->dentry,
+				clk, &clk_debug_disable_unprep_fops);
+	if (!d)
+		goto err_out;
+
 	ret = 0;
 	goto out;
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
  2016-02-26  2:38 ` Pankaj Dev
  (?)
@ 2016-02-26  7:24   ` Holger Schurig
  -1 siblings, 0 replies; 12+ messages in thread
From: Holger Schurig @ 2016-02-26  7:24 UTC (permalink / raw)
  To: Pankaj Dev
  Cc: linux-arm-kernel, linux-kernel, devicetree, mturquette, kernel,
	sboyd, laurent.meunier, lee.jones, maxime.coquelin

Pankaj Dev <pankaj.dev@st.com> writes:

> 1. clk_set_rate : Set new rate to value. Reading returns the
> current rate

If you can use this to set *and* read it, then "_set_" shouldn't be in
the name.

What is wrong with using the existing "clk_rate" for reading/setting the
rate?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  7:24   ` Holger Schurig
  0 siblings, 0 replies; 12+ messages in thread
From: Holger Schurig @ 2016-02-26  7:24 UTC (permalink / raw)
  To: Pankaj Dev
  Cc: linux-arm-kernel, linux-kernel, devicetree, mturquette, kernel,
	sboyd, laurent.meunier, lee.jones, maxime.coquelin

Pankaj Dev <pankaj.dev@st.com> writes:

> 1. clk_set_rate : Set new rate to value. Reading returns the
> current rate

If you can use this to set *and* read it, then "_set_" shouldn't be in
the name.

What is wrong with using the existing "clk_rate" for reading/setting the
rate?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  7:24   ` Holger Schurig
  0 siblings, 0 replies; 12+ messages in thread
From: Holger Schurig @ 2016-02-26  7:24 UTC (permalink / raw)
  To: linux-arm-kernel

Pankaj Dev <pankaj.dev@st.com> writes:

> 1. clk_set_rate : Set new rate to value. Reading returns the
> current rate

If you can use this to set *and* read it, then "_set_" shouldn't be in
the name.

What is wrong with using the existing "clk_rate" for reading/setting the
rate?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
  2016-02-26  7:24   ` Holger Schurig
  (?)
@ 2016-02-26  8:06     ` Pankaj DEV
  -1 siblings, 0 replies; 12+ messages in thread
From: Pankaj DEV @ 2016-02-26  8:06 UTC (permalink / raw)
  To: Holger Schurig
  Cc: linux-arm-kernel, linux-kernel, devicetree, mturquette, kernel,
	sboyd, Laurent MEUNIER, lee.jones, Maxime COQUELIN

Hey

The prime motive for clk_set_rate is to set new rate for a clock, since the 'clk_rate' currently available, allows only reading.
To provide reading rate from 'clk_set_rate' is just additional feature.

Regards
Pankaj

>-----Original Message-----
>From: Holger Schurig [mailto:holgerschurig@gmail.com]
>Sent: Friday, February 26, 2016 12:54 PM
>To: Pankaj DEV
>Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
>devicetree@vger.kernel.org; mturquette@linaro.org; kernel@stlinux.com;
>sboyd@codeaurora.org; Laurent MEUNIER; lee.jones@linaro.org; Maxime
>COQUELIN
>Subject: Re: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-
>parent
>
>Pankaj Dev <pankaj.dev@st.com> writes:
>
>> 1. clk_set_rate : Set new rate to value. Reading returns the current
>> rate
>
>If you can use this to set *and* read it, then "_set_" shouldn't be in the name.
>
>What is wrong with using the existing "clk_rate" for reading/setting the rate?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  8:06     ` Pankaj DEV
  0 siblings, 0 replies; 12+ messages in thread
From: Pankaj DEV @ 2016-02-26  8:06 UTC (permalink / raw)
  To: Holger Schurig
  Cc: linux-arm-kernel, linux-kernel, devicetree, mturquette, kernel,
	sboyd, Laurent MEUNIER, lee.jones, Maxime COQUELIN

Hey

The prime motive for clk_set_rate is to set new rate for a clock, since the 'clk_rate' currently available, allows only reading.
To provide reading rate from 'clk_set_rate' is just additional feature.

Regards
Pankaj

>-----Original Message-----
>From: Holger Schurig [mailto:holgerschurig@gmail.com]
>Sent: Friday, February 26, 2016 12:54 PM
>To: Pankaj DEV
>Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
>devicetree@vger.kernel.org; mturquette@linaro.org; kernel@stlinux.com;
>sboyd@codeaurora.org; Laurent MEUNIER; lee.jones@linaro.org; Maxime
>COQUELIN
>Subject: Re: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-
>parent
>
>Pankaj Dev <pankaj.dev@st.com> writes:
>
>> 1. clk_set_rate : Set new rate to value. Reading returns the current
>> rate
>
>If you can use this to set *and* read it, then "_set_" shouldn't be in the name.
>
>What is wrong with using the existing "clk_rate" for reading/setting the rate?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  8:06     ` Pankaj DEV
  0 siblings, 0 replies; 12+ messages in thread
From: Pankaj DEV @ 2016-02-26  8:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hey

The prime motive for clk_set_rate is to set new rate for a clock, since the 'clk_rate' currently available, allows only reading.
To provide reading rate from 'clk_set_rate' is just additional feature.

Regards
Pankaj

>-----Original Message-----
>From: Holger Schurig [mailto:holgerschurig at gmail.com]
>Sent: Friday, February 26, 2016 12:54 PM
>To: Pankaj DEV
>Cc: linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org;
>devicetree at vger.kernel.org; mturquette at linaro.org; kernel at stlinux.com;
>sboyd at codeaurora.org; Laurent MEUNIER; lee.jones at linaro.org; Maxime
>COQUELIN
>Subject: Re: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-
>parent
>
>Pankaj Dev <pankaj.dev@st.com> writes:
>
>> 1. clk_set_rate : Set new rate to value. Reading returns the current
>> rate
>
>If you can use this to set *and* read it, then "_set_" shouldn't be in the name.
>
>What is wrong with using the existing "clk_rate" for reading/setting the rate?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  8:22       ` Holger Schurig
  0 siblings, 0 replies; 12+ messages in thread
From: Holger Schurig @ 2016-02-26  8:22 UTC (permalink / raw)
  To: Pankaj DEV
  Cc: linux-arm-kernel, linux-kernel, devicetree, mturquette, kernel,
	sboyd, Laurent MEUNIER, lee.jones, Maxime COQUELIN

Pankaj DEV <pankaj.dev@st.com> writes:

> The prime motive for clk_set_rate is to set new rate for a clock,
> since the 'clk_rate' currently available, allows only reading.
> To provide reading rate from 'clk_set_rate' is just additional feature.

Sure.

But my point is to combine things.


After your patch:

- read via clk_rate
- read via clk_set_rate
- write via clk_set_rate

My proposal:

- read via clk_rate
- write via clk_rate

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  8:22       ` Holger Schurig
  0 siblings, 0 replies; 12+ messages in thread
From: Holger Schurig @ 2016-02-26  8:22 UTC (permalink / raw)
  To: Pankaj DEV
  Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	mturquette@linaro.org, kernel@stlinux.com, sboyd@codeaurora.org,
	Laurent MEUNIER, lee.jones@linaro.org, Maxime COQUELIN

Pankaj DEV <pankaj.dev-qxv4g6HH51o@public.gmane.org> writes:

> The prime motive for clk_set_rate is to set new rate for a clock,
> since the 'clk_rate' currently available, allows only reading.
> To provide reading rate from 'clk_set_rate' is just additional feature.

Sure.

But my point is to combine things.


After your patch:

- read via clk_rate
- read via clk_set_rate
- write via clk_set_rate

My proposal:

- read via clk_rate
- write via clk_rate
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 12+ messages in thread

* [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent
@ 2016-02-26  8:22       ` Holger Schurig
  0 siblings, 0 replies; 12+ messages in thread
From: Holger Schurig @ 2016-02-26  8:22 UTC (permalink / raw)
  To: linux-arm-kernel

Pankaj DEV <pankaj.dev@st.com> writes:

> The prime motive for clk_set_rate is to set new rate for a clock,
> since the 'clk_rate' currently available, allows only reading.
> To provide reading rate from 'clk_set_rate' is just additional feature.

Sure.

But my point is to combine things.


After your patch:

- read via clk_rate
- read via clk_set_rate
- write via clk_set_rate

My proposal:

- read via clk_rate
- write via clk_rate

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-02-26  8:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26  2:38 [RFC v1] clk: Add debugfs nodes for enable/disable/set-rate/set-parent Pankaj Dev
2016-02-26  2:38 ` Pankaj Dev
2016-02-26  2:38 ` Pankaj Dev
2016-02-26  7:24 ` Holger Schurig
2016-02-26  7:24   ` Holger Schurig
2016-02-26  7:24   ` Holger Schurig
2016-02-26  8:06   ` Pankaj DEV
2016-02-26  8:06     ` Pankaj DEV
2016-02-26  8:06     ` Pankaj DEV
2016-02-26  8:22     ` Holger Schurig
2016-02-26  8:22       ` Holger Schurig
2016-02-26  8:22       ` Holger Schurig

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.