{"id":638520,"url":"http://patchwork.ozlabs.org/api/patches/638520/?format=json","web_url":"http://patchwork.ozlabs.org/project/rtc-linux/patch/1466493770-11895-12-git-send-email-andrew.smirnov@gmail.com/","project":{"id":9,"url":"http://patchwork.ozlabs.org/api/projects/9/?format=json","name":"Linux RTC development","link_name":"rtc-linux","list_id":"linux-rtc.vger.kernel.org","list_email":"linux-rtc@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1466493770-11895-12-git-send-email-andrew.smirnov@gmail.com>","list_archive_url":null,"date":"2016-06-21T07:22:46","name":"[v2,13/17] RTC: ds1307: Report oscillator problems more intelligently","commit_ref":null,"pull_url":null,"state":"rejected","archived":false,"hash":"fb55054c0305494c1cf033cddac68ca1f3605e23","submitter":{"id":67013,"url":"http://patchwork.ozlabs.org/api/people/67013/?format=json","name":"Andrey Smirnov","email":"andrew.smirnov@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/rtc-linux/patch/1466493770-11895-12-git-send-email-andrew.smirnov@gmail.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/638520/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/638520/checks/","tags":{},"related":[],"headers":{"Return-Path":"<rtc-linux+bncBDKOBWPM5ABRBXWWUO5QKGQEFCNBBNI@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Received":["from mail-pf0-x23a.google.com (mail-pf0-x23a.google.com\n\t[IPv6:2607:f8b0:400e:c00::23a])\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 3rYfMg4hYpz9t0V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 21 Jun 2016 17:23:11 +1000 (AEST)","by mail-pf0-x23a.google.com with SMTP id g62sf2802529pfb.1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 21 Jun 2016 00:23:11 -0700 (PDT)","by 10.157.41.146 with SMTP id n18ls3603661otb.1.gmail; Tue, 21 Jun\n\t2016 00:23:10 -0700 (PDT)","from mail-pf0-x241.google.com (mail-pf0-x241.google.com.\n\t[2607:f8b0:400e:c00::241]) by gmr-mx.google.com with ESMTPS id\n\tpo17si907962pab.2.2016.06.21.00.23.10\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 00:23:10 -0700 (PDT)","by mail-pf0-x241.google.com with SMTP id t190so762020pfb.2\n\tfor <rtc-linux@googlegroups.com>;\n\tTue, 21 Jun 2016 00:23:10 -0700 (PDT)","from squirtle.localdomain.localdomain\n\t(c-73-225-163-254.hsd1.wa.comcast.net. [73.225.163.254])\n\tby smtp.gmail.com with ESMTPSA id\n\tp187sm19452396pfg.67.2016.06.21.00.23.09\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 21 Jun 2016 00:23:09 -0700 (PDT)"],"Authentication-Results":"ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=iBg1SuFP; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=zbaRDxD3;\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:from:to:cc:subject:date:message-id:in-reply-to\n\t:references: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=fGqBHL98pdAeu0wlw+gntGT0O4QkAq5Sr+Uy57Cep0c=;\n\tb=iBg1SuFPssa1UDKHQaes2HNfDqrAi9CO3GgHRu8W5P0p/6eIOzrzX/wgyNt9gWknp/\n\t368iZIX9m+9JVP1Y3aWNpBHnxcTH0ZfAXuvom/0FlHjnr4n1ynn967qukyGtINfmFa+B\n\taHQiB0nZvvu2gFpynpvYw4dRFC6woBvXbsvUfUQEzgaIlEr4IaSLXDvbkHHk9Bej0WWt\n\tbmuLOzu5En/iKs7kb/h7Pkxk8GyRS5H5sNjLe04fd2TrhlFSYNAZD9yeMUbrcKk5wa1h\n\tc7/obDCE2b/01Y/Q+0GmzVpxe82bEM5+Uu7WJXNz/prLbypaE0Jzm4EjOY5eb8N4fhp7\n\tLLfQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20120113;\n\th=mime-version:from:to:cc:subject:date:message-id:in-reply-to\n\t:references: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=fGqBHL98pdAeu0wlw+gntGT0O4QkAq5Sr+Uy57Cep0c=;\n\tb=zbaRDxD3XYeV8M/ura4uL1soSsbEXRV7RzLMfRHr03wTUMs3bhz1LPtTsesodbs7MJ\n\tTQAOFCdSJNtcRDdrnHoE/ubI9BbdNPQsNIaETUFCdgobHSGd7wJ3gfRcrsjGLxdqfIhs\n\tMq/jzj0oGYwmYSuppK+GuR2NArXw+IyvHYxXL2uHECGVQ4cbxYoB2iENrVH/3QV+4nUu\n\tWSZub9JVbTvo0EBGwbo9mt6J/OqZDazqZzEQr+6HkMQ8+us5ZhSd8Op7KiMPJ973sWg3\n\tQUEMU8FD3qOVt98zWlmGxnELdzmXsAqmV+7uymRuAzMmr/JfORD/IrGXhY101HXm6lzk\n\tBGww=="],"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:from:to:cc:subject:date\n\t:message-id:in-reply-to:references: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=fGqBHL98pdAeu0wlw+gntGT0O4QkAq5Sr+Uy57Cep0c=;\n\tb=iRU1zGkAtpAEafR+plD1YOudBlDAMxT+sPlLPKHZntOoHkrNkcSGsExOxOf7sc27zC\n\tVBI97kWar00z49zBn6vN95LrDgtKZC51LpvxSmIoWpUgtfKzbmA+f6hqTuROGpnyONHo\n\t4p1Fyye/lB3vcVi3j0rCqSsSkqvOsNWNJxhshSMHLgsQ45bWeNySofeVVBqHQc0c5e9m\n\t9nrfq1bDuEzjoo8Z6w/P3EkTNXc3LOkPRqFBRJOmlLZWY5KDGxZcYJAttq0Lo8UIjc6E\n\tMC2nvWSXkS6BpwNduV/0n58cS9XsgxdMtZpUhCq2tBma2zt+Yfd+yZ2qwXy2n65MRfbj\n\tPPGA==","Sender":"rtc-linux@googlegroups.com","X-Gm-Message-State":"ALyK8tIh62C/UIgz1aEkjHXbR81//3f/8fUI0V36ZnOH4iYmMfQHn9xq86I6/s4ytJTqeA==","X-Received":["by 10.157.37.28 with SMTP id k28mr606930otb.18.1466493790326;\n\tTue, 21 Jun 2016 00:23:10 -0700 (PDT)","by 10.157.18.215 with SMTP id g81mr21856173otg.16.1466493790129; \n\tTue, 21 Jun 2016 00:23:10 -0700 (PDT)","by 10.98.196.203 with SMTP id h72mr26231255pfk.54.1466493789855; \n\tTue, 21 Jun 2016 00:23:09 -0700 (PDT)"],"MIME-Version":"1.0","X-BeenThere":"rtc-linux@googlegroups.com","Received-SPF":"pass (google.com: domain of andrew.smirnov@gmail.com\n\tdesignates 2607:f8b0:400e:c00::241 as permitted sender)\n\tclient-ip=2607:f8b0:400e:c00::241; ","From":"Andrey Smirnov <andrew.smirnov@gmail.com>","To":"rtc-linux@googlegroups.com","Cc":"Andrey Smirnov <andrew.smirnov@gmail.com>,\n\tAlessandro Zummo <a.zummo@towertech.it>,\n\tAlexandre Belloni <alexandre.belloni@free-electrons.com>,\n\tlinux-kernel@vger.kernel.org, cphealy@gmail.com","Subject":"[rtc-linux] [PATCH v2 13/17] RTC: ds1307: Report oscillator problems\n\tmore intelligently","Date":"Tue, 21 Jun 2016 00:22:46 -0700","Message-Id":"<1466493770-11895-12-git-send-email-andrew.smirnov@gmail.com>","X-Mailer":"git-send-email 2.5.5","In-Reply-To":"<1466493770-11895-1-git-send-email-andrew.smirnov@gmail.com>","References":"<1466493770-11895-1-git-send-email-andrew.smirnov@gmail.com>","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:400e:c00::241 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","Content-Type":"text/plain; charset=UTF-8","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>"},"content":"Report oscillator problems more intelligently, by printing more\ninformation about what cause the issue and not yelling \"SET TIME!\" at\nthe user.\n\nSigned-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>\n---\n drivers/rtc/rtc-ds1307.c | 28 +++++++++++++++++++++++-----\n 1 file changed, 23 insertions(+), 5 deletions(-)","diff":"diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c\nindex 2af9c00..2169e5b 100644\n--- a/drivers/rtc/rtc-ds1307.c\n+++ b/drivers/rtc/rtc-ds1307.c\n@@ -1424,6 +1424,19 @@ static int ds1307_chip_configure(const struct ds1307 *ds1307)\n \treturn 0;\n }\n \n+static void ds1307_report_clock_halt(const struct ds1307 *ds1307)\n+{\n+\tdev_warn(&ds1307->client->dev, \"RTC's oscillator is turned off. \"\n+\t\t \"Turning it on. Please set time\");\n+}\n+\n+static void ds1307_report_oscillator_fault(const struct ds1307 *ds1307)\n+{\n+\tdev_warn(&ds1307->client->dev, \"RTC's reported oscillator fault. \"\n+\t\t \"Clearing the fault flag and re-reading RTC status. \"\n+\t\t \"Please set time\");\n+}\n+\n static int ds1307_chip_sanity_check(const struct ds1307 *ds1307)\n {\n \tint tmp, retries;\n@@ -1453,7 +1466,7 @@ static int ds1307_chip_sanity_check(const struct ds1307 *ds1307)\n \t\t\tif (tmp & DS1307_BIT_CH) {\n \t\t\t\ti2c_smbus_write_byte_data(client,\n \t\t\t\t\t\t\t  DS1307_REG_SECS, 0);\n-\t\t\t\tdev_warn(&client->dev, \"SET TIME!\\n\");\n+\t\t\t\tds1307_report_clock_halt(ds1307);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tbreak;\n@@ -1469,15 +1482,17 @@ static int ds1307_chip_sanity_check(const struct ds1307 *ds1307)\n \t\t\t\t\t\t\t  DS1307_REG_CONTROL,\n \t\t\t\t\t\t\t  regs[DS1307_REG_CONTROL]\n \t\t\t\t\t\t\t  & ~DS1338_BIT_OSF);\n-\t\t\t\tdev_warn(&client->dev, \"SET TIME!\\n\");\n+\t\t\t\tds1307_report_oscillator_fault(ds1307);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tbreak;\n \t\tcase ds_1340:\n \t\t\t/* clock halted?  turn it on, so clock can tick. */\n-\t\t\tif (tmp & DS1340_BIT_nEOSC)\n+\t\t\tif (tmp & DS1340_BIT_nEOSC) {\n \t\t\t\ti2c_smbus_write_byte_data(client,\n \t\t\t\t\t\t\t  DS1307_REG_SECS, 0);\n+\t\t\t\tds1307_report_clock_halt(ds1307);\n+\t\t\t}\n \n \t\t\ttmp = i2c_smbus_read_byte_data(client, DS1340_REG_FLAG);\n \t\t\tif (tmp < 0) {\n@@ -1489,7 +1504,7 @@ static int ds1307_chip_sanity_check(const struct ds1307 *ds1307)\n \t\t\tif (tmp & DS1340_BIT_OSF) {\n \t\t\t\ti2c_smbus_write_byte_data(client,\n \t\t\t\t\t\t\t  DS1340_REG_FLAG, 0);\n-\t\t\t\tdev_warn(&client->dev, \"SET TIME!\\n\");\n+\t\t\t\tds1307_report_oscillator_fault(ds1307);\n \t\t\t}\n \t\t\treturn 0;\n \n@@ -1500,6 +1515,9 @@ static int ds1307_chip_sanity_check(const struct ds1307 *ds1307)\n \t\t\t\t\t\t\t  DS1307_REG_WDAY,\n \t\t\t\t\t\t\t  regs[DS1307_REG_WDAY]\n \t\t\t\t\t\t\t  | MCP794XX_BIT_VBATEN);\n+\t\t\t\tdev_warn(&client->dev,\n+\t\t\t\t\t \"battery backup was disabled. \"\n+\t\t\t\t\t \"Re-enabling it\\n\");\n \t\t\t}\n \n \t\t\t/* clock halted?  turn it on, so clock can tick. */\n@@ -1507,7 +1525,7 @@ static int ds1307_chip_sanity_check(const struct ds1307 *ds1307)\n \t\t\t\ti2c_smbus_write_byte_data(client,\n \t\t\t\t\t\t\t  DS1307_REG_SECS,\n \t\t\t\t\t\t\t  MCP794XX_BIT_ST);\n-\t\t\t\tdev_warn(&client->dev, \"SET TIME!\\n\");\n+\t\t\t\tds1307_report_clock_halt(ds1307);\n \t\t\t\tcontinue;\n \t\t\t}\n \n","prefixes":["v2","13/17"]}