All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] rtc: s35390a: make use of interrupt signal 1
  2026-06-30 19:22 [PATCH 0/3] rtc: s35390a: Allow use of output pin for interrupt signal 1 for wakealarm Markus Probst
@ 2026-06-30 19:22 ` Markus Probst
  2026-06-30 19:28   ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Probst @ 2026-06-30 19:22 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Uwe Kleine-König, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth
  Cc: linux-arm-kernel, linux-rtc, devicetree, linux-kernel,
	Markus Probst

If configured, use output pin for interrupt signal 1 for the wake alarm.

Successfully Tested on a Synology DS923+.

Signed-off-by: Markus Probst <markus.probst@posteo.de>
---
 drivers/rtc/rtc-s35390a.c | 61 +++++++++++++++++++++++++++++++++++++----------
 1 file changed, 49 insertions(+), 12 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 4cfe7034c516..6875bf039cbf 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -12,11 +12,13 @@
 #include <linux/bcd.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <dt-bindings/rtc/s35390a.h>
 
 #define S35390A_CMD_STATUS1	0
 #define S35390A_CMD_STATUS2	1
 #define S35390A_CMD_TIME1	2
 #define S35390A_CMD_TIME2	3
+#define S35390A_CMD_INT1_REG1	4
 #define S35390A_CMD_INT2_REG1	5
 #define S35390A_CMD_FREE_REG    7
 
@@ -36,6 +38,7 @@
 #define S35390A_FLAG_POC	BIT(0)
 #define S35390A_FLAG_BLD	BIT(1)
 #define S35390A_FLAG_INT2	BIT(2)
+#define S35390A_FLAG_INT1	BIT(3)
 #define S35390A_FLAG_24H	BIT(6)
 #define S35390A_FLAG_RESET	BIT(7)
 
@@ -50,6 +53,14 @@
 #define S35390A_INT2_MODE_FREQ		BIT(3) /* INT2FE */
 #define S35390A_INT2_MODE_PMIN		(BIT(3) | BIT(2)) /* INT2FE | INT2ME */
 
+/* INT1 pin output mode */
+#define S35390A_INT1_MODE_MASK		0xE0
+#define S35390A_INT1_MODE_NOINTR	0x00
+#define S35390A_INT1_MODE_ALARM		BIT(5) /* INT1AE */
+#define S35390A_INT1_MODE_PMIN_EDG	BIT(6) /* INT1ME */
+#define S35390A_INT1_MODE_FREQ		BIT(7) /* INT1FE */
+#define S35390A_INT1_MODE_PMIN		(BIT(7) | BIT(6)) /* INT1FE | INT1ME */
+
 static const struct i2c_device_id s35390a_id[] = {
 	{ .name = "s35390a" },
 	{ }
@@ -65,6 +76,7 @@ MODULE_DEVICE_TABLE(of, s35390a_of_match);
 struct s35390a {
 	struct i2c_client *client[8];
 	int twentyfourhour;
+	bool wakealarm_use_int1;
 };
 
 static int s35390a_set_reg(struct s35390a *s35390a, int reg, u8  *buf, int len)
@@ -275,7 +287,7 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	struct i2c_client *client = to_i2c_client(dev);
 	struct s35390a *s35390a = i2c_get_clientdata(client);
 	u8 buf[3], sts = 0;
-	int err, i;
+	int err, i, reg;
 
 	dev_dbg(&client->dev, "%s: alm is secs=%d, mins=%d, hours=%d mday=%d, "\
 		"mon=%d, year=%d, wday=%d\n", __func__, alm->time.tm_sec,
@@ -293,9 +305,13 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 		return err;
 
 	if (alm->enabled)
-		sts = S35390A_INT2_MODE_ALARM;
+		sts = s35390a->wakealarm_use_int1
+			? S35390A_INT1_MODE_ALARM
+			: S35390A_INT2_MODE_ALARM;
 	else
-		sts = S35390A_INT2_MODE_NOINTR;
+		sts = s35390a->wakealarm_use_int1
+			? S35390A_INT1_MODE_NOINTR
+			: S35390A_INT2_MODE_NOINTR;
 
 	/* set interrupt mode*/
 	err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &sts, sizeof(sts));
@@ -317,8 +333,11 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	for (i = 0; i < 3; ++i)
 		buf[i] = bitrev8(buf[i]);
 
-	err = s35390a_set_reg(s35390a, S35390A_CMD_INT2_REG1, buf,
-								sizeof(buf));
+	reg = s35390a->wakealarm_use_int1
+		? S35390A_CMD_INT1_REG1
+		: S35390A_CMD_INT2_REG1;
+
+	err = s35390a_set_reg(s35390a, reg, buf, sizeof(buf));
 
 	return err;
 }
@@ -328,13 +347,21 @@ static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	struct i2c_client *client = to_i2c_client(dev);
 	struct s35390a *s35390a = i2c_get_clientdata(client);
 	u8 buf[3], sts;
-	int i, err;
+	int i, err, reg, mask, mode;
 
 	err = s35390a_get_reg(s35390a, S35390A_CMD_STATUS2, &sts, sizeof(sts));
 	if (err < 0)
 		return err;
 
-	if ((sts & S35390A_INT2_MODE_MASK) != S35390A_INT2_MODE_ALARM) {
+	mask = s35390a->wakealarm_use_int1
+		? S35390A_INT1_MODE_MASK
+		: S35390A_INT2_MODE_MASK;
+
+	mode = s35390a->wakealarm_use_int1
+		? S35390A_INT1_MODE_ALARM
+		: S35390A_INT2_MODE_ALARM;
+
+	if ((sts & mask) != mode) {
 		/*
 		 * When the alarm isn't enabled, the register to configure
 		 * the alarm time isn't accessible.
@@ -345,7 +372,11 @@ static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 		alm->enabled = 1;
 	}
 
-	err = s35390a_get_reg(s35390a, S35390A_CMD_INT2_REG1, buf, sizeof(buf));
+	reg = s35390a->wakealarm_use_int1
+		? S35390A_CMD_INT1_REG1
+		: S35390A_CMD_INT2_REG1;
+
+	err = s35390a_get_reg(s35390a, reg, buf, sizeof(buf));
 	if (err < 0)
 		return err;
 
@@ -437,10 +468,10 @@ static int s35390a_nvmem_write(void *priv, unsigned int offset, void *val,
 static int s35390a_probe(struct i2c_client *client)
 {
 	int err, err_read;
-	unsigned int i;
+	unsigned int i, wakealarm_output_pin = 0;
 	struct s35390a *s35390a;
 	struct rtc_device *rtc;
-	u8 buf, status1;
+	u8 buf, status1, flag;
 	struct device *dev = &client->dev;
 	struct nvmem_config nvmem_cfg = {
 		.name = "s35390a_nvram",
@@ -452,6 +483,9 @@ static int s35390a_probe(struct i2c_client *client)
 		.reg_write = s35390a_nvmem_write,
 	};
 
+	fwnode_property_read_u32(dev->fwnode, "sii,wakealarm-output-pin",
+				 &wakealarm_output_pin);
+
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
 		return -ENODEV;
 
@@ -460,6 +494,7 @@ static int s35390a_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	s35390a->client[0] = client;
+	s35390a->wakealarm_use_int1 = wakealarm_output_pin == S35390A_OUTPUT_PIN_INT1;
 	i2c_set_clientdata(client, s35390a);
 
 	/* This chip uses multiple addresses, use dummy devices for them */
@@ -489,7 +524,9 @@ static int s35390a_probe(struct i2c_client *client)
 	else
 		s35390a->twentyfourhour = 0;
 
-	if (status1 & S35390A_FLAG_INT2) {
+	flag = s35390a->wakealarm_use_int1 ? S35390A_FLAG_INT1 : S35390A_FLAG_INT2;
+
+	if (status1 & flag) {
 		/* disable alarm (and maybe test mode) */
 		buf = 0;
 		err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1);
@@ -514,7 +551,7 @@ static int s35390a_probe(struct i2c_client *client)
 	set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->features);
 	clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features);
 
-	if (status1 & S35390A_FLAG_INT2)
+	if (status1 & flag)
 		rtc_update_irq(rtc, 1, RTC_AF);
 
 	nvmem_cfg.priv = s35390a;

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] rtc: s35390a: make use of interrupt signal 1
  2026-06-30 19:22 ` [PATCH 3/3] rtc: s35390a: make use of interrupt signal 1 Markus Probst
@ 2026-06-30 19:28   ` sashiko-bot
  0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-06-30 19:28 UTC (permalink / raw)
  To: Markus Probst; +Cc: linux-rtc, devicetree, Alexandre Belloni, robh, conor+dt

> If configured, use output pin for interrupt signal 1 for the wake alarm.
> 
> Successfully Tested on a Synology DS923+.
> 
> Signed-off-by: Markus Probst <markus.probst@posteo.de>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260630-rtc_s35390a_int1-v1-0-1b2239e16be2@posteo.de?part=3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] rtc: s35390a: make use of interrupt signal 1
@ 2026-07-02 21:12 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-07-02 21:12 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "dtcheck: binding changes may go via different trees"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260630-rtc_s35390a_int1-v1-3-1b2239e16be2@posteo.de>
References: <20260630-rtc_s35390a_int1-v1-3-1b2239e16be2@posteo.de>
TO: Markus Probst <markus.probst@posteo.de>
TO: Alexandre Belloni <alexandre.belloni@bootlin.com>
TO: Rob Herring <robh@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: "Uwe Kleine-König" <uwe@kleine-koenig.org>
TO: Andrew Lunn <andrew@lunn.ch>
TO: Gregory Clement <gregory.clement@bootlin.com>
TO: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-rtc@vger.kernel.org
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: Markus Probst <markus.probst@posteo.de>

Hi Markus,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 728e68a889bcf257b1e67298b12c360e5c3a13e0]

url:    https://github.com/intel-lab-lkp/linux/commits/Markus-Probst/dt-bindings-rtc-Add-sii-wakealarm-output-pin-property-for-S35390A/20260701-032724
base:   728e68a889bcf257b1e67298b12c360e5c3a13e0
patch link:    https://lore.kernel.org/r/20260630-rtc_s35390a_int1-v1-3-1b2239e16be2%40posteo.de
patch subject: [PATCH 3/3] rtc: s35390a: make use of interrupt signal 1
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm-randconfig-2051-20260701 (https://download.01.org/0day-ci/archive/20260702/202607022332.TCDi7Xuj-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
dtschema: 2026.7.dev1+g2203c1720
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260702/202607022332.TCDi7Xuj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202607022332.TCDi7Xuj-lkp@intel.com/

dtcheck warnings: (new ones prefixed by >>)
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/cm@48004000/clockdomains/dss_clkdm: failed to match any schema with compatible: ['ti,clockdomain']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/cm@48004000/clockdomains/core_l4_clkdm: failed to match any schema with compatible: ['ti,clockdomain']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/cm@48004000/clockdomains/dpll5_clkdm: failed to match any schema with compatible: ['ti,clockdomain']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/cm@48004000/clockdomains/sgx_clkdm: failed to match any schema with compatible: ['ti,clockdomain']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/cm@48004000/clockdomains/usbhost_clkdm: failed to match any schema with compatible: ['ti,clockdomain']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/target-module@48320000/counter@0: failed to match any schema with compatible: ['ti,omap-counter32k']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/target-module@48056000/dma-controller@0: failed to match any schema with compatible: ['ti,omap3430-sdma', 'ti,omap-sdma']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/target-module@48056000/dma-controller@0: failed to match any schema with compatible: ['ti,omap3430-sdma', 'ti,omap-sdma']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: s35390a@30 (sii,s35390a): $nodename:0: 's35390a@30' does not match '^rtc(@.*|-([0-9]|[1-9][0-9]+))?$'
   	from schema $id: http://devicetree.org/schemas/rtc/sii,s35390a.yaml
>> arch/arm/boot/dts/ti/omap/am3517-evm.dtb: s35390a@30 (sii,s35390a): Unevaluated properties are not allowed ('interrupts-extended' was unexpected)
   	from schema $id: http://devicetree.org/schemas/rtc/sii,s35390a.yaml
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/i2c@48070000/tps65023@48: failed to match any schema with compatible: ['ti,tps65023']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: tsc2004@4b (ti,tsc2004): $nodename:0: 'tsc2004@4b' does not match '^touchscreen(@.*)?$'
   	from schema $id: http://devicetree.org/schemas/input/touchscreen/ti,tsc2005.yaml
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/i2c@48060000/tvp5146@5c: failed to match any schema with compatible: ['ti,tvp5146m2']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/1w@480b2000: failed to match any schema with compatible: ['ti,omap3-1w']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/mmc@4809c000: failed to match any schema with compatible: ['ti,omap3-hsmmc']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/mmc@480b4000: failed to match any schema with compatible: ['ti,omap3-hsmmc']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/mmc@480ad000: failed to match any schema with compatible: ['ti,omap3-hsmmc']
   arch/arm/boot/dts/ti/omap/am3517-evm.dtb: /ocp@68000000/mmu@480bd400: failed to match any schema with compatible: ['ti,omap2-iommu']

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-02 21:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 21:12 [PATCH 3/3] rtc: s35390a: make use of interrupt signal 1 kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-06-30 19:22 [PATCH 0/3] rtc: s35390a: Allow use of output pin for interrupt signal 1 for wakealarm Markus Probst
2026-06-30 19:22 ` [PATCH 3/3] rtc: s35390a: make use of interrupt signal 1 Markus Probst
2026-06-30 19:28   ` sashiko-bot

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.