Latest update to kodi-rpi 16.1-7 is causing the TV to switch to the HDMI port that the Raspberry Pi 2 is plugged into. The switch happens every 3 minutes 10 seconds without fail.
libcec-rpi was upgraded to 4.0.0-1 at the same time. No other packages were upgrade and the system is up to date.
Downgrading to kodi-rpi 16.1-6 and libcec-rpi 3.1.0-3 fixes the issue.
Richard.