Battery discharges when connected to DC power

My HP 520 laptop battery discharges even though it is connected to the DC power and another thing the battery starts charging if i shut down the laptop. Please give me the solution.

I think this problem is related to the DC jack failure. In HP 520 laptop the DC jack soldered directly to the motherboard. Overtime, if you plug/unplug AC adapter a lot, connection between the DC jack and motherboard breaks and it stops charging the battery.

Most likely you can fix the problem if you resolder the the DC jack.

In order to repair the jack, it’s necessary to disassemble the laptop and remove the motherboard. This service manual will help you to remove the motherboard.