From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 40D713E51F6 for ; Mon, 25 May 2026 09:15:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779700511; cv=none; b=ijsWIxfsxXgD/i8+go6Q4nZU2ZhQPFPn/SmsJBbAe+Q2l7sq1kPfbiHFuOJFYGYSzoTS8hJWFDmCwWnKwfJE+O9akO+q0RKjwWvUu0GyeGYcupQwrfKFxNgeMlXWDcujTLhsaHqU3pXj1TQx//OkFFf3aVge9+89u+sfqmIPjUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779700511; c=relaxed/simple; bh=BUpTTCqh+ODxfU40tEwAwZTO9Uvn6Hod9gElKniXBDc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=oSzgzhnIiXjc4m7Th/Ak/Ugh6K3XdZjF3Hj95fc8IJaJMZw9T1118L9AfpUNVLuEkdS/FrZtkqssW+UrQHHkpO/2bGxBHapv3PFAuY3+TpDvHCfmHy8xTOAylJWYKF8o1IzqxUvUg2X/kibh2QIlOiKsRBWfW3tTXIINBF3bmLw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=u0ffn7i1; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="u0ffn7i1" X-UUID: 311b24e8581a11f1b1788b6acf885367-20260525 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=Vfj5zzqqiGTc6uUbNj9mlsEVICrqIe0vKwtPNo+W9is=; b=u0ffn7i1tKxxY8IUy8ymBzsO2LZgv/FP1NoqgRYUGhYHvJ8QQXSI4Uew5NpI3DQLd2wmoYFIatwD5LNikUGQO0C0DPvQiMsMuVluB6kw3KDXY8FcZQ9izJt6hWhyOPIomX6s4Tie2RcNOdFvtqOpD2URW5mdoH1wqXMJqDAALwE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.15,REQID:3ad73c13-ccfa-4766-bdae-602decf17284,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:e276073,CLOUDID:9d8c6022-bef7-463f-902c-5f40f7404c33,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102|836|865|888|898,TC:-5,Content:0| 15|50,EDM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,COL:0,OSI:0 ,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 311b24e8581a11f1b1788b6acf885367-20260525 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1033559572; Mon, 25 May 2026 17:14:54 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Mon, 25 May 2026 17:14:52 +0800 Received: from mediatek.com (10.233.130.16) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Mon, 25 May 2026 17:14:52 +0800 Received: by mediatek.com (Postfix, from userid 10034418) id D13CA200C5; Mon, 25 May 2026 17:14:52 +0800 (CST) From: mtk34418 To: , CC: , , , Shunxi Zhang Subject: [PATCH v3 0/4] rtc: mt6397: Enhance RTC driver with BBPU alarm status handling Date: Mon, 25 May 2026 17:14:47 +0800 Message-ID: <20260525091449.1546965-1-dhatrisri.anumula@mediatek.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain From: Shunxi Zhang This patch series enhances the MediaTek MT6397 RTC driver to properly handle BBPU (Battery-Backed Power Unit) alarm status, addressing critical power management issues where: 1. The RTC BBPU alarm state remains active after an alarm event occurs, causing the IRQ handler to be triggered repeatedly 2. Systems unexpectedly power on after shutdown because the RTC alarm state was not cleared during the shutdown sequence The series adds necessary bit definitions to the RTC header, implements alarm status reset functionality in the interrupt handler, and adds a shutdown handler to ensure clean power-down behavior. Changes in v3: - Removed standalone cosmetic formatting patch per maintainer feedback - Removed devicetree property "mediatek,alarm-sta-supported" approach - Removed alarm_sta_supported flag and conditional checks - Execute mtk_rtc_reset_bbpu_alarm_status() unconditionally (PMIC-driven) - Fixed commit messages to use imperative mood throughout - Validated all patches with checkpatch.pl --strict - Validated DTS changes with 'make dtbs_check W=1' - Addressed all review comments from Krzysztof Kozlowski, AngeloGioacchino Del Regno, and Alexandre Belloni Changes in v2: - Initial public submission to LKML - Added DT property for alarm status support (approach rejected) - Added cosmetic formatting changes (rejected) Testing: - Tested on MT6359 PMIC with MT8189 platform (ChromeOS) - Verified RTC alarm triggering and proper status clearing - Verified system shutdown behavior with pending alarm - Validated against mainline v6.16-rc1 - Passed dtbs_check and dt_binding_check Background: The MT6397 family of PMICs (including MT6358, MT6359) share the same RTC IP block. The BBPU register contains an alarm status bit (bit 3) that must be explicitly cleared after an alarm event. Without this handling, systems can experience spurious wakeups or fail to power down cleanly. Shunxi Zhang (4): dt-bindings: rtc: mediatek: Document MT6397 RTC alarm handling mfd: mt6397: Add BBPU bit definitions for alarm status control rtc: mt6397: Add BBPU alarm status reset and shutdown handling arm64: dts: mediatek: mt6359: Enable RTC alarm status reset .../bindings/rtc/mediatek,mt6397-rtc.yaml | 12 ++++++++ arch/arm64/boot/dts/mediatek/mt6359.dtsi | 1 + drivers/rtc/rtc-mt6397.c | 30 +++++++++++++++++++ include/linux/mfd/mt6397/rtc.h | 2 ++ 4 files changed, 45 insertions(+) --- Maintainers CC list (use scripts/get_maintainer.pl): - Alessandro Zummo (RTC maintainer) - Alexandre Belloni (RTC maintainer) - Lee Jones (MFD maintainer) - Matthias Brugger (MediaTek maintainer) - AngeloGioacchino Del Regno (MediaTek reviewer) - linux-rtc@vger.kernel.org - linux-mediatek@lists.infradead.org - linux-arm-kernel@lists.infradead.org - linux-kernel@vger.kernel.org base-commit: -- 2.45.2