It wasn't the XPS 8940. It was the Samsung 870 EVO (from the bad batch they made). So for about 6 months now my XPS8940 has been experiencing slow boots, failures to wake from sleep.  I addressed all these issues with the various suggestions found in these forums.  I turned on and off leep, hibernation, made sure all the HID devices were allowed to wake up the PC.  Then, just recently, I did a check on the after-market Samsung 870 EVO 1TB drive I had installed just under two years ago, and which had been runnign flawlessly for the last 22 months.  The Samsung Magician app was, for the first time since I installed the 870, reporting those ec errors everybody has noted as being the synptoms of a failing 870 EVO SSD. But the drive itself was working fine, and Samsung Magician said it was otherwise  fine. Then a few weeks back, sometimes the drive would disappear from Explorer. Sometimes it would re-appear after a restart, and sometimes only after a hard reboot. Just to be sure, I also tried replacing the SATA cable!  About the same time, the boot time started getting worse, sometimes taking a full minute or more. I tried various fixes, including setting the BIOS to do automatic POST rather than thorough. when that didn't help, I became convinced it wasn;t the SSD. But I was wrong. Yesterday, after working just fine for a few hours, the 870 EVO failed to show up in Explorer, and then, after a while, in the BIOS settings as well. Then it would come back, then it would disappear. Finally, it stopped coming back.  I could not recover. So I ordered a new Crucial 2TB SSD and popped it in today. Lo and behold, the boot up is back to its normal quick self, the new drive reliably shows up, shows no errors. I even swapped back to the old SATA cable and it was fine.  I have no intention of putting the 870 EVO back in, but will send it back for a warranty replacement (though I'm not sure I'd ever trust that model again.) So no way I could transfer files from the 870 to the new drive, and the 87o was dead. Luckily, I had the drive thoroughly backed up and was able to restore using I-Drive. So the lesson learned here is that a failing hard-drive is enough to cause problems with recovery from sleep, waking up on mouse or keypress, and ever getting longer boot times. In hindsight, it figures. Just thought I would share this so others might know that a slowly failing SSD could also be causing a hpost of other problems that might not seem initially traceable to the SSD.
It's July 2023 and I still have this issue that's been reported here and on several other threads. Every so often, it just won't wake up in response to mouse movement, keypress, or respond to the power button either. The ONLY solution is a hard reboot. And sometimes that doesn't even work and I have to actually unplug th machine.  I periodically go back and check all the power management and sleep settings to be sure nothing has changed them , and especially the HID wake settings, and still continue to have an irregular and inconsistent pattern of failures to wake up my XPS8940 (with dual Dell 27inch monitors, AMD Radeon RX 5700.) I keep my bios, all drivers (for all internal and external devices) up to date. I don't think this is ever gonna get solved by Dell, and I may just have to get a new machine sooner than I planned. It's getting tiresome. One pattern I do notice, is that the issue almost always crops up within a few dates of a Windows update or a BIOS update. The failures to respond to wake up do seem to have a pattern related to  MS patch Tuesdays, but only irregularly. I also notice that sometimes  when this hapens, the computer takes an unusually long time to boot up. Then the next tiome I reboot or restart it works just fine and is back quickly. Have usually had good luck with Dell, but this model seems to have a lot of issues. Like others have menetioned in this thread and others, it is completely unpredictable, and seems to have no rhyme or reason. Many of us have followed the aapropriate steps recommended in this thread and others, but the problem eventually always recurs even if it goes away for a while. Not what I expect from the XPS line (this is my third machine in the XPS line.) 
XPS 8940, screen black after overnight sleep, #2