  We present the results of a semianalytical model that evolves the masses and
spins of massive black holes together with the properties of their host
galaxies along the cosmic history. As a consistency check, our model broadly
reproduces a number of observations, e.g. the cosmic star formation history,
the black hole mass and luminosity function and the galaxy mass function at low
redshift, the black hole to bulge mass relation, and the morphological
distribution at low redshift. For the first time in a semianalytical
investigation, we relax the simplifying assumptions of perfect coherency or
perfect isotropy of the gas fueling the black holes. The dynamics of gas is
instead linked to the morphological properties of the host galaxies, resulting
in different spin distributions for black holes hosted in different galaxy
types. We compare our results with the observed sample of spin measurements
obtained through broad K$\alpha$ iron line fitting. The observational data
disfavor both accretion along a fixed direction and isotropic fueling.
Conversely, when the properties of the accretion flow are anchored to the
kinematics of the host galaxy, we obtain a good match between theoretical
expectations and observations. A mixture of coherent accretion and phases of
activity in which the gas dynamics is similar to that of the stars in bulges
(i.e., with a significant velocity dispersion superimposed to a net rotation)
best describes the data, adding further evidence in support to the coevolution
of massive black holes and their hosts.
