get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2218250/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2218250,
    "url": "http://patchwork.ozlabs.org/api/patches/2218250/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/rtc-linux/patch/2076980.usQuhbGJ8B@rafael.j.wysocki/",
    "project": {
        "id": 9,
        "url": "http://patchwork.ozlabs.org/api/projects/9/?format=api",
        "name": "Linux RTC development",
        "link_name": "rtc-linux",
        "list_id": "linux-rtc.vger.kernel.org",
        "list_email": "linux-rtc@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<2076980.usQuhbGJ8B@rafael.j.wysocki>",
    "list_archive_url": null,
    "date": "2026-03-31T19:38:52",
    "name": "[v1,4/4] ACPI: TAD: Add alarm support to the RTC class device interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "41a033d8daf339294a034d910279c2190a83ba06",
    "submitter": {
        "id": 64267,
        "url": "http://patchwork.ozlabs.org/api/people/64267/?format=api",
        "name": "Rafael J. Wysocki",
        "email": "rafael@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/rtc-linux/patch/2076980.usQuhbGJ8B@rafael.j.wysocki/mbox/",
    "series": [
        {
            "id": 498243,
            "url": "http://patchwork.ozlabs.org/api/series/498243/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/rtc-linux/list/?series=498243",
            "date": "2026-03-31T19:25:40",
            "name": "ACPI: TAD: Add alarm support to RTC class device interface",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498243/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218250/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218250/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-rtc+bounces-6269-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-rtc@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=XLX3joYc;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-rtc+bounces-6269-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"XLX3joYc\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"
        ],
        "Received": [
            "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fldmC0Cc2z1yCp\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 06:41:46 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id C311E305EEAE\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 19:39:10 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 82CE73A4513;\n\tTue, 31 Mar 2026 19:39:09 +0000 (UTC)",
            "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C0AD38BF70;\n\tTue, 31 Mar 2026 19:39:09 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id F385AC19423;\n\tTue, 31 Mar 2026 19:39:07 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774985949; cv=none;\n b=qNP71uqCYd9v3G6sc1XzMQLJ04FpRpnM4LtsPVLBhbw4Vj4Wz1A083WQRJlJaLSCiWyCYP+oMJO4jEZjrX9TJg0mi2gGfM6TkvbOGo3fqf1H9j+VNjYNpR540OJ1UnltwjXXoWQUdj46Zy8AgaM6thYSVeYUwQNVlxItNvLJTBM=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774985949; c=relaxed/simple;\n\tbh=1dZWLCLTqRn4kT22XtcWM27dvqDrG6ZgNQNmZWjQR50=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=hcoXxRk2otkFdXpar+TJQ8X/F7+eE0wyyeJvpAXWXWYof7si/RB6TMsUXMGbQsvzTsOsjixn+qC+8JlrZ3W35bVTse7xqJy8a/PyXaLQP4/bW9J+CPIHTxO1mCaxdamxIcmyUY4WM4B/9nKuMYPNlxJQ2x9U3jFLgGaM0K26N7M=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=XLX3joYc; arc=none smtp.client-ip=10.30.226.201",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774985949;\n\tbh=1dZWLCLTqRn4kT22XtcWM27dvqDrG6ZgNQNmZWjQR50=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XLX3joYcgDmxp8j1gAlGAsP4fSTijdZFWruaDvwHVNL9KwN103Vz0BqxECHxCEgdX\n\t j4Y1dlcrjOyBZ2fQBpWfoLMJedC1wC8i8SF4j2AnoqVSqaRzYrprk4PeijGrumQK4Z\n\t UNsClVF1ZnfzLmr4YfLYxmZppw5BwyUw8i//effCRydUa4M6jPWYzsHb8C/AMlnfd4\n\t v5B5MkXycpv7SY6x3nwZ1QrDLMlZ+DJU3YnwSUqo06+bBzzXL6spAKBat+HmoHSGUp\n\t JrBTRq7zFeyZMwb2+pI8FhG50Pc94Dwwc83PgVg77n7ns7NT5FE+vvSNJotsceWWnb\n\t A3rZfK0q53lOA==",
        "From": "\"Rafael J. Wysocki\" <rafael@kernel.org>",
        "To": "Linux ACPI <linux-acpi@vger.kernel.org>",
        "Cc": "linux-rtc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,\n Alexandre Belloni <alexandre.belloni@bootlin.com>",
        "Subject": "\n [PATCH v1 4/4] ACPI: TAD: Add alarm support to the RTC class device interface",
        "Date": "Tue, 31 Mar 2026 21:38:52 +0200",
        "Message-ID": "<2076980.usQuhbGJ8B@rafael.j.wysocki>",
        "Organization": "Linux Kernel Development",
        "In-Reply-To": "<2366642.iZASKD2KPV@rafael.j.wysocki>",
        "References": "<2366642.iZASKD2KPV@rafael.j.wysocki>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-rtc@vger.kernel.org",
        "List-Id": "<linux-rtc.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-rtc+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-rtc+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "7Bit",
        "Content-Type": "text/plain; charset=\"UTF-8\""
    },
    "content": "From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\n\nAdd alarm support, based on Section 9.17 of ACPI 6.6 [1], to the RTC\nclass device interface of the driver.\n\nThe ACPI time and alarm device (TAD) can support two separate alarm\ntimers, one for waking up the system when it is on AC power, and one\nfor waking it up when it is on DC power.  In principle, each of them\ncan be set to a different value representing the number of seconds\ntill the given alarm timer expires.\n\nHowever, the RTC class device can only set one alarm, so it will set\nboth the alarm timers of the ACPI TAD (if the DC one is supported) to\nthe same value.  That is somewhat cumbersome because there is no way in\nthe ACPI TAD firmware interface to set both timers in one go, so they\nneed to be set sequentially, but that's how it goes.\n\nOn the alarm read side, the driver assumes that both timers have been\nset to the same value, so it is sufficient to access one of them (the\nAC one specifically).\n\nLink: https://uefi.org/specs/ACPI/6.6/09_ACPI_Defined_Devices_and_Device_Specific_Objects.html#time-and-alarm-device [1]\nSigned-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\n---\n drivers/acpi/acpi_tad.c |  112 ++++++++++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 109 insertions(+), 3 deletions(-)",
    "diff": "--- a/drivers/acpi/acpi_tad.c\n+++ b/drivers/acpi/acpi_tad.c\n@@ -25,6 +25,7 @@\n \n #include <linux/acpi.h>\n #include <linux/kernel.h>\n+#include <linux/ktime.h>\n #include <linux/module.h>\n #include <linux/platform_device.h>\n #include <linux/pm_runtime.h>\n@@ -658,12 +659,113 @@ static int acpi_tad_rtc_read_time(struct\n \treturn 0;\n }\n \n+static int acpi_tad_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t)\n+{\n+\tstruct acpi_tad_driver_data *dd = dev_get_drvdata(dev);\n+\ts64 value = ACPI_TAD_WAKE_DISABLED;\n+\tstruct rtc_time tm_now;\n+\tstruct acpi_tad_rt rt;\n+\tint ret;\n+\n+\tPM_RUNTIME_ACQUIRE(dev, pm);\n+\tif (PM_RUNTIME_ACQUIRE_ERR(&pm))\n+\t\treturn -ENXIO;\n+\n+\tif (t->enabled) {\n+\t\t/*\n+\t\t * The value to pass to _STV is expected to be the number of\n+\t\t * seconds between the time when the timer is programmed and the\n+\t\t * time when it expires represented as a 32-bit integer.\n+\t\t */\n+\t\tret = __acpi_tad_get_real_time(dev, &rt);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\tacpi_tad_rt_to_tm(&rt, &tm_now);\n+\n+\t\tvalue = ktime_divns(ktime_sub(rtc_tm_to_ktime(t->time),\n+\t\t\t\t\t      rtc_tm_to_ktime(tm_now)), NSEC_PER_SEC);\n+\t\tif (value <= 0 || value > U32_MAX)\n+\t\t\treturn -EINVAL;\n+\t}\n+\n+\tret = __acpi_tad_wake_set(dev, \"_STV\", ACPI_TAD_AC_TIMER, value);\n+\tif (ret && t->enabled)\n+\t\treturn ret;\n+\n+\t/*\n+\t * If a separate DC alarm timer is supported, set it to the same value\n+\t * as the AC alarm timer.\n+\t */\n+\tif (dd->capabilities & ACPI_TAD_DC_WAKE) {\n+\t\tret = __acpi_tad_wake_set(dev, \"_STV\", ACPI_TAD_DC_TIMER, value);\n+\t\tif (ret && t->enabled) {\n+\t\t\t__acpi_tad_wake_set(dev, \"_STV\", ACPI_TAD_AC_TIMER,\n+\t\t\t\t\t    ACPI_TAD_WAKE_DISABLED);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\t/* Assume success if the alarm is being disabled. */\n+\treturn 0;\n+}\n+\n+static int acpi_tad_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t)\n+{\n+\tunsigned long long retval;\n+\tstruct rtc_time tm_now;\n+\tstruct acpi_tad_rt rt;\n+\tint ret;\n+\n+\tPM_RUNTIME_ACQUIRE(dev, pm);\n+\tif (PM_RUNTIME_ACQUIRE_ERR(&pm))\n+\t\treturn -ENXIO;\n+\n+\tret = __acpi_tad_get_real_time(dev, &rt);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tacpi_tad_rt_to_tm(&rt, &tm_now);\n+\n+\t/*\n+\t * Assume that the alarm was set by acpi_tad_rtc_set_alarm(), so the AC\n+\t * and DC alarm timer settings are the same and it is sufficient to read\n+\t * the former.\n+\t *\n+\t * The value returned by _TIV should be the number of seconds till the\n+\t * expiration of the timer, represented as a 32-bit integer, or the\n+\t * special ACPI_TAD_WAKE_DISABLED value meaning that the timer has\n+\t * been disabled.\n+\t */\n+\tret = __acpi_tad_wake_read(dev, \"_TIV\", ACPI_TAD_AC_TIMER, &retval);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (retval > U32_MAX)\n+\t\treturn -ENODATA;\n+\n+\tt->pending = 0;\n+\n+\tif (retval != ACPI_TAD_WAKE_DISABLED) {\n+\t\tt->enabled = 1;\n+\t\tt->time = rtc_ktime_to_tm(ktime_add_ns(rtc_tm_to_ktime(tm_now),\n+\t\t\t\t\t\t       (u64)retval * NSEC_PER_SEC));\n+\t} else {\n+\t\tt->enabled = 0;\n+\t\tt->time = tm_now;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static const struct rtc_class_ops acpi_tad_rtc_ops = {\n \t.read_time = acpi_tad_rtc_read_time,\n \t.set_time = acpi_tad_rtc_set_time,\n+\t.set_alarm = acpi_tad_rtc_set_alarm,\n+\t.read_alarm = acpi_tad_rtc_read_alarm,\n };\n \n-static void acpi_tad_register_rtc(struct device *dev)\n+static void acpi_tad_register_rtc(struct device *dev, unsigned long long caps)\n {\n \tstruct rtc_device *rtc;\n \n@@ -676,10 +778,14 @@ static void acpi_tad_register_rtc(struct\n \n \trtc->ops = &acpi_tad_rtc_ops;\n \n+\tif (!(caps & ACPI_TAD_AC_WAKE))\n+\t\tclear_bit(RTC_FEATURE_ALARM, rtc->features);\n+\n \tdevm_rtc_register_device(rtc);\n }\n #else /* !CONFIG_RTC_CLASS */\n-static inline void acpi_tad_register_rtc(struct device *dev) {}\n+static inline void acpi_tad_register_rtc(struct device *dev,\n+\t\t\t\t\t unsigned long long caps) {}\n #endif /* !CONFIG_RTC_CLASS */\n \n /* Platform driver interface */\n@@ -765,7 +871,7 @@ static int acpi_tad_probe(struct platfor\n \tpm_runtime_suspend(dev);\n \n \tif (caps & ACPI_TAD_RT)\n-\t\tacpi_tad_register_rtc(dev);\n+\t\tacpi_tad_register_rtc(dev, caps);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "v1",
        "4/4"
    ]
}