Skip to contentSkip to conversation

support camera found on Gaokun3

PATCH In review Pengyu Luo 3 participants 16 messages Apr 25 – Jun 19

Subsystems (6)
lore
Share & tools
lore

Pengyu Luo

author
#0 lore raw

cover support camera found on Gaokun3

This series adds support for front camera on Gaokun3(3.0GHz version). The front sensor is Hi846, this series also fixes a error blocking Hi846 driver function, and supports more mode on Hi846.

---
Pengyu Luo (4):
media: hi846: fix hi846_write_reg_16 handling
media: hi846: Add 6MP and 8MP mode support
arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node
arm64: dts: qcom: sc8280xp: gaokun3: describe rear camera module
information as musch as possible

 .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 255 +++++++++++++++++-
 drivers/media/i2c/hi846.c                     | 161 ++++++++++-
 2 files changed, 410 insertions(+), 6 deletions(-)
Signature · 1 line
2.54.0
author
#1 lore raw

PATCH 1/4 media: hi846: fix hi846_write_reg_16 handling

hi846_write_reg_16() does not clear a positive *err value on success. pm_runtime_get_if_in_use() returns a positive value when the device is already in use. When hi846_set_ctrl() passes &ret holding this positive value) to hi846_write_reg_16(), the function returns with ret as is, the positive value propagates back as a return code, which callers interpret as an error.

Fix this by resetting *err to 0 only when it is positive.

Fixes 04fc06f6dc15 ("media: hi846: fix usage of pm_runtime_get_if_in_use()")
---
 drivers/media/i2c/hi846.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/i2c/hi846.c +2 -0
index a3f77b8434ca..09c109f3fba9 100644
@@ -1270,6 +1270,8 @@ static void hi846_write_reg_16(struct hi846 *hi846, u16 reg, u16 val, int *err)
 
 	if (*err < 0)
 		return;
+	else
+		*err = 0;
 
 	put_unaligned_be16(reg, buf);
 	put_unaligned_be16(val, buf + 2);
Signature · 1 line
2.54.0
author
#2 lore raw

PATCH 2/4 media: hi846: Add 6MP and 8MP mode support

In reply to Pengyu Luo

Hi846 is an 8MP sensor, but the upstream driver has only supported 2MP mode for years. This patch adds 6MP and 8MP modes to maximize sensor utilization.

Note that these modes require 4-lane MIPI CSI-2, as the downstream driver only exposes 2MP, 6MP, and 8MP configurations in 4-lane operation on the target device. The register sequences are extracted from the downstream Windows driver.

---
 drivers/media/i2c/hi846.c | 159 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 158 insertions(+), 1 deletion(-)
drivers/media/i2c/hi846.c +158 -1
index 09c109f3fba9..d6739a7c2324 100644
@@ -1027,6 +1027,111 @@ static const struct hi846_reg mode_1632x1224_mipi_4lane[] = {
 	{HI846_REG_TG_ENABLE,			0x0100},
 };
 
+static const struct hi846_reg mode_3264x1836_config[] = {
+	{HI846_REG_MODE_SELECT,			0x0000},
+	{HI846_REG_Y_ODD_INC_FOBP,		0x1111},
+	{HI846_REG_Y_ODD_INC_VACT,		0x1111},
+	{HI846_REG_Y_ADDR_START_VACT_H,		0x0172},
+	{HI846_REG_Y_ADDR_END_VACT_H,		0x089d},
+	{HI846_REG_UNKNOWN_005C,		0x2101},
+	{HI846_REG_FLL,				0x09de},
+	{HI846_REG_LLP,				0x0ed8},
+	{HI846_REG_BINNING_MODE,		0x0022},
+	{HI846_REG_HBIN_MODE,			0x0000},
+	{HI846_REG_UNKNOWN_0A24,		0x0000},
+	{HI846_REG_X_START_H,			0x0000},
+	{HI846_REG_X_OUTPUT_SIZE_H,		0x0cc0},
+	{HI846_REG_Y_OUTPUT_SIZE_H,		0x072c},
+	{HI846_REG_EXPOSURE,			0x09d8},
+
+	/* For OTP */
+	{HI846_REG_UNKNOWN_021C,		0x0001},
+	{HI846_REG_UNKNOWN_021E,		0x0235},
+
+	{HI846_REG_ISP_EN_H,			0x014a},
+	{HI846_REG_UNKNOWN_0418,		0x023e},
+	{HI846_REG_UNKNOWN_0B02,		0xe04d},
+	{HI846_REG_UNKNOWN_0B10,		0x6821},
+	{HI846_REG_UNKNOWN_0B12,		0x0120},
+	{HI846_REG_UNKNOWN_0B14,		0x0001},
+	{HI846_REG_UNKNOWN_2008,		0x38fd},
+	{HI846_REG_UNKNOWN_326E,		0x0000},
+
+// ?
+	// {0x0710, 0x074c},
+	// {0x0f32, 0x025a},
+	// {0x0f38, 0x025a},
+};
+
+static const struct hi846_reg mode_3264x1836_mipi_4lane[] = {
+	{HI846_REG_UNKNOWN_0900,		0x0300},
+	{HI846_REG_MIPI_TX_OP_MODE,		0xc319},
+	{HI846_REG_UNKNOWN_0914,		0xc109},
+	{HI846_REG_TCLK_PREPARE,		0x061a},
+	{HI846_REG_UNKNOWN_0918,		0x0407},
+	{HI846_REG_THS_ZERO,			0x0a0b},
+	{HI846_REG_TCLK_POST,			0x0e08},
+	{HI846_REG_UNKNOWN_091E,		0x0a00},
+	{HI846_REG_UNKNOWN_090C,		0x0427},
+	{HI846_REG_UNKNOWN_090E,		0x0059},
+	{HI846_REG_UNKNOWN_0954,		0x0089},
+	{HI846_REG_UNKNOWN_0956,		0x0000},
+	{HI846_REG_UNKNOWN_0958,		0xca80},
+	{HI846_REG_UNKNOWN_095A,		0x9240},
+	{HI846_REG_PLL_CFG_MIPI2_H,		0x4124},
+	{HI846_REG_TG_ENABLE,			0x0100},
+};
+
+static const struct hi846_reg mode_3264x2448_config[] = {
+	{HI846_REG_MODE_SELECT,			0x0000},
+	{HI846_REG_Y_ODD_INC_FOBP,		0x1111},
+	{HI846_REG_Y_ODD_INC_VACT,		0x1111},
+	{HI846_REG_Y_ADDR_START_VACT_H,		0x0040},
+	{HI846_REG_Y_ADDR_END_VACT_H,		0x09cf},
+	{HI846_REG_UNKNOWN_005C,		0x2101},
+	{HI846_REG_FLL,				0x09de},
+	{HI846_REG_LLP,				0x0ed8},
+	{HI846_REG_BINNING_MODE,		0x0022},
+	{HI846_REG_HBIN_MODE,			0x0000},
+	{HI846_REG_UNKNOWN_0A24,		0x0000},
+	{HI846_REG_X_START_H,			0x0000},
+	{HI846_REG_X_OUTPUT_SIZE_H,		0x0cc0},
+	{HI846_REG_Y_OUTPUT_SIZE_H,		0x0990},
+	{HI846_REG_EXPOSURE,			0x09d8},
+
+	/* For OTP */
+	{HI846_REG_UNKNOWN_021C,		0x0001},
+	{HI846_REG_UNKNOWN_021E,		0x0235},
+
+	{HI846_REG_ISP_EN_H,			0x014a},
+	{HI846_REG_UNKNOWN_0418,		0x0000},
+	{HI846_REG_UNKNOWN_0B02,		0xe04d},
+	{HI846_REG_UNKNOWN_0B10,		0x6821},
+	{HI846_REG_UNKNOWN_0B12,		0x0120},
+	{HI846_REG_UNKNOWN_0B14,		0x0001},
+	{HI846_REG_UNKNOWN_2008,		0x38fd},
+	{HI846_REG_UNKNOWN_326E,		0x0000},
+};
+
+static const struct hi846_reg mode_3264x2448_mipi_4lane[] = {
+	{HI846_REG_UNKNOWN_0900,		0x0300},
+	{HI846_REG_MIPI_TX_OP_MODE,		0xc319},
+	{HI846_REG_UNKNOWN_0914,		0xc109},
+	{HI846_REG_TCLK_PREPARE,		0x061a},
+	{HI846_REG_UNKNOWN_0918,		0x0407},
+	{HI846_REG_THS_ZERO,			0x0a0b},
+	{HI846_REG_TCLK_POST,			0x0e08},
+	{HI846_REG_UNKNOWN_091E,		0x0a00},
+	{HI846_REG_UNKNOWN_090C,		0x0427},
+	{HI846_REG_UNKNOWN_090E,		0x0059},
+	{HI846_REG_UNKNOWN_0954,		0x0089},
+	{HI846_REG_UNKNOWN_0956,		0x0000},
+	{HI846_REG_UNKNOWN_0958,		0xca80},
+	{HI846_REG_UNKNOWN_095A,		0x9240},
+	{HI846_REG_PLL_CFG_MIPI2_H,		0x4124},
+	{HI846_REG_TG_ENABLE,			0x0100},
+};
+
 static const char * const hi846_test_pattern_menu[] = {
 	"Disabled",
 	"Solid Colour",
@@ -1042,9 +1147,11 @@ static const char * const hi846_test_pattern_menu[] = {
 
 #define FREQ_INDEX_640	0
 #define FREQ_INDEX_1280	1
+#define FREQ_INDEX_3264	2
 static const s64 hi846_link_freqs[] = {
 	[FREQ_INDEX_640] = 80000000,
 	[FREQ_INDEX_1280] = 200000000,
+	[FREQ_INDEX_3264] = 288000000,
 };
 
 static const struct hi846_reg_list hi846_init_regs_list_2lane = {
@@ -1134,7 +1241,57 @@ static const struct hi846_mode supported_modes[] = {
 			.width = 1632 * 2,
 			.height = 1224 * 2,
 		},
-	}
+	},
+	{
+		.width = 3264,
+		.height = 1836,
+		.link_freq_index = FREQ_INDEX_3264,
+		.fps = 30,
+		.frame_len = 2526,
+		.llp = HI846_LINE_LENGTH,
+		.reg_list_config = {
+			.num_of_regs = ARRAY_SIZE(mode_3264x1836_config),
+			.regs = mode_3264x1836_config,
+		},
+		.reg_list_2lane = {
+			.num_of_regs = 0,
+		},
+		.reg_list_4lane = {
+			.num_of_regs = ARRAY_SIZE(mode_3264x1836_mipi_4lane),
+			.regs = mode_3264x1836_mipi_4lane,
+		},
+		.crop = {
+			.left = 0x46,
+			.top = 0x172,
+			.width = 3264,
+			.height = 1836,
+		},
+	},
+	{
+		.width = 3264,
+		.height = 2448,
+		.link_freq_index = FREQ_INDEX_3264,
+		.fps = 30,
+		.frame_len = 2526,
+		.llp = HI846_LINE_LENGTH,
+		.reg_list_config = {
+			.num_of_regs = ARRAY_SIZE(mode_3264x2448_config),
+			.regs = mode_3264x2448_config,
+		},
+		.reg_list_2lane = {
+			.num_of_regs = 0,
+		},
+		.reg_list_4lane = {
+			.num_of_regs = ARRAY_SIZE(mode_3264x2448_mipi_4lane),
+			.regs = mode_3264x2448_mipi_4lane,
+		},
+		.crop = {
+			.left = 0x46,
+			.top = 0x40,
+			.width = 3264,
+			.height = 2448,
+		},
+	},
 };
 
 struct hi846_datafmt {
Signature · 1 line
2.54.0
author
#3 lore raw

PATCH 3/4 arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

In reply to Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

Note that it seems that only Goakun3(3.0GHz) version is equipped with Hi846. Goakun3(2.69GHz) version is equipped with S5K4H7.

---
 .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 128 ++++++++++++++++++
 1 file changed, 128 insertions(+)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +128 -0
index 9819454abe13..39e559e91289 100644
@@ -15,6 +15,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/gpio-keys.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include <dt-bindings/phy/phy.h>
 
@@ -27,6 +28,7 @@ / {
 	compatible = "huawei,gaokun3", "qcom,sc8280xp";
 
 	aliases {
+		i2c2 = &cci2_i2c1;
 		i2c4 = &i2c4;
 		i2c15 = &i2c15;
 		serial1 = &uart2;
@@ -47,6 +49,21 @@ framebuffer0: framebuffer@c6200000 {
 		};
 	};
 
+	leds {
+		compatible = "gpio-leds";
+
+		pinctrl-0 = <&cam_indicator_en>;
+		pinctrl-names = "default";
+
+		privacy_led: privacy-led {
+			function = LED_FUNCTION_INDICATOR;
+			color = <LED_COLOR_ID_WHITE>;
+			gpios = <&tlmm 34 GPIO_ACTIVE_HIGH>;
+			default-state = "off";
+			panic-indicator;
+		};
+	};
+
 	wcd938x: audio-codec {
 		compatible = "qcom,wcd9380-codec";
 
@@ -98,6 +115,20 @@ switch-mode {
 		};
 	};
 
+	vreg_camf_1p2: regulator-camf-1p2 {
+		compatible = "regulator-fixed";
+
+		regulator-name = "vreg_camf_1p2";
+		regulator-min-microvolt = <1200000>;
+		regulator-max-microvolt = <1200000>;
+
+		gpio = <&tlmm 44 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+
+		pinctrl-0 = <&camf_1p2_reg_en>;
+		pinctrl-names = "default";
+	};
+
 	vreg_misc_3p3: regulator-misc-3p3 {
 		compatible = "regulator-fixed";
 
@@ -462,6 +493,13 @@ vreg_l8c: ldo8 {
 						   RPMH_REGULATOR_MODE_HPM>;
 		};
 
+		vreg_l11c: ldo11 {
+			regulator-name = "vreg_l11c";
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
 		vreg_l12c: ldo12 {
 			regulator-name = "vreg_l12c";
 			regulator-min-microvolt = <1800000>;
@@ -577,6 +615,66 @@ vreg_l10d: ldo10 {
 	};
 };
 
+&camss {
+	vdda-phy-supply = <&vreg_l6b>;
+	vdda-pll-supply = <&vreg_l3b>;
+
+	status = "okay";
+
+	ports {
+		port@3 {
+			csiphy3_ep: endpoint@0 {
+				reg = <0>;
+
+				clock-lanes = <7>;
+				data-lanes = <0 1 2 3>;
+				remote-endpoint = <&hi846_ep>;
+			};
+		};
+	};
+};
+
+&cci2 {
+	status = "okay";
+};
+
+&cci2_i2c1 {
+	/* On Goakun3(2.69GHz), S5K4H7@2d, image quality is better than hi846 */
+	camera_front: camera@20 {
+		compatible = "hynix,hi846";
+		reg = <0x20>;
+
+		pinctrl-0 = <&camf_rgb_default>;
+		pinctrl-names = "default";
+
+		clocks = <&camcc CAMCC_MCLK3_CLK>;
+
+		assigned-clocks = <&camcc CAMCC_MCLK3_CLK>;
+		assigned-clock-rates = <24000000>;
+
+		reset-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>;
+		vddio-supply = <&vreg_l2c>;
+		vdda-supply = <&vreg_l11c>;
+		vddd-supply = <&vreg_camf_1p2>;
+
+		leds = <&privacy_led>;
+		led-names = "privacy";
+
+		orientation = <0>;	/* Front facing */
+		rotation = <0>;
+
+		port {
+			hi846_ep: endpoint {
+				data-lanes = <1 2 3 4>;
+				link-frequencies = /bits/ 64 <80000000 144000000 200000000 288000000>;
+				remote-endpoint = <&csiphy3_ep>;
+			};
+		};
+	};
+
+	/* actuator???@58, Goakun3(2.69GHz) only, eeprom@50 */
+};
+
 &dispcc0 {
 	status = "okay";
 };
@@ -1318,6 +1416,36 @@ hstp-sw-ctrl-pins {
 		};
 	};
 
+	cam_indicator_en: cam-indicator-en-state {
+		pins = "gpio34";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	camf_1p2_reg_en: camf-1p2-reg-en-state {
+		pins = "gpio44";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	camf_rgb_default: camf-rgb-default-state {
+		mclk-pins {
+			pins = "gpio17";
+			function = "cam_mclk";
+			drive-strength = <6>;
+			bias-disable;
+		};
+
+		sc-rgb-xshut-n-pins {
+			pins = "gpio15";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-disable;
+		};
+	};
+
 	i2c4_default: i2c4-default-state {
 		pins = "gpio171", "gpio172";
 		function = "qup4";
Signature · 1 line
2.54.0
#4 lore raw

Re: [PATCH 3/4] arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

Quoted 4 lines · Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

Note that it seems that only Goakun3(3.0GHz) version is equipped with Hi846. Goakun3(2.69GHz) version is equipped with S5K4H7.

Are there any other noticeable hw differences between the two variants, that could warrant the DT to be split?

[...]

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 663

Quoted 1 line
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +1 -0
+		orientation = <0>;	/* Front facing */

Please either drop the comment or s/tab/space

Konrad

author
#5 lore raw

Re: [PATCH 3/4] arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

Quoted 10 lines · Konrad Dybcio
Quoted 4 lines · Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

Note that it seems that only Goakun3(3.0GHz) version is equipped with Hi846. Goakun3(2.69GHz) version is equipped with S5K4H7.

Are there any other noticeable hw differences between the two variants, that could warrant the DT to be split?

Except for the cameras and cpu, I think no.(But I couldn't tell all 3.0 variants are equipped with hi846) Before camera support, this DT worked for both of them.

Quoted 6 lines

[...]

Quoted 1 line

+ orientation = <0>; /* Front facing */

Please either drop the comment or s/tab/space

I see.

Best wishes,
Pengyu

Quoted 1 line

Konrad

#6 lore raw

Re: [PATCH 3/4] arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

Quoted 9 lines · Pengyu Luo
Quoted 7 lines · Konrad Dybcio
Quoted 4 lines · Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

Note that it seems that only Goakun3(3.0GHz) version is equipped with Hi846. Goakun3(2.69GHz) version is equipped with S5K4H7.

Quoted 7 lines
Quoted 3 lines

Are there any other noticeable hw differences between the two variants, that could warrant the DT to be split?

Except for the cameras and cpu, I think no.(But I couldn't tell all 3.0 variants are equipped with hi846) Before camera support, this DT worked for both of them.

Do the ACPI tables perhaps have some sort of a hwid mechanism? Perhaps two nodes defined for both cameras and the _STA method referencing some object?

Konrad

author
#7 lore raw

Re: [PATCH 3/4] arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

Quoted 15 lines · Konrad Dybcio
Quoted 13 lines · Pengyu Luo
Quoted 10 lines · Konrad Dybcio
Quoted 4 lines · Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

Note that it seems that only Goakun3(3.0GHz) version is equipped with Hi846. Goakun3(2.69GHz) version is equipped with S5K4H7.

Are there any other noticeable hw differences between the two variants, that could warrant the DT to be split?

Quoted 8 lines
Quoted 3 lines

Except for the cameras and cpu, I think no.(But I couldn't tell all 3.0 variants are equipped with hi846) Before camera support, this DT worked for both of them.

Do the ACPI tables perhaps have some sort of a hwid mechanism? Perhaps two nodes defined for both cameras and the _STA method referencing some object?

No. It may poll sensormodule binarys, register lists are in sensormodule, the slave addr may be here too.

In qccamfrontsensor_extension8280.cab

CAMF_RES_MTP_ALT.bin
CAMF_RES_MTP.bin
CAMF_RES_QRD.bin
com.qti.sensormodule.hlt_hi846.bin
com.qti.sensormodule.xinli_s5k4h7.bin
com.qti.tuned.default.bin # for hi846
com.qti.tuned.hlt_hi846.bin
com.qti.tuned.xinli_s5k4h7.bin
qccamfrontsensor_extension8280.cat
qccamfrontsensor_extension8280.inf
SCF1_FRONT_MTP.bin
SCFG_FRONT_MTP.bin
SCFG_FRONT_QRD.bin

in SCFG_FRONT_QRD.bin

Package ()

{
    "com.qti.sensormodule.hlt_hi846.bin",
    "com.qti.tuned.hlt_hi846.bin",
    0x0000000000150041,
    0x0000000046080F16, # id, id_addr, this can be found in the binary too
    0x0000000000000000,
},

If this fails, then try to load com.qti.sensormodule.xinli_s5k4h7.bin?

Best wishes,
Pengyu

Quoted 1 line

Konrad

#8 lore raw

Re: [PATCH 3/4] arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

In reply to Pengyu Luo
Quoted 1 line · Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

To the best of my knowledege there is no 'descripting' word.

Say it simpler like

Describe Hi846 camera sensor found on Gaokun3.

Quoted 22 lines

Note that it seems that only Goakun3(3.0GHz) version is equipped with Hi846. Goakun3(2.69GHz) version is equipped with S5K4H7.

---
  .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 128 ++++++++++++++++++
  1 file changed, 128 insertions(+)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +1 -0
index 9819454abe13..39e559e91289 100644
@@ -15,6 +15,7 @@
  #include <dt-bindings/gpio/gpio.h>
  #include <dt-bindings/input/gpio-keys.h>
  #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
  #include <dt-bindings/phy/phy.h>
 

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts / { · line 31

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +1 -0
@@ -27,6 +28,7 @@ / {
  	compatible = "huawei,gaokun3", "qcom,sc8280xp";
 
  	aliases {
+		i2c2 = &cci2_i2c1;

I don't think that it makes big sense to add this I2C alias, please consider to remove it.

Quoted 66 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +38 -0
  		i2c4 = &i2c4;
  		i2c15 = &i2c15;
  		serial1 = &uart2;
@@ -47,6 +49,21 @@ framebuffer0: framebuffer@c6200000 {
  		};
  	};
 
+	leds {
+		compatible = "gpio-leds";
+
+		pinctrl-0 = <&cam_indicator_en>;
+		pinctrl-names = "default";
+
+		privacy_led: privacy-led {
+			function = LED_FUNCTION_INDICATOR;
+			color = <LED_COLOR_ID_WHITE>;
+			gpios = <&tlmm 34 GPIO_ACTIVE_HIGH>;
+			default-state = "off";
+			panic-indicator;
+		};
+	};
+
  	wcd938x: audio-codec {
  		compatible = "qcom,wcd9380-codec";
 
@@ -98,6 +115,20 @@ switch-mode {
  		};
  	};
 
+	vreg_camf_1p2: regulator-camf-1p2 {
+		compatible = "regulator-fixed";
+
+		regulator-name = "vreg_camf_1p2";
+		regulator-min-microvolt = <1200000>;
+		regulator-max-microvolt = <1200000>;
+
+		gpio = <&tlmm 44 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+
+		pinctrl-0 = <&camf_1p2_reg_en>;
+		pinctrl-names = "default";
+	};
+
  	vreg_misc_3p3: regulator-misc-3p3 {
  		compatible = "regulator-fixed";
 
@@ -462,6 +493,13 @@ vreg_l8c: ldo8 {
  						   RPMH_REGULATOR_MODE_HPM>;
  		};
 
+		vreg_l11c: ldo11 {
+			regulator-name = "vreg_l11c";
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
  		vreg_l12c: ldo12 {
  			regulator-name = "vreg_l12c";
  			regulator-min-microvolt = <1800000>;
@@ -577,6 +615,66 @@ vreg_l10d: ldo10 {
  	};
  };
 
+&camss {
+	vdda-phy-supply = <&vreg_l6b>;

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 629

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +10 -0
+	vdda-pll-supply = <&vreg_l3b>;
+
+	status = "okay";
+
+	ports {
+		port@3 {
+			csiphy3_ep: endpoint@0 {
+				reg = <0>;
+
+				clock-lanes = <7>;

Please remove 'clock-lanes' property from above.

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +4 -0
+				data-lanes = <0 1 2 3>;
+				remote-endpoint = <&hi846_ep>;
+			};
+		};

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 643

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +10 -0
+	};
+};
+
+&cci2 {
+	status = "okay";
+};
+
+&cci2_i2c1 {
+	/* On Goakun3(2.69GHz), S5K4H7@2d, image quality is better than hi846 */
+	camera_front: camera@20 {

'camera_front' label is unused and should be removed.

Quoted 11 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +11 -0
+		compatible = "hynix,hi846";
+		reg = <0x20>;
+
+		pinctrl-0 = <&camf_rgb_default>;
+		pinctrl-names = "default";
+
+		clocks = <&camcc CAMCC_MCLK3_CLK>;
+
+		assigned-clocks = <&camcc CAMCC_MCLK3_CLK>;
+		assigned-clock-rates = <24000000>;
+

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 664

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +10 -0
+		reset-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>;
+		vddio-supply = <&vreg_l2c>;
+		vdda-supply = <&vreg_l11c>;
+		vddd-supply = <&vreg_camf_1p2>;
+
+		leds = <&privacy_led>;
+		led-names = "privacy";
+
+		orientation = <0>;	/* Front facing */
+		rotation = <0>;

Both properties above can be removed as the default ones.

Quoted 31 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +24 -0
+
+		port {
+			hi846_ep: endpoint {
+				data-lanes = <1 2 3 4>;
+				link-frequencies = /bits/ 64 <80000000 144000000 200000000 288000000>;
+				remote-endpoint = <&csiphy3_ep>;
+			};
+		};
+	};
+
+	/* actuator???@58, Goakun3(2.69GHz) only, eeprom@50 */
+};
+
  &dispcc0 {
  	status = "okay";
  };
@@ -1318,6 +1416,36 @@ hstp-sw-ctrl-pins {
  		};
  	};
 
+	cam_indicator_en: cam-indicator-en-state {
+		pins = "gpio34";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	camf_1p2_reg_en: camf-1p2-reg-en-state {
+		pins = "gpio44";
+		function = "gpio";
+		drive-strength = <2>;

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts hstp-sw-ctrl-pins { · line 1439

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +10 -0
+		bias-disable;
+	};
+
+	camf_rgb_default: camf-rgb-default-state {
+		mclk-pins {
+			pins = "gpio17";
+			function = "cam_mclk";
+			drive-strength = <6>;
+			bias-disable;
+		};

cam_mclk pad function descriptions on all 8 pads supporting this function shall be added to the platform in a separate commit to sc8280xp.dtsi

Quoted 12 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +9 -0
+
+		sc-rgb-xshut-n-pins {
+			pins = "gpio15";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-disable;
+		};
+	};
+
  	i2c4_default: i2c4-default-state {
  		pins = "gpio171", "gpio172";
  		function = "qup4";
Signature · 2 lines
Best wishes,
Vladimir
author
#9 lore raw

Re: [PATCH 3/4] arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

Quoted 10 lines · Vladimir Zapolskiy
Quoted 1 line · Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

To the best of my knowledege there is no 'descripting' word.

Say it simpler like

Describe Hi846 camera sensor found on Gaokun3.

Ack

Quoted 21 lines
Quoted 21 lines

Note that it seems that only Goakun3(3.0GHz) version is equipped with Hi846. Goakun3(2.69GHz) version is equipped with S5K4H7.

---
  .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 128 ++++++++++++++++++
  1 file changed, 128 insertions(+)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +1 -0
index 9819454abe13..39e559e91289 100644
@@ -15,6 +15,7 @@
  #include <dt-bindings/gpio/gpio.h>
  #include <dt-bindings/input/gpio-keys.h>
  #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
  #include <dt-bindings/phy/phy.h>
 
Quoted 9 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts / { · line 31

Quoted 5 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +1 -0
@@ -27,6 +28,7 @@ / {
      compatible = "huawei,gaokun3", "qcom,sc8280xp";
 
      aliases {
+             i2c2 = &cci2_i2c1;

I don't think that it makes big sense to add this I2C alias, please consider to remove it.

Ack

Quoted 64 lines
Quoted 64 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +36 -0
              i2c4 = &i2c4;
              i2c15 = &i2c15;
              serial1 = &uart2;
@@ -47,6 +49,21 @@ framebuffer0: framebuffer@c6200000 {
              };
      };
 
+     leds {
+             compatible = "gpio-leds";
+
+             pinctrl-0 = <&cam_indicator_en>;
+             pinctrl-names = "default";
+
+             privacy_led: privacy-led {
+                     function = LED_FUNCTION_INDICATOR;
+                     color = <LED_COLOR_ID_WHITE>;
+                     gpios = <&tlmm 34 GPIO_ACTIVE_HIGH>;
+                     default-state = "off";
+                     panic-indicator;
+             };
+     };
+
      wcd938x: audio-codec {
              compatible = "qcom,wcd9380-codec";
 
@@ -98,6 +115,20 @@ switch-mode {
              };
      };
 
+     vreg_camf_1p2: regulator-camf-1p2 {
+             compatible = "regulator-fixed";
+
+             regulator-name = "vreg_camf_1p2";
+             regulator-min-microvolt = <1200000>;
+             regulator-max-microvolt = <1200000>;
+
+             gpio = <&tlmm 44 GPIO_ACTIVE_HIGH>;
+             enable-active-high;
+
+             pinctrl-0 = <&camf_1p2_reg_en>;
+             pinctrl-names = "default";
+     };
+
      vreg_misc_3p3: regulator-misc-3p3 {
              compatible = "regulator-fixed";
 
@@ -462,6 +493,13 @@ vreg_l8c: ldo8 {
                                                 RPMH_REGULATOR_MODE_HPM>;
              };
 
+             vreg_l11c: ldo11 {
+                     regulator-name = "vreg_l11c";
+                     regulator-min-microvolt = <2800000>;
+                     regulator-max-microvolt = <2800000>;
+                     regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+             };
+
              vreg_l12c: ldo12 {
                      regulator-name = "vreg_l12c";
                      regulator-min-microvolt = <1800000>;
@@ -577,6 +615,66 @@ vreg_l10d: ldo10 {
      };
  };
 
Quoted 15 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 629

Quoted 12 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +12 -0
+&camss {
+     vdda-phy-supply = <&vreg_l6b>;
+     vdda-pll-supply = <&vreg_l3b>;
+
+     status = "okay";
+
+     ports {
+             port@3 {
+                     csiphy3_ep: endpoint@0 {
+                             reg = <0>;
+
+                             clock-lanes = <7>;

Please remove 'clock-lanes' property from above.

Is it unused? I saw it on some devices and v4l2 related source file.

Quoted 8 lines
Quoted 8 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +8 -0
+                             data-lanes = <0 1 2 3>;
+                             remote-endpoint = <&hi846_ep>;
+                     };
+             };
+     };
+};
+
+&cci2 {
Quoted 9 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 643

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +6 -0
+     status = "okay";
+};
+
+&cci2_i2c1 {
+     /* On Goakun3(2.69GHz), S5K4H7@2d, image quality is better than hi846 */
+     camera_front: camera@20 {

'camera_front' label is unused and should be removed.

Ack

Quoted 15 lines
Quoted 15 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +15 -0
+             compatible = "hynix,hi846";
+             reg = <0x20>;
+
+             pinctrl-0 = <&camf_rgb_default>;
+             pinctrl-names = "default";
+
+             clocks = <&camcc CAMCC_MCLK3_CLK>;
+
+             assigned-clocks = <&camcc CAMCC_MCLK3_CLK>;
+             assigned-clock-rates = <24000000>;
+
+             reset-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>;
+             vddio-supply = <&vreg_l2c>;
+             vdda-supply = <&vreg_l11c>;
+             vddd-supply = <&vreg_camf_1p2>;
Quoted 9 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 664

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +6 -0
+
+             leds = <&privacy_led>;
+             led-names = "privacy";
+
+             orientation = <0>;      /* Front facing */
+             rotation = <0>;

Both properties above can be removed as the default ones.

Ack

Quoted 36 lines
Quoted 36 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +29 -0
+
+             port {
+                     hi846_ep: endpoint {
+                             data-lanes = <1 2 3 4>;
+                             link-frequencies = /bits/ 64 <80000000 144000000 200000000 288000000>;
+                             remote-endpoint = <&csiphy3_ep>;
+                     };
+             };
+     };
+
+     /* actuator???@58, Goakun3(2.69GHz) only, eeprom@50 */
+};
+
  &dispcc0 {
      status = "okay";
  };
@@ -1318,6 +1416,36 @@ hstp-sw-ctrl-pins {
              };
      };
 
+     cam_indicator_en: cam-indicator-en-state {
+             pins = "gpio34";
+             function = "gpio";
+             drive-strength = <2>;
+             bias-disable;
+     };
+
+     camf_1p2_reg_en: camf-1p2-reg-en-state {
+             pins = "gpio44";
+             function = "gpio";
+             drive-strength = <2>;
+             bias-disable;
+     };
+
+     camf_rgb_default: camf-rgb-default-state {
+             mclk-pins {
Quoted 9 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts hstp-sw-ctrl-pins { · line 1439

Quoted 5 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +5 -0
+                     pins = "gpio17";
+                     function = "cam_mclk";
+                     drive-strength = <6>;
+                     bias-disable;
+             };

cam_mclk pad function descriptions on all 8 pads supporting this function shall be added to the platform in a separate commit to sc8280xp.dtsi

Ack

Best wishes,
Pengyu

Quoted 16 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts hstp-sw-ctrl-pins { · line 1451

Quoted 12 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +9 -0
+
+             sc-rgb-xshut-n-pins {
+                     pins = "gpio15";
+                     function = "gpio";
+                     drive-strength = <2>;
+                     bias-disable;
+             };
+     };
+
      i2c4_default: i2c4-default-state {
              pins = "gpio171", "gpio172";
              function = "qup4";

--
Best wishes,
Vladimir

#10 lore raw

Re: [PATCH 3/4] arm64: dts: qcom: sc8280xp: gaokun3: add front camera sensor node

Quoted 15 lines · Pengyu Luo
Quoted 10 lines · Vladimir Zapolskiy
Quoted 1 line · Pengyu Luo

Hi846 is found on my Gaokun3, descripting it.

To the best of my knowledege there is no 'descripting' word.

Say it simpler like

Describe Hi846 camera sensor found on Gaokun3.

Ack

...

Quoted 16 lines
Quoted 6 lines
Quoted 6 lines

+&camss {

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +5 -0
+     vdda-phy-supply = <&vreg_l6b>;
+     vdda-pll-supply = <&vreg_l3b>;
+
+     status = "okay";
+
Quoted 9 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l10d: ldo10 { · line 629

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +6 -0
+     ports {
+             port@3 {
+                     csiphy3_ep: endpoint@0 {
+                             reg = <0>;
+
+                             clock-lanes = <7>;

Please remove 'clock-lanes' property from above.

Quoted 2 lines

Is it unused? I saw it on some devices and v4l2 related source file.

It is unused, and its selected value here is bogus.

Signature · 2 lines
Best wishes,
Vladimir
author
#11 lore raw

PATCH 4/4 arm64: dts: qcom: sc8280xp: gaokun3: describe rear camera module information as musch as possible

In reply to Pengyu Luo

The rear sensor is S5K3L6, describing it but dropping compatible string, since there is no upstream driver. A funcitonal downstream driver is in comment.

The VCM is dw9714, describe it.

---
Please take this patch as a RFC, I am not sure, how much I am allowed to add without a sensor driver.

---
 .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 129 +++++++++++++++++-
 1 file changed, 123 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +123 -6
index 39e559e91289..76b1ecb3819d 100644
@@ -22,12 +22,18 @@
 #include "sc8280xp.dtsi"
 #include "sc8280xp-pmics.dtsi"
 
+/* remove due to gpio pins collision, skip 2nd instance won't break things */
+/delete-node/ &cci1_i2c1;
+/delete-node/ &cci1_i2c1_default;
+/delete-node/ &cci1_i2c1_sleep;
+
 / {
 	chassis-type = "tablet";
 	model = "Matebook E Go";
 	compatible = "huawei,gaokun3", "qcom,sc8280xp";
 
 	aliases {
+		i2c1 = &cci1_i2c0;
 		i2c2 = &cci2_i2c1;
 		i2c4 = &i2c4;
 		i2c15 = &i2c15;
@@ -52,9 +58,17 @@ framebuffer0: framebuffer@c6200000 {
 	leds {
 		compatible = "gpio-leds";
 
-		pinctrl-0 = <&cam_indicator_en>;
+		pinctrl-0 = <&cam_indicator_en>, <&camera_flash_en>;
 		pinctrl-names = "default";
 
+		camera_flash: led {
+			function = LED_FUNCTION_FLASH;
+			color = <LED_COLOR_ID_WHITE>;
+			gpios = <&tlmm 93 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "none";
+			default-state = "off";
+		};
+
 		privacy_led: privacy-led {
 			function = LED_FUNCTION_INDICATOR;
 			color = <LED_COLOR_ID_WHITE>;
@@ -129,6 +143,18 @@ vreg_camf_1p2: regulator-camf-1p2 {
 		pinctrl-names = "default";
 	};
 
+	vreg_camr: regulator-camr {
+		compatible = "regulator-fixed";
+
+		regulator-name = "vreg_camr";
+
+		gpio = <&tlmm 92 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+
+		pinctrl-0 = <&camr_reg_en>;
+		pinctrl-names = "default";
+	};
+
 	vreg_misc_3p3: regulator-misc-3p3 {
 		compatible = "regulator-fixed";
 
@@ -387,8 +413,8 @@ vreg_l1b: ldo1 {
 
 		vreg_l2b: ldo2 {
 			regulator-name = "vreg_l2b";
-			regulator-min-microvolt = <1904000>;
-			regulator-max-microvolt = <1904000>;
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <2800000>;
 			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
 		};
 
@@ -433,10 +459,9 @@ vreg_l6b: ldo6 {
 
 		vreg_l7b: ldo7 {
 			regulator-name = "vreg_l7b";
-			regulator-min-microvolt = <1800000>;
-			regulator-max-microvolt = <1800000>;
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
 			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
-			regulator-boot-on;
 		};
 
 		vreg_l9b: ldo9 {
@@ -622,6 +647,16 @@ &camss {
 	status = "okay";
 
 	ports {
+		port@0 {
+			csiphy0_ep: endpoint@0 {
+				reg = <0>;
+
+				clock-lanes = <7>;
+				data-lanes = <0 1 2 3>;
+				remote-endpoint = <&s5k3l6_ep>;
+			};
+		};
+
 		port@3 {
 			csiphy3_ep: endpoint@0 {
 				reg = <0>;
@@ -634,6 +669,58 @@ csiphy3_ep: endpoint@0 {
 	};
 };
 
+&cci1 {
+	status = "okay";
+};
+
+&cci1_i2c0 {
+	voice_coil_motor: vcm@c {
+		compatible = "dongwoon,dw9714";
+		reg = <0xc>;
+		vcc-supply = <&vreg_l7b>; /* FIXME: require l2c on first */
+	};
+
+	/*
+	 * https://source.puri.sm/Librem5/linux/-/blob/pureos/latest/drivers/media/i2c/s5k3l6xx.c
+	 *
+	 * This sensor has never been detected on Goakun3(2.69GHz)
+	 */
+	camera_rear: camera@10 {
+		reg = <0x10>;
+
+		pinctrl-0 = <&camr_rgb_default>;
+		pinctrl-names = "default";
+
+		clocks = <&camcc CAMCC_MCLK4_CLK>;
+		clock-names = "mclk";
+		clock-frequency = <24000000>;
+
+		rstn-gpios = <&tlmm 7 GPIO_ACTIVE_LOW>;
+
+		vddio-supply = <&vreg_camr>;
+		vdda-supply = <&vreg_l2b>;
+		vddd-supply = <&vreg_l2c>;
+
+		/* &camera_flash can't be enabled directly for now */
+		leds = <&privacy_led>;
+		led-names = "privacy";
+
+		lens-focus = <&voice_coil_motor>;
+
+		orientation = <1>;
+		rotation = <180>;
+
+		port {
+			s5k3l6_ep: endpoint {
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&csiphy0_ep>;
+			};
+		};
+	};
+
+	/* eeprom@50/51 */
+};
+
 &cci2 {
 	status = "okay";
 };
@@ -1423,6 +1510,13 @@ cam_indicator_en: cam-indicator-en-state {
 		bias-disable;
 	};
 
+	camera_flash_en: camera-flash-en-state {
+		pins = "gpio93";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	camf_1p2_reg_en: camf-1p2-reg-en-state {
 		pins = "gpio44";
 		function = "gpio";
@@ -1446,6 +1540,29 @@ sc-rgb-xshut-n-pins {
 		};
 	};
 
+	camr_reg_en: camr-reg-en-state {
+		pins = "gpio92";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	camr_rgb_default: camr-rgb-default-state {
+		mclk-pins {
+			pins = "gpio6";
+			function = "cam_mclk";
+			drive-strength = <6>;
+			bias-disable;
+		};
+
+		sc-rgb-xshut-n-pins {
+			pins = "gpio7";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-disable;
+		};
+	};
+
 	i2c4_default: i2c4-default-state {
 		pins = "gpio171", "gpio172";
 		function = "qup4";
Signature · 1 line
2.54.0
#12 lore raw

Re: [PATCH 4/4] arm64: dts: qcom: sc8280xp: gaokun3: describe rear camera module information as musch as possible

Quoted 19 lines · Pengyu Luo

The rear sensor is S5K3L6, describing it but dropping compatible string, since there is no upstream driver. A funcitonal downstream driver is in comment.

The VCM is dw9714, describe it.

---
Please take this patch as a RFC, I am not sure, how much I am allowed to add without a sensor driver.

---
  .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 129 +++++++++++++++++-
  1 file changed, 123 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +0 -0
index 39e559e91289..76b1ecb3819d 100644

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts line 28

Quoted 7 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +4 -0
@@ -22,12 +22,18 @@
  #include "sc8280xp.dtsi"
  #include "sc8280xp-pmics.dtsi"
 
+/* remove due to gpio pins collision, skip 2nd instance won't break things */
+/delete-node/ &cci1_i2c1;
+/delete-node/ &cci1_i2c1_default;
+/delete-node/ &cci1_i2c1_sleep;

Instead of removal 'cci1_default' and 'cci1_sleep' nodes shall be rewritten by excluding 'cci1_i2c1_default' and 'cci1_i2c1_sleep' from them.

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts line 36

Quoted 8 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +2 -0
+
  / {
  	chassis-type = "tablet";
  	model = "Matebook E Go";
  	compatible = "huawei,gaokun3", "qcom,sc8280xp";
 
  	aliases {
+		i2c1 = &cci1_i2c0;

Likely this I2C alias can be removed.

Quoted 53 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +23 -3
  		i2c2 = &cci2_i2c1;
  		i2c4 = &i2c4;
  		i2c15 = &i2c15;
@@ -52,9 +58,17 @@ framebuffer0: framebuffer@c6200000 {
  	leds {
  		compatible = "gpio-leds";
 
-		pinctrl-0 = <&cam_indicator_en>;
+		pinctrl-0 = <&cam_indicator_en>, <&camera_flash_en>;
  		pinctrl-names = "default";
 
+		camera_flash: led {
+			function = LED_FUNCTION_FLASH;
+			color = <LED_COLOR_ID_WHITE>;
+			gpios = <&tlmm 93 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "none";
+			default-state = "off";
+		};
+
  		privacy_led: privacy-led {
  			function = LED_FUNCTION_INDICATOR;
  			color = <LED_COLOR_ID_WHITE>;
@@ -129,6 +143,18 @@ vreg_camf_1p2: regulator-camf-1p2 {
  		pinctrl-names = "default";
  	};
 
+	vreg_camr: regulator-camr {
+		compatible = "regulator-fixed";
+
+		regulator-name = "vreg_camr";
+
+		gpio = <&tlmm 92 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+
+		pinctrl-0 = <&camr_reg_en>;
+		pinctrl-names = "default";
+	};
+
  	vreg_misc_3p3: regulator-misc-3p3 {
  		compatible = "regulator-fixed";
 
@@ -387,8 +413,8 @@ vreg_l1b: ldo1 {
 
  		vreg_l2b: ldo2 {
  			regulator-name = "vreg_l2b";
-			regulator-min-microvolt = <1904000>;
-			regulator-max-microvolt = <1904000>;
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <2800000>;
  			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
  		};
 

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l6b: ldo6 { · line 465

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +2 -3
@@ -433,10 +459,9 @@ vreg_l6b: ldo6 {
 
  		vreg_l7b: ldo7 {
  			regulator-name = "vreg_l7b";
-			regulator-min-microvolt = <1800000>;
-			regulator-max-microvolt = <1800000>;
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
  			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
-			regulator-boot-on;
  		};

ldo2 and ldo7 changes shall be done in separate commits.

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts &camss { · line 654

Quoted 11 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +5 -0
  		vreg_l9b: ldo9 {
@@ -622,6 +647,16 @@ &camss {
  	status = "okay";
 
  	ports {
+		port@0 {
+			csiphy0_ep: endpoint@0 {
+				reg = <0>;
+
+				clock-lanes = <7>;

Please remove 'clock-lanes' property here.

Quoted 53 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +46 -0
+				data-lanes = <0 1 2 3>;
+				remote-endpoint = <&s5k3l6_ep>;
+			};
+		};
+
  		port@3 {
  			csiphy3_ep: endpoint@0 {
  				reg = <0>;
@@ -634,6 +669,58 @@ csiphy3_ep: endpoint@0 {
  	};
  };
 
+&cci1 {
+	status = "okay";
+};
+
+&cci1_i2c0 {
+	voice_coil_motor: vcm@c {
+		compatible = "dongwoon,dw9714";
+		reg = <0xc>;
+		vcc-supply = <&vreg_l7b>; /* FIXME: require l2c on first */
+	};
+
+	/*
+	 * https://source.puri.sm/Librem5/linux/-/blob/pureos/latest/drivers/media/i2c/s5k3l6xx.c
+	 *
+	 * This sensor has never been detected on Goakun3(2.69GHz)
+	 */
+	camera_rear: camera@10 {
+		reg = <0x10>;
+
+		pinctrl-0 = <&camr_rgb_default>;
+		pinctrl-names = "default";
+
+		clocks = <&camcc CAMCC_MCLK4_CLK>;
+		clock-names = "mclk";
+		clock-frequency = <24000000>;
+
+		rstn-gpios = <&tlmm 7 GPIO_ACTIVE_LOW>;
+
+		vddio-supply = <&vreg_camr>;
+		vdda-supply = <&vreg_l2b>;
+		vddd-supply = <&vreg_l2c>;
+
+		/* &camera_flash can't be enabled directly for now */
+		leds = <&privacy_led>;
+		led-names = "privacy";
+
+		lens-focus = <&voice_coil_motor>;
+
+		orientation = <1>;
+		rotation = <180>;
+

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts csiphy3_ep: endpoint@0 { · line 722

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +10 -0
+		port {
+			s5k3l6_ep: endpoint {
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&csiphy0_ep>;
+			};
+		};
+	};
+
+	/* eeprom@50/51 */
+};

I believe it is unacceptable to add device tree nodes like this one without a compatible property. While the motivation behind it is clear, unfortunately it has to be removed.

Quoted 26 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +12 -0
+
  &cci2 {
  	status = "okay";
  };
@@ -1423,6 +1510,13 @@ cam_indicator_en: cam-indicator-en-state {
  		bias-disable;
  	};
 
+	camera_flash_en: camera-flash-en-state {
+		pins = "gpio93";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
  	camf_1p2_reg_en: camf-1p2-reg-en-state {
  		pins = "gpio44";
  		function = "gpio";
@@ -1446,6 +1540,29 @@ sc-rgb-xshut-n-pins {
  		};
  	};
 
+	camr_reg_en: camr-reg-en-state {
+		pins = "gpio92";
+		function = "gpio";
+		drive-strength = <2>;

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts sc-rgb-xshut-n-pins { · line 1556

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +10 -0
+		bias-disable;
+	};
+
+	camr_rgb_default: camr-rgb-default-state {
+		mclk-pins {
+			pins = "gpio6";
+			function = "cam_mclk";
+			drive-strength = <6>;
+			bias-disable;
+		};

MCLK pad function shoul be a part of the change to sc8280xp.dtsi

Quoted 12 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +9 -0
+
+		sc-rgb-xshut-n-pins {
+			pins = "gpio7";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-disable;
+		};
+	};
+
  	i2c4_default: i2c4-default-state {
  		pins = "gpio171", "gpio172";
  		function = "qup4";
Signature · 2 lines
Best wishes,
Vladimir
author
#13 lore raw

Re: [PATCH 4/4] arm64: dts: qcom: sc8280xp: gaokun3: describe rear camera module information as musch as possible

Quoted 24 lines · Vladimir Zapolskiy
Quoted 22 lines · Pengyu Luo

The rear sensor is S5K3L6, describing it but dropping compatible string, since there is no upstream driver. A funcitonal downstream driver is in comment.

The VCM is dw9714, describe it.

---
Please take this patch as a RFC, I am not sure, how much I am allowed to add without a sensor driver.

---
  .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 129 +++++++++++++++++-
  1 file changed, 123 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +0 -0
index 39e559e91289..76b1ecb3819d 100644
@@ -22,12 +22,18 @@
  #include "sc8280xp.dtsi"
  #include "sc8280xp-pmics.dtsi"
 
Quoted 8 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts line 28

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +4 -0
+/* remove due to gpio pins collision, skip 2nd instance won't break things */
+/delete-node/ &cci1_i2c1;
+/delete-node/ &cci1_i2c1_default;
+/delete-node/ &cci1_i2c1_sleep;

Instead of removal 'cci1_default' and 'cci1_sleep' nodes shall be rewritten by excluding 'cci1_i2c1_default' and 'cci1_i2c1_sleep' from them.

Should we register an unused node?

Quoted 65 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts line 36

Quoted 8 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +2 -0
+
  / {
      chassis-type = "tablet";
      model = "Matebook E Go";
      compatible = "huawei,gaokun3", "qcom,sc8280xp";
 
      aliases {
+             i2c1 = &cci1_i2c0;

Likely this I2C alias can be removed.

Quoted 54 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +23 -3
              i2c2 = &cci2_i2c1;
              i2c4 = &i2c4;
              i2c15 = &i2c15;
@@ -52,9 +58,17 @@ framebuffer0: framebuffer@c6200000 {
      leds {
              compatible = "gpio-leds";
 
-             pinctrl-0 = <&cam_indicator_en>;
+             pinctrl-0 = <&cam_indicator_en>, <&camera_flash_en>;
              pinctrl-names = "default";
 
+             camera_flash: led {
+                     function = LED_FUNCTION_FLASH;
+                     color = <LED_COLOR_ID_WHITE>;
+                     gpios = <&tlmm 93 GPIO_ACTIVE_HIGH>;
+                     linux,default-trigger = "none";
+                     default-state = "off";
+             };
+
              privacy_led: privacy-led {
                      function = LED_FUNCTION_INDICATOR;
                      color = <LED_COLOR_ID_WHITE>;
@@ -129,6 +143,18 @@ vreg_camf_1p2: regulator-camf-1p2 {
              pinctrl-names = "default";
      };
 
+     vreg_camr: regulator-camr {
+             compatible = "regulator-fixed";
+
+             regulator-name = "vreg_camr";
+
+             gpio = <&tlmm 92 GPIO_ACTIVE_HIGH>;
+             enable-active-high;
+
+             pinctrl-0 = <&camr_reg_en>;
+             pinctrl-names = "default";
+     };
+
      vreg_misc_3p3: regulator-misc-3p3 {
              compatible = "regulator-fixed";
 
@@ -387,8 +413,8 @@ vreg_l1b: ldo1 {
 
              vreg_l2b: ldo2 {
                      regulator-name = "vreg_l2b";
-                     regulator-min-microvolt = <1904000>;
-                     regulator-max-microvolt = <1904000>;
+                     regulator-min-microvolt = <1800000>;
+                     regulator-max-microvolt = <2800000>;
                      regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
              };
 
@@ -433,10 +459,9 @@ vreg_l6b: ldo6 {
 
Quoted 12 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts vreg_l6b: ldo6 { · line 465

Quoted 9 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +2 -3
              vreg_l7b: ldo7 {
                      regulator-name = "vreg_l7b";
-                     regulator-min-microvolt = <1800000>;
-                     regulator-max-microvolt = <1800000>;
+                     regulator-min-microvolt = <2800000>;
+                     regulator-max-microvolt = <2800000>;
                      regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
-                     regulator-boot-on;
              };

ldo2 and ldo7 changes shall be done in separate commits.

Ack

Quoted 73 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts &camss { · line 654

Quoted 11 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +5 -0
              vreg_l9b: ldo9 {
@@ -622,6 +647,16 @@ &camss {
      status = "okay";
 
      ports {
+             port@0 {
+                     csiphy0_ep: endpoint@0 {
+                             reg = <0>;
+
+                             clock-lanes = <7>;

Please remove 'clock-lanes' property here.

Quoted 59 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +52 -0
+                             data-lanes = <0 1 2 3>;
+                             remote-endpoint = <&s5k3l6_ep>;
+                     };
+             };
+
              port@3 {
                      csiphy3_ep: endpoint@0 {
                              reg = <0>;
@@ -634,6 +669,58 @@ csiphy3_ep: endpoint@0 {
      };
  };
 
+&cci1 {
+     status = "okay";
+};
+
+&cci1_i2c0 {
+     voice_coil_motor: vcm@c {
+             compatible = "dongwoon,dw9714";
+             reg = <0xc>;
+             vcc-supply = <&vreg_l7b>; /* FIXME: require l2c on first */
+     };
+
+     /*
+      * https://source.puri.sm/Librem5/linux/-/blob/pureos/latest/drivers/media/i2c/s5k3l6xx.c
+      *
+      * This sensor has never been detected on Goakun3(2.69GHz)
+      */
+     camera_rear: camera@10 {
+             reg = <0x10>;
+
+             pinctrl-0 = <&camr_rgb_default>;
+             pinctrl-names = "default";
+
+             clocks = <&camcc CAMCC_MCLK4_CLK>;
+             clock-names = "mclk";
+             clock-frequency = <24000000>;
+
+             rstn-gpios = <&tlmm 7 GPIO_ACTIVE_LOW>;
+
+             vddio-supply = <&vreg_camr>;
+             vdda-supply = <&vreg_l2b>;
+             vddd-supply = <&vreg_l2c>;
+
+             /* &camera_flash can't be enabled directly for now */
+             leds = <&privacy_led>;
+             led-names = "privacy";
+
+             lens-focus = <&voice_coil_motor>;
+
+             orientation = <1>;
+             rotation = <180>;
+
+             port {
+                     s5k3l6_ep: endpoint {
+                             data-lanes = <1 2 3 4>;
+                             remote-endpoint = <&csiphy0_ep>;
+                     };
+             };
Quoted 9 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts csiphy3_ep: endpoint@0 { · line 722

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +4 -0
+     };
+
+     /* eeprom@50/51 */
+};

I believe it is unacceptable to add device tree nodes like this one without a compatible property. While the motivation behind it is clear, unfortunately it has to be removed.

Ack

Best wishes,
Pengyu

Quoted 55 lines
Quoted 26 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +12 -0
+
  &cci2 {
      status = "okay";
  };
@@ -1423,6 +1510,13 @@ cam_indicator_en: cam-indicator-en-state {
              bias-disable;
      };
 
+     camera_flash_en: camera-flash-en-state {
+             pins = "gpio93";
+             function = "gpio";
+             drive-strength = <2>;
+             bias-disable;
+     };
+
      camf_1p2_reg_en: camf-1p2-reg-en-state {
              pins = "gpio44";
              function = "gpio";
@@ -1446,6 +1540,29 @@ sc-rgb-xshut-n-pins {
              };
      };
 
+     camr_reg_en: camr-reg-en-state {
+             pins = "gpio92";
+             function = "gpio";
+             drive-strength = <2>;

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts sc-rgb-xshut-n-pins { · line 1556

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +10 -0
+             bias-disable;
+     };
+
+     camr_rgb_default: camr-rgb-default-state {
+             mclk-pins {
+                     pins = "gpio6";
+                     function = "cam_mclk";
+                     drive-strength = <6>;
+                     bias-disable;
+             };

MCLK pad function shoul be a part of the change to sc8280xp.dtsi

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts sc-rgb-xshut-n-pins { · line 1568

Quoted 12 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +9 -0
+
+             sc-rgb-xshut-n-pins {
+                     pins = "gpio7";
+                     function = "gpio";
+                     drive-strength = <2>;
+                     bias-disable;
+             };
+     };
+
      i2c4_default: i2c4-default-state {
              pins = "gpio171", "gpio172";
              function = "qup4";

--
Best wishes,
Vladimir

#14 lore raw

Re: [PATCH 4/4] arm64: dts: qcom: sc8280xp: gaokun3: describe rear camera module information as musch as possible

Quoted 35 lines · Pengyu Luo
Quoted 24 lines · Vladimir Zapolskiy
Quoted 22 lines · Pengyu Luo

The rear sensor is S5K3L6, describing it but dropping compatible string, since there is no upstream driver. A funcitonal downstream driver is in comment.

The VCM is dw9714, describe it.

---
Please take this patch as a RFC, I am not sure, how much I am allowed to add without a sensor driver.

---
   .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 129 +++++++++++++++++-
   1 file changed, 123 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +0 -0
index 39e559e91289..76b1ecb3819d 100644
@@ -22,12 +22,18 @@
   #include "sc8280xp.dtsi"
   #include "sc8280xp-pmics.dtsi"
 
Quoted 8 lines

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts line 28

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +4 -0
+/* remove due to gpio pins collision, skip 2nd instance won't break things */
+/delete-node/ &cci1_i2c1;
+/delete-node/ &cci1_i2c1_default;
+/delete-node/ &cci1_i2c1_sleep;

Instead of removal 'cci1_default' and 'cci1_sleep' nodes shall be rewritten by excluding 'cci1_i2c1_default' and 'cci1_i2c1_sleep' from them.

Quoted 2 lines

Should we register an unused node?

I believe unused nodes are found everywhere marked by status = "disabled" or if they do not produce a conflict for resources. I understand that a CCI IP with two ports are special, but likely (not always though) it should be acceptable to keep its device tree node as is.

Signature · 2 lines
Best wishes,
Vladimir
#15 lore raw

Re: [PATCH 4/4] arm64: dts: qcom: sc8280xp: gaokun3: describe rear camera module information as musch as possible

Quoted 36 lines · Vladimir Zapolskiy
Quoted 35 lines · Pengyu Luo
Quoted 32 lines · Vladimir Zapolskiy
Quoted 19 lines · Pengyu Luo

The rear sensor is S5K3L6, describing it but dropping compatible string, since there is no upstream driver. A funcitonal downstream driver is in comment.

The VCM is dw9714, describe it.

---
Please take this patch as a RFC, I am not sure, how much I am allowed to add without a sensor driver.
---
   .../boot/dts/qcom/sc8280xp-huawei-gaokun3.dts | 129 +++++++++++++++++-

   1 file changed, 123 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +0 -0
index 39e559e91289..76b1ecb3819d 100644

arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts line 28

Quoted 7 lines
arch/arm64/boot/dts/qcom/sc8280xp-huawei-gaokun3.dts +4 -0
@@ -22,12 +22,18 @@
    #include "sc8280xp.dtsi"
    #include "sc8280xp-pmics.dtsi"
 
+/* remove due to gpio pins collision, skip 2nd instance won't break things */
+/delete-node/ &cci1_i2c1;
+/delete-node/ &cci1_i2c1_default;
+/delete-node/ &cci1_i2c1_sleep;

Instead of removal 'cci1_default' and 'cci1_sleep' nodes shall be rewritten by excluding 'cci1_i2c1_default' and 'cci1_i2c1_sleep' from them.

Quoted 7 lines
Quoted 2 lines

Should we register an unused node?

I believe unused nodes are found everywhere marked by status = "disabled" or if they do not produce a conflict for resources. I understand that a CCI IP with two ports are special, but likely (not always though) it should be acceptable to keep its device tree node as is.

I wanted the pins to move to the sub-buses as well, but that doesn't seem trivial - we would either have to alter some obscure core code, or manage the pinctrl states manually from within the CCI driver

(contributions welcome)

Konrad