linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: si5341: Add sysfs property to check selected input
@ 2021-12-03 14:15 Adam Wujek
  2021-12-06 22:53 ` Stephen Boyd
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Wujek @ 2021-12-03 14:15 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd; +Cc: Adam Wujek, linux-clk, linux-kernel

Add a sysfs property to check the selected input.
<input_num> <input_name> <input_name_from_DTB>
E.g.:
cat input_selected
0 in0 WR25M

Signed-off-by: Adam Wujek <dev_public@wujek.eu>
---
 drivers/clk/clk-si5341.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 57ae183982d8..b7641abe6747 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -1536,12 +1536,31 @@ static ssize_t clear_sticky_store(struct device *dev,
 }
 static DEVICE_ATTR_WO(clear_sticky);

+static ssize_t input_selected_show(struct device *dev,
+			       struct device_attribute *attr,
+			       char *buf)
+{
+	struct clk_si5341 *data = dev_get_drvdata(dev);
+	int res = si5341_clk_get_selected_input(data);
+	const char *input_name_dtb;
+
+	if (res < 0)
+		return res;
+	input_name_dtb =  __clk_get_name(devm_clk_get(dev,
+						si5341_input_clock_names[res]));
+	/* input id, input name, input name from DTB */
+	return snprintf(buf, PAGE_SIZE, "%d %s %s\n", res,
+			si5341_input_clock_names[res], input_name_dtb);
+}
+static DEVICE_ATTR_RO(input_selected);
+
 static const struct attribute *si5341_attributes[] = {
 	&dev_attr_input_present.attr,
 	&dev_attr_input_present_sticky.attr,
 	&dev_attr_pll_locked.attr,
 	&dev_attr_pll_locked_sticky.attr,
 	&dev_attr_clear_sticky.attr,
+	&dev_attr_input_selected.attr,
 	NULL
 };

--
2.17.1



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

* Re: [PATCH] clk: si5341: Add sysfs property to check selected input
  2021-12-03 14:15 [PATCH] clk: si5341: Add sysfs property to check selected input Adam Wujek
@ 2021-12-06 22:53 ` Stephen Boyd
  2021-12-06 23:08   ` wujek dev
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Boyd @ 2021-12-06 22:53 UTC (permalink / raw)
  To: Adam Wujek, Michael Turquette; +Cc: Adam Wujek, linux-clk, linux-kernel

Quoting Adam Wujek (2021-12-03 06:15:31)
> Add a sysfs property to check the selected input.
> <input_num> <input_name> <input_name_from_DTB>
> E.g.:
> cat input_selected
> 0 in0 WR25M
> 
> Signed-off-by: Adam Wujek <dev_public@wujek.eu>
> ---
>  drivers/clk/clk-si5341.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

sysfs properties need documentation in Documentation/ABI/

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

* Re: [PATCH] clk: si5341: Add sysfs property to check selected input
  2021-12-06 22:53 ` Stephen Boyd
@ 2021-12-06 23:08   ` wujek dev
  2021-12-08  4:30     ` Stephen Boyd
  0 siblings, 1 reply; 8+ messages in thread
From: wujek dev @ 2021-12-06 23:08 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Michael Turquette, linux-clk, linux-kernel

Other sysfs properties used by this driver are not documented so I didn't add for this one. Even more not a single property from clk subsystem is described. Shall I the add description of this single property?

BR,
Adam

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Monday, December 6th, 2021 at 23:53, Stephen Boyd <sboyd@kernel.org> wrote:

> Quoting Adam Wujek (2021-12-03 06:15:31)
>
> > Add a sysfs property to check the selected input.
> >
> > <input_num> <input_name> <input_name_from_DTB>
> >
> > E.g.:
> >
> > cat input_selected
> >
> > 0 in0 WR25M
> >
> > Signed-off-by: Adam Wujek dev_public@wujek.eu
> > ---------------------------------------------
> >
> > drivers/clk/clk-si5341.c | 19 +++++++++++++++++++
> >
> > 1 file changed, 19 insertions(+)
>
> sysfs properties need documentation in Documentation/ABI/

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

* Re: [PATCH] clk: si5341: Add sysfs property to check selected input
  2021-12-06 23:08   ` wujek dev
@ 2021-12-08  4:30     ` Stephen Boyd
  2021-12-09 12:04       ` wujek dev
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Boyd @ 2021-12-08  4:30 UTC (permalink / raw)
  To: wujek dev; +Cc: Michael Turquette, linux-clk, linux-kernel

Quoting wujek dev (2021-12-06 15:08:03)
> Other sysfs properties used by this driver are not documented so I didn't add for this one. Even more not a single property from clk subsystem is described. Shall I the add description of this single property?
> 

Please don't top post. sysfs properties are supposed to be single value
and for machine consumption. Is this a debugfs property?

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

* Re: [PATCH] clk: si5341: Add sysfs property to check selected input
  2021-12-08  4:30     ` Stephen Boyd
@ 2021-12-09 12:04       ` wujek dev
  2021-12-16  6:32         ` Stephen Boyd
  0 siblings, 1 reply; 8+ messages in thread
From: wujek dev @ 2021-12-09 12:04 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Michael Turquette, linux-clk, linux-kernel



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd <sboyd@kernel.org> wrote:

> Quoting wujek dev (2021-12-06 15:08:03)
>
> > Other sysfs properties used by this driver are not documented so I didn't add for this one. Even more not a single property from clk subsystem is described. Shall I the add description of this single property?
>
> Please don't top post. sysfs properties are supposed to be single value
>
> and for machine consumption. Is this a debugfs property?
No, I think this is rather sysfs than debugfs. The type of information is similar to other reported by this driver. The values in the added property are the same, this is just a different representation (input selected as an int, as string based on manual and as string as described in the DTB).

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

* Re: [PATCH] clk: si5341: Add sysfs property to check selected input
  2021-12-09 12:04       ` wujek dev
@ 2021-12-16  6:32         ` Stephen Boyd
  2021-12-16 14:25           ` wujek dev
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Boyd @ 2021-12-16  6:32 UTC (permalink / raw)
  To: wujek dev; +Cc: Michael Turquette, linux-clk, linux-kernel

Quoting wujek dev (2021-12-09 04:04:48)
> 
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> 
> On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd <sboyd@kernel.org> wrote:
> 
> > Quoting wujek dev (2021-12-06 15:08:03)
> >
> > > Other sysfs properties used by this driver are not documented so I didn't add for this one. Even more not a single property from clk subsystem is described. Shall I the add description of this single property?
> >
> > Please don't top post. sysfs properties are supposed to be single value
> >
> > and for machine consumption. Is this a debugfs property?
> No, I think this is rather sysfs than debugfs. The type of information is similar to other reported by this driver. The values in the added property are the same, this is just a different representation (input selected as an int, as string based on manual and as string as described in the DTB).

Ok what program is going to check the selected input?

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

* Re: [PATCH] clk: si5341: Add sysfs property to check selected input
  2021-12-16  6:32         ` Stephen Boyd
@ 2021-12-16 14:25           ` wujek dev
  2021-12-17  1:47             ` Stephen Boyd
  0 siblings, 1 reply; 8+ messages in thread
From: wujek dev @ 2021-12-16 14:25 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Michael Turquette, linux-clk, linux-kernel



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Thursday, December 16th, 2021 at 07:32, Stephen Boyd <sboyd@kernel.org> wrote:

> Quoting wujek dev (2021-12-09 04:04:48)
>
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> >
> > On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd sboyd@kernel.org wrote:
> >
> > > Quoting wujek dev (2021-12-06 15:08:03)
> > >
> > > > Other sysfs properties used by this driver are not documented so I didn't add for this one. Even more not a single property from clk subsystem is described. Shall I the add description of this single property?
> > >
> > > Please don't top post. sysfs properties are supposed to be single value
> > >
> > > and for machine consumption. Is this a debugfs property?
> > >
> > > No, I think this is rather sysfs than debugfs. The type of information is similar to other reported by this driver. The values in the added property are the same, this is just a different representation (input selected as an int, as string based on manual and as string as described in the DTB).
>
> Ok what program is going to check the selected input?
So far, only the project specific program. I'm not aware about a standard tool that check other (already available) properties from this driver.

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

* Re: [PATCH] clk: si5341: Add sysfs property to check selected input
  2021-12-16 14:25           ` wujek dev
@ 2021-12-17  1:47             ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2021-12-17  1:47 UTC (permalink / raw)
  To: wujek dev; +Cc: Michael Turquette, linux-clk, linux-kernel

Quoting wujek dev (2021-12-16 06:25:58)
> 
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> 
> On Thursday, December 16th, 2021 at 07:32, Stephen Boyd <sboyd@kernel.org> wrote:
> 
> > Quoting wujek dev (2021-12-09 04:04:48)
> >
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > >
> > > On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd sboyd@kernel.org wrote:
> > >
> > > > Quoting wujek dev (2021-12-06 15:08:03)
> > > >
> > > > > Other sysfs properties used by this driver are not documented so I didn't add for this one. Even more not a single property from clk subsystem is described. Shall I the add description of this single property?
> > > >
> > > > Please don't top post. sysfs properties are supposed to be single value
> > > >
> > > > and for machine consumption. Is this a debugfs property?
> > > >
> > > > No, I think this is rather sysfs than debugfs. The type of information is similar to other reported by this driver. The values in the added property are the same, this is just a different representation (input selected as an int, as string based on manual and as string as described in the DTB).
> >
> > Ok what program is going to check the selected input?
> So far, only the project specific program. I'm not aware about a standard tool that check other (already available) properties from this driver.

Why doesn't clk debugfs that indicates the parents of a clk work here?

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

end of thread, other threads:[~2021-12-17  1:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 14:15 [PATCH] clk: si5341: Add sysfs property to check selected input Adam Wujek
2021-12-06 22:53 ` Stephen Boyd
2021-12-06 23:08   ` wujek dev
2021-12-08  4:30     ` Stephen Boyd
2021-12-09 12:04       ` wujek dev
2021-12-16  6:32         ` Stephen Boyd
2021-12-16 14:25           ` wujek dev
2021-12-17  1:47             ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).