[{"id":1386303,"web_url":"http://patchwork.ozlabs.org/comment/1386303/","msgid":"<20160621211712.GZ5809@piout.net>","list_archive_url":null,"date":"2016-06-21T21:17:12","subject":"[rtc-linux] Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave\n\tand timers as default","submitter":{"id":26276,"url":"http://patchwork.ozlabs.org/api/people/26276/","name":"Alexandre Belloni","email":"alexandre.belloni@free-electrons.com"},"content":"On 21/06/2016 at 00:22:35 -0700, Andrey Smirnov wrote :\n> Disable square wave and timers as default for DS1337/39/41 and\n> DS3231. The rationale being that configuring a chip this way puts it\n> into a known state with lower power consumption. While it is not very\n> likely it is still possible that the code controlling RTCs that ran\n> before this driver configured it to produce square wave and left it in\n> such a state.\n> \n\nThe main issue being that if it has been configured that way (from the\nbootloader for example). It is probably necessary for the board. There\nmay be users of that clock and this patch definitively breaks them.\nThe proper way of doing that is to add CCF support in the driver. See:\nhttp://patchwork.ozlabs.org/patch/576201/\n\n> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>\n> ---\n>  drivers/rtc/rtc-ds1307.c | 12 +++++-------\n>  1 file changed, 5 insertions(+), 7 deletions(-)\n> \n> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c\n> index 7e65e2e..c618c22 100644\n> --- a/drivers/rtc/rtc-ds1307.c\n> +++ b/drivers/rtc/rtc-ds1307.c\n> @@ -1320,19 +1320,17 @@ static int ds1307_probe(struct i2c_client *client,\n>  \t\t\tds1307->regs[0] &= ~DS1337_BIT_nEOSC;\n>  \n>  \t\t/*\n> -\t\t * Using IRQ or defined as wakeup-source?\n>  \t\t * Disable the square wave and both alarms.\n>  \t\t * For some variants, be sure alarms can trigger when we're\n>  \t\t * running on Vbackup (BBSQI/BBSQW)\n>  \t\t */\n> -\t\tif (chip->alarm && (ds1307->client->irq > 0 ||\n> -\t\t\t\t\t\tds1307_can_wakeup_device)) {\n> -\t\t\tds1307->regs[0] |= DS1337_BIT_INTCN\n> -\t\t\t\t\t| bbsqi_bitpos[ds1307->type];\n> -\t\t\tds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);\n> +\t\tds1307->regs[0] |= DS1337_BIT_INTCN\n> +\t\t\t| bbsqi_bitpos[ds1307->type];\n> +\t\tds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);\n>  \n> +\t\tif (chip->alarm && (ds1307->client->irq > 0 ||\n> +\t\t\t\t    ds1307_can_wakeup_device))\n>  \t\t\twant_irq = true;\n> -\t\t}\n>  \n>  \t\ti2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,\n>  \t\t\t\t\t\t\tds1307->regs[0]);\n> -- \n> 2.5.5\n>","headers":{"Return-Path":"<rtc-linux+bncBCKYNX7Y3IMBBWO5U25QKGQE7EVMMAI@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Received":["from mail-lb0-x240.google.com (mail-lb0-x240.google.com\n\t[IPv6:2a00:1450:4010:c04::240])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rZ0t46VPjz9sR8\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 22 Jun 2016 07:17:16 +1000 (AEST)","by mail-lb0-x240.google.com with SMTP id l7sf13309379lbr.0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 21 Jun 2016 14:17:16 -0700 (PDT)","by 10.25.209.197 with SMTP id i188ls192108lfg.70.gmail; Tue, 21 Jun\n\t2016 14:17:13 -0700 (PDT)","from mail.free-electrons.com (down.free-electrons.com.\n\t[37.187.137.238]) by gmr-mx.google.com with ESMTP id\n\ta186si153057wma.1.2016.06.21.14.17.13\n\tfor <rtc-linux@googlegroups.com>;\n\tTue, 21 Jun 2016 14:17:13 -0700 (PDT)","by mail.free-electrons.com (Postfix, from userid 110)\n\tid 849892B0; Tue, 21 Jun 2016 23:17:12 +0200 (CEST)","from localhost (unknown [88.191.26.124])\n\tby mail.free-electrons.com (Postfix) with ESMTPSA id 51E2D1BD;\n\tTue, 21 Jun 2016 23:17:12 +0200 (CEST)"],"Authentication-Results":"ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=iqlWabxz; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlegroups.com; s=20120806;\n\th=sender:date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to:user-agent:x-original-sender\n\t:x-original-authentication-results:reply-to:precedence:mailing-list\n\t:list-id:x-spam-checked-in-group:list-post:list-help:list-archive\n\t:list-subscribe:list-unsubscribe;\n\tbh=lTYCxP/MyFnS/WzDzC84tfwBtTF+yiMX/tyumkpw3pM=;\n\tb=iqlWabxzPHQ01E3cQu1dr1oaNmUBEjmtzpK18Rw6yYcJB1h8NP0Zh3a9QpKSLCqVjK\n\tIi10ToC4coDERx4Oez/SicjC+kB8UZOEhXRp9t7x0dEFzAhT83vRk4oUSVyEjiKDLg2P\n\t4ZKQMR8x/njUDjI/lvMbmwtao5FoNyhVHMTWnGQNKr9h2wk8G9G53AyZhVpSaOEBwQGX\n\tA46y81Ml79s0yx8k8uDwN5B6Ey4MFoOREmlMCmO5HrKxd8erl1t1RH7UotClYDkewCEe\n\ttYBtjvJVq9sB/JA9GFvRHoDEPceTSeS6ESZGvghuEmDWHz4YWcijoLVYt25p9zpk65qA\n\tiw6Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=sender:x-gm-message-state:date:from:to:cc:subject:message-id\n\t:references:mime-version:content-disposition:in-reply-to:user-agent\n\t:x-original-sender:x-original-authentication-results:reply-to\n\t:precedence:mailing-list:list-id:x-spam-checked-in-group:list-post\n\t:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=lTYCxP/MyFnS/WzDzC84tfwBtTF+yiMX/tyumkpw3pM=;\n\tb=fQTF8onJzJ3K2ATLzk5v/3TKTONFcBri7kOdD/BKCpzR/flz78dkwkiKTWzoEarnLq\n\tl5HusbwEACskAp4S54V4JkUJRTLyl51p70AW3IdboJSkqJd2uTYU1pHAb6KQLOiRfuqB\n\tRfG48uYm5OQu5EMYSQOibjPFlS4/om6yBbN+N8S7vtrT66QLuyPdrdg8dMexfk3y8/GD\n\tk2DiJpwwZ+bBaJf8VJrR3yNBlWOALzVYlDg3/ffrC2jfZINaXR/HRELYpDWj08PMIqLP\n\tayWaaG0+2ZeGwN9JTNvk01UhkgnpDOkecVAqsJZ1NJeiRSipQT/iBckE1ZxpfUf+F17v\n\tFqeg==","Sender":"rtc-linux@googlegroups.com","X-Gm-Message-State":"ALyK8tJbfhP/ZF4+TAt732/dnkax8HGVOihQWjVLsmdD87vIgk7OJZ0b7Z7ZrnLHkRNzbw==","X-Received":["by 10.25.84.18 with SMTP id i18mr69342lfb.20.1466543833667;\n\tTue, 21 Jun 2016 14:17:13 -0700 (PDT)","by 10.46.1.38 with SMTP id 38mr589420ljb.3.1466543833267;\n\tTue, 21 Jun 2016 14:17:13 -0700 (PDT)"],"X-BeenThere":"rtc-linux@googlegroups.com","Received-SPF":"pass (google.com: domain of\n\talexandre.belloni@free-electrons.com designates\n\t37.187.137.238 as permitted sender) client-ip=37.187.137.238; ","X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tmail.free-electrons.com","X-Spam-Level":"","X-Spam-Status":"No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT,\n\tURIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0","Date":"Tue, 21 Jun 2016 23:17:12 +0200","From":"Alexandre Belloni <alexandre.belloni@free-electrons.com>","To":"Andrey Smirnov <andrew.smirnov@gmail.com>","Cc":"rtc-linux@googlegroups.com, Alessandro Zummo <a.zummo@towertech.it>,\n\tlinux-kernel@vger.kernel.org, cphealy@gmail.com","Subject":"[rtc-linux] Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave\n\tand timers as default","Message-ID":"<20160621211712.GZ5809@piout.net>","References":"<1466493770-11895-1-git-send-email-andrew.smirnov@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Disposition":"inline","In-Reply-To":"<1466493770-11895-1-git-send-email-andrew.smirnov@gmail.com>","User-Agent":"Mutt/1.6.0 (2016-04-01)","X-Original-Sender":"alexandre.belloni@free-electrons.com","X-Original-Authentication-Results":"gmr-mx.google.com;       spf=pass\n\t(google.com: domain of alexandre.belloni@free-electrons.com\n\tdesignates\n\t37.187.137.238 as permitted sender)\n\tsmtp.mailfrom=alexandre.belloni@free-electrons.com","Reply-To":"rtc-linux@googlegroups.com","Precedence":"list","Mailing-list":"list rtc-linux@googlegroups.com;\n\tcontact rtc-linux+owners@googlegroups.com","List-ID":"<rtc-linux.googlegroups.com>","X-Spam-Checked-In-Group":"rtc-linux@googlegroups.com","X-Google-Group-Id":"712029733259","List-Post":"<https://groups.google.com/group/rtc-linux/post>,\n\t<mailto:rtc-linux@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n\t<mailto:rtc-linux+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/rtc-linux","List-Subscribe":"<https://groups.google.com/group/rtc-linux/subscribe>,\n\t<mailto:rtc-linux+subscribe@googlegroups.com>","List-Unsubscribe":"<mailto:googlegroups-manage+712029733259+unsubscribe@googlegroups.com>,\n\t<https://groups.google.com/group/rtc-linux/subscribe>"}},{"id":1386410,"web_url":"http://patchwork.ozlabs.org/comment/1386410/","msgid":"<CAHQ1cqGp9kDDWS0bVtTUayQBkKxC1FJNfjURfcjTvX732oauDQ@mail.gmail.com>","list_archive_url":null,"date":"2016-06-21T23:43:45","subject":"[rtc-linux] Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave\n\tand timers as default","submitter":{"id":67013,"url":"http://patchwork.ozlabs.org/api/people/67013/","name":"Andrey Smirnov","email":"andrew.smirnov@gmail.com"},"content":"On Tue, Jun 21, 2016 at 2:17 PM, Alexandre Belloni\n<alexandre.belloni@free-electrons.com> wrote:\n> On 21/06/2016 at 00:22:35 -0700, Andrey Smirnov wrote :\n>> Disable square wave and timers as default for DS1337/39/41 and\n>> DS3231. The rationale being that configuring a chip this way puts it\n>> into a known state with lower power consumption. While it is not very\n>> likely it is still possible that the code controlling RTCs that ran\n>> before this driver configured it to produce square wave and left it in\n>> such a state.\n>>\n>\n> The main issue being that if it has been configured that way (from the\n> bootloader for example). It is probably necessary for the board. There\n> may be users of that clock and this patch definitively breaks them.\n> The proper way of doing that is to add CCF support in the driver. See:\n> http://patchwork.ozlabs.org/patch/576201/\n\nImplementing CCF support would still break users who rely on this\nparticular behavior and they would still have to spend effort\nmodifying their boards' device tree blob, so doing it the way you\npropose wouldn't really save those users from pain, it would just give\nthem a way out.\n\nUnfortunately, I don't have a bandwidth to develop and test a feature\nthat I don't have a use-case for, so I'll drop this patch from v3.\n\nAndrey","headers":{"Return-Path":"<rtc-linux+bncBDKOBWPM5ABRBMVCU65QKGQE4NHJKRY@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Received":["from mail-io0-x23e.google.com (mail-io0-x23e.google.com\n\t[IPv6:2607:f8b0:4001:c06::23e])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rZ4786hrNz9t0Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 22 Jun 2016 09:43:48 +1000 (AEST)","by mail-io0-x23e.google.com with SMTP id 100sf12833965ioh.1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 21 Jun 2016 16:43:48 -0700 (PDT)","by 10.157.37.125 with SMTP id j58ls4244156otd.67.gmail; Tue, 21 Jun\n\t2016 16:43:46 -0700 (PDT)","from mail-yw0-x22f.google.com (mail-yw0-x22f.google.com.\n\t[2607:f8b0:4002:c05::22f]) by gmr-mx.google.com with ESMTPS id\n\tz17si782332ywd.4.2016.06.21.16.43.46\n\tfor <rtc-linux@googlegroups.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 21 Jun 2016 16:43:46 -0700 (PDT)","by mail-yw0-x22f.google.com with SMTP id b72so28583530ywa.3\n\tfor <rtc-linux@googlegroups.com>;\n\tTue, 21 Jun 2016 16:43:46 -0700 (PDT)","by 10.83.35.205 with HTTP; Tue, 21 Jun 2016 16:43:45 -0700 (PDT)"],"Authentication-Results":"ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=WgG3NLPA; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=OZNib4TG;\n\tdkim-atps=neutral","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlegroups.com; s=20120806;\n\th=sender:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:x-original-sender:x-original-authentication-results\n\t:reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group\n\t:list-post:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=un/JFqHy6CAsidmNNJoAnvmhAwjY+ACZsk3OQ8jBI5A=;\n\tb=WgG3NLPA7s+BB3ZZ6Sd+4CS2/JmiMer4AaEruHyiTAQQzpAdxc06j7KrSiTZDJ4/Zn\n\tfWRyw3fd8Lr7MEsxm3kCa7L3bNVf875IKiRAiXDARQKwRsvCp0B0q/IOWaHbPUDtmTzh\n\t7q6H+OZyPTi8iqfJVJ2+O/ciLVGjESgAvDlk5s3dPSlXhXxfXCGf//Of2zg3dRynZ/qd\n\tAcK1k5g1kPGFokAjCRKnAoiWo/Yf640rZdTDKVcPlYUPcEJHzyU23PXYyu/ftl2OYFM5\n\tGvHlsStMhR3c6/r1ayyf6s4u6O6khfs2kr/LoN9aZIPI3AoDzs8IwIInjmro1O37c/Dq\n\tw50w==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20120113;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:x-original-sender:x-original-authentication-results:reply-to\n\t:precedence:mailing-list:list-id:x-spam-checked-in-group:list-post\n\t:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=un/JFqHy6CAsidmNNJoAnvmhAwjY+ACZsk3OQ8jBI5A=;\n\tb=OZNib4TGOEpu+/Lo3GGrt7eVinAH7crCb1nR0brFA7I3BG79Nreb0cEDsoLd5I9SxV\n\thibqwBdEnU0a3AgbDFNt50DAJbSFRYsSc9Z+HOg4b1U/cOO54yPnmg5AVAktVvokzGmS\n\tYgfP+McqLIGVfconhGPNXo0+gvEb/oTY+CNX8Q1RRIF9z0y7lzLVBn6EhvSunNCAU+EL\n\tBPDZwF9JlrHJ5jw0xC8cPw4MoW1jD+6eAMWt9n5bkZ/wIIUAgfqwjhLcatWJI1BuozM7\n\tUbG5YYvxnioy9vtn3FmAGAo2OcHmGAASAlw9DUKmb+paDeKD6tTgfRw4fIAB1F7347l5\n\tqQdA=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=sender:x-gm-message-state:mime-version:in-reply-to:references:from\n\t:date:message-id:subject:to:cc:x-original-sender\n\t:x-original-authentication-results:reply-to:precedence:mailing-list\n\t:list-id:x-spam-checked-in-group:list-post:list-help:list-archive\n\t:list-subscribe:list-unsubscribe;\n\tbh=un/JFqHy6CAsidmNNJoAnvmhAwjY+ACZsk3OQ8jBI5A=;\n\tb=Tk2xaXwcCn9Soyp70eXW3pbYVIWUVE1OL5y/kodP0Sv8nTRMYkeoRfxpdHP1bImbyR\n\tuNVp/4fsc/56y8YfLxXdkkfttTwCuwG0ib2exic68ghlPud05jEJOdCqXi8rlrDs7kUv\n\tS8+lgDQ+RjNkknezmUikLSZc56Yp0qMImp9GSiLrZPhad29ck0Q47xFjW+VDB91fk/Ct\n\tbGONF/3lfZbhaCL8FGYY8vCP88YSrZYd24Tp2GSs9dDzUrZ3kgzqJpDM94ul4ZkuOhA3\n\td8oyXaNKrkQ/doJykGvzdauFyIzKdgCexxeR3BSdqGB1mUkV9aqlHEjTQzQcuJpEpTUg\n\trVWg==","Sender":"rtc-linux@googlegroups.com","X-Gm-Message-State":"ALyK8tJfZQxEsKMCg5axRbje/9vYE3JCNrBNKn7YBLydjf9gfPuSVgbTAeY6PnZ+4/U1HQ==","X-Received":["by 10.157.48.52 with SMTP id d49mr905160otc.20.1466552626386;\n\tTue, 21 Jun 2016 16:43:46 -0700 (PDT)","by 10.129.162.6 with SMTP id z6mr29340923ywg.15.1466552626155;\n\tTue, 21 Jun 2016 16:43:46 -0700 (PDT)","by 10.37.16.130 with SMTP id 124mr13628887ybq.60.1466552625983; \n\tTue, 21 Jun 2016 16:43:45 -0700 (PDT)"],"X-BeenThere":"rtc-linux@googlegroups.com","Received-SPF":"pass (google.com: domain of andrew.smirnov@gmail.com\n\tdesignates 2607:f8b0:4002:c05::22f as permitted sender)\n\tclient-ip=2607:f8b0:4002:c05::22f; ","MIME-Version":"1.0","In-Reply-To":"<20160621211712.GZ5809@piout.net>","References":"<1466493770-11895-1-git-send-email-andrew.smirnov@gmail.com>\n\t<20160621211712.GZ5809@piout.net>","From":"Andrey Smirnov <andrew.smirnov@gmail.com>","Date":"Tue, 21 Jun 2016 16:43:45 -0700","Message-ID":"<CAHQ1cqGp9kDDWS0bVtTUayQBkKxC1FJNfjURfcjTvX732oauDQ@mail.gmail.com>","Subject":"[rtc-linux] Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave\n\tand timers as default","To":"Alexandre Belloni <alexandre.belloni@free-electrons.com>","Cc":"rtc-linux@googlegroups.com, Alessandro Zummo <a.zummo@towertech.it>, \n\tlinux-kernel@vger.kernel.org, Chris Healy <cphealy@gmail.com>","Content-Type":"text/plain; charset=UTF-8","X-Original-Sender":"andrew.smirnov@gmail.com","X-Original-Authentication-Results":"gmr-mx.google.com;       dkim=pass\n\theader.i=@gmail.com;       spf=pass (google.com: domain of\n\tandrew.smirnov@gmail.com designates 2607:f8b0:4002:c05::22f as\n\tpermitted\n\tsender) smtp.mailfrom=andrew.smirnov@gmail.com; dmarc=pass (p=NONE\n\tdis=NONE) header.from=gmail.com","Reply-To":"rtc-linux@googlegroups.com","Precedence":"list","Mailing-list":"list rtc-linux@googlegroups.com;\n\tcontact rtc-linux+owners@googlegroups.com","List-ID":"<rtc-linux.googlegroups.com>","X-Spam-Checked-In-Group":"rtc-linux@googlegroups.com","X-Google-Group-Id":"712029733259","List-Post":"<https://groups.google.com/group/rtc-linux/post>,\n\t<mailto:rtc-linux@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n\t<mailto:rtc-linux+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/rtc-linux","List-Subscribe":"<https://groups.google.com/group/rtc-linux/subscribe>,\n\t<mailto:rtc-linux+subscribe@googlegroups.com>","List-Unsubscribe":"<mailto:googlegroups-manage+712029733259+unsubscribe@googlegroups.com>,\n\t<https://groups.google.com/group/rtc-linux/subscribe>"}}]