media: i2c: max9286: Use "maxim,gpio-poc" property
authorJacopo Mondi <jacopo+renesas@jmondi.org>
Fri, 17 Dec 2021 14:30:18 +0000 (15:30 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 28 Jan 2022 10:26:05 +0000 (11:26 +0100)
commitc9352df7139bc5be6642ebc8a78b40477ab32acd
tree7799f1dcafb335df5682be7b26b0ccc55df6cec0
parent48a0c73f94d34ae5e78f85dc9a25e420a1dd207e
media: i2c: max9286: Use "maxim,gpio-poc" property

The 'maxim,gpio-poc' property is used when the remote camera
power-over-coax is controlled by one of the MAX9286 gpio lines,
to instruct the driver about which line to use and what the line
polarity is.

Add to the max9286 driver support for parsing the newly introduced
property and use it if available in place of the usual supply, as it is
not possible to establish one as consumer of the max9286 gpio
controller.

If the new property is present, no gpio controller is registered and
'poc-supply' is ignored.

In order to maximize code re-use, break out the max9286 gpio handling
function so that they can be used by the gpio controller through the
gpio-consumer API, or directly by the driver code.

Wrap the power up and power down routines to their own function to
be able to use either the gpio line directly or the supply. This will
make it easier to control the remote camera power at run time.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/i2c/max9286.c