From: Waqar Hameed <waqar.hameed@axis.com>
To: <alexandre.belloni@bootlin.com>
Cc: <linux-rtc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] rtc: rx8111: handle VLOW flag
Date: Fri, 19 Apr 2024 13:04:34 +0200 [thread overview]
Message-ID: <pndh6fxmx4t.fsf@axis.com> (raw)
In-Reply-To: <20240417191937.33790-2-alexandre.belloni@bootlin.com> (alexandre belloni's message of "Wed, 17 Apr 2024 21:19:36 +0200")
On Wed, Apr 17, 2024 at 21:19 +0200 alexandre.belloni@bootlin.com wrote:
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
>
> Allow userspace to get battery status information and be able to warn when
> battery is low and has to be replaced.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/rtc/rtc-rx8111.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/rtc/rtc-rx8111.c b/drivers/rtc/rtc-rx8111.c
> index 4a35bd921b33..8450d9f0b566 100644
> --- a/drivers/rtc/rtc-rx8111.c
> +++ b/drivers/rtc/rtc-rx8111.c
> @@ -95,6 +95,9 @@ enum rx8111_regfield {
> RX8111_REGF_INIEN,
> RX8111_REGF_CHGEN,
>
> + /* RX8111_REG_STATUS_MON. */
> + RX8111_REGF_VLOW,
> +
> /* Sentinel value. */
> RX8111_REGF_MAX
> };
> @@ -129,6 +132,8 @@ static const struct reg_field rx8111_regfields[] = {
> [RX8111_REGF_SWSEL1] = REG_FIELD(RX8111_REG_PWR_SWITCH_CTRL, 3, 3),
> [RX8111_REGF_INIEN] = REG_FIELD(RX8111_REG_PWR_SWITCH_CTRL, 6, 6),
> [RX8111_REGF_CHGEN] = REG_FIELD(RX8111_REG_PWR_SWITCH_CTRL, 7, 7),
> +
> + [RX8111_REGF_VLOW] = REG_FIELD(RX8111_REG_STATUS_MON, 1, 1),
> };
>
> static const struct regmap_config rx8111_regmap_config = {
> @@ -276,6 +281,13 @@ static int rx8111_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
>
> vlval = regval ? RTC_VL_DATA_INVALID : 0;
>
> + ret = regmap_field_read(data->regfields[RX8111_REGF_VLOW],
> + ®val);
> + if (ret)
> + return ret;
> +
> + vlval |= regval ? RTC_VL_BACKUP_LOW : 0;
> +
> return put_user(vlval, (typeof(vlval) __user *)arg);
> default:
> return -ENOIOCTLCMD;
Looks good to me!
Tested-by: Waqar Hameed <waqar.hameed@axis.com>
Reviewed-by: Waqar Hameed <waqar.hameed@axis.com>
next prev parent reply other threads:[~2024-04-19 11:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 19:19 [PATCH 1/2] rtc: rx8111: demote warnings to debug level alexandre.belloni
2024-04-17 19:19 ` [PATCH 2/2] rtc: rx8111: handle VLOW flag alexandre.belloni
2024-04-19 11:04 ` Waqar Hameed [this message]
2024-04-19 11:02 ` [PATCH 1/2] rtc: rx8111: demote warnings to debug level Waqar Hameed
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=pndh6fxmx4t.fsf@axis.com \
--to=waqar.hameed@axis.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).