This seems to be doable using the VideoCore function vc_tv_power_off() and vc_tv_sdtv_power_on(2) from [here](https://github.com/raspberrypi/firmware/blob/master/opt/vc/include/interface/vmcs_host/vc_tvservice.h) Documentation for this is [here](https://elinux.org/Raspberry_Pi_VideoCore_APIs).