mbox series

[00/11] ARM: bcm2835: Implement initial S2Idle for Raspberry Pi

Message ID 20240630153652.318882-1-wahrenst@gmx.net
Headers show
Series ARM: bcm2835: Implement initial S2Idle for Raspberry Pi | expand

Message

Stefan Wahren June 30, 2024, 3:36 p.m. UTC
This series implement the initial Suspend-To-Idle support for
the Raspberry Pi, which was a long time on my TODO list [1]. The
changes allow to suspend and resume the Raspberry Pi via debug UART.
The focus is on the BCM2835 SoC, because it's less complex than its
successors and have enough documentation.

The series is a loose collection of fixes and improvements.
So cherry-picking should be fine.

Test steps:
- configure debug console (pl011 or mini UART) as wakeup source
- send system to idle state

  echo freeze > /sys/power/state

- wakeup system by console traffic

The implementation isn't perfect and contains workarounds like
patch 4 and 9. So there is still room for improvements, but
at least the system won't freeze forever as before [2].

Here are some figures for the Raspberry Pi 1 (without any
devices connected except of a debug UART):

running but CPU idle = 1.67 W
suspend to idle      = 1.33 W

The series has been tested on the following platforms:
Raspberry Pi 1 B
Raspberry Pi 3 A+
Raspberry Pi 3 B+

Known issues:
- currently it's not possible to power down the USB domain [3]
- there seems to be an issue with the DWC2 suspend handling [4]

[1] - https://github.com/lategoodbye/rpi-zero/issues/9
[2] - https://bugzilla.redhat.com/show_bug.cgi?id=2283978
[3] - https://github.com/raspberrypi/firmware/issues/1894
[4] - https://lore.kernel.org/linux-usb/3fd0c2fb-4752-45b3-94eb-42352703e1fd@gmx.net/T/

Stefan Wahren (11):
  firmware: raspberrypi: Improve timeout warning
  mailbox: bcm2835: Fix timeout during suspend mode
  pmdomain: raspberrypi-power: Adjust packet definition
  pmdomain: raspberrypi-power: Avoid powering down USB
  irqchip/bcm2835: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND
  drm/vc4: hdmi: Handle error case of pm_runtime_resume_and_get
  drm/vc4: hdmi: Disable connector status polling during suspend
  usb: dwc2: debugfs: Print parameter no_clock_gating
  usb: dwc2: Skip clock gating on Broadcom SoCs
  serial: 8250_bcm2835aux: add PM suspend/resume support
  ARM: bcm2835_defconfig: Enable SUSPEND

 arch/arm/configs/bcm2835_defconfig        |  2 --
 drivers/firmware/raspberrypi.c            |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c            | 18 +++++++++++++++++-
 drivers/irqchip/irq-bcm2835.c             |  4 +++-
 drivers/mailbox/bcm2835-mailbox.c         |  3 ++-
 drivers/pmdomain/bcm/raspberrypi-power.c  | 17 ++++++++++++-----
 drivers/tty/serial/8250/8250_bcm2835aux.c | 23 +++++++++++++++++++++++
 drivers/usb/dwc2/debugfs.c                |  1 +
 drivers/usb/dwc2/params.c                 |  1 +
 9 files changed, 61 insertions(+), 11 deletions(-)

--
2.34.1

Comments

Minas Harutyunyan July 1, 2024, 5:56 a.m. UTC | #1
On 6/30/24 19:36, Stefan Wahren wrote:
> The commit c4a0f7a6ab54 ("usb: dwc2: Skip clock gating on Samsung
> SoCs") introduced a parameter to skip enabling clock gating mode
> even the hardware platform should supports it.
> 
> In order to make this more visible also print this in show
> parameters of debugfs.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Acked-by: Minas Harutyunyan <hminas@synopsys.com>

> ---
>   drivers/usb/dwc2/debugfs.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c
> index 7c82ab590401..3116ac72747f 100644
> --- a/drivers/usb/dwc2/debugfs.c
> +++ b/drivers/usb/dwc2/debugfs.c
> @@ -702,6 +702,7 @@ static int params_show(struct seq_file *seq, void *v)
>   	print_param(seq, p, uframe_sched);
>   	print_param(seq, p, external_id_pin_ctl);
>   	print_param(seq, p, power_down);
> +	print_param(seq, p, no_clock_gating);
>   	print_param(seq, p, lpm);
>   	print_param(seq, p, lpm_clock_gating);
>   	print_param(seq, p, besl);
> --
> 2.34.1
>