lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211203141515.2448129-1-dev_public@wujek.eu>
Date:   Fri, 03 Dec 2021 14:15:31 +0000
From:   Adam Wujek <dev_public@...ek.eu>
To:     Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>
Cc:     Adam Wujek <dev_public@...ek.eu>, linux-clk@...r.kernel.org,
        linux-kernel@...r.kernel.org
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 <dev_public@...ek.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ