Is it possible to use the tegracam framework for any camera that supports bayer format? Or is it better to use only the v4l2 framework if not sure if it may be valid or no.
If with “tegracam framework” you mean the API 2.0 for sensor drivers, this is still a V4L2 implementation. Version 2.0 is intended to reduce even further the boilerplate code and simplify camera development, drivers ported from version 1.0 to 2.0 should work the same. So, answering your question, yes, you should be able to create a driver that supports bayer format with this new framework.
I advice taking a look into this documentation: https://docs.nvidia.com/jetson/l4t/#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fcamera_dev.html%23