feat/fix(ipu6-drivers): Refactor and add DKMS package (#4395) (#4398)

* feat/fix(ipu6-drivers): Refactor and add DKMS package

* fix: Forgot the 0

Signed-off-by: Gilver <rockgrub@disroot.org>

* Update intel-ipu6-kmod.spec

Signed-off-by: Gilver <rockgrub@disroot.org>

* Update intel-ipu6-kmod.spec

Signed-off-by: Gilver <rockgrub@disroot.org>

---------

Signed-off-by: Gilver <rockgrub@disroot.org>
(cherry picked from commit 1283e2280c)

Co-authored-by: Gilver <rockgrub@disroot.org>
This commit is contained in:
Raboneko
2025-04-24 04:02:38 -07:00
committed by GitHub
parent 2a310a5932
commit 3a966597ae
49 changed files with 2983 additions and 1582 deletions
@@ -30,8 +30,6 @@ Obsoletes: ivsc-firmware < 20250326.3377801-3
%endif
Obsoletes: ivsc-firmware < 0^20250326git.3377801-3
%endif
### For Akmods package
Provides: intel-ipu6-kmod-common = %{version}
# Fix the stupid issue when changing versioning schemes
%if 0%{?fedora} <= 43 || 0%{?rhel} <= 10
Provides: %{name} = %{?epoch:%{epoch}:}%{commit_date}.%{shortcommit}-%{release}
@@ -1,183 +0,0 @@
--- a/drivers/media/pci/intel/ipu-isys-csi2.c
+++ b/drivers/media/pci/intel/ipu-isys-csi2.c
@@ -532,8 +532,10 @@ int ipu_isys_csi2_init(struct ipu_isys_csi2 *csi2,
NR_OF_CSI2_SINK_PADS, 0,
CSI2_PAD_SOURCE,
CSI2_PAD_SINK);
- if (rval)
+ if (rval) {
+ dev_err(&isys->adev->dev, "ipu_isys_subdev_init() err %d\n", rval);
goto fail;
+ }
csi2->asd.pad[CSI2_PAD_SINK].flags |= MEDIA_PAD_FL_MUST_CONNECT;
--- a/drivers/media/pci/intel/ipu-isys-subdev.c
+++ b/drivers/media/pci/intel/ipu-isys-subdev.c
@@ -849,17 +849,22 @@ int ipu_isys_subdev_init(struct ipu_isys_subdev *asd,
return -ENOMEM;
rval = media_entity_pads_init(&asd->sd.entity, num_pads, asd->pad);
- if (rval)
+ if (rval) {
+ dev_err(&asd->isys->adev->dev, "%s: media_entity_pads_init(%d) err %d\n", __func__, num_pads, rval);
goto out_mutex_destroy;
+ }
if (asd->ctrl_init) {
rval = v4l2_ctrl_handler_init(&asd->ctrl_handler, nr_ctrls);
- if (rval)
+ if (rval) {
+ dev_err(&asd->isys->adev->dev, "%s: v4l2_ctrl_handler_init() err %d\n", __func__, rval);
goto out_media_entity_cleanup;
+ }
asd->ctrl_init(&asd->sd);
if (asd->ctrl_handler.error) {
rval = asd->ctrl_handler.error;
+ dev_err(&asd->isys->adev->dev, "%s: ctrl_handler.error %d\n", __func__, rval);
goto out_v4l2_ctrl_handler_free;
}
--- a/drivers/media/pci/intel/ipu-isys.c
+++ b/drivers/media/pci/intel/ipu-isys.c
@@ -396,8 +396,10 @@ static int isys_register_subdevices(struct ipu_isys *isys)
rval = ipu_isys_csi2_init(&isys->csi2[i], isys,
isys->pdata->base +
csi2->offsets[i], i);
- if (rval)
+ if (rval) {
+ dev_err(&isys->adev->dev, "ipu_isys_csi2_init() err %d\n", rval);
goto fail;
+ }
isys->isr_csi2_bits |= IPU_ISYS_UNISPART_IRQ_CSI2(i);
}
@@ -1009,12 +1011,16 @@ static int isys_register_devices(struct ipu_isys *isys)
goto out_v4l2_device_unregister;
rval = isys_notifier_init(isys);
- if (rval)
+ if (rval) {
+ dev_err(&isys->adev->dev, "isys_notifier_init() err %d\n", rval);
goto out_isys_unregister_subdevices;
+ }
rval = v4l2_device_register_subdev_nodes(&isys->v4l2_dev);
- if (rval)
+ if (rval) {
+ dev_err(&isys->adev->dev, "error registering subdev nodes %d\n", rval);
goto out_isys_notifier_cleanup;
+ }
return 0;
@@ -1561,8 +1567,10 @@ static int isys_probe(struct ipu_bus_device *adev)
if (rval)
goto out_remove_pkg_dir_shared_buffer;
rval = isys_iwake_watermark_init(isys);
- if (rval)
+ if (rval) {
+ dev_err(&adev->dev, "isys_iwake_watermark_init() err %d\n", rval);
goto out_unregister_devices;
+ }
ipu_mmu_hw_cleanup(adev->mmu);
--- a/drivers/media/pci/intel/ipu-isys.c
+++ b/drivers/media/pci/intel/ipu-isys.c
@@ -382,15 +382,12 @@ static int isys_register_subdevices(struct ipu_isys *isys)
const struct ipu_isys_internal_csi2_pdata *csi2 =
&isys->pdata->ipdata->csi2;
struct ipu_isys_csi2_be_soc *csi2_be_soc;
- unsigned int i, k;
- int rval;
+ int i = 0, k = 0, rval;
isys->csi2 = devm_kcalloc(&isys->adev->dev, csi2->nports,
sizeof(*isys->csi2), GFP_KERNEL);
- if (!isys->csi2) {
- rval = -ENOMEM;
- goto fail;
- }
+ if (!isys->csi2)
+ return -ENOMEM;
for (i = 0; i < csi2->nports; i++) {
rval = ipu_isys_csi2_init(&isys->csi2[i], isys,
@@ -425,7 +422,8 @@ static int isys_register_subdevices(struct ipu_isys *isys)
if (rval) {
dev_info(&isys->adev->dev,
"can't create link csi2->be_soc\n");
- goto fail;
+ isys_unregister_subdevices(isys);
+ return rval;
}
}
}
@@ -433,7 +431,16 @@ static int isys_register_subdevices(struct ipu_isys *isys)
return 0;
fail:
- isys_unregister_subdevices(isys);
+ while (--k >= 0) {
+ dev_info(&isys->adev->dev, "foo %d\n", k);
+ ipu_isys_csi2_be_soc_cleanup(&isys->csi2_be_soc[k]);
+ }
+
+ while (--i >= 0) {
+ dev_info(&isys->adev->dev, "bar %d\n", k);
+ ipu_isys_csi2_cleanup(&isys->csi2[i]);
+ }
+
return rval;
}
--- a/drivers/media/pci/intel/ipu-isys.c
+++ b/drivers/media/pci/intel/ipu-isys.c
@@ -1170,8 +1170,7 @@ static void isys_remove(struct ipu_bus_device *adev)
dev_info(&adev->dev, "removed\n");
#ifdef CONFIG_DEBUG_FS
- if (isp->ipu_dir)
- debugfs_remove_recursive(isys->debugfsdir);
+ debugfs_remove_recursive(isys->debugfsdir);
#endif
list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist, head) {
@@ -1217,6 +1216,7 @@ static void isys_remove(struct ipu_bus_device *adev)
mutex_destroy(&isys->stream_mutex);
mutex_destroy(&isys->mutex);
+ mutex_destroy(&isys->lib_mutex);
if (isys->short_packet_source == IPU_ISYS_SHORT_PACKET_FROM_TUNIT) {
u32 trace_size = IPU_ISYS_SHORT_PACKET_TRACE_BUFFER_SIZE;
@@ -1587,7 +1587,15 @@ static int isys_probe(struct ipu_bus_device *adev)
isys_iwake_watermark_cleanup(isys);
isys_unregister_devices(isys);
out_remove_pkg_dir_shared_buffer:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
cpu_latency_qos_remove_request(&isys->pm_qos);
+#else
+ pm_qos_remove_request(&isys->pm_qos);
+#endif
+ ipu_trace_uninit(&adev->dev);
+#ifdef CONFIG_DEBUG_FS
+ debugfs_remove_recursive(isys->debugfsdir);
+#endif
if (!isp->secure_mode)
ipu_cpd_free_pkg_dir(adev, isys->pkg_dir,
isys->pkg_dir_dma_addr,
@@ -1598,10 +1606,10 @@ static int isys_probe(struct ipu_bus_device *adev)
release_firmware:
if (!isp->secure_mode)
release_firmware(isys->fw);
- ipu_trace_uninit(&adev->dev);
mutex_destroy(&isys->mutex);
mutex_destroy(&isys->stream_mutex);
+ mutex_destroy(&isys->lib_mutex);
if (isys->short_packet_source == IPU_ISYS_SHORT_PACKET_FROM_TUNIT)
mutex_destroy(&isys->short_packet_tracing_mutex);
@@ -1,85 +0,0 @@
From 5917297efb44d52548a052c04e9f759926ca2ddd Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 11 Jun 2024 11:39:34 +0200
Subject: [PATCH 2/6] media: ipu6: Fix compilation with kernels >= 6.10
Fix compilation with kernels >= 6.10.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[vicamo: update for v6.12-rc1]
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
drivers/media/pci/intel/ipu-mmu.c | 1 +
drivers/media/pci/intel/ipu-psys.c | 31 ++++++++++++++++++++++++++++++
drivers/media/pci/intel/ipu.c | 1 +
3 files changed, 33 insertions(+)
diff --git a/drivers/media/pci/intel/ipu-mmu.c b/drivers/media/pci/intel/ipu-mmu.c
index a36a6ded8..b06c9f8c1 100644
--- a/drivers/media/pci/intel/ipu-mmu.c
+++ b/drivers/media/pci/intel/ipu-mmu.c
@@ -7,6 +7,7 @@
#include <linux/iova.h>
#include <linux/module.h>
#include <linux/sizes.h>
+#include <linux/vmalloc.h>
#include "ipu.h"
#include "ipu-platform.h"
diff --git a/drivers/media/pci/intel/ipu-psys.c b/drivers/media/pci/intel/ipu-psys.c
index b12ecf3fc..87fab7cf8 100644
--- a/drivers/media/pci/intel/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu-psys.c
@@ -128,6 +128,37 @@ ipu_psys_lookup_kbuffer_by_kaddr(struct ipu_psys_fh *fh, void *kaddr)
return NULL;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+/* Dropped from 6.10, use our own copy for now */
+static int follow_pfn(struct vm_area_struct *vma, unsigned long address, unsigned long *pfn)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
+ spinlock_t *ptl;
+ pte_t *ptep;
+
+ if (follow_pte(vma, address, &ptep, &ptl))
+ return -EINVAL;
+
+ *pfn = pte_pfn(ptep_get(ptep));
+ pte_unmap_unlock(ptep, ptl);
+#else
+ struct follow_pfnmap_args args = {
+ .vma = vma,
+ .address = address,
+ };
+ int ret;
+
+ ret = follow_pfnmap_start(&args);
+ if (ret)
+ return ret;
+
+ *pfn = args.pfn;
+ follow_pfnmap_end(&args);
+#endif
+ return 0;
+}
+#endif
+
static int ipu_psys_get_userpages(struct ipu_dma_buf_attach *attach)
{
struct vm_area_struct *vma;
diff --git a/drivers/media/pci/intel/ipu.c b/drivers/media/pci/intel/ipu.c
index 33592a662..fc091a11a 100644
--- a/drivers/media/pci/intel/ipu.c
+++ b/drivers/media/pci/intel/ipu.c
@@ -15,6 +15,7 @@
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/version.h>
+#include <linux/vmalloc.h>
#include "ipu.h"
#include "ipu-buttress.h"
--
2.47.0
@@ -1,84 +0,0 @@
From 3ddee5543a8caa4bb716fd0ff815d52b0d09bbb1 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 10 Jun 2024 19:30:48 +0200
Subject: [PATCH 3/6] Makefile: prefix ipu6 modules with icamera- instead of
intel-
Now that IPU6 isys support has landed upstream, using an auxbus approach
rather then the custom ipu6-bus, there is a conflict between the mainline
intel-ipu6* kernel modules and the out of tree ipu6-drivers intel-ipu6*
kernel modules.
Rename the out of tree ipu6 modules to icamera-ipu6* so that both can be
installed together and the user can easily switch by blacklisting one of
the 2 sets of modules.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/Makefile | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/Makefile b/drivers/media/pci/intel/ipu6/Makefile
index 23f8cdba4..92cd9fe1b 100644
--- a/drivers/media/pci/intel/ipu6/Makefile
+++ b/drivers/media/pci/intel/ipu6/Makefile
@@ -8,7 +8,7 @@ endif
ccflags-y += -DIPU_TPG_FRAME_SYNC -DIPU_PSYS_GPC \
-DIPU_ISYS_GPC
-intel-ipu6-objs += ../ipu.o \
+icamera-ipu6-objs += ../ipu.o \
../ipu-bus.o \
../ipu-dma.o \
../ipu-mmu.o \
@@ -18,12 +18,12 @@ intel-ipu6-objs += ../ipu.o \
ipu6.o \
../ipu-fw-com.o
ifdef CONFIG_IPU_ISYS_BRIDGE
-intel-ipu6-objs += ../cio2-bridge.o
+icamera-ipu6-objs += ../cio2-bridge.o
endif
-obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6.o
+obj-$(CONFIG_VIDEO_INTEL_IPU6) += icamera-ipu6.o
-intel-ipu6-isys-objs += ../ipu-isys.o \
+icamera-ipu6-isys-objs += ../ipu-isys.o \
../ipu-isys-csi2.o \
ipu6-isys.o \
ipu6-isys-phy.o \
@@ -36,26 +36,26 @@ intel-ipu6-isys-objs += ../ipu-isys.o \
../ipu-isys-queue.o \
../ipu-isys-subdev.o
-obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6-isys.o
+obj-$(CONFIG_VIDEO_INTEL_IPU6) += icamera-ipu6-isys.o
-intel-ipu6-psys-objs += ../ipu-psys.o \
+icamera-ipu6-psys-objs += ../ipu-psys.o \
ipu6-psys.o \
ipu-resources.o \
ipu6-psys-gpc.o \
ipu6-l-scheduler.o \
ipu6-ppg.o
-intel-ipu6-psys-objs += ipu-fw-resources.o \
+icamera-ipu6-psys-objs += ipu-fw-resources.o \
ipu6-fw-resources.o \
ipu6se-fw-resources.o \
ipu6ep-fw-resources.o \
../ipu-fw-psys.o
ifeq ($(CONFIG_COMPAT),y)
-intel-ipu6-psys-objs += ../ipu-psys-compat32.o
+icamera-ipu6-psys-objs += ../ipu-psys-compat32.o
endif
-obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6-psys.o
+obj-$(CONFIG_VIDEO_INTEL_IPU6) += icamera-ipu6-psys.o
ccflags-y += -I$(srcpath)/$(src)/../../../../../include/
ccflags-y += -I$(srcpath)/$(src)/../
--
2.47.0
@@ -1,32 +0,0 @@
From 5c1e910f6c473f7f53377219e1f00b36e6ae7da1 Mon Sep 17 00:00:00 2001
From: You-Sheng Yang <vicamo.yang@canonical.com>
Date: Thu, 8 Aug 2024 14:30:51 +0800
Subject: [PATCH 4/6] media: ipu6: Fix compilation with kernels >= 6.11
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
drivers/media/pci/intel/ipu-bus.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/media/pci/intel/ipu-bus.c b/drivers/media/pci/intel/ipu-bus.c
index 0569ccb61..234fde8f1 100644
--- a/drivers/media/pci/intel/ipu-bus.c
+++ b/drivers/media/pci/intel/ipu-bus.c
@@ -75,9 +75,13 @@ static const struct dev_pm_ops ipu_bus_pm_ops = {
#define IPU_BUS_PM_OPS NULL
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
static int ipu_bus_match(struct device *dev, struct device_driver *drv)
+#else
+static int ipu_bus_match(struct device *dev, const struct device_driver *drv)
+#endif
{
- struct ipu_bus_driver *adrv = to_ipu_bus_driver(drv);
+ const struct ipu_bus_driver *adrv = to_ipu_bus_driver(drv);
dev_dbg(dev, "bus match: \"%s\" --- \"%s\"\n", dev_name(dev),
adrv->wanted);
--
2.47.0
@@ -1,269 +0,0 @@
From 3bbe043c6c92ef8fb2482077911ca6ea5fb2ef52 Mon Sep 17 00:00:00 2001
From: You-Sheng Yang <vicamo.yang@canonical.com>
Date: Fri, 11 Oct 2024 01:44:50 +0800
Subject: [PATCH 5/6] media: ipu6: Fix compilation with kernels >= 6.12: move
asm/unaligned.h to linux/unaligned.h
Accommodate to v6.12-rc2 commit 5f60d5f6bbc12 ("move asm/unaligned.h to
linux/unaligned.h").
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2083996
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/i2c/hi556.c | 6 +++++-
drivers/media/i2c/hm11b1.c | 6 +++++-
drivers/media/i2c/hm2170.c | 6 +++++-
drivers/media/i2c/hm2172.c | 6 +++++-
drivers/media/i2c/ov01a10.c | 6 +++++-
drivers/media/i2c/ov01a1s.c | 6 +++++-
drivers/media/i2c/ov02c10.c | 6 +++++-
drivers/media/i2c/ov02e10.c | 6 +++++-
drivers/media/i2c/ov2740.c | 6 +++++-
drivers/media/i2c/ov8856.c | 6 +++++-
10 files changed, 50 insertions(+), 10 deletions(-)
diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
index 4fc020b65..90080438b 100644
--- a/drivers/media/i2c/hi556.c
+++ b/drivers/media/i2c/hi556.c
@@ -1,14 +1,18 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/hm11b1.c b/drivers/media/i2c/hm11b1.c
index f3900d29f..173bb32eb 100644
--- a/drivers/media/i2c/hm11b1.c
+++ b/drivers/media/i2c/hm11b1.c
@@ -1,13 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020-2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/hm2170.c b/drivers/media/i2c/hm2170.c
index 102eec25a..060bb04d1 100644
--- a/drivers/media/i2c/hm2170.c
+++ b/drivers/media/i2c/hm2170.c
@@ -1,7 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
@@ -9,7 +14,6 @@
#include <linux/pm_runtime.h>
#include <linux/nvmem-provider.h>
#include <linux/regmap.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/hm2172.c b/drivers/media/i2c/hm2172.c
index 3362d3151..422166f04 100644
--- a/drivers/media/i2c/hm2172.c
+++ b/drivers/media/i2c/hm2172.c
@@ -1,7 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
@@ -9,7 +14,6 @@
#include <linux/pm_runtime.h>
#include <linux/nvmem-provider.h>
#include <linux/regmap.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/ov01a10.c b/drivers/media/i2c/ov01a10.c
index 78ae01811..aa47a50e5 100644
--- a/drivers/media/i2c/ov01a10.c
+++ b/drivers/media/i2c/ov01a10.c
@@ -1,13 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020-2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/ov01a1s.c b/drivers/media/i2c/ov01a1s.c
index f7cf2218c..639b0921f 100644
--- a/drivers/media/i2c/ov01a1s.c
+++ b/drivers/media/i2c/ov01a1s.c
@@ -1,13 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020-2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index 40865f8e3..0a1fed161 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -1,7 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
@@ -9,7 +14,6 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c
index 916def90f..ea82040f2 100644
--- a/drivers/media/i2c/ov02e10.c
+++ b/drivers/media/i2c/ov02e10.c
@@ -1,7 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2023 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
@@ -9,7 +14,6 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
index bd9b68e34..4ed0094f7 100644
--- a/drivers/media/i2c/ov2740.c
+++ b/drivers/media/i2c/ov2740.c
@@ -1,7 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
@@ -9,7 +14,6 @@
#include <linux/pm_runtime.h>
#include <linux/nvmem-provider.h>
#include <linux/regmap.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c
index 1c4469ea0..a2c7c8c22 100644
--- a/drivers/media/i2c/ov8856.c
+++ b/drivers/media/i2c/ov8856.c
@@ -1,13 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2021-2022 Intel Corporation.
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
+#else
+#include <linux/unaligned.h>
+#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
-#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
--
2.47.0
@@ -1,53 +0,0 @@
From f89a4e3da45753d012b3c40bfe9c8b56671e5306 Mon Sep 17 00:00:00 2001
From: You-Sheng Yang <vicamo.yang@canonical.com>
Date: Fri, 11 Oct 2024 01:28:38 +0800
Subject: [PATCH 6/6] media: ipu6: Fix compilation with kernels >= 6.12:
Finally take no_llseek out
Accommodate to v6.12-rc1 commit cb787f4ac0c2 ("[tree-wide] finally take
no_llseek out").
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2083996
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu-trace.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/media/pci/intel/ipu-trace.c b/drivers/media/pci/intel/ipu-trace.c
index 282ac659a..2dc458a1d 100644
--- a/drivers/media/pci/intel/ipu-trace.c
+++ b/drivers/media/pci/intel/ipu-trace.c
@@ -517,7 +517,9 @@ static const struct file_operations ipu_traceconf_fops = {
.release = traceconf_release,
.read = traceconf_read,
.write = traceconf_write,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
.llseek = no_llseek,
+#endif
};
static void wptraceconf_dump(struct ipu_device *isp)
@@ -673,7 +675,9 @@ static const struct file_operations ipu_wptraceconf_fops = {
.release = wptraceconf_release,
.read = wptraceconf_read,
.write = wptraceconf_write,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
.llseek = no_llseek,
+#endif
};
static int gettrace_open(struct inode *inode, struct file *file)
@@ -740,7 +744,9 @@ static const struct file_operations ipu_gettrace_fops = {
.release = gettrace_release,
.read = gettrace_read,
.write = gettrace_write,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
.llseek = no_llseek,
+#endif
};
int ipu_trace_init(struct ipu_device *isp, void __iomem *base,
--
2.47.0
@@ -1,773 +0,0 @@
From 2c4ad1398dddfb307e8a40a714a6d5f70d6d14cb Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 10 Jun 2024 13:05:53 +0200
Subject: [PATCH 4/4] Makefile: Adjust which modules to build for which
kernel-versions for Fedora
Fedora's kernels have not enabled various IPU6 related drivers as soon
as they were mainlined. Instead they were enabled at later times.
Fix the automatic disabling of certain modules to match when they were
enabled in the Fedora kernels:
Do not build ljca for kernels >= 6.7
Do not build ivsc for kernels >= 6.10
Do not build ov2740 for kernels >= 6.10 (1)
Do not build ov01a10 for kernels >= 6.10
Do not build hi556 for kernels >= 6.10 (2)
Do not build cio2-bridge for kernels >= 6.10 (3)
1) Also switch the Kconfig symbols for mainlined sensor drivers from
CONFIG_VIDEO_FOO to CONFIG_ICAMERA_FOO to avoid these still being
set when they should not because of the CONFIG_VIDEO_FOO symbols
inherited from the base kernel.
2) hi556 was enabled in earlier Fedora patches but the mainline version
missed reset GPIO / clk / regulator support
3) The mainline ipu6-bridge is only used for kernels >= 6.10 because it
lacked ACPI HIDs for many of the still out of tree sensor drivers, see:
https://lore.kernel.org/linux-media/20240610173418.16119-1-hdegoede@redhat.com/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 20 ++++++++++++--------
drivers/media/i2c/Makefile | 7 ++++---
drivers/media/i2c/hi556.c | 20 ++++++++++----------
drivers/media/i2c/hm2170.c | 20 ++++++++++----------
drivers/media/i2c/hm2172.c | 20 ++++++++++----------
drivers/media/i2c/ov01a10.c | 18 +++++++++---------
drivers/media/i2c/ov01a1s.c | 20 ++++++++++----------
drivers/media/i2c/ov02c10.c | 20 ++++++++++----------
drivers/media/i2c/ov02e10.c | 20 ++++++++++----------
9 files changed, 85 insertions(+), 80 deletions(-)
diff --git a/Makefile b/Makefile
index 4734c4497..5d716eb61 100644
--- a/Makefile
+++ b/Makefile
@@ -20,15 +20,16 @@ version_lt = $(shell \
echo "false"; \
fi)
-KV_IVSC := 6.6.0
-KV_IPU_BRIDGE := 6.6.0
-KV_OV2740 := 6.8.0
+KV_LJCA := 6.7.0
+KV_IVSC := 6.10.0
+KV_IPU_BRIDGE := 6.10.0
+KV_OV2740 := 6.10.0
KERNEL_SRC ?= /lib/modules/$(KERNELRELEASE)/build
MODSRC := $(shell pwd)
-ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_IVSC)),true)
-$(warning build ljca ivsc)
+ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_LJCA)),true)
+$(warning build ljca)
obj-m += ljca.o
ljca-y := drivers/mfd/ljca.o
@@ -40,7 +41,10 @@ gpio-ljca-y := drivers/gpio/gpio-ljca.o
obj-m += i2c-ljca.o
i2c-ljca-y := drivers/i2c/busses/i2c-ljca.o
+endif
+ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_IVSC)),true)
+$(warning build ivsc)
obj-m += mei-vsc.o
mei-vsc-y := drivers/misc/mei/spi-vsc.o
mei-vsc-y += drivers/misc/mei/hw-vsc.o
@@ -77,16 +81,16 @@ obj-y += drivers/media/pci/intel/
export CONFIG_VIDEO_HM11B1 = m
export CONFIG_VIDEO_OV01A1S = m
-export CONFIG_VIDEO_OV01A10 = m
export CONFIG_VIDEO_OV02C10 = m
export CONFIG_VIDEO_OV02E10 = m
export CONFIG_VIDEO_HM2170 = m
export CONFIG_VIDEO_HM2172 = m
-export CONFIG_VIDEO_HI556 = m
export CONFIG_VIDEO_GC5035 = m
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
-export CONFIG_VIDEO_OV2740 = m
+export CONFIG_ICAMERA_OV2740 = m
+export CONFIG_ICAMERA_OV01A10 = m
+export CONFIG_ICAMERA_HI556 = m
endif
obj-y += drivers/media/i2c/
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 1f395448b..f49609620 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -4,11 +4,12 @@
obj-$(CONFIG_VIDEO_HM11B1) += hm11b1.o
obj-$(CONFIG_VIDEO_GC5035) += gc5035.o
obj-$(CONFIG_VIDEO_OV01A1S) += ov01a1s.o
-obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o
obj-$(CONFIG_VIDEO_OV02C10) += ov02c10.o
obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.o
-obj-$(CONFIG_VIDEO_OV2740) += ov2740.o
obj-$(CONFIG_VIDEO_HM2170) += hm2170.o
obj-$(CONFIG_VIDEO_HM2170) += hm2172.o
-obj-$(CONFIG_VIDEO_HI556) += hi556.o
obj-$(CONFIG_POWER_CTRL_LOGIC) += power_ctrl_logic.o
+
+obj-$(CONFIG_ICAMERA_OV2740) += ov2740.o
+obj-$(CONFIG_ICAMERA_OV01A10) += ov01a10.o
+obj-$(CONFIG_ICAMERA_HI556) += hi556.o
diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
index 4fc020b65..2adb5a1fe 100644
--- a/drivers/media/i2c/hi556.c
+++ b/drivers/media/i2c/hi556.c
@@ -12,7 +12,7 @@
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
#include <linux/vsc.h>
@@ -510,7 +510,7 @@ struct hi556 {
/* Clock provider */
struct clk *img_clk;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
struct vsc_mipi_config conf;
struct vsc_camera_status status;
@@ -527,7 +527,7 @@ struct hi556 {
/* True if the device has been identified */
bool identified;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
bool use_intel_vsc;
#endif
@@ -704,7 +704,7 @@ static int hi556_set_ctrl(struct v4l2_ctrl *ctrl)
ret = hi556_test_pattern(hi556, ctrl->val);
break;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
case V4L2_CID_PRIVACY:
dev_dbg(&client->dev, "set privacy to %d", ctrl->val);
@@ -732,7 +732,7 @@ static int hi556_init_controls(struct hi556 *hi556)
int ret;
ctrl_hdlr = &hi556->ctrl_handler;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
#else
@@ -771,7 +771,7 @@ static int hi556_init_controls(struct hi556 *hi556)
h_blank);
if (hi556->hblank)
hi556->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
hi556->privacy_status = v4l2_ctrl_new_std(ctrl_hdlr, &hi556_ctrl_ops,
V4L2_CID_PRIVACY, 0, 1, 1,
@@ -836,7 +836,7 @@ static int hi556_identify_module(struct hi556 *hi556)
return 0;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static void hi556_vsc_privacy_callback(void *handle,
enum vsc_privacy_status status)
@@ -936,7 +936,7 @@ static int hi556_power_off(struct device *dev)
struct hi556 *hi556 = to_hi556(sd);
int ret = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (hi556->use_intel_vsc) {
ret = vsc_release_camera_sensor(&hi556->status);
@@ -961,7 +961,7 @@ static int hi556_power_on(struct device *dev)
struct hi556 *hi556 = to_hi556(sd);
int ret;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (hi556->use_intel_vsc) {
hi556->conf.lane_num = HI556_DATA_LANES;
@@ -1217,7 +1217,7 @@ static int hi556_get_pm_resources(struct device *dev)
struct hi556 *hi556 = to_hi556(sd);
int ret;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_handle_list dep_devices;
diff --git a/drivers/media/i2c/hm2170.c b/drivers/media/i2c/hm2170.c
index 102eec25a..2987e0cbe 100644
--- a/drivers/media/i2c/hm2170.c
+++ b/drivers/media/i2c/hm2170.c
@@ -13,7 +13,7 @@
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
#include <linux/vsc.h>
#endif
@@ -615,7 +615,7 @@ struct hm2170 {
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *exposure;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
struct vsc_mipi_config conf;
struct vsc_camera_status status;
@@ -792,7 +792,7 @@ static int hm2170_set_ctrl(struct v4l2_ctrl *ctrl)
ret = hm2170_test_pattern(hm2170, ctrl->val);
break;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
case V4L2_CID_PRIVACY:
dev_dbg(&client->dev, "set privacy to %d", ctrl->val);
@@ -825,7 +825,7 @@ static int hm2170_init_controls(struct hm2170 *hm2170)
int ret = 0;
ctrl_hdlr = &hm2170->ctrl_handler;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
#else
@@ -864,7 +864,7 @@ static int hm2170_init_controls(struct hm2170 *hm2170)
h_blank);
if (hm2170->hblank)
hm2170->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
hm2170->privacy_status = v4l2_ctrl_new_std(ctrl_hdlr, &hm2170_ctrl_ops,
V4L2_CID_PRIVACY, 0, 1, 1,
@@ -904,7 +904,7 @@ static void hm2170_update_pad_format(const struct hm2170_mode *mode,
fmt->field = V4L2_FIELD_NONE;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static void hm2170_vsc_privacy_callback(void *handle,
enum vsc_privacy_status status)
@@ -984,7 +984,7 @@ static int hm2170_set_stream(struct v4l2_subdev *sd, int enable)
return ret;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static int hm2170_power_off(struct device *dev)
{
@@ -1323,7 +1323,7 @@ static int hm2170_probe(struct i2c_client *client)
}
v4l2_i2c_subdev_init(&hm2170->sd, client, &hm2170_subdev_ops);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
hm2170->conf.lane_num = HM2170_DATA_LANES;
/* frequency unit 100k */
@@ -1389,7 +1389,7 @@ probe_error_v4l2_ctrl_handler_free:
mutex_destroy(&hm2170->mutex);
probe_error_ret:
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
hm2170_power_off(&client->dev);
#endif
@@ -1399,7 +1399,7 @@ probe_error_ret:
static const struct dev_pm_ops hm2170_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(hm2170_suspend, hm2170_resume)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
SET_RUNTIME_PM_OPS(hm2170_power_off, hm2170_power_on, NULL)
#endif
diff --git a/drivers/media/i2c/hm2172.c b/drivers/media/i2c/hm2172.c
index 3362d3151..8e1d1f883 100644
--- a/drivers/media/i2c/hm2172.c
+++ b/drivers/media/i2c/hm2172.c
@@ -15,7 +15,7 @@
#include <media/v4l2-fwnode.h>
#include <linux/clk.h>
#include <linux/gpio/consumer.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
#include <linux/vsc.h>
@@ -927,7 +927,7 @@ struct hm2172 {
struct gpio_desc *reset;
struct gpio_desc *handshake;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
struct vsc_mipi_config conf;
struct vsc_camera_status status;
@@ -942,7 +942,7 @@ struct hm2172 {
/* Streaming on/off */
bool streaming;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
bool use_intel_vsc;
#endif
@@ -1109,7 +1109,7 @@ static int hm2172_set_ctrl(struct v4l2_ctrl *ctrl)
ret = hm2172_test_pattern(hm2172, ctrl->val);
break;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
case V4L2_CID_PRIVACY:
dev_dbg(&client->dev, "set privacy to %d", ctrl->val);
@@ -1142,7 +1142,7 @@ static int hm2172_init_controls(struct hm2172 *hm2172)
int ret = 0;
ctrl_hdlr = &hm2172->ctrl_handler;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
#else
@@ -1183,7 +1183,7 @@ static int hm2172_init_controls(struct hm2172 *hm2172)
if (hm2172->hblank)
hm2172->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
hm2172->privacy_status = v4l2_ctrl_new_std(ctrl_hdlr, &hm2172_ctrl_ops,
V4L2_CID_PRIVACY, 0, 1, 1,
@@ -1223,7 +1223,7 @@ static void hm2172_update_pad_format(const struct hm2172_mode *mode,
fmt->field = V4L2_FIELD_NONE;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static void hm2172_vsc_privacy_callback(void *handle,
enum vsc_privacy_status status)
@@ -1309,7 +1309,7 @@ static int hm2172_power_off(struct device *dev)
struct hm2172 *hm2172 = to_hm2172(sd);
int ret = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (hm2172->use_intel_vsc) {
ret = vsc_release_camera_sensor(&hm2172->status);
@@ -1336,7 +1336,7 @@ static int hm2172_power_on(struct device *dev)
struct hm2172 *hm2172 = to_hm2172(sd);
int ret;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (hm2172->use_intel_vsc) {
hm2172->conf.lane_num = HM2172_DATA_LANES;
@@ -1392,7 +1392,7 @@ static int hm2172_get_pm_resources(struct device *dev)
struct hm2172 *hm2172 = to_hm2172(sd);
int ret = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_handle_list dep_devices;
diff --git a/drivers/media/i2c/ov01a10.c b/drivers/media/i2c/ov01a10.c
index 78ae01811..31f1e7a3d 100644
--- a/drivers/media/i2c/ov01a10.c
+++ b/drivers/media/i2c/ov01a10.c
@@ -11,7 +11,7 @@
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
#include <linux/vsc.h>
#endif
@@ -296,7 +296,7 @@ struct ov01a10 {
/* To serialize asynchronus callbacks */
struct mutex mutex;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
struct vsc_mipi_config conf;
struct vsc_camera_status status;
@@ -469,7 +469,7 @@ static int ov01a10_set_ctrl(struct v4l2_ctrl *ctrl)
ret = ov01a10_test_pattern(ov01a10, ctrl->val);
break;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
case V4L2_CID_PRIVACY:
dev_dbg(&client->dev, "set privacy to %d", ctrl->val);
@@ -500,7 +500,7 @@ static int ov01a10_init_controls(struct ov01a10 *ov01a10)
int ret = 0;
ctrl_hdlr = &ov01a10->ctrl_handler;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
#else
@@ -539,7 +539,7 @@ static int ov01a10_init_controls(struct ov01a10 *ov01a10)
if (ov01a10->hblank)
ov01a10->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ov01a10->privacy_status = v4l2_ctrl_new_std(ctrl_hdlr,
&ov01a10_ctrl_ops,
@@ -661,7 +661,7 @@ static int ov01a10_set_stream(struct v4l2_subdev *sd, int enable)
return ret;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static void ov01a10_vsc_privacy_callback(void *handle,
enum vsc_privacy_status status)
@@ -1016,7 +1016,7 @@ static int ov01a10_probe(struct i2c_client *client)
return -ENOMEM;
v4l2_i2c_subdev_init(&ov01a10->sd, client, &ov01a10_subdev_ops);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ov01a10->conf.lane_num = OV01A10_DATA_LANES;
/* frequency unit 100k */
@@ -1082,7 +1082,7 @@ probe_error_v4l2_ctrl_handler_free:
mutex_destroy(&ov01a10->mutex);
probe_error_ret:
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ov01a10_power_off(&client->dev);
#endif
@@ -1092,7 +1092,7 @@ probe_error_ret:
static const struct dev_pm_ops ov01a10_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(ov01a10_suspend, ov01a10_resume)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
SET_RUNTIME_PM_OPS(ov01a10_power_off, ov01a10_power_on, NULL)
#endif
diff --git a/drivers/media/i2c/ov01a1s.c b/drivers/media/i2c/ov01a1s.c
index f7cf2218c..85f9c684c 100644
--- a/drivers/media/i2c/ov01a1s.c
+++ b/drivers/media/i2c/ov01a1s.c
@@ -17,7 +17,7 @@
#elif IS_ENABLED(CONFIG_POWER_CTRL_LOGIC)
#include "power_ctrl_logic.h"
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
#include <linux/vsc.h>
#endif
@@ -303,7 +303,7 @@ struct ov01a1s {
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *exposure;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
struct v4l2_ctrl *privacy_status;
@@ -337,7 +337,7 @@ struct ov01a1s {
#if IS_ENABLED(CONFIG_INTEL_SKL_INT3472) || IS_ENABLED(CONFIG_POWER_CTRL_LOGIC)
OV01A1S_USE_INT3472 = 1,
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
OV01A1S_USE_INTEL_VSC = 2,
#endif
@@ -508,7 +508,7 @@ static int ov01a1s_set_ctrl(struct v4l2_ctrl *ctrl)
ret = ov01a1s_test_pattern(ov01a1s, ctrl->val);
break;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
case V4L2_CID_PRIVACY:
dev_dbg(&client->dev, "set privacy to %d", ctrl->val);
@@ -539,7 +539,7 @@ static int ov01a1s_init_controls(struct ov01a1s *ov01a1s)
int ret = 0;
ctrl_hdlr = &ov01a1s->ctrl_handler;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
#else
@@ -577,7 +577,7 @@ static int ov01a1s_init_controls(struct ov01a1s *ov01a1s)
1, h_blank);
if (ov01a1s->hblank)
ov01a1s->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ov01a1s->privacy_status = v4l2_ctrl_new_std(ctrl_hdlr,
&ov01a1s_ctrl_ops,
@@ -619,7 +619,7 @@ static void ov01a1s_update_pad_format(const struct ov01a1s_mode *mode,
fmt->field = V4L2_FIELD_NONE;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static void ov01a1s_vsc_privacy_callback(void *handle,
enum vsc_privacy_status status)
@@ -729,7 +729,7 @@ static int ov01a1s_power_off(struct device *dev)
if (ov01a1s->power_type == OV01A1S_USE_INT3472)
ret = power_ctrl_logic_set_power(0);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (ov01a1s->power_type == OV01A1S_USE_INTEL_VSC) {
ret = vsc_release_camera_sensor(&ov01a1s->status);
@@ -764,7 +764,7 @@ static int ov01a1s_power_on(struct device *dev)
if (ov01a1s->power_type == OV01A1S_USE_INT3472)
ret = power_ctrl_logic_set_power(1);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (ov01a1s->power_type == OV01A1S_USE_INTEL_VSC) {
ret = vsc_acquire_camera_sensor(&ov01a1s->conf,
@@ -1125,7 +1125,7 @@ static int ov01a1s_parse_power(struct ov01a1s *ov01a1s)
{
int ret = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ov01a1s->conf.lane_num = OV01A1S_DATA_LANES;
/* frequency unit 100k */
diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index 40865f8e3..4f58d5ac9 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -13,7 +13,7 @@
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
#include <linux/vsc.h>
@@ -697,7 +697,7 @@ struct ov02c10 {
struct gpio_desc *reset;
struct gpio_desc *handshake;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
struct vsc_mipi_config conf;
struct vsc_camera_status status;
@@ -717,7 +717,7 @@ IS_ENABLED(CONFIG_INTEL_VSC)
/* Module name index */
u8 module_name_index;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
bool use_intel_vsc;
@@ -857,7 +857,7 @@ static int ov02c10_set_ctrl(struct v4l2_ctrl *ctrl)
ret = ov02c10_test_pattern(ov02c10, ctrl->val);
break;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
case V4L2_CID_PRIVACY:
dev_dbg(&client->dev, "set privacy to %d", ctrl->val);
@@ -888,7 +888,7 @@ static int ov02c10_init_controls(struct ov02c10 *ov02c10)
int ret = 0;
ctrl_hdlr = &ov02c10->ctrl_handler;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
#else
@@ -926,7 +926,7 @@ IS_ENABLED(CONFIG_INTEL_VSC)
1, h_blank);
if (ov02c10->hblank)
ov02c10->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ov02c10->privacy_status = v4l2_ctrl_new_std(ctrl_hdlr,
&ov02c10_ctrl_ops,
@@ -1102,7 +1102,7 @@ static int ov02c10_get_pm_resources(struct device *dev)
struct ov02c10 *ov02c10 = to_ov02c10(sd);
int ret;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_handle_list deps;
@@ -1162,7 +1162,7 @@ IS_ENABLED(CONFIG_INTEL_VSC)
return 0;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static void ov02c10_vsc_privacy_callback(void *handle,
enum vsc_privacy_status status)
@@ -1179,7 +1179,7 @@ static int ov02c10_power_off(struct device *dev)
struct ov02c10 *ov02c10 = to_ov02c10(sd);
int ret = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (ov02c10->use_intel_vsc) {
ret = vsc_release_camera_sensor(&ov02c10->status);
@@ -1206,7 +1206,7 @@ static int ov02c10_power_on(struct device *dev)
struct ov02c10 *ov02c10 = to_ov02c10(sd);
int ret;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (ov02c10->use_intel_vsc) {
ov02c10->conf.lane_num = ov02c10->mipi_lanes;
diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c
index 916def90f..c5c373aa6 100644
--- a/drivers/media/i2c/ov02e10.c
+++ b/drivers/media/i2c/ov02e10.c
@@ -13,7 +13,7 @@
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
#include <linux/vsc.h>
@@ -289,7 +289,7 @@ struct ov02e10 {
struct gpio_desc *reset;
struct gpio_desc *handshake;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
struct vsc_mipi_config conf;
struct vsc_camera_status status;
@@ -304,7 +304,7 @@ struct ov02e10 {
/* Streaming on/off */
bool streaming;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
bool use_intel_vsc;
#endif
@@ -486,7 +486,7 @@ static int ov02e10_set_ctrl(struct v4l2_ctrl *ctrl)
ret = ov02e10_test_pattern(ov02e10, ctrl->val);
break;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
case V4L2_CID_PRIVACY:
dev_dbg(&client->dev, "set privacy to %d", ctrl->val);
@@ -520,7 +520,7 @@ static int ov02e10_init_controls(struct ov02e10 *ov02e10)
int ret;
ctrl_hdlr = &ov02e10->ctrl_handler;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
#else
@@ -561,7 +561,7 @@ static int ov02e10_init_controls(struct ov02e10 *ov02e10)
if (ov02e10->hblank)
ov02e10->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
ov02e10->privacy_status = v4l2_ctrl_new_std(ctrl_hdlr, &ov02e10_ctrl_ops,
V4L2_CID_PRIVACY, 0, 1, 1,
@@ -602,7 +602,7 @@ static void ov02e10_update_pad_format(const struct ov02e10_mode *mode,
fmt->field = V4L2_FIELD_NONE;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
static void ov02e10_vsc_privacy_callback(void *handle,
enum vsc_privacy_status status)
@@ -696,7 +696,7 @@ static int ov02e10_get_pm_resources(struct device *dev)
struct ov02e10 *ov02e10 = to_ov02e10(sd);
int ret;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_handle_list dep_devices;
@@ -763,7 +763,7 @@ static int ov02e10_power_off(struct device *dev)
struct ov02e10 *ov02e10 = to_ov02e10(sd);
int ret = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (ov02e10->use_intel_vsc) {
ret = vsc_release_camera_sensor(&ov02e10->status);
@@ -790,7 +790,7 @@ static int ov02e10_power_on(struct device *dev)
struct ov02e10 *ov02e10 = to_ov02e10(sd);
int ret;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \
IS_ENABLED(CONFIG_INTEL_VSC)
if (ov02e10->use_intel_vsc) {
ov02e10->conf.lane_num = OV02E10_DATA_LANES;
--
2.45.1
@@ -1,93 +0,0 @@
%global commit0 aecec2aaef069fea56aa921cf5d7e449bb7a0b82
%global date 20240624
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global commit1 a6dccbbf5a955489d20d996234b6ebb481183ed7
%global date 20240416
%global shortcommit1 %(c=%{commit0}; echo ${c:0:7})
%define buildforkernels akmod
%global debug_package %{nil}
%global realname intel-ipu6
Name: %{realname}-kmod
Version: %{date}.%{shortcommit0}
Release: 1%{?dist}
Summary: Kernel drivers for the IPU 6 and sensors
License: GPL-3.0-only
URL: https://github.com/intel/ipu6-drivers
Source0: https://github.com/intel/ipu6-drivers/archive/%{commit0}.tar.gz#/ipu6-drivers-%{shortcommit0}.tar.gz
Source1: https://github.com/intel/ivsc-driver/archive/%{commit1}.tar.gz#/ivsc-driver-%{shortcommit1}.tar.gz
### intel/ipu6-drivers | PR #214 | Ipu6-isys probe improvements
## https://github.com/intel/ipu6-drivers/pull/214
Patch0: 0000-probe-improvements.patch
### intel/ipu6-drivers | PR #239 | gc5035: Fix compilation with kernels >= 6.8
## https://github.com/intel/ipu6-drivers/pull/239
Patch1: 0001-fix-compilation-6.8.patch
### intel/ipu6-drivers | PR #242 | media: ipu6: Fix compilation with kernels >= 6.10
## https://github.com/intel/ipu6-drivers/pull/242
Patch2: 0002-fix-compilation-6.10.patch
### intel-ipu6-drivers | PR #243 | Rename ipu6 .ko files to avoid conflict with upstream ipu6 isys support
## https://github.com/intel/ipu6-drivers/pull/243
Patch3: 0003-prefix-modules.patch
### intel/ipu6-drivers | PR #261 | media: ipu6: Fix compilation with kernels >= 6.11
## https://github.com/intel/ipu6-drivers/pull/261
Patch4: 0004-fix-compilation-6.11.patch
### intel/ipu6-drivers | PR #283 | media: ipu6: Fix compilation with kernels >= 6.12
## https://github.com/intel/ipu6-drivers/pull/283
Patch5: 0005-fix-compilation-6.12.patch
Patch6: 0006-fix-compilation-6.12-no-no_llseek.patch
### jwrdegoede/ipu6-drivers | Commit 2c4ad13 | Makefile: Adjust which modules to build for which kernel-versions for Fedora
## https://github.com/jwrdegoede/ipu6-drivers/commit/2c4ad1398dddfb307e8a40a714a6d5f70d6d14cb
Patch7: 0007-modules-per-kernel.patch
BuildRequires: gcc
BuildRequires: elfutils-libelf-devel
BuildRequires: kmodtool
%{expand:%(kmodtool --target %{_target_cpu} --repo terra --kmodname %{realname} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"}) }
%description
Kernel drivers for Intel iVSC, IPU 6, and sensors.
%prep
%{?kmodtool_check}
kmodtool --target %{_target_cpu} --repo terra --kmodname %{realname} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"}
%autosetup -p1 -n ipu6-drivers-%{commit0} -a 1
cp -av ivsc-driver-%{commit1}/{backport-include,drivers,include} .
rm -fr intel-vsc-%{commit1}
for kernel_version in %{?kernel_versions}; do
mkdir _kmod_build_${kernel_version%%___*}
cp -fr backport-include drivers include Makefile _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions}; do
pushd _kmod_build_${kernel_version%%___*}/
%make_build -C "${kernel_version##*___}" M=$(pwd) VERSION="v%{version}" modules
popd
done
%install
for kernel_version in %{?kernel_versions}; do
mkdir -p %{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
install -p -m 0755 \
_kmod_build_${kernel_version%%___*}/*.ko \
_kmod_build_${kernel_version%%___*}/drivers/media/i2c/*.ko \
_kmod_build_${kernel_version%%___*}/drivers/media/pci/intel/ipu6/*.ko \
%{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
done
%{?akmod_install}
### Reloading the modules is needed for %{PATCH0} to take effect properly on some kernels, as well for the changes to be properly reverted on uninstall.
## See: https://github.com/intel/ipu6-drivers/pull/214#issuecomment-1986110818
%post
/usr/sbin/rmmod -f intel_ipu6_psys intel_ipu6_isys intel_ipu6
/usr/sbin/modprobe -a intel_ipu6 intel_ipu6_isys intel_ipu6_psys
%postun
/usr/sbin/rmmod -f intel_ipu6_psys intel_ipu6_isys intel_ipu6
/usr/sbin/modprobe -a intel_ipu6 intel_ipu6_isys intel_ipu6_psys
%changelog
%autochangelog
@@ -0,0 +1,88 @@
From c451aa3f50f8a5ef26d9a36f159c3f9fb8e6ef11 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 10 Jun 2024 13:05:53 +0200
Subject: [PATCH 1/9] Makefile: Switch sensor driver symbols from
CONFIG_VIDEO_FOO to CONFIG_ICAMERA_FOO
Switch the Kconfig symbols for sensor drivers from CONFIG_VIDEO_FOO to
CONFIG_ICAMERA_FOO to avoid these still being set when they should not
because of the CONFIG_VIDEO_FOO symbols inherited from the base kernel.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 22 +++++++++++-----------
drivers/media/i2c/Makefile | 22 +++++++++++-----------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/Makefile b/Makefile
index 49b27300a..356f5e7f3 100644
--- a/Makefile
+++ b/Makefile
@@ -81,22 +81,22 @@ else
obj-y += drivers/media/pci/intel/ipu6/psys/
endif
-export CONFIG_VIDEO_HM11B1 = m
-export CONFIG_VIDEO_OV01A1S = m
-export CONFIG_VIDEO_OV01A10 = m
-export CONFIG_VIDEO_OV02C10 = m
-export CONFIG_VIDEO_OV02E10 = m
-export CONFIG_VIDEO_HM2170 = m
-export CONFIG_VIDEO_HM2172 = m
-export CONFIG_VIDEO_HI556 = m
+export CONFIG_ICAMERA_HM11B1 = m
+export CONFIG_ICAMERA_OV01A1S = m
+export CONFIG_ICAMERA_OV01A10 = m
+export CONFIG_ICAMERA_OV02C10 = m
+export CONFIG_ICAMERA_OV02E10 = m
+export CONFIG_ICAMERA_HM2170 = m
+export CONFIG_ICAMERA_HM2172 = m
+export CONFIG_ICAMERA_HI556 = m
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
-export CONFIG_VIDEO_OV2740 = m
-export CONFIG_VIDEO_GC5035 = m
+export CONFIG_ICAMERA_OV2740 = m
+export CONFIG_ICAMERA_GC5035 = m
endif
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
-export CONFIG_VIDEO_OV05C10 = m
+export CONFIG_ICAMERA_OV05C10 = m
endif
obj-y += drivers/media/i2c/
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index b4fa25598..2bcc878e7 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -1,15 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2021 Intel Corporation.
-obj-$(CONFIG_VIDEO_HM11B1) += hm11b1.o
-obj-$(CONFIG_VIDEO_GC5035) += gc5035.o
-obj-$(CONFIG_VIDEO_OV01A1S) += ov01a1s.o
-obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o
-obj-$(CONFIG_VIDEO_OV02C10) += ov02c10.o
-obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.o
-obj-$(CONFIG_VIDEO_OV05C10) += ov05c10.o
-obj-$(CONFIG_VIDEO_OV2740) += ov2740.o
-obj-$(CONFIG_VIDEO_HM2170) += hm2170.o
-obj-$(CONFIG_VIDEO_HM2170) += hm2172.o
-obj-$(CONFIG_VIDEO_HI556) += hi556.o
+obj-$(CONFIG_ICAMERA_HM11B1) += hm11b1.o
+obj-$(CONFIG_ICAMERA_GC5035) += gc5035.o
+obj-$(CONFIG_ICAMERA_OV01A1S) += ov01a1s.o
+obj-$(CONFIG_ICAMERA_OV01A10) += ov01a10.o
+obj-$(CONFIG_ICAMERA_OV02C10) += ov02c10.o
+obj-$(CONFIG_ICAMERA_OV02E10) += ov02e10.o
+obj-$(CONFIG_ICAMERA_OV05C10) += ov05c10.o
+obj-$(CONFIG_ICAMERA_OV2740) += ov2740.o
+obj-$(CONFIG_ICAMERA_HM2170) += hm2170.o
+obj-$(CONFIG_ICAMERA_HM2170) += hm2172.o
+obj-$(CONFIG_ICAMERA_HI556) += hi556.o
obj-$(CONFIG_POWER_CTRL_LOGIC) += power_ctrl_logic.o
--
2.48.1
@@ -1,17 +1,38 @@
From b839b8153bd364c22811496c1753145fa475bcc8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 10 Jun 2024 13:41:16 +0200
Subject: [PATCH 2/9] Makefile: Re-enable gc5035 compilation with kernels >=
6.8
For some reason the gc5035 driver has been disabled for kernels >= 6.8,
but it is not upstream yet.
Fix compilation with kernel >= 6.8 and re-enable the driver.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 2 +-
drivers/media/i2c/gc5035.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 356f5e7f3..58bc10aed 100644
--- a/Makefile
+++ b/Makefile
@@ -83,10 +83,10 @@ export CONFIG_VIDEO_OV02E10 = m
export CONFIG_VIDEO_HM2170 = m
export CONFIG_VIDEO_HM2172 = m
export CONFIG_VIDEO_HI556 = m
+export CONFIG_VIDEO_GC5035 = m
@@ -89,10 +89,10 @@ export CONFIG_ICAMERA_OV02E10 = m
export CONFIG_ICAMERA_HM2170 = m
export CONFIG_ICAMERA_HM2172 = m
export CONFIG_ICAMERA_HI556 = m
+export CONFIG_ICAMERA_GC5035 = m
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
export CONFIG_VIDEO_OV2740 = m
-export CONFIG_VIDEO_GC5035 = m
export CONFIG_ICAMERA_OV2740 = m
-export CONFIG_ICAMERA_GC5035 = m
endif
obj-y += drivers/media/i2c/
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
diff --git a/drivers/media/i2c/gc5035.c b/drivers/media/i2c/gc5035.c
index 16bbd4845..e825dfa7d 100644
--- a/drivers/media/i2c/gc5035.c
+++ b/drivers/media/i2c/gc5035.c
@@ -1497,7 +1497,11 @@ static int gc5035_set_fmt(struct v4l2_subdev *sd,
@@ -71,3 +92,6 @@
ret = gc5035_initialize_controls(gc5035);
if (ret) {
dev_err_probe(dev, ret, "Failed to initialize controls\n");
--
2.48.1
@@ -0,0 +1,54 @@
From 580d73c387405534bdef7911e0616ad66953f7ce Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 13 Jan 2025 13:11:00 +0100
Subject: [PATCH 3/9] Makefile: Do not build hi556 driver with kernels >= 6.10
The mainline kernel hi556 driver has ACPI enumeration, GPIO and clk support
since kernel 6.10, so it can be used instead of the out of tree driver.
Add a new KV_HI556 variable and stop building the hi556 driver on
kernels >= 6.10.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 58bc10aed..472fdec22 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ KV_IVSC := 6.6.0
KV_IPU_BRIDGE := 6.6.0
KV_OV2740 := 6.8.0
KV_OV05C10 := 6.8.0
+KV_HI556 := 6.10
KV_IPU6_ISYS := 6.10.0
KERNEL_SRC ?= /lib/modules/$(KERNELRELEASE)/build
@@ -88,17 +89,21 @@ export CONFIG_ICAMERA_OV02C10 = m
export CONFIG_ICAMERA_OV02E10 = m
export CONFIG_ICAMERA_HM2170 = m
export CONFIG_ICAMERA_HM2172 = m
-export CONFIG_ICAMERA_HI556 = m
export CONFIG_ICAMERA_GC5035 = m
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
export CONFIG_ICAMERA_OV2740 = m
endif
+# Note OV05C10 check is reversed, it is not build on too old kernels
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
export CONFIG_ICAMERA_OV05C10 = m
endif
+ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_HI556)),true)
+export CONFIG_ICAMERA_HI556 = m
+endif
+
obj-y += drivers/media/i2c/
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_IVSC)),true)
--
2.48.1
@@ -0,0 +1,51 @@
From 14d41bf82770fcab65dcf3b2eec3f95b7a963aff Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 13 Jan 2025 13:15:15 +0100
Subject: [PATCH 4/9] Makefile: Do not build ov01a10 driver with kernels >= 6.8
Since commit 47a78052db51 ("media: ov01a10: Enable runtime PM before
registering async sub-device") the mainline ov01a10 driver is fully
usable and it can be used instead of the out of tree driver.
Add a new KV_OV01A10 variable and stop building the ov01a10 driver on
kernels >= 6.8.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 472fdec22..7ae3be835 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ version_lt = $(shell \
KV_IVSC := 6.6.0
KV_IPU_BRIDGE := 6.6.0
KV_OV2740 := 6.8.0
+KV_OV01A10 := 6.8.0
KV_OV05C10 := 6.8.0
KV_HI556 := 6.10
KV_IPU6_ISYS := 6.10.0
@@ -84,7 +85,6 @@ endif
export CONFIG_ICAMERA_HM11B1 = m
export CONFIG_ICAMERA_OV01A1S = m
-export CONFIG_ICAMERA_OV01A10 = m
export CONFIG_ICAMERA_OV02C10 = m
export CONFIG_ICAMERA_OV02E10 = m
export CONFIG_ICAMERA_HM2170 = m
@@ -95,6 +95,10 @@ ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
export CONFIG_ICAMERA_OV2740 = m
endif
+ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV01A10)),true)
+export CONFIG_ICAMERA_OV01A10 = m
+endif
+
# Note OV05C10 check is reversed, it is not build on too old kernels
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
export CONFIG_ICAMERA_OV05C10 = m
--
2.48.1
@@ -0,0 +1,28 @@
From 7ce00bf77d1b92981f471a26fa2d92c96d14e51c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 14 Jan 2025 23:07:35 +0100
Subject: [PATCH 5/9] media: ipu6: Fix out of tree builds
Fix out of tree builds not finding the ipu6*.h files.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/pci/intel/ipu6/psys/Makefile b/drivers/media/pci/intel/ipu6/psys/Makefile
index fa638fcdf..9a3aa6e78 100644
--- a/drivers/media/pci/intel/ipu6/psys/Makefile
+++ b/drivers/media/pci/intel/ipu6/psys/Makefile
@@ -23,6 +23,8 @@ obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6-psys.o
ifeq ($(is_kernel_lt_6_10), 1)
ccflags-y += -I$(src)/../ipu6/
+else
+ccflags-y += -I/lib/modules/$(KERNELRELEASE)/build/drivers/media/pci/intel/ipu6/
endif
ccflags-y += -I$(src)/../
ccflags-y += -I$(src)/../../
--
2.48.1
@@ -0,0 +1,53 @@
From a42273020f4a2e1c633dda6f30c512db56738b67 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 14 Jan 2025 23:08:04 +0100
Subject: [PATCH 6/9] media: ipu6: Fix building with kernel 6.13
Fix building with kernel 6.13.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 8 ++++++++
drivers/media/pci/intel/ipu6/psys/ipu6-psys.c | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index 00e394f20..36f99a3b8 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -2681,8 +2681,16 @@ MODULE_AUTHOR("Yunliang Ding <yunliang.ding@intel.com>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Intel ipu processing system driver");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) || IS_ENABLED(CONFIG_DRM_I915_HAS_SRIOV)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS(DMA_BUF);
+#else
+MODULE_IMPORT_NS("DMA_BUF");
+#endif
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS(INTEL_IPU6);
+#else
+MODULE_IMPORT_NS("INTEL_IPU6");
+#endif
#endif
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
index 53c845ba3..0c3a5ca62 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
@@ -32,7 +32,11 @@
#include "ipu6-platform-buttress-regs.h"
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS(DMA_BUF);
+#else
+MODULE_IMPORT_NS("DMA_BUF");
+#endif
static bool early_pg_transfer;
module_param(early_pg_transfer, bool, 0664);
--
2.48.1
@@ -0,0 +1,49 @@
From 32ce53b82bef51479d49d7d68794e2b801367dd6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 30 Jan 2025 22:20:16 +0100
Subject: [PATCH 7/9] Modify 0001-v6.10-IPU6-headers-used-by-PSYS.patch for
v6.13
Modify 0001-v6.10-IPU6-headers-used-by-PSYS.patch so that it also works
with 6.13 kernels.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
index 00fb961d2..6a465a924 100644
--- a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
+++ b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
@@ -52,7 +52,7 @@ index 000000000..b26c6aee1
+
+struct ipu6_bus_device {
+ struct auxiliary_device auxdev;
-+ struct auxiliary_driver *auxdrv;
++ const struct auxiliary_driver *auxdrv;
+ const struct ipu6_auxdrv_data *auxdrv_data;
+ struct list_head list;
+ void *pdata;
@@ -92,7 +92,7 @@ new file mode 100644
index 000000000..9b6f56958
--- /dev/null
+++ b/drivers/media/pci/intel/ipu6/ipu6-buttress.h
-@@ -0,0 +1,92 @@
+@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Copyright (C) 2013--2024 Intel Corporation */
+
@@ -141,7 +141,9 @@ index 000000000..9b6f56958
+struct ipu6_buttress {
+ struct mutex power_mutex, auth_mutex, cons_mutex, ipc_mutex;
+ struct ipu6_buttress_ipc cse;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
+ struct ipu6_buttress_ipc ish;
++#endif
+ struct list_head constraints;
+ u32 wdt_cached_value;
+ bool force_suspend;
--
2.48.1
@@ -0,0 +1,306 @@
From a9236f549f28811a5af0c71ce6708d1f259d0e78 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 1 Feb 2025 08:04:35 +0100
Subject: [PATCH 8/9] ipu6-psys: Adjust DMA code for ipu6-bus DMA changes in
kernels >= 6.12
Upstream commit daabc5c64703 ("media: ipu6: not override the dma_ops of
device in driver") has changed the ipu6-bus code to no longer modify
the aux device's dma_ops, instead new ipu6_dma_*() helpers were introduced
modify the psys driver to use these new helpers.
This fixes the below DMA warning, which was followed by ipu6_psys_probe()
failing due to dma_alloc_attrs() failing:
Jan 31 11:59:59 x1 kernel: ------------[ cut here ]------------
Jan 31 11:59:59 x1 kernel: WARNING: CPU: 3 PID: 8595 at kernel/dma/mapping.c:597 dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: Modules linked in: intel_ipu6_psys(OE+) rfcomm snd_seq_dummy snd_hrtimer qrtr bnep binfmt_misc vfat fat snd_soc_skl_hda_dsp snd_soc_intel_sof_board_helpers snd_sof_probes snd_soc_intel_hda_dsp_common snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_soc_dmic snd_sof_pci_intel_mtl snd_sof_intel_hda_generic soundwire_intel soundwire_cadence snd_sof_intel_hda_common snd_soc_hdac_hda iwlmvm snd_sof_intel_hda_mlink snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp snd_sof snd_sof_utils snd_hda_ext_core mac80211 snd_soc_acpi_intel_match soundwire_generic_allocation snd_soc_acpi intel_uncore_frequency soundwire_bus intel_uncore_frequency_common x86_pkg_temp_thermal snd_soc_core intel_ipu6_isys intel_powerclamp videobuf2_dma_sg coretemp snd_compress videobuf2_memops ac97_bus videobuf2_v4l2 snd_pcm_dmaengine videobuf2_common snd_hda_intel libarc4 snd_intel_dspcfg snd_intel_sdw_acpi kvm_intel snd_hda_codec spi_nor btusb iTCO_wdt btrtl mhi_wwan_mbim intel_pmc_bxt mhi_wwan_ctrl
Jan 31 11:59:59 x1 kernel: snd_hda_core mei_gsc_proxy gpio_usbio(OE) mei_wdt i2c_usbio(OE) mtd iTCO_vendor_support intel_rapl_msr btintel snd_hwdep kvm btbcm btmtk snd_seq snd_ctl_led hid_sensor_accel_3d hid_sensor_gyro_3d iwlwifi bluetooth snd_seq_device rapl processor_thermal_device_pci intel_cstate hid_sensor_trigger think_lmi processor_thermal_device hid_sensor_iio_common processor_thermal_wt_hint industrialio_triggered_buffer intel_uncore usbio(OE) firmware_attributes_class snd_pcm wmi_bmof mhi_pci_generic kfifo_buf processor_thermal_rfim i2c_i801 mei_me cfg80211 processor_thermal_rapl thinkpad_acpi spi_intel_pci mhi industrialio thunderbolt snd_timer spi_intel mei intel_ipu6 i2c_smbus intel_rapl_common idma64 platform_profile processor_thermal_wt_req ipu_bridge rfkill processor_thermal_power_floor snd igen6_edac processor_thermal_mbox int3403_thermal soundcore soc_button_array int340x_thermal_zone intel_pmc_core intel_skl_int3472_tps68470 ov08x40(OE) tps68470_regulator v4l2_fwnode clk_tps68470 intel_vsec v4l2_async
Jan 31 11:59:59 x1 kernel: pmt_telemetry intel_skl_int3472_discrete int3400_thermal intel_hid acpi_tad pmt_class intel_skl_int3472_common acpi_pad sparse_keymap joydev acpi_thermal_rel loop nfnetlink zram lz4hc_compress lz4_compress dm_crypt xe drm_ttm_helper gpu_sched drm_suballoc_helper drm_gpuvm drm_exec hid_sensor_hub intel_ishtp_hid i915 i2c_algo_bit drm_buddy nvme ttm nvme_core drm_display_helper intel_ish_ipc video ucsi_acpi crct10dif_pclmul hid_multitouch crc32_pclmul crc32c_intel polyval_clmulni polyval_generic ghash_clmulni_intel intel_vpu sha512_ssse3 sha256_ssse3 typec_ucsi sha1_ssse3 intel_ishtp cec typec nvme_auth i2c_hid_acpi i2c_hid wmi pinctrl_meteorlake serio_raw v4l2loopback(OE) videodev mc i2c_dev fuse
Jan 31 11:59:59 x1 kernel: CPU: 3 UID: 0 PID: 8595 Comm: modprobe Tainted: G OE 6.12.10-200.fc41.x86_64 #1
Jan 31 11:59:59 x1 kernel: Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
Jan 31 11:59:59 x1 kernel: Hardware name: LENOVO 21KCSIT080/21KCSIT080, BIOS N3YET72W (1.37 ) 10/03/2024
Jan 31 11:59:59 x1 kernel: RIP: 0010:dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: Code: 4c 89 e6 48 89 df e8 94 5d 9a 00 49 89 c7 e9 62 ff ff ff 0f 0b 45 31 ff 5b 5d 4c 89 f8 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc <0f> 0b e9 0d ff ff ff 45 31 ff e9 3e ff ff ff 66 0f 1f 44 00 00 90
Jan 31 11:59:59 x1 kernel: RSP: 0018:ffffaeefe452fbc8 EFLAGS: 00010246
Jan 31 11:59:59 x1 kernel: RAX: 0000000000000000 RBX: ffff936a8de60800 RCX: 0000000000000cc0
Jan 31 11:59:59 x1 kernel: RDX: ffff936af6c65018 RSI: 0000000000002000 RDI: ffff936a8de60800
Jan 31 11:59:59 x1 kernel: RBP: ffff936a8de60800 R08: 0000000000000000 R09: ffff936af6c65000
Jan 31 11:59:59 x1 kernel: R10: ffffaeefe452fc00 R11: ffff9371bf9a17c0 R12: 0000000000002000
Jan 31 11:59:59 x1 kernel: R13: ffff936af6c65018 R14: 0000000000000000 R15: ffff936a9d9be440
Jan 31 11:59:59 x1 kernel: FS: 00007f8ff258f740(0000) GS:ffff9371bf980000(0000) knlGS:0000000000000000
Jan 31 11:59:59 x1 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jan 31 11:59:59 x1 kernel: CR2: 00007f2e39eee67c CR3: 000000013b884003 CR4: 0000000000f72ef0
Jan 31 11:59:59 x1 kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jan 31 11:59:59 x1 kernel: DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400
Jan 31 11:59:59 x1 kernel: PKRU: 55555554
Jan 31 11:59:59 x1 kernel: Call Trace:
Jan 31 11:59:59 x1 kernel: <TASK>
Jan 31 11:59:59 x1 kernel: ? dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: ? __warn.cold+0x93/0xfa
Jan 31 11:59:59 x1 kernel: ? dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: ? report_bug+0xff/0x140
Jan 31 11:59:59 x1 kernel: ? handle_bug+0x58/0x90
Jan 31 11:59:59 x1 kernel: ? exc_invalid_op+0x17/0x70
Jan 31 11:59:59 x1 kernel: ? asm_exc_invalid_op+0x1a/0x20
Jan 31 11:59:59 x1 kernel: ? dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: ipu6_psys_probe+0x37d/0x4b0 [intel_ipu6_psys]
Jan 31 11:59:59 x1 kernel: ? __pfx_ipu6_psys_probe+0x10/0x10 [intel_ipu6_psys]
Jan 31 11:59:59 x1 kernel: auxiliary_bus_probe+0x46/0x80
Jan 31 11:59:59 x1 kernel: ? driver_sysfs_add+0x57/0xc0
Jan 31 11:59:59 x1 kernel: really_probe+0xdb/0x340
Jan 31 11:59:59 x1 kernel: ? pm_runtime_barrier+0x54/0x90
Jan 31 11:59:59 x1 kernel: ? __pfx___driver_attach+0x10/0x10
Jan 31 11:59:59 x1 kernel: __driver_probe_device+0x78/0x110
Jan 31 11:59:59 x1 kernel: driver_probe_device+0x1f/0xa0
Jan 31 11:59:59 x1 kernel: __driver_attach+0xba/0x1c0
Jan 31 11:59:59 x1 kernel: bus_for_each_dev+0x8c/0xe0
Jan 31 11:59:59 x1 kernel: bus_add_driver+0x142/0x220
Jan 31 11:59:59 x1 kernel: driver_register+0x72/0xd0
Jan 31 11:59:59 x1 kernel: __auxiliary_driver_register+0x6e/0xd0
Jan 31 11:59:59 x1 kernel: ? __pfx_ipu6_psys_aux_driver_init+0x10/0x10 [intel_ipu6_psys]
Jan 31 11:59:59 x1 kernel: do_one_initcall+0x58/0x310
Jan 31 11:59:59 x1 kernel: do_init_module+0x90/0x260
Jan 31 11:59:59 x1 kernel: __do_sys_init_module+0x17a/0x1b0
Jan 31 11:59:59 x1 kernel: do_syscall_64+0x82/0x160
Jan 31 11:59:59 x1 kernel: ? exc_page_fault+0x7e/0x180
Jan 31 11:59:59 x1 kernel: entry_SYSCALL_64_after_hwframe+0x76/0x7e
Jan 31 11:59:59 x1 kernel: RIP: 0033:0x7f8ff1f0228e
Jan 31 11:59:59 x1 kernel: Code: 48 8b 0d 85 3b 0f 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 52 3b 0f 00 f7 d8 64 89 01 48
Jan 31 11:59:59 x1 kernel: RSP: 002b:00007ffdfbde11e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
Jan 31 11:59:59 x1 kernel: RAX: ffffffffffffffda RBX: 000055a0687e9240 RCX: 00007f8ff1f0228e
Jan 31 11:59:59 x1 kernel: RDX: 000055a05859a715 RSI: 0000000000041a65 RDI: 00007f8ff13a7010
Jan 31 11:59:59 x1 kernel: RBP: 00007ffdfbde12a0 R08: 000055a0687e8010 R09: 0000000000000007
Jan 31 11:59:59 x1 kernel: R10: 0000000000000001 R11: 0000000000000246 R12: 000055a05859a715
Jan 31 11:59:59 x1 kernel: R13: 0000000000040000 R14: 000055a0687e92e0 R15: 0000000000000000
Jan 31 11:59:59 x1 kernel: </TASK>
Jan 31 11:59:59 x1 kernel: ---[ end trace 0000000000000000 ]---
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 64 ++++++++++++++++++-
drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c | 6 +-
drivers/media/pci/intel/ipu6/psys/ipu6-psys.c | 22 +++++--
3 files changed, 85 insertions(+), 7 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index 36f99a3b8..7c512e5ae 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -52,6 +52,7 @@
#include "ipu-psys.h"
#include "ipu6-platform-regs.h"
#include "ipu6-fw-com.h"
+#include "ipu6-dma.h"
#endif
static bool async_fw_init;
@@ -228,9 +229,12 @@ struct ipu_psys_pg *__get_pg_buf(struct ipu_psys *psys, size_t pg_size)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
kpg->pg = dma_alloc_attrs(&psys->adev->dev, pg_size,
&kpg->pg_dma_addr, GFP_KERNEL, 0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kpg->pg = dma_alloc_attrs(dev, pg_size, &kpg->pg_dma_addr,
GFP_KERNEL, 0);
+#else
+ kpg->pg = ipu6_dma_alloc(to_ipu6_bus_device(dev), pg_size,
+ &kpg->pg_dma_addr, GFP_KERNEL, 0);
#endif
if (!kpg->pg) {
kfree(kpg);
@@ -597,6 +601,7 @@ static void ipu_dma_buf_detach(struct dma_buf *dbuf,
attach->priv = NULL;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
static struct sg_table *ipu_dma_buf_map(struct dma_buf_attachment *attach,
enum dma_data_direction dir)
{
@@ -658,6 +663,50 @@ static void ipu_dma_buf_unmap(struct dma_buf_attachment *attach,
#endif
}
+#else
+
+static struct sg_table *ipu_dma_buf_map(struct dma_buf_attachment *attach,
+ enum dma_data_direction dir)
+{
+ struct ipu_dma_buf_attach *ipu_attach = attach->priv;
+ struct ipu6_bus_device *adev = to_ipu6_bus_device(attach->dev);
+ struct pci_dev *pdev = adev->isp->pdev;
+ unsigned long attrs;
+ int ret;
+
+ attrs = DMA_ATTR_SKIP_CPU_SYNC;
+ ret = dma_map_sgtable(&pdev->dev, ipu_attach->sgt, dir, attrs);
+ if (ret) {
+ dev_dbg(attach->dev, "buf map failed\n");
+ return ERR_PTR(-EIO);
+ }
+
+ ret = ipu6_dma_map_sgtable(adev, ipu_attach->sgt, dir, attrs);
+ if (ret) {
+ dma_unmap_sgtable(&pdev->dev, ipu_attach->sgt, dir, attrs);
+ return ERR_PTR(-EIO);
+ }
+
+ /*
+ * Initial cache flush to avoid writing dirty pages for buffers which
+ * are later marked as IPU_BUFFER_FLAG_NO_FLUSH.
+ */
+ ipu6_dma_sync_sgtable(adev, ipu_attach->sgt);
+
+ return ipu_attach->sgt;
+}
+
+static void ipu_dma_buf_unmap(struct dma_buf_attachment *attach,
+ struct sg_table *sgt, enum dma_data_direction dir)
+{
+ struct ipu6_bus_device *adev = to_ipu6_bus_device(attach->dev);
+ struct pci_dev *pdev = adev->isp->pdev;
+
+ ipu6_dma_unmap_sgtable(adev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sgtable(&pdev->dev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC);
+}
+#endif
+
static int ipu_dma_buf_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma)
{
return -ENOTTY;
@@ -2371,7 +2420,12 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
kpg = kzalloc(sizeof(*kpg), GFP_KERNEL);
if (!kpg)
goto out_free_pgs;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kpg->pg = dma_alloc_attrs(dev, IPU_PSYS_PG_MAX_SIZE,
+#else
+ kpg->pg = ipu6_dma_alloc(adev, IPU_PSYS_PG_MAX_SIZE,
+#endif
&kpg->pg_dma_addr,
GFP_KERNEL, 0);
if (!kpg->pg) {
@@ -2426,7 +2480,11 @@ out_release_fw_com:
ipu6_fw_com_release(psys->fwcom, 1);
out_free_pgs:
list_for_each_entry_safe(kpg, kpg0, &psys->pgs, list) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
+#else
+ ipu6_dma_free(adev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
+#endif
kfree(kpg);
}
@@ -2484,8 +2542,10 @@ static void ipu6_psys_remove(struct auxiliary_device *auxdev)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
dma_free_attrs(&adev->dev, kpg->size, kpg->pg,
kpg->pg_dma_addr, 0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
+#else
+ ipu6_dma_free(psys->adev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
#endif
kfree(kpg);
}
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c b/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c
index 9038f69cd..5e6fb9a1b 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c
@@ -8,6 +8,7 @@
#include <asm/cacheflush.h>
#include "ipu6-ppg.h"
+#include "ipu6-dma.h"
static bool enable_suspend_resume;
module_param(enable_suspend_resume, bool, 0664);
@@ -75,9 +76,12 @@ __get_buf_set(struct ipu_psys_fh *fh, size_t buf_set_size)
kbuf_set->kaddr = dma_alloc_attrs(&fh->psys->adev->dev,
buf_set_size, &kbuf_set->dma_addr,
GFP_KERNEL, 0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kbuf_set->kaddr = dma_alloc_attrs(dev, buf_set_size,
&kbuf_set->dma_addr, GFP_KERNEL, 0);
+#else
+ kbuf_set->kaddr = ipu6_dma_alloc(to_ipu6_bus_device(dev), buf_set_size,
+ &kbuf_set->dma_addr, GFP_KERNEL, 0);
#endif
if (!kbuf_set->kaddr) {
kfree(kbuf_set);
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
index 0c3a5ca62..58662ea16 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
@@ -30,6 +30,7 @@
#include "ipu6-ppg.h"
#include "ipu6-platform-regs.h"
#include "ipu6-platform-buttress-regs.h"
+#include "ipu6-dma.h"
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
@@ -450,10 +451,12 @@ static struct ipu_psys_kcmd *ipu_psys_copy_cmd(struct ipu_psys_command *cmd,
kcmd->kbufs[i]->sgt->sgl,
kcmd->kbufs[i]->sgt->orig_nents,
DMA_BIDIRECTIONAL);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_sync_sg_for_device(dev, kcmd->kbufs[i]->sgt->sgl,
kcmd->kbufs[i]->sgt->orig_nents,
DMA_BIDIRECTIONAL);
+#else
+ ipu6_dma_sync_sgtable(psys->adev, kcmd->kbufs[i]->sgt);
#endif
}
@@ -1102,11 +1105,16 @@ int ipu_psys_fh_init(struct ipu_psys_fh *fh)
&kbuf_set->dma_addr,
GFP_KERNEL,
0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kbuf_set->kaddr = dma_alloc_attrs(dev,
IPU_PSYS_BUF_SET_MAX_SIZE,
&kbuf_set->dma_addr,
GFP_KERNEL, 0);
+#else
+ kbuf_set->kaddr = ipu6_dma_alloc(to_ipu6_bus_device(dev),
+ IPU_PSYS_BUF_SET_MAX_SIZE,
+ &kbuf_set->dma_addr,
+ GFP_KERNEL, 0);
#endif
if (!kbuf_set->kaddr) {
kfree(kbuf_set);
@@ -1124,8 +1132,11 @@ out_free_buf_sets:
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
dma_free_attrs(&psys->adev->dev,
kbuf_set->size, kbuf_set->kaddr,
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kbuf_set->size, kbuf_set->kaddr,
+#else
+ ipu6_dma_free(to_ipu6_bus_device(dev),
+ kbuf_set->size, kbuf_set->kaddr,
#endif
kbuf_set->dma_addr, 0);
list_del(&kbuf_set->list);
@@ -1229,8 +1240,11 @@ int ipu_psys_fh_deinit(struct ipu_psys_fh *fh)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
dma_free_attrs(&psys->adev->dev,
kbuf_set->size, kbuf_set->kaddr,
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kbuf_set->size, kbuf_set->kaddr,
+#else
+ ipu6_dma_free(to_ipu6_bus_device(dev),
+ kbuf_set->size, kbuf_set->kaddr,
#endif
kbuf_set->dma_addr, 0);
list_del(&kbuf_set->list);
--
2.48.1
@@ -0,0 +1,84 @@
From 47a2e1cf89b789bbc10d3cb3b26b357404633114 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 1 Feb 2025 08:19:22 +0100
Subject: [PATCH 9/9] Add ipu6-dma.h to
0001-v6.10-IPU6-headers-used-by-PSYS.patch
Add ipu6-dma.h to 0001-v6.10-IPU6-headers-used-by-PSYS.patch,
this is necessary for the DMA code adjustments in the psys code
which were done for the ipu6-bus DMA changes in kernels >= 6.12.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
...0001-v6.10-IPU6-headers-used-by-PSYS.patch | 55 +++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
index 6a465a924..b8eeaae66 100644
--- a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
+++ b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
@@ -1195,6 +1195,61 @@ index 000000000..92e3c3414
+ int pkg_dir_idx, void __iomem *base, u64 *pkg_dir,
+ dma_addr_t pkg_dir_dma_addr);
+#endif /* IPU6_H */
+diff --git a/drivers/media/pci/intel/ipu6/ipu6-dma.h b/drivers/media/pci/intel/ipu6/ipu6-dma.h
+new file mode 100644
+index 000000000..b51244add
+--- /dev/null
++++ b/drivers/media/pci/intel/ipu6/ipu6-dma.h
+@@ -0,0 +1,49 @@
++/* SPDX-License-Identifier: GPL-2.0-only */
++/* Copyright (C) 2013--2024 Intel Corporation */
++
++#ifndef IPU6_DMA_H
++#define IPU6_DMA_H
++
++#include <linux/dma-map-ops.h>
++#include <linux/dma-mapping.h>
++#include <linux/iova.h>
++#include <linux/iova.h>
++#include <linux/scatterlist.h>
++#include <linux/types.h>
++
++#include "ipu6-bus.h"
++
++struct ipu6_mmu_info;
++
++struct ipu6_dma_mapping {
++ struct ipu6_mmu_info *mmu_info;
++ struct iova_domain iovad;
++};
++
++void ipu6_dma_sync_single(struct ipu6_bus_device *sys, dma_addr_t dma_handle,
++ size_t size);
++void ipu6_dma_sync_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,
++ int nents);
++void ipu6_dma_sync_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt);
++void *ipu6_dma_alloc(struct ipu6_bus_device *sys, size_t size,
++ dma_addr_t *dma_handle, gfp_t gfp,
++ unsigned long attrs);
++void ipu6_dma_free(struct ipu6_bus_device *sys, size_t size, void *vaddr,
++ dma_addr_t dma_handle, unsigned long attrs);
++int ipu6_dma_mmap(struct ipu6_bus_device *sys, struct vm_area_struct *vma,
++ void *addr, dma_addr_t iova, size_t size,
++ unsigned long attrs);
++int ipu6_dma_map_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,
++ int nents, enum dma_data_direction dir,
++ unsigned long attrs);
++void ipu6_dma_unmap_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,
++ int nents, enum dma_data_direction dir,
++ unsigned long attrs);
++int ipu6_dma_map_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt,
++ enum dma_data_direction dir, unsigned long attrs);
++void ipu6_dma_unmap_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt,
++ enum dma_data_direction dir, unsigned long attrs);
++int ipu6_dma_get_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt,
++ void *cpu_addr, dma_addr_t handle, size_t size,
++ unsigned long attrs);
++#endif /* IPU6_DMA_H */
--
2.43.0
--
2.48.1
@@ -0,0 +1,202 @@
From c1cb2a62cd9d949fda60f5993a72ec0c44f52719 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 5 Feb 2025 13:20:21 +0100
Subject: [PATCH 10/11] psys: Do not skipping registering ipu_psys_bus for
kernels >= 6.10
The new auxbus code-paths were not registering the ipu_psys_bus used for
psys->dev.bus = &ipu_psys_bus, this was causing udev to not be able to
properly enumerate the device. For example running:
udevadm test -a add /dev/ipu-psys0
would fail with the following error:
"Failed to clone sd_device object: No such file or directory"
This udev issue in turn was causing issues with udev rules to set
permissions on /dev/ipu-psys0 not working
Fix this by:
1. Rename ipu6_psys_bus to ipu_psys_bus, there is no need for separate
names for this struct with different kernels and having the same name
allows code sharing.
2. Switching back from using module_auxiliary_driver() to using
module_init() / module_exit() codes for registering the drivers.
3. Move the now always used ipu_psys_init() and ipu_psys_exit()
out of any ifdefs blocks, so that these functions now always
(un)register the chrdev region and the ipu_psys_bus.
4. Remove the now duplicate chrdev region handling from the auxbus
ipu6_psys_probe() and ipu6_psys_remove() functions (now handled
by ipu_psys_init() and ipu_psys_exit()).
Signed-off-by: Hans de Goede
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 94 +++++++++-----------
1 file changed, 40 insertions(+), 54 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index 7c512e5ae..c06cd515a 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -92,7 +92,7 @@ static struct bus_type ipu_psys_bus = {
.name = IPU_PSYS_NAME,
};
#else
-static const struct bus_type ipu6_psys_bus = {
+static const struct bus_type ipu_psys_bus = {
.name = "intel-ipu6-psys",
};
#endif
@@ -2331,17 +2331,9 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
ipu_ver = adev->isp->hw_ver;
- rval = alloc_chrdev_region(&ipu_psys_dev_t, 0,
- IPU_PSYS_NUM_DEVICES, IPU6_PSYS_NAME);
- if (rval) {
- dev_err(dev, "can't alloc psys chrdev region (%d)\n",
- rval);
- return rval;
- }
-
rval = ipu6_mmu_hw_init(adev->mmu);
if (rval)
- goto out_unregister_chr_region;
+ return rval;
mutex_lock(&ipu_psys_mutex);
@@ -2453,7 +2445,7 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
goto out_free_pgs;
}
- psys->dev.bus = &ipu6_psys_bus;
+ psys->dev.bus = &ipu_psys_bus;
psys->dev.parent = dev;
psys->dev.devt = MKDEV(MAJOR(ipu_psys_dev_t), minor);
psys->dev.release = ipu_psys_dev_release;
@@ -2500,10 +2492,6 @@ out_unlock:
/* Safe to call even if the init is not called */
mutex_unlock(&ipu_psys_mutex);
ipu6_mmu_hw_cleanup(adev->mmu);
-
-out_unregister_chr_region:
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-
return rval;
}
#endif
@@ -2521,9 +2509,6 @@ static void ipu6_psys_remove(struct auxiliary_device *auxdev)
#endif
struct ipu_psys_pg *kpg, *kpg0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
#ifdef CONFIG_DEBUG_FS
if (isp->ipu_dir)
@@ -2658,38 +2643,6 @@ static struct ipu_bus_driver ipu_psys_driver = {
},
};
-static int __init ipu_psys_init(void)
-{
- int rval = alloc_chrdev_region(&ipu_psys_dev_t, 0,
- IPU_PSYS_NUM_DEVICES, IPU_PSYS_NAME);
- if (rval) {
- pr_err("can't alloc psys chrdev region (%d)\n", rval);
- return rval;
- }
-
- rval = bus_register(&ipu_psys_bus);
- if (rval) {
- pr_warn("can't register psys bus (%d)\n", rval);
- goto out_bus_register;
- }
-
- ipu_bus_register_driver(&ipu_psys_driver);
-
- return rval;
-
-out_bus_register:
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-
- return rval;
-}
-
-static void __exit ipu_psys_exit(void)
-{
- ipu_bus_unregister_driver(&ipu_psys_driver);
- bus_unregister(&ipu_psys_bus);
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-}
-
static const struct pci_device_id ipu_pci_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, IPU6_PCI_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, IPU6SE_PCI_ID)},
@@ -2700,9 +2653,6 @@ static const struct pci_device_id ipu_pci_tbl[] = {
{0,}
};
MODULE_DEVICE_TABLE(pci, ipu_pci_tbl);
-
-module_init(ipu_psys_init);
-module_exit(ipu_psys_exit);
#else
static const struct ipu6_auxdrv_data ipu6_psys_auxdrv_data = {
.isr_threaded = psys_isr_threaded,
@@ -2727,9 +2677,45 @@ static struct auxiliary_driver ipu6_psys_aux_driver = {
.pm = &psys_pm_ops,
},
};
-module_auxiliary_driver(ipu6_psys_aux_driver);
#endif
+static int __init ipu_psys_init(void)
+{
+ int rval = alloc_chrdev_region(&ipu_psys_dev_t, 0,
+ IPU_PSYS_NUM_DEVICES, ipu_psys_bus.name);
+ if (rval) {
+ pr_err("can't alloc psys chrdev region (%d)\n", rval);
+ return rval;
+ }
+
+ rval = bus_register(&ipu_psys_bus);
+ if (rval) {
+ pr_err("can't register psys bus (%d)\n", rval);
+ unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
+ return rval;
+ }
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+ ipu_bus_register_driver(&ipu_psys_driver);
+#else
+ auxiliary_driver_register(&ipu6_psys_aux_driver);
+#endif
+ return 0;
+}
+module_init(ipu_psys_init);
+
+static void __exit ipu_psys_exit(void)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+ ipu_bus_unregister_driver(&ipu_psys_driver);
+#else
+ auxiliary_driver_unregister(&ipu6_psys_aux_driver);
+#endif
+ bus_unregister(&ipu_psys_bus);
+ unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
+}
+module_exit(ipu_psys_exit);
+
MODULE_AUTHOR("Antti Laakso <antti.laakso@intel.com>");
MODULE_AUTHOR("Bin Han <bin.b.han@intel.com>");
MODULE_AUTHOR("Renwei Wu <renwei.wu@intel.com>");
--
2.48.1
@@ -0,0 +1,38 @@
From d5f08986936a7fda0cce543c73fb8d9bab76eae2 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 15 Jan 2025 11:28:54 +0100
Subject: [PATCH 10/12] usbio: Fix GPIO and I2C driver modaliases
The created GPIO and I2C devices have modaliases of
"platform:usbio-gpio" and "platform:usbio-i2c" note "usbio" not "usb"
fix the aliases of the drivers so that these will properly auto load.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpio/gpio-usbio.c | 2 +-
drivers/i2c/busses/i2c-usbio.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-usbio.c b/drivers/gpio/gpio-usbio.c
index 625558b..de9d5cb 100644
--- a/drivers/gpio/gpio-usbio.c
+++ b/drivers/gpio/gpio-usbio.c
@@ -499,4 +499,4 @@ MODULE_AUTHOR("Israel Cepeda <israel.a.cepeda.lopez@intel.com>");
MODULE_AUTHOR("Lifu Wang <lifu.wang@intel.com>");
MODULE_DESCRIPTION("Intel USBIO-GPIO driver");
MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:usb-gpio");
+MODULE_ALIAS("platform:usbio-gpio");
diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c
index ef1f380..3b2c856 100644
--- a/drivers/i2c/busses/i2c-usbio.c
+++ b/drivers/i2c/busses/i2c-usbio.c
@@ -437,4 +437,4 @@ MODULE_AUTHOR("Israel Cepeda <israel.a.cepeda.lopez@intel.com>");
MODULE_AUTHOR("Lifu Wang <lifu.wang@intel.com>");
MODULE_DESCRIPTION("Intel USBIO-I2C driver");
MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:usb-i2c");
+MODULE_ALIAS("platform:usbio-i2c");
--
2.47.1
@@ -0,0 +1,130 @@
From ce28836eb5ce74ae26a66a97949778bdb2cebc3c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 4 Feb 2025 17:34:54 +0100
Subject: [PATCH 11/11] psys: Use cdev_device_add() for /dev/ipu-psys0
Use cdev_device_add() for /dev/ipu-psys0 so that its kobj parents gets
set properly by calling cdev_set_parent().
"cdev_set_parent() sets a parent kobject which will be referenced
appropriately so the parent is not freed before the cdev. This
should be called before cdev_add."
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 45 ++++++++------------
1 file changed, 17 insertions(+), 28 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index c06cd515a..62fcf0215 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -2170,17 +2170,6 @@ static int ipu_psys_probe(struct ipu_bus_device *adev)
ipu_trace_init(adev->isp, psys->pdata->base, &adev->dev,
psys_trace_blocks);
- cdev_init(&psys->cdev, &ipu_psys_fops);
- psys->cdev.owner = ipu_psys_fops.owner;
-
- rval = cdev_add(&psys->cdev, MKDEV(MAJOR(ipu_psys_dev_t), minor), 1);
- if (rval) {
- dev_err(&adev->dev, "cdev_add failed (%d)\n", rval);
- goto out_unlock;
- }
-
- set_bit(minor, ipu_psys_devices);
-
spin_lock_init(&psys->ready_lock);
spin_lock_init(&psys->pgs_lock);
psys->ready = 0;
@@ -2261,12 +2250,19 @@ static int ipu_psys_probe(struct ipu_bus_device *adev)
psys->dev.devt = MKDEV(MAJOR(ipu_psys_dev_t), minor);
psys->dev.release = ipu_psys_dev_release;
dev_set_name(&psys->dev, "ipu-psys%d", minor);
- rval = device_register(&psys->dev);
+ device_initialize(&psys->dev);
+
+ cdev_init(&psys->cdev, &ipu_psys_fops);
+ psys->cdev.owner = ipu_psys_fops.owner;
+
+ rval = cdev_device_add(&psys->cdev, &psys->dev);
if (rval < 0) {
dev_err(&psys->dev, "psys device_register failed\n");
goto out_release_fw_com;
}
+ set_bit(minor, ipu_psys_devices);
+
/* Add the hw stepping information to caps */
strscpy(psys->caps.dev_model, IPU_MEDIA_DEV_MODEL_NAME,
sizeof(psys->caps.dev_model));
@@ -2298,7 +2294,6 @@ out_free_pgs:
ipu_psys_resource_pool_cleanup(&psys->resource_pool_running);
out_mutex_destroy:
mutex_destroy(&psys->mutex);
- cdev_del(&psys->cdev);
if (psys->sched_cmd_thread) {
kthread_stop(psys->sched_cmd_thread);
psys->sched_cmd_thread = NULL;
@@ -2359,17 +2354,6 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
psys->power_gating = 0;
- cdev_init(&psys->cdev, &ipu_psys_fops);
- psys->cdev.owner = ipu_psys_fops.owner;
-
- rval = cdev_add(&psys->cdev, MKDEV(MAJOR(ipu_psys_dev_t), minor), 1);
- if (rval) {
- dev_err(dev, "cdev_add failed (%d)\n", rval);
- goto out_unlock;
- }
-
- set_bit(minor, ipu_psys_devices);
-
spin_lock_init(&psys->ready_lock);
spin_lock_init(&psys->pgs_lock);
psys->ready = 0;
@@ -2450,12 +2434,19 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
psys->dev.devt = MKDEV(MAJOR(ipu_psys_dev_t), minor);
psys->dev.release = ipu_psys_dev_release;
dev_set_name(&psys->dev, "ipu-psys%d", minor);
- rval = device_register(&psys->dev);
+ device_initialize(&psys->dev);
+
+ cdev_init(&psys->cdev, &ipu_psys_fops);
+ psys->cdev.owner = ipu_psys_fops.owner;
+
+ rval = cdev_device_add(&psys->cdev, &psys->dev);
if (rval < 0) {
dev_err(dev, "psys device_register failed\n");
goto out_release_fw_com;
}
+ set_bit(minor, ipu_psys_devices);
+
/* Add the hw stepping information to caps */
strscpy(psys->caps.dev_model, IPU6_MEDIA_DEV_MODEL_NAME,
sizeof(psys->caps.dev_model));
@@ -2483,7 +2474,6 @@ out_free_pgs:
ipu_psys_resource_pool_cleanup(&psys->resource_pool_running);
out_mutex_destroy:
mutex_destroy(&psys->mutex);
- cdev_del(&psys->cdev);
if (psys->sched_cmd_thread) {
kthread_stop(psys->sched_cmd_thread);
psys->sched_cmd_thread = NULL;
@@ -2552,10 +2542,9 @@ static void ipu6_psys_remove(struct auxiliary_device *auxdev)
ipu_psys_resource_pool_cleanup(&psys->resource_pool_running);
- device_unregister(&psys->dev);
+ cdev_device_del(&psys->cdev, &psys->dev);
clear_bit(MINOR(psys->cdev.dev), ipu_psys_devices);
- cdev_del(&psys->cdev);
mutex_unlock(&ipu_psys_mutex);
--
2.48.1
@@ -0,0 +1,115 @@
From 47b34a6f467eebb4e9fc59f5e25618fe760fbf33 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 29 Jan 2025 19:13:29 +0100
Subject: [PATCH 11/12] usbio: Fix I2C max transfer size
There are 2 issues with the I2C max transfer size in the i2c-usbio module:
1. The code defines a usbio_i2c_quirks struct but does not set
i2c_adapter.quirks. This causes ov08x40_burst_fill_regs() to not split
i2c-transfers larger then USBIO_I2C_MAX_XFER_SIZE which causes them
to be rejected with -EINVAL. Fix this by setting i2c_adapter.quirks.
2. Once 1. is fixed the following error messages show up in dmesg:
Jan 28 18:31:04 x1 kernel: usbio-bridge 3-9:1.0: data not correct header->len:5 payload_len:3
Jan 28 18:31:04 x1 kernel: usbio-bridge 3-9:1.0: data not correct header->len:5 payload_len:3
...
Every time ov08x40_burst_fill_regs() gets called. This is caused by
the usbio_transfer_internal() splitting-up the i2c-transfer into
multiple USB bulk packets to honor MAX_PACKET_SIZE.
This splitting up seems to not work and the USBIO expander responds with
a 3 byte answer with flags set 0x0e which includes ERR_FLAG, it seems that
when ERR_FLAG is set only a 3 byte header is returned (no length field).
Modify USBIO_I2C_MAX_XFER_SIZE to avoid the splitting of the i2c-transfer
over multiple USB bulk packets, since the USBIO chip seems to not like
the splitting.
After this change to USBIO_I2C_MAX_XFER_SIZE the code to split transfers
in usbio_transfer_internal() is no longer necessary, remove it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/i2c/busses/i2c-usbio.c | 11 ++++++++++-
drivers/mfd/usbio.c | 33 ++-------------------------------
2 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c
index 3b2c856..a6c5edc 100644
--- a/drivers/i2c/busses/i2c-usbio.c
+++ b/drivers/i2c/busses/i2c-usbio.c
@@ -65,7 +65,15 @@ struct i2c_xfer {
u8 data[];
} __packed;
-#define USBIO_I2C_MAX_XFER_SIZE 256
+//[WA]: Max USB packet size needs to be 63
+//in order for fw download to work
+#define USBIO_MAX_PACKET_SIZE 63
+#define USBIO_BULK_MSG_HDR_SIZE 5
+
+#define USBIO_I2C_MAX_XFER_SIZE \
+ (USBIO_MAX_PACKET_SIZE - USBIO_BULK_MSG_HDR_SIZE - \
+ sizeof(struct i2c_rw_packet))
+
#define USBIO_I2C_BUF_SIZE \
(USBIO_I2C_MAX_XFER_SIZE + sizeof(struct i2c_rw_packet))
@@ -384,6 +392,7 @@ static int usbio_i2c_probe(struct platform_device *pdev)
usbio_i2c->adap.owner = THIS_MODULE;
usbio_i2c->adap.class = I2C_CLASS_HWMON;
usbio_i2c->adap.algo = &usbio_i2c_algo;
+ usbio_i2c->adap.quirks = &usbio_i2c_quirks;
usbio_i2c->adap.dev.parent = &pdev->dev;
try_bind_acpi(pdev, usbio_i2c);
diff --git a/drivers/mfd/usbio.c b/drivers/mfd/usbio.c
index 8bc7600..51757df 100644
--- a/drivers/mfd/usbio.c
+++ b/drivers/mfd/usbio.c
@@ -390,37 +390,8 @@ static int usbio_transfer_internal(struct platform_device *pdev, u8 cmd,
ret = usbio_control_xfer(stub, cmd, obuf, obuf_len,
ibuf, ibuf_len, wait_ack, USB_WRITE_ACK_TIMEOUT);
else if (stub->type == I2C_STUB) {
- if (cmd == I2C_WRITE) {
- u8 *i2cpkt = obuf;
- int wsize = 0;
- bool done = false;
- while (wsize < obuf_len) {
- int chunk;
-
- if ((obuf_len - wsize) <= MAX_PAYLOAD_BSIZE) {
- chunk = obuf_len - wsize;
- done = true;
- } else
- chunk = MAX_PAYLOAD_BSIZE;
-
- //[WA]: The I2C header in each chunk has to be updated
- //to the payload bytes being sent in that chunk for fw
- //download to work.
- struct i2c_rw_packet *i2cpkt_hdr = (struct i2c_rw_packet *)i2cpkt;
- i2cpkt_hdr->len = chunk - sizeof(struct i2c_rw_packet);
-
- ret = usbio_bulk_write(stub, cmd, i2cpkt, chunk, ibuf, ibuf_len,
- done, done? wait_ack : false, USB_WRITE_ACK_TIMEOUT);
- if (ret || done)
- break;
-
- wsize += chunk - sizeof(struct i2c_rw_packet);
- i2cpkt += chunk - sizeof(struct i2c_rw_packet);
- memcpy(i2cpkt, obuf, sizeof(struct i2c_rw_packet));
- }
- } else
- ret = usbio_bulk_write(stub, cmd, obuf, obuf_len,
- ibuf, ibuf_len, true, wait_ack, USB_WRITE_ACK_TIMEOUT);
+ ret = usbio_bulk_write(stub, cmd, obuf, obuf_len,
+ ibuf, ibuf_len, true, wait_ack, USB_WRITE_ACK_TIMEOUT);
}
return ret;
--
2.47.1
@@ -0,0 +1,30 @@
From 0eae85556558b410635ad03ed5eccb9648e11fce Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 29 Jan 2025 19:26:16 +0100
Subject: [PATCH 12/12] usbio: Use MAX_PAYLOAD_BSIZE in usbio_bulk_write()
usbio_bulk_write() uses a struct usbio_bmsg header rather than
a struct usbio_msg header. So its max payload length check must use
MAX_PAYLOAD_BSIZE instead of MAX_PAYLOAD_SIZE.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/mfd/usbio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/usbio.c b/drivers/mfd/usbio.c
index 51757df..ab5dae9 100644
--- a/drivers/mfd/usbio.c
+++ b/drivers/mfd/usbio.c
@@ -303,7 +303,7 @@ static int usbio_bulk_write(struct usbio_stub *stub, u8 cmd, const void *obuf,
if (bridge->state == BRIDGE_STOPPED)
return -ENODEV;
- if (obuf_len > MAX_PAYLOAD_SIZE)
+ if (obuf_len > MAX_PAYLOAD_BSIZE)
return -EINVAL;
if (last_pkt)
--
2.47.1
@@ -0,0 +1,38 @@
From a6c5a0c329fd1582fc94b51ba9c6f1c21abc0084 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 30 Jan 2025 22:04:41 +0100
Subject: [PATCH 8/8] Fedora local mod: integrate usbio-drivers within
ipu6-drivers Makefile
Integrate usbio-drivers within ipu6-drivers Makefile.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Makefile b/Makefile
index 7ae3be835..637382d6d 100644
--- a/Makefile
+++ b/Makefile
@@ -114,6 +114,17 @@ ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_IVSC)),true)
ccflags-y += -I$(src)/backport-include/drivers/misc/mei/
endif
+# begin integrate usbio-drivers within ipu6-drivers Makefile
+obj-m += usbio.o
+usbio-y := drivers/mfd/usbio.o
+
+obj-m += gpio-usbio.o
+gpio-usbio-y := drivers/gpio/gpio-usbio.o
+
+obj-m += i2c-usbio.o
+i2c-usbio-y := drivers/i2c/busses/i2c-usbio.o
+# end integrate usbio-drivers within ipu6-drivers Makefile
+
subdir-ccflags-y += -I$(src)/include/ \
-DCONFIG_VIDEO_V4L2_SUBDEV_API
--
2.47.1
@@ -5,5 +5,6 @@ project pkg {
}
labels {
mock = 1
updbranch = 1
}
}
@@ -0,0 +1,113 @@
%if 0%{?fedora}
%global buildforkernels akmod
%global debug_package %{nil}
%endif
%global ipu6_commit 13c466ebdaaa0578e82bf3039b63eb0b3f472b72
%global ipu6_commitdate 20250115
%global ipu6_shortcommit %(c=%{ipu6_commit}; echo ${c:0:7})
%global usbio_commit 450939ff5f8af733bc89c564603222a4d420acf3
%global usbio_commitdate 20241210
%global usbio_shortcommit %(c=%{usbio_commit}; echo ${c:0:7})
%global modulename intel-ipu6
# Actual "release" version, currently unused as the release versions are back and forth on if on if they use 1.0.0 or 1.0.1
%global ver 1.0.1
Name: %{modulename}-kmod
Summary: Akmods module for %{modulename}
Version: 0^%{ipu6_commitdate}git.%{ipu6_shortcommit}
Release: 2%{?dist}
License: GPL-2.0-or-later
URL: https://github.com/intel/ipu6-drivers
Source0: https://github.com/intel/ipu6-drivers/archive/%{ipu6_commit}/ipu6-drivers-%{ipu6_shortcommit}.tar.gz
Source1: https://github.com/intel/usbio-drivers/archive/%{usbio_commit}/usbio-drivers-%{usbio_shortcommit}.tar.gz
# Patches
# https://github.com/intel/ipu6-drivers/pull/322
Patch1: 0001-Makefile-Switch-sensor-driver-symbols-from-CONFIG_VI.patch
Patch2: 0002-Makefile-Re-enable-gc5035-compilation-with-kernels-6.patch
Patch3: 0003-Makefile-Do-not-build-hi556-driver-with-kernels-6.10.patch
Patch4: 0004-Makefile-Do-not-build-ov01a10-driver-with-kernels-6..patch
# https://github.com/intel/ipu6-drivers/pull/321
Patch5: 0005-media-ipu6-Fix-out-of-tree-builds.patch
Patch6: 0006-media-ipu6-Fix-building-with-kernel-6.13.patch
Patch7: 0007-Modify-0001-v6.10-IPU6-headers-used-by-PSYS.patch-fo.patch
# https://github.com/intel/ipu6-drivers/pull/324
Patch8: 0008-ipu6-psys-Adjust-DMA-code-for-ipu6-bus-DMA-changes-i.patch
Patch9: 0009-Add-ipu6-dma.h-to-0001-v6.10-IPU6-headers-used-by-PS.patch
# https://github.com/intel/ipu6-drivers/pull/327
Patch10: 0010-psys-Do-not-skipping-registering-ipu_psys_bus-for-ke.patch
Patch11: 0011-psys-Use-cdev_device_add-for-dev-ipu-psys0.patch
# https://github.com/intel/usbio-drivers/pull/33
Patch20: 0010-usbio-Fix-GPIO-and-I2C-driver-modaliases.patch
# https://github.com/intel/usbio-drivers/pull/34
Patch21: 0011-usbio-Fix-I2C-max-transfer-size.patch
Patch22: 0012-usbio-Use-MAX_PAYLOAD_BSIZE-in-usbio_bulk_write.patch
# Downstream/Fedora specific patches
Patch101: 0101-Fedora-local-mod-integrate-usbio-drivers-within-ipu6.patch
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
BuildRequires: kmodtool
Requires: %{modulename}-kmod-common = %{?epoch:%{epoch}:}%{version}
Requires: akmods
%if 0%{?fedora} <= 43 || 0%{?rhel} <= 10
Provides: %{name} = %{ipu6_commitdate}.%{ipu6_shortcommit}-%{release}
Provides: akmod-%{modulename} = %{ipu6_commitdate}.%{ipu6_shortcommit}-%{release}
%endif
%{expand:%(kmodtool --target %{_target_cpu} --repo terra --kmodname %{modulename} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
This package enables the Intel IPU6 image processor.
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo terra --kmodname %{modulename} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
%setup -q -c -a 1
(cd ipu6-drivers-%{ipu6_commit}
%patch 1 -p1
%patch 2 -p1
%patch 3 -p1
%patch 4 -p1
%patch 5 -p1
%patch 6 -p1
%patch 7 -p1
%patch 8 -p1
%patch 9 -p1
%patch 10 -p1
%patch 11 -p1
%patch 101 -p1
patch -p1 < patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
)
(cd usbio-drivers-%{usbio_commit}
%patch 20 -p1
%patch 21 -p1
%patch 22 -p1
)
cp -Rp usbio-drivers-%{usbio_commit}/drivers ipu6-drivers-%{ipu6_commit}/
cp -Rp usbio-drivers-%{usbio_commit}/include ipu6-drivers-%{ipu6_commit}/
for kernel_version in %{?kernel_versions} ; do
cp -a ipu6-drivers-%{ipu6_commit}/ _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions} ; do
make -C ${kernel_version##*___} M=${PWD}/_kmod_build_${kernel_version%%___*} modules
done
%install
for kernel_version in %{?kernel_versions}; do
mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/media/i2c/
mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/media/pci/intel/ipu6/psys/
install -m 755 _kmod_build_${kernel_version%%___*}/drivers/media/i2c/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/media/i2c/
install -m 755 _kmod_build_${kernel_version%%___*}/drivers/media/pci/intel/ipu6/psys/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/media/pci/intel/ipu6/psys/
install -m 755 _kmod_build_${kernel_version%%___*}/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}
done
%{?akmod_install}
%changelog
%autochangelog
@@ -0,0 +1,13 @@
let c = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global ipu6_commit ' | sed -E 's/.+ipu6_commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("ipu6_commit", c);
if rpm.changed() {
rpm.release();
let d = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global ipu6_commitdate' | sed -E 's/.+ipu6_commitdate //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("ipu6_commitdate", d);
let v = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global ver' | sed -E 's/.+ver //'", #{"stdout": "piped"}).ctx.stdout;
v.pop();
rpm.global("ver", v);
}
@@ -0,0 +1,88 @@
From c451aa3f50f8a5ef26d9a36f159c3f9fb8e6ef11 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 10 Jun 2024 13:05:53 +0200
Subject: [PATCH 1/9] Makefile: Switch sensor driver symbols from
CONFIG_VIDEO_FOO to CONFIG_ICAMERA_FOO
Switch the Kconfig symbols for sensor drivers from CONFIG_VIDEO_FOO to
CONFIG_ICAMERA_FOO to avoid these still being set when they should not
because of the CONFIG_VIDEO_FOO symbols inherited from the base kernel.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 22 +++++++++++-----------
drivers/media/i2c/Makefile | 22 +++++++++++-----------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/Makefile b/Makefile
index 49b27300a..356f5e7f3 100644
--- a/Makefile
+++ b/Makefile
@@ -81,22 +81,22 @@ else
obj-y += drivers/media/pci/intel/ipu6/psys/
endif
-export CONFIG_VIDEO_HM11B1 = m
-export CONFIG_VIDEO_OV01A1S = m
-export CONFIG_VIDEO_OV01A10 = m
-export CONFIG_VIDEO_OV02C10 = m
-export CONFIG_VIDEO_OV02E10 = m
-export CONFIG_VIDEO_HM2170 = m
-export CONFIG_VIDEO_HM2172 = m
-export CONFIG_VIDEO_HI556 = m
+export CONFIG_ICAMERA_HM11B1 = m
+export CONFIG_ICAMERA_OV01A1S = m
+export CONFIG_ICAMERA_OV01A10 = m
+export CONFIG_ICAMERA_OV02C10 = m
+export CONFIG_ICAMERA_OV02E10 = m
+export CONFIG_ICAMERA_HM2170 = m
+export CONFIG_ICAMERA_HM2172 = m
+export CONFIG_ICAMERA_HI556 = m
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
-export CONFIG_VIDEO_OV2740 = m
-export CONFIG_VIDEO_GC5035 = m
+export CONFIG_ICAMERA_OV2740 = m
+export CONFIG_ICAMERA_GC5035 = m
endif
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
-export CONFIG_VIDEO_OV05C10 = m
+export CONFIG_ICAMERA_OV05C10 = m
endif
obj-y += drivers/media/i2c/
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index b4fa25598..2bcc878e7 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -1,15 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2021 Intel Corporation.
-obj-$(CONFIG_VIDEO_HM11B1) += hm11b1.o
-obj-$(CONFIG_VIDEO_GC5035) += gc5035.o
-obj-$(CONFIG_VIDEO_OV01A1S) += ov01a1s.o
-obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o
-obj-$(CONFIG_VIDEO_OV02C10) += ov02c10.o
-obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.o
-obj-$(CONFIG_VIDEO_OV05C10) += ov05c10.o
-obj-$(CONFIG_VIDEO_OV2740) += ov2740.o
-obj-$(CONFIG_VIDEO_HM2170) += hm2170.o
-obj-$(CONFIG_VIDEO_HM2170) += hm2172.o
-obj-$(CONFIG_VIDEO_HI556) += hi556.o
+obj-$(CONFIG_ICAMERA_HM11B1) += hm11b1.o
+obj-$(CONFIG_ICAMERA_GC5035) += gc5035.o
+obj-$(CONFIG_ICAMERA_OV01A1S) += ov01a1s.o
+obj-$(CONFIG_ICAMERA_OV01A10) += ov01a10.o
+obj-$(CONFIG_ICAMERA_OV02C10) += ov02c10.o
+obj-$(CONFIG_ICAMERA_OV02E10) += ov02e10.o
+obj-$(CONFIG_ICAMERA_OV05C10) += ov05c10.o
+obj-$(CONFIG_ICAMERA_OV2740) += ov2740.o
+obj-$(CONFIG_ICAMERA_HM2170) += hm2170.o
+obj-$(CONFIG_ICAMERA_HM2170) += hm2172.o
+obj-$(CONFIG_ICAMERA_HI556) += hi556.o
obj-$(CONFIG_POWER_CTRL_LOGIC) += power_ctrl_logic.o
--
2.48.1
@@ -0,0 +1,97 @@
From b839b8153bd364c22811496c1753145fa475bcc8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 10 Jun 2024 13:41:16 +0200
Subject: [PATCH 2/9] Makefile: Re-enable gc5035 compilation with kernels >=
6.8
For some reason the gc5035 driver has been disabled for kernels >= 6.8,
but it is not upstream yet.
Fix compilation with kernel >= 6.8 and re-enable the driver.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 2 +-
drivers/media/i2c/gc5035.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 356f5e7f3..58bc10aed 100644
--- a/Makefile
+++ b/Makefile
@@ -89,10 +89,10 @@ export CONFIG_ICAMERA_OV02E10 = m
export CONFIG_ICAMERA_HM2170 = m
export CONFIG_ICAMERA_HM2172 = m
export CONFIG_ICAMERA_HI556 = m
+export CONFIG_ICAMERA_GC5035 = m
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
export CONFIG_ICAMERA_OV2740 = m
-export CONFIG_ICAMERA_GC5035 = m
endif
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
diff --git a/drivers/media/i2c/gc5035.c b/drivers/media/i2c/gc5035.c
index 16bbd4845..e825dfa7d 100644
--- a/drivers/media/i2c/gc5035.c
+++ b/drivers/media/i2c/gc5035.c
@@ -1497,7 +1497,11 @@ static int gc5035_set_fmt(struct v4l2_subdev *sd,
mutex_lock(&gc5035->mutex);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
*v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format;
+#else
+ *v4l2_subdev_state_get_format(sd_state, fmt->pad) = fmt->format;
+#endif
} else {
gc5035->cur_mode = mode;
h_blank = mode->hts_def - mode->width;
@@ -1522,7 +1526,11 @@ static int gc5035_get_fmt(struct v4l2_subdev *sd,
mutex_lock(&gc5035->mutex);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad);
+#else
+ fmt->format = *v4l2_subdev_state_get_format(sd_state, fmt->pad);
+#endif
} else {
fmt->format.width = mode->width;
fmt->format.height = mode->height;
@@ -1714,7 +1722,9 @@ static const struct v4l2_subdev_video_ops gc5035_video_ops = {
};
static const struct v4l2_subdev_pad_ops gc5035_pad_ops = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
.init_cfg = gc5035_entity_init_cfg,
+#endif
.enum_mbus_code = gc5035_enum_mbus_code,
.enum_frame_size = gc5035_enum_frame_sizes,
.get_fmt = gc5035_get_fmt,
@@ -1730,6 +1740,12 @@ static const struct media_entity_operations gc5035_subdev_entity_ops = {
.link_validate = v4l2_subdev_link_validate,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
+static const struct v4l2_subdev_internal_ops gc5035_internal_ops = {
+ .init_state = gc5035_entity_init_cfg,
+};
+#endif
+
static int gc5035_set_exposure(struct gc5035 *gc5035, u32 val)
{
u32 caltime = 0;
@@ -2091,6 +2107,9 @@ static int gc5035_probe(struct i2c_client *client)
mutex_init(&gc5035->mutex);
sd = &gc5035->subdev;
v4l2_i2c_subdev_init(sd, client, &gc5035_subdev_ops);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
+ sd->internal_ops = &gc5035_internal_ops;
+#endif
ret = gc5035_initialize_controls(gc5035);
if (ret) {
dev_err_probe(dev, ret, "Failed to initialize controls\n");
--
2.48.1
@@ -0,0 +1,54 @@
From 580d73c387405534bdef7911e0616ad66953f7ce Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 13 Jan 2025 13:11:00 +0100
Subject: [PATCH 3/9] Makefile: Do not build hi556 driver with kernels >= 6.10
The mainline kernel hi556 driver has ACPI enumeration, GPIO and clk support
since kernel 6.10, so it can be used instead of the out of tree driver.
Add a new KV_HI556 variable and stop building the hi556 driver on
kernels >= 6.10.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 58bc10aed..472fdec22 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ KV_IVSC := 6.6.0
KV_IPU_BRIDGE := 6.6.0
KV_OV2740 := 6.8.0
KV_OV05C10 := 6.8.0
+KV_HI556 := 6.10
KV_IPU6_ISYS := 6.10.0
KERNEL_SRC ?= /lib/modules/$(KERNELRELEASE)/build
@@ -88,17 +89,21 @@ export CONFIG_ICAMERA_OV02C10 = m
export CONFIG_ICAMERA_OV02E10 = m
export CONFIG_ICAMERA_HM2170 = m
export CONFIG_ICAMERA_HM2172 = m
-export CONFIG_ICAMERA_HI556 = m
export CONFIG_ICAMERA_GC5035 = m
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
export CONFIG_ICAMERA_OV2740 = m
endif
+# Note OV05C10 check is reversed, it is not build on too old kernels
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
export CONFIG_ICAMERA_OV05C10 = m
endif
+ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_HI556)),true)
+export CONFIG_ICAMERA_HI556 = m
+endif
+
obj-y += drivers/media/i2c/
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_IVSC)),true)
--
2.48.1
@@ -0,0 +1,51 @@
From 14d41bf82770fcab65dcf3b2eec3f95b7a963aff Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 13 Jan 2025 13:15:15 +0100
Subject: [PATCH 4/9] Makefile: Do not build ov01a10 driver with kernels >= 6.8
Since commit 47a78052db51 ("media: ov01a10: Enable runtime PM before
registering async sub-device") the mainline ov01a10 driver is fully
usable and it can be used instead of the out of tree driver.
Add a new KV_OV01A10 variable and stop building the ov01a10 driver on
kernels >= 6.8.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 472fdec22..7ae3be835 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ version_lt = $(shell \
KV_IVSC := 6.6.0
KV_IPU_BRIDGE := 6.6.0
KV_OV2740 := 6.8.0
+KV_OV01A10 := 6.8.0
KV_OV05C10 := 6.8.0
KV_HI556 := 6.10
KV_IPU6_ISYS := 6.10.0
@@ -84,7 +85,6 @@ endif
export CONFIG_ICAMERA_HM11B1 = m
export CONFIG_ICAMERA_OV01A1S = m
-export CONFIG_ICAMERA_OV01A10 = m
export CONFIG_ICAMERA_OV02C10 = m
export CONFIG_ICAMERA_OV02E10 = m
export CONFIG_ICAMERA_HM2170 = m
@@ -95,6 +95,10 @@ ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV2740)),true)
export CONFIG_ICAMERA_OV2740 = m
endif
+ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV01A10)),true)
+export CONFIG_ICAMERA_OV01A10 = m
+endif
+
# Note OV05C10 check is reversed, it is not build on too old kernels
ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_OV05C10)),false)
export CONFIG_ICAMERA_OV05C10 = m
--
2.48.1
@@ -0,0 +1,28 @@
From 7ce00bf77d1b92981f471a26fa2d92c96d14e51c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 14 Jan 2025 23:07:35 +0100
Subject: [PATCH 5/9] media: ipu6: Fix out of tree builds
Fix out of tree builds not finding the ipu6*.h files.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/pci/intel/ipu6/psys/Makefile b/drivers/media/pci/intel/ipu6/psys/Makefile
index fa638fcdf..9a3aa6e78 100644
--- a/drivers/media/pci/intel/ipu6/psys/Makefile
+++ b/drivers/media/pci/intel/ipu6/psys/Makefile
@@ -23,6 +23,8 @@ obj-$(CONFIG_VIDEO_INTEL_IPU6) += intel-ipu6-psys.o
ifeq ($(is_kernel_lt_6_10), 1)
ccflags-y += -I$(src)/../ipu6/
+else
+ccflags-y += -I/lib/modules/$(KERNELRELEASE)/build/drivers/media/pci/intel/ipu6/
endif
ccflags-y += -I$(src)/../
ccflags-y += -I$(src)/../../
--
2.48.1
@@ -0,0 +1,53 @@
From a42273020f4a2e1c633dda6f30c512db56738b67 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 14 Jan 2025 23:08:04 +0100
Subject: [PATCH 6/9] media: ipu6: Fix building with kernel 6.13
Fix building with kernel 6.13.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 8 ++++++++
drivers/media/pci/intel/ipu6/psys/ipu6-psys.c | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index 00e394f20..36f99a3b8 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -2681,8 +2681,16 @@ MODULE_AUTHOR("Yunliang Ding <yunliang.ding@intel.com>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Intel ipu processing system driver");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) || IS_ENABLED(CONFIG_DRM_I915_HAS_SRIOV)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS(DMA_BUF);
+#else
+MODULE_IMPORT_NS("DMA_BUF");
+#endif
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS(INTEL_IPU6);
+#else
+MODULE_IMPORT_NS("INTEL_IPU6");
+#endif
#endif
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
index 53c845ba3..0c3a5ca62 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
@@ -32,7 +32,11 @@
#include "ipu6-platform-buttress-regs.h"
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS(DMA_BUF);
+#else
+MODULE_IMPORT_NS("DMA_BUF");
+#endif
static bool early_pg_transfer;
module_param(early_pg_transfer, bool, 0664);
--
2.48.1
@@ -0,0 +1,49 @@
From 32ce53b82bef51479d49d7d68794e2b801367dd6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 30 Jan 2025 22:20:16 +0100
Subject: [PATCH 7/9] Modify 0001-v6.10-IPU6-headers-used-by-PSYS.patch for
v6.13
Modify 0001-v6.10-IPU6-headers-used-by-PSYS.patch so that it also works
with 6.13 kernels.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
index 00fb961d2..6a465a924 100644
--- a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
+++ b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
@@ -52,7 +52,7 @@ index 000000000..b26c6aee1
+
+struct ipu6_bus_device {
+ struct auxiliary_device auxdev;
-+ struct auxiliary_driver *auxdrv;
++ const struct auxiliary_driver *auxdrv;
+ const struct ipu6_auxdrv_data *auxdrv_data;
+ struct list_head list;
+ void *pdata;
@@ -92,7 +92,7 @@ new file mode 100644
index 000000000..9b6f56958
--- /dev/null
+++ b/drivers/media/pci/intel/ipu6/ipu6-buttress.h
-@@ -0,0 +1,92 @@
+@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Copyright (C) 2013--2024 Intel Corporation */
+
@@ -141,7 +141,9 @@ index 000000000..9b6f56958
+struct ipu6_buttress {
+ struct mutex power_mutex, auth_mutex, cons_mutex, ipc_mutex;
+ struct ipu6_buttress_ipc cse;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
+ struct ipu6_buttress_ipc ish;
++#endif
+ struct list_head constraints;
+ u32 wdt_cached_value;
+ bool force_suspend;
--
2.48.1
@@ -0,0 +1,306 @@
From a9236f549f28811a5af0c71ce6708d1f259d0e78 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 1 Feb 2025 08:04:35 +0100
Subject: [PATCH 8/9] ipu6-psys: Adjust DMA code for ipu6-bus DMA changes in
kernels >= 6.12
Upstream commit daabc5c64703 ("media: ipu6: not override the dma_ops of
device in driver") has changed the ipu6-bus code to no longer modify
the aux device's dma_ops, instead new ipu6_dma_*() helpers were introduced
modify the psys driver to use these new helpers.
This fixes the below DMA warning, which was followed by ipu6_psys_probe()
failing due to dma_alloc_attrs() failing:
Jan 31 11:59:59 x1 kernel: ------------[ cut here ]------------
Jan 31 11:59:59 x1 kernel: WARNING: CPU: 3 PID: 8595 at kernel/dma/mapping.c:597 dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: Modules linked in: intel_ipu6_psys(OE+) rfcomm snd_seq_dummy snd_hrtimer qrtr bnep binfmt_misc vfat fat snd_soc_skl_hda_dsp snd_soc_intel_sof_board_helpers snd_sof_probes snd_soc_intel_hda_dsp_common snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_soc_dmic snd_sof_pci_intel_mtl snd_sof_intel_hda_generic soundwire_intel soundwire_cadence snd_sof_intel_hda_common snd_soc_hdac_hda iwlmvm snd_sof_intel_hda_mlink snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp snd_sof snd_sof_utils snd_hda_ext_core mac80211 snd_soc_acpi_intel_match soundwire_generic_allocation snd_soc_acpi intel_uncore_frequency soundwire_bus intel_uncore_frequency_common x86_pkg_temp_thermal snd_soc_core intel_ipu6_isys intel_powerclamp videobuf2_dma_sg coretemp snd_compress videobuf2_memops ac97_bus videobuf2_v4l2 snd_pcm_dmaengine videobuf2_common snd_hda_intel libarc4 snd_intel_dspcfg snd_intel_sdw_acpi kvm_intel snd_hda_codec spi_nor btusb iTCO_wdt btrtl mhi_wwan_mbim intel_pmc_bxt mhi_wwan_ctrl
Jan 31 11:59:59 x1 kernel: snd_hda_core mei_gsc_proxy gpio_usbio(OE) mei_wdt i2c_usbio(OE) mtd iTCO_vendor_support intel_rapl_msr btintel snd_hwdep kvm btbcm btmtk snd_seq snd_ctl_led hid_sensor_accel_3d hid_sensor_gyro_3d iwlwifi bluetooth snd_seq_device rapl processor_thermal_device_pci intel_cstate hid_sensor_trigger think_lmi processor_thermal_device hid_sensor_iio_common processor_thermal_wt_hint industrialio_triggered_buffer intel_uncore usbio(OE) firmware_attributes_class snd_pcm wmi_bmof mhi_pci_generic kfifo_buf processor_thermal_rfim i2c_i801 mei_me cfg80211 processor_thermal_rapl thinkpad_acpi spi_intel_pci mhi industrialio thunderbolt snd_timer spi_intel mei intel_ipu6 i2c_smbus intel_rapl_common idma64 platform_profile processor_thermal_wt_req ipu_bridge rfkill processor_thermal_power_floor snd igen6_edac processor_thermal_mbox int3403_thermal soundcore soc_button_array int340x_thermal_zone intel_pmc_core intel_skl_int3472_tps68470 ov08x40(OE) tps68470_regulator v4l2_fwnode clk_tps68470 intel_vsec v4l2_async
Jan 31 11:59:59 x1 kernel: pmt_telemetry intel_skl_int3472_discrete int3400_thermal intel_hid acpi_tad pmt_class intel_skl_int3472_common acpi_pad sparse_keymap joydev acpi_thermal_rel loop nfnetlink zram lz4hc_compress lz4_compress dm_crypt xe drm_ttm_helper gpu_sched drm_suballoc_helper drm_gpuvm drm_exec hid_sensor_hub intel_ishtp_hid i915 i2c_algo_bit drm_buddy nvme ttm nvme_core drm_display_helper intel_ish_ipc video ucsi_acpi crct10dif_pclmul hid_multitouch crc32_pclmul crc32c_intel polyval_clmulni polyval_generic ghash_clmulni_intel intel_vpu sha512_ssse3 sha256_ssse3 typec_ucsi sha1_ssse3 intel_ishtp cec typec nvme_auth i2c_hid_acpi i2c_hid wmi pinctrl_meteorlake serio_raw v4l2loopback(OE) videodev mc i2c_dev fuse
Jan 31 11:59:59 x1 kernel: CPU: 3 UID: 0 PID: 8595 Comm: modprobe Tainted: G OE 6.12.10-200.fc41.x86_64 #1
Jan 31 11:59:59 x1 kernel: Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
Jan 31 11:59:59 x1 kernel: Hardware name: LENOVO 21KCSIT080/21KCSIT080, BIOS N3YET72W (1.37 ) 10/03/2024
Jan 31 11:59:59 x1 kernel: RIP: 0010:dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: Code: 4c 89 e6 48 89 df e8 94 5d 9a 00 49 89 c7 e9 62 ff ff ff 0f 0b 45 31 ff 5b 5d 4c 89 f8 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc <0f> 0b e9 0d ff ff ff 45 31 ff e9 3e ff ff ff 66 0f 1f 44 00 00 90
Jan 31 11:59:59 x1 kernel: RSP: 0018:ffffaeefe452fbc8 EFLAGS: 00010246
Jan 31 11:59:59 x1 kernel: RAX: 0000000000000000 RBX: ffff936a8de60800 RCX: 0000000000000cc0
Jan 31 11:59:59 x1 kernel: RDX: ffff936af6c65018 RSI: 0000000000002000 RDI: ffff936a8de60800
Jan 31 11:59:59 x1 kernel: RBP: ffff936a8de60800 R08: 0000000000000000 R09: ffff936af6c65000
Jan 31 11:59:59 x1 kernel: R10: ffffaeefe452fc00 R11: ffff9371bf9a17c0 R12: 0000000000002000
Jan 31 11:59:59 x1 kernel: R13: ffff936af6c65018 R14: 0000000000000000 R15: ffff936a9d9be440
Jan 31 11:59:59 x1 kernel: FS: 00007f8ff258f740(0000) GS:ffff9371bf980000(0000) knlGS:0000000000000000
Jan 31 11:59:59 x1 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jan 31 11:59:59 x1 kernel: CR2: 00007f2e39eee67c CR3: 000000013b884003 CR4: 0000000000f72ef0
Jan 31 11:59:59 x1 kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jan 31 11:59:59 x1 kernel: DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400
Jan 31 11:59:59 x1 kernel: PKRU: 55555554
Jan 31 11:59:59 x1 kernel: Call Trace:
Jan 31 11:59:59 x1 kernel: <TASK>
Jan 31 11:59:59 x1 kernel: ? dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: ? __warn.cold+0x93/0xfa
Jan 31 11:59:59 x1 kernel: ? dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: ? report_bug+0xff/0x140
Jan 31 11:59:59 x1 kernel: ? handle_bug+0x58/0x90
Jan 31 11:59:59 x1 kernel: ? exc_invalid_op+0x17/0x70
Jan 31 11:59:59 x1 kernel: ? asm_exc_invalid_op+0x1a/0x20
Jan 31 11:59:59 x1 kernel: ? dma_alloc_attrs+0x12b/0x140
Jan 31 11:59:59 x1 kernel: ipu6_psys_probe+0x37d/0x4b0 [intel_ipu6_psys]
Jan 31 11:59:59 x1 kernel: ? __pfx_ipu6_psys_probe+0x10/0x10 [intel_ipu6_psys]
Jan 31 11:59:59 x1 kernel: auxiliary_bus_probe+0x46/0x80
Jan 31 11:59:59 x1 kernel: ? driver_sysfs_add+0x57/0xc0
Jan 31 11:59:59 x1 kernel: really_probe+0xdb/0x340
Jan 31 11:59:59 x1 kernel: ? pm_runtime_barrier+0x54/0x90
Jan 31 11:59:59 x1 kernel: ? __pfx___driver_attach+0x10/0x10
Jan 31 11:59:59 x1 kernel: __driver_probe_device+0x78/0x110
Jan 31 11:59:59 x1 kernel: driver_probe_device+0x1f/0xa0
Jan 31 11:59:59 x1 kernel: __driver_attach+0xba/0x1c0
Jan 31 11:59:59 x1 kernel: bus_for_each_dev+0x8c/0xe0
Jan 31 11:59:59 x1 kernel: bus_add_driver+0x142/0x220
Jan 31 11:59:59 x1 kernel: driver_register+0x72/0xd0
Jan 31 11:59:59 x1 kernel: __auxiliary_driver_register+0x6e/0xd0
Jan 31 11:59:59 x1 kernel: ? __pfx_ipu6_psys_aux_driver_init+0x10/0x10 [intel_ipu6_psys]
Jan 31 11:59:59 x1 kernel: do_one_initcall+0x58/0x310
Jan 31 11:59:59 x1 kernel: do_init_module+0x90/0x260
Jan 31 11:59:59 x1 kernel: __do_sys_init_module+0x17a/0x1b0
Jan 31 11:59:59 x1 kernel: do_syscall_64+0x82/0x160
Jan 31 11:59:59 x1 kernel: ? exc_page_fault+0x7e/0x180
Jan 31 11:59:59 x1 kernel: entry_SYSCALL_64_after_hwframe+0x76/0x7e
Jan 31 11:59:59 x1 kernel: RIP: 0033:0x7f8ff1f0228e
Jan 31 11:59:59 x1 kernel: Code: 48 8b 0d 85 3b 0f 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 52 3b 0f 00 f7 d8 64 89 01 48
Jan 31 11:59:59 x1 kernel: RSP: 002b:00007ffdfbde11e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
Jan 31 11:59:59 x1 kernel: RAX: ffffffffffffffda RBX: 000055a0687e9240 RCX: 00007f8ff1f0228e
Jan 31 11:59:59 x1 kernel: RDX: 000055a05859a715 RSI: 0000000000041a65 RDI: 00007f8ff13a7010
Jan 31 11:59:59 x1 kernel: RBP: 00007ffdfbde12a0 R08: 000055a0687e8010 R09: 0000000000000007
Jan 31 11:59:59 x1 kernel: R10: 0000000000000001 R11: 0000000000000246 R12: 000055a05859a715
Jan 31 11:59:59 x1 kernel: R13: 0000000000040000 R14: 000055a0687e92e0 R15: 0000000000000000
Jan 31 11:59:59 x1 kernel: </TASK>
Jan 31 11:59:59 x1 kernel: ---[ end trace 0000000000000000 ]---
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 64 ++++++++++++++++++-
drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c | 6 +-
drivers/media/pci/intel/ipu6/psys/ipu6-psys.c | 22 +++++--
3 files changed, 85 insertions(+), 7 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index 36f99a3b8..7c512e5ae 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -52,6 +52,7 @@
#include "ipu-psys.h"
#include "ipu6-platform-regs.h"
#include "ipu6-fw-com.h"
+#include "ipu6-dma.h"
#endif
static bool async_fw_init;
@@ -228,9 +229,12 @@ struct ipu_psys_pg *__get_pg_buf(struct ipu_psys *psys, size_t pg_size)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
kpg->pg = dma_alloc_attrs(&psys->adev->dev, pg_size,
&kpg->pg_dma_addr, GFP_KERNEL, 0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kpg->pg = dma_alloc_attrs(dev, pg_size, &kpg->pg_dma_addr,
GFP_KERNEL, 0);
+#else
+ kpg->pg = ipu6_dma_alloc(to_ipu6_bus_device(dev), pg_size,
+ &kpg->pg_dma_addr, GFP_KERNEL, 0);
#endif
if (!kpg->pg) {
kfree(kpg);
@@ -597,6 +601,7 @@ static void ipu_dma_buf_detach(struct dma_buf *dbuf,
attach->priv = NULL;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
static struct sg_table *ipu_dma_buf_map(struct dma_buf_attachment *attach,
enum dma_data_direction dir)
{
@@ -658,6 +663,50 @@ static void ipu_dma_buf_unmap(struct dma_buf_attachment *attach,
#endif
}
+#else
+
+static struct sg_table *ipu_dma_buf_map(struct dma_buf_attachment *attach,
+ enum dma_data_direction dir)
+{
+ struct ipu_dma_buf_attach *ipu_attach = attach->priv;
+ struct ipu6_bus_device *adev = to_ipu6_bus_device(attach->dev);
+ struct pci_dev *pdev = adev->isp->pdev;
+ unsigned long attrs;
+ int ret;
+
+ attrs = DMA_ATTR_SKIP_CPU_SYNC;
+ ret = dma_map_sgtable(&pdev->dev, ipu_attach->sgt, dir, attrs);
+ if (ret) {
+ dev_dbg(attach->dev, "buf map failed\n");
+ return ERR_PTR(-EIO);
+ }
+
+ ret = ipu6_dma_map_sgtable(adev, ipu_attach->sgt, dir, attrs);
+ if (ret) {
+ dma_unmap_sgtable(&pdev->dev, ipu_attach->sgt, dir, attrs);
+ return ERR_PTR(-EIO);
+ }
+
+ /*
+ * Initial cache flush to avoid writing dirty pages for buffers which
+ * are later marked as IPU_BUFFER_FLAG_NO_FLUSH.
+ */
+ ipu6_dma_sync_sgtable(adev, ipu_attach->sgt);
+
+ return ipu_attach->sgt;
+}
+
+static void ipu_dma_buf_unmap(struct dma_buf_attachment *attach,
+ struct sg_table *sgt, enum dma_data_direction dir)
+{
+ struct ipu6_bus_device *adev = to_ipu6_bus_device(attach->dev);
+ struct pci_dev *pdev = adev->isp->pdev;
+
+ ipu6_dma_unmap_sgtable(adev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sgtable(&pdev->dev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC);
+}
+#endif
+
static int ipu_dma_buf_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma)
{
return -ENOTTY;
@@ -2371,7 +2420,12 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
kpg = kzalloc(sizeof(*kpg), GFP_KERNEL);
if (!kpg)
goto out_free_pgs;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kpg->pg = dma_alloc_attrs(dev, IPU_PSYS_PG_MAX_SIZE,
+#else
+ kpg->pg = ipu6_dma_alloc(adev, IPU_PSYS_PG_MAX_SIZE,
+#endif
&kpg->pg_dma_addr,
GFP_KERNEL, 0);
if (!kpg->pg) {
@@ -2426,7 +2480,11 @@ out_release_fw_com:
ipu6_fw_com_release(psys->fwcom, 1);
out_free_pgs:
list_for_each_entry_safe(kpg, kpg0, &psys->pgs, list) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
+#else
+ ipu6_dma_free(adev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
+#endif
kfree(kpg);
}
@@ -2484,8 +2542,10 @@ static void ipu6_psys_remove(struct auxiliary_device *auxdev)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
dma_free_attrs(&adev->dev, kpg->size, kpg->pg,
kpg->pg_dma_addr, 0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
+#else
+ ipu6_dma_free(psys->adev, kpg->size, kpg->pg, kpg->pg_dma_addr, 0);
#endif
kfree(kpg);
}
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c b/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c
index 9038f69cd..5e6fb9a1b 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu6-ppg.c
@@ -8,6 +8,7 @@
#include <asm/cacheflush.h>
#include "ipu6-ppg.h"
+#include "ipu6-dma.h"
static bool enable_suspend_resume;
module_param(enable_suspend_resume, bool, 0664);
@@ -75,9 +76,12 @@ __get_buf_set(struct ipu_psys_fh *fh, size_t buf_set_size)
kbuf_set->kaddr = dma_alloc_attrs(&fh->psys->adev->dev,
buf_set_size, &kbuf_set->dma_addr,
GFP_KERNEL, 0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kbuf_set->kaddr = dma_alloc_attrs(dev, buf_set_size,
&kbuf_set->dma_addr, GFP_KERNEL, 0);
+#else
+ kbuf_set->kaddr = ipu6_dma_alloc(to_ipu6_bus_device(dev), buf_set_size,
+ &kbuf_set->dma_addr, GFP_KERNEL, 0);
#endif
if (!kbuf_set->kaddr) {
kfree(kbuf_set);
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
index 0c3a5ca62..58662ea16 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu6-psys.c
@@ -30,6 +30,7 @@
#include "ipu6-ppg.h"
#include "ipu6-platform-regs.h"
#include "ipu6-platform-buttress-regs.h"
+#include "ipu6-dma.h"
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
@@ -450,10 +451,12 @@ static struct ipu_psys_kcmd *ipu_psys_copy_cmd(struct ipu_psys_command *cmd,
kcmd->kbufs[i]->sgt->sgl,
kcmd->kbufs[i]->sgt->orig_nents,
DMA_BIDIRECTIONAL);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_sync_sg_for_device(dev, kcmd->kbufs[i]->sgt->sgl,
kcmd->kbufs[i]->sgt->orig_nents,
DMA_BIDIRECTIONAL);
+#else
+ ipu6_dma_sync_sgtable(psys->adev, kcmd->kbufs[i]->sgt);
#endif
}
@@ -1102,11 +1105,16 @@ int ipu_psys_fh_init(struct ipu_psys_fh *fh)
&kbuf_set->dma_addr,
GFP_KERNEL,
0);
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
kbuf_set->kaddr = dma_alloc_attrs(dev,
IPU_PSYS_BUF_SET_MAX_SIZE,
&kbuf_set->dma_addr,
GFP_KERNEL, 0);
+#else
+ kbuf_set->kaddr = ipu6_dma_alloc(to_ipu6_bus_device(dev),
+ IPU_PSYS_BUF_SET_MAX_SIZE,
+ &kbuf_set->dma_addr,
+ GFP_KERNEL, 0);
#endif
if (!kbuf_set->kaddr) {
kfree(kbuf_set);
@@ -1124,8 +1132,11 @@ out_free_buf_sets:
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
dma_free_attrs(&psys->adev->dev,
kbuf_set->size, kbuf_set->kaddr,
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kbuf_set->size, kbuf_set->kaddr,
+#else
+ ipu6_dma_free(to_ipu6_bus_device(dev),
+ kbuf_set->size, kbuf_set->kaddr,
#endif
kbuf_set->dma_addr, 0);
list_del(&kbuf_set->list);
@@ -1229,8 +1240,11 @@ int ipu_psys_fh_deinit(struct ipu_psys_fh *fh)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
dma_free_attrs(&psys->adev->dev,
kbuf_set->size, kbuf_set->kaddr,
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
dma_free_attrs(dev, kbuf_set->size, kbuf_set->kaddr,
+#else
+ ipu6_dma_free(to_ipu6_bus_device(dev),
+ kbuf_set->size, kbuf_set->kaddr,
#endif
kbuf_set->dma_addr, 0);
list_del(&kbuf_set->list);
--
2.48.1
@@ -0,0 +1,84 @@
From 47a2e1cf89b789bbc10d3cb3b26b357404633114 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 1 Feb 2025 08:19:22 +0100
Subject: [PATCH 9/9] Add ipu6-dma.h to
0001-v6.10-IPU6-headers-used-by-PSYS.patch
Add ipu6-dma.h to 0001-v6.10-IPU6-headers-used-by-PSYS.patch,
this is necessary for the DMA code adjustments in the psys code
which were done for the ipu6-bus DMA changes in kernels >= 6.12.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
...0001-v6.10-IPU6-headers-used-by-PSYS.patch | 55 +++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
index 6a465a924..b8eeaae66 100644
--- a/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
+++ b/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
@@ -1195,6 +1195,61 @@ index 000000000..92e3c3414
+ int pkg_dir_idx, void __iomem *base, u64 *pkg_dir,
+ dma_addr_t pkg_dir_dma_addr);
+#endif /* IPU6_H */
+diff --git a/drivers/media/pci/intel/ipu6/ipu6-dma.h b/drivers/media/pci/intel/ipu6/ipu6-dma.h
+new file mode 100644
+index 000000000..b51244add
+--- /dev/null
++++ b/drivers/media/pci/intel/ipu6/ipu6-dma.h
+@@ -0,0 +1,49 @@
++/* SPDX-License-Identifier: GPL-2.0-only */
++/* Copyright (C) 2013--2024 Intel Corporation */
++
++#ifndef IPU6_DMA_H
++#define IPU6_DMA_H
++
++#include <linux/dma-map-ops.h>
++#include <linux/dma-mapping.h>
++#include <linux/iova.h>
++#include <linux/iova.h>
++#include <linux/scatterlist.h>
++#include <linux/types.h>
++
++#include "ipu6-bus.h"
++
++struct ipu6_mmu_info;
++
++struct ipu6_dma_mapping {
++ struct ipu6_mmu_info *mmu_info;
++ struct iova_domain iovad;
++};
++
++void ipu6_dma_sync_single(struct ipu6_bus_device *sys, dma_addr_t dma_handle,
++ size_t size);
++void ipu6_dma_sync_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,
++ int nents);
++void ipu6_dma_sync_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt);
++void *ipu6_dma_alloc(struct ipu6_bus_device *sys, size_t size,
++ dma_addr_t *dma_handle, gfp_t gfp,
++ unsigned long attrs);
++void ipu6_dma_free(struct ipu6_bus_device *sys, size_t size, void *vaddr,
++ dma_addr_t dma_handle, unsigned long attrs);
++int ipu6_dma_mmap(struct ipu6_bus_device *sys, struct vm_area_struct *vma,
++ void *addr, dma_addr_t iova, size_t size,
++ unsigned long attrs);
++int ipu6_dma_map_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,
++ int nents, enum dma_data_direction dir,
++ unsigned long attrs);
++void ipu6_dma_unmap_sg(struct ipu6_bus_device *sys, struct scatterlist *sglist,
++ int nents, enum dma_data_direction dir,
++ unsigned long attrs);
++int ipu6_dma_map_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt,
++ enum dma_data_direction dir, unsigned long attrs);
++void ipu6_dma_unmap_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt,
++ enum dma_data_direction dir, unsigned long attrs);
++int ipu6_dma_get_sgtable(struct ipu6_bus_device *sys, struct sg_table *sgt,
++ void *cpu_addr, dma_addr_t handle, size_t size,
++ unsigned long attrs);
++#endif /* IPU6_DMA_H */
--
2.43.0
--
2.48.1
@@ -0,0 +1,202 @@
From c1cb2a62cd9d949fda60f5993a72ec0c44f52719 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 5 Feb 2025 13:20:21 +0100
Subject: [PATCH 10/11] psys: Do not skipping registering ipu_psys_bus for
kernels >= 6.10
The new auxbus code-paths were not registering the ipu_psys_bus used for
psys->dev.bus = &ipu_psys_bus, this was causing udev to not be able to
properly enumerate the device. For example running:
udevadm test -a add /dev/ipu-psys0
would fail with the following error:
"Failed to clone sd_device object: No such file or directory"
This udev issue in turn was causing issues with udev rules to set
permissions on /dev/ipu-psys0 not working
Fix this by:
1. Rename ipu6_psys_bus to ipu_psys_bus, there is no need for separate
names for this struct with different kernels and having the same name
allows code sharing.
2. Switching back from using module_auxiliary_driver() to using
module_init() / module_exit() codes for registering the drivers.
3. Move the now always used ipu_psys_init() and ipu_psys_exit()
out of any ifdefs blocks, so that these functions now always
(un)register the chrdev region and the ipu_psys_bus.
4. Remove the now duplicate chrdev region handling from the auxbus
ipu6_psys_probe() and ipu6_psys_remove() functions (now handled
by ipu_psys_init() and ipu_psys_exit()).
Signed-off-by: Hans de Goede
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 94 +++++++++-----------
1 file changed, 40 insertions(+), 54 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index 7c512e5ae..c06cd515a 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -92,7 +92,7 @@ static struct bus_type ipu_psys_bus = {
.name = IPU_PSYS_NAME,
};
#else
-static const struct bus_type ipu6_psys_bus = {
+static const struct bus_type ipu_psys_bus = {
.name = "intel-ipu6-psys",
};
#endif
@@ -2331,17 +2331,9 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
ipu_ver = adev->isp->hw_ver;
- rval = alloc_chrdev_region(&ipu_psys_dev_t, 0,
- IPU_PSYS_NUM_DEVICES, IPU6_PSYS_NAME);
- if (rval) {
- dev_err(dev, "can't alloc psys chrdev region (%d)\n",
- rval);
- return rval;
- }
-
rval = ipu6_mmu_hw_init(adev->mmu);
if (rval)
- goto out_unregister_chr_region;
+ return rval;
mutex_lock(&ipu_psys_mutex);
@@ -2453,7 +2445,7 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
goto out_free_pgs;
}
- psys->dev.bus = &ipu6_psys_bus;
+ psys->dev.bus = &ipu_psys_bus;
psys->dev.parent = dev;
psys->dev.devt = MKDEV(MAJOR(ipu_psys_dev_t), minor);
psys->dev.release = ipu_psys_dev_release;
@@ -2500,10 +2492,6 @@ out_unlock:
/* Safe to call even if the init is not called */
mutex_unlock(&ipu_psys_mutex);
ipu6_mmu_hw_cleanup(adev->mmu);
-
-out_unregister_chr_region:
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-
return rval;
}
#endif
@@ -2521,9 +2509,6 @@ static void ipu6_psys_remove(struct auxiliary_device *auxdev)
#endif
struct ipu_psys_pg *kpg, *kpg0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
#ifdef CONFIG_DEBUG_FS
if (isp->ipu_dir)
@@ -2658,38 +2643,6 @@ static struct ipu_bus_driver ipu_psys_driver = {
},
};
-static int __init ipu_psys_init(void)
-{
- int rval = alloc_chrdev_region(&ipu_psys_dev_t, 0,
- IPU_PSYS_NUM_DEVICES, IPU_PSYS_NAME);
- if (rval) {
- pr_err("can't alloc psys chrdev region (%d)\n", rval);
- return rval;
- }
-
- rval = bus_register(&ipu_psys_bus);
- if (rval) {
- pr_warn("can't register psys bus (%d)\n", rval);
- goto out_bus_register;
- }
-
- ipu_bus_register_driver(&ipu_psys_driver);
-
- return rval;
-
-out_bus_register:
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-
- return rval;
-}
-
-static void __exit ipu_psys_exit(void)
-{
- ipu_bus_unregister_driver(&ipu_psys_driver);
- bus_unregister(&ipu_psys_bus);
- unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
-}
-
static const struct pci_device_id ipu_pci_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, IPU6_PCI_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, IPU6SE_PCI_ID)},
@@ -2700,9 +2653,6 @@ static const struct pci_device_id ipu_pci_tbl[] = {
{0,}
};
MODULE_DEVICE_TABLE(pci, ipu_pci_tbl);
-
-module_init(ipu_psys_init);
-module_exit(ipu_psys_exit);
#else
static const struct ipu6_auxdrv_data ipu6_psys_auxdrv_data = {
.isr_threaded = psys_isr_threaded,
@@ -2727,9 +2677,45 @@ static struct auxiliary_driver ipu6_psys_aux_driver = {
.pm = &psys_pm_ops,
},
};
-module_auxiliary_driver(ipu6_psys_aux_driver);
#endif
+static int __init ipu_psys_init(void)
+{
+ int rval = alloc_chrdev_region(&ipu_psys_dev_t, 0,
+ IPU_PSYS_NUM_DEVICES, ipu_psys_bus.name);
+ if (rval) {
+ pr_err("can't alloc psys chrdev region (%d)\n", rval);
+ return rval;
+ }
+
+ rval = bus_register(&ipu_psys_bus);
+ if (rval) {
+ pr_err("can't register psys bus (%d)\n", rval);
+ unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
+ return rval;
+ }
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+ ipu_bus_register_driver(&ipu_psys_driver);
+#else
+ auxiliary_driver_register(&ipu6_psys_aux_driver);
+#endif
+ return 0;
+}
+module_init(ipu_psys_init);
+
+static void __exit ipu_psys_exit(void)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+ ipu_bus_unregister_driver(&ipu_psys_driver);
+#else
+ auxiliary_driver_unregister(&ipu6_psys_aux_driver);
+#endif
+ bus_unregister(&ipu_psys_bus);
+ unregister_chrdev_region(ipu_psys_dev_t, IPU_PSYS_NUM_DEVICES);
+}
+module_exit(ipu_psys_exit);
+
MODULE_AUTHOR("Antti Laakso <antti.laakso@intel.com>");
MODULE_AUTHOR("Bin Han <bin.b.han@intel.com>");
MODULE_AUTHOR("Renwei Wu <renwei.wu@intel.com>");
--
2.48.1
@@ -0,0 +1,38 @@
From d5f08986936a7fda0cce543c73fb8d9bab76eae2 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 15 Jan 2025 11:28:54 +0100
Subject: [PATCH 10/12] usbio: Fix GPIO and I2C driver modaliases
The created GPIO and I2C devices have modaliases of
"platform:usbio-gpio" and "platform:usbio-i2c" note "usbio" not "usb"
fix the aliases of the drivers so that these will properly auto load.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpio/gpio-usbio.c | 2 +-
drivers/i2c/busses/i2c-usbio.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-usbio.c b/drivers/gpio/gpio-usbio.c
index 625558b..de9d5cb 100644
--- a/drivers/gpio/gpio-usbio.c
+++ b/drivers/gpio/gpio-usbio.c
@@ -499,4 +499,4 @@ MODULE_AUTHOR("Israel Cepeda <israel.a.cepeda.lopez@intel.com>");
MODULE_AUTHOR("Lifu Wang <lifu.wang@intel.com>");
MODULE_DESCRIPTION("Intel USBIO-GPIO driver");
MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:usb-gpio");
+MODULE_ALIAS("platform:usbio-gpio");
diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c
index ef1f380..3b2c856 100644
--- a/drivers/i2c/busses/i2c-usbio.c
+++ b/drivers/i2c/busses/i2c-usbio.c
@@ -437,4 +437,4 @@ MODULE_AUTHOR("Israel Cepeda <israel.a.cepeda.lopez@intel.com>");
MODULE_AUTHOR("Lifu Wang <lifu.wang@intel.com>");
MODULE_DESCRIPTION("Intel USBIO-I2C driver");
MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:usb-i2c");
+MODULE_ALIAS("platform:usbio-i2c");
--
2.47.1
@@ -0,0 +1,130 @@
From ce28836eb5ce74ae26a66a97949778bdb2cebc3c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 4 Feb 2025 17:34:54 +0100
Subject: [PATCH 11/11] psys: Use cdev_device_add() for /dev/ipu-psys0
Use cdev_device_add() for /dev/ipu-psys0 so that its kobj parents gets
set properly by calling cdev_set_parent().
"cdev_set_parent() sets a parent kobject which will be referenced
appropriately so the parent is not freed before the cdev. This
should be called before cdev_add."
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/pci/intel/ipu6/psys/ipu-psys.c | 45 ++++++++------------
1 file changed, 17 insertions(+), 28 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
index c06cd515a..62fcf0215 100644
--- a/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
+++ b/drivers/media/pci/intel/ipu6/psys/ipu-psys.c
@@ -2170,17 +2170,6 @@ static int ipu_psys_probe(struct ipu_bus_device *adev)
ipu_trace_init(adev->isp, psys->pdata->base, &adev->dev,
psys_trace_blocks);
- cdev_init(&psys->cdev, &ipu_psys_fops);
- psys->cdev.owner = ipu_psys_fops.owner;
-
- rval = cdev_add(&psys->cdev, MKDEV(MAJOR(ipu_psys_dev_t), minor), 1);
- if (rval) {
- dev_err(&adev->dev, "cdev_add failed (%d)\n", rval);
- goto out_unlock;
- }
-
- set_bit(minor, ipu_psys_devices);
-
spin_lock_init(&psys->ready_lock);
spin_lock_init(&psys->pgs_lock);
psys->ready = 0;
@@ -2261,12 +2250,19 @@ static int ipu_psys_probe(struct ipu_bus_device *adev)
psys->dev.devt = MKDEV(MAJOR(ipu_psys_dev_t), minor);
psys->dev.release = ipu_psys_dev_release;
dev_set_name(&psys->dev, "ipu-psys%d", minor);
- rval = device_register(&psys->dev);
+ device_initialize(&psys->dev);
+
+ cdev_init(&psys->cdev, &ipu_psys_fops);
+ psys->cdev.owner = ipu_psys_fops.owner;
+
+ rval = cdev_device_add(&psys->cdev, &psys->dev);
if (rval < 0) {
dev_err(&psys->dev, "psys device_register failed\n");
goto out_release_fw_com;
}
+ set_bit(minor, ipu_psys_devices);
+
/* Add the hw stepping information to caps */
strscpy(psys->caps.dev_model, IPU_MEDIA_DEV_MODEL_NAME,
sizeof(psys->caps.dev_model));
@@ -2298,7 +2294,6 @@ out_free_pgs:
ipu_psys_resource_pool_cleanup(&psys->resource_pool_running);
out_mutex_destroy:
mutex_destroy(&psys->mutex);
- cdev_del(&psys->cdev);
if (psys->sched_cmd_thread) {
kthread_stop(psys->sched_cmd_thread);
psys->sched_cmd_thread = NULL;
@@ -2359,17 +2354,6 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
psys->power_gating = 0;
- cdev_init(&psys->cdev, &ipu_psys_fops);
- psys->cdev.owner = ipu_psys_fops.owner;
-
- rval = cdev_add(&psys->cdev, MKDEV(MAJOR(ipu_psys_dev_t), minor), 1);
- if (rval) {
- dev_err(dev, "cdev_add failed (%d)\n", rval);
- goto out_unlock;
- }
-
- set_bit(minor, ipu_psys_devices);
-
spin_lock_init(&psys->ready_lock);
spin_lock_init(&psys->pgs_lock);
psys->ready = 0;
@@ -2450,12 +2434,19 @@ static int ipu6_psys_probe(struct auxiliary_device *auxdev,
psys->dev.devt = MKDEV(MAJOR(ipu_psys_dev_t), minor);
psys->dev.release = ipu_psys_dev_release;
dev_set_name(&psys->dev, "ipu-psys%d", minor);
- rval = device_register(&psys->dev);
+ device_initialize(&psys->dev);
+
+ cdev_init(&psys->cdev, &ipu_psys_fops);
+ psys->cdev.owner = ipu_psys_fops.owner;
+
+ rval = cdev_device_add(&psys->cdev, &psys->dev);
if (rval < 0) {
dev_err(dev, "psys device_register failed\n");
goto out_release_fw_com;
}
+ set_bit(minor, ipu_psys_devices);
+
/* Add the hw stepping information to caps */
strscpy(psys->caps.dev_model, IPU6_MEDIA_DEV_MODEL_NAME,
sizeof(psys->caps.dev_model));
@@ -2483,7 +2474,6 @@ out_free_pgs:
ipu_psys_resource_pool_cleanup(&psys->resource_pool_running);
out_mutex_destroy:
mutex_destroy(&psys->mutex);
- cdev_del(&psys->cdev);
if (psys->sched_cmd_thread) {
kthread_stop(psys->sched_cmd_thread);
psys->sched_cmd_thread = NULL;
@@ -2552,10 +2542,9 @@ static void ipu6_psys_remove(struct auxiliary_device *auxdev)
ipu_psys_resource_pool_cleanup(&psys->resource_pool_running);
- device_unregister(&psys->dev);
+ cdev_device_del(&psys->cdev, &psys->dev);
clear_bit(MINOR(psys->cdev.dev), ipu_psys_devices);
- cdev_del(&psys->cdev);
mutex_unlock(&ipu_psys_mutex);
--
2.48.1
@@ -0,0 +1,115 @@
From 47b34a6f467eebb4e9fc59f5e25618fe760fbf33 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 29 Jan 2025 19:13:29 +0100
Subject: [PATCH 11/12] usbio: Fix I2C max transfer size
There are 2 issues with the I2C max transfer size in the i2c-usbio module:
1. The code defines a usbio_i2c_quirks struct but does not set
i2c_adapter.quirks. This causes ov08x40_burst_fill_regs() to not split
i2c-transfers larger then USBIO_I2C_MAX_XFER_SIZE which causes them
to be rejected with -EINVAL. Fix this by setting i2c_adapter.quirks.
2. Once 1. is fixed the following error messages show up in dmesg:
Jan 28 18:31:04 x1 kernel: usbio-bridge 3-9:1.0: data not correct header->len:5 payload_len:3
Jan 28 18:31:04 x1 kernel: usbio-bridge 3-9:1.0: data not correct header->len:5 payload_len:3
...
Every time ov08x40_burst_fill_regs() gets called. This is caused by
the usbio_transfer_internal() splitting-up the i2c-transfer into
multiple USB bulk packets to honor MAX_PACKET_SIZE.
This splitting up seems to not work and the USBIO expander responds with
a 3 byte answer with flags set 0x0e which includes ERR_FLAG, it seems that
when ERR_FLAG is set only a 3 byte header is returned (no length field).
Modify USBIO_I2C_MAX_XFER_SIZE to avoid the splitting of the i2c-transfer
over multiple USB bulk packets, since the USBIO chip seems to not like
the splitting.
After this change to USBIO_I2C_MAX_XFER_SIZE the code to split transfers
in usbio_transfer_internal() is no longer necessary, remove it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/i2c/busses/i2c-usbio.c | 11 ++++++++++-
drivers/mfd/usbio.c | 33 ++-------------------------------
2 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c
index 3b2c856..a6c5edc 100644
--- a/drivers/i2c/busses/i2c-usbio.c
+++ b/drivers/i2c/busses/i2c-usbio.c
@@ -65,7 +65,15 @@ struct i2c_xfer {
u8 data[];
} __packed;
-#define USBIO_I2C_MAX_XFER_SIZE 256
+//[WA]: Max USB packet size needs to be 63
+//in order for fw download to work
+#define USBIO_MAX_PACKET_SIZE 63
+#define USBIO_BULK_MSG_HDR_SIZE 5
+
+#define USBIO_I2C_MAX_XFER_SIZE \
+ (USBIO_MAX_PACKET_SIZE - USBIO_BULK_MSG_HDR_SIZE - \
+ sizeof(struct i2c_rw_packet))
+
#define USBIO_I2C_BUF_SIZE \
(USBIO_I2C_MAX_XFER_SIZE + sizeof(struct i2c_rw_packet))
@@ -384,6 +392,7 @@ static int usbio_i2c_probe(struct platform_device *pdev)
usbio_i2c->adap.owner = THIS_MODULE;
usbio_i2c->adap.class = I2C_CLASS_HWMON;
usbio_i2c->adap.algo = &usbio_i2c_algo;
+ usbio_i2c->adap.quirks = &usbio_i2c_quirks;
usbio_i2c->adap.dev.parent = &pdev->dev;
try_bind_acpi(pdev, usbio_i2c);
diff --git a/drivers/mfd/usbio.c b/drivers/mfd/usbio.c
index 8bc7600..51757df 100644
--- a/drivers/mfd/usbio.c
+++ b/drivers/mfd/usbio.c
@@ -390,37 +390,8 @@ static int usbio_transfer_internal(struct platform_device *pdev, u8 cmd,
ret = usbio_control_xfer(stub, cmd, obuf, obuf_len,
ibuf, ibuf_len, wait_ack, USB_WRITE_ACK_TIMEOUT);
else if (stub->type == I2C_STUB) {
- if (cmd == I2C_WRITE) {
- u8 *i2cpkt = obuf;
- int wsize = 0;
- bool done = false;
- while (wsize < obuf_len) {
- int chunk;
-
- if ((obuf_len - wsize) <= MAX_PAYLOAD_BSIZE) {
- chunk = obuf_len - wsize;
- done = true;
- } else
- chunk = MAX_PAYLOAD_BSIZE;
-
- //[WA]: The I2C header in each chunk has to be updated
- //to the payload bytes being sent in that chunk for fw
- //download to work.
- struct i2c_rw_packet *i2cpkt_hdr = (struct i2c_rw_packet *)i2cpkt;
- i2cpkt_hdr->len = chunk - sizeof(struct i2c_rw_packet);
-
- ret = usbio_bulk_write(stub, cmd, i2cpkt, chunk, ibuf, ibuf_len,
- done, done? wait_ack : false, USB_WRITE_ACK_TIMEOUT);
- if (ret || done)
- break;
-
- wsize += chunk - sizeof(struct i2c_rw_packet);
- i2cpkt += chunk - sizeof(struct i2c_rw_packet);
- memcpy(i2cpkt, obuf, sizeof(struct i2c_rw_packet));
- }
- } else
- ret = usbio_bulk_write(stub, cmd, obuf, obuf_len,
- ibuf, ibuf_len, true, wait_ack, USB_WRITE_ACK_TIMEOUT);
+ ret = usbio_bulk_write(stub, cmd, obuf, obuf_len,
+ ibuf, ibuf_len, true, wait_ack, USB_WRITE_ACK_TIMEOUT);
}
return ret;
--
2.47.1
@@ -0,0 +1,30 @@
From 0eae85556558b410635ad03ed5eccb9648e11fce Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 29 Jan 2025 19:26:16 +0100
Subject: [PATCH 12/12] usbio: Use MAX_PAYLOAD_BSIZE in usbio_bulk_write()
usbio_bulk_write() uses a struct usbio_bmsg header rather than
a struct usbio_msg header. So its max payload length check must use
MAX_PAYLOAD_BSIZE instead of MAX_PAYLOAD_SIZE.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/mfd/usbio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/usbio.c b/drivers/mfd/usbio.c
index 51757df..ab5dae9 100644
--- a/drivers/mfd/usbio.c
+++ b/drivers/mfd/usbio.c
@@ -303,7 +303,7 @@ static int usbio_bulk_write(struct usbio_stub *stub, u8 cmd, const void *obuf,
if (bridge->state == BRIDGE_STOPPED)
return -ENODEV;
- if (obuf_len > MAX_PAYLOAD_SIZE)
+ if (obuf_len > MAX_PAYLOAD_BSIZE)
return -EINVAL;
if (last_pkt)
--
2.47.1
@@ -0,0 +1,38 @@
From a6c5a0c329fd1582fc94b51ba9c6f1c21abc0084 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 30 Jan 2025 22:04:41 +0100
Subject: [PATCH 8/8] Fedora local mod: integrate usbio-drivers within
ipu6-drivers Makefile
Integrate usbio-drivers within ipu6-drivers Makefile.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Makefile | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Makefile b/Makefile
index 7ae3be835..637382d6d 100644
--- a/Makefile
+++ b/Makefile
@@ -114,6 +114,17 @@ ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_IVSC)),true)
ccflags-y += -I$(src)/backport-include/drivers/misc/mei/
endif
+# begin integrate usbio-drivers within ipu6-drivers Makefile
+obj-m += usbio.o
+usbio-y := drivers/mfd/usbio.o
+
+obj-m += gpio-usbio.o
+gpio-usbio-y := drivers/gpio/gpio-usbio.o
+
+obj-m += i2c-usbio.o
+i2c-usbio-y := drivers/i2c/busses/i2c-usbio.o
+# end integrate usbio-drivers within ipu6-drivers Makefile
+
subdir-ccflags-y += -I$(src)/include/ \
-DCONFIG_VIDEO_V4L2_SUBDEV_API
--
2.47.1
+10
View File
@@ -0,0 +1,10 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "dkms-intel-ipu6.spec"
}
labels {
mock = 1
updbranch = 1
}
}
@@ -0,0 +1,112 @@
%global debug_package %{nil}
%global ipu6_commit 13c466ebdaaa0578e82bf3039b63eb0b3f472b72
%global ipu6_commitdate 20250115
%global ipu6_shortcommit %(c=%{ipu6_commit}; echo ${c:0:7})
%global usbio_commit 450939ff5f8af733bc89c564603222a4d420acf3
%global usbio_commitdate 20241210
%global usbio_shortcommit %(c=%{usbio_commit}; echo ${c:0:7})
%global commit_date 20250224
%global modulename intel-ipu6
# Actual "release" version, currently unused as the release versions are back and forth on if on if they use 1.0.0 or 1.0.1
%global ver 1.0.1
Name: dkms-%{modulename}
Summary: DKMS module for %{modulename}
Version: 0^%{ipu6_commitdate}git.%{ipu6_shortcommit}
Release: 1%{?dist}
License: GPL-2.0-or-later
URL: https://github.com/intel/ipu6-drivers
Source0: https://github.com/intel/ipu6-drivers/archive/%{ipu6_commit}/ipu6-drivers-%{ipu6_shortcommit}.tar.gz
Source1: https://github.com/intel/usbio-drivers/archive/%{usbio_commit}/usbio-drivers-%{usbio_shortcommit}.tar.gz
Source2: no-weak-modules.conf
# Patches
# https://github.com/intel/ipu6-drivers/pull/322
Patch1: 0001-Makefile-Switch-sensor-driver-symbols-from-CONFIG_VI.patch
Patch2: 0002-Makefile-Re-enable-gc5035-compilation-with-kernels-6.patch
Patch3: 0003-Makefile-Do-not-build-hi556-driver-with-kernels-6.10.patch
Patch4: 0004-Makefile-Do-not-build-ov01a10-driver-with-kernels-6..patch
# https://github.com/intel/ipu6-drivers/pull/321
Patch5: 0005-media-ipu6-Fix-out-of-tree-builds.patch
Patch6: 0006-media-ipu6-Fix-building-with-kernel-6.13.patch
Patch7: 0007-Modify-0001-v6.10-IPU6-headers-used-by-PSYS.patch-fo.patch
# https://github.com/intel/ipu6-drivers/pull/324
Patch8: 0008-ipu6-psys-Adjust-DMA-code-for-ipu6-bus-DMA-changes-i.patch
Patch9: 0009-Add-ipu6-dma.h-to-0001-v6.10-IPU6-headers-used-by-PS.patch
# https://github.com/intel/ipu6-drivers/pull/327
Patch10: 0010-psys-Do-not-skipping-registering-ipu_psys_bus-for-ke.patch
Patch11: 0011-psys-Use-cdev_device_add-for-dev-ipu-psys0.patch
# https://github.com/intel/usbio-drivers/pull/33
Patch20: 0010-usbio-Fix-GPIO-and-I2C-driver-modaliases.patch
# https://github.com/intel/usbio-drivers/pull/34
Patch21: 0011-usbio-Fix-I2C-max-transfer-size.patch
Patch22: 0012-usbio-Use-MAX_PAYLOAD_BSIZE-in-usbio_bulk_write.patch
# Downstream/Fedora specific patches
Patch101: 0101-Fedora-local-mod-integrate-usbio-drivers-within-ipu6.patch
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
BuildRequires: systemd-rpm-macros
Requires: %{modulename}-kmod-common = %{?epoch:%{epoch}:}%{version}
Requires: dkms
BuildArch: noarch
Packager: Gilver E. <rockgrub@disroot.org>
%description
This package enables the Intel IPU6 image processor.
%prep
%setup -q -c -a 1
(cd ipu6-drivers-%{ipu6_commit}
%patch 1 -p1
%patch 2 -p1
%patch 3 -p1
%patch 4 -p1
%patch 5 -p1
%patch 6 -p1
%patch 7 -p1
%patch 8 -p1
%patch 9 -p1
%patch 10 -p1
%patch 11 -p1
%patch 101 -p1
patch -p1 < patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch
sed -i "s/^PACKAGE_VERSION=\".*\"$/PACKAGE_VERSION=\"%{version}\"/g" ./dkms.conf
)
(cd usbio-drivers-%{usbio_commit}
%patch 20 -p1
%patch 21 -p1
%patch 22 -p1
)
cp -Rp usbio-drivers-%{usbio_commit}/drivers ipu6-drivers-%{ipu6_commit}/
cp -Rp usbio-drivers-%{usbio_commit}/include ipu6-drivers-%{ipu6_commit}/
%build
%install
mkdir -p %{buildroot}%{_usrsrc}/%{modulename}-%{version}
cp -fr ipu6-drivers-%{ipu6_commit}/{drivers,include,patch,patches,Makefile,dkms.conf} %{buildroot}%{_usrsrc}/%{modulename}-%{version}/
%if 0%{?fedora}
# Do not enable weak modules support in Fedora (no kABI):
install -Dpm644 %{SOURCE2} %{buildroot}%{_sysconfdir}/dkms/%{modulename}.conf
%endif
%post
dkms add -m %{modulename} -v %{version} -q --rpm_safe_upgrade || :
# Rebuild and make available for the currently running kernel:
dkms build -m %{modulename} -v %{version} -q || :
dkms install -m %{modulename} -v %{version} -q --force || :
%preun
# Remove all versions from DKMS registry:
dkms remove -m %{modulename} -v %{version} -q --all --rpm_safe_upgrade || :
%files
%{_usrsrc}/%{modulename}-%{version}
%if 0%{?fedora}
%{_sysconfdir}/dkms/%{modulename}.conf
%endif
%changelog
* Thu Apr 24 2025 Gilver E. <rockgrub@disroot.org>
- Initial package
@@ -0,0 +1 @@
NO_WEAK_MODULES="yes"
+13
View File
@@ -0,0 +1,13 @@
let c = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global ipu6_commit ' | sed -E 's/.+ipu6_commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("ipu6_commit", c);
if rpm.changed() {
rpm.release();
let d = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global ipu6_commitdate' | sed -E 's/.+ipu6_commitdate //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("ipu6_commitdate", d);
let v = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global ver' | sed -E 's/.+ver //'", #{"stdout": "piped"}).ctx.stdout;
v.pop();
rpm.global("ver", v);
}
@@ -0,0 +1,6 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "intel-ipu6-drivers.spec"
}
}
@@ -0,0 +1,47 @@
%global debug_package %{nil}
%global ipu6_commit 13c466ebdaaa0578e82bf3039b63eb0b3f472b72
%global ipu6_commitdate 20250115
%global ipu6_shortcommit %(c=%{ipu6_commit}; echo ${c:0:7})
%global usbio_commit 450939ff5f8af733bc89c564603222a4d420acf3
%global usbio_commitdate 20241210
%global usbio_shortcommit %(c=%{usbio_commit}; echo ${c:0:7})
# Actual "release" version, currently unused as the release versions are back and forth on if on if they use 1.0.0 or 1.0.1
# Use this if they ever stop doing that I guess
%global ver 1.0.1
Name: intel-ipu6-drivers
Summary: Common files for Intel IPU6 drivers
Version: 0^%{ipu6_commitdate}git.%{ipu6_shortcommit}
Release: 1%{?dist}
License: GPL-2.0-or-later
URL: https://github.com/intel/ipu6-drivers
Source0: https://github.com/intel/ipu6-drivers/archive/%{ipu6_commit}/ipu6-drivers-%{ipu6_shortcommit}.tar.gz
Source1: https://github.com/intel/usbio-drivers/archive/%{usbio_commit}/usbio-drivers-%{usbio_shortcommit}.tar.gz
Requires: ipu6-camera-bins
Requires: (intel-ipu6-kmod = %{?epoch:%{epoch}:}%{version} or dkms-intel-ipu6 = %{?epoch:%{epoch}:}%{version})
Provides: intel-ipu6-kmod-common = %{?epoch:%{epoch}:}%{version}-%{release}
BuildArch: noarch
Packager: Gilver E. <rockgrub@disroot.org>
%description
Common files for the Intel IPU6 camera drivers.
%prep
%setup -q -c -a 1
%build
%install
install -Dpm644 usbio-drivers-%{usbio_commit}/LICENSE.txt -t %{buildroot}%{_defaultlicensedir}/%{name}/usbio-drivers/
install -Dpm644 usbio-drivers-%{usbio_commit}/{CODE_OF_CONDUCT.md,README.md,SECURITY.md,security.md} -t %{buildroot}%{_defaultdocdir}/%{name}/usbio-drivers/
%files
%license ipu6-drivers-%{ipu6_commit}/LICENSE
%doc ipu6-drivers-%{ipu6_commit}/README.md
%doc ipu6-drivers-%{ipu6_commit}/SECURITY.md
%{_defaultdocdir}/%{name}/usbio-drivers
%{_defaultlicensedir}/%{name}/usbio-drivers
%changelog
* Thu Apr 24 2025 Gilver E. <rockgrub@disroot.org>
- Initial package
@@ -0,0 +1,6 @@
rpm.global("ipu6_commit", gh_commit("intel/ipu6-drivers"));
if rpm.changed() {
rpm.release();
rpm.global("usbio_commit", gh_commit("intel/usbio-drivers"));
rpm.global("ipu6_commitdate", date());
}