Connect an ATmega microcontroller to the HDMI CEC bus
Since the HDMI CEC bus is an open-collector configuration with shared pullups like i2c, you should write to it by toggling the port's state (the data direction register or DDR) between input (does not affect the bus, a 1) to output 0 (pull the bus down) and back again. Instead of writing 1 and 0 to the PORT[ABCD] register since the microcontroller doesn't need to pull the line back up.

On other microcontrollers you might configure the port in open-drain mode or use a built-in CEC peripheral.

You should disable the microcontroller's built-in pull-up/down resistors. The bus already has pullups and yours will not match the voltage/current specification required by the bus. A commercial device might provide its own discrete pull-up resistors or rely on the other end depending on the specification.

It would also be a good idea to run your ATMega at 3.3V. It will work at 3.3V; many AVRs are designed to work all the way down to 1.8V.