Partial sync of calibration code from G3

Includes minor updates to build with -Wdouble-promotion enabled.

Tip of G3 CL: 176540134
Test: compile only
Change-Id: I6048b4b0586601837a179b90ea8927060f2199dd
7 files changed