Squashed commits of wifi deep sleep fix

Squashed commits extracted by pastime1971