[media] adv7180: Do implicit register paging

The ad7180 has multiple register pages which can be switched between by writing
to a register. Currently the driver manually switches between pages whenever a
register outside of the default register map is accessed and switches back after
it has been accessed. This is a bit tedious and also potential source for bugs.
Having multiple pages means that a register access is not a single atomic
i2c_smbus_write_byte_data() or i2c_smbus_read_byte_data() call and we need to
make sure that concurrent register access does not race against each other. This
patch adds two helper functions that take care of switching between pages and
reading/writing the register. Those functions have a lockdep_assert_held() to
make sure that they are called with the state mutex held to avoid race
conditions. The register numbers for registers are updated to encode both the
page (in the upper 8-bits) and the register (in the lower 8-bits) numbers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Reset the device before initialization

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Add media entity support

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Switch to pad ops

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Consolidate video mode setting

We have basically the same code to set the video standard in init_device() and
adv7180_s_std(). Factor this out into a common helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Prepare for multi-chip support

The adv7180 is part of a larger family of device, which have all a very similar
register map layout. This patch prepares the adv7180 driver for support for
multiple different devices. For now the only difference we care about is the
number of input channel configurations. Also the way the input format is
configured slightly differs between some devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Add support for the ad7182

This patch adds support for the adv7182 to the adv7180 driver. The adv7182 is
similar to the adv7180, the main difference from the driver's point of view is
how the video input and how the input format are selected.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Add support for the adv7280/adv7281/adv7282

This patch adds support for the adv7280/adv7281/adv7282 devices to the adv7180
driver. They are very similar to the adv7182, the main difference from the
drivers point of view are some different tuning constants for improved video
performance.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Add support for the adv7280-m/adv7281-m/adv7281-ma/adv7282-m

This patch adds support for the adv7280-m/adv2781-m/adv7281-ma/adv7282-m devices
to the adv7180 driver. They are very similar to the adv7280/adv7281/adv7282 but
instead of parallel video out they feature a MIPI CSI2 transmitter.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
[media] adv7180: Add I2P support

Some of the devices supported by this driver have a interlaced-to-progressive
converter which can optionally be enabled. This patch adds support for enabling
and disabling the I2P converter on such devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>