Skip to content

Commit 51d66a7

Browse files
jlawrynosgruszka
authored andcommitted
accel/ivpu: Use generation based function and registers names
Given that VPU generation can be used by multiple platforms, driver should use VPU IP generation names instead of a platform. Change naming for functions and registries. Use 37XX format, where: 3 - major VPU IP generation version 7 - minor VPU IP generation version XX - postfix indicating this is an architecture and not marketing name Signed-off-by: Jacek Lawrynowicz <[email protected]> Reviewed-by: Stanislaw Gruszka <[email protected]> Signed-off-by: Stanislaw Gruszka <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 864a00b commit 51d66a7

File tree

6 files changed

+492
-484
lines changed

6 files changed

+492
-484
lines changed

drivers/accel/ivpu/ivpu_drv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ static int ivpu_pci_init(struct ivpu_device *vdev)
443443
/* Clear any pending errors */
444444
pcie_capability_clear_word(pdev, PCI_EXP_DEVSTA, 0x3f);
445445

446-
/* VPU MTL does not require PCI spec 10m D3hot delay */
447-
if (ivpu_is_mtl(vdev))
446+
/* VPU 37XX does not require 10m D3hot delay */
447+
if (ivpu_hw_gen(vdev) == IVPU_HW_37XX)
448448
pdev->d3hot_delay = 0;
449449

450450
ret = pcim_enable_device(pdev);
@@ -482,7 +482,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
482482
if (!vdev->pm)
483483
return -ENOMEM;
484484

485-
vdev->hw->ops = &ivpu_hw_mtl_ops;
485+
vdev->hw->ops = &ivpu_hw_37xx_ops;
486486
vdev->hw->dma_bits = 38;
487487

488488
vdev->platform = IVPU_PLATFORM_INVALID;

drivers/accel/ivpu/ivpu_drv.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#define PCI_DEVICE_ID_MTL 0x7d1d
2626

27+
#define IVPU_HW_37XX 37
28+
2729
#define IVPU_GLOBAL_CONTEXT_MMU_SSID 0
2830
/* SSID 1 is used by the VPU to represent invalid context */
2931
#define IVPU_USER_CONTEXT_MIN_SSID 2
@@ -146,11 +148,6 @@ void ivpu_file_priv_put(struct ivpu_file_priv **link);
146148
int ivpu_boot(struct ivpu_device *vdev);
147149
int ivpu_shutdown(struct ivpu_device *vdev);
148150

149-
static inline bool ivpu_is_mtl(struct ivpu_device *vdev)
150-
{
151-
return to_pci_dev(vdev->drm.dev)->device == PCI_DEVICE_ID_MTL;
152-
}
153-
154151
static inline u8 ivpu_revision(struct ivpu_device *vdev)
155152
{
156153
return to_pci_dev(vdev->drm.dev)->revision;
@@ -161,6 +158,17 @@ static inline u16 ivpu_device_id(struct ivpu_device *vdev)
161158
return to_pci_dev(vdev->drm.dev)->device;
162159
}
163160

161+
static inline int ivpu_hw_gen(struct ivpu_device *vdev)
162+
{
163+
switch (ivpu_device_id(vdev)) {
164+
case PCI_DEVICE_ID_MTL:
165+
return IVPU_HW_37XX;
166+
default:
167+
ivpu_err(vdev, "Unknown VPU device\n");
168+
return 0;
169+
}
170+
}
171+
164172
static inline struct ivpu_device *to_ivpu_device(struct drm_device *dev)
165173
{
166174
return container_of(dev, struct ivpu_device, drm);

drivers/accel/ivpu/ivpu_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct ivpu_hw_info {
6060
int dma_bits;
6161
};
6262

63-
extern const struct ivpu_hw_ops ivpu_hw_mtl_ops;
63+
extern const struct ivpu_hw_ops ivpu_hw_37xx_ops;
6464

6565
static inline int ivpu_hw_info_init(struct ivpu_device *vdev)
6666
{

0 commit comments

Comments
 (0)