Hi,
While using the new kernel with the mentioned workaround (i.e. enabling
the graphics card manually before suspending), I've noticed something
that might help to understand this issue better:
Only the first PM_SUSPEND_PREPARE-event is missing. When I get through
the first suspend, all following suspends work as expected. See the
following annotated excerpt from dmesg:
# Initial system boot
[ 15.564193] bbswitch: version 0.8
[ 15.564198] bbswitch: Found integrated VGA device 0000:00:02.0:
\_SB_.PCI0.GFX0
[ 15.564222] bbswitch: Found discrete VGA device 0000:01:00.0:
\_SB_.PCI0.PEG0.PEGP
[ 15.565812] bbswitch: detected an Optimus _DSM function
[ 15.565820] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0
is on
[ 15.910080] bbswitch: disabling discrete graphics
# boot completed, I manually enable the graphics card
[ 33.026943] bbswitch: enabling discrete graphics
# suspend, note the missing event type 3
[ 44.663868] bbswitch: bbswitch_pm_handler: event_type=4
is_card_disabled=0 dis_before_suspend_disabled=0
# wakeup from suspend completed, I manually disable the graphics card
[ 49.237038] bbswitch: disabling discrete graphics
# now second suspend, the event type 3 is generated successfully, the
graphics card is automatically disabled as expected
[ 56.211317] bbswitch: bbswitch_pm_handler: event_type=3
is_card_disabled=1 dis_before_suspend_disabled=0
[ 56.211322] bbswitch: enabling discrete graphics
# wake up from second suspend, the graphics card is disabled as expected
[ 64.060784] bbswitch: bbswitch_pm_handler: event_type=4
is_card_disabled=0 dis_before_suspend_disabled=1
[ 64.060786] bbswitch: disabling discrete graphics
# And just to demonstrate: activating and deactivating the graphics card
now still works
[ 65.428920] bbswitch: enabling discrete graphics
[ 68.149054] bbswitch: disabling discrete graphics
Just for reference, I am using now kernel: 5.7.0-2-amd64 #1 SMP Debian
5.7.10-1 (2020-07-26) x86_64 GNU/Linux
--
Kind regards,
Felix Dörre