media: platform: rockchip: cif: register sd itf when cif pipeline completed

Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: I4025d325f0e5dee52a692a302a5cef699adfd6c9
This commit is contained in:
Allon Huang
2021-03-15 14:32:04 +08:00
committed by Tao Huang
parent 4d5fcff848
commit cd0b093f5a
5 changed files with 28 additions and 4 deletions

View File

@@ -2173,7 +2173,9 @@ int rkcif_update_sensor_info(struct rkcif_stream *stream)
sensor = sd_to_sensor(stream->cifdev, sensor_sd);
if (!sensor) {
v4l2_err(&stream->cifdev->v4l2_dev, "get sensor for updating failed!\n");
v4l2_err(&stream->cifdev->v4l2_dev,
"%s: stream[%d] get remote sensor failed!\n",
__func__, stream->id);
return -ENODEV;
}
ret = v4l2_subdev_call(sensor->sd, video, g_mbus_config,
@@ -2205,6 +2207,10 @@ int rkcif_update_sensor_info(struct rkcif_stream *stream)
terminal_sensor->lanes = 4;
break;
default:
v4l2_err(&stream->cifdev->v4l2_dev, "%s:get sd:%s lane num failed!\n",
__func__,
terminal_sensor->sd ?
terminal_sensor->sd->name : "null");
return -EINVAL;
}

View File

@@ -542,6 +542,16 @@ static int _set_pipeline_default_fmt(struct rkcif_device *dev)
return 0;
}
static void subdev_itf_register_work(struct work_struct *work)
{
struct rkcif_device *dev = container_of(work,
struct rkcif_device,
async_register_work);
if (dev->chip_id >= CHIP_RK1808_CIF)
platform_driver_register(&rkcif_subdev_driver);
}
static int subdev_notifier_complete(struct v4l2_async_notifier *notifier)
{
struct rkcif_device *dev;
@@ -586,6 +596,14 @@ static int subdev_notifier_complete(struct v4l2_async_notifier *notifier)
if (ret < 0)
goto unregister_lvds;
INIT_WORK(&dev->async_register_work, subdev_itf_register_work);
if (schedule_work(&dev->async_register_work))
v4l2_info(&dev->v4l2_dev,
"async register subdev itf successfully\n");
else
v4l2_info(&dev->v4l2_dev,
"async register subdev itf failed\n");
v4l2_info(&dev->v4l2_dev, "Async subdev notifier completed\n");
return ret;

View File

@@ -503,6 +503,7 @@ struct rkcif_device {
struct notifier_block reset_notifier; /* reset for mipi csi crc err */
struct rkcif_work_struct reset_work;
struct rkcif_timer reset_watchdog_timer;
struct work_struct async_register_work;
unsigned int buf_wake_up_cnt;
bool iommu_en;

View File

@@ -930,10 +930,8 @@ static int rkcif_plat_hw_probe(struct platform_device *pdev)
if (data->chip_id == CHIP_RK1808_CIF ||
data->chip_id == CHIP_RV1126_CIF ||
data->chip_id == CHIP_RK3568_CIF) {
data->chip_id == CHIP_RK3568_CIF)
platform_driver_register(&rkcif_plat_drv);
platform_driver_register(&rkcif_subdev_driver);
}
return 0;
}

View File

@@ -56,6 +56,7 @@
*4. add extended lines to out image for normal & hdr short frame
*5. modify reset mechanism drivered by real-time frame rate
*6. support rk356x iommu uses vb2 sg type
*7. register cif sd itf when pipeline completed
*/
#define RKCIF_DRIVER_VERSION RKCIF_API_VERSION