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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 25 Jun 2023 14:21:34 +0000
From:   Eliav Farber <farbere@...zon.com>
To:     <giometti@...eenne.com>, <robh+dt@...nel.org>,
        <krzysztof.kozlowski+dt@...aro.org>, <conor+dt@...nel.org>,
        <farbere@...zon.com>, <devicetree@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <ronenk@...zon.com>, <talel@...zon.com>, <hhhawa@...zon.com>,
        <jonnyc@...zon.com>, <itamark@...zon.com>, <shellykz@...zon.com>,
        <amitlavi@...zon.com>, <almogbs@...zon.com>
Subject: [PATCH 5/5] pps: clients: gpio: enable pps pulse-width calculations based on device-tree

This change adds setting of PPS_WIDTHASSERT and PPS_WIDTHCLEAR modes to
enable PPS pulse-width calculation.

Width calculation will be enabled if
 - assert-pulse-width
 - clear-pulse-width
boolean properties exist in device-tree.

Signed-off-by: Eliav Farber <farbere@...zon.com>
---
 drivers/pps/clients/pps-gpio.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index a61dc1299ce9..ca4b8047e924 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -33,6 +33,8 @@ struct pps_gpio_device_data {
 	struct timer_list echo_timer;	/* timer to reset echo active state */
 	bool assert_falling_edge;
 	bool capture_clear;
+	bool assert_pulse_width;
+	bool clear_pulse_width;
 	unsigned int echo_active_ms;	/* PPS echo active duration */
 	unsigned long echo_timeout;	/* timer timeout value in jiffies */
 };
@@ -113,6 +115,10 @@ static int pps_gpio_setup(struct device *dev)
 	data->assert_falling_edge =
 		device_property_read_bool(dev, "assert-falling-edge");
 	data->capture_clear = device_property_read_bool(dev, "capture-clear");
+	data->assert_pulse_width =
+		device_property_read_bool(dev, "assert-pulse-width");
+	data->clear_pulse_width =
+		device_property_read_bool(dev, "clear-pulse-width");
 
 	data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
 	if (IS_ERR(data->echo_pin))
@@ -186,6 +192,10 @@ static int pps_gpio_probe(struct platform_device *pdev)
 	if (data->capture_clear)
 		data->info.mode |= PPS_CAPTURECLEAR | PPS_OFFSETCLEAR |
 			PPS_ECHOCLEAR;
+	if (data->assert_pulse_width)
+		data->info.mode |= PPS_WIDTHASSERT;
+	if (data->clear_pulse_width)
+		data->info.mode |= PPS_WIDTHCLEAR;
 	data->info.owner = THIS_MODULE;
 	snprintf(data->info.name, PPS_MAX_NAME_LEN - 1, "%s.%d",
 		 pdev->name, pdev->id);
@@ -199,6 +209,10 @@ static int pps_gpio_probe(struct platform_device *pdev)
 	pps_default_params = PPS_CAPTUREASSERT | PPS_OFFSETASSERT;
 	if (data->capture_clear)
 		pps_default_params |= PPS_CAPTURECLEAR | PPS_OFFSETCLEAR;
+	if (data->assert_pulse_width)
+		pps_default_params |= PPS_WIDTHASSERT;
+	if (data->clear_pulse_width)
+		pps_default_params |= PPS_WIDTHCLEAR;
 	data->pps = pps_register_source(&data->info, pps_default_params);
 	if (IS_ERR(data->pps)) {
 		dev_err(dev, "failed to register IRQ %d as PPS source\n",
-- 
2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ