public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Macpaul Lin <macpaul.lin@mediatek.com>,
	lee@kernel.org, ZhanZhan.ge@mediatek.com
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	matthias.bgg@gmail.com, eddie.huang@mediatek.com,
	sean.wang@mediatek.com, alexandre.belloni@bootlin.com,
	sen.chu@mediatek.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-rtc@vger.kernel.org,
	kernel@collabora.com, yong.mao@mediatek.com
Subject: Re: [PATCH v1 2/3] rtc: mt6359: Add RTC hardware range and add support for start-year
Date: Tue, 24 Sep 2024 11:30:25 +0200	[thread overview]
Message-ID: <72ce817e-63de-40a7-b7e9-a5b44b67e207@collabora.com> (raw)
In-Reply-To: <247abc15-d82f-3e8f-5202-edc6099707df@mediatek.com>

Il 24/09/24 09:05, Macpaul Lin ha scritto:
> 
> 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 <angelogioacchino.delregno@collabora.com>
>>> ---
>>>   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 <macpaul.lin@mediatek.com>
> Reviewed-by: ZhanZhan Ge <zhanzhan.ge@mediatek.com>
> 

Thank you Macpaul, ZhanZhan :-)

Cheers,
Angelo


  reply	other threads:[~2024-09-24  9:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 10:00 [PATCH v1 0/3] rtc: mt6359: Cleanup and support start-year property AngeloGioacchino Del Regno
2024-09-23 10:00 ` [PATCH v1 1/3] dt-bindings: mfd: mediatek: mt6397: Add start-year property to RTC AngeloGioacchino Del Regno
2024-09-23 21:21   ` Conor Dooley
2024-10-09 10:15   ` Lee Jones
2024-10-09 10:17     ` AngeloGioacchino Del Regno
2024-10-09 10:33       ` Lee Jones
2024-10-09 10:37         ` Lee Jones
2024-10-09 10:48           ` Macpaul Lin
2024-10-09 11:05           ` AngeloGioacchino Del Regno
2024-10-16  8:04   ` (subset) " Lee Jones
2024-09-23 10:00 ` [PATCH v1 2/3] rtc: mt6359: Add RTC hardware range and add support for start-year AngeloGioacchino Del Regno
2024-09-24  4:08   ` Macpaul Lin
2024-09-24  7:05     ` Macpaul Lin
2024-09-24  9:30       ` AngeloGioacchino Del Regno [this message]
2024-09-24  9:28     ` AngeloGioacchino Del Regno
2024-09-23 10:00 ` [PATCH v1 3/3] rtc: mt6359: Use RTC_TC_DOW hardware register for wday AngeloGioacchino Del Regno
2024-11-11 21:04 ` (subset) [PATCH v1 0/3] rtc: mt6359: Cleanup and support start-year property Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72ce817e-63de-40a7-b7e9-a5b44b67e207@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=ZhanZhan.ge@mediatek.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eddie.huang@mediatek.com \
    --cc=kernel@collabora.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=macpaul.lin@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=sen.chu@mediatek.com \
    --cc=yong.mao@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox