public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Shiyan <eagle.alexander923@gmail.com>
To: linux-rtc@vger.kernel.org
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	"Steven A . Falco" <sfalco@harris.com>,
	Atsushi Nemoto <anemo@mba.ocn.ne.jp>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: [PATCH 3/6] rtc: m41t80: Fix watchdog resolution bit handling for chips without extra resolution
Date: Wed,  1 Apr 2026 19:52:42 +0300	[thread overview]
Message-ID: <20260401165245.936428-3-eagle.alexander923@gmail.com> (raw)
In-Reply-To: <20260401165245.936428-1-eagle.alexander923@gmail.com>

For chips without the extra watchdog resolution (i.e., those with only 2
resolution bits), bit 7 (RB2) must be cleared to avoid invalid settings.
The current logic clears RB2 only when extra resolution is present.
Reverse the condition.

Fixes: d3a126fcf9df ("rtc: rtc-m41t80.c: add support for the ST M41T65 RTC")
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/rtc/rtc-m41t80.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 52f398107d35..11ef8195e786 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -658,10 +658,10 @@ static void wdt_ping(void)
 		i2c_data[1] = wdt_margin << 2 | 0x82;
 
 	/*
-	 * M41T65 has three bits for watchdog resolution.  Don't set bit 7, as
-	 * that would be an invalid resolution.
+	 * Chips with extra watchdog resolution have three bits.
+	 * Don't set bit 7, as that would be an invalid resolution.
 	 */
-	if (clientdata->features & M41T80_FEATURE_WDR)
+	if (!(clientdata->features & M41T80_FEATURE_WDR))
 		i2c_data[1] &= ~M41T80_WATCHDOG_RB2;
 
 	i2c_transfer(save_client->adapter, msgs1, 1);
-- 
2.52.0


  parent reply	other threads:[~2026-04-01 16:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 16:52 [PATCH 1/6] rtc: m41t80: Remove deprecated and undocumented compatible strings Alexander Shiyan
2026-04-01 16:52 ` [PATCH 2/6] rtc: m41t80: Rename FEATURE_WD to FEATURE_WDR for clarity Alexander Shiyan
2026-04-01 16:52 ` Alexander Shiyan [this message]
2026-04-02 11:31   ` [PATCH 3/6] rtc: m41t80: Fix watchdog resolution bit handling for chips without extra resolution Alexander Shiyan
2026-04-01 16:52 ` [PATCH 4/6] rtc: m41t80: Add FEATURE_HT to all chips supporting extra watchdog resolution Alexander Shiyan
2026-04-01 16:52 ` [PATCH 5/6] rtc: m41t80: Add missing FEATURE_HT and FEATURE_WDR for m41t62 Alexander Shiyan
2026-04-01 16:52 ` [PATCH 6/6] rtc: m41t80: Fix typo: WTD -> WDT Alexander Shiyan

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=20260401165245.936428-3-eagle.alexander923@gmail.com \
    --to=eagle.alexander923@gmail.com \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-rtc@vger.kernel.org \
    --cc=sfalco@harris.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox