summaryrefslogtreecommitdiff
path: root/drivers/accel/amdxdna/aie2_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/accel/amdxdna/aie2_pci.c')
-rw-r--r--drivers/accel/amdxdna/aie2_pci.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
index 8141d8e51636..f70ccf0f3c01 100644
--- a/drivers/accel/amdxdna/aie2_pci.c
+++ b/drivers/accel/amdxdna/aie2_pci.c
@@ -57,41 +57,23 @@ struct mgmt_mbox_chann_info {
static int aie2_check_protocol(struct amdxdna_dev_hdl *ndev, u32 fw_major, u32 fw_minor)
{
const struct aie2_fw_feature_tbl *feature;
- struct amdxdna_dev *xdna = ndev->xdna;
-
- /*
- * The driver supported mailbox behavior is defined by
- * ndev->priv->protocol_major and protocol_minor.
- *
- * When protocol_major and fw_major are different, it means driver
- * and firmware are incompatible.
- */
- if (ndev->priv->protocol_major != fw_major) {
- XDNA_ERR(xdna, "Incompatible firmware protocol major %d minor %d",
- fw_major, fw_minor);
- return -EINVAL;
- }
+ bool found = false;
- /*
- * When protocol_minor is greater then fw_minor, that means driver
- * relies on operation the installed firmware does not support.
- */
- if (ndev->priv->protocol_minor > fw_minor) {
- XDNA_ERR(xdna, "Firmware minor version smaller than supported");
- return -EINVAL;
- }
-
- for (feature = ndev->priv->fw_feature_tbl; feature && feature->min_minor;
- feature++) {
+ for (feature = ndev->priv->fw_feature_tbl; feature->major; feature++) {
+ if (feature->major != fw_major)
+ continue;
if (fw_minor < feature->min_minor)
continue;
if (feature->max_minor > 0 && fw_minor > feature->max_minor)
continue;
- set_bit(feature->feature, &ndev->feature_mask);
+ ndev->feature_mask |= feature->features;
+
+ /* firmware version matches one of the driver support entry */
+ found = true;
}
- return 0;
+ return found ? 0 : -EOPNOTSUPP;
}
static void aie2_dump_chann_info_debug(struct amdxdna_dev_hdl *ndev)
@@ -322,7 +304,7 @@ static int aie2_xrs_set_dft_dpm_level(struct drm_device *ddev, u32 dpm_level)
if (ndev->pw_mode != POWER_MODE_DEFAULT || ndev->dpm_level == dpm_level)
return 0;
- return ndev->priv->hw_ops.set_dpm(ndev, dpm_level);
+ return aie2_pm_set_dpm(ndev, dpm_level);
}
static struct xrs_action_ops aie2_xrs_actions = {