|
9 | 9 |
|
10 | 10 | #include <linux/component.h> |
11 | 11 | #include <linux/dma-mapping.h> |
| 12 | +#include <linux/jiffies.h> |
12 | 13 | #include <linux/module.h> |
13 | 14 | #include <linux/of_address.h> |
14 | 15 | #include <linux/of_device.h> |
@@ -401,7 +402,8 @@ static int apple_drm_init_dcp(struct device *dev) |
401 | 402 | struct apple_drm_private *apple = dev_get_drvdata(dev); |
402 | 403 | struct platform_device *dcp[MAX_COPROCESSORS]; |
403 | 404 | struct device_node *np; |
404 | | - int ret, num_dcp = 0; |
| 405 | + u64 timeout; |
| 406 | + int i, ret, num_dcp = 0; |
405 | 407 |
|
406 | 408 | for_each_matching_node(np, apple_dcp_id_tbl) { |
407 | 409 | if (!of_device_is_available(np)) { |
@@ -429,6 +431,21 @@ static int apple_drm_init_dcp(struct device *dev) |
429 | 431 | if (num_dcp < 1) |
430 | 432 | return -ENODEV; |
431 | 433 |
|
| 434 | + timeout = get_jiffies_64() + msecs_to_jiffies(500); |
| 435 | + |
| 436 | + for (i = 0; i < num_dcp; ++i) { |
| 437 | + u64 jiffies = get_jiffies_64(); |
| 438 | + u64 wait = time_after_eq64(jiffies, timeout) ? |
| 439 | + 0 : |
| 440 | + timeout - jiffies; |
| 441 | + ret = dcp_wait_ready(dcp[i], wait); |
| 442 | + /* There is nothing we can do if a dcp/dcpext does not boot |
| 443 | + * (successfully). Ignoring it should not do any harm now. |
| 444 | + * Needs to reevaluated whenn adding dcpext support. |
| 445 | + */ |
| 446 | + if (ret) |
| 447 | + dev_warn(dev, "DCP[%d] not ready: %d\n", i, ret); |
| 448 | + } |
432 | 449 |
|
433 | 450 | return 0; |
434 | 451 | } |
|
0 commit comments