Energy level alignment of dipolar interface layer in organic and hybrid perovskite solar cells