From 97f7d4cc515c38956ef5cfeb007a6a8f258c51a1 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 1 Oct 2024 10:00:30 -0400 Subject: [PATCH] linux6.11: update to 6.11.2, enable x13s camera Co-authored-by: Duncaen --- srcpkgs/linux6.11/files/arm64-dotconfig | 11 +- srcpkgs/linux6.11/files/i386-dotconfig | 4 +- srcpkgs/linux6.11/files/x86_64-dotconfig | 4 +- srcpkgs/linux6.11/patches/x13s-camera.patch | 333 ++++++++++++++++++++ srcpkgs/linux6.11/template | 7 +- 5 files changed, 345 insertions(+), 14 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 ee92b115673..be66371a25e 100644 --- a/srcpkgs/linux6.11/files/arm64-dotconfig +++ b/srcpkgs/linux6.11/files/arm64-dotconfig @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 6.11.0 Kernel Configuration +# Linux/arm64 6.11.2 Kernel Configuration # CONFIG_CC_VERSION_TEXT="aarch64-linux-musl-gcc (GCC) 13.2.0" CONFIG_CC_IS_GCC=y @@ -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 @@ -6880,7 +6880,6 @@ CONFIG_VIDEO_CADENCE_CSI2TX=m # Chips&Media media platform drivers # CONFIG_VIDEO_CODA=m -# CONFIG_VIDEO_E5010_JPEG_ENC is not set # # Intel media platform drivers @@ -9919,8 +9918,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 +13139,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/files/i386-dotconfig b/srcpkgs/linux6.11/files/i386-dotconfig index b67c42eb625..2d83990563a 100644 --- a/srcpkgs/linux6.11/files/i386-dotconfig +++ b/srcpkgs/linux6.11/files/i386-dotconfig @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 6.11.0 Kernel Configuration +# Linux/i386 6.11.2 Kernel Configuration # CONFIG_CC_VERSION_TEXT="gcc (GCC) 13.2.0" CONFIG_CC_IS_GCC=y @@ -5910,7 +5910,6 @@ CONFIG_VIDEO_CADENCE_CSI2TX=m # # Chips&Media media platform drivers # -# CONFIG_VIDEO_E5010_JPEG_ENC is not set # # Intel media platform drivers @@ -5948,7 +5947,6 @@ CONFIG_VIDEO_CAFE_CCIC=m # # Raspberry Pi media platform drivers # -# CONFIG_VIDEO_RASPBERRYPI_PISP_BE is not set # # Renesas media platform drivers diff --git a/srcpkgs/linux6.11/files/x86_64-dotconfig b/srcpkgs/linux6.11/files/x86_64-dotconfig index c873edefe92..9afca482e85 100644 --- a/srcpkgs/linux6.11/files/x86_64-dotconfig +++ b/srcpkgs/linux6.11/files/x86_64-dotconfig @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 6.11.0 Kernel Configuration +# Linux/x86_64 6.11.2 Kernel Configuration # CONFIG_CC_VERSION_TEXT="gcc (GCC) 13.2.0" CONFIG_CC_IS_GCC=y @@ -6137,7 +6137,6 @@ CONFIG_VIDEO_CADENCE_CSI2TX=m # # Chips&Media media platform drivers # -# CONFIG_VIDEO_E5010_JPEG_ENC is not set # # Intel media platform drivers @@ -6175,7 +6174,6 @@ CONFIG_VIDEO_CAFE_CCIC=m # # Raspberry Pi media platform drivers # -# CONFIG_VIDEO_RASPBERRYPI_PISP_BE is not set # # Renesas media platform drivers diff --git a/srcpkgs/linux6.11/patches/x13s-camera.patch b/srcpkgs/linux6.11/patches/x13s-camera.patch new file mode 100644 index 00000000000..e971c13bcf2 --- /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 +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 +Signed-off-by: Bryan O'Donoghue +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 +--- + .../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 +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 +Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/ +Tested-by: Johan Hovold +Cc: stable@vger.kernel.org +Signed-off-by: Bryan O'Donoghue +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 +--- + 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 +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 +Closes: https://lore.kernel.org/lkml/ZoVNHOTI0PKMNt4_@hovoldconsulting.com/ +Tested-by: Johan Hovold +Cc: stable@vger.kernel.org +Signed-off-by: Bryan O'Donoghue +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 +--- + 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 +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 +Link: https://lore.kernel.org/r/20240713-linux-next-ov5675-v3-1-527f5b985836@linaro.org +Signed-off-by: Johan Hovold +--- + 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 5593135e650..d256cfb5cc5 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.2 revision=1 short_desc="Linux kernel and modules (${version%.*} series)" maintainer="Duncaen " @@ -13,7 +13,8 @@ if [ "${version##*.}" != 0 ]; then skip_extraction="patch-${version}.xz" fi -checksum=55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e +checksum="55d2c6c025ebc27810c748d66325dd5bc601e8d32f8581d9e77673529bdacb2e + 2b269f51babfd89937206aa0fcac6f93c94cdf2f24d7e54ebc304a93cf9e4929" python_version=3 # XXX Restrict archs until a proper -dotconfig is available in FILESDIR.