chore: Update Intel IPU6 specs, separate IPU6 drivers and USBIO drivers (#5490) (#5496)

* chore: Update Intel IPU6 specs, separate IPU6 drivers and USBIO drivers

* chore: Changelogs

* fix: Some oopsies

* fix: Commit?

* fix: Cleanup

* fix: dfshdfshjksdfdfhjs

(cherry picked from commit 205fe13dd3)

Co-authored-by: Gilver <rockgrub@disroot.org>
This commit is contained in:
Raboneko
2025-06-16 02:56:23 -07:00
committed by GitHub
parent a872fa65d8
commit 130efdf2fe
30 changed files with 337 additions and 888 deletions
@@ -1,28 +0,0 @@
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
@@ -1,38 +0,0 @@
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
@@ -1,130 +0,0 @@
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
@@ -1,115 +0,0 @@
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
@@ -1,30 +0,0 @@
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
@@ -1,38 +0,0 @@
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
@@ -1,42 +1,28 @@
%if 0%{?fedora}
%global buildforkernels akmod
%global debug_package %{nil}
%endif
%global ipu6_commit e89983c628d046b2f77af3b6678cc49c2dd58332
%global ipu6_commitdate 20250521
%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 e89983c628d046b2f77af3b6678cc49c2dd58332
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commit_date 20250521
%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: 1%?dist
Version: 0^%{commit_date}git.%{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/321
Patch0: 0005-media-ipu6-Fix-out-of-tree-builds.patch
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
Source0: https://github.com/intel/ipu6-drivers/archive/%{commit}/ipu6-drivers-%{shortcommit}.tar.gz
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
BuildRequires: kmodtool
Requires: %{modulename}-kmod-common = %{?epoch:%{epoch}:}%{version}
Requires: akmods
Requires: akmod-intel-usbio
%if 0%{?fedora} <= 43 || 0%{?rhel} <= 10
Provides: %{name} = %{ipu6_commitdate}.%{ipu6_shortcommit}-%{release}
Provides: akmod-%{modulename} = %{ipu6_commitdate}.%{ipu6_shortcommit}-%{release}
Provides: %{name} = %{commitdate}.%{shortcommit}-%{release}
Provides: akmod-%{modulename} = %{commitdate}.%{shortcommit}-%{release}
%endif
%{expand:%(kmodtool --target %{_target_cpu} --repo terra --kmodname %{modulename} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
@@ -45,43 +31,36 @@ Provides: akmod-%{modulename} = %{ipu6_commitdate}.%{ipu6_shortcommit}-%{r
This package enables the Intel IPU6 image processor.
%prep
# error out if there was something wrong with kmodtool
# Error out if there was something wrong with kmodtool:
%{?kmodtool_check}
# Print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo terra --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo terra --kmodname %{modulename} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
%autosetup -p1 -n ipu6-drivers-%{commit}
patch -p1 -i patches/*.patch
rm -fr dkms.conf .github
%setup -q -c -a 1
(cd ipu6-drivers-%{ipu6_commit}
%patch 0 -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%%___*}
for kernel_version in %{?kernel_versions}; do
mkdir _kmod_build_${kernel_version%%___*}
cp -fr drivers include Makefile _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions} ; do
make -C ${kernel_version##*___} M=${PWD}/_kmod_build_${kernel_version%%___*} modules
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}/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}
# Print out modules that are getting built:
find _kmod_build_${kernel_version%%___*} -name "*.ko"
mkdir -p %{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
install -p -m 0755 \
_kmod_build_${kernel_version%%___*}/drivers/media/i2c/*.ko \
_kmod_build_${kernel_version%%___*}/drivers/media/pci/intel/ipu6/psys/*.ko \
%{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
done
%{?akmod_install}
+4 -4
View File
@@ -1,11 +1,11 @@
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;
let c = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global commit ' | sed -E 's/.+commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("ipu6_commit", c);
rpm.global("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;
let d = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global commit_date' | sed -E 's/.+commit_date //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("ipu6_commitdate", d);
rpm.global("commit_date", 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);
@@ -1,28 +0,0 @@
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
@@ -1,38 +0,0 @@
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
@@ -1,130 +0,0 @@
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
@@ -1,115 +0,0 @@
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
@@ -1,30 +0,0 @@
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
@@ -1,38 +0,0 @@
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
@@ -0,0 +1,40 @@
PACKAGE_NAME=ipu6-drivers
PACKAGE_VERSION=0.1
AUTOINSTALL="yes"
BUILD_EXCLUSIVE_CONFIG="CONFIG_VIDEO_V4L2_I2C CONFIG_V4L2_CCI_I2C"
BUILT_MODULE_NAME[0]="hm11b1"
BUILT_MODULE_LOCATION[0]="drivers/media/i2c"
DEST_MODULE_LOCATION[0]="/extra"
BUILT_MODULE_NAME[1]="ov01a1s"
BUILT_MODULE_LOCATION[1]="drivers/media/i2c"
DEST_MODULE_LOCATION[1]="/extra"
BUILT_MODULE_NAME[2]="ov02c10"
BUILT_MODULE_LOCATION[2]="drivers/media/i2c"
DEST_MODULE_LOCATION[2]="/extra"
BUILT_MODULE_NAME[3]="ov02e10"
BUILT_MODULE_LOCATION[3]="drivers/media/i2c"
DEST_MODULE_LOCATION[3]="/extra"
BUILT_MODULE_NAME[4]="hm2170"
BUILT_MODULE_LOCATION[4]="drivers/media/i2c"
DEST_MODULE_LOCATION[4]="/extra"
BUILT_MODULE_NAME[5]="hm2172"
BUILT_MODULE_LOCATION[5]="drivers/media/i2c"
DEST_MODULE_LOCATION[5]="/extra"
BUILT_MODULE_NAME[6]="ov05c10"
BUILT_MODULE_LOCATION[6]="drivers/media/i2c"
DEST_MODULE_LOCATION[6]="/extra"
BUILT_MODULE_NAME[7]="intel-ipu6-psys"
BUILT_MODULE_LOCATION[7]="drivers/media/pci/intel/ipu6/psys"
DEST_MODULE_LOCATION[7]="/extra"
BUILT_MODULE_NAME[8]="imx471"
BUILT_MODULE_LOCATION[8]="drivers/media/i2c"
DEST_MODULE_LOCATION[8]="/extra"
@@ -1,38 +1,26 @@
%global debug_package %{nil}
%global ipu6_commit e89983c628d046b2f77af3b6678cc49c2dd58332
%global ipu6_commitdate 20250521
%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 commit e89983c628d046b2f77af3b6678cc49c2dd58332
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commit_date 20250521
%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
Version: 0^%{commit_date}git.%{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
Source2: no-weak-modules.conf
# Patches
# https://github.com/intel/ipu6-drivers/pull/321
Patch0: 0005-media-ipu6-Fix-out-of-tree-builds.patch
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
Source0: %{url}/archive/%{commit}.tar.gz#/ipu6-drivers-%{shortcommit}.tar.gz
Source1: %{name}.conf
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
BuildRequires: systemd-rpm-macros
Provides: %{modulename}-kmod
Requires: %{modulename}-kmod-common = %{?epoch:%{epoch}:}%{version}
Requires: dkms
Requires: dkms-usbio-drivers
BuildArch: noarch
Packager: Gilver E. <rockgrub@disroot.org>
@@ -40,47 +28,32 @@ Packager: Gilver E. <rockgrub@disroot.org>
This package enables the Intel IPU6 image processor.
%prep
%setup -q -c -a 1
(cd ipu6-drivers-%{ipu6_commit}
%patch 0 -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
)
%autosetup -p1 -n ipu6-drivers-%{commit}
# Pre-apply patch listed in dkms.conf:
patch -p1 -i patches/*.patch
rm -fr patch* .github
cp -Rp usbio-drivers-%{usbio_commit}/drivers ipu6-drivers-%{ipu6_commit}/
cp -Rp usbio-drivers-%{usbio_commit}/include ipu6-drivers-%{ipu6_commit}/
cp -f %{SOURCE1} dkms.conf
%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
# Create empty tree:
mkdir -p %{buildroot}%{_usrsrc}/%{dkms_name}-%{version}/
cp -fr * %{buildroot}%{_usrsrc}/%{dkms_name}-%{version}/
%post
dkms add -m %{modulename} -v %{version} -q --rpm_safe_upgrade || :
dkms add -m %{dkms_name} -v %{version} -q || :
# Rebuild and make available for the currently running kernel:
dkms build -m %{modulename} -v %{version} -q || :
dkms install -m %{modulename} -v %{version} -q --force || :
dkms build -m %{dkms_name} -v %{version} -q || :
dkms install -m %{dkms_name} -v %{version} -q --force || :
%preun
# Remove all versions from DKMS registry:
dkms remove -m %{modulename} -v %{version} -q --all --rpm_safe_upgrade || :
dkms remove -m %{dkms_name} -v %{version} -q --all || :
%files
%{_usrsrc}/%{modulename}-%{version}
%if 0%{?fedora}
%{_sysconfdir}/dkms/%{modulename}.conf
%endif
%{_usrsrc}/%{dkms_name}-%{version}
%changelog
* Thu Apr 24 2025 Gilver E. <rockgrub@disroot.org>
@@ -1 +0,0 @@
NO_WEAK_MODULES="yes"
+4 -4
View File
@@ -1,11 +1,11 @@
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;
let c = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global commit ' | sed -E 's/.+commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("ipu6_commit", c);
rpm.global("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;
let d = sh("cat anda/system/ipu6-drivers/kmod-common/intel-ipu6-drivers.spec | grep '%global commit_date' | sed -E 's/.+commit_date //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("ipu6_commitdate", d);
rpm.global("commit_date", 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);
@@ -1,24 +1,20 @@
%global debug_package %{nil}
%global ipu6_commit e89983c628d046b2f77af3b6678cc49c2dd58332
%global ipu6_commitdate 20250521
%global ipu6_shortcommit %(c=%{ipu6_commit}; echo ${c:0:7})
%global usbio_commit 4fb690c6d15a81c492954636c2db396cb700a119
%global usbio_commitdate 20241210
%global usbio_shortcommit %(c=%{usbio_commit}; echo ${c:0:7})
%global commit e89983c628d046b2f77af3b6678cc49c2dd58332
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commit_date 20250521
# 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
Version: 0^%{commit_date}git.%{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
Source0: https://github.com/intel/ipu6-drivers/archive/%{commit}/ipu6-drivers-%{shortcommit}.tar.gz
Requires: ipu6-camera-bins
Requires: (intel-ipu6-kmod = %{?epoch:%{epoch}:}%{version} or dkms-intel-ipu6 = %{?epoch:%{epoch}:}%{version})
Requires: intel-ipu6-kmod = %{?epoch:%{epoch}:}%{version}
Provides: intel-ipu6-kmod-common = %{?epoch:%{epoch}:}%{version}-%{release}
BuildArch: noarch
Packager: Gilver E. <rockgrub@disroot.org>
@@ -27,20 +23,16 @@ Packager: Gilver E. <rockgrub@disroot.org>
Common files for the Intel IPU6 camera drivers.
%prep
%setup -q -c -a 1
%autosetup -n ipu6-drivers-%{commit}
%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
%license LICENSE
%doc README.md
%doc SECURITY.md
%changelog
* Thu Apr 24 2025 Gilver E. <rockgrub@disroot.org>
@@ -1,6 +1,5 @@
rpm.global("ipu6_commit", gh_commit("intel/ipu6-drivers"));
rpm.global("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());
rpm.global("commit_date", date());
}
+10
View File
@@ -0,0 +1,10 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "intel-usbio-kmod.spec"
}
labels {
mock = 1
updbranch = 1
}
}
@@ -0,0 +1,64 @@
%global buildforkernels akmod
%global debug_package %{nil}
%global commit 4fb690c6d15a81c492954636c2db396cb700a119
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commit_date 20241210
%global modulename intel-usbio
Name: %{modulename}-kmod
Summary: Kernel drivers for the USBIO Extension
Version: 0^%{commit_date}git.%{shortcommit}
Release: 1%?dist
License: GPL-2.0-only
URL: https://github.com/intel/usbio-drivers
Source0: %{url}/archive/%{commit}.tar.gz#/usbio-drivers-%{shortcommit}.tar.gz
Patch0: https://github.com/jwrdegoede/usbio-drivers/commit/d5f08986936a7fda0cce543c73fb8d9bab76eae2.patch
Patch1: https://github.com/jwrdegoede/usbio-drivers/commit/47b34a6f467eebb4e9fc59f5e25618fe760fbf33.patch
Patch2: https://github.com/jwrdegoede/usbio-drivers/commit/0eae85556558b410635ad03ed5eccb9648e11fce.patch
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
BuildRequires: kmodtool
Requires: %{modulename}-kmod-common = %{?epoch:%{epoch}:}%{version}
Requires: akmods
Requires: akmod-intel-ipu6
Packager: Gilver E. <rockgrub@disroot.org>
%{expand:%(kmodtool --target %{_target_cpu} --repo terra --kmodname %{modulename} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
This package enables USBIO Extension drivers on Intel Alder Lake, Raptor Lake, Meteor Lake and Lunar Lake platforms.
%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
%autosetup -p1 -n usbio-drivers-%{commit}
rm -fr .github
for kernel_version in %{?kernel_versions} ; do
cp -a ./* _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/gpio/
mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/i2c/busses/
mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/mfd/
install -m 755 _kmod_build_${kernel_version%%___*}/drivers/gpio/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/gpio/
install -m 755 _kmod_build_${kernel_version%%___*}/drivers/i2c/busses/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/i2c/busses/
install -m 755 _kmod_build_${kernel_version%%___*}/drivers/mfd/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/drivers/mfd/
install -m 755 _kmod_build_${kernel_version%%___*}/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}
done
%{?akmod_install}
%changelog
* Mon Jun 16 2025 Gilver E. <rockgrub@disroot.org> - 0^20250312git4fb690c
- Initial package
@@ -0,0 +1,10 @@
let c = sh("cat anda/system/usbio-drivers/kmod-common/intel-usbio-drivers.spec | grep '%global commit ' | sed -E 's/.+commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("commit", c);
if rpm.changed() {
rpm.release();
let d = sh("cat anda/system/usbio-drivers/kmod-common/intel-usbio-drivers.spec | grep '%global commit_date' | sed -E 's/.+commit_date //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("commit_date", d);
}
+9
View File
@@ -0,0 +1,9 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "dkms-intel-usbio.spec"
}
labels {
updbranch = 1
}
}
@@ -0,0 +1,12 @@
PACKAGE_NAME="usbio-drivers"
PACKAGE_VERSION="0.1"
AUTOINSTALL="yes"
BUILT_MODULE_NAME[0]="usbio"
DEST_MODULE_LOCATION[0]="/extra"
BUILT_MODULE_NAME[1]="gpio-usbio"
DEST_MODULE_LOCATION[1]="/extra"
BUILT_MODULE_NAME[2]="i2c-usbio"
DEST_MODULE_LOCATION[2]="/extra"
@@ -0,0 +1,56 @@
%global commit 4fb690c6d15a81c492954636c2db396cb700a119
%global shortcommit %{sub %{commit} 1 7}
%global commit_date 20250312
%global debug_package %{nil}
%global modulename intel-usbio
Name: dkms-%{modulename}
Version: 0^%{commit_date}git.%{shortcommit}
Release: 1%{?dist}
Summary: Kernel drivers for the USBIO Extension
License: GPL-2.0-only
URL: https://github.com/intel/usbio-drivers
Source0: %{url}/archive/%{commit}.tar.gz#/usbio-drivers-%{shortcommit}.tar.gz
Source2: %{name}.conf
Patch0: https://github.com/jwrdegoede/usbio-drivers/commit/d5f08986936a7fda0cce543c73fb8d9bab76eae2.patch
Patch1: https://github.com/jwrdegoede/usbio-drivers/commit/47b34a6f467eebb4e9fc59f5e25618fe760fbf33.patch
Patch2: https://github.com/jwrdegoede/usbio-drivers/commit/0eae85556558b410635ad03ed5eccb9648e11fce.patch
Provides: %{modulename}-kmod = %{version}
Requires: dkms
Requires: dkms-intel-ipu6
BuildArch: noarch
Packager: Gilver E. <rockgrub@disroot.org>
%description
This package enables USBIO Extension drivers on Intel Alder Lake, Raptor Lake, Meteor Lake and Lunar Lake platforms.
%prep
%autosetup -p1 -n usbio-drivers-%{commit}
rm -fr .github
cp -f %{SOURCE2} dkms.conf
%build
%install
# Create empty tree:
mkdir -p %{buildroot}%{_usrsrc}/%{modulename}-%{version}/
cp -fr * %{buildroot}%{_usrsrc}/%{modulename}-%{version}/
%post
dkms add -m %{modulename} -v %{version} -q || :
# 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 || :
%files
%{_usrsrc}/%{modulename}-%{version}
%changelog
* Mon Jun 16 2025 Gilver E. <rockgrub@disroot.org> - 0^20250312git4fb690c
- Initial package
@@ -0,0 +1,10 @@
let c = sh("cat anda/system/usbio-drivers/kmod-common/intel-usbio-drivers.spec | grep '%global commit ' | sed -E 's/.+commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("commit", c);
if rpm.changed() {
rpm.release();
let d = sh("cat anda/system/usbio-drivers/kmod-common/intel-usbio-drivers.spec | grep '%global commit_date' | sed -E 's/.+commit_date //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("commit_date", d);
}
@@ -0,0 +1,9 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "intel-usbio-drivers.spec"
}
labels {
nightly = 1
}
}
@@ -0,0 +1,40 @@
%global commit 4fb690c6d15a81c492954636c2db396cb700a119
%global shortcommit %{sub %{commit} 1 7}
%global commit_date 20250312
%global debug_package %{nil}
Name: dkms-%{modulename}
Version: 0^%{commit_date}git.%{shortcommit}
Release: 1%{?dist}
Summary: Common files for the USBIO drivers
License: GPL-2.0-only
URL: https://github.com/intel/usbio-drivers
Source0: %{url}/archive/%{commit}.tar.gz#/usbio-drivers-%{shortcommit}.tar.gz
BuildRequires: anda-srpm-macros
Provides: intel-usbio-kmod-common = %{evr}
Requires: intel-ipu6-kmod-common
BuildArch: noarch
Packager: Gilver E. <rockgrub@disroot.org>
%description
This package contains the common files for the UBSIO kernel modules.
%prep
%autosetup -p1 -n usbio-drivers-%{commit}
%build
# Hi, I'm empty.
%install
# Hi, I'm also empty!
%files
%doc CODE_OF_CONDUCT.md
%doc README.md
%doc SECURITY.md
%doc security.md
%license LICENSE.txt
%changelog
* Mon Jun 16 2025 Gilver E. <rockgrub@disroot.org> - 0^20250312git4fb690c
- Initial package
@@ -0,0 +1,5 @@
rpm.global("commit", gh_commit("intel/usbio-drivers"));
if rpm.changed() {
rpm.release();
rpm.global("commit_date", date());
}