I'm trying to figure out how to notify the Linux MMC subsystem that there is an upcoming power loss. I would like to do this to mitigate possible SD card damage. From what I know, some newer SD cards may support something like "POWER OFF NOTIFY", which is even implemented in Linux MMC subsystem drivers.
The solution could be something like this - the driver waits for an external interrupt generated by a PSU and then notifies the MMC subsystem. The question is - how should in notify the MMC subsystem? I was thinking about calling "hw_protection_shutdown" but it seems that this call will generate too much overhead, especially since I'm interested in MMC only. What would be the other ways to notify the MMC subsystem (without modifying its' core)? How about the Power Management Framework - perhaps PM runtime_suspend function?