From 771d840df1a876270095b15a24ddc18e2523d7ea Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 18 Jul 2025 18:24:37 +0300 Subject: [PATCH 01/52] 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 Reviewed-by: Tomi Valkeinen --- .../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 04559090558205..d1feacc6080720 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 960c65d747eb01419daab96301d2dba7ee894984 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:38 +0300 Subject: [PATCH 02/52] 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 97d958c945e4ff..d35d4654ce6673 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14967,6 +14967,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 03072d1d80e0d027f8491e3a9aad39f5c4e1687e Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:39 +0300 Subject: [PATCH 03/52] 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) Reviewed-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 37f8088c72da5630811c7a0e307976d020ac5c6c Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:40 +0300 Subject: [PATCH 04/52] 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 27515fa8b52a1dc6414e4b8161d696fd8701ea3c Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:41 +0300 Subject: [PATCH 05/52] 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 17e1093428dcd843dd1a629b0a51ccf03564e16d Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:42 +0300 Subject: [PATCH 06/52] 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 95e4d6cfef5e69a9ba79c40babb4c43b9c1bd83f Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:43 +0300 Subject: [PATCH 07/52] 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 26f85151afbd3e..efdece2b33b965 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 d35d4654ce6673..d2273e53e12af1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14953,6 +14953,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 f4e602a673f39263163fe0d9f8e195b8ac29e70f Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:44 +0300 Subject: [PATCH 08/52] 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 Reviewed-by: Rob Herring (Arm) --- .../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 efdece2b33b965..f712d7cfc35f51 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -40,27 +40,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: @@ -78,8 +66,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 2ef218708b5108bd534f846778182ba2f67e18a5 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:45 +0300 Subject: [PATCH 09/52] 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) Reviewed-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 f712d7cfc35f51..758c0223977d47 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -37,6 +37,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 @@ -79,6 +103,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 1999af33923b985231c2912e508638107f4bf4fc Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:46 +0300 Subject: [PATCH 10/52] 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 Reviewed-by: Rob Herring (Arm) --- .../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 758c0223977d47..b345305acc4c3b 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -96,6 +96,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 fcf484131d608f5dd91b57be880fc90a1265a71e Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:47 +0300 Subject: [PATCH 11/52] dt-bindings: media: i2c: max96712: add support for MAX96724F/R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MAX96724F/MAX96724R are a lower capability variant of the MAX96724 which only support a fixed rate of 3Gbps in the forward direction. Signed-off-by: Cosmin Tanislav Acked-by: Rob Herring (Arm) Reviewed-by: Niklas Söderlund --- .../devicetree/bindings/media/i2c/maxim,max96712.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml index b345305acc4c3b..5dcafd46344ccd 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml @@ -24,12 +24,17 @@ description: | MAX96712 can be paired with first-generation 3.12Gbps or 1.5Gbps GMSL1 serializers or operate up to 3.12Gbps with GMSL2 serializers in GMSL1 mode. + MAX96724F and MAX96724R only support a fixed rate of 3Gbps in the forward + direction. + properties: compatible: items: - enum: - maxim,max96712 - maxim,max96724 + - maxim,max96724f + - maxim,max96724r reg: description: I2C device address From a7af2baf8037b2d98ec36b21252a4e65a3e18185 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:48 +0300 Subject: [PATCH 12/52] 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 d2273e53e12af1..a8fe0ebb780159 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14961,6 +14961,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 2250ba7aa1320edaed9f9f3e9f0694d22333d1e8 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:49 +0300 Subject: [PATCH 13/52] 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 50ba59ed8ff74e917d43f1fee5998d7e239091e1 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:50 +0300 Subject: [PATCH 14/52] 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 a8fe0ebb780159..8ecc7cae81a3fe 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14989,6 +14989,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 8b88e3bfb09858885315c9a8c80e90d83a7d09c5 Mon Sep 17 00:00:00 2001 From: Cosmin Tanislav Date: Fri, 18 Jul 2025 18:24:51 +0300 Subject: [PATCH 15/52] 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 8ecc7cae81a3fe..8ea583d4a58b10 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14994,6 +14994,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 d7e8a0b986a327..52d22b93dde46a 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -1714,6 +1714,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 085c0e0e15dd93..22813cf584eff4 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