Skip to content

Commit

Permalink
patch: Correct folders for different kernel
Browse files Browse the repository at this point in the history
Signed-off-by: Hao Yao <[email protected]>
  • Loading branch information
hao-yao committed Oct 10, 2024
1 parent 5c06097 commit 1d6a19a
Show file tree
Hide file tree
Showing 17 changed files with 810 additions and 52 deletions.
49 changes: 32 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Three ways are available:
### 1. Build with kernel source tree
- Tested with kernel v6.10
- Check out kernel
- Apply patches:
- Apply patches (please check detail comments below):
```sh
# For Meteor Lake B stepping only
patch/0002-iommu-Add-passthrough-for-MTL-IPU.patch
Expand All @@ -45,25 +45,40 @@ Three ways are available:
# For kernel version >= 6.3 and using ov13b10
patch/ov13b10-v6.3/*.patch

# For kernel version v6.8
# For kernel version v6.8,
# patch/v6.8/0002-media-Add-IPU6-and-supported-sensors-config.patch
# will change the related Kconfig & Makefile.
patch/v6.8/*.patch

# For kernel version v6.10
patch/v6.10/in-tree-build/*.patch
patch/v6.10/*.patch
# For kernel version v6.10+,
# patch/<version>/in-tree-build/0001-media-ipu6-Workaround-to-build-PSYS.patch
# will change the Makefile to build IPU6 PSYS driver, and
# patch/<version>/in-tree-build/0002-media-i2c-Add-sensors-config.patch
# will change the Makefile & Kconfig for I2C sensor drivers.
patch/<version>/in-tree-build/*.patch
patch/<version>/*.patch
```

- Copy IPU6 drivers to kernel source:
- For kernel < 6.10, need all IPU6 drivers:
```sh
cp -r drivers/media/pci/intel/ <your-kernel>/drivers/media/pci/
cp -r include/* <your-kernel>/include/
```
- For kernel >= 6.10, only IPU6 PSYS driver needed:
```sh
# Out-Of-Tree IPU6 PSYS driver
cp -r drivers/media/pci/intel/ipu6/psys <your-kernel>/drivers/media/pci/intel/ipu6/
cp include/uapi/linux/ipu-psys.h <your-kernel>/include/uapi/linux/
```

- Copy I2C sensor drivers to kernel source (depending on your need):
```sh
# Remove ipu6-drivers/drivers/media/i2c/{Kconfig,Makefile}
# as corresponding files in your kernel was changed by patches before
rm drivers/media/i2c/Kconfig drivers/media/i2c/Makefile
cp -r drivers/media/i2c <your-kernel>/drivers/media/
```
- For kernel v6.8. patch/v6.8/0002-media-Add-IPU6-and-supported-sensors-config.patch will change the related Kconfig & Makefile.
- For kernel v6.10. patch/v6.10/in-tree-build/0001-workaround-patch-to-build-psys.patch will change the Makefile to build IPU6 PSYS driver.
- For latest linux-firmware repo, apply patch/linux-firmware/0001-Add-symbolic-link-for-Intel-IPU6-firmwares.patch to it to make driver work.
- For kernel v6.10 and above, copy only drivers you need to kernel source:
```sh
# Out-Of-Tree IPU6 PSYS driver
cp -r drivers/media/pci/intel/ipu6/psys <your-kernel>/drivers/media/pci/intel/ipu6/
cp include/uapi/linux/ipu-psys.h <your-kernel>/include/uapi/linux/
# Out-Of-Tree I2C sensor drivers
cp -r drivers/media/i2c <your-kernel>/drivers/media/i2c
```
- For kernel version less than v6.10, copy `drivers` and `include` folders to kernel source **(except Kconfig & Makefile at drivers/media/pci/intel and drivers/media/i2c as they are modified by patches in previous step. You can delete them before you copy folders.)**.

- Enable the following settings in .config
```conf
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c1eb35f7316fc54b67442dfe6880f57f93728a3c Mon Sep 17 00:00:00 2001
From d9fb0461964244c26f8fec257ae1b725f0ef5873 Mon Sep 17 00:00:00 2001
From: Dongcheng Yan <[email protected]>
Date: Tue, 30 Jul 2024 11:03:10 +0800
Subject: [PATCH 2/3] use module parameter to set isys/psys freq
Subject: [PATCH 3/5] media: ipu6: Use module parameter to set isys/psys freq

Signed-off-by: Hongju Wang <[email protected]>
Signed-off-by: Dongcheng Yan <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
From c2bad048dcd547c41edb1858259fb672c0db98d4 Mon Sep 17 00:00:00 2001
From ee48e82af9634b4b7da6767a897504331016daf6 Mon Sep 17 00:00:00 2001
From: Hao Yao <[email protected]>
Date: Wed, 18 Sep 2024 14:47:40 +0800
Subject: [PATCH 3/3] media: ipu6: Don't disable ATS when CPU is not Metero
Subject: [PATCH 4/5] media: ipu6: Don't disable ATS when CPU is not Meteor
Lake

IPU6 on Arrow Lake shares the same PCI ID with Meteor Lake, so we
can't use PCI ID to distinguish whether the hardware is Meteor Lake.
Use boot_cpu_data.x86_vfm instead.

Signed-off-by: Hao Yao <[email protected]>
---
drivers/media/pci/intel/ipu6/ipu6.c | 7 +++++--
Expand Down
47 changes: 47 additions & 0 deletions patch/v6.10/0005-media-ipu-bridge-Support-more-sensors.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From d054e0f6a17fcff494dffedcece4e3c34978ad6a Mon Sep 17 00:00:00 2001
From: Hao Yao <[email protected]>
Date: Tue, 26 Mar 2024 10:50:41 +0800
Subject: [PATCH 5/5] media: ipu-bridge: Support more sensors

Signed-off-by: Hao Yao <[email protected]>
---
drivers/media/pci/intel/ipu-bridge.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index 61750cc98d70..0248d119a597 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -61,10 +61,29 @@ static const struct ipu_sensor_config ipu_supported_sensors[] = {
IPU_SENSOR_CONFIG("INT3537", 1, 437000000),
/* Omnivision ov13b10 */
IPU_SENSOR_CONFIG("OVTIDB10", 1, 560000000),
+ IPU_SENSOR_CONFIG("OVTI13B1", 1, 560000000),
/* GalaxyCore GC0310 */
IPU_SENSOR_CONFIG("INT0310", 0),
/* Omnivision ov01a10 */
IPU_SENSOR_CONFIG("OVTI01A0", 1, 400000000),
+ /* Omnivision ov08x40 */
+ IPU_SENSOR_CONFIG("OVTI08F4", 1, 400000000),
+ /* Himax hm11b1 */
+ IPU_SENSOR_CONFIG("HIMX11B1", 1, 384000000),
+ /* Himax hm2170 */
+ IPU_SENSOR_CONFIG("HIMX2170", 1, 384000000),
+ /* Himax hm2172 */
+ IPU_SENSOR_CONFIG("HIMX2172", 1, 384000000),
+ /* Omnivision ov01a1s */
+ IPU_SENSOR_CONFIG("OVTI01AS", 1, 400000000),
+ /* Omnivision ov02c10 */
+ IPU_SENSOR_CONFIG("OVTI02C1", 1, 400000000),
+ /* Omnivision ov02e10 */
+ IPU_SENSOR_CONFIG("OVTI02E1", 1, 360000000),
+ /* Omnivision ov05c10 */
+ IPU_SENSOR_CONFIG("OVTI05C1", 1, 480000000),
+ /* Omnivision ov08a10 */
+ IPU_SENSOR_CONFIG("OVTI08A1", 1, 500000000),
};

static const struct ipu_property_names prop_names = {
--
2.43.0

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 77c296a250c8741de81f5799bfcdd62a465cce65 Mon Sep 17 00:00:00 2001
From 9204b09b79fd63f6d9c14fff8680d837bfc5824a Mon Sep 17 00:00:00 2001
From: Dongcheng Yan <[email protected]>
Date: Fri, 13 Sep 2024 18:02:37 +0800
Subject: [PATCH 1/3] workaround patch to build psys
Subject: [PATCH 1/5] media: ipu6: Workaround to build PSYS

Signed-off-by: Dongcheng Yan <[email protected]>
---
Expand Down
137 changes: 137 additions & 0 deletions patch/v6.10/in-tree-build/0002-media-i2c-Add-sensors-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
From d1a3458bab8845555b5cb760cf9db4b3654fa4e7 Mon Sep 17 00:00:00 2001
From: Hao Yao <[email protected]>
Date: Mon, 25 Mar 2024 14:40:09 +0800
Subject: [PATCH 2/5] media: i2c: Add sensors config

Signed-off-by: Hao Yao <[email protected]>
---
drivers/media/i2c/Kconfig | 71 ++++++++++++++++++++++++++++++++++++++
drivers/media/i2c/Makefile | 8 +++++
2 files changed, 79 insertions(+)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index c6d3ee472d81..5fa7d3e047e4 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -107,6 +107,33 @@ config VIDEO_HI847
To compile this driver as a module, choose M here: the
module will be called hi847.

+config VIDEO_HM11B1
+ tristate "Himax HM11B1 sensor support"
+ help
+ This is a Video4Linux2 sensor driver for the Himax
+ HM11B1 camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called hm11b1.
+
+config VIDEO_HM2170
+ tristate "Himax HM2170 sensor support"
+ help
+ This is a Video4Linux2 sensor driver for the Himax
+ HM2170 camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called hm2170.
+
+config VIDEO_HM2172
+ tristate "Himax HM2172 sensor support"
+ help
+ This is a Video4Linux2 sensor driver for the Himax
+ HM2172 camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called hm2172.
+
config VIDEO_IMX208
tristate "Sony IMX208 sensor support"
help
@@ -315,6 +342,15 @@ config VIDEO_OV01A10
To compile this driver as a module, choose M here: the
module will be called ov01a10.

+config VIDEO_OV01A1S
+ tristate "OmniVision OV01A1S sensor support"
+ help
+ This is a Video4Linux2 sensor driver for the OmniVision
+ OV01A1S camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ov01a1s.
+
config VIDEO_OV02A10
tristate "OmniVision OV02A10 sensor support"
help
@@ -324,6 +360,41 @@ config VIDEO_OV02A10
To compile this driver as a module, choose M here: the
module will be called ov02a10.

+config VIDEO_OV02C10
+ tristate "OmniVision OV02C10 sensor support"
+ help
+ This is a Video4Linux2 sensor driver for the OmniVision
+ OV02C10 camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ov02c10.
+
+config VIDEO_OV02E10
+ tristate "OmniVision OV02E10 sensor support"
+ help
+ This is a Video4Linux2 sensor driver for the OmniVision
+ ov02e10 camera.
+
+config VIDEO_OV05C10
+ tristate "OmniVision OV05C10 sensor support"
+ depends on ACPI || COMPILE_TEST
+ select V4L2_CCI_I2C
+ help
+ This is a Video4Linux2 sensor driver for the OmniVision
+ OV05C10 camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ov05c10.
+
+config VIDEO_OV08A10
+ tristate "OmniVision OV08A10 sensor support"
+ help
+ This is a Video4Linux2 sensor driver for the OmniVision
+ OV08A10 camera sensor.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ov08a10.
+
config VIDEO_OV08D10
tristate "OmniVision OV08D10 sensor support"
help
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index dfbe6448b549..2c1765d5650c 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -42,6 +42,9 @@ obj-$(CONFIG_VIDEO_GC2145) += gc2145.o
obj-$(CONFIG_VIDEO_HI556) += hi556.o
obj-$(CONFIG_VIDEO_HI846) += hi846.o
obj-$(CONFIG_VIDEO_HI847) += hi847.o
+obj-$(CONFIG_VIDEO_HM11B1) += hm11b1.o
+obj-$(CONFIG_VIDEO_HM2170) += hm2170.o
+obj-$(CONFIG_VIDEO_HM2172) += hm2172.o
obj-$(CONFIG_VIDEO_I2C) += video-i2c.o
obj-$(CONFIG_VIDEO_IMX208) += imx208.o
obj-$(CONFIG_VIDEO_IMX214) += imx214.o
@@ -76,7 +79,12 @@ obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
obj-$(CONFIG_VIDEO_MT9V111) += mt9v111.o
obj-$(CONFIG_VIDEO_OG01A1B) += og01a1b.o
obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o
+obj-$(CONFIG_VIDEO_OV01A1S) += ov01a1s.o
obj-$(CONFIG_VIDEO_OV02A10) += ov02a10.o
+obj-$(CONFIG_VIDEO_OV02C10) += ov02c10.o
+obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.o
+obj-$(CONFIG_VIDEO_OV05C10) += ov05c10.o
+obj-$(CONFIG_VIDEO_OV08A10) += ov08a10.o
obj-$(CONFIG_VIDEO_OV08D10) += ov08d10.o
obj-$(CONFIG_VIDEO_OV08X40) += ov08x40.o
obj-$(CONFIG_VIDEO_OV13858) += ov13858.o
--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From cde3265769fe1ad857137367dea4ec16fcb80548 Mon Sep 17 00:00:00 2001
From: Dongcheng Yan <[email protected]>
Date: Tue, 30 Jul 2024 11:03:10 +0800
Subject: [PATCH 3/5] media: ipu6: Use module parameter to set isys/psys freq

Signed-off-by: Hongju Wang <[email protected]>
Signed-off-by: Dongcheng Yan <[email protected]>
---
drivers/media/pci/intel/ipu6/ipu6.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c
index bbd646378ab3..5a683dbdf03a 100644
--- a/drivers/media/pci/intel/ipu6/ipu6.c
+++ b/drivers/media/pci/intel/ipu6/ipu6.c
@@ -33,6 +33,14 @@
#include "ipu6-platform-isys-csi2-reg.h"
#include "ipu6-platform-regs.h"

+static unsigned int isys_freq_override;
+module_param(isys_freq_override, uint, 0660);
+MODULE_PARM_DESC(isys_freq_override, "Override ISYS freq(mhz)");
+
+static unsigned int psys_freq_override;
+module_param(psys_freq_override, uint, 0660);
+MODULE_PARM_DESC(psys_freq_override, "Override PSYS freq(mhz)");
+
#define IPU6_PCI_BAR 0

struct ipu6_cell_program {
@@ -387,6 +395,14 @@ ipu6_isys_init(struct pci_dev *pdev, struct device *parent,
pdata->base = base;
pdata->ipdata = ipdata;

+ /* Override the isys freq */
+ if (isys_freq_override >= BUTTRESS_MIN_FORCE_IS_FREQ &&
+ isys_freq_override <= BUTTRESS_MAX_FORCE_IS_FREQ) {
+ ctrl->ratio = isys_freq_override / BUTTRESS_IS_FREQ_STEP;
+ dev_dbg(&pdev->dev, "Override the isys freq:%u(mhz)\n",
+ isys_freq_override);
+ }
+
isys_adev = ipu6_bus_initialize_device(pdev, parent, pdata, ctrl,
IPU6_ISYS_NAME);
if (IS_ERR(isys_adev)) {
@@ -433,6 +449,15 @@ ipu6_psys_init(struct pci_dev *pdev, struct device *parent,
pdata->base = base;
pdata->ipdata = ipdata;

+ /* Override the psys freq */
+ if (psys_freq_override >= BUTTRESS_MIN_FORCE_PS_FREQ &&
+ psys_freq_override <= BUTTRESS_MAX_FORCE_PS_FREQ) {
+ ctrl->ratio = psys_freq_override / BUTTRESS_PS_FREQ_STEP;
+ ctrl->qos_floor = psys_freq_override;
+ dev_dbg(&pdev->dev, "Override the psys freq:%u(mhz)\n",
+ psys_freq_override);
+ }
+
psys_adev = ipu6_bus_initialize_device(pdev, parent, pdata, ctrl,
IPU6_PSYS_NAME);
if (IS_ERR(psys_adev)) {
--
2.43.0

Loading

0 comments on commit 1d6a19a

Please sign in to comment.