diff mbox

[v4,0/2] rtc: pcf2127: add alarm support

Message ID 20200630024211.12782-1-liambeguin@gmail.com
State Not Applicable
Headers show

Commit Message

Liam Beguin June 30, 2020, 2:42 a.m. UTC
From: Liam Beguin <lvb@xiphos.com>

The board used to test this series has the interrupt line of the RTC
connected to a circuit controlling the power of the board.
An event on the interrupt line while the board is off will power it on.
Because of these hardware limitations, the irq handler added in this
patch wasn't fully tested.

The alarm fuctionality was tested on a PCA2129, with:

	$ date "2010-10-10 10:10"
	Sun Oct 10 10:10:00 UTC 2010
	$ /usr/sbin/rtcwake -u -d /dev/rtc0  -s10 --mode off
	[ ... ]
	$ # power on after 10 seconds

Changes since v1:
- Document new compatible string for the pca2129
- Add calls to pcf2127_wdt_active_ping after accessing CTRL2
- Use sizeof(buf) instead of hadcoding value
- Cleanup debug trace
- Add interrupt handler and wakeup-source devicetree option

Changes since v2:
- Rebase on latest mainline tree
- Remove redundant if in pcf2127_rtc_alarm_irq_enable
- Remove duplicate watchdog ping in pcf2127_rtc_irq
- Avoid forward declaration
- Remove dev_err strings
- Remove dev_dbg traces since they are now part of the core
- Avoid unnecessary read in pcf2127_rtc_irq with regmap_write
- Add extra rtc_class_ops struct with alarm functions

Changes since v3:
- Replace "goto irq_err" with "return IRQ_NONE" in interrupt handler
- Add Reviewed-by trailers

Liam Beguin (2):
  rtc: pcf2127: add pca2129 device id
  rtc: pcf2127: add alarm support

 .../devicetree/bindings/rtc/trivial-rtc.yaml  |   2 +
 drivers/rtc/rtc-pcf2127.c                     | 137 ++++++++++++++++++
 2 files changed, 139 insertions(+)

Interdiff against v3:

base-commit: 7c30b859a947535f2213277e827d7ac7dcff9c84

Comments

Liam Beguin July 12, 2020, 5:52 p.m. UTC | #1
On Mon Jun 29, 2020 at 10:42 PM Liam Beguin wrote:
> From: Liam Beguin <lvb@xiphos.com>
> 
> The board used to test this series has the interrupt line of the RTC
> connected to a circuit controlling the power of the board.
> An event on the interrupt line while the board is off will power it on.
> Because of these hardware limitations, the irq handler added in this
> patch wasn't fully tested.
> 
> The alarm fuctionality was tested on a PCA2129, with:
> 
> 	$ date "2010-10-10 10:10"
> 	Sun Oct 10 10:10:00 UTC 2010
> 	$ /usr/sbin/rtcwake -u -d /dev/rtc0  -s10 --mode off
> 	[ ... ]
> 	$ # power on after 10 seconds
> 
> Changes since v1:
> - Document new compatible string for the pca2129
> - Add calls to pcf2127_wdt_active_ping after accessing CTRL2
> - Use sizeof(buf) instead of hadcoding value
> - Cleanup debug trace
> - Add interrupt handler and wakeup-source devicetree option
> 
> Changes since v2:
> - Rebase on latest mainline tree
> - Remove redundant if in pcf2127_rtc_alarm_irq_enable
> - Remove duplicate watchdog ping in pcf2127_rtc_irq
> - Avoid forward declaration
> - Remove dev_err strings
> - Remove dev_dbg traces since they are now part of the core
> - Avoid unnecessary read in pcf2127_rtc_irq with regmap_write
> - Add extra rtc_class_ops struct with alarm functions
> 
> Changes since v3:
> - Replace "goto irq_err" with "return IRQ_NONE" in interrupt handler
> - Add Reviewed-by trailers
> 
> Liam Beguin (2):
>   rtc: pcf2127: add pca2129 device id
>   rtc: pcf2127: add alarm support
> 

Hi Alexandre,

Did you get a change to take a look at this revision?
Thanks,

Liam

>  .../devicetree/bindings/rtc/trivial-rtc.yaml  |   2 +
>  drivers/rtc/rtc-pcf2127.c                     | 137 ++++++++++++++++++
>  2 files changed, 139 insertions(+)
> 
> Interdiff against v3:
> diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> index df09d3c6c5c3..4e99c45a87d7 100644
> --- a/drivers/rtc/rtc-pcf2127.c
> +++ b/drivers/rtc/rtc-pcf2127.c
> @@ -416,7 +416,7 @@ static irqreturn_t pcf2127_rtc_irq(int irq, void *dev)
>  
>  	ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL2, &ctrl2);
>  	if (ret)
> -		goto irq_err;
> +		return IRQ_NONE;
>  
>  	if (ctrl2 & PCF2127_BIT_CTRL2_AF) {
>  		regmap_write(pcf2127->regmap, PCF2127_REG_CTRL2,
> @@ -427,11 +427,9 @@ static irqreturn_t pcf2127_rtc_irq(int irq, void *dev)
>  
>  	ret = pcf2127_wdt_active_ping(&pcf2127->wdd);
>  	if (ret)
> -		goto irq_err;
> +		return IRQ_NONE;
>  
>  	return IRQ_HANDLED;
> -irq_err:
> -	return IRQ_NONE;
>  }
>  
>  static const struct rtc_class_ops pcf2127_rtc_alrm_ops = {
> 
> base-commit: 7c30b859a947535f2213277e827d7ac7dcff9c84
> -- 
> 2.27.0
>
Alexandre Belloni Aug. 12, 2020, 9:48 a.m. UTC | #2
On Mon, 29 Jun 2020 22:42:09 -0400, Liam Beguin wrote:
> The board used to test this series has the interrupt line of the RTC
> connected to a circuit controlling the power of the board.
> An event on the interrupt line while the board is off will power it on.
> Because of these hardware limitations, the irq handler added in this
> patch wasn't fully tested.
> 
> The alarm fuctionality was tested on a PCA2129, with:
> 
> [...]

Applied, thanks!

[1/2] rtc: pcf2127: add pca2129 device id
      commit: 985b30dbe2cf58c27dd81da85410439ced8ce6d7
[2/2] rtc: pcf2127: add alarm support
      commit: 8a914bac44be33623cfcf27688b18b6f81a5c7d5

Best regards,
diff mbox

Patch

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index df09d3c6c5c3..4e99c45a87d7 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -416,7 +416,7 @@  static irqreturn_t pcf2127_rtc_irq(int irq, void *dev)
 
 	ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL2, &ctrl2);
 	if (ret)
-		goto irq_err;
+		return IRQ_NONE;
 
 	if (ctrl2 & PCF2127_BIT_CTRL2_AF) {
 		regmap_write(pcf2127->regmap, PCF2127_REG_CTRL2,
@@ -427,11 +427,9 @@  static irqreturn_t pcf2127_rtc_irq(int irq, void *dev)
 
 	ret = pcf2127_wdt_active_ping(&pcf2127->wdd);
 	if (ret)
-		goto irq_err;
+		return IRQ_NONE;
 
 	return IRQ_HANDLED;
-irq_err:
-	return IRQ_NONE;
 }
 
 static const struct rtc_class_ops pcf2127_rtc_alrm_ops = {