Constructing TiO2 p-n homojunction for photoelectrochemical and photocatalytic hydrogen generation