Regulation of charging current or voltage