Here's an example patch (compile-tested only) to get people started.
This function calls the TPM command, and returns TPM header + RNG data
in the supplied buffer.
A hw_random driver for TPM still needs to (a) parse the TPM header for
return code, (b) extract RNG bytes out at offset 14, and (c) figure out
some way to get a tpm_chip pointer.
Spec at
https://www.trustedcomputinggroup.org/specs/TPM/TCPA_Main_TCG_Architecture_v1_1b.pdf
describes TPM_GetRandom on page 215.
Jeff