From patchwork Mon Jan 1 11:57:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aishwarya Pant X-Patchwork-Id: 854307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-rtc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gBLBww8o"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z9G0b09b9z9t3w for ; Mon, 1 Jan 2018 22:57:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751256AbeAAL5h (ORCPT ); Mon, 1 Jan 2018 06:57:37 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33734 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbeAAL5f (ORCPT ); Mon, 1 Jan 2018 06:57:35 -0500 Received: by mail-pf0-f195.google.com with SMTP id y89so24609702pfk.0; Mon, 01 Jan 2018 03:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=SYqtg0mWNmZ1qA4ywEtwRFqkh6S53AdgtO/uN+MJK5Y=; b=gBLBww8oraDuG3u0WDJ9G1HFFtKZkpCGafqPFn7jiqP3dci6ZzVFMzJhsNTL7ekuo0 XN+x0rKet+8hl5BkJSDnRWOotq+WMRJ3TFg4BwV82RNmA46WIItvhxe/RldX8WCsBdzR Znf5jKknhEXpL1TEsw3GSCZ5xO8uVJd3cj9yc/Ymtcs/jp2ASSTrs9+B3L7IpZwtdr7s v5oA+nMoBcgmJpfKnzINwEmtg1KYNQXptz0QV9QxG/Eo2ULZpehMUCSBVl7B9eFYMqMR L7F7dubbcq+Aveypxht2aNA9oBIz8m0uLugrWx/15G1eZUPokFAOHucNYvSpIVYdtUJT CmiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=SYqtg0mWNmZ1qA4ywEtwRFqkh6S53AdgtO/uN+MJK5Y=; b=gh0V7+FQJVEPZMec+6KT5y2r7yGrMCxXUc0E2o9Ja+uI6gGNxHqaqQQRWlAkxR58Lg HHy21Bm+fed/XApTdwd57zXNi2fstVEmSbE13gv5km+Z5MJvsF0cxpb+HVFRCt2wQhNx tfPq7v4iMwqKf68yolhOTu+modkekqWfaLgYATA6VjIwwIPXMunJ7ScitVUlJnmItYba 15ZPvp1DGqNr1AMHBd4/l4mHlBRPTadwbhZschkI1iLLg7eQv/tmuHQovDwS5XdIqI+e nDeoMIQQskDkP8L7pjMBKdh64LZqZBYOWjZzQEwXnRVMMRlKECCmf6GKczbxD5Rlfq8Y oZkQ== X-Gm-Message-State: AKGB3mJZDW0zeVmQlLbVMsVmQln4zLzPfejIaei9XSkpi2EqafvS/hf/ 8azmBMVuTJvq4GnUERo6Osk= X-Google-Smtp-Source: ACJfBou91rmnqWRYa7qTdIh+tWNW74Z1OfHjbpa/J8i6j+qMroiXaFV+Js0t4M6z39VNWar4X8AuXQ== X-Received: by 10.101.65.70 with SMTP id x6mr3933130pgp.144.1514807853988; Mon, 01 Jan 2018 03:57:33 -0800 (PST) Received: from mordor.localdomain ([183.82.21.239]) by smtp.gmail.com with ESMTPSA id u17sm60135803pgb.68.2018.01.01.03.57.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Jan 2018 03:57:33 -0800 (PST) Date: Mon, 1 Jan 2018 17:27:26 +0530 From: Aishwarya Pant To: Alessandro Zummo , Alexandre Belloni , Jonathan Corbet , linux-rtc@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Cc: Julia Lawall , gregkh@linuxfoundation.org Subject: [PATCH] rtc: sysfs: move sysfs & ioctl interface to Documentation/ABI Message-ID: <20180101115726.GA4519@mordor.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org Right now, the decription of the rtc and sysfs interfaces is in Documentation/rtc.txt. Since these are a part of the ABI, they should be in Documentation/ABI along with the rest. Signed-off-by: Aishwarya Pant --- Let me know if the contact information should be different. I picked up the module author of drivers/rtc/rtc-sysfs.c as the primary contact of the interfaces. Documentation/ABI/stable/rtc | 135 +++++++++++++++++++++++++++++++++++++++++++ Documentation/rtc.txt | 80 +------------------------ 2 files changed, 136 insertions(+), 79 deletions(-) create mode 100644 Documentation/ABI/stable/rtc diff --git a/Documentation/ABI/stable/rtc b/Documentation/ABI/stable/rtc new file mode 100644 index 000000000000..799003dfb86e --- /dev/null +++ b/Documentation/ABI/stable/rtc @@ -0,0 +1,135 @@ +SYSFS interface +--------------- + +The sysfs interface provides access to various +rtc attributes without requiring the use of ioctls. All dates and times +are in the RTC's timezone, rather than in system time. + +What: /sys/class/rtc/rtc[0-*]/date +Date: March 2006 +KernelVersion: 2.6.17 +Contact: Alexandre Belloni +Description: (RO) RTC-provided date + +What: /sys/class/rtc/rtc[0-*]/name +Date: March 2006 +KernelVersion: 2.6.17 +Contact: Alexandre Belloni +Description: (RO) The name of the RTC corresponding to this sysfs directory. + +What: /sys/class/rtc/rtc[0-*]/time +Date: March 2006 +KernelVersion: 2.6.17 +Contact: Alexandre Belloni +Description: (RO) RTC-provided time + +What: /sys/class/rtc/rtc[0-*]/since_epoch +Date: March 2006 +KernelVersion: 2.6.17 +Contact: Alexandre Belloni +Description: (RO) The number of seconds since the epoch according to the RTC. + +What: /sys/class/rtc/rtc[0-*]/wakealarm +Date: February 2007 +KernelVersion: 2.6.21 +Contact: Alexandre Belloni +Description: (RW) The time at which the clock will generate a system wakeup + event. This is a one shot wakeup event, so must be reset + after wake if a daily wakeup is required. Format is seconds + since the epoch by default, or if there's a leading +, seconds + in the future, or if there is a leading +=, seconds ahead of + the current alarm. + +What: /sys/class/rtc/rtc[0-*]/max_user_freq +Date: October 2007 +KernelVersion: 2.6.24 +Contact: Alexandre Belloni +Description: (RW) The maximum interrupt rate an unprivileged user may request + from this RTC. + +What: /sys/class/rtc/rtc[0-*]/hctosys +Date: September 2009 +KernelVersion: 2.6.32 +Contact: Alexandre Belloni +Description: (RO) 1 if the RTC provided the system time at boot via the + CONFIG_RTC_HCTOSYS kernel option, 0 otherwise. + +What: /sys/class/rtc/rtc[0-*]/offset +Date: February 2016 +KernelVersion: 4.6 +Contact: Alexandre Belloni +Description: (RW) The amount which the rtc clock has been adjusted in firmware. + Visible only if the driver supports clock offset adjustment. + The unit is parts per billion, i.e. The number of clock ticks + which are added to or removed from the rtc's base clock per + billion ticks. A positive value makes a day pass more slowly, + longer, and a negative value makes a day pass more quickly. + +What: /sys/bus/nvmem/devices/dev-name/nvmem +Date: July 2017 +KernelVersion: 4.13 +Contact: Alexandre Belloni +Description: (RW) The non volatile storage exported as a raw file, as described + in Documentation/nvmem/nvmem.txt. The previous ABI + /sys/class/rtc/rtc[0-*]/device/nvram will be deprecated. + +IOCTL interface +--------------- + +What: /dev/rtc[0-*] +Date: April 2005 +KernelVersion: 2.6.12 +Contact: Alexandre Belloni +Description: The ioctl() calls supported by /dev/rtc are also supported by + the RTC class framework. However, because the chips and systems + are not standardized, some PC/AT functionality might not be + provided. And in the same way, some newer features -- including + those enabled by ACPI -- are exposed by the RTC class framework, + but can't be supported by the older driver. + + * RTC_RD_TIME, RTC_SET_TIME ... every RTC supports at + least reading time, returning the result as a Gregorian + calendar date and 24 hour wall clock time. To be most + useful, this time may also be updated. + + * RTC_AIE_ON, RTC_AIE_OFF, RTC_ALM_SET, RTC_ALM_READ ... + when the RTC is connected to an IRQ line, it can often + issue an alarm IRQ up to 24 hours in the future. (Use + RTC_WKALM_* by preference.) + + * RTC_WKALM_SET, RTC_WKALM_RD ... RTCs that can issue + alarms beyond the next 24 hours use a slightly more + powerful API, which supports setting the longer alarm + time and enabling its IRQ using a single request (using + the same model as EFI firmware). + + * RTC_UIE_ON, RTC_UIE_OFF ... if the RTC offers IRQs, the + RTC framework will emulate this mechanism. + + * RTC_PIE_ON, RTC_PIE_OFF, RTC_IRQP_SET, RTC_IRQP_READ ... + these icotls are emulated via a kernel hrtimer. + + In many cases, the RTC alarm can be a system wake event, used to + force Linux out of a low power sleep state (or hibernation) back + to a fully operational state. For example, a system could enter + a deep power saving state until it's time to execute some + scheduled tasks. + + Note that many of these ioctls are handled by the common rtc-dev + interface. Some common examples: + + * RTC_RD_TIME, RTC_SET_TIME: the read_time/set_time + functions will be called with appropriate values. + + * RTC_ALM_SET, RTC_ALM_READ, RTC_WKALM_SET, RTC_WKALM_RD: + gets or sets the alarm rtc_timer. May call the set_alarm + driver function. + + * RTC_IRQP_SET, RTC_IRQP_READ: These are emulated by the + generic code. + + * RTC_PIE_ON, RTC_PIE_OFF: These are also emulated by the + generic code. + + If all else fails, check out the + tools/testing/selftests/timers/rtctest.c test! diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt index c0c977445fb9..a7890ca9a27e 100644 --- a/Documentation/rtc.txt +++ b/Documentation/rtc.txt @@ -136,82 +136,4 @@ a high functionality RTC is integrated into the SOC. That system might read the system clock from the discrete RTC, but use the integrated one for all other tasks, because of its greater functionality. -SYSFS interface ---------------- - -The sysfs interface under /sys/class/rtc/rtcN provides access to various -rtc attributes without requiring the use of ioctls. All dates and times -are in the RTC's timezone, rather than in system time. - -================ ============================================================== -date RTC-provided date -hctosys 1 if the RTC provided the system time at boot via the - CONFIG_RTC_HCTOSYS kernel option, 0 otherwise -max_user_freq The maximum interrupt rate an unprivileged user may request - from this RTC. -name The name of the RTC corresponding to this sysfs directory -since_epoch The number of seconds since the epoch according to the RTC -time RTC-provided time -wakealarm The time at which the clock will generate a system wakeup - event. This is a one shot wakeup event, so must be reset - after wake if a daily wakeup is required. Format is seconds - since the epoch by default, or if there's a leading +, seconds - in the future, or if there is a leading +=, seconds ahead of - the current alarm. -offset The amount which the rtc clock has been adjusted in firmware. - Visible only if the driver supports clock offset adjustment. - The unit is parts per billion, i.e. The number of clock ticks - which are added to or removed from the rtc's base clock per - billion ticks. A positive value makes a day pass more slowly, - longer, and a negative value makes a day pass more quickly. -*/nvmem The non volatile storage exported as a raw file, as described - in Documentation/nvmem/nvmem.txt -================ ============================================================== - -IOCTL interface ---------------- - -The ioctl() calls supported by /dev/rtc are also supported by the RTC class -framework. However, because the chips and systems are not standardized, -some PC/AT functionality might not be provided. And in the same way, some -newer features -- including those enabled by ACPI -- are exposed by the -RTC class framework, but can't be supported by the older driver. - - * RTC_RD_TIME, RTC_SET_TIME ... every RTC supports at least reading - time, returning the result as a Gregorian calendar date and 24 hour - wall clock time. To be most useful, this time may also be updated. - - * RTC_AIE_ON, RTC_AIE_OFF, RTC_ALM_SET, RTC_ALM_READ ... when the RTC - is connected to an IRQ line, it can often issue an alarm IRQ up to - 24 hours in the future. (Use RTC_WKALM_* by preference.) - - * RTC_WKALM_SET, RTC_WKALM_RD ... RTCs that can issue alarms beyond - the next 24 hours use a slightly more powerful API, which supports - setting the longer alarm time and enabling its IRQ using a single - request (using the same model as EFI firmware). - - * RTC_UIE_ON, RTC_UIE_OFF ... if the RTC offers IRQs, the RTC framework - will emulate this mechanism. - - * RTC_PIE_ON, RTC_PIE_OFF, RTC_IRQP_SET, RTC_IRQP_READ ... these icotls - are emulated via a kernel hrtimer. - -In many cases, the RTC alarm can be a system wake event, used to force -Linux out of a low power sleep state (or hibernation) back to a fully -operational state. For example, a system could enter a deep power saving -state until it's time to execute some scheduled tasks. - -Note that many of these ioctls are handled by the common rtc-dev interface. -Some common examples: - - * RTC_RD_TIME, RTC_SET_TIME: the read_time/set_time functions will be - called with appropriate values. - - * RTC_ALM_SET, RTC_ALM_READ, RTC_WKALM_SET, RTC_WKALM_RD: gets or sets - the alarm rtc_timer. May call the set_alarm driver function. - - * RTC_IRQP_SET, RTC_IRQP_READ: These are emulated by the generic code. - - * RTC_PIE_ON, RTC_PIE_OFF: These are also emulated by the generic code. - -If all else fails, check out the tools/testing/selftests/timers/rtctest.c test! +The sysfs and ioctl interfaces are described in Documentation/ABI/stable/rtc.