PowerMac6,1 and similar boards are flagged PMAC_MB_MAY_SLEEP. They only offer PMU sleep (mem_sleep "deep") once a video driver calls pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE) to say it can bring the display back after the GPU loses power. radeonfb and aty128fb do this, nouveau does not, so with nouveau only s2idle is available.
nouveau resumes the NV34M (10de:0329) in the iMac G4 correctly: it runs the VBIOS init tables and restores the mode. With the previous patch, the backlight PWM is restored too. Make the call for that GPU. Other GPUs are left out because they have not been tested. When nouveau is built in it probes before via-pmu registers its suspend ops, so "deep" is offered from boot. With nouveau as a module it is not, because the valid states are computed only once, in suspend_set_ops(). radeonfb as a module has the same limitation. Tested on an iMac G4 (PowerMac6,1, 7448, NV34M) with nouveau built in: one suspend to RAM, woken with the power button. The console came back with the backlight on and no errors in dmesg. Signed-off-by: Matt Turner <[email protected]> --- drivers/gpu/drm/nouveau/dispnv04/disp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c index 7d44d18e1b88..b4f522fbaf64 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -35,6 +35,10 @@ #include <nvif/if0004.h> +#ifdef CONFIG_PPC_PMAC +#include <asm/pmac_feature.h> +#endif + /* Apple GPUs whose panel backlight is a PWM in NV_PBUS_DEBUG_DUALHEAD_CTL. */ bool nv04_display_has_apple_backlight(struct drm_device *dev) @@ -330,5 +334,15 @@ nv04_display_create(struct drm_device *dev) nouveau_overlay_init(dev); +#ifdef CONFIG_PPC_PMAC + /* + * PMAC_MB_MAY_SLEEP boards only offer PMU sleep once the video driver + * says it can restore the display. Resume has only been tested on the + * NV34M. + */ + if (to_pci_dev(dev->dev)->device == 0x0329) + pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, NULL, 0, 1); +#endif + return 0; } -- 2.56.1
