From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AFD4CF9C71 for ; Tue, 24 Sep 2024 07:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:CC:To:From:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5FI73r9MTBVi/IDFAW9B1t0gui+ZP6buNt8HbOWdgsI=; b=n9zkEyhf5RbQQ+UCp088xzkrtH aFvgIJbHTVfGtIL0IapbsKOURPj1lG547MqvjqBPjZfF0xA2rXEa23lrFFqn2BxU0ZH7x0MV8Krq9 RkJ05zDYv7SRLcSrdyflq1OGXAtrrTFk7ZoLwbL8fDIpWEABSjfmcaNLeVWOJCOD1zZwHaAPZ9y// zM4I71ZVbZxiO+FJALsg/wVb+/WIvKA8C1c/6AT8eeHtTss3J5fL+N+NFtrobhH7uI3hWohrqSFvL Mn3YRdnv7nCQS/PxN/idykAtBHtusadYtG7WYodWBxiQZt+dhVT0G5OTrnOYhH5MXEPV9SsK17C7z LvNT3Pww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sszdw-00000001M0K-2JSy; Tue, 24 Sep 2024 07:07:28 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sszcM-00000001LnY-3Vx5; Tue, 24 Sep 2024 07:05:52 +0000 X-UUID: 6a3a69f27a4311efb3adad29d29602c1-20240924 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:CC:To:From:Subject:MIME-Version:Date:Message-ID; bh=5FI73r9MTBVi/IDFAW9B1t0gui+ZP6buNt8HbOWdgsI=; b=EBKOi5hlTTWPGnT8keZkDzfY8jYxUn996l0nADydciazd1DwnFMkVRPkAzk/D/qAm0U7gT+D8Q62LuDAkKIX1jnPvRe+Yk6hweoa3eso9bKt/7qXUAkjr4Y/hORPr+7fA6elJqpEdetvUbq9KCX59woLghIRF2ScFzwsFDp0mCw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.41,REQID:f7b7a5b1-80cd-4675-a9bf-3b12ae848933,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6dc6a47,CLOUDID:f2da2818-b42d-49a6-94d2-a75fa0df01d2,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0|-5,EDM:-3,IP:ni l,URL:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,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: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 6a3a69f27a4311efb3adad29d29602c1-20240924 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1139161115; Tue, 24 Sep 2024 00:05:43 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 24 Sep 2024 15:05:41 +0800 Received: from [172.21.84.99] (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 24 Sep 2024 15:05:38 +0800 Message-ID: <247abc15-d82f-3e8f-5202-edc6099707df@mediatek.com> Date: Tue, 24 Sep 2024 15:05:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v1 2/3] rtc: mt6359: Add RTC hardware range and add support for start-year Content-Language: en-US From: Macpaul Lin To: AngeloGioacchino Del Regno , , CC: , , , , , , , , , , , , , , References: <20240923100010.97470-1-angelogioacchino.delregno@collabora.com> <20240923100010.97470-3-angelogioacchino.delregno@collabora.com> <0748868d-4789-fcaa-e70f-6a4508411b36@mediatek.com> In-Reply-To: <0748868d-4789-fcaa-e70f-6a4508411b36@mediatek.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_000550_910944_AD55703C X-CRM114-Status: GOOD ( 23.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 9/24/24 12:08, Macpaul Lin wrote: > > On 9/23/24 18:00, AngeloGioacchino Del Regno wrote: >> Add the RTC hardware range parameters to enable the possibility >> of using the `start-year` devicetree property which, if present, >> will set the start_secs parameter by overriding the defaults >> that this driver is setting; >> >> To keep compatibility with (hence have the same date/time reading >> as) the old behavior, set: >>   - range_min to 1900-01-01 00:00:00 >>   - range_max to 2027-12-31 23:59:59 (HW year max range is 0-127) >>   - start_secs defaulting to 1968-01-02 00:00:00 >> >> Please note that the oddness of starting from January 2nd is not >> a hardware quirk and it's done only to get the same date/time >> reading as an RTC which time was set before this commit. >> >> Also remove the RTC_MIN_YEAR_OFFSET addition and subtraction in >> callbacks set_time() and read_time() respectively, as now this >> is already done by the API. >> >> Signed-off-by: AngeloGioacchino Del Regno >> >> --- >>   drivers/rtc/rtc-mt6397.c | 13 ++++--------- >>   1 file changed, 4 insertions(+), 9 deletions(-) > > [snip] > > Thanks for helping add new patch fix for RTC. > >> @@ -302,6 +293,10 @@ static int mtk_rtc_probe(struct platform_device >> *pdev) >>       device_init_wakeup(&pdev->dev, 1); >>       rtc->rtc_dev->ops = &mtk_rtc_ops; >> +    rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900; >> +    rtc->rtc_dev->range_max = mktime64(2027, 12, 31, 23, 59, 59); >> +    rtc->rtc_dev->start_secs = mktime64(1968, 1, 2, 0, 0, 0); >> +    rtc->rtc_dev->set_start_time = true; >>       return devm_rtc_register_device(rtc->rtc_dev); >>   } > > Dear @Zhanhan, Please help to leave comment if you think there is > something need to be clarify. For example, I've found some relate origin > defines > in "include/linux/mfd/mt6397/rtc.h" > #define RTC_MIN_YEAR    1968 > #define RTC_BASE_YEAR    1900 > #define RTC_NUM_YEAR    128 > #define RTC_MIN_YEAR_OFFSET    (RTC_MIN_YEAR - RTC_BASE_YEAR) > > Should MediaTek remove RTC_MIN_YEAR and RTC_BASE_YEAR in next patch? > And since there may not exist any smartphone/tablet/TV using mt6397 > RTC earlier than 2010? Is it possible to change > RTC_TIMESTAMP_BEGIN_1900 to RTC_TIMESTAMP_BEGIN_2000 without breaking > compatibility for these devices? > > Thanks > Macpaul Lin > After discussing these change with ZhanZhan, MediaTek think use RTC_TIMESTAMP_BEGIN_1900 and the other changes are okay. Reviewed-by: Macpaul Lin Reviewed-by: ZhanZhan Ge Thanks! Macpaul Lin