Keyboard, numpad and touchpad randomly stops working until plugged into power

Hello I have an AMD 7040 Series framework 16, running arch linux. I have an issue where my keyboard, touchpad and numpad module will randomly stop working, until I plug my laptop into power. When I plug into power, the numpad, touchpad and keyboard start working again, even when I remove the ac adapter. The modules also will randomly stop working if I am at full power and am not charging, and to make them work again I have to unplug power to let the battery drain a bit and then plug my laptop back in. I’m not really sure why this issue occurs. Does anyone know how to fix this?