From 688913b920acb70cb17c70bf0ca3ae501a3483a9 Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Fri, 9 Sep 2022 16:38:54 +0200 Subject: [PATCH 283/389] arm64: dts: pinephone-pro: Add camera support - Both cameras - Flash LED - Lens controller Signed-off-by: Ondrej Jirman --- .../dts/rockchip/rk3399-pinephone-pro.dts | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts index 0e7cfd52b067..33561aebef48 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts @@ -334,6 +334,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 = ; + flash-max-timeout-us = <250000>; + }; + }; }; &cpu_l0 { @@ -654,12 +669,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 @@ -788,6 +897,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; @@ -848,6 +1001,23 @@ pwrbtn_pin: pwrbtn-pin { }; }; + 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 { @@ -867,6 +1037,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