Allwinner A33 tablet does not fully power off
Hi,
After commit 843107498f91e57d1d4b22cd8787112726fdaeb4 (bus: sunxi-rsb: Implement suspend/resume/shutdown callbacks) Q8 A33 tablet I have here cannot be powered-on after power-off, it needs press-and-hold of the power button for 10 seconds (I guess some HW assisted power down happens) before it can be powered-on again.
The following patch makes it behave correctly:
drivers/bus/sunxi-rsb.c +0 -3
@@ -818,10 +818,7 @@ static int sunxi_rsb_remove(struct platform_device *pdev)static void sunxi_rsb_shutdown (struct platform_device *pdev) { -struct sunxi_rsb *rsb =platform_get_drvdata (pdev); -pm_runtime_disable (&pdev->dev); -sunxi_rsb_hw_exit (rsb); }static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {
I guess the issue comes from the fact that by the time 'power off' command to the power management IC has to be send, the bus it lives on is already down, so the device is left in semi-powered down state. Ofc this is a wild guess, however, preventing the bus being turned off on shutdown fixes the issue.
Please LMK if the above is the correct approach so I will send a proper patch or something else shall be fixed.
Ivo
Samuel Holland
maintainerHi Ivo,
Quoted 26 lines · Ivaylo Dimitrov
After commit
843107498f91e57d1d4b22cd8787112726fdaeb4(bus: sunxi-rsb:
Implement suspend/resume/shutdown callbacks) Q8 A33 tablet I have here cannot be powered-on after power-off, it needs press-and-hold of the power button for 10 seconds (I guess some HW assisted power down happens) before it can be powered-on again.The following patch makes it behave correctly:
drivers/bus/sunxi-rsb.c +0
-3@@ -818,10 +818,7 @@ static int sunxi_rsb_remove(struct platform_device *pdev) static void sunxi_rsb_shutdown(struct platform_device *pdev) { - struct sunxi_rsb *rsb = platform_get_drvdata(pdev); - pm_runtime_disable(&pdev->dev); - sunxi_rsb_hw_exit(rsb); }static const struct
dev_pm_opssunxi_rsb_dev_pm_ops= {
Quoted 5 lines
I guess the issue comes from the fact that by the time 'power off' command to the power management IC has to be send, the bus it lives on is already down, so the device is left in semi-powered down state. Ofc this is a wild guess, however, preventing the bus being turned off on shutdown fixes the issue.
Your guess is correct. The controller gets shut down in
kernel_power_off()
kernel_shutdown_prepare()
device_shutdown()
but the PMIC communication needs to happen later in
kernel_power_off()
machine_power_off()
pm_power_off()Quoted 2 lines
Please LMK if the above is the correct approach so I will send a proper patch or something else shall be fixed.
Yes, this is exactly the right approach. The whole sunxi_rsb_shutdown() function should be removed. When you send a patch, please add a Fixes:
tag referencing the commit that you bisected to.
Regards,
Samuel
Hi Samuel,
Quoted 43 lines · Samuel Holland
Hi Ivo,
Quoted 26 lines · Ivaylo Dimitrov
After commit
843107498f91e57d1d4b22cd8787112726fdaeb4(bus: sunxi-rsb:
Implement suspend/resume/shutdown callbacks) Q8 A33 tablet I have here cannot be powered-on after power-off, it needs press-and-hold of the power button for 10 seconds (I guess some HW assisted power down happens) before it can be powered-on again.The following patch makes it behave correctly:
drivers/bus/sunxi-rsb.c +0
-3@@ -818,10 +818,7 @@ static int sunxi_rsb_remove(struct platform_device *pdev) static void sunxi_rsb_shutdown(struct platform_device *pdev) { - struct sunxi_rsb *rsb = platform_get_drvdata(pdev); - pm_runtime_disable(&pdev->dev); - sunxi_rsb_hw_exit(rsb); }static const struct
dev_pm_opssunxi_rsb_dev_pm_ops= {Quoted 5 lines
I guess the issue comes from the fact that by the time 'power off' command to the power management IC has to be send, the bus it lives on is already down, so the device is left in semi-powered down state. Ofc this is a wild guess, however, preventing the bus being turned off on shutdown fixes the issue.
Your guess is correct. The controller gets shut down in
kernel_power_off()
kernel_shutdown_prepare()
device_shutdown()but the PMIC communication needs to happen later in
Quoted 8 lines
kernel_power_off() machine_power_off() pm_power_off()Quoted 2 lines
Please LMK if the above is the correct approach so I will send a proper patch or something else shall be fixed.
Yes, this is exactly the right approach. The whole
sunxi_rsb_shutdown()
Don't we need pm_runtime_disable() on shutdown? As IIUC, the controller might be suspended and we have to resume it to put it in state to accept commands later on(in pm_power_off()).
Regards,
Ivo
Quoted 6 lines
function should be removed. When you send a patch, please add a Fixes:
tag referencing the commit that you bisected to.Regards,
Samuel
Samuel Holland
maintainerQuoted 50 lines · Ivaylo Dimitrov
Hi Samuel,
Quoted 47 lines · Samuel Holland
Hi Ivo,
Quoted 26 lines · Ivaylo Dimitrov
After commit
843107498f91e57d1d4b22cd8787112726fdaeb4(bus: sunxi-rsb:
Implement suspend/resume/shutdown callbacks) Q8 A33 tablet I have here cannot be powered-on after power-off, it needs press-and-hold of the power button for 10 seconds (I guess some HW assisted power down happens) before it can be powered-on again.The following patch makes it behave correctly:
drivers/bus/sunxi-rsb.c +0
-3@@ -818,10 +818,7 @@ static int sunxi_rsb_remove(struct platform_device *pdev) static void sunxi_rsb_shutdown(struct platform_device *pdev) { - struct sunxi_rsb *rsb = platform_get_drvdata(pdev); - pm_runtime_disable(&pdev->dev); - sunxi_rsb_hw_exit(rsb); }static const struct
dev_pm_opssunxi_rsb_dev_pm_ops= {Quoted 5 lines
I guess the issue comes from the fact that by the time 'power off' command to the power management IC has to be send, the bus it lives on is already down, so the device is left in semi-powered down state. Ofc this is a wild guess, however, preventing the bus being turned off on shutdown fixes the issue.
Your guess is correct. The controller gets shut down in
kernel_power_off()
kernel_shutdown_prepare()
device_shutdown()but the PMIC communication needs to happen later in
kernel_power_off()
machine_power_off()
pm_power_off()
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Please LMK if the above is the correct approach so I will send a proper patch or something else shall be fixed.
Yes, this is exactly the right approach. The whole
sunxi_rsb_shutdown()Don't we need
pm_runtime_disable()on shutdown? As IIUC, the controller might be suspended and we have to resume it to put it in state to accept commands lateron(in pm_power_off()).
sunxi_rsb_write() takes care of resuming the controller, so the controller being suspended prior to pm_power_off() is fine. pm_runtime_disable() would actually prevent resuming the controller later in sunxi_rsb_write().
Quoted 2 lines
Quoted 2 lines
function should be removed. When you send a patch, please add a Fixes:
tag referencing the commit that you bisected to.
I found a couple of other issues as well, so I'll send out some fixes with you CC'd.
Regards,
Samuel
Quoted 56 lines · Samuel Holland
Quoted 55 lines · Ivaylo Dimitrov
Hi Samuel,
Quoted 51 lines · Samuel Holland
Hi Ivo,
Quoted 26 lines · Ivaylo Dimitrov
After commit
843107498f91e57d1d4b22cd8787112726fdaeb4(bus: sunxi-rsb:
Implement suspend/resume/shutdown callbacks) Q8 A33 tablet I have here cannot be powered-on after power-off, it needs press-and-hold of the power button for 10 seconds (I guess some HW assisted power down happens) before it can be powered-on again.The following patch makes it behave correctly:
drivers/bus/sunxi-rsb.c +0
-3@@ -818,10 +818,7 @@ static int sunxi_rsb_remove(struct platform_device *pdev) static void sunxi_rsb_shutdown(struct platform_device *pdev) { - struct sunxi_rsb *rsb = platform_get_drvdata(pdev); - pm_runtime_disable(&pdev->dev); - sunxi_rsb_hw_exit(rsb); }static const struct
dev_pm_opssunxi_rsb_dev_pm_ops= {Quoted 5 lines
I guess the issue comes from the fact that by the time 'power off' command to the power management IC has to be send, the bus it lives on is already down, so the device is left in semi-powered down state. Ofc this is a wild guess, however, preventing the bus being turned off on shutdown fixes the issue.
Your guess is correct. The controller gets shut down in
kernel_power_off()
kernel_shutdown_prepare()
device_shutdown()but the PMIC communication needs to happen later in
kernel_power_off()
machine_power_off()
pm_power_off()Quoted 2 lines
Please LMK if the above is the correct approach so I will send a proper patch or something else shall be fixed.
Yes, this is exactly the right approach. The whole
sunxi_rsb_shutdown()
Quoted 9 lines
Quoted 3 lines
Don't we need
pm_runtime_disable()on shutdown? As IIUC, the controller might be suspended and we have to resume it to put it in state to accept commands lateron(in pm_power_off()).
sunxi_rsb_write()takes care of resuming the controller, so the controller being suspended prior topm_power_off()is fine.pm_runtime_disable()would actually prevent resuming the controller later insunxi_rsb_write().
I see.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
function should be removed. When you send a patch, please add a Fixes:
tag referencing the commit that you bisected to.I found a couple of other issues as well, so I'll send out some fixes with you CC'd.
Ok, thanks. What about stable kernels, poweroff is broken since 843107498f91e57d1d4b22cd8787112726fdaeb4?
Regards,
Ivo
Quoted 3 lines
Regards,
Samuel
Jernej Škrabec
maintainerDne nedelja, 06. november 2022 ob 08:15:40 CET je Ivaylo Dimitrov napisal(a):
Quoted 71 lines · Samuel Holland
Quoted 59 lines · Ivaylo Dimitrov
Quoted 58 lines
Hi Samuel,
Quoted 54 lines · Samuel Holland
Hi Ivo,
Quoted 29 lines · Ivaylo Dimitrov
After commit
843107498f91e57d1d4b22cd8787112726fdaeb4(bus: sunxi-rsb:
Implement suspend/resume/shutdown callbacks) Q8 A33 tablet I have here cannot be powered-on after power-off, it needs press-and-hold of the power button for 10 seconds (I guess some HW assisted power down happens) before it can be powered-on again.The following patch makes it behave correctly:
drivers/bus/sunxi-rsb.c +0
-3@@ -818,10 +818,7 @@ static int sunxi_rsb_remove(struct platform_device *pdev)static void sunxi_rsb_shutdown (struct platform_device *pdev) { -struct sunxi_rsb *rsb =platform_get_drvdata (pdev); -pm_runtime_disable (&pdev->dev); -sunxi_rsb_hw_exit (rsb); }static const struct dev_pm_ops sunxi_rsb_dev_pm_ops = {Quoted 5 lines
I guess the issue comes from the fact that by the time 'power off' command to the power management IC has to be send, the bus it lives on is already down, so the device is left in semi-powered down state. Ofc this is a wild guess, however, preventing the bus being turned off on shutdown fixes the issue.
Your guess is correct. The controller gets shut down in
kernel_power_off()
kernel_shutdown_prepare()
device_shutdown()but the PMIC communication needs to happen later in
kernel_power_off() machine_power_off() pm_power_off()Quoted 2 lines
Please LMK if the above is the correct approach so I will send a proper patch or something else shall be fixed.
Yes, this is exactly the right approach. The whole
sunxi_rsb_shutdown()Quoted 8 lines
Quoted 3 lines
Don't we need
pm_runtime_disable()on shutdown? As IIUC, the controller might be suspended and we have to resume it to put it in state to accept commands lateron(in pm_power_off()).
sunxi_rsb_write()takes care of resuming the controller, so the controller being suspended prior topm_power_off()is fine.pm_runtime_disable()would actually prevent resuming the controller later insunxi_rsb_write().I see.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
function should be removed. When you send a patch, please add a Fixes:
tag referencing the commit that you bisected to.I found a couple of other issues as well, so I'll send out some fixes with you CC'd.
Ok, thanks. What about stable kernels, poweroff is broken since
843107498f91e57d1d4b22cd8787112726fdaeb4?
All changes must first hit latest development branch. If they are marked with fixes tag, they get automatically backported in all currently maintained kernels (mostly LTS) if applicable. But this will take a while.
Best regards,
Jernej
Quoted 6 lines
Regards,
IvoQuoted 2 lines
Regards,
Samuel