Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2976735rwb; Mon, 19 Sep 2022 12:57:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Sr+/xLXtmx8oH5VCl7iyBll4lWsuKtVMXjt8QbMpFyGDGjETbnoO85Y7vWtLNE1ZKkp7Q X-Received: by 2002:a17:906:6a14:b0:774:a998:d9a2 with SMTP id qw20-20020a1709066a1400b00774a998d9a2mr13712008ejc.496.1663617473257; Mon, 19 Sep 2022 12:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663617473; cv=none; d=google.com; s=arc-20160816; b=uvUvyFkDEjXO/QbiMShJnnyXcNxKjPwlalf0LeYTkDmfPDj4ruQe/eKSYMlVc/7JZG sxj/QD+nNgb2Sv50dBjDSmNRf0yt3Aw8sYjnfjsCHZzn3TRg39R6GMsv0AIL3MEWnKI3 UlZ/eX1LyAMGOaEiFwDO4IGK43K9STqi2H1FXqlhlaWsO18j0pyYXj5DGC9RLvDWw7A8 /9VYfYRQSWwA/nQOSet0kfG0/KI+Mm0hNzxaYANDoowYBrpMKDgpizKfngG8R6mmw55M sqk9G/I35cM7tUVR30K8w52y0vtayfqISzv2m+SeieypWYQUQDf/qL5hs8ipSNp0vyv5 K7fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XFv8/s07GWCJPcBdBdWUf3TF+ajCiKTrMdsn8auNwkw=; b=oNPnrDcR2fyQbZxgYGc1vx9uUMuTfA/7sKlN3NAjUcn4Ab959fPhkXV5gM9AWE6n7d PNkZyo8VOtOxA55AYgDAKqzHc0n/vSa4r5MkdsCMaJj3+aHD+U8FnKTXZCo9+diIDqJh M2p3CEnfsxcTkCV1xpa25VMhRHL3MFf/sTiPv9fyXwmT9okAoJPBEtFIG4UkdHTY8CED t2hX/CaWk0prW6QeNo/Jvnw2j8iemTlhimDw0klZ65xEOSvrrUKgFxaH98TQqngLLSlR tTNlGTnFJLCqQg0XHNkwbAlaozg57M1MTctOF7P5/XdWDh+ED6H6r3wSFKqO7Y1r0XlN hImQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=f0DIRu0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd11-20020a1709069b8b00b0077081057215si1249719ejc.956.2022.09.19.12.57.28; Mon, 19 Sep 2022 12:57:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=f0DIRu0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229599AbiISTjy (ORCPT + 99 others); Mon, 19 Sep 2022 15:39:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiISTjx (ORCPT ); Mon, 19 Sep 2022 15:39:53 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB66415727; Mon, 19 Sep 2022 12:39:50 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id a41so744790edf.4; Mon, 19 Sep 2022 12:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=XFv8/s07GWCJPcBdBdWUf3TF+ajCiKTrMdsn8auNwkw=; b=f0DIRu0cqDxg5c/CwpkHebVvvJ0PzpsnxQJECBvzLov876B4CbJwMeNmxF5At7uNE5 zNcmi/nLJljwJMSGY3Q/PyG4HdodW/GJm+tO44bauRTke3EbRSBuG5smK480Fphp7wee Jex8inaCvwds8GMO/hZql6j9RkMY0VO3Ds0zDwKk8+KfO/jV4bCrxrUZd0d5p/pjJX/e wK3+ijWqiV6atwOrNaDU4LblXv/2Nlybdg/H5OrxtQ7w8ww6UIiF19TEWSCdy1mSlBnn 08ffeAuGNGOEMF29M9rxRWaj/EuZ5PZH9Wrn+cibHrx7+CHLp8PeGyxuBi6OHj2a8Zgd zJIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=XFv8/s07GWCJPcBdBdWUf3TF+ajCiKTrMdsn8auNwkw=; b=zDUJLVvqS8KF45oCLLpUn9FeHCBdS3Zb9mcfyQuAFtSptfj+9RX9c8kMwr0ETKJJz7 31vJLKIqs7Rl93z0RFf10qxNqlVWjqkwGtptIpRKCa0xYyXyfCfyCBA9Ti2DTeALYxXb LpOzrqDw2V7fKJzkJvD8wKQY/krEszVo/0TAuKQ9KnRYGDknbbC2LisBqDDQ9AiXoZIe OvuhK2pxBfO++vMeFA3rq080ooQYbW9I3nCOysOFUfAGFR6G2DtdXsVD45mv9/EOYo75 9CkBiA8yMSyCBGQvkuwJFBbbkQ6S1RAJrr1+TqnIyiyf32QtVXeN8YjnXO+KppCH6t6e hVAQ== X-Gm-Message-State: ACrzQf2lC+XmI9u3/0jdNHJmbYI/wlVPgFIJr5J0/Ip2VmCxVfBp8wRB W2rrloUr1q1FKnDrsvAVcdAgTdBqX1NvFVCCULs= X-Received: by 2002:a05:6402:2789:b0:451:a578:74dd with SMTP id b9-20020a056402278900b00451a57874ddmr17033392ede.72.1663616389164; Mon, 19 Sep 2022 12:39:49 -0700 (PDT) MIME-Version: 1.0 References: <20220912190753.10158-1-jagathjog1996@gmail.com> <20220912190753.10158-3-jagathjog1996@gmail.com> In-Reply-To: From: Jagath Jog J Date: Tue, 20 Sep 2022 01:09:37 +0530 Message-ID: Subject: Re: [PATCH v2 2/2] rtc: maxim: Add Maxim max31329 real time clock To: Alexandre Belloni Cc: a.zummo@towertech.it, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexandre, Before sending v3 I have one comment, Please see below. On Mon, Sep 19, 2022 at 12:18 AM Alexandre Belloni wrote: > > On 17/09/2022 16:09:54+0530, Jagath Jog J wrote: > > > This doesn't feel right, doesn't that break start-year? > > > > > > What is the actual time range supported by this RTC? Shouldn't you set > > > the century? > > > > The time range supported by RTC is 2000 to 2199. > > The alarm registers don't have a century bit. > > I have tested the alarm for > > 2122-09-17T01:22:00 > > 2142-09-17T01:22:00 > > 2160-02-29T00:00:00 > > 2196-02-29T00:00:00 etc > > > > I will add another condition such that if the century bit > > from the time register is not set then configuring the > > alarm for the next century is not allowed. > > The actual check should be for the alarm to not exceed 100 years in the > future then. Else, this wouldn't work well with datetime offsetting. Sure, I will add this check. > > > > > +static int max31329_set_time(struct device *dev, struct rtc_time *tm) > > > > +{ > > > > + struct max31329_data *max31329 = dev_get_drvdata(dev); > > > > + u8 regs[7]; > > > > + int ret; > > > > + > > > > + ret = max31329_get_osc_status(dev); > > > > + if (ret) > > > > + return ret; > > > > + > > > > > > Checking the oscillator is not needed here but resetting the status is. > > > > Resetting the device will resets the digital block, > > I2C-programmable registers and oscillator also, > > The oscillator is taking some time around 80 milli sec > > to be back as usual. > > > > Is it required to reset every time during the time setting? > > > > Not but resetting the osc status is. Actually, the STATUS register which contains the Oscillator Stop Flag (OSF) bit is a read-only register. If the OSF bit is set, then reading the status register will not clear the OSF bit. Based on the oscillator disable and enable testing, I observed that the OSF bit is getting cleared automatically once the clock settles, which is taking around 80msec. The manual resetting option is not there for the OSC status bit. Can I set the time without resetting the OSC status? Thank you, Jagath > > > -- > Alexandre Belloni, co-owner and COO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com