Skip to content

Avoid making difference between 15pins and 22pins raspberry pi CSI connector #91983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
18 changes: 9 additions & 9 deletions boards/shields/st_b_cams_imx_mb1854/st_b_cams_imx_mb1854.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*
*/

#include <zephyr/dt-bindings/gpio/raspberrypi-csi-22pins-connector.h>
#include <zephyr/dt-bindings/gpio/raspberrypi-csi-connector.h>
#include <zephyr/dt-bindings/video/video-interfaces.h>

/ {
chosen {
zephyr,camera = &csi_22pins_capture_port;
zephyr,camera = &csi_capture_port;
};

imx335_input_clock: imx335-input-clock {
Expand All @@ -20,38 +20,38 @@
};
};

&csi_22pins_interface {
&csi_interface {
status = "okay";
};

&csi_22pins_ep_in {
&csi_ep_in {
remote-endpoint-label = "imx335_ep_out";
bus-type = <VIDEO_BUS_TYPE_CSI2_DPHY>;
data-lanes = <1 2>;
};

&csi_22pins_i2c {
&csi_i2c {
imx335: camera@1a {
compatible = "sony,imx335";
clocks = <&imx335_input_clock>;
reg = <0x1a>;
reset-gpios = <&csi_22pins_connector CSI_22PINS_IO0 GPIO_ACTIVE_LOW>;
reset-gpios = <&csi_connector CSI_IO0 GPIO_ACTIVE_LOW>;

port {
imx335_ep_out: endpoint {
remote-endpoint-label = "csi_22pins_ep_in";
remote-endpoint-label = "csi_ep_in";
bus-type = <VIDEO_BUS_TYPE_CSI2_DPHY>;
data-lanes = <1 2>;
};
};
};
};

&csi_22pins_connector {
&csi_connector {
/* Power the camera module */
en-module-gpios {
gpio-hog;
gpios = <CSI_22PINS_IO1 GPIO_ACTIVE_HIGH>;
gpios = <CSI_IO1 GPIO_ACTIVE_HIGH>;
output-high;
};
};
18 changes: 9 additions & 9 deletions boards/st/stm32n6570_dk/stm32n6570_dk_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <st/n6/stm32n657x0hxq-pinctrl.dtsi>
#include "zephyr/dt-bindings/display/panel.h"
#include <zephyr/dt-bindings/flash_controller/xspi.h>
#include <zephyr/dt-bindings/gpio/raspberrypi-csi-22pins-connector.h>
#include <zephyr/dt-bindings/gpio/raspberrypi-csi-connector.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/video/video-interfaces.h>
#include "arduino_r3_connector.dtsi"
Expand Down Expand Up @@ -56,13 +56,13 @@
};
};

csi_22pins_connector: connector_csi_22pins {
compatible = "raspberrypi,csi-22pins-connector";
csi_connector: connector_csi {
compatible = "raspberrypi,csi-connector";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <CSI_22PINS_IO0 0 &gpioc 8 0>,
<CSI_22PINS_IO1 0 &gpiod 2 0>;
gpio-map = <CSI_IO0 0 &gpioc 8 0>,
<CSI_IO1 0 &gpiod 2 0>;
};
};

Expand Down Expand Up @@ -219,7 +219,7 @@
status = "okay";
};

csi_22pins_i2c: &i2c1 {
csi_i2c: &i2c1 {
clocks = <&rcc STM32_CLOCK(APB1, 21)>,
<&rcc STM32_SRC_CKPER I2C1_SEL(1)>;
pinctrl-0 = <&i2c1_scl_ph9 &i2c1_sda_pc1>;
Expand Down Expand Up @@ -436,14 +436,14 @@ zephyr_udc0: &usbotg_hs1 {
def-back-color-blue = <0xFF>;
};

csi_22pins_interface: &dcmipp {
csi_interface: &dcmipp {
ports {
port@0 {
csi_22pins_ep_in: endpoint { };
csi_ep_in: endpoint { };
};

port@1 {
csi_22pins_capture_port: endpoint@1 { };
csi_capture_port: endpoint@1 { };
};
};
};
33 changes: 0 additions & 33 deletions dts/bindings/gpio/raspberrypi,csi-22pins-connector.yaml

This file was deleted.

66 changes: 66 additions & 0 deletions dts/bindings/gpio/raspberrypi,csi-connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 2025 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0

title: GPIO pins exposed on the Raspberry Pi CSI Camera connector

description: |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a title:, please, otherwise this will look really odd/wrong in boards' documentation

I guess you want something like "GPIO pins exposed on the Raspberry Pi CSI Camera connector".

There are 2 variants of the Raspberry Pi CSI camera connector. Either 15-pin
or 22-pin. Here only GPIO provided by those connectors are abstracted since
others pins are directly connected to CSI PHY.
For reference, pinout of 15-pin and 22-pin connectors are references below.
In this gpio nexus, only GPIOs are represented and should be described in
the following way, allowing to have a single compatible for both 15-pin
and 22-pin connectors and also allowing to deal with 15-pin to 22-pin
conversion cables.

Nexus mapping:
1 IO0 pin 11 (15-pin based) / pin 17 (22-pin based)
2 IO1 pin 12 (15-pin based) / pin 18 (22-pin based)
3 I2C_SCL pin 13 (15-pin based) / pin 20 (22-pin based)
4 I2C_SDA pin 14 (15-pin based) / pin 21 (22-pin based)

For reference only, Raspberry 15-pin Connector layout:
1 GND
2 CSI_D0_N
3 CSI_D0_P
4 GND
5 CSI_D1_N
6 CSI_D1_P
7 GND
8 CSI_CK_N
9 CSI_CK_P
10 GND
11 IO0
12 IO1
13 I2C_SCL
14 I2C_SDA
15 VCC (3v3)

For reference only, Raspberry 22-pin Connector layout:

1 GND
2 CSI_D0_N
3 CSI_D0_P
4 GND
5 CSI_D1_N
6 CSI_D1_P
7 GND
8 CSI_CK_N
9 CSI_CK_P
10 GND
11 CSI_D2_N
12 CSI_D2_P
13 GND
14 CSI_D3_N
15 CSI_D3_P
16 GND
17 IO0
18 IO1
19 GND
20 I2C_SCL
21 I2C_SDA
22 VCC (3v3)

compatible: "raspberrypi,csi-connector"

include: [gpio-nexus.yaml, base.yaml]
18 changes: 0 additions & 18 deletions include/zephyr/dt-bindings/gpio/raspberrypi-csi-22pins-connector.h

This file was deleted.

18 changes: 18 additions & 0 deletions include/zephyr/dt-bindings/gpio/raspberrypi-csi-connector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2025 STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_CONNECTOR_H_
#define INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_CONNECTOR_H_

/**
* @name CSI camera connector GPIO list
* @{
*/
#define CSI_IO0 1 /**< GPIO0 */
#define CSI_IO1 2 /**< GPIO1 */
#define CSI_I2C_SCL 3 /**< I2C clock pin */
#define CSI_I2C_SDA 4 /**< I2C data pin */
/** @} */

#endif /* INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_CONNECTOR_H_ */