Skip to content

Commit 05bc458

Browse files
author
Jiri Kosina
committed
Merge branch 'for-6.20/intel-ish' into for-linus
- support for new firmware handling in intel-ish-hid (Vishnu Sankar)
2 parents 9be2c22 + 698362f commit 05bc458

2 files changed

Lines changed: 70 additions & 7 deletions

File tree

Documentation/hid/intel-ish-hid.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,23 +413,32 @@ Vendors who wish to upstream their custom firmware should follow these guideline
413413

414414
- The firmware filename should use one of the following patterns:
415415

416+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
417+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_SKU_CRC32}.bin``
418+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}.bin``
419+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}.bin``
416420
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
417421
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
418422
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
419423
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin``
420424

421425
- ``${intel_plat_gen}`` indicates the Intel platform generation (e.g., ``lnlm`` for Lunar Lake) and must not exceed 8 characters in length.
422426
- ``${SYS_VENDOR_CRC32}`` is the CRC32 checksum of the ``sys_vendor`` value from the DMI field ``DMI_SYS_VENDOR``.
427+
- ``${PRODUCT_FAMILY_CRC32}`` is the CRC32 checksum of the ``product_family`` value from the DMI field ``DMI_PRODUCT_FAMILY``.
423428
- ``${PRODUCT_NAME_CRC32}`` is the CRC32 checksum of the ``product_name`` value from the DMI field ``DMI_PRODUCT_NAME``.
424429
- ``${PRODUCT_SKU_CRC32}`` is the CRC32 checksum of the ``product_sku`` value from the DMI field ``DMI_PRODUCT_SKU``.
425430

426431
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:
427432

428-
1. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
429-
2. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
430-
3. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
431-
4. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin``
432-
5. ``intel/ish/ish_${intel_plat_gen}.bin``
433+
1. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
434+
2. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_SKU_CRC32}.bin``
435+
3. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}_${PRODUCT_NAME_CRC32}.bin``
436+
4. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_FAMILY_CRC32}.bin``
437+
5. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
438+
6. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
439+
7. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
440+
8. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin``
441+
9. ``intel/ish/ish_${intel_plat_gen}.bin``
433442

434443
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.
435444

drivers/hid/intel-ish-hid/ishtp/loader.c

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,19 @@ static int prepare_dma_bufs(struct ishtp_device *dev,
195195
return 0;
196196
}
197197

198+
/* Patterns with PRODUCT_FAMILY */
199+
#define ISH_FW_FILE_VENDOR_FAMILY_NAME_SKU_FMT "intel/ish/ish_%s_%08x_%08x_%08x_%08x.bin"
200+
#define ISH_FW_FILE_VENDOR_FAMILY_SKU_FMT "intel/ish/ish_%s_%08x_%08x_%08x.bin"
201+
#define ISH_FW_FILE_VENDOR_FAMILY_NAME_FMT "intel/ish/ish_%s_%08x_%08x_%08x.bin"
202+
#define ISH_FW_FILE_VENDOR_FAMILY_FMT "intel/ish/ish_%s_%08x_%08x.bin"
203+
198204
#define ISH_FW_FILE_VENDOR_NAME_SKU_FMT "intel/ish/ish_%s_%08x_%08x_%08x.bin"
199205
#define ISH_FW_FILE_VENDOR_SKU_FMT "intel/ish/ish_%s_%08x_%08x.bin"
200206
#define ISH_FW_FILE_VENDOR_NAME_FMT "intel/ish/ish_%s_%08x_%08x.bin"
201207
#define ISH_FW_FILE_VENDOR_FMT "intel/ish/ish_%s_%08x.bin"
202208
#define ISH_FW_FILE_DEFAULT_FMT "intel/ish/ish_%s.bin"
203209

204-
#define ISH_FW_FILENAME_LEN_MAX 56
210+
#define ISH_FW_FILENAME_LEN_MAX 72
205211

206212
#define ISH_CRC_INIT (~0u)
207213
#define ISH_CRC_XOROUT (~0u)
@@ -228,6 +234,12 @@ static int _request_ish_firmware(const struct firmware **firmware_p,
228234
* for the given device in the following order, prioritizing custom firmware
229235
* with more precise matching patterns:
230236
*
237+
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32)
238+
* _$(PRODUCT_NAME_CRC32)_${PRODUCT_SKU_CRC32}.bin
239+
*
240+
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32)_${PRODUCT_SKU_CRC32}.bin
241+
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32)_$(PRODUCT_NAME_CRC32).bin
242+
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_FAMILY_CRC32).bin
231243
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_NAME_CRC32)_${PRODUCT_SKU_CRC32}.bin
232244
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin
233245
* ish_${fw_generation}_${SYS_VENDOR_CRC32}_$(PRODUCT_NAME_CRC32).bin
@@ -256,23 +268,65 @@ static int request_ish_firmware(const struct firmware **firmware_p,
256268
struct device *dev)
257269
{
258270
const char *gen, *sys_vendor, *product_name, *product_sku;
271+
const char *product_family;
259272
struct ishtp_device *ishtp = dev_get_drvdata(dev);
260-
u32 vendor_crc, name_crc, sku_crc;
273+
u32 vendor_crc, name_crc, sku_crc, family_crc;
261274
char filename[ISH_FW_FILENAME_LEN_MAX];
262275
int ret;
263276

264277
gen = ishtp->driver_data->fw_generation;
265278
sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
266279
product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
267280
product_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
281+
product_family = dmi_get_system_info(DMI_PRODUCT_FAMILY);
268282

269283
if (sys_vendor)
270284
vendor_crc = crc32(ISH_CRC_INIT, sys_vendor, strlen(sys_vendor)) ^ ISH_CRC_XOROUT;
285+
if (product_family)
286+
family_crc = crc32(ISH_CRC_INIT, product_family,
287+
strlen(product_family)) ^ ISH_CRC_XOROUT;
271288
if (product_name)
272289
name_crc = crc32(ISH_CRC_INIT, product_name, strlen(product_name)) ^ ISH_CRC_XOROUT;
273290
if (product_sku)
274291
sku_crc = crc32(ISH_CRC_INIT, product_sku, strlen(product_sku)) ^ ISH_CRC_XOROUT;
275292

293+
/* PRODUCT_FAMILY-extended matching */
294+
if (sys_vendor && product_family && product_name && product_sku) {
295+
snprintf(filename, sizeof(filename),
296+
ISH_FW_FILE_VENDOR_FAMILY_NAME_SKU_FMT,
297+
gen, vendor_crc, family_crc, name_crc, sku_crc);
298+
ret = _request_ish_firmware(firmware_p, filename, dev);
299+
if (!ret)
300+
return 0;
301+
}
302+
303+
if (sys_vendor && product_family && product_sku) {
304+
snprintf(filename, sizeof(filename),
305+
ISH_FW_FILE_VENDOR_FAMILY_SKU_FMT,
306+
gen, vendor_crc, family_crc, sku_crc);
307+
ret = _request_ish_firmware(firmware_p, filename, dev);
308+
if (!ret)
309+
return 0;
310+
}
311+
312+
if (sys_vendor && product_family && product_name) {
313+
snprintf(filename, sizeof(filename),
314+
ISH_FW_FILE_VENDOR_FAMILY_NAME_FMT,
315+
gen, vendor_crc, family_crc, name_crc);
316+
ret = _request_ish_firmware(firmware_p, filename, dev);
317+
if (!ret)
318+
return 0;
319+
}
320+
321+
if (sys_vendor && product_family) {
322+
snprintf(filename, sizeof(filename),
323+
ISH_FW_FILE_VENDOR_FAMILY_FMT,
324+
gen, vendor_crc, family_crc);
325+
ret = _request_ish_firmware(firmware_p, filename, dev);
326+
if (!ret)
327+
return 0;
328+
}
329+
276330
if (sys_vendor && product_name && product_sku) {
277331
snprintf(filename, sizeof(filename), ISH_FW_FILE_VENDOR_NAME_SKU_FMT, gen,
278332
vendor_crc, name_crc, sku_crc);

0 commit comments

Comments
 (0)