* [PATCH v2 1/2] HID: intel-ish-hid: loader: Add PRODUCT_FAMILY-based firmware matching
@ 2025-12-22 7:53 Vishnu Sankar
2025-12-22 7:53 ` [PATCH v2 2/2] Documentation: hid: intel-ish-hid: Document PRODUCT_FAMILY " Vishnu Sankar
0 siblings, 1 reply; 2+ messages in thread
From: Vishnu Sankar @ 2025-12-22 7:53 UTC (permalink / raw)
To: srinivas.pandruvada, jikos, bentiss, corbet, vsankar
Cc: linux-doc, linux-input, linux-kernel, Vishnu Sankar,
Mark Pearson, Richie Roy Jayme
Add support for firmware filenames that include the CRC32 checksum of the
DMI product_family field. Several OEMs ship ISH firmware variants shared
across a product family while product_name or product_sku may differ. This
intermediate matching granularity reduces duplication and improves firmware
selection for vendor-customized platforms.
The newly supported filename forms are checked before existing patterns:
ish_${gen}_${vendor}_${family}_${name}_${sku}.bin
ish_${gen}_${vendor}_${family}_${sku}.bin
ish_${gen}_${vendor}_${family}_${name}.bin
ish_${gen}_${vendor}_${family}.bin
The legacy product_name/product_sku rules remain unchanged and continue
to provide fallback matching.
ISH_FW_FILENAME_LEN_MAX is changed to 72 to accommodate the product_family.
Tested with X9 series and X1 series.
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Richie Roy Jayme <rjayme.jp@gmail.com>
Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
---
Changes in v2
- Indent corrected
- More comments added
---
---
drivers/hid/intel-ish-hid/ishtp/loader.c | 59 +++++++++++++++++++++++-
1 file changed, 57 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/intel-ish-hid/ishtp/loader.c b/drivers/hid/intel-ish-hid/ishtp/loader.c
index f34086b29cf0..5a7e7491f242 100644
--- a/drivers/hid/intel-ish-hid/ishtp/loader.c
+++ b/drivers/hid/intel-ish-hid/ishtp/loader.c
@@ -195,13 +195,20 @@ static int prepare_dma_bufs(struct ishtp_device *dev,
return 0;
}
+/* Patterns with PRODUCT_FAMILY */
+#define ISH_FW_FILE_VENDOR_FAMILY_NAME_SKU_FMT "intel/ish/ish_%s_%08x_%08x_%08x_%08x.bin"
+#define ISH_FW_FILE_VENDOR_FAMILY_SKU_FMT "intel/ish/ish_%s_%08x_%08x_%08x.bin"
+#define ISH_FW_FILE_VENDOR_FAMILY_NAME_FMT "intel/ish/ish_%s_%08x_%08x_%08x.bin"
+#define ISH_FW_FILE_VENDOR_FAMILY_FMT "intel/ish/ish_%s_%08x_%08x.bin"
+
#define ISH_FW_FILE_VENDOR_NAME_SKU_FMT "intel/ish/ish_%s_%08x_%08x_%08x.bin"
+#define ISH_FW_FILE_VENDOR_FAMILY_FMT "intel/ish/ish_%s_%08x_%08x.bin"
#define ISH_FW_FILE_VENDOR_SKU_FMT "intel/ish/ish_%s_%08x_%08x.bin"
#define ISH_FW_FILE_VENDOR_NAME_FMT "intel/ish/ish_%s_%08x_%08x.bin"
#define ISH_FW_FILE_VENDOR_FMT "intel/ish/ish_%s_%08x.bin"
#define ISH_FW_FILE_DEFAULT_FMT "intel/ish/ish_%s.bin"
-#define ISH_FW_FILENAME_LEN_MAX 56
+#define ISH_FW_FILENAME_LEN_MAX 72
#define ISH_CRC_INIT (~0u)
#define ISH_CRC_XOROUT (~0u)
@@ -228,6 +235,12 @@ static int _request_ish_firmware(const struct firmware **firmware_p,
* for the given device in the following order, prioritizing custom firmware
* with more precise matching patterns:
*
+ * ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32)
+ * _$(PRODUCT_NAME_CRC32)_${PRODUCT_SKU_CRC32}.bin
+ *
+ * ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32)_${PRODUCT_SKU_CRC32}.bin
+ * ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32)_$(PRODUCT_NAME_CRC32).bin
+ * ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32).bin
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_NAME_CRC32)_${PRODUCT_SKU_CRC32}.bin
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_NAME_CRC32).bin
@@ -256,8 +269,9 @@ static int request_ish_firmware(const struct firmware **firmware_p,
struct device *dev)
{
const char *gen, *sys_vendor, *product_name, *product_sku;
+ const char *product_family;
struct ishtp_device *ishtp = dev_get_drvdata(dev);
- u32 vendor_crc, name_crc, sku_crc;
+ u32 vendor_crc, name_crc, sku_crc, family_crc;
char filename[ISH_FW_FILENAME_LEN_MAX];
int ret;
@@ -265,14 +279,55 @@ static int request_ish_firmware(const struct firmware **firmware_p,
sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
product_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
+ product_family = dmi_get_system_info(DMI_PRODUCT_FAMILY);
if (sys_vendor)
vendor_crc = crc32(ISH_CRC_INIT, sys_vendor, strlen(sys_vendor)) ^ ISH_CRC_XOROUT;
+ if (product_family)
+ family_crc = crc32(ISH_CRC_INIT, product_family,
+ strlen(product_family)) ^ ISH_CRC_XOROUT;
if (product_name)
name_crc = crc32(ISH_CRC_INIT, product_name, strlen(product_name)) ^ ISH_CRC_XOROUT;
if (product_sku)
sku_crc = crc32(ISH_CRC_INIT, product_sku, strlen(product_sku)) ^ ISH_CRC_XOROUT;
+ /* PRODUCT_FAMILY-extended matching */
+ if (sys_vendor && product_family && product_name && product_sku) {
+ snprintf(filename, sizeof(filename),
+ ISH_FW_FILE_VENDOR_FAMILY_NAME_SKU_FMT,
+ gen, vendor_crc, family_crc, name_crc, sku_crc);
+ ret = _request_ish_firmware(firmware_p, filename, dev);
+ if (!ret)
+ return 0;
+ }
+
+ if (sys_vendor && product_family && product_sku) {
+ snprintf(filename, sizeof(filename),
+ ISH_FW_FILE_VENDOR_FAMILY_SKU_FMT,
+ gen, vendor_crc, family_crc, sku_crc);
+ ret = _request_ish_firmware(firmware_p, filename, dev);
+ if (!ret)
+ return 0;
+ }
+
+ if (sys_vendor && product_family && product_name) {
+ snprintf(filename, sizeof(filename),
+ ISH_FW_FILE_VENDOR_FAMILY_NAME_FMT,
+ gen, vendor_crc, family_crc, name_crc);
+ ret = _request_ish_firmware(firmware_p, filename, dev);
+ if (!ret)
+ return 0;
+ }
+
+ if (sys_vendor && product_family) {
+ snprintf(filename, sizeof(filename),
+ ISH_FW_FILE_VENDOR_FAMILY_FMT,
+ gen, vendor_crc, family_crc);
+ ret = _request_ish_firmware(firmware_p, filename, dev);
+ if (!ret)
+ return 0;
+}
+
if (sys_vendor && product_name && product_sku) {
snprintf(filename, sizeof(filename), ISH_FW_FILE_VENDOR_NAME_SKU_FMT, gen,
vendor_crc, name_crc, sku_crc);
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 2/2] Documentation: hid: intel-ish-hid: Document PRODUCT_FAMILY firmware matching
2025-12-22 7:53 [PATCH v2 1/2] HID: intel-ish-hid: loader: Add PRODUCT_FAMILY-based firmware matching Vishnu Sankar
@ 2025-12-22 7:53 ` Vishnu Sankar
0 siblings, 0 replies; 2+ messages in thread
From: Vishnu Sankar @ 2025-12-22 7:53 UTC (permalink / raw)
To: srinivas.pandruvada, jikos, bentiss, corbet, vsankar
Cc: linux-doc, linux-input, linux-kernel, Vishnu Sankar
Document the ISH firmware filename matching rules, including the
new PRODUCT_FAMILY-based patterns and their search order.
This aligns the documentation with the driver behavior and provides
clear guidance for vendors supplying custom ISH firmware.
Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
---
Documentation/hid/intel-ish-hid.rst | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/Documentation/hid/intel-ish-hid.rst b/Documentation/hid/intel-ish-hid.rst
index 2adc174fb576..068a5906b177 100644
--- a/Documentation/hid/intel-ish-hid.rst
+++ b/Documentation/hid/intel-ish-hid.rst
@@ -413,6 +413,10 @@ Vendors who wish to upstream their custom firmware should follow these guideline
- The firmware filename should use one of the following patterns:
+ - ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
+ - ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_SKU_CRC32}.bin``
+ - ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}.bin``
+ - ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}.bin``
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
@@ -420,16 +424,21 @@ Vendors who wish to upstream their custom firmware should follow these guideline
- ``${intel_plat_gen}`` indicates the Intel platform generation (e.g., ``lnlm`` for Lunar Lake) and must not exceed 8 characters in length.
- ``${SYS_VENDOR_CRC32}`` is the CRC32 checksum of the ``sys_vendor`` value from the DMI field ``DMI_SYS_VENDOR``.
+- ``${PRODUCT_FAMILY_CRC32}`` is the CRC32 checksum of the ``product_family`` value from the DMI field ``DMI_PRODUCT_FAMILY``.
- ``${PRODUCT_NAME_CRC32}`` is the CRC32 checksum of the ``product_name`` value from the DMI field ``DMI_PRODUCT_NAME``.
- ``${PRODUCT_SKU_CRC32}`` is the CRC32 checksum of the ``product_sku`` value from the DMI field ``DMI_PRODUCT_SKU``.
During system boot, the ISH Linux driver will attempt to load the firmware in the following order, prioritizing custom firmware with more precise matching patterns:
-1. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
-2. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
-3. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
-4. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin``
-5. ``intel/ish/ish_${intel_plat_gen}.bin``
+1. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
+2. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_SKU_CRC32}.bin``
+3. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}.bin``
+4. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}.bin``
+5. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
+6. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
+7. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
+8. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin``
+9. ``intel/ish/ish_${intel_plat_gen}.bin``
The driver will load the first matching firmware and skip the rest. If no matching firmware is found, it will proceed to the next pattern in the specified order. If all searches fail, the default Intel firmware, listed last in the order above, will be loaded.
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-22 7:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-22 7:53 [PATCH v2 1/2] HID: intel-ish-hid: loader: Add PRODUCT_FAMILY-based firmware matching Vishnu Sankar
2025-12-22 7:53 ` [PATCH v2 2/2] Documentation: hid: intel-ish-hid: Document PRODUCT_FAMILY " Vishnu Sankar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®