What enables this function (sleep and power key) is a patch in the kernel. You can use the patch I used in my github page. All the procedure to make it can be found there, go to the section Kernel in the README.md
Keep in mind that “sleep” is in reality “freezing”. All the information can be found here: