Valence and spin state of Co and Ni ions and their relation to metallicity and ferromagnetism in LaCo 0.5 Ni 0.5 O 3