In this paper we present a generalization of Berreman's model for the elastic contribution to the surface free-energy density of a nematic liquid crystal in presence of a sawtooth substrate which favors homeotropic anchoring as a function of the wave number of the surface structure q, the tilt angle α, and the surface anchoring strength w. In addition to the previously reported nonanalytic contribution proportional to −q ln q, due to the nucleation of disclination lines at the wedge bottoms and apexes of the substrate, the next-to-leading contribution is proportional to q for a given substrate roughness, in agreement with Berreman's predictions. We characterize this term, finding that it has two contributions: the deviations of the nematic director field with respect to a reference field corresponding to the isolated disclination lines and their associated core free energies. Comparison with the results obtained from the Landau-de Gennes model shows that our model is quite accurate in the limit wL > 1, when strong anchoring conditions are effectively achieved.