Help to understand working of powerbutton and volume rockers I want to understand the workings of power button and volume rockers in Android devices, which are associated with the kernel driver of these keys.  

What happens in the kernel driver and boot loader when I press a physical key on a device?
The problem with understanding any physical buttons on an Android, is that they are extremely hardware dependent. Usually they're connected to some GPIO port on either the application processor (AP) or cellular processor (CP/modem), and on some devices (MTK,Qualcomm) these are combined in a SoC. In other devices, there is a separate touch screen MCU, that can also be used for some keys. So without knowing your exact hardware and its configuration, it is impossible to answer your question. 

Your best chance for success in understanding, is by downloading the sources for your device/kernel and look in there, in combination with finding a service manual that also show some schematics.



EDIT: Here is one block diagram:

And here is another: