Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions Documentation/devicetree/bindings/media/qcom,qcm2290-camss-ope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/media/qcom,qcm2290-camss-ope.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm Camera Subsystem Offline Processing Engine

maintainers:
- Loic Poulain <loic.poulain@oss.qualcomm.com>

description:
The Qualcomm Camera Subsystem (CAMSS) Offline Processing Engine (OPE)
is a memory-to-memory image processing block. It supports a range of
pixel-processing operations such as scaling, cropping, gain adjustments,
white-balancing, and various format conversions. The OPE does not
interface directly with image sensors, instead, it processes frames
sourced from and written back to system memory.

properties:
compatible:
oneOf:
- items:
- const: qcom,shikra-camss-ope
- const: qcom,qcm2290-camss-ope
- const: qcom,qcm2290-camss-ope

reg:
maxItems: 6

reg-names:
items:
- const: cdm
- const: top
- const: qos
- const: pipeline
- const: bus_read
- const: bus_write

clocks:
maxItems: 5

clock-names:
items:
- const: axi
- const: core
- const: iface
- const: nrt
- const: top

interrupts:
maxItems: 1

interconnects:
maxItems: 2

interconnect-names:
items:
- const: config
- const: data

iommus:
items:
- description: OPE CDM (Configuration DMA) port.
- description: OPE read (fetch engine) port.
- description: OPE write (write engine) port.

operating-points-v2: true

opp-table:
type: object

power-domains:
items:
- description: GDSC CAMSS Block, Global Distributed Switch Controller.
- description: CX power domain.

power-domain-names:
items:
- const: camss
- const: cx

required:
- compatible
- reg
- reg-names
- clocks
- clock-names
- interrupts
- interconnects
- interconnect-names
- iommus
- power-domains
- power-domain-names

additionalProperties: false

examples:
- |
#include <dt-bindings/clock/qcom,gcc-qcm2290.h>
#include <dt-bindings/interconnect/qcom,qcm2290.h>
#include <dt-bindings/interconnect/qcom,rpm-icc.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/power/qcom-rpmpd.h>

camss_ope: isp@5c42000 {
compatible = "qcom,qcm2290-camss-ope";

reg = <0x5c42000 0x400>,
<0x5c42400 0x200>,
<0x5c42600 0x200>,
<0x5c42800 0x4400>,
<0x5c46c00 0x190>,
<0x5c46d90 0xa00>;
reg-names = "cdm", "top", "qos", "pipeline",
"bus_read", "bus_write";

clocks = <&gcc GCC_CAMSS_AXI_CLK>,
<&gcc GCC_CAMSS_OPE_CLK>,
<&gcc GCC_CAMSS_OPE_AHB_CLK>,
<&gcc GCC_CAMSS_NRT_AXI_CLK>,
<&gcc GCC_CAMSS_TOP_AHB_CLK>;
clock-names = "axi", "core", "iface", "nrt", "top";

interrupts = <GIC_SPI 209 IRQ_TYPE_EDGE_RISING>;

interconnects = <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
&config_noc SLAVE_CAMERA_CFG RPM_ACTIVE_TAG>,
<&mmnrt_virt MASTER_CAMNOC_SF RPM_ALWAYS_TAG
&bimc SLAVE_EBI1 RPM_ALWAYS_TAG>;
interconnect-names = "config", "data";

iommus = <&apps_smmu 0x800 0x0>,
<&apps_smmu 0x820 0x0>,
<&apps_smmu 0x840 0x0>;

operating-points-v2 = <&ope_opp_table>;
power-domains = <&gcc GCC_CAMSS_TOP_GDSC>,
<&rpmpd QCM2290_VDDCX>;
power-domain-names = "camss", "cx";

ope_opp_table: opp-table {
compatible = "operating-points-v2";

opp-200000000 {
opp-hz = /bits/ 64 <200000000>;
required-opps = <&rpmpd_opp_svs>;
};

opp-465000000 {
opp-hz = /bits/ 64 <465000000>;
required-opps = <&rpmpd_opp_nom>;
};
};
};
1 change: 1 addition & 0 deletions Documentation/userspace-api/media/v4l/meta-formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ These formats are used for the :ref:`metadata` interface only.
metafmt-intel-ipu3
metafmt-pisp-be
metafmt-pisp-fe
metafmt-qcom-isp
metafmt-rkisp1
metafmt-uvc
metafmt-uvc-msxu-1-5
Expand Down
147 changes: 147 additions & 0 deletions Documentation/userspace-api/media/v4l/metafmt-qcom-isp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
.. SPDX-License-Identifier: GPL-2.0
.. c:namespace:: V4L

.. _v4l2-meta-fmt-qcom-isp-params:

**************************************
V4L2_META_FMT_QCOM_ISP_PARAMS ('QCIP')
**************************************

Configuration Parameters
========================

The ``V4L2_META_FMT_QCOM_ISP_PARAMS`` format carries image processing
configuration for the ISP engines found in the Qualcomm Camera Subsystem
(CAMSS). It is passed to a metadata output video node using the
:c:type:`v4l2_meta_format` interface.

Rather than a single struct containing sub-structs for each configurable area
of the ISP, parameters use the :ref:`v4l2-isp` parameters system, through which
groups of parameters are defined as distinct structs or "blocks" which may be
added to the data member of :c:type:`v4l2_isp_params_buffer`. Userspace is
responsible for populating the data member with the blocks that need to be
configured by the driver. Each block-specific struct embeds
:c:type:`v4l2_isp_params_block_header` as its first member and userspace must
populate the type member with a value from :c:type:`camss_params_block_type`.
Populated blocks must be placed consecutively in the data member, and the
combined size of all populated blocks must be set in the data_size member of
:c:type:`v4l2_isp_params_buffer`.

The set of supported blocks depends on the CAMSS engine consuming the buffer.
The block definitions themselves are shared across CAMSS ISPs; currently the
Offline Processing Engine (OPE) is the only engine consuming them, through its
``ope_params`` metadata output video node. Additional engines and blocks may be
added to this format in the future.

A block carrying ``V4L2_ISP_PARAMS_FL_BLOCK_DISABLE`` bypasses the
corresponding hardware module. Any other block updates the module's
configuration and leaves it enabled. Blocks omitted from a buffer keep their
previously programmed configuration and enable state; until userspace submits
a block for a given module, the driver's default configuration applies.

OPE processing pipeline
=======================

The OPE is a memory-to-memory engine that reads a Bayer RAW frame from its
``ope_input`` node and writes a YUV frame to its ``ope_disp_output`` node. The
parameter blocks configure fixed-function hardware modules that the frame data
passes through, in the following order:

.. code-block:: none

Bayer RAW in RGB domain YUV domain YUV out
(8/10-bit) +------+ +------+ +------+ +------+ +------+ +------+ (NV12/NV16/
----------> | WB |-->| DEMO |-->| CC |-->| GLUT |-->|CHROMA|-->| DSC |----------->
+------+ +------+ +------+ +------+ |ENHAN | +------+ NV24/GREY)
+------+

The stages, and the parameter block that configures each one, are:

.. flat-table:: OPE pipeline stages
:header-rows: 1
:stub-columns: 0

* - Stage
- Module
- Parameter block
- Function
* - WB
- CLC_WB
- :c:type:`camss_params_wb_gain`
- Per-channel white balance gains and black-level / pedestal offsets,
applied to the raw Bayer data.
* - DEMO
- CLC_DEMO
- *(none)*
- Demosaic: reconstructs a full-resolution RGB image from the Bayer
mosaic. Always enabled; not configurable through this format.
* - CC
- CLC_CC
- :c:type:`camss_params_color_correct`
- Color correction matrix applied in the RGB domain.
* - GLUT
- CLC_GLUT
- :c:type:`camss_params_gamma`
- Per-channel gamma correction curves (256-entry LUTs).
* - CHROMA_ENHAN
- CLC_CHROMA_ENHAN
- :c:type:`camss_params_chroma_enhan`
- RGB to YUV color transfer matrix.
* - DSC
- Downscaler
- *(none)*
- Chroma (and, when required, luma) downscaling to produce the requested
YUV subsampling, e.g. YUV 4:4:4 to 4:2:2 (NV16) or 4:2:0 (NV12).

The input node accepts 8-bit and 10-bit packed Bayer RAW formats (for example
``V4L2_PIX_FMT_SRGGB8`` and ``V4L2_PIX_FMT_SRGGB10P``). The output node
produces semi-planar YUV (``V4L2_PIX_FMT_NV12`` / ``NV21`` / ``NV16`` /
``NV61`` / ``NV24`` / ``NV42``) or luma-only ``V4L2_PIX_FMT_GREY``. A
configurable stage is bypassed while its block carries
``V4L2_ISP_PARAMS_FL_BLOCK_DISABLE``.

The following example populates an OPE parameters buffer with a white balance
and a gamma correction block:

.. code-block:: c

struct v4l2_isp_params_buffer *params =
(struct v4l2_isp_params_buffer *)buffer;

params->version = V4L2_ISP_PARAMS_VERSION_V1;
params->data_size = sizeof(struct camss_params_wb_gain) +
sizeof(struct camss_params_gamma);

__u8 *data = params->data;

struct camss_params_wb_gain *wb =
(struct camss_params_wb_gain *)data;

memset(wb, 0, sizeof(*wb));
wb->header.type = CAMSS_PARAMS_WB_GAIN;
wb->header.flags = V4L2_ISP_PARAMS_FL_BLOCK_ENABLE;
wb->header.size = sizeof(struct camss_params_wb_gain);

/* Unity gain on all three channels (15uQ10, 1024 = 1.0) */
wb->g_gain = 1024;
wb->b_gain = 1024;
wb->r_gain = 1024;

data += sizeof(struct camss_params_wb_gain);

struct camss_params_gamma *gamma =
(struct camss_params_gamma *)data;

memset(gamma, 0, sizeof(*gamma));
gamma->header.type = CAMSS_PARAMS_GAMMA;
gamma->header.flags = V4L2_ISP_PARAMS_FL_BLOCK_ENABLE;
gamma->header.size = sizeof(struct camss_params_gamma);

/* Identity curve (pass-through, gamma 1.0) */
for (unsigned int i = 0; i < CAMSS_GAMMA_LUT_SIZE; i++)
gamma->glut[i] = gamma->blut[i] = gamma->rlut[i] = i;

Qualcomm CAMSS ISP uAPI data types
==================================

.. kernel-doc:: include/uapi/linux/qcom-camss-config.h
10 changes: 10 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -21129,7 +21129,9 @@ L: linux-media@vger.kernel.org
S: Maintained
F: Documentation/admin-guide/media/qcom_camss.rst
F: Documentation/devicetree/bindings/media/qcom,*camss*
F: Documentation/userspace-api/media/v4l/metafmt-qcom-isp.rst
F: drivers/media/platform/qcom/camss/
F: include/uapi/linux/qcom-camss-config.h

QUALCOMM CLOCK DRIVERS
M: Bjorn Andersson <andersson@kernel.org>
Expand Down Expand Up @@ -26993,6 +26995,14 @@ F: drivers/media/i2c/vd55g1.c
F: drivers/media/i2c/vd56g3.c
F: drivers/media/i2c/vgxy61.c

V4L2 GENERIC ISP PARAMETERS AND STATISTIC FORMATS
M: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
L: linux-media@vger.kernel.org
S: Maintained
F: drivers/media/v4l2-core/v4l2-isp.c
F: include/media/v4l2-isp.h
F: include/uapi/linux/media/v4l2-isp.h

VF610 NAND DRIVER
M: Stefan Agner <stefan@agner.ch>
L: linux-mtd@lists.infradead.org
Expand Down
Loading
Loading