You need to contact omnivison and get an NDA signed. They will provide you the source and register details.
I know there are some register in sensor setting that will control sensor gain,but i don't konw how to control in from firmware.
I will get sensor source code after get NDA,should i add some APIs in sensor source code?
Yes, you have to use some APIs to modify the register settings that varies the Gain.