Rtc -ds 1374 wakealrm mode

Hello,

I hope you’re going well in this period.

I’m working on the driver rtc-ds-1374.c because in my embedded card, I got an RTC ds-1371 and the driver is compatible.

The problem I meet is with the alarm mode. In fact, I need alarm “wake up” to be enable but I have not got GPIO interrupt wired between rtc and CPU so as the driver need it to activate the alarm mode, I decided to modify the driver by activating it whithout interrupt specifier in devicetree.

Here is a link to reference driver rtc-ds-1374.c: https://elixir.bootlin.com/linux/v4.19.89/source/drivers/rtc/rtc-ds1374.c

These, are the new features I added:

1) Adding OSF bit info in sysfs: /sys/rtc/osf_status
2) enable alarm wake up without specifing interrupts in devicetree
--------------------------------
Exemple of devicetree:

ds1374:rtc@68 {
    compatible = "dallas,ds1374";
    wakeup-capable;
    reg = <0x68>;
};
--------------------------------

The problem is: With my modifications, I’m obliged to comment the lines:

//if (client->irq <= 0)
//    return -EINVAL;

in “ds1374_set_alarm” function. If I do that, the command hwclock return me the following error: “hwclock: select() to /dev/rtc0 to wait for clock tick timed out”. But if I don’t do that, the set alarm does not work, because when I try the command:

echo +20 > /sys/class/rtc/rtc0/wakealarm

System returns an error: “-sh: echo: write error: Invalid argument”

Do you know a method to get both working?

Thanks for all, and best reguards: Anthony.