-
Notifications
You must be signed in to change notification settings - Fork 5.2k
rtc-ds1307.c: add DT property 'wakeup-source' #1260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
That's quite a substantial change. Although I normally prefer fewer commits, I would rather see this code change split into two parts - a clearly labelled back-port of the 4.4 version (with an explanation of why it is necessary), and a separate commit containing your changes. We are likely to switch to 4.4 fairly soon - weeks, not months - and this split will make both the code reviewing and the rebasing much easier. The overlay looks fine. |
contains the following changes: * Convert to threaded IRQ with this, it is easier to drop the irq-handling for chips with no irq connected to the soc changes for threaded IRQ: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/rtc/rtc-ds1307.c?id=2fb07a10e0aa699ddb12aba1459208579bdc9802 * Fix kernel splat due to wakeup irq handling * Enable the mcp794xx alarm after programming time * Fix alarm programming for mcp794xx * Clean up ds1307_nvram_read and ds1307_nvram_write() * Sorting the headers NOTE: This is a backport from linux-4.4 to rpi-4.1.y, expect the irq handling, these are small changes
Splitted the PR as suggested. And here a little explanation: |
… wakeup the device without an IRQ Tested with the Witty Pi extension board by UUGear that has an ds1337.
corrected minor issues |
Can you try submitting your patch upstream and give us a link to the discussion. |
Send to the mailinglist rtc-linux: |
@vitalogy thanks. Feel free to ping here if the patch is accepted, or some other solution emerges and we can cherry-pick whatever is merged upstream. |
https://patchwork.ozlabs.org/patch/571268/ |
I've cherry-picked the upstream commit and the overlay to rpi-4.4.y tree. |
So sorry, I have only tested this on rpi-4.1.y yet, but it should also work with rpi-4.4.y. The rtc-ds1307 was taken from linux-4.4 and then patched with the wakeup-source changes. |
For what it’s worth, I am using @vitalogy’s patches with linux 4.1.18 and OpenELEC 6.0.3. Moreover, I had to enable wakeup-source in the i2c-rtc-overlay.dts file. I tried the attached patch but, unfortunately, it does not work for me: if I load this overlay with the wakeup-source option, when I look in /proc/device-tree, I see that the option is only set for the ds1307 device, but not for the ds1339 device (that I am using) and others… Any idea what is wrong with my patch? |
Tested rpi-4.4 with wittypi-overlay.dtb and it works without problems.
Do I miss something in kernel config or a new binary to load the overlay files dtbo? Testing the wakealarm, using wittypi-overlay.dtb
The Raspberry comes up again 👍 @nboullis
/boot/config.txt should contain this
There is also an error in the log, but it works.
|
I think you've been hit by two different issues. The failure to load the overlay was a recent glitch that should be fixed in the latest firmware. The phandle issue is the result of you running into a long-standing bug. Boolean attributes cause a property to be created or deleted, which in turn can cause items after the property in question to move. The code that applies the dtparams/overrides has been using the description of the parameter in-place, walking through it and acting on it one target at a time. Your series of wakeup-source booleans causes it to lose track of where it was, hence the error. I'll address this in an update soon. |
@pelwell |
No - the problem is that the description of which properties to modify appears after the properties themselves. As an experiment you could change the order in the overlay files so that overrides appears before fragment@0, but the correct solution is to fix the firmware (I have a patch ready for that). |
@pelwell @popcornmix |
This PR will add the DT property 'wakeup-source' to the rtc driverl rtc-ds1307 and will add an DT overlay for the Witty Pi extension board by UUGear, that has the rtc ds1337.
To support the DT property 'wakeup-source' to get the wakealarm sysfs entry I have taken the modul-source from linux-4.4 and add the necessary changes, because the irq_handling was easier to drop.
With the supplied DT overlay you get an rtc (with the wakealarm sysfs entry) for your Raspberry A+, B+ or 2. The DT property 'wakeup-source' is also used by other kernel-drivers in the mainline kernel. I will also try to bring this upstream to rtc-ds1307.
Please have a look.
regards
MichaeL