Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] Add Ultra Wide Camera Support for Nothing Phone (1)
@ 2026-08-01 14:31 Danila Tikhonov
  2026-08-01 14:31 ` [PATCH 1/2] drivers: media: i2c: s5kjn1: Add support for 19.2MHz MCLK Danila Tikhonov
  2026-08-01 14:31 ` [PATCH 2/2] arm64: dts: qcom: sm7325-nothing-spacewar: Add ultra wide camera support Danila Tikhonov
  0 siblings, 2 replies; 5+ messages in thread
From: Danila Tikhonov @ 2026-08-01 14:31 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sakari Ailus, Vladimir Zapolskiy,
	Mauro Carvalho Chehab, Eugene Lepshy, Vasiliy Doylov,
	Achill Gilgenast, Luca Weiss
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-media,
	~postmarketos/upstreaming, Danila Tikhonov

This series adds support for the Samsung S5KJN1 camera sensor on the
Nothing Phone (1).

The sensor on this device is supplied with a 19.2MHz MCLK, while the
Samsung S5KJN1 driver currently supports only a 24MHz clock.

The first patch adds the required 19.2MHz MCLK support to the driver.
And the second patch adds the Samsung S5KJN1 camera sensor node in the
sm7325-nothing-spacewar device-tree.

To: Bjorn Andersson <andersson@kernel.org>
To: Konrad Dybcio <konradybcio@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Eugene Lepshy <fekz115@gmail.com>
To: Vasiliy Doylov <neko@altlinux.org>
To: Achill Gilgenast <achill@achill.org>
To: Luca Weiss <luca.weiss@fairphone.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: ~postmarketos/upstreaming@lists.sr.ht
Signed-off-by: Danila Tikhonov <danila@mainlining.org>

Danila Tikhonov (2):
  drivers: media: i2c: s5kjn1: Add support for 19.2MHz MCLK
  arm64: dts: qcom: sm7325-nothing-spacewar: Add ultra wide camera
    support

 arch/arm64/boot/dts/qcom/kodiak.dtsi          |   7 +
 .../boot/dts/qcom/sm7325-nothing-spacewar.dts |  47 ++++-
 drivers/media/i2c/s5kjn1.c                    | 183 +++++++++++++++---
 3 files changed, 204 insertions(+), 33 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] drivers: media: i2c: s5kjn1: Add support for 19.2MHz MCLK
  2026-08-01 14:31 [PATCH 0/2] Add Ultra Wide Camera Support for Nothing Phone (1) Danila Tikhonov
@ 2026-08-01 14:31 ` Danila Tikhonov
  2026-08-01 14:39   ` Neko
  2026-08-01 14:31 ` [PATCH 2/2] arm64: dts: qcom: sm7325-nothing-spacewar: Add ultra wide camera support Danila Tikhonov
  1 sibling, 1 reply; 5+ messages in thread
From: Danila Tikhonov @ 2026-08-01 14:31 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sakari Ailus, Vladimir Zapolskiy,
	Mauro Carvalho Chehab, Eugene Lepshy, Vasiliy Doylov,
	Achill Gilgenast, Luca Weiss
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-media,
	~postmarketos/upstreaming, Danila Tikhonov

The S5KJN1 sensor supports a range of external clock frequencies (MCLK),
while the driver currently only supports a 24MHz MCLK.

The 19.2MHz clock is used by the S5KJN1 camera sensor on the
Nothing Phone (1) aka sm7325-nothing-spacewar.

Add support for this frequency.

While splitting the clock settings into separate register sequences,
add definitions for the known clock-related registers and values instead
of using raw register addresses and magic values.

Signed-off-by: Danila Tikhonov <danila@mainlining.org>
---
 drivers/media/i2c/s5kjn1.c | 183 ++++++++++++++++++++++++++++++-------
 1 file changed, 151 insertions(+), 32 deletions(-)

diff --git a/drivers/media/i2c/s5kjn1.c b/drivers/media/i2c/s5kjn1.c
index a707cb740556..1036e629758f 100644
--- a/drivers/media/i2c/s5kjn1.c
+++ b/drivers/media/i2c/s5kjn1.c
@@ -15,6 +15,7 @@
 #include <media/v4l2-fwnode.h>
 
 #define S5KJN1_LINK_FREQ_700MHZ		(700ULL * HZ_PER_MHZ)
+#define S5KJN1_MCLK_FREQ_19P2MHZ	(19200 * HZ_PER_KHZ)
 #define S5KJN1_MCLK_FREQ_24MHZ		(24 * HZ_PER_MHZ)
 #define S5KJN1_DATA_LANES		4
 
@@ -25,6 +26,24 @@
 #define S5KJN1_REG_CTRL_MODE		CCI_REG8(0x0100)
 #define S5KJN1_MODE_STREAMING		BIT(0)
 
+#define S5KJN1_REG_EXTCLK_INTEGER	CCI_REG16(0x0136)
+#define S5KJN1_REG_EXTCLK_FRACTION	CCI_REG16(0x013e)
+#define S5KJN1_REG_VT_PIX_CLK_DIV	CCI_REG16(0x0300)
+#define S5KJN1_REG_VT_SYS_CLK_DIV	CCI_REG16(0x0302)
+#define S5KJN1_REG_VT_PRE_PLL_CLK_DIV	CCI_REG16(0x0304)
+#define S5KJN1_REG_VT_PLL_MULTIPLIER	CCI_REG16(0x0306)
+
+#define S5KJN1_EXTCLK_19P2MHZ_INTEGER	0x1300
+#define S5KJN1_EXTCLK_19P2MHZ_FRACTION	0x00c8
+#define S5KJN1_EXTCLK_24MHZ_INTEGER	0x1800
+#define S5KJN1_EXTCLK_24MHZ_FRACTION	0x0000
+#define S5KJN1_VT_PIX_CLK_DIV		0x0006
+#define S5KJN1_VT_SYS_CLK_DIV		0x0001
+#define S5KJN1_VT_PRE_PLL_DIV_19P2MHZ	0x0003
+#define S5KJN1_VT_PRE_PLL_DIV_24MHZ	0x0004
+#define S5KJN1_VT_PLL_MUL_19P2MHZ	0x0083
+#define S5KJN1_VT_PLL_MUL_24MHZ		0x008c
+
 #define S5KJN1_REG_ORIENTATION		CCI_REG8(0x0101)
 #define S5KJN1_VFLIP			BIT(1)
 #define S5KJN1_HFLIP			BIT(0)
@@ -70,6 +89,17 @@ struct s5kjn1_reg_list {
 	unsigned int num_regs;
 };
 
+enum s5kjn1_mclk {
+	S5KJN1_MCLK_19P2MHZ,
+	S5KJN1_MCLK_24MHZ,
+	S5KJN1_NUM_MCLKS,
+};
+
+static const unsigned long s5kjn1_mclk_freqs[S5KJN1_NUM_MCLKS] = {
+	[S5KJN1_MCLK_19P2MHZ] = S5KJN1_MCLK_FREQ_19P2MHZ,
+	[S5KJN1_MCLK_24MHZ] = S5KJN1_MCLK_FREQ_24MHZ,
+};
+
 struct s5kjn1_mode {
 	u32 width;			/* Frame width in pixels */
 	u32 height;			/* Frame height in pixels */
@@ -78,7 +108,10 @@ struct s5kjn1_mode {
 	u32 exposure;			/* Default exposure value */
 	u32 exposure_margin;		/* Exposure margin */
 
-	const struct s5kjn1_reg_list reg_list;	/* Sensor register setting */
+	/* Sensor register setting */
+	const struct s5kjn1_reg_list mode_setup_reg_list;
+	const struct s5kjn1_reg_list clk_reg_list[S5KJN1_NUM_MCLKS];
+	const struct s5kjn1_reg_list frame_timing_reg_list;
 };
 
 static const char * const s5kjn1_test_pattern_menu[] = {
@@ -93,6 +126,7 @@ struct s5kjn1 {
 	struct device *dev;
 	struct regmap *regmap;
 	struct clk *mclk;
+	unsigned int mclk_index;
 	struct gpio_desc *reset_gpio;
 	struct regulator *afvdd;	/* Autofocus actuator power */
 	struct regulator *vdda;		/* Analog power */
@@ -147,7 +181,7 @@ static const struct cci_reg_sequence init_array_setting[] = {
 	{ CCI_REG16(0x011a), 0x0001 },
 };
 
-static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_mode[] = {
+static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_mode_setup[] = {
 	{ CCI_REG16(0x6028), 0x2400 },
 	{ CCI_REG16(0x602a), 0x1a28 },
 	{ CCI_REG16(0x6f12), 0x4c00 },
@@ -403,21 +437,39 @@ static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_mode[] = {
 	{ CCI_REG16(0x0110), 0x1002 },
 	{ CCI_REG16(0x0114), 0x0301 },
 	{ CCI_REG16(0x0116), 0x3000 },
+};
 
-	/* Clock settings */
-	{ CCI_REG16(0x0136), 0x1800 },
-	{ CCI_REG16(0x013e), 0x0000 },
-	{ CCI_REG16(0x0300), 0x0006 },
-	{ CCI_REG16(0x0302), 0x0001 },
-	{ CCI_REG16(0x0304), 0x0004 },
-	{ CCI_REG16(0x0306), 0x008c },
+static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_19p2mhz_clk[] = {
+	{ S5KJN1_REG_EXTCLK_INTEGER, S5KJN1_EXTCLK_19P2MHZ_INTEGER },
+	{ S5KJN1_REG_EXTCLK_FRACTION, S5KJN1_EXTCLK_19P2MHZ_FRACTION },
+	{ S5KJN1_REG_VT_PIX_CLK_DIV, S5KJN1_VT_PIX_CLK_DIV },
+	{ S5KJN1_REG_VT_SYS_CLK_DIV, S5KJN1_VT_SYS_CLK_DIV },
+	{ S5KJN1_REG_VT_PRE_PLL_CLK_DIV, S5KJN1_VT_PRE_PLL_DIV_19P2MHZ },
+	{ S5KJN1_REG_VT_PLL_MULTIPLIER, S5KJN1_VT_PLL_MUL_19P2MHZ },
+	{ CCI_REG16(0x0308), 0x0008 },
+	{ CCI_REG16(0x030a), 0x0001 },
+	{ CCI_REG16(0x030c), 0x0000 },
+	{ CCI_REG16(0x030e), 0x0003 },
+	{ CCI_REG16(0x0310), 0x0089 },
+	{ CCI_REG16(0x0312), 0x0000 },
+};
+
+static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_24mhz_clk[] = {
+	{ S5KJN1_REG_EXTCLK_INTEGER, S5KJN1_EXTCLK_24MHZ_INTEGER },
+	{ S5KJN1_REG_EXTCLK_FRACTION, S5KJN1_EXTCLK_24MHZ_FRACTION },
+	{ S5KJN1_REG_VT_PIX_CLK_DIV, S5KJN1_VT_PIX_CLK_DIV },
+	{ S5KJN1_REG_VT_SYS_CLK_DIV, S5KJN1_VT_SYS_CLK_DIV },
+	{ S5KJN1_REG_VT_PRE_PLL_CLK_DIV, S5KJN1_VT_PRE_PLL_DIV_24MHZ },
+	{ S5KJN1_REG_VT_PLL_MULTIPLIER, S5KJN1_VT_PLL_MUL_24MHZ },
 	{ CCI_REG16(0x0308), 0x0008 },
 	{ CCI_REG16(0x030a), 0x0001 },
 	{ CCI_REG16(0x030c), 0x0000 },
 	{ CCI_REG16(0x030e), 0x0004 },
 	{ CCI_REG16(0x0310), 0x0092 },
 	{ CCI_REG16(0x0312), 0x0000 },
+};
 
+static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_frame_timing[] = {
 	{ CCI_REG16(0x080e), 0x0000 },
 	{ S5KJN1_REG_VTS,    0x10c0 },
 	{ S5KJN1_REG_HTS,    0x1100 },
@@ -431,7 +483,7 @@ static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_mode[] = {
 	{ CCI_REG16(0x0816), 0x1c00 },
 };
 
-static const struct cci_reg_sequence s5kjn1_8160x6144_10fps_mode[] = {
+static const struct cci_reg_sequence s5kjn1_8160x6144_10fps_mode_setup[] = {
 	{ CCI_REG16(0x6028), 0x2400 },
 	{ CCI_REG16(0x602a), 0x1a28 },
 	{ CCI_REG16(0x6f12), 0x4c00 },
@@ -687,21 +739,39 @@ static const struct cci_reg_sequence s5kjn1_8160x6144_10fps_mode[] = {
 	{ CCI_REG16(0x0110), 0x1002 },
 	{ CCI_REG16(0x0114), 0x0300 },
 	{ CCI_REG16(0x0116), 0x3000 },
+};
+
+static const struct cci_reg_sequence s5kjn1_8160x6144_10fps_19p2mhz_clk[] = {
+	{ S5KJN1_REG_EXTCLK_INTEGER, S5KJN1_EXTCLK_19P2MHZ_INTEGER },
+	{ S5KJN1_REG_EXTCLK_FRACTION, S5KJN1_EXTCLK_19P2MHZ_FRACTION },
+	{ S5KJN1_REG_VT_PIX_CLK_DIV, S5KJN1_VT_PIX_CLK_DIV },
+	{ S5KJN1_REG_VT_SYS_CLK_DIV, S5KJN1_VT_SYS_CLK_DIV },
+	{ S5KJN1_REG_VT_PRE_PLL_CLK_DIV, S5KJN1_VT_PRE_PLL_DIV_19P2MHZ },
+	{ S5KJN1_REG_VT_PLL_MULTIPLIER, S5KJN1_VT_PLL_MUL_19P2MHZ },
+	{ CCI_REG16(0x0308), 0x0008 },
+	{ CCI_REG16(0x030a), 0x0001 },
+	{ CCI_REG16(0x030c), 0x0000 },
+	{ CCI_REG16(0x030e), 0x0003 },
+	{ CCI_REG16(0x0310), 0x006d },
+	{ CCI_REG16(0x0312), 0x0000 },
+};
 
-	/* Clock settings */
-	{ CCI_REG16(0x0136), 0x1800 },
-	{ CCI_REG16(0x013e), 0x0000 },
-	{ CCI_REG16(0x0300), 0x0006 },
-	{ CCI_REG16(0x0302), 0x0001 },
-	{ CCI_REG16(0x0304), 0x0004 },
-	{ CCI_REG16(0x0306), 0x008c },
+static const struct cci_reg_sequence s5kjn1_8160x6144_10fps_24mhz_clk[] = {
+	{ S5KJN1_REG_EXTCLK_INTEGER, S5KJN1_EXTCLK_24MHZ_INTEGER },
+	{ S5KJN1_REG_EXTCLK_FRACTION, S5KJN1_EXTCLK_24MHZ_FRACTION },
+	{ S5KJN1_REG_VT_PIX_CLK_DIV, S5KJN1_VT_PIX_CLK_DIV },
+	{ S5KJN1_REG_VT_SYS_CLK_DIV, S5KJN1_VT_SYS_CLK_DIV },
+	{ S5KJN1_REG_VT_PRE_PLL_CLK_DIV, S5KJN1_VT_PRE_PLL_DIV_24MHZ },
+	{ S5KJN1_REG_VT_PLL_MULTIPLIER, S5KJN1_VT_PLL_MUL_24MHZ },
 	{ CCI_REG16(0x0308), 0x0008 },
 	{ CCI_REG16(0x030a), 0x0001 },
 	{ CCI_REG16(0x030c), 0x0000 },
 	{ CCI_REG16(0x030e), 0x0004 },
 	{ CCI_REG16(0x0310), 0x0074 },
 	{ CCI_REG16(0x0312), 0x0000 },
+};
 
+static const struct cci_reg_sequence s5kjn1_8160x6144_10fps_frame_timing[] = {
 	{ CCI_REG16(0x080e), 0x0000 },
 	{ S5KJN1_REG_VTS,    0x1900 },
 	{ S5KJN1_REG_HTS,    0x21f0 },
@@ -722,9 +792,23 @@ static const struct s5kjn1_mode s5kjn1_supported_modes[] = {
 		.vts = 4288,
 		.exposure = 3840,
 		.exposure_margin = 22,
-		.reg_list = {
-			.regs = s5kjn1_4080x3072_30fps_mode,
-			.num_regs = ARRAY_SIZE(s5kjn1_4080x3072_30fps_mode),
+		.mode_setup_reg_list = {
+			.regs = s5kjn1_4080x3072_30fps_mode_setup,
+			.num_regs = ARRAY_SIZE(s5kjn1_4080x3072_30fps_mode_setup),
+		},
+		.clk_reg_list = {
+			[S5KJN1_MCLK_19P2MHZ] = {
+				.regs = s5kjn1_4080x3072_30fps_19p2mhz_clk,
+				.num_regs = ARRAY_SIZE(s5kjn1_4080x3072_30fps_19p2mhz_clk),
+			},
+			[S5KJN1_MCLK_24MHZ] = {
+				.regs = s5kjn1_4080x3072_30fps_24mhz_clk,
+				.num_regs = ARRAY_SIZE(s5kjn1_4080x3072_30fps_24mhz_clk),
+			},
+		},
+		.frame_timing_reg_list = {
+			.regs = s5kjn1_4080x3072_30fps_frame_timing,
+			.num_regs = ARRAY_SIZE(s5kjn1_4080x3072_30fps_frame_timing),
 		},
 	},
 	{
@@ -734,9 +818,23 @@ static const struct s5kjn1_mode s5kjn1_supported_modes[] = {
 		.vts = 6400,
 		.exposure = 6144,
 		.exposure_margin = 44,
-		.reg_list = {
-			.regs = s5kjn1_8160x6144_10fps_mode,
-			.num_regs = ARRAY_SIZE(s5kjn1_8160x6144_10fps_mode),
+		.mode_setup_reg_list = {
+			.regs = s5kjn1_8160x6144_10fps_mode_setup,
+			.num_regs = ARRAY_SIZE(s5kjn1_8160x6144_10fps_mode_setup),
+		},
+		.clk_reg_list = {
+			[S5KJN1_MCLK_19P2MHZ] = {
+				.regs = s5kjn1_8160x6144_10fps_19p2mhz_clk,
+				.num_regs = ARRAY_SIZE(s5kjn1_8160x6144_10fps_19p2mhz_clk),
+			},
+			[S5KJN1_MCLK_24MHZ] = {
+				.regs = s5kjn1_8160x6144_10fps_24mhz_clk,
+				.num_regs = ARRAY_SIZE(s5kjn1_8160x6144_10fps_24mhz_clk),
+			},
+		},
+		.frame_timing_reg_list = {
+			.regs = s5kjn1_8160x6144_10fps_frame_timing,
+			.num_regs = ARRAY_SIZE(s5kjn1_8160x6144_10fps_frame_timing),
 		},
 	},
 };
@@ -894,9 +992,12 @@ static int s5kjn1_enable_streams(struct v4l2_subdev *sd,
 				 u64 streams_mask)
 {
 	struct s5kjn1 *s5kjn1 = to_s5kjn1(sd);
-	const struct s5kjn1_reg_list *reg_list = &s5kjn1->mode->reg_list;
+	const struct s5kjn1_mode *mode = s5kjn1->mode;
+	const struct s5kjn1_reg_list *clk_reg_list;
 	int ret;
 
+	clk_reg_list = &mode->clk_reg_list[s5kjn1->mclk_index];
+
 	ret = pm_runtime_resume_and_get(s5kjn1->dev);
 	if (ret)
 		return ret;
@@ -924,8 +1025,12 @@ static int s5kjn1_enable_streams(struct v4l2_subdev *sd,
 	/* Sensor init settings */
 	cci_multi_reg_write(s5kjn1->regmap, init_array_setting,
 			    ARRAY_SIZE(init_array_setting), &ret);
-	cci_multi_reg_write(s5kjn1->regmap, reg_list->regs,
-			    reg_list->num_regs, &ret);
+	cci_multi_reg_write(s5kjn1->regmap, mode->mode_setup_reg_list.regs,
+			    mode->mode_setup_reg_list.num_regs, &ret);
+	cci_multi_reg_write(s5kjn1->regmap, clk_reg_list->regs,
+			    clk_reg_list->num_regs, &ret);
+	cci_multi_reg_write(s5kjn1->regmap, mode->frame_timing_reg_list.regs,
+			    mode->frame_timing_reg_list.num_regs, &ret);
 	if (ret)
 		goto error;
 
@@ -1199,6 +1304,23 @@ static int s5kjn1_check_hwcfg(struct s5kjn1 *s5kjn1)
 	return ret;
 }
 
+static int s5kjn1_get_mclk_index(struct s5kjn1 *s5kjn1)
+{
+	unsigned long freq = clk_get_rate(s5kjn1->mclk);
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(s5kjn1_mclk_freqs); i++) {
+		if (freq == s5kjn1_mclk_freqs[i]) {
+			s5kjn1->mclk_index = i;
+			return 0;
+		}
+	}
+
+	return dev_err_probe(s5kjn1->dev, -EINVAL,
+			     "MCLK clock frequency %lu is not supported\n",
+			     freq);
+}
+
 static int s5kjn1_power_on(struct device *dev)
 {
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
@@ -1290,7 +1412,6 @@ static int s5kjn1_power_off(struct device *dev)
 static int s5kjn1_probe(struct i2c_client *client)
 {
 	struct s5kjn1 *s5kjn1;
-	unsigned long freq;
 	int ret;
 
 	s5kjn1 = devm_kzalloc(&client->dev, sizeof(*s5kjn1), GFP_KERNEL);
@@ -1310,11 +1431,9 @@ static int s5kjn1_probe(struct i2c_client *client)
 		return dev_err_probe(s5kjn1->dev, PTR_ERR(s5kjn1->mclk),
 				     "failed to get MCLK clock\n");
 
-	freq = clk_get_rate(s5kjn1->mclk);
-	if (freq != S5KJN1_MCLK_FREQ_24MHZ)
-		return dev_err_probe(s5kjn1->dev, -EINVAL,
-				     "MCLK clock frequency %lu is not supported\n",
-				     freq);
+	ret = s5kjn1_get_mclk_index(s5kjn1);
+	if (ret)
+		return ret;
 
 	ret = s5kjn1_check_hwcfg(s5kjn1);
 	if (ret)
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] arm64: dts: qcom: sm7325-nothing-spacewar: Add ultra wide camera support
  2026-08-01 14:31 [PATCH 0/2] Add Ultra Wide Camera Support for Nothing Phone (1) Danila Tikhonov
  2026-08-01 14:31 ` [PATCH 1/2] drivers: media: i2c: s5kjn1: Add support for 19.2MHz MCLK Danila Tikhonov
@ 2026-08-01 14:31 ` Danila Tikhonov
  2026-08-01 14:40   ` Neko
  1 sibling, 1 reply; 5+ messages in thread
From: Danila Tikhonov @ 2026-08-01 14:31 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sakari Ailus, Vladimir Zapolskiy,
	Mauro Carvalho Chehab, Eugene Lepshy, Vasiliy Doylov,
	Achill Gilgenast, Luca Weiss
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-media,
	~postmarketos/upstreaming, Danila Tikhonov

Add and configure the necessary nodes to enable the ultra wide camera
(Samsung S5KJN1), connected to CSIPHY 2.

Signed-off-by: Danila Tikhonov <danila@mainlining.org>
---
 arch/arm64/boot/dts/qcom/kodiak.dtsi          |  7 +++
 .../boot/dts/qcom/sm7325-nothing-spacewar.dts | 47 ++++++++++++++++++-
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi b/arch/arm64/boot/dts/qcom/kodiak.dtsi
index f74fa66f1a67..96bb354dad8f 100644
--- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
+++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
@@ -5851,6 +5851,13 @@ tlmm: pinctrl@f100000 {
 			gpio-ranges = <&tlmm 0 0 175>;
 			wakeup-parent = <&pdc>;
 
+			cam_mclk2_default: cam-mclk2-default-state {
+				pins = "gpio66";
+				function = "cam_mclk";
+				drive-strength = <2>;
+				bias-disable;
+			};
+
 			cam_mclk3_default: cam-mclk3-default-state {
 				pins = "gpio67";
 				function = "cam_mclk";
diff --git a/arch/arm64/boot/dts/qcom/sm7325-nothing-spacewar.dts b/arch/arm64/boot/dts/qcom/sm7325-nothing-spacewar.dts
index a6ba19cb60fd..c36e3274f783 100644
--- a/arch/arm64/boot/dts/qcom/sm7325-nothing-spacewar.dts
+++ b/arch/arm64/boot/dts/qcom/sm7325-nothing-spacewar.dts
@@ -12,6 +12,7 @@
 #include <dt-bindings/iio/qcom,spmi-adc7-pm8350b.h>
 #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/media/video-interfaces.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include <dt-bindings/sound/qcom,q6afe.h>
@@ -831,6 +832,23 @@ vreg_bob: bob {
 	};
 };
 
+&camss {
+	vdda-phy-supply = <&vreg_l10c_0p88>;
+	vdda-pll-supply = <&vreg_l6b_1p2>;
+
+	status = "okay";
+
+	ports {
+		port@2 {
+			csiphy2_ep: endpoint {
+				data-lanes = <0 1 2 3>;
+				bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
+				remote-endpoint = <&camera_s5kjn1_ep>;
+			};
+		};
+	};
+};
+
 &cci0 {
 	/*
 	 * cci0_i2c1 bus is unused and GPIO 71&72 are repurposed.
@@ -860,7 +878,34 @@ &cci1 {
 
 &cci1_i2c0 {
 	/* actuator (For Ultra Wide sensor) @ 0xc */
-	/* D-PHY samsung,s5kjn1 (Ultra Wide) @ 0x2d */
+
+	camu_s5kjn1: camera@2d {
+		compatible = "samsung,s5kjn1";
+		reg = <0x2d>;
+
+		vdda-supply = <&vreg_camu_vana_2p8>;
+		vddd-supply = <&vreg_camu_vdig_1p1>;
+		vddio-supply = <&vreg_cam_vio_1p8>;
+
+		clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clocks = <&camcc CAM_CC_MCLK2_CLK>;
+		assigned-clock-rates = <19200000>;
+
+		reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>;
+		pinctrl-0 = <&cam_mclk2_default>;
+		pinctrl-names = "default";
+
+		orientation = <1>; /* Rear facing */
+		rotation = <90>;
+
+		port {
+			camera_s5kjn1_ep: endpoint {
+				data-lanes = <1 2 3 4>;
+				link-frequencies = /bits/ 64 <700000000>;
+				remote-endpoint = <&csiphy2_ep>;
+			};
+		};
+	};
 
 	camu_gt24p128e: eeprom@51 {
 		compatible = "giantec,gt24p128e",
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drivers: media: i2c: s5kjn1: Add support for 19.2MHz MCLK
  2026-08-01 14:31 ` [PATCH 1/2] drivers: media: i2c: s5kjn1: Add support for 19.2MHz MCLK Danila Tikhonov
@ 2026-08-01 14:39   ` Neko
  0 siblings, 0 replies; 5+ messages in thread
From: Neko @ 2026-08-01 14:39 UTC (permalink / raw)
  To: Danila Tikhonov, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sakari Ailus,
	Vladimir Zapolskiy, Mauro Carvalho Chehab, Eugene Lepshy,
	Achill Gilgenast, Luca Weiss
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-media,
	~postmarketos/upstreaming


On 8/1/26 5:31 PM, Danila Tikhonov wrote:
> The S5KJN1 sensor supports a range of external clock frequencies (MCLK),
> while the driver currently only supports a 24MHz MCLK.
>
> The 19.2MHz clock is used by the S5KJN1 camera sensor on the
> Nothing Phone (1) aka sm7325-nothing-spacewar.
>
> Add support for this frequency.
>
> While splitting the clock settings into separate register sequences,
> add definitions for the known clock-related registers and values instead
> of using raw register addresses and magic values.

Tested-by: Vasiliy Doylov <neko@altlinux.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] arm64: dts: qcom: sm7325-nothing-spacewar: Add ultra wide camera support
  2026-08-01 14:31 ` [PATCH 2/2] arm64: dts: qcom: sm7325-nothing-spacewar: Add ultra wide camera support Danila Tikhonov
@ 2026-08-01 14:40   ` Neko
  0 siblings, 0 replies; 5+ messages in thread
From: Neko @ 2026-08-01 14:40 UTC (permalink / raw)
  To: Danila Tikhonov, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sakari Ailus,
	Vladimir Zapolskiy, Mauro Carvalho Chehab, Eugene Lepshy,
	Achill Gilgenast, Luca Weiss
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-media,
	~postmarketos/upstreaming


On 8/1/26 5:31 PM, Danila Tikhonov wrote:
> Add and configure the necessary nodes to enable the ultra wide camera
> (Samsung S5KJN1), connected to CSIPHY 2.

Tested-by: Vasiliy Doylov <neko@altlinux.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-01 14:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-01 14:31 [PATCH 0/2] Add Ultra Wide Camera Support for Nothing Phone (1) Danila Tikhonov
2026-08-01 14:31 ` [PATCH 1/2] drivers: media: i2c: s5kjn1: Add support for 19.2MHz MCLK Danila Tikhonov
2026-08-01 14:39   ` Neko
2026-08-01 14:31 ` [PATCH 2/2] arm64: dts: qcom: sm7325-nothing-spacewar: Add ultra wide camera support Danila Tikhonov
2026-08-01 14:40   ` Neko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox