[PATCH 0/2] media: i2c: Add support for RDACM21 camera module

From: Jacopo Mondi
Date: Wed Sep 16 2020 - 13:46:50 EST

this series introduces support for the RDACM21 camera module, an automotive
camera module based on GMSL technology.

The camera module integrates a MAX9271 serializer, and OV10640 image sensor
coupled with an OV490 ISP. The image sensor and the ISP are programmed loading
the content of an EEPROM chip integrated in the camera module package and
are configured to produce images in 1280x1080 YUYV8 format.

The camera module driver uses the max9271 library to control the serializer,
as the RDACM20 does, to maximize code reuse.

And that's for patch 2/2: it's all unicorns and rainbows!

Patch 1/2 is the less nice one, and is sent as RFC to trigger discussions.

The camera module is connected to a MAXIM development board which integrates a
MAX9286 deserializer. The same expansion board is used with the RDACM20 camera
module and the max9286 driver is meant to work with both cameras without

Unfortunately, each camera module has its own characteristics, in details:

- the RDACM20 module integrates a micro-controller unit that pre-programs the
embedded max9271 serializer at power-up time. The serializer then operates
with the GMSL reverse channel towards the de-serializer with electrical
noise immunity feature enabled ("high-threshold" as per chip manual), and
requires the de-serializer to communicate with the camera module with the
reverse channel amplitude compensated to 170mV.

- the RDACM21 module is not pre-programmed by any micro-controller, and requires
the de-serializer to initially maintain the reverse channel amplitude to
100mV, then after the remote ends have been probed and have enabled the noise
immunity feature on their reverse channels to increase the amplitude to 170mV
to guarantee stability of the communications.

For that reason, a mechanism to control the reverse channel amplitude of the
GMSL channel is required. The channel amplitude is controlled by the
de-serializer, but depends on the properties of the remote serializer.

We have explored a few solutions in the past:
1) A dt property that specifies the initial reverse channel amplitude (or simply
a boolean property that specifies if any channel pre-compensation is
required). Issue is that the property should be set in the de-serializer
but depends on the remote side configuration and on which camera module
is currently connected.

2) Use get_mbus_config to retrieve the GMSL channel configuration. Hyun has
added to get_mbus_config support for GMSL parameters to control the signal
polarities[1]. This seems nice, but the channel amplitude has to be set
-before- the remote end is probed and no subdev operation can be called
until the remote sub-device have registered.

In this initial version, [1/2] simply adjust the reverse channel after all
remotes have probed, allowing support for RDACM21 but breaking compatibility
with RDACM20.

Any comment on how this should better be handled ?


[1] https://github.com/xlnx-hyunkwon/linux-xlnx/commits/hyunk/vision-wip-5.4-next

Jacopo Mondi (2):
RFC: media: i2c: max9286: Compensate reverse channel
media: i2c: Add driver for RDACM21 camera module

drivers/media/i2c/Kconfig | 13 +
drivers/media/i2c/Makefile | 2 +
drivers/media/i2c/max9286.c | 8 +-
drivers/media/i2c/rdacm21.c | 541 ++++++++++++++++++++++++++++++++++++
5 files changed, 574 insertions(+), 2 deletions(-)
create mode 100644 drivers/media/i2c/rdacm21.c