Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp37401pxt; Wed, 4 Aug 2021 05:26:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySMqXofJIXffwxM+zifDAHFmBMtGIjTVc+nPIJ5Gk+cCHv8+BKSxFvpmyeCrP9+uHTvMSb X-Received: by 2002:a02:cc22:: with SMTP id o2mr6047391jap.26.1628080005001; Wed, 04 Aug 2021 05:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628080004; cv=none; d=google.com; s=arc-20160816; b=rk8uhhO3PLS/Qr/1Pt/plX5ALrmCQNAMpzslz8U9N+hzAGokL47xxeIADKxwyAB1mq zmjEmRX/OZaUVb9gesusHRKtBW372HCMWctyj5dH+OfahSJMwLBlkvr2AEn9bU7oi+JZ moJr+wUxXpq8Fuvre2tmSdjeh6HcpL+hHhW891lymygbutR5N+4F8BoNH7UuutIboKRs eisrk9hIBOOqt6tRPjCtAtjT/GQkPRd3dy1pZNWue6gz0aoy0D9kcSy8Zf6pQTPBkNRY yOow32kxGwbCa9XmK/w5lP1ulzJTJuk0qAdRhT0q7BzJEushngXWkwL4ira+68GJ7rvF 4mEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bVgJShFt+YT9d1Abl4IzcM318iVx3cW5xk67/PwT/DQ=; b=TuH9y1/SGHRAYeQyNx2Hj/OK/aOVIduw+yv8wpJEKIQCrIs3GHHsQgGfAbTxcLSN+g 45/NSHEkWvZJbCCzz4C837h3c421qpDRiASdmw72UzJJjb37yIfF5ivKO4L4hcQhMtvT vkbiE+732sxc/e7mVxf7WSfdoJo9PWTNV+RFYHAGdfwguV3dv2aj4JtIyyunkJQDWtBH cRyV2uEKQXMXTkw6XXh18JB+hrPzY2DXFfwiJukxppqJaRbPo54Dgx3uzYz4ZvwRtQO8 p7gs1lAj+knOvpKX8Xtje9D35v7/Uxu8i7frJFbUPSIT+b9wEXxXpB9CFqZHyzpdu2eG dMCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k18si2272008ilq.156.2021.08.04.05.26.32; Wed, 04 Aug 2021 05:26:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237533AbhHDKnP (ORCPT + 99 others); Wed, 4 Aug 2021 06:43:15 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:35531 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237402AbhHDKmh (ORCPT ); Wed, 4 Aug 2021 06:42:37 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id B1223FF807; Wed, 4 Aug 2021 10:42:20 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 4/4] rtc: s5m: set range Date: Wed, 4 Aug 2021 12:41:32 +0200 Message-Id: <20210804104133.5158-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210804104133.5158-1-alexandre.belloni@bootlin.com> References: <20210804104133.5158-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The S5M8763X type seems to handles dates from year 0000 to 9999, there is no info on leap year handling after 2099. The other models handles dates from 2000 to 2099. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-s5m.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index 87df797758fc..fb9c6b709e13 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -204,15 +204,9 @@ static int s5m8767_tm_to_data(struct rtc_time *tm, u8 *data) data[RTC_WEEKDAY] = 1 << tm->tm_wday; data[RTC_DATE] = tm->tm_mday; data[RTC_MONTH] = tm->tm_mon + 1; - data[RTC_YEAR1] = tm->tm_year > 100 ? (tm->tm_year - 100) : 0; + data[RTC_YEAR1] = tm->tm_year - 100; - if (tm->tm_year < 100) { - pr_err("RTC cannot handle the year %d\n", - 1900 + tm->tm_year); - return -EINVAL; - } else { - return 0; - } + return 0; } /* @@ -792,6 +786,14 @@ static int s5m_rtc_probe(struct platform_device *pdev) info->rtc_dev->ops = &s5m_rtc_ops; + if (info->device_type == S5M8763X) { + info->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_0000; + info->rtc_dev->range_max = RTC_TIMESTAMP_END_9999; + } else { + info->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_2000; + info->rtc_dev->range_max = RTC_TIMESTAMP_END_2099; + } + if (!info->irq) { clear_bit(RTC_FEATURE_ALARM, info->rtc_dev->features); } else { -- 2.31.1