diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/changelog ivsc-driver-0~git202212210258.94ecb88b/debian/changelog --- ivsc-driver-0~git202212210258.94ecb88b/debian/changelog 2023-07-12 16:17:37.000000000 +0800 +++ ivsc-driver-0~git202212210258.94ecb88b/debian/changelog 2023-08-23 00:11:46.000000000 +0800 @@ -1,3 +1,14 @@ +ivsc-driver (0~git202212210258.94ecb88b-0ubuntu0.23.10.3~ppa.2) mantic; urgency=low + + [ You-Sheng Yang ] + * Support mipi camera on Intel Meteor Lake platform (LP: #2031412) + - ljca: try to find acpi device from hub device + - mei-vsc: port mei api change in v6.2 + - mfd: ljca: Fix try_match_acpi_hid return value checking + - misc: spi-vsc: Fix cvfd_ids array with terminator + + -- You-Sheng Yang Wed, 23 Aug 2023 00:11:46 +0800 + ivsc-driver (0~git202212210258.94ecb88b-0ubuntu0.23.10.2) mantic; urgency=low [ You-Sheng Yang ] diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch 1970-01-01 08:00:00.000000000 +0800 +++ ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0004-ljca-try-to-find-acpi-device-from-hub-device.patch 2023-08-23 00:11:46.000000000 +0800 @@ -0,0 +1,192 @@ +From: Ye Xiang +Date: Wed, 22 Mar 2023 02:24:26 +0800 +Subject: ljca: try to find acpi device from hub device + +BugLink: https://bugs.launchpad.net/bugs/2031412 + +On MTL platforms, the parent for LJCA sub-devices changes from the USB +device to it's parent (RHUB). This patch makes the acpi binding of LJCA +sub-devices compatible on MTL platforms. + +Signed-off-by: Ye Xiang +(cherry picked from commit e1bb9fc0b4777265ab65ece21a8c634d1478666f) +Signed-off-by: You-Sheng Yang +--- + drivers/mfd/ljca.c | 96 ++++++++++++++++++++++++++++++++++++++---------------- + 1 file changed, 68 insertions(+), 28 deletions(-) + +diff --git a/drivers/mfd/ljca.c b/drivers/mfd/ljca.c +index f4d1448..e47be7c 100644 +--- a/drivers/mfd/ljca.c ++++ b/drivers/mfd/ljca.c +@@ -211,55 +211,94 @@ struct ljca_dev { + struct mutex mutex; + }; + +-static int try_match_acpi_hid(struct acpi_device *child, +- struct mfd_cell_acpi_match *match, char **hids, +- int hids_num) ++/* parent of sub-devices */ ++struct device *sub_dev_parent; ++struct device *cur_dev; ++ ++static int try_match_acpi_hid(struct acpi_device *child, char **hids, int hids_num) + { + struct acpi_device_id ids[2] = {}; + int i; + + for (i = 0; i < hids_num; i++) { + strlcpy(ids[0].id, hids[i], sizeof(ids[0].id)); +- if (!acpi_match_device_ids(child, ids)) { +- match->pnpid = hids[i]; +- break; +- } ++ if (!acpi_match_device_ids(child, ids)) ++ return i; + } + +- return 0; ++ return -ENODEV; + } + + static int match_device_ids(struct acpi_device *adev, void *data) + { +- (void)data; +- try_match_acpi_hid(adev, &ljca_acpi_match_gpio, gpio_hids, +- ARRAY_SIZE(gpio_hids)); +- try_match_acpi_hid(adev, &ljca_acpi_match_i2cs[0], i2c_hids, +- ARRAY_SIZE(i2c_hids)); +- try_match_acpi_hid(adev, &ljca_acpi_match_i2cs[1], i2c_hids, +- ARRAY_SIZE(i2c_hids)); +- try_match_acpi_hid(adev, &ljca_acpi_match_spis[0], spi_hids, +- ARRAY_SIZE(spi_hids)); ++ int ret; ++ int *child_count = data; ++ ++ dev_dbg(&adev->dev, "adev->dep_unmet %d %d\n", adev->dep_unmet, *child_count); ++ ++ /* dependency not ready */ ++ if (adev->dep_unmet) ++ return -ENODEV; ++ ++ ret = try_match_acpi_hid(adev, gpio_hids, ARRAY_SIZE(gpio_hids)); ++ if (ret > 0) { ++ ljca_acpi_match_gpio.pnpid = gpio_hids[ret]; ++ (*child_count)++; ++ } ++ ++ ret = try_match_acpi_hid(adev, i2c_hids, ARRAY_SIZE(i2c_hids)); ++ if (ret > 0) { ++ ljca_acpi_match_i2cs[0].pnpid = i2c_hids[ret]; ++ ljca_acpi_match_i2cs[1].pnpid = i2c_hids[ret]; ++ (*child_count)++; ++ } ++ ++ ret = try_match_acpi_hid(adev, spi_hids, ARRAY_SIZE(spi_hids)); ++ if (ret > 0) { ++ ljca_acpi_match_spis[0].pnpid = spi_hids[ret]; ++ (*child_count)++; ++ } + + return 0; + } + + static int precheck_acpi_hid(struct usb_interface *intf) + { +- struct acpi_device *parent; ++ struct device *parents[2]; ++ int i; ++ int child_count; + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) + struct acpi_device *child; + #endif + +- parent = ACPI_COMPANION(&intf->dev); +- if (!parent) ++ parents[0] = &intf->dev; ++ parents[1] = intf->dev.parent->parent; ++ if (!parents[0] || !parents[1]) + return -ENODEV; + ++ acpi_dev_clear_dependencies(ACPI_COMPANION(parents[0])); ++ sub_dev_parent = parents[0]; ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +- acpi_dev_for_each_child(parent, match_device_ids, NULL); ++ for (i = 0; i < ARRAY_SIZE(parents); i++) { ++ child_count = 0; ++ acpi_dev_for_each_child(ACPI_COMPANION(parents[i]), match_device_ids, &child_count); ++ if (child_count > 0) { ++ sub_dev_parent = parents[i]; ++ break; ++ } ++ } + #else +- list_for_each_entry (child, &parent->children, node) { +- match_device_ids(child, NULL); ++ for (i = 0; i < ARRAY_SIZE(parents); i++) { ++ child_count = 0; ++ list_for_each_entry(child, &(ACPI_COMPANION(parents[i])->children), node) { ++ match_device_ids(child, &child_count); ++ } ++ ++ if (child_count > 0) { ++ sub_dev_parent = parents[i]; ++ break; ++ } + } + #endif + +@@ -443,7 +482,7 @@ static int ljca_transfer_internal(struct platform_device *pdev, u8 cmd, + if (!pdev) + return -EINVAL; + +- ljca = dev_get_drvdata(pdev->dev.parent); ++ ljca = dev_get_drvdata(cur_dev); + ljca_pdata = dev_get_platdata(&pdev->dev); + stub = ljca_stub_find(ljca, ljca_pdata->type); + if (IS_ERR(stub)) +@@ -480,7 +519,7 @@ int ljca_register_event_cb(struct platform_device *pdev, + if (!pdev) + return -EINVAL; + +- ljca = dev_get_drvdata(pdev->dev.parent); ++ ljca = dev_get_drvdata(cur_dev); + ljca_pdata = dev_get_platdata(&pdev->dev); + stub = ljca_stub_find(ljca, ljca_pdata->type); + if (IS_ERR(stub)) +@@ -502,7 +541,7 @@ void ljca_unregister_event_cb(struct platform_device *pdev) + struct ljca_stub *stub; + unsigned long flags; + +- ljca = dev_get_drvdata(pdev->dev.parent); ++ ljca = dev_get_drvdata(cur_dev); + ljca_pdata = dev_get_platdata(&pdev->dev); + stub = ljca_stub_find(ljca, ljca_pdata->type); + if (IS_ERR(stub)) +@@ -1068,6 +1107,7 @@ static int ljca_probe(struct usb_interface *intf, + struct usb_endpoint_descriptor *bulk_in, *bulk_out; + int ret; + ++ cur_dev = &intf->dev; + ret = precheck_acpi_hid(intf); + if (ret) + return ret; +@@ -1128,7 +1168,7 @@ static int ljca_probe(struct usb_interface *intf, + goto error_stop; + } + +- ret = mfd_add_hotplug_devices(&intf->dev, ljca->cells, ++ ret = mfd_add_hotplug_devices(sub_dev_parent, ljca->cells, + ljca->cell_count); + if (ret) { + dev_err(&intf->dev, "failed to add mfd devices to core %d\n", +@@ -1157,7 +1197,7 @@ static void ljca_disconnect(struct usb_interface *intf) + + ljca_stop(ljca); + ljca->state = LJCA_STOPPED; +- mfd_remove_devices(&intf->dev); ++ mfd_remove_devices(sub_dev_parent); + ljca_stub_cleanup(ljca); + usb_set_intfdata(intf, NULL); + ljca_delete(ljca); diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch 1970-01-01 08:00:00.000000000 +0800 +++ ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0005-mei-vsc-port-mei-api-change-in-v6.2.patch 2023-08-23 00:11:46.000000000 +0800 @@ -0,0 +1,199 @@ +From: Ye Xiang +Date: Tue, 28 Mar 2023 21:38:40 +0800 +Subject: mei-vsc: port mei api change in v6.2 + +BugLink: https://bugs.launchpad.net/bugs/2031412 + +Since MEI API has been changed in mainline kernel in v6.2, +this patch port the API change in two mainline patchs. + +1. mei: add support to GSC extended header +2. mei: Move uuid_le_cmp() to its only user + +Signed-off-by: Ye Xiang +(cherry picked from commit cce4377f1539f3e7e8d8b45fbe23e87828ed1deb) +Signed-off-by: You-Sheng Yang +--- + backport-include/drivers/misc/mei/hw.h | 84 +++++++++++++++++++++++++++++ + backport-include/drivers/misc/mei/mei_dev.h | 17 ++++++ + 2 files changed, 101 insertions(+) + +diff --git a/backport-include/drivers/misc/mei/hw.h b/backport-include/drivers/misc/mei/hw.h +index 377cf47..59f23b8 100644 +--- a/backport-include/drivers/misc/mei/hw.h ++++ b/backport-include/drivers/misc/mei/hw.h +@@ -95,6 +95,14 @@ + #define HBM_MINOR_VERSION_VT 2 + #define HBM_MAJOR_VERSION_VT 2 + ++#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) ++/* ++ * MEI version with GSC support ++ */ ++#define HBM_MINOR_VERSION_GSC 2 ++#define HBM_MAJOR_VERSION_GSC 2 ++#endif ++ + /* + * MEI version with capabilities message support + */ +@@ -236,6 +244,7 @@ enum mei_cl_disconnect_status { + enum mei_ext_hdr_type { + MEI_EXT_HDR_NONE = 0, + MEI_EXT_HDR_VTAG = 1, ++ MEI_EXT_HDR_GSC = 2, + }; + + /** +@@ -331,6 +340,62 @@ static inline bool mei_ext_last(struct mei_ext_meta_hdr *meta, + return (u8 *)ext >= (u8 *)meta + sizeof(*meta) + (meta->size * 4); + } + ++#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) ++struct mei_gsc_sgl { ++ u32 low; ++ u32 high; ++ u32 length; ++} __packed; ++ ++#define GSC_HECI_MSG_KERNEL 0 ++#define GSC_HECI_MSG_USER 1 ++ ++#define GSC_ADDRESS_TYPE_GTT 0 ++#define GSC_ADDRESS_TYPE_PPGTT 1 ++#define GSC_ADDRESS_TYPE_PHYSICAL_CONTINUOUS 2 /* max of 64K */ ++#define GSC_ADDRESS_TYPE_PHYSICAL_SGL 3 ++ ++/** ++ * struct mei_ext_hdr_gsc_h2f - extended header: gsc host to firmware interface ++ * ++ * @hdr: extended header ++ * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER ++ * @addr_type: GSC_ADDRESS_TYPE_{GTT, PPGTT, PHYSICAL_CONTINUOUS, PHYSICAL_SGL} ++ * @fence_id: synchronization marker ++ * @input_address_count: number of input sgl buffers ++ * @output_address_count: number of output sgl buffers ++ * @reserved: reserved ++ * @sgl: sg list ++ */ ++struct mei_ext_hdr_gsc_h2f { ++ struct mei_ext_hdr hdr; ++ u8 client_id; ++ u8 addr_type; ++ u32 fence_id; ++ u8 input_address_count; ++ u8 output_address_count; ++ u8 reserved[2]; ++ struct mei_gsc_sgl sgl[]; ++} __packed; ++ ++/** ++ * struct mei_ext_hdr_gsc_f2h - gsc firmware to host interface ++ * ++ * @hdr: extended header ++ * @client_id: GSC_HECI_MSG_KERNEL or GSC_HECI_MSG_USER ++ * @reserved: reserved ++ * @fence_id: synchronization marker ++ * @written: number of bytes written to firmware ++ */ ++struct mei_ext_hdr_gsc_f2h { ++ struct mei_ext_hdr hdr; ++ u8 client_id; ++ u8 reserved; ++ u32 fence_id; ++ u32 written; ++} __packed; ++#endif ++ + /** + * mei_ext_next - following extended header on the TLV list + * +@@ -350,6 +415,23 @@ static inline struct mei_ext_hdr *mei_ext_next(struct mei_ext_hdr *ext) + #endif + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) ++/** ++ * mei_ext_hdr_len - get ext header length in bytes ++ * ++ * @ext: extend header ++ * ++ * Return: extend header length in bytes ++ */ ++static inline u32 mei_ext_hdr_len(const struct mei_ext_hdr *ext) ++{ ++ if (!ext) ++ return 0; ++ ++ return ext->length * sizeof(u32); ++} ++#endif ++ + /** + * struct mei_msg_hdr - MEI BUS Interface Section + * +@@ -712,6 +794,8 @@ struct hbm_dma_ring_ctrl { + + /* virtual tag supported */ + #define HBM_CAP_VT BIT(0) ++/* gsc extended header support */ ++#define HBM_CAP_GSC BIT(1) + /* client dma supported */ + #define HBM_CAP_CD BIT(2) + +diff --git a/backport-include/drivers/misc/mei/mei_dev.h b/backport-include/drivers/misc/mei/mei_dev.h +index 6031ad4..3a90404 100644 +--- a/backport-include/drivers/misc/mei/mei_dev.h ++++ b/backport-include/drivers/misc/mei/mei_dev.h +@@ -14,6 +14,13 @@ + #include + #include + ++#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 3, 0) ++static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) ++{ ++ return memcmp(&u1, &u2, sizeof(uuid_le)); ++} ++#endif ++ + #include "hw.h" + #include "hbm.h" + +@@ -123,6 +130,8 @@ enum mei_cl_io_mode { + MEI_CL_IO_TX_INTERNAL = BIT(1), + + MEI_CL_IO_RX_NONBLOCK = BIT(2), ++ ++ MEI_CL_IO_SGL = BIT(3), + }; + + /* +@@ -219,6 +228,9 @@ struct mei_cl_cb { + int status; + u32 internal:1; + u32 blocking:1; ++#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) ++ struct mei_ext_hdr *ext_hdr; ++#endif + }; + + /** +@@ -380,6 +392,10 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length, u8 vtag, + ssize_t __mei_cl_send(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag, + unsigned int mode); + #endif ++#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0) ++ssize_t __mei_cl_send_timeout(struct mei_cl *cl, const u8 *buf, size_t length, u8 vtag, ++ unsigned int mode, unsigned long timeout); ++#endif + ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length, u8 *vtag, + unsigned int mode, unsigned long timeout); + bool mei_cl_bus_rx_event(struct mei_cl *cl); +@@ -598,6 +614,7 @@ struct mei_device { + unsigned int hbm_f_vt_supported:1; + unsigned int hbm_f_cap_supported:1; + unsigned int hbm_f_cd_supported:1; ++ unsigned int hbm_f_gsc_supported:1; + + struct mei_fw_version fw_ver[MEI_MAX_FW_VER_BLOCKS]; + diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch 1970-01-01 08:00:00.000000000 +0800 +++ ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch 2023-08-23 00:11:46.000000000 +0800 @@ -0,0 +1,44 @@ +From: Hao Yao +Date: Sat, 7 Oct 2023 17:18:48 +0800 +Subject: mfd: ljca: Fix try_match_acpi_hid return value checking + +Signed-off-by: Hao Yao +(cherry picked from commit 73343516ac36f98d3334f4a1f3ad940a1d7bb537) +Signed-off-by: You-Sheng Yang +--- + drivers/mfd/ljca.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/mfd/ljca.c b/drivers/mfd/ljca.c +index e47be7c..f9ec6f6 100644 +--- a/drivers/mfd/ljca.c ++++ b/drivers/mfd/ljca.c +@@ -241,22 +241,25 @@ static int match_device_ids(struct acpi_device *adev, void *data) + return -ENODEV; + + ret = try_match_acpi_hid(adev, gpio_hids, ARRAY_SIZE(gpio_hids)); +- if (ret > 0) { ++ if (ret >= 0 && ret < ARRAY_SIZE(gpio_hids)) { + ljca_acpi_match_gpio.pnpid = gpio_hids[ret]; + (*child_count)++; ++ return 0; + } + + ret = try_match_acpi_hid(adev, i2c_hids, ARRAY_SIZE(i2c_hids)); +- if (ret > 0) { ++ if (ret >= 0 && ret < ARRAY_SIZE(i2c_hids)) { + ljca_acpi_match_i2cs[0].pnpid = i2c_hids[ret]; + ljca_acpi_match_i2cs[1].pnpid = i2c_hids[ret]; + (*child_count)++; ++ return 0; + } + + ret = try_match_acpi_hid(adev, spi_hids, ARRAY_SIZE(spi_hids)); +- if (ret > 0) { ++ if (ret >= 0 && ret < ARRAY_SIZE(spi_hids)) { + ljca_acpi_match_spis[0].pnpid = spi_hids[ret]; + (*child_count)++; ++ return 0; + } + + return 0; diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch 1970-01-01 08:00:00.000000000 +0800 +++ ivsc-driver-0~git202212210258.94ecb88b/debian/patches/0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch 2023-08-23 00:11:46.000000000 +0800 @@ -0,0 +1,41 @@ +From: Hao Yao +Date: Sun, 8 Oct 2023 14:26:34 +0800 +Subject: misc: spi-vsc: Fix cvfd_ids array with terminator + +Signed-off-by: Hao Yao +(cherry picked from commit e8ea8b825217091fa91c9b3cb68cee4101d416e2) +Signed-off-by: You-Sheng Yang +--- + drivers/misc/mei/spi-vsc.c | 19 ++++++------------- + 1 file changed, 6 insertions(+), 13 deletions(-) + +diff --git a/drivers/misc/mei/spi-vsc.c b/drivers/misc/mei/spi-vsc.c +index e97664e..fb2c310 100644 +--- a/drivers/misc/mei/spi-vsc.c ++++ b/drivers/misc/mei/spi-vsc.c +@@ -32,19 +32,12 @@ static const struct acpi_gpio_mapping mei_vsc_acpi_gpios[] = { + {} + }; + +-static struct acpi_device_id cvfd_ids[] = { +- { +- .id = "INTC1059", +- }, +- { +- .id = "INTC1095", +- }, +- { +- .id = "INTC100A", +- }, +- { +- .id = "INTC10CF", +- }, ++static const struct acpi_device_id cvfd_ids[] = { ++ { "INTC1059", 0 }, ++ { "INTC1095", 0 }, ++ { "INTC100A", 0 }, ++ { "INTC10CF", 0 }, ++ {} + }; + + struct match_ids_walk_data { diff -Nru ivsc-driver-0~git202212210258.94ecb88b/debian/patches/series ivsc-driver-0~git202212210258.94ecb88b/debian/patches/series --- ivsc-driver-0~git202212210258.94ecb88b/debian/patches/series 2023-05-01 22:12:57.000000000 +0800 +++ ivsc-driver-0~git202212210258.94ecb88b/debian/patches/series 2023-08-23 00:11:46.000000000 +0800 @@ -1,3 +1,7 @@ 0001-dkms-use-debian-package-version-as-PACKAGE_VERSION.patch 0002-add-support-for-MTL-board.patch 0003-Add-build-exclusive-rule.patch +0004-ljca-try-to-find-acpi-device-from-hub-device.patch +0005-mei-vsc-port-mei-api-change-in-v6.2.patch +0006-mfd-ljca-Fix-try_match_acpi_hid-return-value-checkin.patch +0007-misc-spi-vsc-Fix-cvfd_ids-array-with-terminator.patch