HID: intel-ish-hid: Use PCI_VDEVICE() and rename device ID macros

Use PCI_VDEVICE() to simplify the device table, and rename these IDs to
follow the pattern PCI_DEVICE_ID_INTEL_*;

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Zhang, Lixu <lixu.zhang@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
Zhang, Lixu 2024-03-06 00:56:37 +00:00 committed by Jiri Kosina
parent 3e78a6c0d3
commit 4156f83163
3 changed files with 58 additions and 58 deletions

View File

@ -13,28 +13,28 @@
#include "hw-ish-regs.h" #include "hw-ish-regs.h"
#include "ishtp-dev.h" #include "ishtp-dev.h"
#define CHV_DEVICE_ID 0x22D8 #define PCI_DEVICE_ID_INTEL_ISH_CHV 0x22D8
#define BXT_Ax_DEVICE_ID 0x0AA2 #define PCI_DEVICE_ID_INTEL_ISH_BXT_Ax 0x0AA2
#define BXT_Bx_DEVICE_ID 0x1AA2 #define PCI_DEVICE_ID_INTEL_ISH_BXT_Bx 0x1AA2
#define APL_Ax_DEVICE_ID 0x5AA2 #define PCI_DEVICE_ID_INTEL_ISH_APL_Ax 0x5AA2
#define SPT_Ax_DEVICE_ID 0x9D35 #define PCI_DEVICE_ID_INTEL_ISH_SPT_Ax 0x9D35
#define CNL_Ax_DEVICE_ID 0x9DFC #define PCI_DEVICE_ID_INTEL_ISH_CNL_Ax 0x9DFC
#define GLK_Ax_DEVICE_ID 0x31A2 #define PCI_DEVICE_ID_INTEL_ISH_GLK_Ax 0x31A2
#define CNL_H_DEVICE_ID 0xA37C #define PCI_DEVICE_ID_INTEL_ISH_CNL_H 0xA37C
#define ICL_MOBILE_DEVICE_ID 0x34FC #define PCI_DEVICE_ID_INTEL_ISH_ICL_MOBILE 0x34FC
#define SPT_H_DEVICE_ID 0xA135 #define PCI_DEVICE_ID_INTEL_ISH_SPT_H 0xA135
#define CML_LP_DEVICE_ID 0x02FC #define PCI_DEVICE_ID_INTEL_ISH_CML_LP 0x02FC
#define CMP_H_DEVICE_ID 0x06FC #define PCI_DEVICE_ID_INTEL_ISH_CMP_H 0x06FC
#define EHL_Ax_DEVICE_ID 0x4BB3 #define PCI_DEVICE_ID_INTEL_ISH_EHL_Ax 0x4BB3
#define TGL_LP_DEVICE_ID 0xA0FC #define PCI_DEVICE_ID_INTEL_ISH_TGL_LP 0xA0FC
#define TGL_H_DEVICE_ID 0x43FC #define PCI_DEVICE_ID_INTEL_ISH_TGL_H 0x43FC
#define ADL_S_DEVICE_ID 0x7AF8 #define PCI_DEVICE_ID_INTEL_ISH_ADL_S 0x7AF8
#define ADL_P_DEVICE_ID 0x51FC #define PCI_DEVICE_ID_INTEL_ISH_ADL_P 0x51FC
#define ADL_N_DEVICE_ID 0x54FC #define PCI_DEVICE_ID_INTEL_ISH_ADL_N 0x54FC
#define RPL_S_DEVICE_ID 0x7A78 #define PCI_DEVICE_ID_INTEL_ISH_RPL_S 0x7A78
#define MTL_P_DEVICE_ID 0x7E45 #define PCI_DEVICE_ID_INTEL_ISH_MTL_P 0x7E45
#define ARL_H_DEVICE_ID 0x7745 #define PCI_DEVICE_ID_INTEL_ISH_ARL_H 0x7745
#define ARL_S_DEVICE_ID 0x7F78 #define PCI_DEVICE_ID_INTEL_ISH_ARL_S 0x7F78
#define REVISION_ID_CHT_A0 0x6 #define REVISION_ID_CHT_A0 0x6
#define REVISION_ID_CHT_Ax_SI 0x0 #define REVISION_ID_CHT_Ax_SI 0x0

View File

@ -78,7 +78,7 @@ static bool check_generated_interrupt(struct ishtp_device *dev)
bool interrupt_generated = true; bool interrupt_generated = true;
uint32_t pisr_val = 0; uint32_t pisr_val = 0;
if (dev->pdev->device == CHV_DEVICE_ID) { if (dev->pdev->device == PCI_DEVICE_ID_INTEL_ISH_CHV) {
pisr_val = ish_reg_read(dev, IPC_REG_PISR_CHV_AB); pisr_val = ish_reg_read(dev, IPC_REG_PISR_CHV_AB);
interrupt_generated = interrupt_generated =
IPC_INT_FROM_ISH_TO_HOST_CHV_AB(pisr_val); IPC_INT_FROM_ISH_TO_HOST_CHV_AB(pisr_val);
@ -117,7 +117,7 @@ static bool ish_is_input_ready(struct ishtp_device *dev)
*/ */
static void set_host_ready(struct ishtp_device *dev) static void set_host_ready(struct ishtp_device *dev)
{ {
if (dev->pdev->device == CHV_DEVICE_ID) { if (dev->pdev->device == PCI_DEVICE_ID_INTEL_ISH_CHV) {
if (dev->pdev->revision == REVISION_ID_CHT_A0 || if (dev->pdev->revision == REVISION_ID_CHT_A0 ||
(dev->pdev->revision & REVISION_ID_SI_MASK) == (dev->pdev->revision & REVISION_ID_SI_MASK) ==
REVISION_ID_CHT_Ax_SI) REVISION_ID_CHT_Ax_SI)
@ -909,11 +909,11 @@ static uint32_t ish_ipc_get_header(struct ishtp_device *dev, int length,
*/ */
static bool _dma_no_cache_snooping(struct ishtp_device *dev) static bool _dma_no_cache_snooping(struct ishtp_device *dev)
{ {
return (dev->pdev->device == EHL_Ax_DEVICE_ID || return (dev->pdev->device == PCI_DEVICE_ID_INTEL_ISH_EHL_Ax ||
dev->pdev->device == TGL_LP_DEVICE_ID || dev->pdev->device == PCI_DEVICE_ID_INTEL_ISH_TGL_LP ||
dev->pdev->device == TGL_H_DEVICE_ID || dev->pdev->device == PCI_DEVICE_ID_INTEL_ISH_TGL_H ||
dev->pdev->device == ADL_S_DEVICE_ID || dev->pdev->device == PCI_DEVICE_ID_INTEL_ISH_ADL_S ||
dev->pdev->device == ADL_P_DEVICE_ID); dev->pdev->device == PCI_DEVICE_ID_INTEL_ISH_ADL_P);
} }
static const struct ishtp_hw_ops ish_hw_ops = { static const struct ishtp_hw_ops ish_hw_ops = {

View File

@ -24,29 +24,29 @@
#include "hw-ish.h" #include "hw-ish.h"
static const struct pci_device_id ish_pci_tbl[] = { static const struct pci_device_id ish_pci_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CHV_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_CHV)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, BXT_Ax_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_BXT_Ax)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, BXT_Bx_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_BXT_Bx)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, APL_Ax_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_APL_Ax)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_Ax_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_SPT_Ax)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_CNL_Ax)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, GLK_Ax_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_GLK_Ax)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_H_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_CNL_H)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ICL_MOBILE_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ICL_MOBILE)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_H_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_SPT_H)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CML_LP_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_CML_LP)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CMP_H_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_CMP_H)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, EHL_Ax_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_EHL_Ax)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_LP_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_TGL_LP)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_H_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_TGL_H)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_S_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ADL_S)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_P_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ADL_P)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_N_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ADL_N)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, RPL_S_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_RPL_S)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MTL_P_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_MTL_P)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ARL_H_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_H)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ARL_S_DEVICE_ID)}, {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_S)},
{0, } {}
}; };
MODULE_DEVICE_TABLE(pci, ish_pci_tbl); MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
@ -105,19 +105,19 @@ static int ish_init(struct ishtp_device *dev)
static const struct pci_device_id ish_invalid_pci_ids[] = { static const struct pci_device_id ish_invalid_pci_ids[] = {
/* Mehlow platform special pci ids */ /* Mehlow platform special pci ids */
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xA309)}, {PCI_VDEVICE(INTEL, 0xA309)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xA30A)}, {PCI_VDEVICE(INTEL, 0xA30A)},
{} {}
}; };
static inline bool ish_should_enter_d0i3(struct pci_dev *pdev) static inline bool ish_should_enter_d0i3(struct pci_dev *pdev)
{ {
return !pm_suspend_via_firmware() || pdev->device == CHV_DEVICE_ID; return !pm_suspend_via_firmware() || pdev->device == PCI_DEVICE_ID_INTEL_ISH_CHV;
} }
static inline bool ish_should_leave_d0i3(struct pci_dev *pdev) static inline bool ish_should_leave_d0i3(struct pci_dev *pdev)
{ {
return !pm_resume_via_firmware() || pdev->device == CHV_DEVICE_ID; return !pm_resume_via_firmware() || pdev->device == PCI_DEVICE_ID_INTEL_ISH_CHV;
} }
/** /**
@ -189,7 +189,7 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
init_waitqueue_head(&ishtp->resume_wait); init_waitqueue_head(&ishtp->resume_wait);
/* Enable PME for EHL */ /* Enable PME for EHL */
if (pdev->device == EHL_Ax_DEVICE_ID) if (pdev->device == PCI_DEVICE_ID_INTEL_ISH_EHL_Ax)
device_init_wakeup(dev, true); device_init_wakeup(dev, true);
ret = ish_init(ishtp); ret = ish_init(ishtp);
@ -222,7 +222,7 @@ static void ish_remove(struct pci_dev *pdev)
*/ */
static void ish_shutdown(struct pci_dev *pdev) static void ish_shutdown(struct pci_dev *pdev)
{ {
if (pdev->device == EHL_Ax_DEVICE_ID) if (pdev->device == PCI_DEVICE_ID_INTEL_ISH_EHL_Ax)
pci_prepare_to_sleep(pdev); pci_prepare_to_sleep(pdev);
} }