From nobody Sat Feb 7 17:54:41 2026 Received: from pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.35.192.45]) (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 8B8B237F0F3; Fri, 30 Jan 2026 17:37:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.35.192.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769794662; cv=none; b=P5FwwbC8DyszkHygYJx1mPTy3a0j8W6zg9EulbSKfQc8Ep8vJRNRoG9VWVhg7+nZYp656S0CuRkEWUUFgBeQmrsOj7QcxL7DtbPi+5BgTzmcFmXUJB8/6pO2+gJPyPnoOX3J3S1fYH2CF5kfjv4D5V7XZPGr1RjL2/+gI9OGSCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769794662; c=relaxed/simple; bh=smOrr7rJtqJ1A/iQT/v59C5+7ftMjhEeBSqGWew1gNo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PZ4rStwQi/5Uxal/zwCgUeLjLvEu2n0LOlmimsCk5q6JjTnHnYihsAdTodkM3TuXEORreMn/K6z34Nll+ZI/zhAwguHjxlN1OHdEAQ6qDvMAHOOkmTeC1jZRsKmOvGBERFvxoVq0Ku0g8Xo5Gvp/kPqmqfiX9Uqc/++h/cLK7QI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=F4T32OAn; arc=none smtp.client-ip=52.35.192.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="F4T32OAn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769794660; x=1801330660; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FgHEkCKDX6peL0Q9VZpqqddTmjBFrZxzV6jF7iiGbxI=; b=F4T32OAnGcW2EvMRwD5/jHYPs7lJjxp7iAUDa81EcVUBETbrrx8DGyIg eWuNif7+uHKze4pGQ6ZUaC6Tt8/5tMPs6ndSRttPXQ57ACZ4+3ZaaqREZ 3tZPnp2wwbkFIXc/pgwys4+wivN7i1d34r7i8KV3L5dq5I16Nf9WSlDrf h47nPLwbH1G3ANii7GFuHs1nbcpSc8GkMGwXVDUazK+vowpyZ3YiZsdSV sm6/ervbPRZxU7UGvha0PKwI1vhKBW55gaCY164Ifga1Sz07sdO+vaK2p tFY72/Tn/Z6gHguz66wos3ZYw2B9SjM2aEP0ganPgMVcM98gn4p7kMDTu A==; X-CSE-ConnectionGUID: A2t4NE0ETXiyhNRzB0iUlw== X-CSE-MsgGUID: aHBSknfIQya7DDbknB6mnQ== X-IronPort-AV: E=Sophos;i="6.21,263,1763424000"; d="scan'208";a="11720956" Received: from ip-10-5-12-219.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.12.219]) by internal-pdx-out-011.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2026 17:37:37 +0000 Received: from EX19MTAUWB001.ant.amazon.com [205.251.233.104:21098] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.16.224:2525] with esmtp (Farcaster) id edd01702-61c8-47d5-ac65-d1bd6e6f9b19; Fri, 30 Jan 2026 17:37:37 +0000 (UTC) X-Farcaster-Flow-ID: edd01702-61c8-47d5-ac65-d1bd6e6f9b19 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWB001.ant.amazon.com (10.250.64.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Fri, 30 Jan 2026 17:37:37 +0000 Received: from dev-dsk-itazur-1b-11e7fc0f.eu-west-1.amazon.com (172.19.66.53) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Fri, 30 Jan 2026 17:37:34 +0000 From: Takahiro Itazuri To: , , , , , , , CC: , , , Babis Chalios , "Alexander Graf" , , Marco Cali , David Woodhouse , "Takahiro Itazuri" Subject: [PATCH v7 4/7] ptp: ptp_vmclock: Add device tree support Date: Fri, 30 Jan 2026 17:36:03 +0000 Message-ID: <20260130173704.12575-5-itazur@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260130173704.12575-1-itazur@amazon.com> References: <20260130173704.12575-1-itazur@amazon.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-ClientProxiedBy: EX19D046UWB004.ant.amazon.com (10.13.139.164) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Type: text/plain; charset="utf-8" From: David Woodhouse Add device tree support to the ptp_vmclock driver, allowing it to probe via device tree in addition to ACPI. Handle optional interrupt for clock disruption notifications, mirroring the ACPI notification behaviour. Although the interrupt is marked as 'optional' in the DT bindings, if the device *advertises* the VMCLOCK_FLAG_NOTIFICATION_ABSENT then it *should* have an interrupt. The driver will refuse to initialize if not. Signed-off-by: David Woodhouse Signed-off-by: Babis Chalios Signed-off-by: Takahiro Itazuri Tested-by: Takahiro Itazuri --- drivers/ptp/ptp_vmclock.c | 67 +++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c index f8b24f9e8..619c8e5a9 100644 --- a/drivers/ptp/ptp_vmclock.c +++ b/drivers/ptp/ptp_vmclock.c @@ -14,10 +14,13 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include =20 @@ -524,7 +527,7 @@ vmclock_acpi_notification_handler(acpi_handle __always_= unused handle, wake_up_interruptible(&st->disrupt_wait); } =20 -static int vmclock_setup_notification(struct device *dev, struct vmclock_s= tate *st) +static int vmclock_setup_acpi_notification(struct device *dev) { struct acpi_device *adev =3D ACPI_COMPANION(dev); acpi_status status; @@ -537,10 +540,6 @@ static int vmclock_setup_notification(struct device *d= ev, struct vmclock_state * if (!adev) return -ENODEV; =20 - /* The device does not support notifications. Nothing else to do */ - if (!(le64_to_cpu(st->clk->flags) & VMCLOCK_FLAG_NOTIFICATION_PRESENT)) - return 0; - status =3D acpi_install_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY, vmclock_acpi_notification_handler, dev); @@ -575,6 +574,55 @@ static int vmclock_probe_acpi(struct device *dev, stru= ct vmclock_state *st) return 0; } =20 +static irqreturn_t vmclock_of_irq_handler(int __always_unused irq, void *_= st) +{ + struct vmclock_state *st =3D _st; + + wake_up_interruptible(&st->disrupt_wait); + return IRQ_HANDLED; +} + +static int vmclock_probe_dt(struct device *dev, struct vmclock_state *st) +{ + struct platform_device *pdev =3D to_platform_device(dev); + struct resource *res; + + res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + st->res =3D *res; + + return 0; +} + +static int vmclock_setup_of_notification(struct device *dev) +{ + struct platform_device *pdev =3D to_platform_device(dev); + int irq; + + irq =3D platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + return devm_request_irq(dev, irq, vmclock_of_irq_handler, IRQF_SHARED, + "vmclock", dev->driver_data); +} + +static int vmclock_setup_notification(struct device *dev, + struct vmclock_state *st) +{ + /* The device does not support notifications. Nothing else to do */ + if (!(le64_to_cpu(st->clk->flags) & VMCLOCK_FLAG_NOTIFICATION_PRESENT)) + return 0; + + if (has_acpi_companion(dev)) { + return vmclock_setup_acpi_notification(dev); + } else { + return vmclock_setup_of_notification(dev); + } +} + static void vmclock_remove(void *data) { struct device *dev =3D data; @@ -619,7 +667,7 @@ static int vmclock_probe(struct platform_device *pdev) if (has_acpi_companion(dev)) ret =3D vmclock_probe_acpi(dev, st); else - ret =3D -EINVAL; /* Only ACPI for now */ + ret =3D vmclock_probe_dt(dev, st); =20 if (ret) { dev_info(dev, "Failed to obtain physical address: %d\n", ret); @@ -719,11 +767,18 @@ static const struct acpi_device_id vmclock_acpi_ids[]= =3D { }; MODULE_DEVICE_TABLE(acpi, vmclock_acpi_ids); =20 +static const struct of_device_id vmclock_of_ids[] =3D { + { .compatible =3D "amazon,vmclock", }, + { }, +}; +MODULE_DEVICE_TABLE(of, vmclock_of_ids); + static struct platform_driver vmclock_platform_driver =3D { .probe =3D vmclock_probe, .driver =3D { .name =3D "vmclock", .acpi_match_table =3D vmclock_acpi_ids, + .of_match_table =3D vmclock_of_ids, }, }; =20 --=20 2.50.1