|
@@ -451,7 +451,7 @@ int phm_wait_on_register(struct pp_hwmgr *hwmgr, uint32_t index,
|
|
|
* reached the given value.The indirect space is described by giving
|
|
|
* the memory-mapped index of the indirect index register.
|
|
|
*/
|
|
|
-void phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr,
|
|
|
+int phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr,
|
|
|
uint32_t indirect_port,
|
|
|
uint32_t index,
|
|
|
uint32_t value,
|
|
@@ -459,14 +459,50 @@ void phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr,
|
|
|
{
|
|
|
if (hwmgr == NULL || hwmgr->device == NULL) {
|
|
|
pr_err("Invalid Hardware Manager!");
|
|
|
- return;
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
|
|
|
|
cgs_write_register(hwmgr->device, indirect_port, index);
|
|
|
- phm_wait_on_register(hwmgr, indirect_port + 1, mask, value);
|
|
|
+ return phm_wait_on_register(hwmgr, indirect_port + 1, mask, value);
|
|
|
}
|
|
|
|
|
|
+int phm_wait_for_register_unequal(struct pp_hwmgr *hwmgr,
|
|
|
+ uint32_t index,
|
|
|
+ uint32_t value, uint32_t mask)
|
|
|
+{
|
|
|
+ uint32_t i;
|
|
|
+ uint32_t cur_value;
|
|
|
|
|
|
+ if (hwmgr == NULL || hwmgr->device == NULL)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ for (i = 0; i < hwmgr->usec_timeout; i++) {
|
|
|
+ cur_value = cgs_read_register(hwmgr->device,
|
|
|
+ index);
|
|
|
+ if ((cur_value & mask) != (value & mask))
|
|
|
+ break;
|
|
|
+ udelay(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* timeout means wrong logic */
|
|
|
+ if (i == hwmgr->usec_timeout)
|
|
|
+ return -ETIME;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int phm_wait_for_indirect_register_unequal(struct pp_hwmgr *hwmgr,
|
|
|
+ uint32_t indirect_port,
|
|
|
+ uint32_t index,
|
|
|
+ uint32_t value,
|
|
|
+ uint32_t mask)
|
|
|
+{
|
|
|
+ if (hwmgr == NULL || hwmgr->device == NULL)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ cgs_write_register(hwmgr->device, indirect_port, index);
|
|
|
+ return phm_wait_for_register_unequal(hwmgr, indirect_port + 1,
|
|
|
+ value, mask);
|
|
|
+}
|
|
|
|
|
|
bool phm_cf_want_uvd_power_gating(struct pp_hwmgr *hwmgr)
|
|
|
{
|