|
26 | 26 | #include <linux/mfd/syscon.h>
|
27 | 27 | #include "dev.h"
|
28 | 28 | #include "procfs.h"
|
| 29 | +#include <linux/kthread.h> |
29 | 30 |
|
30 | 31 | #define RKCIF_VERNO_LEN 10
|
31 | 32 |
|
@@ -1310,19 +1311,17 @@ static int subdev_asyn_register_itf(struct rkcif_device *dev)
|
1310 | 1311 | {
|
1311 | 1312 | struct sditf_priv *sditf = NULL;
|
1312 | 1313 | int ret = 0;
|
1313 |
| - int i = 0; |
1314 | 1314 |
|
1315 | 1315 | ret = rkcif_update_sensor_info(&dev->stream[0]);
|
1316 | 1316 | if (ret) {
|
1317 | 1317 | v4l2_err(&dev->v4l2_dev,
|
1318 | 1318 | "There is not terminal subdev, not synchronized with ISP\n");
|
1319 | 1319 | return 0;
|
1320 | 1320 | }
|
1321 |
| - |
1322 |
| - for (i = 0; i < dev->sditf_cnt; i++) { |
1323 |
| - sditf = dev->sditf[i]; |
1324 |
| - if (sditf && (!sditf->is_combine_mode)) |
1325 |
| - ret = v4l2_async_register_subdev_sensor_common(&sditf->sd); |
| 1321 | + sditf = dev->sditf[0]; |
| 1322 | + if (sditf && (!sditf->is_combine_mode) && (!dev->is_notifier_isp)) { |
| 1323 | + ret = v4l2_async_register_subdev_sensor_common(&sditf->sd); |
| 1324 | + dev->is_notifier_isp = true; |
1326 | 1325 | }
|
1327 | 1326 |
|
1328 | 1327 | return ret;
|
@@ -1414,6 +1413,8 @@ static int subdev_notifier_complete(struct v4l2_async_notifier *notifier)
|
1414 | 1413 | if (ret < 0)
|
1415 | 1414 | goto unregister_lvds;
|
1416 | 1415 |
|
| 1416 | + if (!completion_done(&dev->cmpl_ntf)) |
| 1417 | + complete(&dev->cmpl_ntf); |
1417 | 1418 | v4l2_info(&dev->v4l2_dev, "Async subdev notifier completed\n");
|
1418 | 1419 |
|
1419 | 1420 | return ret;
|
@@ -1516,6 +1517,20 @@ static int cif_subdev_notifier(struct rkcif_device *cif_dev)
|
1516 | 1517 | return ret;
|
1517 | 1518 | }
|
1518 | 1519 |
|
| 1520 | +static int notifier_isp_thread(void *data) |
| 1521 | +{ |
| 1522 | + struct rkcif_device *dev = data; |
| 1523 | + int ret = 0; |
| 1524 | + |
| 1525 | + ret = wait_for_completion_timeout(&dev->cmpl_ntf, msecs_to_jiffies(5000)); |
| 1526 | + if (ret) { |
| 1527 | + mutex_lock(&rkcif_dev_mutex); |
| 1528 | + subdev_asyn_register_itf(dev); |
| 1529 | + mutex_unlock(&rkcif_dev_mutex); |
| 1530 | + } |
| 1531 | + return 0; |
| 1532 | +} |
| 1533 | + |
1519 | 1534 | /***************************** platform deive *******************************/
|
1520 | 1535 |
|
1521 | 1536 | static int rkcif_register_platform_subdevs(struct rkcif_device *cif_dev)
|
@@ -1551,6 +1566,8 @@ static int rkcif_register_platform_subdevs(struct rkcif_device *cif_dev)
|
1551 | 1566 | goto err_unreg_stream_vdev;
|
1552 | 1567 | }
|
1553 | 1568 | }
|
| 1569 | + init_completion(&cif_dev->cmpl_ntf); |
| 1570 | + kthread_run(notifier_isp_thread, cif_dev, "notifier isp"); |
1554 | 1571 | ret = cif_subdev_notifier(cif_dev);
|
1555 | 1572 | if (ret < 0) {
|
1556 | 1573 | v4l2_err(&cif_dev->v4l2_dev,
|
@@ -1764,6 +1781,7 @@ int rkcif_plat_init(struct rkcif_device *cif_dev, struct device_node *node, int
|
1764 | 1781 | cif_dev->id_use_cnt = 0;
|
1765 | 1782 | cif_dev->sync_type = NO_SYNC_MODE;
|
1766 | 1783 | cif_dev->sditf_cnt = 0;
|
| 1784 | + cif_dev->is_notifier_isp = false; |
1767 | 1785 | if (cif_dev->chip_id == CHIP_RV1126_CIF_LITE)
|
1768 | 1786 | cif_dev->isr_hdl = rkcif_irq_lite_handler;
|
1769 | 1787 |
|
|
0 commit comments