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?
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It only takes a minute to sign up.Sign up to join this community
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: