android_kernel_samsung_sm8650/drivers/mmc
Anjana Hari 7f649b416c msm: sdhci-msm: Add hibernation support for mmc devices
eMMC is the storage device for hibernation image. As such it needs
to be working when hibernation image is created and written. Also for
loading hibernation image after reboot, eMMC driver needs to be
probed and running.

During reboot,  kernel comes up and does its own eMMC probe and sets
speed for eMMC. A late system call then checks for hibernation image.
If there is a hibernation image, the current kernel will stay only
temporarily.
Once the hibernation image is found and loaded, the temporary kernel
suspends the eMMC device and then gives control to kernel in
hibernation image.
The hibernation image then restores the eMMC device based on the eMMC
driver state saved just before creating hibernation image.
This gives rise to a possible mismatch between the HW state of eMMC
(Specifically the bus speed) when temporary kernel suspends it and the
state driver restores after hibernation restore.
So a synchornization has been done by making the eMMC run in max speed
during:
	1. Just before hibernation image is created (So the driver
	state in hibernation image will be for max speed mode).
	2. After reboot, just before temporary kernel loads image and
	suspends (so the mmc driver in temporary kernel will put the
	eMMC in suspend while HW state is in highest speed mode).
This ensures that the HW state, mmc_resume post the hibernation
expects, will be same as the HW state actually present in the eMMC
at the point of hibernation restore.

This also ensures we save the hibernation image in max performance and
we restore the hibernation image also in max performance.

Also, SD card detection is done through card detection (CD) GPIO.
The IRQ for this cd GPIO should be freed before going to hibernation and
restored in resume path.

Change-Id: I844017537f62df49eade965c308f33ce5451770e
Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
Signed-off-by: Anjana Hari <quic_ahari@quicinc.com>
Signed-off-by: Jayasri Bhattacharyya <quic_jbhattac@quicinc.com>
2024-02-22 18:55:33 +05:30
..
core Merge tag 'android14-6.1.57_r00' into branch 'android14-6.1' 2023-11-27 16:18:59 +00:00
host msm: sdhci-msm: Add hibernation support for mmc devices 2024-02-22 18:55:33 +05:30
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00