diff options
Diffstat (limited to 'drivers/misc/mei/hbm.c')
-rw-r--r-- | drivers/misc/mei/hbm.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 280befc46d11..9fc051b7f1a3 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
@@ -372,7 +372,8 @@ static int mei_hbm_prop_req(struct mei_device *dev) | |||
372 | * @dev: the device structure | 372 | * @dev: the device structure |
373 | * @pg_cmd: the pg command code | 373 | * @pg_cmd: the pg command code |
374 | * | 374 | * |
375 | * This function returns -EIO on write failure | 375 | * returns -EIO on write failure |
376 | * -EOPNOTSUPP if the operation is not supported by the protocol | ||
376 | */ | 377 | */ |
377 | int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) | 378 | int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) |
378 | { | 379 | { |
@@ -381,6 +382,9 @@ int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) | |||
381 | const size_t len = sizeof(struct hbm_power_gate); | 382 | const size_t len = sizeof(struct hbm_power_gate); |
382 | int ret; | 383 | int ret; |
383 | 384 | ||
385 | if (!dev->hbm_f_pg_supported) | ||
386 | return -EOPNOTSUPP; | ||
387 | |||
384 | mei_hbm_hdr(mei_hdr, len); | 388 | mei_hbm_hdr(mei_hdr, len); |
385 | 389 | ||
386 | req = (struct hbm_power_gate *)dev->wr_msg.data; | 390 | req = (struct hbm_power_gate *)dev->wr_msg.data; |
@@ -660,6 +664,23 @@ static int mei_hbm_fw_disconnect_req(struct mei_device *dev, | |||
660 | return 0; | 664 | return 0; |
661 | } | 665 | } |
662 | 666 | ||
667 | /** | ||
668 | * mei_hbm_config_features: check what hbm features and commands | ||
669 | * are supported by the fw | ||
670 | * | ||
671 | * @dev: the device structure | ||
672 | */ | ||
673 | static void mei_hbm_config_features(struct mei_device *dev) | ||
674 | { | ||
675 | /* Power Gating Isolation Support */ | ||
676 | dev->hbm_f_pg_supported = 0; | ||
677 | if (dev->version.major_version > HBM_MAJOR_VERSION_PGI) | ||
678 | dev->hbm_f_pg_supported = 1; | ||
679 | |||
680 | if (dev->version.major_version == HBM_MAJOR_VERSION_PGI && | ||
681 | dev->version.minor_version >= HBM_MINOR_VERSION_PGI) | ||
682 | dev->hbm_f_pg_supported = 1; | ||
683 | } | ||
663 | 684 | ||
664 | /** | 685 | /** |
665 | * mei_hbm_version_is_supported - checks whether the driver can | 686 | * mei_hbm_version_is_supported - checks whether the driver can |
@@ -743,6 +764,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) | |||
743 | break; | 764 | break; |
744 | } | 765 | } |
745 | 766 | ||
767 | mei_hbm_config_features(dev); | ||
768 | |||
746 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || | 769 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
747 | dev->hbm_state != MEI_HBM_STARTING) { | 770 | dev->hbm_state != MEI_HBM_STARTING) { |
748 | dev_err(&dev->pdev->dev, "hbm: start: state mismatch, [%d, %d]\n", | 771 | dev_err(&dev->pdev->dev, "hbm: start: state mismatch, [%d, %d]\n", |