From 4b95f00a0721363d7284e3aeb08457ec070f637b Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 18 Jul 2025 18:24:37 +0300 Subject: [PATCH 01/72] media: mc: Add INTERNAL pad flag Internal source pads will be used as routing endpoints in V4L2 [GS]_ROUTING IOCTLs, to indicate that the stream begins in the entity. Internal source pads are pads that have both SINK and INTERNAL flags set. Also prevent creating links to pads that have been flagged as internal and initialising SOURCE pads with INTERNAL flag set. Signed-off-by: Sakari Ailus --- .../userspace-api/media/mediactl/media-types.rst | 8 ++++++++ drivers/media/mc/mc-entity.c | 10 ++++++++-- include/uapi/linux/media.h | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Documentation/userspace-api/media/mediactl/media-types.rst b/Documentation/userspace-api/media/mediactl/media-types.rst index 6332e8395263b0..f55ef055bcf859 100644 --- a/Documentation/userspace-api/media/mediactl/media-types.rst +++ b/Documentation/userspace-api/media/mediactl/media-types.rst @@ -361,6 +361,7 @@ Types and flags used to represent the media graph elements .. _MEDIA-PAD-FL-SINK: .. _MEDIA-PAD-FL-SOURCE: .. _MEDIA-PAD-FL-MUST-CONNECT: +.. _MEDIA-PAD-FL-INTERNAL: .. flat-table:: Media pad flags :header-rows: 0 @@ -381,6 +382,13 @@ Types and flags used to represent the media graph elements enabled links even when this flag isn't set; the absence of the flag doesn't imply there is none. + * - ``MEDIA_PAD_FL_INTERNAL`` + - The internal flag indicates an internal pad that has no external + connections. Such a pad shall not be connected with a link. + + The internal flag may currently be present only in a source pad where + it indicates that the :ref:``stream `` + originates from within the entity. One and only one of ``MEDIA_PAD_FL_SINK`` and ``MEDIA_PAD_FL_SOURCE`` must be set for every pad. diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 96dd0f6ccd0d0a..c43a195207d432 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -213,7 +213,9 @@ int media_entity_pads_init(struct media_entity *entity, u16 num_pads, iter->index = i++; if (hweight32(iter->flags & (MEDIA_PAD_FL_SINK | - MEDIA_PAD_FL_SOURCE)) != 1) { + MEDIA_PAD_FL_SOURCE)) != 1 || + (iter->flags & MEDIA_PAD_FL_INTERNAL && + !(iter->flags & MEDIA_PAD_FL_SINK))) { ret = -EINVAL; break; } @@ -1118,7 +1120,8 @@ int media_get_pad_index(struct media_entity *entity, u32 pad_type, for (i = 0; i < entity->num_pads; i++) { if ((entity->pads[i].flags & - (MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_SOURCE)) != pad_type) + (MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_SOURCE | + MEDIA_PAD_FL_INTERNAL)) != pad_type) continue; if (entity->pads[i].sig_type == sig_type) @@ -1148,6 +1151,9 @@ media_create_pad_link(struct media_entity *source, u16 source_pad, return -EINVAL; if (WARN_ON(!(sink->pads[sink_pad].flags & MEDIA_PAD_FL_SINK))) return -EINVAL; + if (WARN_ON(source->pads[source_pad].flags & MEDIA_PAD_FL_INTERNAL) || + WARN_ON(sink->pads[sink_pad].flags & MEDIA_PAD_FL_INTERNAL)) + return -EINVAL; link = media_add_link(&source->links); if (link == NULL) diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 1c80b1d6bbaf36..80cfd12a43fc1a 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -208,6 +208,7 @@ struct media_entity_desc { #define MEDIA_PAD_FL_SINK (1U << 0) #define MEDIA_PAD_FL_SOURCE (1U << 1) #define MEDIA_PAD_FL_MUST_CONNECT (1U << 2) +#define MEDIA_PAD_FL_INTERNAL (1U << 3) struct media_pad_desc { __u32 entity; /* entity ID */ From 23256c94dd6aef5f394553d1378e9700dfd82401 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:38 +0300 Subject: [PATCH 02/72] dt-bindings: media: i2c: max96717: add myself as maintainer Analog Devices is taking responsability for the maintenance of the Maxim GMSL2/3 devices. Add myself to the maintainers list and to the device tree bindings. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml | 1 + MAINTAINERS | 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml index d1e8ba6e368ec1..15ab37702a9270 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml @@ -9,6 +9,7 @@ title: MAX96717 CSI-2 to GMSL2 Serializer maintainers: - Julien Massot + - Cosmin Tanislav description: The MAX96717 serializer converts MIPI CSI-2 D-PHY formatted input diff --git a/MAINTAINERS b/MAINTAINERS index be3d7b41fcb37d..52016f2cbc1d94 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13916,6 +13916,7 @@ F: drivers/media/i2c/max96714.c MAX96717 GMSL2 SERIALIZER DRIVER M: Julien Massot +M: Cosmin Tanislav L: linux-media@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml From 1e7931dd69ab6239803528e4bd4c72a35e9f665e Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:39 +0300 Subject: [PATCH 03/72] dt-bindings: media: i2c: max96717: add support for I2C ATR MAX96717 is capable of address translation for the connected I2C slaves. Add support for I2C ATR while keeping I2C gate for compatibility to support this usecase. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- .../bindings/media/i2c/maxim,max96717.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml index 15ab37702a9270..167c3dd50683c7 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml @@ -92,6 +92,30 @@ properties: incoming GMSL2 link. Therefore, it supports an i2c-gate subnode to configure a sensor. + i2c-alias-pool: + maxItems: 2 + + i2c-atr: + type: object + additionalProperties: false + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^i2c@[01]$': + $ref: /schemas/i2c/i2c-controller.yaml# + unevaluatedProperties: false + properties: + reg: + items: + minimum: 0 + maximum: 1 + required: - compatible - reg @@ -99,6 +123,21 @@ required: additionalProperties: false +allOf: + - $ref: /schemas/i2c/i2c-atr.yaml# + + - anyOf: + - oneOf: + - required: [i2c-atr] + - required: [i2c-gate] + + - not: + required: [i2c-atr, i2c-gate] + +dependentRequired: + i2c-atr: [i2c-alias-pool] + i2c-alias-pool: [i2c-atr] + examples: - | #include From 538264c2910df6a597f79c271561c9e3c7f305b4 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:40 +0300 Subject: [PATCH 04/72] dt-bindings: media: i2c: max96717: add support for pinctrl/pinconf MAX96717 is capable of configuring various pin properties. Add pinctrl/pinconf properties to support this usecase. Signed-off-by: Cosmin Tanislav Reviewed-by: Rob Herring (Arm) --- .../bindings/media/i2c/maxim,max96717.yaml | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml index 167c3dd50683c7..9afaa8a7a3f526 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml @@ -121,6 +121,111 @@ required: - reg - ports +patternProperties: + '-pins$': + type: object + additionalProperties: false + + properties: + function: + enum: [gpio, rclkout] + + pins: true + drive-open-drain: true + drive-push-pull: true + bias-disable: true + output-disable: true + output-enable: true + output-low: true + output-high: true + input-enable: true + + slew-rate: + description: | + Slew rate. + Rise and fall times represent the time needed for a GPIO to go + from 20% to 80% of VDDIO. + 0 - Fastest + rise: 1.0ns @ 1.8V, 0.6ns @ 3.3V, + fall: 0.8ns @ 1.8V, 0.5ns @ 3.3V + 1 - Fast + rise: 2.1ns @ 1.8V, 1.1ns @ 3.3V, + fall: 2.0ns @ 1.8V, 1.1ns @ 3.3V + 2 - Slow + rise: 4.0ns @ 1.8V, 2.3ns @3.3V, + fall: 10.0ns @ 1.8V, 5.0ns @3.3V + 3 - Slowest + rise: 9.0ns @ 1.8V, 5.0ns @3.3V, + fall: 10.0ns @ 1.8V, 5.0ns @3.3V + maximum: 3 + + bias-pull-up: + oneOf: + - type: boolean + description: Enable regular 40kOhm pull-up + - enum: [ 40000, 1000000 ] + description: Enable either the 40kOhm or the 1MOhm pull-up + + bias-pull-down: + oneOf: + - type: boolean + description: Enable regular 40kOhm pull-down + - enum: [ 40000, 1000000 ] + description: Enable either the 40kOhm or the 1MOhm pull-down + + maxim,jitter-compensation: + type: boolean + description: | + Enables jitter compensation. + Jitter compensation is used to minimize the jitter of the + signals transmitted from the deserializer to the serializer + by adding a fixed delay to every transition on the serializer + side. This can be used for pulse generation where timing is + critical. + + maxim,tx-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Enable transmission of the pin state from the serializer to + the deserializer using the specified identifier. + maximum: 31 + + maxim,rx-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Enable transmission of the pin state from the deserializer to + the serializer using the specified identifier. + maximum: 31 + + required: + - pins + - function + + allOf: + - $ref: /schemas/pinctrl/pincfg-node.yaml# + - $ref: /schemas/pinctrl/pinmux-node.yaml# + + - if: + properties: + function: + const: gpio + then: + properties: + pins: + items: + enum: [mfp0, mfp1, mfp2, mfp3, mfp4, mfp5, mfp6, mfp7, + mfp8, mfp9, mfp10] + + - if: + properties: + function: + const: rclkout + then: + properties: + pins: + items: + enum: [mfp2, mfp4] + additionalProperties: false allOf: From 2c424dd9311f0116d1f4ea8b87d48d5ea8b6e2f7 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:41 +0300 Subject: [PATCH 05/72] dt-bindings: media: i2c: max96717: add support for MAX9295A MAX9295A is an older variant of the MAX96717 which does not support tunnel mode. Document the compatibility. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/media/i2c/maxim,max96717.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml index 9afaa8a7a3f526..78ecbab8205a55 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml @@ -25,12 +25,17 @@ description: The GMSL2 serial link operates at a fixed rate of 3Gbps or 6Gbps in the forward direction and 187.5Mbps in the reverse direction. + MAX96717F only supports a fixed rate of 3Gbps in the forward direction. + MAX9295A only supports pixel mode. + properties: compatible: oneOf: - - const: maxim,max96717f + - enum: + - maxim,max9295a + - maxim,max96717f - items: - enum: - maxim,max96717 From b524b8ce386dec0cef0fac8cd11827cfdc368061 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:42 +0300 Subject: [PATCH 06/72] dt-bindings: media: i2c: max96717: add support for MAX96793 MAX96793 is a newer variant of the MAX96717 which also supports GMSL3 links. Document this compatibility. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/media/i2c/maxim,max96717.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml index 78ecbab8205a55..02a44db9828522 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml @@ -30,6 +30,8 @@ description: MAX9295A only supports pixel mode. + MAX96793 also supports GMSL3 mode. + properties: compatible: oneOf: @@ -39,6 +41,7 @@ properties: - items: - enum: - maxim,max96717 + - maxim,max96793 - const: maxim,max96717f '#gpio-cells': From 552c2e214099feb9aa87cbb5aa0a325174b94af6 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:43 +0300 Subject: [PATCH 07/72] dt-bindings: media: i2c: max96712: add myself as maintainer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Analog Devices is taking responsability for the maintenance of the Maxim GMSL2/3 devices. Add myself to the maintainers list and to the device tree bindings. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) Acked-by: Niklas Söderlund --- Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml | 1 + MAINTAINERS | 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml index 6c72e77b927c0d..a8e5ce6f7f17ad 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -9,6 +9,7 @@ title: Quad GMSL2 to CSI-2 Deserializer with GMSL1 Compatibility maintainers: - Niklas Söderlund + - Cosmin Tanislav description: | The MAX96712 deserializer converts GMSL2 or GMSL1 serial inputs into MIPI diff --git a/MAINTAINERS b/MAINTAINERS index 52016f2cbc1d94..eedd864486d96a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13902,6 +13902,7 @@ F: drivers/media/i2c/max9286.c MAX96712 QUAD GMSL2 DESERIALIZER DRIVER M: Niklas Söderlund +M: Cosmin Tanislav L: linux-media@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml From f3ce16b008b77226678d9e99abb8e21054e9de5f Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:44 +0300 Subject: [PATCH 08/72] dt-bindings: media: i2c: max96712: use pattern properties for ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MAX96712 and MAX96724 support up to 4 separate PHYs, depending on the selected PHY configuration. Use patternProperties to document this. The input ports are all the same, use patternProperties for them. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) Reviewed-by: Niklas Söderlund --- .../bindings/media/i2c/maxim,max96712.yaml | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml index a8e5ce6f7f17ad..70118d1ee7f1fd 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -37,27 +37,15 @@ properties: ports: $ref: /schemas/graph.yaml#/properties/ports - properties: - port@0: + patternProperties: + '^port@[0-3]$': $ref: /schemas/graph.yaml#/properties/port - description: GMSL Input 0 + description: GMSL Input ports 0-3 - port@1: - $ref: /schemas/graph.yaml#/properties/port - description: GMSL Input 1 - - port@2: - $ref: /schemas/graph.yaml#/properties/port - description: GMSL Input 2 - - port@3: - $ref: /schemas/graph.yaml#/properties/port - description: GMSL Input 3 - - port@4: + '^port@[4-7]$': $ref: /schemas/graph.yaml#/$defs/port-base unevaluatedProperties: false - description: CSI-2 Output + description: CSI-2 Output port 0-3 properties: endpoint: @@ -75,8 +63,11 @@ properties: - data-lanes - bus-type - required: - - port@4 + anyOf: + - required: [port@4] + - required: [port@5] + - required: [port@6] + - required: [port@7] required: - compatible From ede7955664ff13732f55471c27566b74e30e00b9 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:45 +0300 Subject: [PATCH 09/72] dt-bindings: media: i2c: max96712: add support for I2C ATR MAX96712 and MAX96724 have more than one GMSL2 link, and each link is capable of connecting to a separate serializer. If these serializers have the same CFG pins configuration, they will also have the same I2C address, causing conflicts unless the deserializer changes the address of the connected serializers. The MAX96712 and MAX96724 support changing the I2C address of the connected serializers. Document this capability. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- .../bindings/media/i2c/maxim,max96712.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml index 70118d1ee7f1fd..77399cf4aab61a 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -34,6 +34,30 @@ properties: enable-gpios: true + i2c-alias-pool: + maxItems: 4 + + i2c-atr: + type: object + additionalProperties: false + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^i2c@[0-3]$': + $ref: /schemas/i2c/i2c-controller.yaml# + unevaluatedProperties: false + properties: + reg: + items: + minimum: 0 + maximum: 3 + ports: $ref: /schemas/graph.yaml#/properties/ports @@ -76,6 +100,13 @@ required: additionalProperties: false +allOf: + - $ref: /schemas/i2c/i2c-atr.yaml# + +dependentRequired: + i2c-atr: [i2c-alias-pool] + i2c-alias-pool: [i2c-atr] + examples: - | #include From c0214d91ada9ec3204d7c7f62939812dc0e03110 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:46 +0300 Subject: [PATCH 10/72] dt-bindings: media: i2c: max96712: add support for POC supplies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GMSL links can carry power to the serializer when using coaxial cables. Document this capability. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) Reviewed-by: Niklas Söderlund --- .../devicetree/bindings/media/i2c/maxim,max96712.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml index 77399cf4aab61a..c87f7757e6c762 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -93,6 +93,10 @@ properties: - required: [port@6] - required: [port@7] +patternProperties: + '^port[0-3]-poc-supply$': + description: Regulator providing Power over Coax for GMSL ports + required: - compatible - reg From c5fe90e5d55a718a88156ffe493cbc5fe619ed4f Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:48 +0300 Subject: [PATCH 11/72] dt-bindings: media: i2c: max96714: add myself as maintainer Analog Devices is taking responsability for the maintenance of the Maxim GMSL2/3 devices. Add myself to the maintainers list and to the device tree bindings. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml | 1 + MAINTAINERS | 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml index 3ace50e11921b2..f53c72e5c57279 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml @@ -8,6 +8,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Maxim MAX96714 GMSL2 to CSI-2 Deserializer maintainers: + - Cosmin Tanislav - Julien Massot description: diff --git a/MAINTAINERS b/MAINTAINERS index eedd864486d96a..a79f3876d53fa8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13910,6 +13910,7 @@ F: drivers/staging/media/max96712/max96712.c MAX96714 GMSL2 DESERIALIZER DRIVER M: Julien Massot +M: Cosmin Tanislav L: linux-media@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml From 9169e8082426b378719bed1d52116b13d4ec6c4e Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:49 +0300 Subject: [PATCH 12/72] dt-bindings: media: i2c: max96714: add support for MAX96714R MAX96714R is a lower capability variant of the MAX96714 which only supports a fixed rate of 3Gbps in the forward direction. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/media/i2c/maxim,max96714.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml index f53c72e5c57279..1c97624833ebd8 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml @@ -23,7 +23,9 @@ description: The GMSL2 serial link operates at a fixed rate of 3Gbps or 6Gbps in the forward direction and 187.5Mbps in the reverse direction. - MAX96714F only supports a fixed rate of 3Gbps in the forward direction. + + MAX96714F and MAX96714R only support a fixed rate of 3Gbps in the forward + direction. properties: compatible: @@ -32,6 +34,7 @@ properties: - items: - enum: - maxim,max96714 + - maxim,max96714r - const: maxim,max96714f reg: From 0c28fa27e036baeccb371f290071f072a8ca81ed Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:50 +0300 Subject: [PATCH 13/72] dt-bindings: media: i2c: add MAX9296A, MAX96716A, MAX96792A The MAX9296A deserializer converts single or dual serial inputs to MIPI CSI-2 outputs. The GMSL2 links operate at a fixed rate of 3Gbps or 6Gbps in the forward direction and 187.5Mbps in the reverse direction. In GMSL1 mode, each serial link can be paired with 3.12Gbps or 1.5Gbps GMSL1 serializers or operate up to 4.5Gbps with GMSL2 serializers with GMSL1 backward compatibility. The MAX9296A supports mixed GMSL2 and GMSL1 links. The serial inputs operate independently, allowing videos with different timings and resolutions to be received on each input. MAX96716A supports both tunnel and pixel mode. MAX96792A supports both tunnel and pixel mode, and has two GMSL3 links. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) --- .../bindings/media/i2c/maxim,max9296a.yaml | 242 ++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 248 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/maxim,max9296a.yaml diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9296a.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9296a.yaml new file mode 100644 index 00000000000000..4f2b3b5b69cf44 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9296a.yaml @@ -0,0 +1,242 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2024 Collabora Ltd. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/maxim,max9296a.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Maxim MAX9296A GMSL2 to CSI-2 Deserializer + +maintainers: + - Cosmin Tanislav + +description: > + The MAX9296A deserializer converts single or dual serial inputs to + MIPI CSI-2 outputs. The GMSL2 links operate at a fixed rate of 3Gbps + or 6Gbps in the forward direction and 187.5Mbps in the reverse + direction. In GMSL1 mode, each serial link can be paired with 3.12Gbps + or 1.5Gbps GMSL1 serializers or operate up to 4.5Gbps with GMSL2 + serializers with GMSL1 backward compatibility. The MAX9296A supports + mixed GMSL2 and GMSL1 links. The serial inputs operate independently, + allowing videos with different timings and resolutions to be received + on each input. + + MAX96716A supports both tunnel and pixel mode. + + MAX96792A supports both tunnel and pixel mode, and has two GMSL3 links. + +properties: + compatible: + enum: + - maxim,max9296a + - maxim,max96716a + - maxim,max96792a + + reg: + maxItems: 1 + + powerdown-gpios: + maxItems: 1 + description: Specifier for the GPIO connected to the PWDNB pin. + + port0-poc-supply: + description: Regulator providing Power over Coax for GMSL port 0 + + port1-poc-supply: + description: Regulator providing Power over Coax for GMSL port 1 + + i2c-alias-pool: + maxItems: 2 + + i2c-atr: + type: object + additionalProperties: false + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^i2c@[0-1]$': + $ref: /schemas/i2c/i2c-controller.yaml# + unevaluatedProperties: false + properties: + reg: + items: + minimum: 0 + maximum: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + patternProperties: + '^port@[0-1]$': + $ref: /schemas/graph.yaml#/properties/port + description: GMSL Input ports 0-1 + + '^port@[2-3]$': + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: CSI-2 Output ports 0-1 + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + minItems: 1 + maxItems: 4 + + lane-polarities: + minItems: 1 + maxItems: 5 + + link-frequencies: + maxItems: 1 + + required: + - data-lanes + + anyOf: + - required: + - port@2 + - required: + - port@3 + +required: + - compatible + - reg + - ports + +additionalProperties: false + +allOf: + - $ref: /schemas/i2c/i2c-atr.yaml# + +dependentRequired: + i2c-atr: [i2c-alias-pool] + i2c-alias-pool: [i2c-atr] + +examples: + - | + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + deserializer@28 { + compatible = "maxim,max9296a"; + reg = <0x28>; + powerdown-gpios = <&main_gpio0 37 GPIO_ACTIVE_LOW>; + + i2c-alias-pool = <0x40 0x41>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + des_gmsl_in_0: endpoint { + remote-endpoint = <&ser_0_gmsl_out>; + }; + }; + + port@1 { + reg = <1>; + des_gmsl_in_1: endpoint { + remote-endpoint = <&ser_1_gmsl_out>; + }; + }; + + port@2 { + reg = <2>; + des_csi_out: endpoint { + data-lanes = <1 2 3 4>; + link-frequencies = /bits/ 64 <400000000>; + remote-endpoint = <&csi_in>; + }; + }; + }; + + i2c-atr { + #address-cells = <1>; + #size-cells = <0>; + + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + serializer@40 { + compatible = "maxim,max96717", "maxim,max96717f"; + reg = <0x40>; + gpio-controller; + #gpio-cells = <2>; + #clock-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ser_0_csi_in: endpoint { + data-lanes = <1 2>; + remote-endpoint = <&sensor_0_out>; + }; + }; + + port@1 { + reg = <1>; + ser_0_gmsl_out: endpoint { + remote-endpoint = <&des_gmsl_in_0>; + }; + }; + }; + }; + }; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + serializer@40 { + compatible = "maxim,max96717", "maxim,max96717f"; + reg = <0x40>; + gpio-controller; + #gpio-cells = <2>; + #clock-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ser_1_csi_in: endpoint { + data-lanes = <1 2>; + remote-endpoint = <&sensor_1_out>; + }; + }; + + port@1 { + reg = <1>; + ser_1_gmsl_out: endpoint { + remote-endpoint = <&des_gmsl_in_1>; + }; + }; + }; + }; + }; + }; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index a79f3876d53fa8..3d0b4466b6214a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13938,6 +13938,12 @@ S: Maintained F: Documentation/devicetree/bindings/iio/proximity/maxbotix,mb1232.yaml F: drivers/iio/proximity/mb1232.c +MAXIM GMSL2/3 SERIALIZERS AND DESERIALIZERS +M: Cosmin Tanislav +L: linux-media@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/media/i2c/maxim,max9296a.yaml + MAXIM MAX11205 DRIVER M: Ramona Bolboaca L: linux-iio@vger.kernel.org From 5a42e049bf6c0c4c02d33a73735feadc47e53990 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:51 +0300 Subject: [PATCH 14/72] media: i2c: add Maxim GMSL2/3 serializer and deserializer framework These drivers are meant to be used as a common framework for Maxim GMSL2/3 serializers and deserializers. This framework enables support for the following new features across all the chips: * Full Streams API support * .get_frame_desc() * .get_mbus_config() * I2C ATR * automatic GMSL link version negotiation * automatic stream id selection * automatic VC remapping * automatic pixel mode / tunnel mode selection * automatic double mode selection / data padding * logging of internal state and chip status registers via .log_status() * PHY modes * serializer pinctrl * TPG Signed-off-by: Cosmin Tanislav --- MAINTAINERS | 1 + drivers/media/i2c/Kconfig | 2 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/maxim-serdes/Kconfig | 17 + drivers/media/i2c/maxim-serdes/Makefile | 3 + drivers/media/i2c/maxim-serdes/max_serdes.c | 413 ++++++++++++++++++++ drivers/media/i2c/maxim-serdes/max_serdes.h | 183 +++++++++ 7 files changed, 620 insertions(+) create mode 100644 drivers/media/i2c/maxim-serdes/Kconfig create mode 100644 drivers/media/i2c/maxim-serdes/Makefile create mode 100644 drivers/media/i2c/maxim-serdes/max_serdes.c create mode 100644 drivers/media/i2c/maxim-serdes/max_serdes.h diff --git a/MAINTAINERS b/MAINTAINERS index 3d0b4466b6214a..1eb92a6da6cf28 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13943,6 +13943,7 @@ M: Cosmin Tanislav L: linux-media@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/media/i2c/maxim,max9296a.yaml +F: drivers/media/i2c/maxim-serdes/ MAXIM MAX11205 DRIVER M: Ramona Bolboaca diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index de6835f6d0482b..b05d73c8078d0f 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -1692,6 +1692,8 @@ config VIDEO_MAX96717 To compile this driver as a module, choose M here: the module will be called max96717. +source "drivers/media/i2c/maxim-serdes/Kconfig" + endmenu endif # VIDEO_DEV diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 35d9b9b839193e..aa9bce673928e7 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -72,6 +72,7 @@ obj-$(CONFIG_VIDEO_MAX9271_LIB) += max9271.o obj-$(CONFIG_VIDEO_MAX9286) += max9286.o obj-$(CONFIG_VIDEO_MAX96714) += max96714.o obj-$(CONFIG_VIDEO_MAX96717) += max96717.o +obj-$(CONFIG_VIDEO_MAXIM_SERDES) += maxim-serdes/ obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o obj-$(CONFIG_VIDEO_MT9M001) += mt9m001.o diff --git a/drivers/media/i2c/maxim-serdes/Kconfig b/drivers/media/i2c/maxim-serdes/Kconfig new file mode 100644 index 00000000000000..f5a4ca80a263be --- /dev/null +++ b/drivers/media/i2c/maxim-serdes/Kconfig @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0 + +config VIDEO_MAXIM_SERDES + tristate "Maxim GMSL2/3 Serializer and Deserializer support" + depends on VIDEO_DEV + depends on I2C + select I2C_ATR + select I2C_MUX + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + help + This driver supports the Maxim GMSL2/3 common Serializer and + Deserializer framework. + + To compile this driver as a module, choose M here: the module + will be called max_serdes. diff --git a/drivers/media/i2c/maxim-serdes/Makefile b/drivers/media/i2c/maxim-serdes/Makefile new file mode 100644 index 00000000000000..630fbb486bab13 --- /dev/null +++ b/drivers/media/i2c/maxim-serdes/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 +max-serdes-objs := max_serdes.o +obj-$(CONFIG_VIDEO_MAXIM_SERDES) += max-serdes.o diff --git a/drivers/media/i2c/maxim-serdes/max_serdes.c b/drivers/media/i2c/maxim-serdes/max_serdes.c new file mode 100644 index 00000000000000..bed70b8ce99a44 --- /dev/null +++ b/drivers/media/i2c/maxim-serdes/max_serdes.c @@ -0,0 +1,413 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2025 Analog Devices Inc. + */ + +#include +#include +#include +#include + +#include + +#include