V4L/DVB: au8522: fix race condition in switching from digital to analog mode
With applications like MythTV, switching inputs results in closing the digital
side and then immediately opening the analog side. This exposes a race
condition where the dvb_frontend kernel thread powers down the chip and closes
the i2c gate even though we're in the middle of bringing up the analog part
of the chip (since the shutdown of the dvb_frontend kernel thread occurs
asychronously).
Introduce a construct to keep track of what mode we're in, and drop requests
to power down or management the gate if we've already switched to analog mode.
Thanks to Zaphod Beeblebrox for reporting this issue.