Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera
@ 2024-10-01 14:01 classabbyamp
  2024-10-01 14:23 ` [PR PATCH] [Updated] " classabbyamp
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: classabbyamp @ 2024-10-01 14:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages linux6-cam
https://github.com/void-linux/void-packages/pull/52444

linux6.11: update to 6.11.1, enable x13s camera
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly** (aarch64)

still testing the patches on aarch64, haven't tested other archs

cc @duncaen

[ci skip]

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/52444.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux6-cam-52444.patch --]
[-- Type: text/x-diff, Size: 5193 bytes --]

From 32a86d77ed069703225b9e7b53a88d481a92e1c3 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 1 Oct 2024 10:00:30 -0400
Subject: [PATCH] linux6.11: update to 6.11.1, enable x13s camera

---
 srcpkgs/linux6.11/files/arm64-dotconfig     |   6 +-
 srcpkgs/linux6.11/patches/x13s-camera.patch | 105 ++++++++++++++++++++
 srcpkgs/linux6.11/template                  |   7 +-
 3 files changed, 113 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/linux6.11/patches/x13s-camera.patch

diff --git a/srcpkgs/linux6.11/files/arm64-dotconfig b/srcpkgs/linux6.11/files/arm64-dotconfig
index ee92b115673319..d7b0507e959515 100644
--- a/srcpkgs/linux6.11/files/arm64-dotconfig
+++ b/srcpkgs/linux6.11/files/arm64-dotconfig
@@ -2,7 +2,7 @@
 # Automatically generated file; DO NOT EDIT.
 # Linux/arm64 6.11.0 Kernel Configuration
 #
-CONFIG_CC_VERSION_TEXT="aarch64-linux-musl-gcc (GCC) 13.2.0"
+CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (GCC) 13.2.0"
 CONFIG_CC_IS_GCC=y
 CONFIG_GCC_VERSION=130200
 CONFIG_CLANG_VERSION=0
@@ -9919,8 +9919,10 @@ CONFIG_UDMABUF=y
 # CONFIG_DMABUF_MOVE_NOTIFY is not set
 # CONFIG_DMABUF_DEBUG is not set
 # CONFIG_DMABUF_SELFTESTS is not set
-# CONFIG_DMABUF_HEAPS is not set
+CONFIG_DMABUF_HEAPS=y
 # CONFIG_DMABUF_SYSFS_STATS is not set
+CONFIG_DMABUF_HEAPS_SYSTEM=y
+CONFIG_DMABUF_HEAPS_CMA=y
 # end of DMABUF options
 
 CONFIG_UIO=m
diff --git a/srcpkgs/linux6.11/patches/x13s-camera.patch b/srcpkgs/linux6.11/patches/x13s-camera.patch
new file mode 100644
index 00000000000000..0244ca1c777061
--- /dev/null
+++ b/srcpkgs/linux6.11/patches/x13s-camera.patch
@@ -0,0 +1,105 @@
+From ce53360b46625976e3cacd0508bd781a4a1b2c0b Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Tue, 6 Aug 2024 10:45:43 +0100
+Subject: [PATCH] arm64: dts: qcom: sc8280xp-x13s: Enable RGB sensor
+
+Enable the main RGB sensor on the Lenovo x13s a five megapixel 2 lane DPHY
+MIPI sensor connected to cisphy0.
+
+With the pm8008 patches recently applied to the x13s dtsi we can now also
+enable the RGB sensor. Once done we have all upstream support necessary for
+the RGB sensor on x13s.
+
+Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/r/20240806-b4-linux-next-24-07-31-camss-sc8280xp-lenovo-rgb-v2-v3-1-199767fb193d@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 67 +++++++++++++++++++
+ 1 file changed, 67 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+index a7c5a3f5926c73..6a28cab971891d 100644
+--- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
++++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+@@ -592,6 +592,57 @@
+ 	};
+ };
+ 
++&camss {
++	vdda-phy-supply = <&vreg_l6d>;
++	vdda-pll-supply = <&vreg_l4d>;
++
++	status = "okay";
++
++	ports {
++		port@0 {
++			csiphy0_lanes01_ep: endpoint@0 {
++				reg = <0>;
++				clock-lanes = <7>;
++				data-lanes = <0 1>;
++				remote-endpoint = <&ov5675_ep>;
++			};
++		};
++	};
++};
++
++&cci2 {
++	status = "okay";
++};
++
++&cci2_i2c1 {
++	camera@10 {
++		compatible = "ovti,ov5675";
++		reg = <0x10>;
++
++		reset-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>;
++		pinctrl-names = "default";
++		pinctrl-0 = <&cam_rgb_default>;
++
++		clocks = <&camcc CAMCC_MCLK3_CLK>;
++
++		orientation = <0>;	/* Front facing */
++
++		avdd-supply = <&vreg_l6q>;
++		dvdd-supply = <&vreg_l2q>;
++		dovdd-supply = <&vreg_l7q>;
++
++		port {
++			ov5675_ep: endpoint {
++				clock-lanes = <0>;
++				data-lanes = <1 2>;
++				link-frequencies = /bits/ 64 <450000000>;
++				remote-endpoint = <&csiphy0_lanes01_ep>;
++			};
++		};
++
++	};
++};
++
+ &dispcc0 {
+ 	status = "okay";
+ };
+@@ -1436,6 +1487,22 @@
+ 		bias-disable;
+ 	};
+ 
++	cam_rgb_default: cam-rgb-default-state {
++		mclk-pins {
++			pins = "gpio17";
++			function = "cam_mclk";
++			drive-strength = <16>;
++			bias-disable;
++		};
++
++		sc-rgb-xshut-n-pins {
++			pins = "gpio15";
++			function = "gpio";
++			drive-strength = <2>;
++			bias-disable;
++		};
++	};
++
+ 	edp_reg_en: edp-reg-en-state {
+ 		pins = "gpio25";
+ 		function = "gpio";
diff --git a/srcpkgs/linux6.11/template b/srcpkgs/linux6.11/template
index 5593135e650e7d..49ba319cf341e9 100644
--- a/srcpkgs/linux6.11/template
+++ b/srcpkgs/linux6.11/template
@@ -1,6 +1,6 @@
-# Template file for 'linux6.11'.
+# Template file for 'linux6.11'
 pkgname=linux6.11
-version=6.11.0
+version=6.11.1
 revision=1
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
@@ -13,7 +13,8 @@ if [ "${version##*.}" != 0 ]; then
 	skip_extraction="patch-${version}.xz"
 fi
 
-checksum=55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+checksum="55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+ e209cd7f59dd57a6c5c3c6ce5bc7c494401a695e323e635e2a62c708c07095c0"
 python_version=3
 
 # XXX Restrict archs until a proper <arch>-dotconfig is available in FILESDIR.

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

* Re: [PR PATCH] [Updated] linux6.11: update to 6.11.1, enable x13s camera
  2024-10-01 14:01 [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera classabbyamp
@ 2024-10-01 14:23 ` classabbyamp
  2024-10-01 15:05 ` classabbyamp
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: classabbyamp @ 2024-10-01 14:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages linux6-cam
https://github.com/void-linux/void-packages/pull/52444

linux6.11: update to 6.11.1, enable x13s camera
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly** (aarch64)

still testing the patches on aarch64, haven't tested other archs

cc @duncaen

[ci skip]

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/52444.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux6-cam-52444.patch --]
[-- Type: text/x-diff, Size: 15226 bytes --]

From ccc2aedc52d28b3b597ae4d0cbd7945c0fc8c78d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 1 Oct 2024 10:00:30 -0400
Subject: [PATCH] linux6.11: update to 6.11.1, enable x13s camera

---
 srcpkgs/linux6.11/files/arm64-dotconfig     |   6 +-
 srcpkgs/linux6.11/patches/x13s-camera.patch | 333 ++++++++++++++++++++
 srcpkgs/linux6.11/template                  |   7 +-
 3 files changed, 341 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/linux6.11/patches/x13s-camera.patch

diff --git a/srcpkgs/linux6.11/files/arm64-dotconfig b/srcpkgs/linux6.11/files/arm64-dotconfig
index ee92b115673319..d7b0507e959515 100644
--- a/srcpkgs/linux6.11/files/arm64-dotconfig
+++ b/srcpkgs/linux6.11/files/arm64-dotconfig
@@ -2,7 +2,7 @@
 # Automatically generated file; DO NOT EDIT.
 # Linux/arm64 6.11.0 Kernel Configuration
 #
-CONFIG_CC_VERSION_TEXT="aarch64-linux-musl-gcc (GCC) 13.2.0"
+CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (GCC) 13.2.0"
 CONFIG_CC_IS_GCC=y
 CONFIG_GCC_VERSION=130200
 CONFIG_CLANG_VERSION=0
@@ -9919,8 +9919,10 @@ CONFIG_UDMABUF=y
 # CONFIG_DMABUF_MOVE_NOTIFY is not set
 # CONFIG_DMABUF_DEBUG is not set
 # CONFIG_DMABUF_SELFTESTS is not set
-# CONFIG_DMABUF_HEAPS is not set
+CONFIG_DMABUF_HEAPS=y
 # CONFIG_DMABUF_SYSFS_STATS is not set
+CONFIG_DMABUF_HEAPS_SYSTEM=y
+CONFIG_DMABUF_HEAPS_CMA=y
 # end of DMABUF options
 
 CONFIG_UIO=m
diff --git a/srcpkgs/linux6.11/patches/x13s-camera.patch b/srcpkgs/linux6.11/patches/x13s-camera.patch
new file mode 100644
index 00000000000000..e971c13bcf2bb7
--- /dev/null
+++ b/srcpkgs/linux6.11/patches/x13s-camera.patch
@@ -0,0 +1,333 @@
+From ce53360b46625976e3cacd0508bd781a4a1b2c0b Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Tue, 6 Aug 2024 10:45:43 +0100
+Subject: [PATCH] arm64: dts: qcom: sc8280xp-x13s: Enable RGB sensor
+
+Enable the main RGB sensor on the Lenovo x13s a five megapixel 2 lane DPHY
+MIPI sensor connected to cisphy0.
+
+With the pm8008 patches recently applied to the x13s dtsi we can now also
+enable the RGB sensor. Once done we have all upstream support necessary for
+the RGB sensor on x13s.
+
+Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/r/20240806-b4-linux-next-24-07-31-camss-sc8280xp-lenovo-rgb-v2-v3-1-199767fb193d@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 67 +++++++++++++++++++
+ 1 file changed, 67 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+index a7c5a3f5926c73..6a28cab971891d 100644
+--- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
++++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+@@ -592,6 +592,57 @@
+ 	};
+ };
+ 
++&camss {
++	vdda-phy-supply = <&vreg_l6d>;
++	vdda-pll-supply = <&vreg_l4d>;
++
++	status = "okay";
++
++	ports {
++		port@0 {
++			csiphy0_lanes01_ep: endpoint@0 {
++				reg = <0>;
++				clock-lanes = <7>;
++				data-lanes = <0 1>;
++				remote-endpoint = <&ov5675_ep>;
++			};
++		};
++	};
++};
++
++&cci2 {
++	status = "okay";
++};
++
++&cci2_i2c1 {
++	camera@10 {
++		compatible = "ovti,ov5675";
++		reg = <0x10>;
++
++		reset-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>;
++		pinctrl-names = "default";
++		pinctrl-0 = <&cam_rgb_default>;
++
++		clocks = <&camcc CAMCC_MCLK3_CLK>;
++
++		orientation = <0>;	/* Front facing */
++
++		avdd-supply = <&vreg_l6q>;
++		dvdd-supply = <&vreg_l2q>;
++		dovdd-supply = <&vreg_l7q>;
++
++		port {
++			ov5675_ep: endpoint {
++				clock-lanes = <0>;
++				data-lanes = <1 2>;
++				link-frequencies = /bits/ 64 <450000000>;
++				remote-endpoint = <&csiphy0_lanes01_ep>;
++			};
++		};
++
++	};
++};
++
+ &dispcc0 {
+ 	status = "okay";
+ };
+@@ -1436,6 +1487,22 @@
+ 		bias-disable;
+ 	};
+ 
++	cam_rgb_default: cam-rgb-default-state {
++		mclk-pins {
++			pins = "gpio17";
++			function = "cam_mclk";
++			drive-strength = <16>;
++			bias-disable;
++		};
++
++		sc-rgb-xshut-n-pins {
++			pins = "gpio15";
++			function = "gpio";
++			drive-strength = <2>;
++			bias-disable;
++		};
++	};
++
+ 	edp_reg_en: edp-reg-en-state {
+ 		pins = "gpio25";
+ 		function = "gpio";
+
+From cf9d67be324a1c3b025ea5a7d9bd2c70036d6635 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 29 Jul 2024 13:42:02 +0100
+Subject: [PATCH] media: qcom: camss: Remove use_count guard in stop_streaming
+
+The use_count check was introduced so that multiple concurrent Raw Data
+Interfaces RDIs could be driven by different virtual channels VCs on the
+CSIPHY input driving the video pipeline.
+
+This is an invalid use of use_count though as use_count pertains to the
+number of times a video entity has been opened by user-space not the number
+of active streams.
+
+If use_count and stream-on count don't agree then stop_streaming() will
+break as is currently the case and has become apparent when using CAMSS
+with libcamera's released softisp 0.3.
+
+The use of use_count like this is a bit hacky and right now breaks regular
+usage of CAMSS for a single stream case. Stopping qcam results in the splat
+below, and then it cannot be started again and any attempts to do so fails
+with -EBUSY.
+
+[ 1265.509831] WARNING: CPU: 5 PID: 919 at drivers/media/common/videobuf2/videobuf2-core.c:2183 __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common]
+...
+[ 1265.510630] Call trace:
+[ 1265.510636]  __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common]
+[ 1265.510648]  vb2_core_streamoff+0x24/0xcc [videobuf2_common]
+[ 1265.510660]  vb2_ioctl_streamoff+0x5c/0xa8 [videobuf2_v4l2]
+[ 1265.510673]  v4l_streamoff+0x24/0x30 [videodev]
+[ 1265.510707]  __video_do_ioctl+0x190/0x3f4 [videodev]
+[ 1265.510732]  video_usercopy+0x304/0x8c4 [videodev]
+[ 1265.510757]  video_ioctl2+0x18/0x34 [videodev]
+[ 1265.510782]  v4l2_ioctl+0x40/0x60 [videodev]
+...
+[ 1265.510944] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 0 in active state
+[ 1265.511175] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 1 in active state
+[ 1265.511398] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 2 in active st
+
+One CAMSS specific way to handle multiple VCs on the same RDI might be:
+
+- Reference count each pipeline enable for CSIPHY, CSID, VFE and RDIx.
+- The video buffers are already associated with msm_vfeN_rdiX so
+  release video buffers when told to do so by stop_streaming.
+- Only release the power-domains for the CSIPHY, CSID and VFE when
+  their internal refcounts drop.
+
+Either way refusing to release video buffers based on use_count is
+erroneous and should be reverted. The silicon enabling code for selecting
+VCs is perfectly fine. Its a "known missing feature" that concurrent VCs
+won't work with CAMSS right now.
+
+Initial testing with this code didn't show an error but, SoftISP and "real"
+usage with Google Hangouts breaks the upstream code pretty quickly, we need
+to do a partial revert and take another pass at VCs.
+
+This commit partially reverts commit 89013969e232 ("media: camss: sm8250:
+Pipeline starting and stopping for multiple virtual channels")
+
+Fixes: 89013969e232 ("media: camss: sm8250: Pipeline starting and stopping for multiple virtual channels")
+Reported-by: Johan Hovold <johan+linaro@kernel.org>
+Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Tested-by: Johan Hovold <johan+linaro@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Link: https://lore.kernel.org/r/20240729-linux-next-24-07-13-camss-fixes-v3-1-38235dc782c7@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/platform/qcom/camss/camss-video.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
+index cd72feca618ca4..3b8fc31d957c77 100644
+--- a/drivers/media/platform/qcom/camss/camss-video.c
++++ b/drivers/media/platform/qcom/camss/camss-video.c
+@@ -297,12 +297,6 @@ static void video_stop_streaming(struct vb2_queue *q)
+ 
+ 		ret = v4l2_subdev_call(subdev, video, s_stream, 0);
+ 
+-		if (entity->use_count > 1) {
+-			/* Don't stop if other instances of the pipeline are still running */
+-			dev_dbg(video->camss->dev, "Video pipeline still used, don't stop streaming.\n");
+-			return;
+-		}
+-
+ 		if (ret) {
+ 			dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret);
+ 			return;
+
+From 8f15c04d37a94e7f78e16c32d332489581099712 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 29 Jul 2024 13:42:03 +0100
+Subject: [PATCH] media: qcom: camss: Fix ordering of pm_runtime_enable
+
+pm_runtime_enable() should happen prior to vfe_get() since vfe_get() calls
+pm_runtime_resume_and_get().
+
+This is a basic race condition that doesn't show up for most users so is
+not widely reported. If you blacklist qcom-camss in modules.d and then
+subsequently modprobe the module post-boot it is possible to reliably show
+this error up.
+
+The kernel log for this error looks like this:
+
+qcom-camss ac5a000.camss: Failed to power up pipeline: -13
+
+Fixes: 02afa816dbbf ("media: camss: Add basic runtime PM support")
+Reported-by: Johan Hovold <johan+linaro@kernel.org>
+Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Tested-by: Johan Hovold <johan+linaro@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Link: https://lore.kernel.org/r/20240729-linux-next-24-07-13-camss-fixes-v3-2-38235dc782c7@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/platform/qcom/camss/camss.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
+index 51b1d3550421a4..d64985ca6e884f 100644
+--- a/drivers/media/platform/qcom/camss/camss.c
++++ b/drivers/media/platform/qcom/camss/camss.c
+@@ -2283,6 +2283,8 @@ static int camss_probe(struct platform_device *pdev)
+ 
+ 	v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev);
+ 
++	pm_runtime_enable(dev);
++
+ 	num_subdevs = camss_of_parse_ports(camss);
+ 	if (num_subdevs < 0) {
+ 		ret = num_subdevs;
+@@ -2323,8 +2325,6 @@ static int camss_probe(struct platform_device *pdev)
+ 		}
+ 	}
+ 
+-	pm_runtime_enable(dev);
+-
+ 	return 0;
+ 
+ err_register_subdevs:
+@@ -2332,6 +2332,7 @@ static int camss_probe(struct platform_device *pdev)
+ err_v4l2_device_unregister:
+ 	v4l2_device_unregister(&camss->v4l2_dev);
+ 	v4l2_async_nf_cleanup(&camss->notifier);
++	pm_runtime_disable(dev);
+ err_genpd_cleanup:
+ 	camss_genpd_cleanup(camss);
+ 
+From 6abbc57534f97fee63e7b43875c8b415eb8f6787 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Sat, 13 Jul 2024 23:33:29 +0100
+Subject: [PATCH] media: ov5675: Fix power on/off delay timings
+
+The ov5675 specification says that the gap between XSHUTDN deassert and the
+first I2C transaction should be a minimum of 8192 XVCLK cycles.
+
+Right now we use a usleep_rage() that gives a sleep time of between about
+430 and 860 microseconds.
+
+On the Lenovo X13s we have observed that in about 1/20 cases the current
+timing is too tight and we start transacting before the ov5675's reset
+cycle completes, leading to I2C bus transaction failures.
+
+The reset racing is sometimes triggered at initial chip probe but, more
+usually on a subsequent power-off/power-on cycle e.g.
+
+[   71.451662] ov5675 24-0010: failed to write reg 0x0103. error = -5
+[   71.451686] ov5675 24-0010: failed to set plls
+
+The current quiescence period we have is too tight. Instead of expressing
+the post reset delay in terms of the current XVCLK this patch converts the
+power-on and power-off delays to the maximum theoretical delay @ 6 MHz with
+an additional buffer.
+
+1.365 milliseconds on the power-on path is 1.5 milliseconds with grace.
+85.3 microseconds on the power-off path is 90 microseconds with grace.
+
+Fixes: 49d9ad719e89 ("media: ov5675: add device-tree support and support runtime PM")
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/r/20240713-linux-next-ov5675-v3-1-527f5b985836@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/i2c/ov5675.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c
+index 3641911bc73f68..5b5127f8953ff4 100644
+--- a/drivers/media/i2c/ov5675.c
++++ b/drivers/media/i2c/ov5675.c
+@@ -972,12 +972,10 @@ static int ov5675_set_stream(struct v4l2_subdev *sd, int enable)
+ 
+ static int ov5675_power_off(struct device *dev)
+ {
+-	/* 512 xvclk cycles after the last SCCB transation or MIPI frame end */
+-	u32 delay_us = DIV_ROUND_UP(512, OV5675_XVCLK_19_2 / 1000 / 1000);
+ 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ 	struct ov5675 *ov5675 = to_ov5675(sd);
+ 
+-	usleep_range(delay_us, delay_us * 2);
++	usleep_range(90, 100);
+ 
+ 	clk_disable_unprepare(ov5675->xvclk);
+ 	gpiod_set_value_cansleep(ov5675->reset_gpio, 1);
+@@ -988,7 +986,6 @@ static int ov5675_power_off(struct device *dev)
+ 
+ static int ov5675_power_on(struct device *dev)
+ {
+-	u32 delay_us = DIV_ROUND_UP(8192, OV5675_XVCLK_19_2 / 1000 / 1000);
+ 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ 	struct ov5675 *ov5675 = to_ov5675(sd);
+ 	int ret;
+@@ -1014,8 +1011,11 @@ static int ov5675_power_on(struct device *dev)
+ 
+ 	gpiod_set_value_cansleep(ov5675->reset_gpio, 0);
+ 
+-	/* 8192 xvclk cycles prior to the first SCCB transation */
+-	usleep_range(delay_us, delay_us * 2);
++	/* Worst case quiesence gap is 1.365 milliseconds @ 6MHz XVCLK
++	 * Add an additional threshold grace period to ensure reset
++	 * completion before initiating our first I2C transaction.
++	 */
++	usleep_range(1500, 1600);
+ 
+ 	return 0;
+ }
diff --git a/srcpkgs/linux6.11/template b/srcpkgs/linux6.11/template
index 5593135e650e7d..49ba319cf341e9 100644
--- a/srcpkgs/linux6.11/template
+++ b/srcpkgs/linux6.11/template
@@ -1,6 +1,6 @@
-# Template file for 'linux6.11'.
+# Template file for 'linux6.11'
 pkgname=linux6.11
-version=6.11.0
+version=6.11.1
 revision=1
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
@@ -13,7 +13,8 @@ if [ "${version##*.}" != 0 ]; then
 	skip_extraction="patch-${version}.xz"
 fi
 
-checksum=55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+checksum="55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+ e209cd7f59dd57a6c5c3c6ce5bc7c494401a695e323e635e2a62c708c07095c0"
 python_version=3
 
 # XXX Restrict archs until a proper <arch>-dotconfig is available in FILESDIR.

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

* Re: [PR PATCH] [Updated] linux6.11: update to 6.11.1, enable x13s camera
  2024-10-01 14:01 [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera classabbyamp
  2024-10-01 14:23 ` [PR PATCH] [Updated] " classabbyamp
@ 2024-10-01 15:05 ` classabbyamp
  2024-10-01 15:08 ` classabbyamp
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: classabbyamp @ 2024-10-01 15:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages linux6-cam
https://github.com/void-linux/void-packages/pull/52444

linux6.11: update to 6.11.1, enable x13s camera
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly** (aarch64)

still testing the patches on aarch64, haven't tested other archs

cc @duncaen

[ci skip]

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/52444.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux6-cam-52444.patch --]
[-- Type: text/x-diff, Size: 15807 bytes --]

From e65cb9aa964db1647d228e8a1827734914433e0b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 1 Oct 2024 10:00:30 -0400
Subject: [PATCH] linux6.11: update to 6.11.1, enable x13s camera

---
 srcpkgs/linux6.11/files/arm64-dotconfig     |  10 +-
 srcpkgs/linux6.11/patches/x13s-camera.patch | 333 ++++++++++++++++++++
 srcpkgs/linux6.11/template                  |   7 +-
 3 files changed, 343 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/linux6.11/patches/x13s-camera.patch

diff --git a/srcpkgs/linux6.11/files/arm64-dotconfig b/srcpkgs/linux6.11/files/arm64-dotconfig
index ee92b115673319..4717ef810c9a20 100644
--- a/srcpkgs/linux6.11/files/arm64-dotconfig
+++ b/srcpkgs/linux6.11/files/arm64-dotconfig
@@ -2,7 +2,7 @@
 # Automatically generated file; DO NOT EDIT.
 # Linux/arm64 6.11.0 Kernel Configuration
 #
-CONFIG_CC_VERSION_TEXT="aarch64-linux-musl-gcc (GCC) 13.2.0"
+CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (GCC) 13.2.0"
 CONFIG_CC_IS_GCC=y
 CONFIG_GCC_VERSION=130200
 CONFIG_CLANG_VERSION=0
@@ -6412,7 +6412,7 @@ CONFIG_REGULATOR_PF8X00=m
 # CONFIG_REGULATOR_PV88080 is not set
 # CONFIG_REGULATOR_PV88090 is not set
 CONFIG_REGULATOR_PWM=m
-# CONFIG_REGULATOR_QCOM_PM8008 is not set
+CONFIG_REGULATOR_QCOM_PM8008=m
 # CONFIG_REGULATOR_QCOM_REFGEN is not set
 CONFIG_REGULATOR_QCOM_RPM=m
 CONFIG_REGULATOR_QCOM_RPMH=m
@@ -9919,8 +9919,10 @@ CONFIG_UDMABUF=y
 # CONFIG_DMABUF_MOVE_NOTIFY is not set
 # CONFIG_DMABUF_DEBUG is not set
 # CONFIG_DMABUF_SELFTESTS is not set
-# CONFIG_DMABUF_HEAPS is not set
+CONFIG_DMABUF_HEAPS=y
 # CONFIG_DMABUF_SYSFS_STATS is not set
+CONFIG_DMABUF_HEAPS_SYSTEM=y
+CONFIG_DMABUF_HEAPS_CMA=y
 # end of DMABUF options
 
 CONFIG_UIO=m
@@ -13138,7 +13140,7 @@ CONFIG_DMA_CMA=y
 #
 # Default contiguous memory area size:
 #
-CONFIG_CMA_SIZE_MBYTES=0
+CONFIG_CMA_SIZE_MBYTES=128
 CONFIG_CMA_SIZE_SEL_MBYTES=y
 # CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
 # CONFIG_CMA_SIZE_SEL_MIN is not set
diff --git a/srcpkgs/linux6.11/patches/x13s-camera.patch b/srcpkgs/linux6.11/patches/x13s-camera.patch
new file mode 100644
index 00000000000000..e971c13bcf2bb7
--- /dev/null
+++ b/srcpkgs/linux6.11/patches/x13s-camera.patch
@@ -0,0 +1,333 @@
+From ce53360b46625976e3cacd0508bd781a4a1b2c0b Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Tue, 6 Aug 2024 10:45:43 +0100
+Subject: [PATCH] arm64: dts: qcom: sc8280xp-x13s: Enable RGB sensor
+
+Enable the main RGB sensor on the Lenovo x13s a five megapixel 2 lane DPHY
+MIPI sensor connected to cisphy0.
+
+With the pm8008 patches recently applied to the x13s dtsi we can now also
+enable the RGB sensor. Once done we have all upstream support necessary for
+the RGB sensor on x13s.
+
+Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/r/20240806-b4-linux-next-24-07-31-camss-sc8280xp-lenovo-rgb-v2-v3-1-199767fb193d@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 67 +++++++++++++++++++
+ 1 file changed, 67 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+index a7c5a3f5926c73..6a28cab971891d 100644
+--- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
++++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+@@ -592,6 +592,57 @@
+ 	};
+ };
+ 
++&camss {
++	vdda-phy-supply = <&vreg_l6d>;
++	vdda-pll-supply = <&vreg_l4d>;
++
++	status = "okay";
++
++	ports {
++		port@0 {
++			csiphy0_lanes01_ep: endpoint@0 {
++				reg = <0>;
++				clock-lanes = <7>;
++				data-lanes = <0 1>;
++				remote-endpoint = <&ov5675_ep>;
++			};
++		};
++	};
++};
++
++&cci2 {
++	status = "okay";
++};
++
++&cci2_i2c1 {
++	camera@10 {
++		compatible = "ovti,ov5675";
++		reg = <0x10>;
++
++		reset-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>;
++		pinctrl-names = "default";
++		pinctrl-0 = <&cam_rgb_default>;
++
++		clocks = <&camcc CAMCC_MCLK3_CLK>;
++
++		orientation = <0>;	/* Front facing */
++
++		avdd-supply = <&vreg_l6q>;
++		dvdd-supply = <&vreg_l2q>;
++		dovdd-supply = <&vreg_l7q>;
++
++		port {
++			ov5675_ep: endpoint {
++				clock-lanes = <0>;
++				data-lanes = <1 2>;
++				link-frequencies = /bits/ 64 <450000000>;
++				remote-endpoint = <&csiphy0_lanes01_ep>;
++			};
++		};
++
++	};
++};
++
+ &dispcc0 {
+ 	status = "okay";
+ };
+@@ -1436,6 +1487,22 @@
+ 		bias-disable;
+ 	};
+ 
++	cam_rgb_default: cam-rgb-default-state {
++		mclk-pins {
++			pins = "gpio17";
++			function = "cam_mclk";
++			drive-strength = <16>;
++			bias-disable;
++		};
++
++		sc-rgb-xshut-n-pins {
++			pins = "gpio15";
++			function = "gpio";
++			drive-strength = <2>;
++			bias-disable;
++		};
++	};
++
+ 	edp_reg_en: edp-reg-en-state {
+ 		pins = "gpio25";
+ 		function = "gpio";
+
+From cf9d67be324a1c3b025ea5a7d9bd2c70036d6635 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 29 Jul 2024 13:42:02 +0100
+Subject: [PATCH] media: qcom: camss: Remove use_count guard in stop_streaming
+
+The use_count check was introduced so that multiple concurrent Raw Data
+Interfaces RDIs could be driven by different virtual channels VCs on the
+CSIPHY input driving the video pipeline.
+
+This is an invalid use of use_count though as use_count pertains to the
+number of times a video entity has been opened by user-space not the number
+of active streams.
+
+If use_count and stream-on count don't agree then stop_streaming() will
+break as is currently the case and has become apparent when using CAMSS
+with libcamera's released softisp 0.3.
+
+The use of use_count like this is a bit hacky and right now breaks regular
+usage of CAMSS for a single stream case. Stopping qcam results in the splat
+below, and then it cannot be started again and any attempts to do so fails
+with -EBUSY.
+
+[ 1265.509831] WARNING: CPU: 5 PID: 919 at drivers/media/common/videobuf2/videobuf2-core.c:2183 __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common]
+...
+[ 1265.510630] Call trace:
+[ 1265.510636]  __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common]
+[ 1265.510648]  vb2_core_streamoff+0x24/0xcc [videobuf2_common]
+[ 1265.510660]  vb2_ioctl_streamoff+0x5c/0xa8 [videobuf2_v4l2]
+[ 1265.510673]  v4l_streamoff+0x24/0x30 [videodev]
+[ 1265.510707]  __video_do_ioctl+0x190/0x3f4 [videodev]
+[ 1265.510732]  video_usercopy+0x304/0x8c4 [videodev]
+[ 1265.510757]  video_ioctl2+0x18/0x34 [videodev]
+[ 1265.510782]  v4l2_ioctl+0x40/0x60 [videodev]
+...
+[ 1265.510944] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 0 in active state
+[ 1265.511175] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 1 in active state
+[ 1265.511398] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 2 in active st
+
+One CAMSS specific way to handle multiple VCs on the same RDI might be:
+
+- Reference count each pipeline enable for CSIPHY, CSID, VFE and RDIx.
+- The video buffers are already associated with msm_vfeN_rdiX so
+  release video buffers when told to do so by stop_streaming.
+- Only release the power-domains for the CSIPHY, CSID and VFE when
+  their internal refcounts drop.
+
+Either way refusing to release video buffers based on use_count is
+erroneous and should be reverted. The silicon enabling code for selecting
+VCs is perfectly fine. Its a "known missing feature" that concurrent VCs
+won't work with CAMSS right now.
+
+Initial testing with this code didn't show an error but, SoftISP and "real"
+usage with Google Hangouts breaks the upstream code pretty quickly, we need
+to do a partial revert and take another pass at VCs.
+
+This commit partially reverts commit 89013969e232 ("media: camss: sm8250:
+Pipeline starting and stopping for multiple virtual channels")
+
+Fixes: 89013969e232 ("media: camss: sm8250: Pipeline starting and stopping for multiple virtual channels")
+Reported-by: Johan Hovold <johan+linaro@kernel.org>
+Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Tested-by: Johan Hovold <johan+linaro@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Link: https://lore.kernel.org/r/20240729-linux-next-24-07-13-camss-fixes-v3-1-38235dc782c7@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/platform/qcom/camss/camss-video.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
+index cd72feca618ca4..3b8fc31d957c77 100644
+--- a/drivers/media/platform/qcom/camss/camss-video.c
++++ b/drivers/media/platform/qcom/camss/camss-video.c
+@@ -297,12 +297,6 @@ static void video_stop_streaming(struct vb2_queue *q)
+ 
+ 		ret = v4l2_subdev_call(subdev, video, s_stream, 0);
+ 
+-		if (entity->use_count > 1) {
+-			/* Don't stop if other instances of the pipeline are still running */
+-			dev_dbg(video->camss->dev, "Video pipeline still used, don't stop streaming.\n");
+-			return;
+-		}
+-
+ 		if (ret) {
+ 			dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret);
+ 			return;
+
+From 8f15c04d37a94e7f78e16c32d332489581099712 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 29 Jul 2024 13:42:03 +0100
+Subject: [PATCH] media: qcom: camss: Fix ordering of pm_runtime_enable
+
+pm_runtime_enable() should happen prior to vfe_get() since vfe_get() calls
+pm_runtime_resume_and_get().
+
+This is a basic race condition that doesn't show up for most users so is
+not widely reported. If you blacklist qcom-camss in modules.d and then
+subsequently modprobe the module post-boot it is possible to reliably show
+this error up.
+
+The kernel log for this error looks like this:
+
+qcom-camss ac5a000.camss: Failed to power up pipeline: -13
+
+Fixes: 02afa816dbbf ("media: camss: Add basic runtime PM support")
+Reported-by: Johan Hovold <johan+linaro@kernel.org>
+Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Tested-by: Johan Hovold <johan+linaro@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Link: https://lore.kernel.org/r/20240729-linux-next-24-07-13-camss-fixes-v3-2-38235dc782c7@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/platform/qcom/camss/camss.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
+index 51b1d3550421a4..d64985ca6e884f 100644
+--- a/drivers/media/platform/qcom/camss/camss.c
++++ b/drivers/media/platform/qcom/camss/camss.c
+@@ -2283,6 +2283,8 @@ static int camss_probe(struct platform_device *pdev)
+ 
+ 	v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev);
+ 
++	pm_runtime_enable(dev);
++
+ 	num_subdevs = camss_of_parse_ports(camss);
+ 	if (num_subdevs < 0) {
+ 		ret = num_subdevs;
+@@ -2323,8 +2325,6 @@ static int camss_probe(struct platform_device *pdev)
+ 		}
+ 	}
+ 
+-	pm_runtime_enable(dev);
+-
+ 	return 0;
+ 
+ err_register_subdevs:
+@@ -2332,6 +2332,7 @@ static int camss_probe(struct platform_device *pdev)
+ err_v4l2_device_unregister:
+ 	v4l2_device_unregister(&camss->v4l2_dev);
+ 	v4l2_async_nf_cleanup(&camss->notifier);
++	pm_runtime_disable(dev);
+ err_genpd_cleanup:
+ 	camss_genpd_cleanup(camss);
+ 
+From 6abbc57534f97fee63e7b43875c8b415eb8f6787 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Sat, 13 Jul 2024 23:33:29 +0100
+Subject: [PATCH] media: ov5675: Fix power on/off delay timings
+
+The ov5675 specification says that the gap between XSHUTDN deassert and the
+first I2C transaction should be a minimum of 8192 XVCLK cycles.
+
+Right now we use a usleep_rage() that gives a sleep time of between about
+430 and 860 microseconds.
+
+On the Lenovo X13s we have observed that in about 1/20 cases the current
+timing is too tight and we start transacting before the ov5675's reset
+cycle completes, leading to I2C bus transaction failures.
+
+The reset racing is sometimes triggered at initial chip probe but, more
+usually on a subsequent power-off/power-on cycle e.g.
+
+[   71.451662] ov5675 24-0010: failed to write reg 0x0103. error = -5
+[   71.451686] ov5675 24-0010: failed to set plls
+
+The current quiescence period we have is too tight. Instead of expressing
+the post reset delay in terms of the current XVCLK this patch converts the
+power-on and power-off delays to the maximum theoretical delay @ 6 MHz with
+an additional buffer.
+
+1.365 milliseconds on the power-on path is 1.5 milliseconds with grace.
+85.3 microseconds on the power-off path is 90 microseconds with grace.
+
+Fixes: 49d9ad719e89 ("media: ov5675: add device-tree support and support runtime PM")
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/r/20240713-linux-next-ov5675-v3-1-527f5b985836@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/i2c/ov5675.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c
+index 3641911bc73f68..5b5127f8953ff4 100644
+--- a/drivers/media/i2c/ov5675.c
++++ b/drivers/media/i2c/ov5675.c
+@@ -972,12 +972,10 @@ static int ov5675_set_stream(struct v4l2_subdev *sd, int enable)
+ 
+ static int ov5675_power_off(struct device *dev)
+ {
+-	/* 512 xvclk cycles after the last SCCB transation or MIPI frame end */
+-	u32 delay_us = DIV_ROUND_UP(512, OV5675_XVCLK_19_2 / 1000 / 1000);
+ 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ 	struct ov5675 *ov5675 = to_ov5675(sd);
+ 
+-	usleep_range(delay_us, delay_us * 2);
++	usleep_range(90, 100);
+ 
+ 	clk_disable_unprepare(ov5675->xvclk);
+ 	gpiod_set_value_cansleep(ov5675->reset_gpio, 1);
+@@ -988,7 +986,6 @@ static int ov5675_power_off(struct device *dev)
+ 
+ static int ov5675_power_on(struct device *dev)
+ {
+-	u32 delay_us = DIV_ROUND_UP(8192, OV5675_XVCLK_19_2 / 1000 / 1000);
+ 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ 	struct ov5675 *ov5675 = to_ov5675(sd);
+ 	int ret;
+@@ -1014,8 +1011,11 @@ static int ov5675_power_on(struct device *dev)
+ 
+ 	gpiod_set_value_cansleep(ov5675->reset_gpio, 0);
+ 
+-	/* 8192 xvclk cycles prior to the first SCCB transation */
+-	usleep_range(delay_us, delay_us * 2);
++	/* Worst case quiesence gap is 1.365 milliseconds @ 6MHz XVCLK
++	 * Add an additional threshold grace period to ensure reset
++	 * completion before initiating our first I2C transaction.
++	 */
++	usleep_range(1500, 1600);
+ 
+ 	return 0;
+ }
diff --git a/srcpkgs/linux6.11/template b/srcpkgs/linux6.11/template
index 5593135e650e7d..49ba319cf341e9 100644
--- a/srcpkgs/linux6.11/template
+++ b/srcpkgs/linux6.11/template
@@ -1,6 +1,6 @@
-# Template file for 'linux6.11'.
+# Template file for 'linux6.11'
 pkgname=linux6.11
-version=6.11.0
+version=6.11.1
 revision=1
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
@@ -13,7 +13,8 @@ if [ "${version##*.}" != 0 ]; then
 	skip_extraction="patch-${version}.xz"
 fi
 
-checksum=55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+checksum="55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+ e209cd7f59dd57a6c5c3c6ce5bc7c494401a695e323e635e2a62c708c07095c0"
 python_version=3
 
 # XXX Restrict archs until a proper <arch>-dotconfig is available in FILESDIR.

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

* Re: [PR PATCH] [Updated] linux6.11: update to 6.11.1, enable x13s camera
  2024-10-01 14:01 [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera classabbyamp
  2024-10-01 14:23 ` [PR PATCH] [Updated] " classabbyamp
  2024-10-01 15:05 ` classabbyamp
@ 2024-10-01 15:08 ` classabbyamp
  2024-10-01 22:18 ` classabbyamp
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: classabbyamp @ 2024-10-01 15:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages linux6-cam
https://github.com/void-linux/void-packages/pull/52444

linux6.11: update to 6.11.1, enable x13s camera
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly** (aarch64)

still testing the patches on aarch64, haven't tested other archs

cc @duncaen

[ci skip]

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/52444.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux6-cam-52444.patch --]
[-- Type: text/x-diff, Size: 17653 bytes --]

From e65cb9aa964db1647d228e8a1827734914433e0b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 1 Oct 2024 10:00:30 -0400
Subject: [PATCH 1/2] linux6.11: update to 6.11.1, enable x13s camera

---
 srcpkgs/linux6.11/files/arm64-dotconfig     |  10 +-
 srcpkgs/linux6.11/patches/x13s-camera.patch | 333 ++++++++++++++++++++
 srcpkgs/linux6.11/template                  |   7 +-
 3 files changed, 343 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/linux6.11/patches/x13s-camera.patch

diff --git a/srcpkgs/linux6.11/files/arm64-dotconfig b/srcpkgs/linux6.11/files/arm64-dotconfig
index ee92b115673319..4717ef810c9a20 100644
--- a/srcpkgs/linux6.11/files/arm64-dotconfig
+++ b/srcpkgs/linux6.11/files/arm64-dotconfig
@@ -2,7 +2,7 @@
 # Automatically generated file; DO NOT EDIT.
 # Linux/arm64 6.11.0 Kernel Configuration
 #
-CONFIG_CC_VERSION_TEXT="aarch64-linux-musl-gcc (GCC) 13.2.0"
+CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (GCC) 13.2.0"
 CONFIG_CC_IS_GCC=y
 CONFIG_GCC_VERSION=130200
 CONFIG_CLANG_VERSION=0
@@ -6412,7 +6412,7 @@ CONFIG_REGULATOR_PF8X00=m
 # CONFIG_REGULATOR_PV88080 is not set
 # CONFIG_REGULATOR_PV88090 is not set
 CONFIG_REGULATOR_PWM=m
-# CONFIG_REGULATOR_QCOM_PM8008 is not set
+CONFIG_REGULATOR_QCOM_PM8008=m
 # CONFIG_REGULATOR_QCOM_REFGEN is not set
 CONFIG_REGULATOR_QCOM_RPM=m
 CONFIG_REGULATOR_QCOM_RPMH=m
@@ -9919,8 +9919,10 @@ CONFIG_UDMABUF=y
 # CONFIG_DMABUF_MOVE_NOTIFY is not set
 # CONFIG_DMABUF_DEBUG is not set
 # CONFIG_DMABUF_SELFTESTS is not set
-# CONFIG_DMABUF_HEAPS is not set
+CONFIG_DMABUF_HEAPS=y
 # CONFIG_DMABUF_SYSFS_STATS is not set
+CONFIG_DMABUF_HEAPS_SYSTEM=y
+CONFIG_DMABUF_HEAPS_CMA=y
 # end of DMABUF options
 
 CONFIG_UIO=m
@@ -13138,7 +13140,7 @@ CONFIG_DMA_CMA=y
 #
 # Default contiguous memory area size:
 #
-CONFIG_CMA_SIZE_MBYTES=0
+CONFIG_CMA_SIZE_MBYTES=128
 CONFIG_CMA_SIZE_SEL_MBYTES=y
 # CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
 # CONFIG_CMA_SIZE_SEL_MIN is not set
diff --git a/srcpkgs/linux6.11/patches/x13s-camera.patch b/srcpkgs/linux6.11/patches/x13s-camera.patch
new file mode 100644
index 00000000000000..e971c13bcf2bb7
--- /dev/null
+++ b/srcpkgs/linux6.11/patches/x13s-camera.patch
@@ -0,0 +1,333 @@
+From ce53360b46625976e3cacd0508bd781a4a1b2c0b Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Tue, 6 Aug 2024 10:45:43 +0100
+Subject: [PATCH] arm64: dts: qcom: sc8280xp-x13s: Enable RGB sensor
+
+Enable the main RGB sensor on the Lenovo x13s a five megapixel 2 lane DPHY
+MIPI sensor connected to cisphy0.
+
+With the pm8008 patches recently applied to the x13s dtsi we can now also
+enable the RGB sensor. Once done we have all upstream support necessary for
+the RGB sensor on x13s.
+
+Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/r/20240806-b4-linux-next-24-07-31-camss-sc8280xp-lenovo-rgb-v2-v3-1-199767fb193d@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 67 +++++++++++++++++++
+ 1 file changed, 67 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+index a7c5a3f5926c73..6a28cab971891d 100644
+--- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
++++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+@@ -592,6 +592,57 @@
+ 	};
+ };
+ 
++&camss {
++	vdda-phy-supply = <&vreg_l6d>;
++	vdda-pll-supply = <&vreg_l4d>;
++
++	status = "okay";
++
++	ports {
++		port@0 {
++			csiphy0_lanes01_ep: endpoint@0 {
++				reg = <0>;
++				clock-lanes = <7>;
++				data-lanes = <0 1>;
++				remote-endpoint = <&ov5675_ep>;
++			};
++		};
++	};
++};
++
++&cci2 {
++	status = "okay";
++};
++
++&cci2_i2c1 {
++	camera@10 {
++		compatible = "ovti,ov5675";
++		reg = <0x10>;
++
++		reset-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>;
++		pinctrl-names = "default";
++		pinctrl-0 = <&cam_rgb_default>;
++
++		clocks = <&camcc CAMCC_MCLK3_CLK>;
++
++		orientation = <0>;	/* Front facing */
++
++		avdd-supply = <&vreg_l6q>;
++		dvdd-supply = <&vreg_l2q>;
++		dovdd-supply = <&vreg_l7q>;
++
++		port {
++			ov5675_ep: endpoint {
++				clock-lanes = <0>;
++				data-lanes = <1 2>;
++				link-frequencies = /bits/ 64 <450000000>;
++				remote-endpoint = <&csiphy0_lanes01_ep>;
++			};
++		};
++
++	};
++};
++
+ &dispcc0 {
+ 	status = "okay";
+ };
+@@ -1436,6 +1487,22 @@
+ 		bias-disable;
+ 	};
+ 
++	cam_rgb_default: cam-rgb-default-state {
++		mclk-pins {
++			pins = "gpio17";
++			function = "cam_mclk";
++			drive-strength = <16>;
++			bias-disable;
++		};
++
++		sc-rgb-xshut-n-pins {
++			pins = "gpio15";
++			function = "gpio";
++			drive-strength = <2>;
++			bias-disable;
++		};
++	};
++
+ 	edp_reg_en: edp-reg-en-state {
+ 		pins = "gpio25";
+ 		function = "gpio";
+
+From cf9d67be324a1c3b025ea5a7d9bd2c70036d6635 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 29 Jul 2024 13:42:02 +0100
+Subject: [PATCH] media: qcom: camss: Remove use_count guard in stop_streaming
+
+The use_count check was introduced so that multiple concurrent Raw Data
+Interfaces RDIs could be driven by different virtual channels VCs on the
+CSIPHY input driving the video pipeline.
+
+This is an invalid use of use_count though as use_count pertains to the
+number of times a video entity has been opened by user-space not the number
+of active streams.
+
+If use_count and stream-on count don't agree then stop_streaming() will
+break as is currently the case and has become apparent when using CAMSS
+with libcamera's released softisp 0.3.
+
+The use of use_count like this is a bit hacky and right now breaks regular
+usage of CAMSS for a single stream case. Stopping qcam results in the splat
+below, and then it cannot be started again and any attempts to do so fails
+with -EBUSY.
+
+[ 1265.509831] WARNING: CPU: 5 PID: 919 at drivers/media/common/videobuf2/videobuf2-core.c:2183 __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common]
+...
+[ 1265.510630] Call trace:
+[ 1265.510636]  __vb2_queue_cancel+0x230/0x2c8 [videobuf2_common]
+[ 1265.510648]  vb2_core_streamoff+0x24/0xcc [videobuf2_common]
+[ 1265.510660]  vb2_ioctl_streamoff+0x5c/0xa8 [videobuf2_v4l2]
+[ 1265.510673]  v4l_streamoff+0x24/0x30 [videodev]
+[ 1265.510707]  __video_do_ioctl+0x190/0x3f4 [videodev]
+[ 1265.510732]  video_usercopy+0x304/0x8c4 [videodev]
+[ 1265.510757]  video_ioctl2+0x18/0x34 [videodev]
+[ 1265.510782]  v4l2_ioctl+0x40/0x60 [videodev]
+...
+[ 1265.510944] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 0 in active state
+[ 1265.511175] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 1 in active state
+[ 1265.511398] videobuf2_common: driver bug: stop_streaming operation is leaving buffer 2 in active st
+
+One CAMSS specific way to handle multiple VCs on the same RDI might be:
+
+- Reference count each pipeline enable for CSIPHY, CSID, VFE and RDIx.
+- The video buffers are already associated with msm_vfeN_rdiX so
+  release video buffers when told to do so by stop_streaming.
+- Only release the power-domains for the CSIPHY, CSID and VFE when
+  their internal refcounts drop.
+
+Either way refusing to release video buffers based on use_count is
+erroneous and should be reverted. The silicon enabling code for selecting
+VCs is perfectly fine. Its a "known missing feature" that concurrent VCs
+won't work with CAMSS right now.
+
+Initial testing with this code didn't show an error but, SoftISP and "real"
+usage with Google Hangouts breaks the upstream code pretty quickly, we need
+to do a partial revert and take another pass at VCs.
+
+This commit partially reverts commit 89013969e232 ("media: camss: sm8250:
+Pipeline starting and stopping for multiple virtual channels")
+
+Fixes: 89013969e232 ("media: camss: sm8250: Pipeline starting and stopping for multiple virtual channels")
+Reported-by: Johan Hovold <johan+linaro@kernel.org>
+Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Tested-by: Johan Hovold <johan+linaro@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Link: https://lore.kernel.org/r/20240729-linux-next-24-07-13-camss-fixes-v3-1-38235dc782c7@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/platform/qcom/camss/camss-video.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
+index cd72feca618ca4..3b8fc31d957c77 100644
+--- a/drivers/media/platform/qcom/camss/camss-video.c
++++ b/drivers/media/platform/qcom/camss/camss-video.c
+@@ -297,12 +297,6 @@ static void video_stop_streaming(struct vb2_queue *q)
+ 
+ 		ret = v4l2_subdev_call(subdev, video, s_stream, 0);
+ 
+-		if (entity->use_count > 1) {
+-			/* Don't stop if other instances of the pipeline are still running */
+-			dev_dbg(video->camss->dev, "Video pipeline still used, don't stop streaming.\n");
+-			return;
+-		}
+-
+ 		if (ret) {
+ 			dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret);
+ 			return;
+
+From 8f15c04d37a94e7f78e16c32d332489581099712 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 29 Jul 2024 13:42:03 +0100
+Subject: [PATCH] media: qcom: camss: Fix ordering of pm_runtime_enable
+
+pm_runtime_enable() should happen prior to vfe_get() since vfe_get() calls
+pm_runtime_resume_and_get().
+
+This is a basic race condition that doesn't show up for most users so is
+not widely reported. If you blacklist qcom-camss in modules.d and then
+subsequently modprobe the module post-boot it is possible to reliably show
+this error up.
+
+The kernel log for this error looks like this:
+
+qcom-camss ac5a000.camss: Failed to power up pipeline: -13
+
+Fixes: 02afa816dbbf ("media: camss: Add basic runtime PM support")
+Reported-by: Johan Hovold <johan+linaro@kernel.org>
+Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Tested-by: Johan Hovold <johan+linaro@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/
+Link: https://lore.kernel.org/r/20240729-linux-next-24-07-13-camss-fixes-v3-2-38235dc782c7@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/platform/qcom/camss/camss.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
+index 51b1d3550421a4..d64985ca6e884f 100644
+--- a/drivers/media/platform/qcom/camss/camss.c
++++ b/drivers/media/platform/qcom/camss/camss.c
+@@ -2283,6 +2283,8 @@ static int camss_probe(struct platform_device *pdev)
+ 
+ 	v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev);
+ 
++	pm_runtime_enable(dev);
++
+ 	num_subdevs = camss_of_parse_ports(camss);
+ 	if (num_subdevs < 0) {
+ 		ret = num_subdevs;
+@@ -2323,8 +2325,6 @@ static int camss_probe(struct platform_device *pdev)
+ 		}
+ 	}
+ 
+-	pm_runtime_enable(dev);
+-
+ 	return 0;
+ 
+ err_register_subdevs:
+@@ -2332,6 +2332,7 @@ static int camss_probe(struct platform_device *pdev)
+ err_v4l2_device_unregister:
+ 	v4l2_device_unregister(&camss->v4l2_dev);
+ 	v4l2_async_nf_cleanup(&camss->notifier);
++	pm_runtime_disable(dev);
+ err_genpd_cleanup:
+ 	camss_genpd_cleanup(camss);
+ 
+From 6abbc57534f97fee63e7b43875c8b415eb8f6787 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Sat, 13 Jul 2024 23:33:29 +0100
+Subject: [PATCH] media: ov5675: Fix power on/off delay timings
+
+The ov5675 specification says that the gap between XSHUTDN deassert and the
+first I2C transaction should be a minimum of 8192 XVCLK cycles.
+
+Right now we use a usleep_rage() that gives a sleep time of between about
+430 and 860 microseconds.
+
+On the Lenovo X13s we have observed that in about 1/20 cases the current
+timing is too tight and we start transacting before the ov5675's reset
+cycle completes, leading to I2C bus transaction failures.
+
+The reset racing is sometimes triggered at initial chip probe but, more
+usually on a subsequent power-off/power-on cycle e.g.
+
+[   71.451662] ov5675 24-0010: failed to write reg 0x0103. error = -5
+[   71.451686] ov5675 24-0010: failed to set plls
+
+The current quiescence period we have is too tight. Instead of expressing
+the post reset delay in terms of the current XVCLK this patch converts the
+power-on and power-off delays to the maximum theoretical delay @ 6 MHz with
+an additional buffer.
+
+1.365 milliseconds on the power-on path is 1.5 milliseconds with grace.
+85.3 microseconds on the power-off path is 90 microseconds with grace.
+
+Fixes: 49d9ad719e89 ("media: ov5675: add device-tree support and support runtime PM")
+Cc: stable@vger.kernel.org
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Link: https://lore.kernel.org/r/20240713-linux-next-ov5675-v3-1-527f5b985836@linaro.org
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+---
+ drivers/media/i2c/ov5675.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c
+index 3641911bc73f68..5b5127f8953ff4 100644
+--- a/drivers/media/i2c/ov5675.c
++++ b/drivers/media/i2c/ov5675.c
+@@ -972,12 +972,10 @@ static int ov5675_set_stream(struct v4l2_subdev *sd, int enable)
+ 
+ static int ov5675_power_off(struct device *dev)
+ {
+-	/* 512 xvclk cycles after the last SCCB transation or MIPI frame end */
+-	u32 delay_us = DIV_ROUND_UP(512, OV5675_XVCLK_19_2 / 1000 / 1000);
+ 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ 	struct ov5675 *ov5675 = to_ov5675(sd);
+ 
+-	usleep_range(delay_us, delay_us * 2);
++	usleep_range(90, 100);
+ 
+ 	clk_disable_unprepare(ov5675->xvclk);
+ 	gpiod_set_value_cansleep(ov5675->reset_gpio, 1);
+@@ -988,7 +986,6 @@ static int ov5675_power_off(struct device *dev)
+ 
+ static int ov5675_power_on(struct device *dev)
+ {
+-	u32 delay_us = DIV_ROUND_UP(8192, OV5675_XVCLK_19_2 / 1000 / 1000);
+ 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ 	struct ov5675 *ov5675 = to_ov5675(sd);
+ 	int ret;
+@@ -1014,8 +1011,11 @@ static int ov5675_power_on(struct device *dev)
+ 
+ 	gpiod_set_value_cansleep(ov5675->reset_gpio, 0);
+ 
+-	/* 8192 xvclk cycles prior to the first SCCB transation */
+-	usleep_range(delay_us, delay_us * 2);
++	/* Worst case quiesence gap is 1.365 milliseconds @ 6MHz XVCLK
++	 * Add an additional threshold grace period to ensure reset
++	 * completion before initiating our first I2C transaction.
++	 */
++	usleep_range(1500, 1600);
+ 
+ 	return 0;
+ }
diff --git a/srcpkgs/linux6.11/template b/srcpkgs/linux6.11/template
index 5593135e650e7d..49ba319cf341e9 100644
--- a/srcpkgs/linux6.11/template
+++ b/srcpkgs/linux6.11/template
@@ -1,6 +1,6 @@
-# Template file for 'linux6.11'.
+# Template file for 'linux6.11'
 pkgname=linux6.11
-version=6.11.0
+version=6.11.1
 revision=1
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Duncaen <duncaen@voidlinux.org>"
@@ -13,7 +13,8 @@ if [ "${version##*.}" != 0 ]; then
 	skip_extraction="patch-${version}.xz"
 fi
 
-checksum=55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+checksum="55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e
+ e209cd7f59dd57a6c5c3c6ce5bc7c494401a695e323e635e2a62c708c07095c0"
 python_version=3
 
 # XXX Restrict archs until a proper <arch>-dotconfig is available in FILESDIR.

From b2ad72fc4a093be8a82d71c3a8f6d8072df91f9a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 1 Oct 2024 11:08:04 -0400
Subject: [PATCH 2/2] x13s-base: update to 2.

adds udev rule for the camera
---
 srcpkgs/x13s-base/files/95-libcamera-hack.rules | 2 ++
 srcpkgs/x13s-base/template                      | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/x13s-base/files/95-libcamera-hack.rules

diff --git a/srcpkgs/x13s-base/files/95-libcamera-hack.rules b/srcpkgs/x13s-base/files/95-libcamera-hack.rules
new file mode 100644
index 00000000000000..c9eca52187215a
--- /dev/null
+++ b/srcpkgs/x13s-base/files/95-libcamera-hack.rules
@@ -0,0 +1,2 @@
+ACTION=="add", SUBSYSTEM=="dma_heap", KERNEL=="linux,cma", GROUP="video", MODE="0660"
+ACTION=="add", SUBSYSTEM=="dma_heap", KERNEL=="system", GROUP="video", MODE="0660"
diff --git a/srcpkgs/x13s-base/template b/srcpkgs/x13s-base/template
index 17da5ee388cc3d..dbfaefbd1665f8 100644
--- a/srcpkgs/x13s-base/template
+++ b/srcpkgs/x13s-base/template
@@ -1,6 +1,6 @@
 # Template file for 'x13s-base'
 pkgname=x13s-base
-version=1
+version=2
 revision=1
 archs="aarch64*"
 depends="linux-mainline>=6.8 linux-firmware-qualcomm alsa-ucm-conf"
@@ -13,6 +13,7 @@ conf_files="/etc/default/x13s"
 do_install() {
 	vinstall "${FILESDIR}"/72-touchscreen.rules 644 usr/lib/udev/rules.d 72-x13s-touchscreen.rules
 	vinstall "${FILESDIR}"/90-net-address.rules 644 usr/lib/udev/rules.d 90-x13s-net-address.rules
+	vinstall "${FILESDIR}"/95-libcamera-hack.rules 644 usr/lib/udev/rules.d 90-x13s-libcamera-hack.rules
 	vinstall "${FILESDIR}"/90-bt-address.sh 644 etc/runit/core-services 90-x13s-bt-address.sh
 	vinstall "${FILESDIR}"/dracut.conf 644 usr/lib/dracut/dracut.conf.d x13s.conf
 	vinstall "${FILESDIR}"/x13s-setup 755 usr/libexec

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

* Re: linux6.11: update to 6.11.1, enable x13s camera
  2024-10-01 14:01 [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera classabbyamp
                   ` (2 preceding siblings ...)
  2024-10-01 15:08 ` classabbyamp
@ 2024-10-01 22:18 ` classabbyamp
  2024-10-06 14:29 ` classabbyamp
  2024-10-06 14:29 ` [PR PATCH] [Closed]: " classabbyamp
  5 siblings, 0 replies; 7+ messages in thread
From: classabbyamp @ 2024-10-01 22:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/52444#issuecomment-2387184751

Comment:
built on all available archs, haven't booted on any except aarch64

```
SUMMARY                                      
pkg        host         target        cross  result
linux6.11  x86_64       x86_64        n      OK
linux6.11  x86_64-musl  x86_64-musl   n      OK
linux6.11  i686         i686          n      OK
linux6.11  x86_64-musl  aarch64-musl  y      OK
linux6.11  x86_64       aarch64       y      OK
linux6.11  x86_64-musl  armv7l-musl   y      SKIPPED
linux6.11  x86_64       armv7l        y      SKIPPED
linux6.11  x86_64-musl  armv6l-musl   y      SKIPPED
linux6.11  x86_64       armv6l        y      SKIPPED
```

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

* Re: linux6.11: update to 6.11.1, enable x13s camera
  2024-10-01 14:01 [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera classabbyamp
                   ` (3 preceding siblings ...)
  2024-10-01 22:18 ` classabbyamp
@ 2024-10-06 14:29 ` classabbyamp
  2024-10-06 14:29 ` [PR PATCH] [Closed]: " classabbyamp
  5 siblings, 0 replies; 7+ messages in thread
From: classabbyamp @ 2024-10-06 14:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/52444#issuecomment-2395460908

Comment:
97f7d4cc515c38956ef5cfeb007a6a8f258c51a1

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

* Re: [PR PATCH] [Closed]: linux6.11: update to 6.11.1, enable x13s camera
  2024-10-01 14:01 [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera classabbyamp
                   ` (4 preceding siblings ...)
  2024-10-06 14:29 ` classabbyamp
@ 2024-10-06 14:29 ` classabbyamp
  5 siblings, 0 replies; 7+ messages in thread
From: classabbyamp @ 2024-10-06 14:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]

There's a closed pull request on the void-packages repository

linux6.11: update to 6.11.1, enable x13s camera
https://github.com/void-linux/void-packages/pull/52444

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly** (aarch64)

~~still testing the patches on aarch64~~ done, haven't tested other archs

cc @duncaen

[ci skip]

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


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

end of thread, other threads:[~2024-10-06 14:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-01 14:01 [PR PATCH] linux6.11: update to 6.11.1, enable x13s camera classabbyamp
2024-10-01 14:23 ` [PR PATCH] [Updated] " classabbyamp
2024-10-01 15:05 ` classabbyamp
2024-10-01 15:08 ` classabbyamp
2024-10-01 22:18 ` classabbyamp
2024-10-06 14:29 ` classabbyamp
2024-10-06 14:29 ` [PR PATCH] [Closed]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).