Skip to content

Commit 6b2a374

Browse files
lixuzhaJiri Kosina
authored andcommitted
HID: intel-ish-hid: Add driver_data for specifying the firmware filename
Introduces a new structure, ishtp_driver_data, to hold driver-specific data, including the firmware filename for different hardware variants of the Intel Integrated Sensor Hub (ISH). Signed-off-by: Zhang Lixu <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent f7ae309 commit 6b2a374

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

drivers/hid/intel-ish-hid/ipc/pci-ish.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@
2323
#include "ishtp-dev.h"
2424
#include "hw-ish.h"
2525

26+
enum ishtp_driver_data_index {
27+
ISHTP_DRIVER_DATA_NONE,
28+
ISHTP_DRIVER_DATA_LNL_M,
29+
};
30+
31+
#define ISH_FW_FILENAME_LNL_M "intel/ish/ish_lnlm.bin"
32+
33+
static struct ishtp_driver_data ishtp_driver_data[] = {
34+
[ISHTP_DRIVER_DATA_LNL_M] = {
35+
.fw_filename = ISH_FW_FILENAME_LNL_M,
36+
},
37+
};
38+
2639
static const struct pci_device_id ish_pci_tbl[] = {
2740
{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_CHV)},
2841
{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_BXT_Ax)},
@@ -46,7 +59,7 @@ static const struct pci_device_id ish_pci_tbl[] = {
4659
{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_MTL_P)},
4760
{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_H)},
4861
{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_S)},
49-
{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_LNL_M)},
62+
{PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_LNL_M), .driver_data = ISHTP_DRIVER_DATA_LNL_M},
5063
{}
5164
};
5265
MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
@@ -167,6 +180,7 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
167180
}
168181
hw = to_ish_hw(ishtp);
169182
ishtp->print_log = ish_event_tracer;
183+
ishtp->driver_data = &ishtp_driver_data[ent->driver_data];
170184

171185
/* mapping IO device memory */
172186
hw->mem_addr = pcim_iomap_table(pdev)[0];
@@ -377,3 +391,5 @@ MODULE_AUTHOR("Srinivas Pandruvada <[email protected]>");
377391

378392
MODULE_DESCRIPTION("Intel(R) Integrated Sensor Hub PCI Device Driver");
379393
MODULE_LICENSE("GPL");
394+
395+
MODULE_FIRMWARE(ISH_FW_FILENAME_LNL_M);

drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,29 @@ struct ishtp_hw_ops {
122122
bool (*dma_no_cache_snooping)(struct ishtp_device *dev);
123123
};
124124

125+
/**
126+
* struct ishtp_driver_data - Driver-specific data for ISHTP devices
127+
*
128+
* This structure holds driver-specific data that can be associated with each
129+
* ISHTP device instance. It allows for the storage of data that is unique to
130+
* a particular driver or hardware variant.
131+
*
132+
* @fw_filename: The firmware filename associated with a specific hardware
133+
* variant of the Intel Integrated Sensor Hub (ISH). This allows
134+
* the driver to load the correct firmware based on the device's
135+
* hardware variant.
136+
*/
137+
struct ishtp_driver_data {
138+
char *fw_filename;
139+
};
140+
125141
/**
126142
* struct ishtp_device - ISHTP private device struct
127143
*/
128144
struct ishtp_device {
129145
struct device *devc; /* pointer to lowest device */
130146
struct pci_dev *pdev; /* PCI device to get device ids */
147+
struct ishtp_driver_data *driver_data; /* pointer to driver-specific data */
131148

132149
/* waitq for waiting for suspend response */
133150
wait_queue_head_t suspend_wait;

0 commit comments

Comments
 (0)