We present recent results for heavy-flavor observables in nucleus-nucleus collisions at LHC energies, obtained with the POWLANG transport setup. The initial creation of c-cbar and b-bbar pairs is simulated with a perturbative QCD approach (POWHEG+PYTHIA); their propagation in the medium (created in the nucleus-nucleus or in proton-nucleus collision) is studied with the relativistic Langevin equation, here solved using weak-coupling transport coefficients. Successively, the heavy quarks hadronize in the medium. We compute the nuclear modification factor and the elliptic flow parameter of the final D mesons both in nucleus-nucleus and in (for the first time, in the POWLANG setup) proton-nucleus collisions and compare our results to experimental data.