build/patch/kernel/archive/sunxi-6.2/patches.megous/arm64-dts-pinephone-pro-Add-camera-support.patch

240 lines
5.3 KiB
Diff

From b8548fd305bcc9671cec78c3b556726d343021a4 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 9 Sep 2022 16:38:54 +0200
Subject: [PATCH 283/391] arm64: dts: pinephone-pro: Add camera support
- Both cameras
- Flash LED
- Lens controller
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
.../dts/rockchip/rk3399-pinephone-pro.dts | 177 ++++++++++++++++++
1 file changed, 177 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
index 4fea14b33..65a1bdc46 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
@@ -342,6 +342,21 @@ typec_extcon_bridge: typec-extcon {
mode-switch;
svid = /bits/ 16 <0xff01>;
};
+
+ sgm3140: led-controller {
+ compatible = "sgmicro,sgm3140";
+ vin-supply = <&vcc3v3_sys>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&flash_pins>;
+ enable-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
+ flash-gpios = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
+
+ sgm3140_flash: led {
+ function = LED_FUNCTION_FLASH;
+ color = <LED_COLOR_ID_WHITE>;
+ flash-max-timeout-us = <250000>;
+ };
+ };
};
&cpu_alert0 {
@@ -669,12 +684,106 @@ opp07 {
};
};
+/*
+ * Cameras:
+ *
+ * cif clk out = gpio2 B3 / CIF_CLKOUTA_u
+ *
+ * both on i2c1 GPIO4_A1 (SDA) / GPIO4_A2 (SCL)
+ *
+ * both share power:
+ * VCC1V8_DVP - LDO7 - supplied by VCC7 (VCC3V3_SYS)
+ * DVDD_DVP 1.5V - autoenabled by VCC2V8_DVP depends on VCC1V8_S3 (U118 supplies 1.2V, though, not 1.5V)
+ * VCC2V8_DVP af - autoenabled by VCC1V8_DVP depends on VCC3V3_SYS
+ * AVDD2V8_DVP - autoenabled by VCC1V8_DVP depends on VCC3V3_SYS
+ *
+ * isp1 = imx258
+ * reset = GPIO1_A0
+ * powerdown = GPIO2_B4
+ *
+ * isp0 = OV8858
+ * powerdown = GPIO2_D4
+ * reset = GPIO1_A4
+ */
&i2c1 {
status = "okay";
clock-frequency = <400000>;
i2c-scl-rising-time-ns = <300>;
i2c-scl-falling-time-ns = <15>;
+
+ pinctrl-0 = <&i2c1_xfer &cif_clkouta>;
+
+ assigned-clocks = <&cru SCLK_CIF_OUT &cru SCLK_CIF_OUT_SRC>;
+ assigned-clock-parents = <&cru SCLK_CIF_OUT_SRC &cru PLL_GPLL>;
+ assigned-clock-rates = <19200000 0>;
+
+ wcam: camera@1a {
+ compatible = "sony,imx258";
+ reg = <0x1a>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&wcam_rst &wcam_pdn>;
+
+ clocks = <&cru SCLK_CIF_OUT>;
+ clock-names = "xvclk";
+
+ vif-supply = <&vcc1v8_dvp>;
+ i2c-supply = <&vcca1v8_codec>;
+ /*XXX: also depends on vcca1v8_codec for I2C bus power (currently always on) */
+
+ reset-gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_LOW>;
+ powerdown-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
+
+ rotation = <180>;
+
+ lens-focus = <&wcam_lens>;
+ flash-leds = <&sgm3140_flash>;
+
+ port {
+ wcam_out: endpoint {
+ remote-endpoint = <&mipi_in_wcam>;
+ data-lanes = <1 2 3 4>;
+ };
+ };
+ };
+
+ wcam_lens: camera-lens@c {
+ compatible = "dongwoon,dw9714";
+ reg = <0x0c>;
+ vcc-supply = <&vcc1v8_dvp>;
+ };
+
+ ucam: camera@36 {
+ compatible = "ovti,ov8858";
+ reg = <0x36>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&ucam_pdn &ucam_rst>;
+
+ clocks = <&cru SCLK_CIF_OUT>;
+ clock-names = "xvclk";
+
+ dovdd-supply = <&vcc1v8_dvp>;
+ /*XXX: also depends on vcca1v8_codec for I2C bus power */
+
+ reset-gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_LOW>;
+ powerdown-gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>;
+
+ /* we're using forward ported BSP driver, thus: */
+ rockchip,camera-module-index = <0x00>;
+ rockchip,camera-module-facing = "front";
+ rockchip,camera-module-name = "CameraKing";
+ rockchip,camera-module-lens-name = "Largan-9569A2";
+
+ rotation = <180>;
+
+ port {
+ ucam_out: endpoint {
+ remote-endpoint = <&mipi_in_ucam>;
+ data-lanes = <1 2 3 4>;
+ };
+ };
+ };
+
// XXX: modem codec supplies:
// - vcc1v8_codec
// - vcca3v0_codec
@@ -803,6 +912,50 @@ &io_domains {
status = "okay";
};
+&isp1 {
+ status = "okay";
+
+ ports {
+ port@0 {
+ mipi_in_wcam: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&wcam_out>;
+ data-lanes = <1 2 3 4>;
+ };
+ };
+ };
+};
+
+&mipi_dphy_rx0 {
+ status = "okay";
+};
+
+&isp0 {
+ status = "okay";
+
+ ports {
+ port@0 {
+ mipi_in_ucam: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&ucam_out>;
+ data-lanes = <1 2 3 4>;
+ };
+ };
+ };
+};
+
+&isp0_mmu {
+ status = "okay";
+};
+
+&isp1_mmu {
+ status = "okay";
+};
+
+&mipi_dsi1 {
+ status = "okay";
+};
+
&mipi_dsi {
status = "okay";
clock-master;
@@ -863,6 +1016,24 @@ display_pwren1: display-pwren1 {
};
};
+ camera {
+ wcam_rst: wcam-rst {
+ rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ wcam_pdn: wcam-pdn {
+ rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ ucam_rst: ucam-rst {
+ rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ ucam_pdn: ucam-pdn {
+ rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
+
fusb302x {
fusb0_int: fusb0-int {
rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
@@ -881,6 +1052,12 @@ green_led_pin: green-led-pin {
blue_led_pin: blue-led-pin {
rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
};
+
+ flash_pins: flash-pins {
+ rockchip,pins =
+ <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>,
+ <4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
};
pmic {
--
2.35.3