Hole transport layers (HTLs) in perovskite photovoltaics do not just play a key role in device performance; they also determine the overall flexibility, cost, and opportune tandem solar cell applications. Currently used HTLs have limited functionality and are costly. Here, we develop an efficient bifunctional and cost-effective HTL based on electrochemically deposited polyaniline (PAN) decorated with dodecyl benzene sulfonic acid. We then resurface PAN with chlorine to improve HTL conductivity and to provide nucleation sites for the growth and passivation of perovskite films. The synergetic modification on the perovskite/PAN interface and crystallographic/optoelectric properties of the perovskite film delivers a photovoltaic efficiency of 20.7% for a small-area inverted cell, the highest among any polyaniline-based perovskite solar cells. An efficiency of 18.4% is achieved for 1 cm2 devices. This work provides a competitive category of in situ passivasive HTLs for efficient and scalable perovskite solar cells.