In situ doping control of the surface of high-temperature superconductors