linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Heiko Schocher" <hs@nabladev.com>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	conor+dt@kernel.org, linux-rtc@vger.kernel.org,
	devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v1 3/3] rtc: rs5c372: support eco mode on R2223x
Date: Mon, 24 Aug 2026 11:15:06 +0000	[thread overview]
Message-ID: <20260824111506.8540F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824110452.4038870-4-hs@nabladev.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `rtc_r2223x` device is unhandled in the `RTC_VL_READ` and `RTC_VL_CLR` ioctls, causing incorrect voltage reporting and an inability to clear voltage warnings.
--

--- Patch [3]: [PATCH v1 3/3] rtc: rs5c372: support eco mode on R2223x ---
commit 03356cfada315a3baf4a319faaa5eba9b7ccba15
Author: Heiko Schocher <hs@nabladev.com>

rtc: rs5c372: support eco mode on R2223x
    
The R2223x can run in an eco mode that lowers its current consumption
from the backup supply. Enable it when ricoh,eco-mode property is
set in the device tree.

> diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
> index 30e272d650219..41d391bf07f7c 100644
> --- a/drivers/rtc/rtc-rs5c372.c
> +++ b/drivers/rtc/rtc-rs5c372.c

[ ... ]

> @@ -898,6 +917,13 @@ static int rs5c372_probe(struct i2c_client *client)
>  			rs5c372->time24 ? "24hr" : "am/pm"
>  			);
>  
> +	if (rs5c372->type == rtc_r2223x &&
> +	    device_property_read_bool(&client->dev, "ricoh,eco-mode")) {
> +		err = rs5c372_set_eco_mode(rs5c372, true);
> +		if (err < 0)
> +			return err;
> +	}
> +

[Severity: Medium]
Are we missing rtc_r2223x support in rs5c372_ioctl() for RTC_VL_READ and
RTC_VL_CLR?

For RTC_VL_READ, without rtc_r2223x in the switch statement, it falls through
to the default handler which misinterprets the PON bit (bit 4) as the
oscillator stopped (XSTP) bit, and ignores the voltage low (VDET) bit:

drivers/rtc/rtc-rs5c372.c:rs5c372_ioctl() {
    ...
		switch (rs5c->type) {
		case rtc_r2025sd:
		case rtc_r2221tl:
			// ... checks R2x2x_CTRL2_XSTP and R2x2x_CTRL2_VDET ...
			break;
		default:
			if (ctrl2 & RS5C_CTRL2_XSTP)
				flags |= RTC_VL_DATA_INVALID;
			break;
		}
    ...
}

Similarly, for RTC_VL_CLR, userspace cannot clear the voltage warning bit
because rtc_r2223x is omitted from the check:

drivers/rtc/rtc-rs5c372.c:rs5c372_ioctl() {
    ...
	case RTC_VL_CLR:
		/* clear VDET bit */
		if (rs5c->type == rtc_r2025sd || rs5c->type == rtc_r2221tl) {
			ctrl2 &= ~R2x2x_CTRL2_VDET;
    ...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824110452.4038870-1-hs@nabladev.com?part=3

      reply	other threads:[~2026-08-24 11:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 11:04 [PATCH v1 0/3] rtc: rs5c372: add Ricoh R2223x support Heiko Schocher
2026-08-24 11:04 ` [PATCH v1 1/3] dt-bindings: rtc: add ricoh,r2223x binding Heiko Schocher
2026-08-24 11:08   ` sashiko-bot
2026-08-24 16:26   ` Conor Dooley
2026-08-24 11:04 ` [PATCH v1 2/3] rtc: rs5c372: add support for Ricoh R2223x Heiko Schocher
2026-08-24 11:14   ` sashiko-bot
2026-08-24 11:04 ` [PATCH v1 3/3] rtc: rs5c372: support eco mode on R2223x Heiko Schocher
2026-08-24 11:15   ` sashiko-bot [this message]

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=20260824111506.8540F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hs@nabladev.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).