2021-12-03 14:15:41

by Adam Wujek

[permalink] [raw]
Subject: [PATCH] clk: si5341: Add sysfs property to check selected input

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 <[email protected]>
---
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




2021-12-06 22:54:30

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] clk: si5341: Add sysfs property to check selected input

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 <[email protected]>
> ---
> drivers/clk/clk-si5341.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)

sysfs properties need documentation in Documentation/ABI/

2021-12-06 23:08:09

by Adam Wujek

[permalink] [raw]
Subject: Re: [PATCH] clk: si5341: Add sysfs property to check selected input

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 <[email protected]> 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 [email protected]
> > ---------------------------------------------
> >
> > drivers/clk/clk-si5341.c | 19 +++++++++++++++++++
> >
> > 1 file changed, 19 insertions(+)
>
> sysfs properties need documentation in Documentation/ABI/

2021-12-08 04:30:59

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] clk: si5341: Add sysfs property to check selected input

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?

2021-12-09 12:04:55

by Adam Wujek

[permalink] [raw]
Subject: Re: [PATCH] clk: si5341: Add sysfs property to check selected input



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

On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd <[email protected]> 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).

2021-12-16 06:32:50

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] clk: si5341: Add sysfs property to check selected input

Quoting wujek dev (2021-12-09 04:04:48)
>
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd <[email protected]> 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?

2021-12-16 14:26:04

by Adam Wujek

[permalink] [raw]
Subject: Re: [PATCH] clk: si5341: Add sysfs property to check selected input



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

On Thursday, December 16th, 2021 at 07:32, Stephen Boyd <[email protected]> wrote:

> Quoting wujek dev (2021-12-09 04:04:48)
>
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> >
> > On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd [email protected] 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.

2021-12-17 01:47:40

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] clk: si5341: Add sysfs property to check selected input

Quoting wujek dev (2021-12-16 06:25:58)
>
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Thursday, December 16th, 2021 at 07:32, Stephen Boyd <[email protected]> wrote:
>
> > Quoting wujek dev (2021-12-09 04:04:48)
> >
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > >
> > > On Wednesday, December 8th, 2021 at 05:30, Stephen Boyd [email protected] 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?