From nobody Wed Nov 27 20:28:28 2024 Received: from smtpdh16-2.aruba.it (smtpdh16-2.aruba.it [62.149.155.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9504A1DF736 for ; Tue, 8 Oct 2024 13:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.149.155.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728395629; cv=none; b=fLW/Rk/PmQSKdPKyFFXg35pwF3dRtxP1hPOR9uz8rZADcM1ohvHSVtDrvrRgWjlpKDwx5iK8rzJIFZbqjNllC0fpucND1pTcrPWSuVKqXJnkjfXWd0aQ3+aE+JpGpG7rsfmY0HTL0jJWsjdX9SbniqcBfXdUYbdhovq0JNP9puY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728395629; c=relaxed/simple; bh=cdcJb9H8yy7FXPibF4xVZrLc+VV4/S0BBeF8nOGjdO8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=btCJr6TmX7aLEtUCJ/9jJvfWeu7vmghVmsLPbCUOkmIWsCVV6FybN7i/hnez3Q9BoFO9z7a7rZcmlRxIWBgCaCCyU2xRnoxJeSS0StQJj3jAiuVsLWImpNv73Psm4lWfSKtTuEB2ko1zXvyXRjfn593MVGOnTcKSmooUd6uoVus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=enneenne.com; spf=pass smtp.mailfrom=enneenne.com; dkim=pass (2048-bit key) header.d=aruba.it header.i=@aruba.it header.b=d7+ccx67; arc=none smtp.client-ip=62.149.155.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=enneenne.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=enneenne.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=aruba.it header.i=@aruba.it header.b="d7+ccx67" Received: from polimar.homenet.telecomitalia.it ([79.0.204.227]) by Aruba Outgoing Smtp with ESMTPSA id yAbisgixkbsngyAbksUWW3; Tue, 08 Oct 2024 15:50:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aruba.it; s=a1; t=1728395437; bh=cdcJb9H8yy7FXPibF4xVZrLc+VV4/S0BBeF8nOGjdO8=; h=From:To:Subject:Date:MIME-Version; b=d7+ccx67fpCFwxby7OiE7Qs+i6levIS/5JOKtlw3uX0B+j5CSt9vYE0K10LrfLscZ pr2jG4oebUqDOgJojv7X/cK5xkX5OeEORP3hcxEQTg0+zwYH7m+GZ0wItIMjH7TR8K xrujnFMX0M/VghA3/6G12B6GQ8NvaLk/Krw2bTOZ4rdrnb3PQcnHRD5n54WAA86yXl KBMj5EUDCfR/7Mf3S03Ez3OWgVl47m7Q6k0fXDW7gGV31oTl2lDskwWJti3QhB3923 kzd0jXSwbDmdqORGmYbq1CPSdeotVW+Z/zB5z++CjAzhLFYvVdmwO1NZYgToFiWvco q6h6114JxuPzw== From: Rodolfo Giometti To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Greg KH , corbet@lwn.net, Hall Christopher S , Mohan Subramanian , tglx@linutronix.de, andriy.shevchenko@linux.intel.com, Dong Eddie , N Pandith , T R Thejesh Reddy , Zage David , Chinnadurai Srinivasan , Rodolfo Giometti Subject: [RFC 2/3] Documentation pps.rst: add PPS generators documentation Date: Tue, 8 Oct 2024 15:50:32 +0200 Message-Id: <20241008135033.3171915-3-giometti@enneenne.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008135033.3171915-1-giometti@enneenne.com> References: <20241008135033.3171915-1-giometti@enneenne.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMAE-Envelope: MS4xfP5U7jx3B81F686kX4T4Oiv6i3eEj04luOg7Go0TsFKHNeWefdCGahxXs0bq0y6bSAWVQDwGt9M/FTkV8o0S1xmz+8C29+HJ5eAN3J/Ool1mKM2VW8eo M5v9h8m/zApegAdfFXMXCQoErVNyLTD6QuIPWpVAZ5TVr9HDfQDl14EhVYkTex8FD5vPRyANzCfMkR+Hid6RaO4OiwyxnJhqSheZ7737DcNo2lCOc04sdCfs ponx0u1zOFt3ED3zu/pUY/su66i/8mgox0dmQsvNIdoLeWG7gcSmc1ZDftYSDHyX+tyJ8MrAsB+eG+8odaRF6XS+QQSB4Qofhf8x0JMjNrgaf+ITOwG5rdFR xdrjJRCXnwNoVb1wqpmYqh7nVToNYOfgy4+ofLtTqf0Id6aUTHlWd9rJ/SRMcRcHSDODw/4CB5nQArEsFPYvJQixTgCtvTN2Q9eibw/ASbxuYcrDgQnig4V/ AJx8Aqz1YeiwWNuDcgtq0hqFo9VRWqgNIk2KQ9csg8qz39TXnsN0jIKdhp2vZPgoLvejAY5mIpoig8jaXSu3lLzBSyhnpNME4o0UDBXXcBP8o/0FcDW7Zttg 3iSYkdSRTrJRkUMqGjAcMmdBwZ1Ezrnnl1/ZMsvl6KZbl1LKbad8ks5enQqbx7hi6tlu1Oa2BUMunO24F/K7aOIMb2h+yO1mSNZyK6OBnreG40wgs0HYejzM vxN2uIEVsCt3MjVbyQpyXMXvHcR6tM8i Content-Type: text/plain; charset="utf-8" This patch adds some examples about how to register a new PPS generator in the system, and how to manage it. Signed-off-by: Rodolfo Giometti --- Documentation/driver-api/pps.rst | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Documentation/driver-api/pps.rst b/Documentation/driver-api/pp= s.rst index 78dded03e5d8..c71b3b878e41 100644 --- a/Documentation/driver-api/pps.rst +++ b/Documentation/driver-api/pps.rst @@ -202,6 +202,46 @@ Sometimes one needs to be able not only to catch PPS s= ignals but to produce them also. For example, running a distributed simulation, which requires computers' clock to be synchronized very tightly. =20 +To do so the class pps-gen has been added. PPS generators can be +registered int the kernel by defining a struct pps_gen_source_info as +follows:: + + static struct pps_gen_source_info pps_gen_dummy_info =3D { + .name =3D "dummy", + .use_system_clock =3D true, + .get_time =3D pps_gen_dummy_get_time, + .enable =3D pps_gen_dummy_enable, + }; + +Where the use_system_clock states if the generator uses the system +clock to generate its pulses, or from a peripheral device +clock. Method get_time() is used to query the time stored into the +generator clock, while the method enable() is used to enable or +disable the PPS pulse generation. + +Then calling the function pps_gen_register_source() in your +initialization routine as follows a new generator is created into the +system:: + + pps_gen =3D pps_gen_register_source(&pps_gen_dummy_info); + +Generators SYSFS support +------------------------ + +If the SYSFS filesystem is enabled in the kernel it provides a new class:: + + $ ls /sys/class/pps-gen/ + pps-gen0/ pps-gen1/ pps-gen2/ + +Every directory is the ID of a PPS generator defined in the system and +inside you find several files:: + + $ ls -F /sys/class/pps-gen/pps-gen0/ + dev enable name power/ subsystem@ system time uevent + +To enable the PPS signal generation you can use the command below:: + + $ echo 1 > /sys/class/pps-gen/pps-gen0/enable =20 Parallel port generator ------------------------ --=20 2.34.1