From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Csókás, Bence" <csokas.bence@prolan.hu>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
"Szentendrei, Tamás" <szentendrei.tamas@prolan.hu>
Subject: Re: [PATCH resubmit] rtc: ds1307: Detect oscillator fail on mcp794xx
Date: Fri, 28 Jun 2024 00:37:03 +0200 [thread overview]
Message-ID: <202406272237033260538e@mail.local> (raw)
In-Reply-To: <20240621080512.2916664-1-csokas.bence@prolan.hu>
Hello,
It is not clear to me why your resent this one but not the other one,
can you elaborate?
On 21/06/2024 10:05:13+0200, Csókás, Bence wrote:
> This patch enables the detection of the oscillator failure
> on mcp794xx chips.
>
> Co-developed-by: Szentendrei, Tamás <szentendrei.tamas@prolan.hu>
> Signed-off-by: Szentendrei, Tamás <szentendrei.tamas@prolan.hu>
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> ---
> drivers/rtc/rtc-ds1307.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index 506b7d1c2397..bdb7b201a160 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -65,6 +65,7 @@ enum ds_type {
> # define DS1340_BIT_CENTURY_EN 0x80 /* in REG_HOUR */
> # define DS1340_BIT_CENTURY 0x40 /* in REG_HOUR */
> #define DS1307_REG_WDAY 0x03 /* 01-07 */
> +# define MCP794XX_BIT_OSCRUN BIT(5)
> # define MCP794XX_BIT_VBATEN 0x08
> #define DS1307_REG_MDAY 0x04 /* 01-31 */
> #define DS1307_REG_MONTH 0x05 /* 01-12 */
> @@ -242,6 +243,10 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
> regs[DS1307_REG_MIN] & M41T0_BIT_OF) {
> dev_warn_once(dev, "oscillator failed, set time!\n");
> return -EINVAL;
> + } else if (ds1307->type == mcp794xx &&
> + !(regs[DS1307_REG_WDAY] & MCP794XX_BIT_OSCRUN)) {
> + dev_warn_once(dev, "oscillator failed, set time!\n");
> + return -EINVAL;
> }
>
> tmp = regs[DS1307_REG_SECS];
> --
> 2.34.1
>
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-06-27 22:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 8:05 [PATCH resubmit] rtc: ds1307: Detect oscillator fail on mcp794xx Csókás, Bence
2024-06-27 22:37 ` Alexandre Belloni [this message]
2024-06-28 8:58 ` Csókás Bence
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=202406272237033260538e@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=csokas.bence@prolan.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=szentendrei.tamas@prolan.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.