OSDN Git Service

[media] adv7180: Do implicit register paging
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 23 Jan 2015 15:52:24 +0000 (12:52 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 2 Feb 2015 13:40:14 +0000 (11:40 -0200)
commit3999e5d01da74f1a22afbb0b61b3992fea301478
tree3be79b327c87cc90a3a7ca14a3eea497ac8ccf57
parent029d61779189a488d5649dab43c83cc6497e8843
[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.

This patch adds two helper functions that take care of switching between
pages and reading/writing the register. 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.

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.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/adv7180.c