sophgo / linux-riscv

Linux kernel stable tree
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
Other
23 stars 47 forks source link

soft shutdown feature doesn't work. #109

Closed unicornx closed 4 months ago

unicornx commented 5 months ago

Does Pioneer have a function that allows you to softly shut down the system by pressing the power button briefly.

I found that this function worked when kernel is 6.1.31, which is the version that I first flashed the machine here. I changed it to a relatively new version of sg2042-dev, and the 6.1.72 version did not work. It seems that there are changes on sg2042-dev that break the original function. The commit corresponding to sg2042-dev I am talking about for 6.1.72 is beafa8820ba0ea1e8aab84c4ebb0c907f828c963.

unicornx commented 4 months ago

fixed with 83ab3eda46e651464f2715455ae66711882be116

rootcasue analysis:

There was a problem with the gpio node in our device tree. The clock part does not match the dw gpio driver. The reason why it could be used normally before was because of our IC design, the gpio clock gate was open by default, so the gpio always had a clock. Later, we changed the clock driver so that it was turned off by default and turned on only when the probe was driven. And that made this issue.

DW gpio driver only enable bus and db clock. However, when we designed the IC, we connected 3 clocks to the gpio ip, including the interrupt clock. The corresponding enable function was not found in the dw gpio driver. If it is not turned on, the gpio interrupt trigger will not take effect. So the fix set the interrupt clock as critical to enable it by default.