A controller for controlling valve timing imbalance between cylinder
groups of an engine. For each cylinder group, the controller has a
variable mechanism for varying the valve timing. A lock mechanism locks
the variable mechanism so as to maintain the valve timing of the cylinder
group at a lock value. An ECU sets a valve timing target value based on
the operating condition of the engine. The ECU and an oil control valve
drive the variable mechanism. The ECU restricts the valve timing target
value of at least one of the variable mechanisms of which operation is
unlocked when the operation of at least one of the variable mechanisms is
locked so that difference between the target value and the lock value
decreases.