Inflation and dark matter in two Higgs doublet models