[PATCH 0/5] media: qcom: camss, ccs: Sony IMX376 on SDM660 using the MIPI CCS driver

Gianluca Boiano posted 5 patches 14 hours ago
drivers/media/i2c/ccs/ccs-core.c                | 106 +++++++++++++++++++++---
drivers/media/platform/qcom/camss/camss-video.c |  28 +++++++
drivers/media/platform/qcom/camss/camss.c       |   6 +-
3 files changed, 129 insertions(+), 11 deletions(-)
[PATCH 0/5] media: qcom: camss, ccs: Sony IMX376 on SDM660 using the MIPI CCS driver
Posted by Gianluca Boiano 14 hours ago
Hi,

These make the Sony IMX376 work with the mainline MIPI CCS driver behind
the Qualcomm CAMSS on SDM660. Nothing specific to the sensor is added to
the driver: the DT node uses "mipi-ccs-1.1", and the manufacturer specific
register settings come from CCS static data (sensors/sony,imx376.yaml,
https://github.com/M0Rf30/ccs-static-data/pull/1, to be submitted to
ccs-static-data).

Tested on a Xiaomi Mi A2 (SDM660, rear IMX376, 4 lanes, link frequencies
500 and 864 MHz):

  - 2592x1940 (2x2 binned), 36 fps at 500 MHz
  - 5184x3880, 29 fps at 864 MHz
  - switching between the two repeatedly
  - cropping the pixel array (4096x3000 binned to 2048x1500)
  - the front IMX376 and the IMX486, which use dedicated drivers, still
    stream

Patches:

1: CAMSS calls s_stream on every sub-device from the video node up to the
   sensor. For a sensor with several sub-devices (CCS has a pixel array, a
   binner and a scaler) that includes the pixel array, whose s_stream
   fails with -EINVAL as only the CSI-2 source pad can be enabled. Stop at
   the sub-device that is bound to CAMSS, as the other CSI-2 receiver
   drivers do (ipu3-cio2, rkisp1, ti-cal, ipu6, rcar-vin): that
   sub-device is responsible for starting what is upstream of it. This
   touches the loops that Qianhui Xu's "media: camss: video: factor
   pipeline stream on/off into a helper" also changes; I'm happy to
   rebase on top of it.

2: The link frequency and the pixel clock were looked up from the pixel
   array of a CCS sensor, whose pixel rate is not the one on the CSI-2
   bus. Use the sub-device bound to CAMSS instead.

3, 4: Two CCS bugs found while doing the above, both regressions from the
   switch to sub-device active state: the format set on a sink pad is not
   stored, and the format of a source pad does not follow the crop
   rectangle. Link validation fails with -EPIPE for anything but the
   native size.

5: CCS static data can carry manufacturer register blocks conditional on
   sensor register values (rules); the driver parses them but never
   writes them. Apply the matching blocks at stream start. The IMX376
   needs this for its full resolution mode, which uses different
   readout registers than the binned one.

The pipeline is configured the usual way, from the pixel array to the
source of the CSI-2 bus (here the scaler), setting the binning with the
compose rectangle of the binner and then the size of the sink pad of the
scaler:

  media-ctl -V '"ccs binner 2-001a":0[fmt:SRGGB12_1X12/5184x3880 compose:(0,0)/2592x1940]'
  media-ctl -V '"ccs scaler 2-001a":0[fmt:SRGGB12_1X12/2592x1940 crop:(0,0)/2592x1940 compose:(0,0)/2592x1940]'
  media-ctl -V '"ccs scaler 2-001a":1[fmt:SRGGB10_1X10/2592x1940]'

---
Gianluca Boiano (5):
      media: qcom: camss: Don't stream sub-devices upstream of the sensor
      media: qcom: camss: Look up link frequency from the sub-device on the CSI-2 link
      media: ccs: Store the format set on a sink pad
      media: ccs: Make the source pad format follow the crop rectangle
      media: ccs: Apply rule-based manufacturer register blocks at stream start

 drivers/media/i2c/ccs/ccs-core.c                | 106 +++++++++++++++++++++---
 drivers/media/platform/qcom/camss/camss-video.c |  28 +++++++
 drivers/media/platform/qcom/camss/camss.c       |   6 +-
 3 files changed, 129 insertions(+), 11 deletions(-)
---
base-commit: aa0f4c41d4870a18e65772a1817af16427200371
change-id: 20261122-b4-ccs-imx376-03da25278f5b

Best regards,
--  
Gianluca Boiano <morf3089@gmail.com>