All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Mohit Aggarwal <maggarwa@codeaurora.org>
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc-pm8xxx: Clear Alarm register on resume
Date: Sun, 22 Mar 2020 22:31:54 +0100	[thread overview]
Message-ID: <20200322213154.GH221863@piout.net> (raw)
In-Reply-To: <1584525218-14719-1-git-send-email-maggarwa@codeaurora.org>

Hi,

On 18/03/2020 15:23:38+0530, Mohit Aggarwal wrote:
> Currently, alarm register is not cleared on resume
> leading to reboot during power off charging mode.
> 
> Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
> ---
>  drivers/rtc/rtc-pm8xxx.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> index bbe013f..bfcd878 100644
> --- a/drivers/rtc/rtc-pm8xxx.c
> +++ b/drivers/rtc/rtc-pm8xxx.c
> @@ -1,5 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0-only
> -/* Copyright (c) 2010-2011, 2019, The Linux Foundation. All rights reserved. */
> +/* Copyright (c) 2010-2011, 2019-2020, The Linux Foundation. All rights reserved. */
>  

This part doesn't apply and is not based on upstream.

>  #include <linux/of.h>
>  #include <linux/module.h>
> @@ -301,6 +301,7 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
>  	struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
>  	const struct pm8xxx_rtc_regs *regs = rtc_dd->regs;
>  	unsigned int ctrl_reg;
> +	u8 value[NUM_8_BIT_RTC_REGS] = {0};
>  
>  	spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
>  
> @@ -319,6 +320,16 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
>  		goto rtc_rw_fail;
>  	}
>  
> +	/* Clear Alarm register */
> +	if (!enable) {
> +		     rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value,
> +					sizeof(value));
> +		     if (rc) {
> +			     dev_err(dev, "Write to RTC ALARM register failed\n");
> +			     goto rtc_rw_fail;
> +		     }
> +	}
> +
>  rtc_rw_fail:
>  	spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
>  	return rc;
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2020-03-22 21:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18  9:53 [PATCH] rtc-pm8xxx: Clear Alarm register on resume Mohit Aggarwal
2020-03-22 21:31 ` Alexandre Belloni [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-03-23  7:16 Mohit Aggarwal
2020-03-17  8:04 Mohit Aggarwal
2020-03-16  7:11 Mohit Aggarwal
2020-03-16 10:29 ` Alexandre Belloni
2020-03-17  4:50   ` maggarwa
2020-03-17 11:55     ` Alexandre Belloni
2020-03-18  9:56       ` maggarwa

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=20200322213154.GH221863@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=maggarwa@codeaurora.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 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.