Brooklyn/arch/arm/boot/dts/overlays/camera-mux-4port-overlay.dts
2022-09-07 22:30:50 +05:00

685 lines
17 KiB
Plaintext

// SPDX-License-Identifier: GPL-2.0-only
// Overlay to configure a 4 port camera multiplexer
//
// Configuration is based on the Arducam 4 channel multiplexer
// which uses a PCA9543 I2C multiplexer to handle the
// I2C, and GPIOs 4, 17, and 18 to control the MIPI muxes.
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
/{
compatible = "brcm,bcm2835";
/* Fragments that complete the individual sensor fragments */
/* IMX290 */
fragment@0 {
target = <&imx290_0_ep>;
__overlay__ {
data-lanes = <1 2>;
link-frequencies =
/bits/ 64 <445500000 297000000>;
};
};
fragment@1 {
target = <&imx290_1_ep>;
__overlay__ {
data-lanes = <1 2>;
link-frequencies =
/bits/ 64 <445500000 297000000>;
};
};
fragment@2 {
target = <&imx290_2_ep>;
__overlay__ {
data-lanes = <1 2>;
link-frequencies =
/bits/ 64 <445500000 297000000>;
};
};
fragment@3 {
target = <&imx290_3_ep>;
__overlay__ {
data-lanes = <1 2>;
link-frequencies =
/bits/ 64 <445500000 297000000>;
};
};
/* IMX477 */
fragment@10 {
target = <&imx477_0>;
__overlay__ {
compatible = "sony,imx477";
};
};
fragment@11 {
target = <&imx477_1>;
__overlay__ {
compatible = "sony,imx477";
};
};
fragment@12 {
target = <&imx477_2>;
__overlay__ {
compatible = "sony,imx477";
};
};
fragment@13 {
target = <&imx477_3>;
__overlay__ {
compatible = "sony,imx477";
};
};
/* Additional fragments affecting the mux nodes */
fragment@100 {
target = <&mux_in0>;
__dormant__ {
data-lanes = <1>;
};
};
fragment@101 {
target = <&mux_in0>;
__overlay__ {
data-lanes = <1 2>;
};
};
fragment@102 {
target = <&mux_in1>;
__dormant__ {
data-lanes = <1>;
};
};
fragment@103 {
target = <&mux_in1>;
__overlay__ {
data-lanes = <1 2>;
};
};
fragment@104 {
target = <&mux_in2>;
__dormant__ {
data-lanes = <1>;
};
};
fragment@105 {
target = <&mux_in2>;
__overlay__ {
data-lanes = <1 2>;
};
};
fragment@106 {
target = <&mux_in3>;
__dormant__ {
data-lanes = <1>;
};
};
fragment@107 {
target = <&mux_in3>;
__overlay__ {
data-lanes = <1 2>;
};
};
/* Mux define */
fragment@200 {
target = <&i2c_csi_dsi>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pca@70 {
reg = <0x70>;
compatible = "nxp,pca9544";
#address-cells = <1>;
#size-cells = <0>;
i2c@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
#define cam_node imx219_0
#define cam_endpoint imx219_0_ep
#define cam1_clk clk_24mhz
#include "imx219.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx477_0
#define cam_endpoint imx477_0_ep
#define cam1_clk clk_24mhz
#include "imx477_378.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov5647_0
#define cam_endpoint ov5647_0_ep
#define cam1_clk clk_25mhz
#include "ov5647.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov7251_0
#define cam_endpoint ov7251_0_ep
#define cam1_clk clk_24mhz
#include "ov7251.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov9281_0
#define cam_endpoint ov9281_0_ep
#define cam1_clk clk_24mhz
#include "ov9281.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx258_0
#define cam_endpoint imx258_0_ep
#define cam1_clk clk_24mhz
#include "imx258.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx290_0
#define cam_endpoint imx290_0_ep
#define cam1_clk clk_imx290
#include "imx290_327.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov2311_0
#define cam_endpoint ov2311_0_ep
#define cam1_clk clk_24mhz
#include "ov2311.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
};
i2c@1 {
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;
#define cam_node imx219_1
#define cam_endpoint imx219_1_ep
#define cam1_clk clk_24mhz
#include "imx219.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx477_1
#define cam_endpoint imx477_1_ep
#define cam1_clk clk_24mhz
#include "imx477_378.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov5647_1
#define cam_endpoint ov5647_1_ep
#define cam1_clk clk_25mhz
#include "ov5647.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov7251_1
#define cam_endpoint ov7251_1_ep
#define cam1_clk clk_24mhz
#include "ov7251.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov9281_1
#define cam_endpoint ov9281_1_ep
#define cam1_clk clk_24mhz
#include "ov9281.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx258_1
#define cam_endpoint imx258_1_ep
#define cam1_clk clk_24mhz
#include "imx258.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx290_1
#define cam_endpoint imx290_1_ep
#define cam1_clk clk_imx290
#include "imx290_327.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov2311_1
#define cam_endpoint ov2311_1_ep
#define cam1_clk clk_24mhz
#include "ov2311.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
};
i2c@2 {
reg = <2>;
#address-cells = <1>;
#size-cells = <0>;
#define cam_node imx219_2
#define cam_endpoint imx219_2_ep
#define cam1_clk clk_24mhz
#include "imx219.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx477_2
#define cam_endpoint imx477_2_ep
#define cam1_clk clk_24mhz
#include "imx477_378.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov5647_2
#define cam_endpoint ov5647_2_ep
#define cam1_clk clk_25mhz
#include "ov5647.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov7251_2
#define cam_endpoint ov7251_2_ep
#define cam1_clk clk_24mhz
#include "ov7251.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov9281_2
#define cam_endpoint ov9281_2_ep
#define cam1_clk clk_24mhz
#include "ov9281.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx258_2
#define cam_endpoint imx258_2_ep
#define cam1_clk clk_24mhz
#include "imx258.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx290_2
#define cam_endpoint imx290_2_ep
#define cam1_clk clk_imx290
#include "imx290_327.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov2311_2
#define cam_endpoint ov2311_2_ep
#define cam1_clk clk_24mhz
#include "ov2311.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
};
i2c@3 {
reg = <3>;
#address-cells = <1>;
#size-cells = <0>;
#define cam_node imx219_3
#define cam_endpoint imx219_3_ep
#define cam1_clk clk_24mhz
#include "imx219.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx477_3
#define cam_endpoint imx477_3_ep
#define cam1_clk clk_24mhz
#include "imx477_378.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov5647_3
#define cam_endpoint ov5647_3_ep
#define cam1_clk clk_25mhz
#include "ov5647.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov7251_3
#define cam_endpoint ov7251_3_ep
#define cam1_clk clk_24mhz
#include "ov7251.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov9281_3
#define cam_endpoint ov9281_3_ep
#define cam1_clk clk_24mhz
#include "ov9281.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx258_3
#define cam_endpoint imx258_3_ep
#define cam1_clk clk_24mhz
#include "imx258.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node imx290_3
#define cam_endpoint imx290_3_ep
#define cam1_clk clk_imx290
#include "imx290_327.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
#define cam_node ov2311_3
#define cam_endpoint ov2311_3_ep
#define cam1_clk clk_24mhz
#include "ov2311.dtsi"
#undef cam_node
#undef cam_endpoint
#undef cam1_clk
};
};
};
};
fragment@201 {
target = <&csi1>;
__overlay__ {
status = "okay";
brcm,media-controller;
port {
csi1_ep: endpoint {
remote-endpoint = <&mux_out>;
clock-lanes = <0>;
data-lanes = <1 2>;
};
};
};
};
fragment@202 {
target = <&i2c0if>;
__overlay__ {
status = "okay";
};
};
fragment@203 {
target-path="/";
__overlay__ {
mux: mux-controller {
compatible = "gpio-mux";
#mux-control-cells = <0>;
/* SEL, En2, En1 */
mux-gpios = <&gpio 4 GPIO_ACTIVE_HIGH>,
<&gpio 18 GPIO_ACTIVE_HIGH>,
<&gpio 17 GPIO_ACTIVE_HIGH>;
};
video-mux {
compatible = "video-mux";
mux-controls = <&mux>;
#address-cells = <1>;
#size-cells = <0>;
/* GPIO mappings settings for selecting the different
* camera connectors are not direct, hence port@ values
* are not straight forward.
*/
port@2 {
/* Port A - GPIO 17 = 0, GPIO 18 = 1,GPIO 4 = 0 */
reg = <2>;
mux_in0: endpoint {
clock-lanes = <0>;
};
};
port@3 {
/* Port B - GPIO 17 = 0, GPIO 18 = 1,GPIO 4 = 1 */
reg = <3>;
mux_in1: endpoint {
clock-lanes = <0>;
};
};
port@4 {
/* Port C - GPIO 17 = 1, GPIO 18 = 0, GPIO 4 = 0 */
reg = <4>;
mux_in2: endpoint {
clock-lanes = <0>;
};
};
port@5 {
/* Port D - GPIO 17 = 1, GPIO 18 = 0, GPIO 4 = 1 */
reg = <5>;
mux_in3: endpoint {
clock-lanes = <0>;
};
};
port@6 {
/* Output port needs to be the highest port number */
reg = <6>;
mux_out: endpoint {
remote-endpoint = <&csi1_ep>;
clock-lanes = <0>;
};
};
};
clk_24mhz: clk_24mhz {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
status = "okay";
};
clk_25mhz: clk_25mhz {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <25000000>;
status = "okay";
};
clk_imx290: clk_imx290 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <37125000>;
status = "okay";
};
};
};
fragment@204 {
target = <&i2c0mux>;
__overlay__ {
status = "okay";
};
};
__overrides__ {
cam0-imx219 = <&mux_in0>, "remote-endpoint:0=",<&imx219_0_ep>,
<&imx219_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&mux_in0>, "clock-noncontinuous?",
<&imx219_0>, "status=okay";
cam0-imx477 = <&mux_in0>, "remote-endpoint:0=",<&imx477_0_ep>,
<&imx477_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&mux_in0>, "clock-noncontinuous?",
<&imx477_0>, "status=okay";
cam0-ov5647 = <&mux_in0>, "remote-endpoint:0=",<&ov5647_0_ep>,
<&ov5647_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&ov5647_0>, "status=okay";
cam0-ov7251 = <&mux_in0>, "remote-endpoint:0=",<&ov7251_0_ep>,
<&ov7251_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&ov7251_0>, "status=okay",
<0>,"+100-101";
cam0-ov9281 = <&mux_in0>, "remote-endpoint:0=",<&ov9281_0_ep>,
<&ov9281_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&ov9281_0>, "status=okay";
cam0-imx258 = <&mux_in0>, "remote-endpoint:0=",<&imx258_0_ep>,
<&imx258_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&imx258_0>, "status=okay";
cam0-imx290 = <&mux_in0>, "remote-endpoint:0=",<&imx290_0_ep>,
<&imx290_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&imx290_0>, "status=okay";
cam0-ov2311 = <&mux_in0>, "remote-endpoint:0=",<&ov2311_0_ep>,
<&ov2311_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&ov2311_0>, "status=okay";
cam1-imx219 = <&mux_in1>, "remote-endpoint:0=",<&imx219_1_ep>,
<&imx219_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&mux_in1>, "clock-noncontinuous?",
<&imx219_1>, "status=okay";
cam1-imx477 = <&mux_in1>, "remote-endpoint:0=",<&imx477_1_ep>,
<&imx477_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&mux_in1>, "clock-noncontinuous?",
<&imx477_1>, "status=okay";
cam1-ov5647 = <&mux_in1>, "remote-endpoint:0=",<&ov5647_1_ep>,
<&ov5647_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&ov5647_1>, "status=okay";
cam1-ov7251 = <&mux_in1>, "remote-endpoint:0=",<&ov7251_1_ep>,
<&ov7251_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&ov7251_1>, "status=okay",
<0>,"+102-103";
cam1-ov9281 = <&mux_in1>, "remote-endpoint:0=",<&ov9281_1_ep>,
<&ov9281_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&ov9281_1>, "status=okay";
cam1-imx258 = <&mux_in1>, "remote-endpoint:0=",<&imx258_1_ep>,
<&imx258_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&imx258_1>, "status=okay";
cam1-imx290 = <&mux_in1>, "remote-endpoint:0=",<&imx290_1_ep>,
<&imx290_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&imx290_1>, "status=okay";
cam1-ov2311 = <&mux_in1>, "remote-endpoint:0=",<&ov2311_1_ep>,
<&ov2311_1_ep>, "remote-endpoint:0=",<&mux_in1>,
<&ov2311_1>, "status=okay";
cam2-imx219 = <&mux_in2>, "remote-endpoint:0=",<&imx219_2_ep>,
<&imx219_2_ep>, "remote-endpoint:0=",<&mux_in2>,
<&mux_in2>, "clock-noncontinuous?",
<&imx219_2>, "status=okay";
cam2-imx477 = <&mux_in2>, "remote-endpoint:0=",<&imx477_2_ep>,
<&imx477_2_ep>, "remote-endpoint:0=",<&mux_in2>,
<&mux_in2>, "clock-noncontinuous?",
<&imx477_2>, "status=okay";
cam2-ov5647 = <&mux_in2>, "remote-endpoint:0=",<&ov5647_2_ep>,
<&ov5647_2_ep>, "remote-endpoint:0=",<&mux_in2>,
<&ov5647_2>, "status=okay";
cam2-ov7251 = <&mux_in2>, "remote-endpoint:0=",<&ov7251_2_ep>,
<&ov7251_2_ep>, "remote-endpoint:0=",<&mux_in2>,
<&ov7251_2>, "status=okay",
<0>,"+104-105";
cam2-ov9281 = <&mux_in2>, "remote-endpoint:0=",<&ov9281_2_ep>,
<&ov9281_2_ep>, "remote-endpoint:0=",<&mux_in2>,
<&ov9281_2>, "status=okay";
cam2-imx258 = <&mux_in2>, "remote-endpoint:0=",<&imx258_2_ep>,
<&imx258_2>, "status=okay",
<&imx258_2>, "remote-endpoint:0=",<&mux_in2>;
cam2-imx290 = <&mux_in2>, "remote-endpoint:0=",<&imx290_2_ep>,
<&imx290_2_ep>, "remote-endpoint:0=",<&mux_in2>,
<&imx290_2>, "status=okay";
cam2-ov2311 = <&mux_in2>, "remote-endpoint:0=",<&ov2311_2_ep>,
<&ov2311_2_ep>, "remote-endpoint:0=",<&mux_in2>,
<&ov2311_2>, "status=okay";
cam3-imx219 = <&mux_in3>, "remote-endpoint:0=",<&imx219_3_ep>,
<&imx219_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&mux_in3>, "clock-noncontinuous?",
<&imx219_3>, "status=okay";
cam3-imx477 = <&mux_in3>, "remote-endpoint:0=",<&imx477_3_ep>,
<&imx477_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&mux_in3>, "clock-noncontinuous?",
<&imx477_3>, "status=okay";
cam3-ov5647 = <&mux_in3>, "remote-endpoint:0=",<&ov5647_3_ep>,
<&ov5647_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&ov5647_3>, "status=okay";
cam3-ov7251 = <&mux_in3>, "remote-endpoint:0=",<&ov7251_3_ep>,
<&ov7251_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&ov7251_3>, "status=okay",
<0>,"+106-107";
cam3-ov9281 = <&mux_in3>, "remote-endpoint:0=",<&ov9281_3_ep>,
<&ov9281_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&ov9281_3>, "status=okay";
cam3-imx258 = <&mux_in3>, "remote-endpoint:0=",<&imx258_3_ep>,
<&imx258_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&imx258_3>, "status=okay";
cam3-imx290 = <&mux_in3>, "remote-endpoint:0=",<&imx290_3_ep>,
<&imx290_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&imx290_3>, "status=okay";
cam3-ov2311 = <&mux_in3>, "remote-endpoint:0=",<&ov2311_3_ep>,
<&ov2311_3_ep>, "remote-endpoint:0=",<&mux_in3>,
<&ov2311_3>, "status=okay";
cam0-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
<&imx290_0>,"clock-frequency:0";
cam1-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
<&imx290_1>,"clock-frequency:0";
cam2-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
<&imx290_2>,"clock-frequency:0";
cam3-imx290-clk-freq = <&clk_imx290>,"clock-frequency:0",
<&imx290_3>,"clock-frequency:0";
};
};