Skip to content

Commit fe3602c

Browse files
Zefa Chenrkhuangtao
authored andcommitted
media: rockchip: vicap fixed issue of sditf async to isp
Signed-off-by: Zefa Chen <[email protected]> Change-Id: If650530feba615c5cc92770f8378a1cc354ed010
1 parent 201d45e commit fe3602c

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

drivers/media/platform/rockchip/cif/dev.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/mfd/syscon.h>
2727
#include "dev.h"
2828
#include "procfs.h"
29+
#include <linux/kthread.h>
2930

3031
#define RKCIF_VERNO_LEN 10
3132

@@ -1310,19 +1311,17 @@ static int subdev_asyn_register_itf(struct rkcif_device *dev)
13101311
{
13111312
struct sditf_priv *sditf = NULL;
13121313
int ret = 0;
1313-
int i = 0;
13141314

13151315
ret = rkcif_update_sensor_info(&dev->stream[0]);
13161316
if (ret) {
13171317
v4l2_err(&dev->v4l2_dev,
13181318
"There is not terminal subdev, not synchronized with ISP\n");
13191319
return 0;
13201320
}
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;
13261325
}
13271326

13281327
return ret;
@@ -1414,6 +1413,8 @@ static int subdev_notifier_complete(struct v4l2_async_notifier *notifier)
14141413
if (ret < 0)
14151414
goto unregister_lvds;
14161415

1416+
if (!completion_done(&dev->cmpl_ntf))
1417+
complete(&dev->cmpl_ntf);
14171418
v4l2_info(&dev->v4l2_dev, "Async subdev notifier completed\n");
14181419

14191420
return ret;
@@ -1516,6 +1517,20 @@ static int cif_subdev_notifier(struct rkcif_device *cif_dev)
15161517
return ret;
15171518
}
15181519

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+
15191534
/***************************** platform deive *******************************/
15201535

15211536
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)
15511566
goto err_unreg_stream_vdev;
15521567
}
15531568
}
1569+
init_completion(&cif_dev->cmpl_ntf);
1570+
kthread_run(notifier_isp_thread, cif_dev, "notifier isp");
15541571
ret = cif_subdev_notifier(cif_dev);
15551572
if (ret < 0) {
15561573
v4l2_err(&cif_dev->v4l2_dev,
@@ -1764,6 +1781,7 @@ int rkcif_plat_init(struct rkcif_device *cif_dev, struct device_node *node, int
17641781
cif_dev->id_use_cnt = 0;
17651782
cif_dev->sync_type = NO_SYNC_MODE;
17661783
cif_dev->sditf_cnt = 0;
1784+
cif_dev->is_notifier_isp = false;
17671785
if (cif_dev->chip_id == CHIP_RV1126_CIF_LITE)
17681786
cif_dev->isr_hdl = rkcif_irq_lite_handler;
17691787

drivers/media/platform/rockchip/cif/dev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,12 @@ struct rkcif_device {
730730
unsigned int wait_line_bak;
731731
unsigned int wait_line_cache;
732732
struct rkcif_dummy_buffer dummy_buf;
733+
struct completion cmpl_ntf;
733734
bool is_start_hdr;
734735
bool reset_work_cancel;
735736
bool iommu_en;
736737
bool is_use_dummybuf;
738+
bool is_notifier_isp;
737739
int sync_type;
738740
int sditf_cnt;
739741
};

0 commit comments

Comments
 (0)