I recently bough a Raspberry Pi 4. Its primary usage is as a home NAS (utilizing an external USB HDD), but I figured that since I already have it, I can also hook it up to my living room AV setup for light computing from the couch, or maybe some mediacentery stuff once in a while. Anyway, it's running Raspbian Buster. I reconfigured it a bit - I changed user account settings, installed Samba, MiniDLNA, custom build of Kodi, reconfigured some USB storage auto-mounting stuff, remounted some paths as tmpfs and set up unattended-upgrades - but in particular, aside from changing screen resolution, I didn't really mess with anything related to video, HDMI, CEC or anything like that.
This all works fairly good, with one exception. The Pi, having no standby mode and also doubling as a server, is always-on. I've got a little home theatre setup with Samsung MU8000-series TV and a Denon AVR-X1500H. And after plugging the Pi into this setup, whenever I powered up the AVR, the inputs switched on both the TV and the AVR to show me the Pi desktop. This is annoying when you're watching live TV, want to reroute the audio from TV speakers to the AVR, but it also switches inputs when you try. Interestingly, this happens regardless of whether I plugged the Pi directly into the TV or into the AVR - in the first case, turning on the AVR causes the TV to switch to Pi's HDMI input and the AVR switches to "TV Audio", and in the second, the TV switches to AVR's HDMI input and the AVR switches to Pi's input.
I'm not really familiar with HDMI CEC protocol, so I don't know where to start debugging further. My educated guess is that the AVR is perhaps scanning the entire CEC bus upon powering up, and the Pi somehow signals itself as a "wannabe active" device, and one of the devices causes the input switch.
I messed with every CEC-related option on the TV, AVR, and Pi's config.txt. And the problem only seems to go away if I completely disable CEC in either the TV, AVR or Pi (via hdmi_ignore_cec=1). Disabling CEC on the TV and AVR is out of the question, because it also disables ARC, and I don't have a separate S/PDIF cable between the TV and the AVR, so I need it (and besides, it makes the AVR more cumbersome to use).
Yes, I tried hdmi_ignore_cec_init=1 as well, but while it does what it's advertised to do, it does not solve this issue.
So I settled on hdmi_ignore_cec=1. This is a fair workaround, not really that big of a deal since I have a wireless keyboard hooked up anyway. But CEC support might come in handy once in a while; when I actually want to use Kodi, it would be more natural to use the TV remote rather than the keyboard (and before disabling CEC, I checked it, and it works). Is there any workaround I could try to avoid disabling CEC completely and yet prevent this unwanted input-switching every time I turn on the AVR?