From 17e3b729a6ecd4cc85fee896192ac4297c187ad4 Mon Sep 17 00:00:00 2001 From: Wooyeon Kim Date: Mon, 15 Apr 2019 19:18:10 +0900 Subject: [PATCH] [COMMON] fimc-is2: modify "head" base when group is stopped - when camera is suddenly closed, wrong refer group caused smp trigger stuck problem PR JIRA ID: CPR-958 Change-Id: I311a14c062906d4aab7aa5f9e36fb151ba80107e Signed-off-by: Wooyeon Kim --- .../exynos/fimc-is2/fimc-is-groupmgr.c | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/drivers/media/platform/exynos/fimc-is2/fimc-is-groupmgr.c b/drivers/media/platform/exynos/fimc-is2/fimc-is-groupmgr.c index 0409d4c16f0c..a3415f24be0a 100644 --- a/drivers/media/platform/exynos/fimc-is2/fimc-is-groupmgr.c +++ b/drivers/media/platform/exynos/fimc-is2/fimc-is-groupmgr.c @@ -2215,6 +2215,7 @@ int fimc_is_group_stop(struct fimc_is_groupmgr *groupmgr, struct fimc_is_framemgr *framemgr; struct fimc_is_device_ischain *device; struct fimc_is_device_sensor *sensor; + struct fimc_is_group *head; struct fimc_is_group *child; struct fimc_is_subdev *subdev; struct fimc_is_group_task *gtask; @@ -2229,7 +2230,6 @@ int fimc_is_group_stop(struct fimc_is_groupmgr *groupmgr, device = group->device; sensor = device->sensor; framemgr = GET_HEAD_GROUP_FRAMEMGR(group); - gtask = &groupmgr->gtask[group->id]; if (!framemgr) { mgerr("framemgr is NULL", group, group); goto p_err; @@ -2241,6 +2241,10 @@ int fimc_is_group_stop(struct fimc_is_groupmgr *groupmgr, return -EPERM; } + FIMC_BUG(!group->head); + head = group->head; + gtask = &groupmgr->gtask[head->id]; + /* force stop set if only HEAD group OTF input */ if (test_bit(FIMC_IS_GROUP_OTF_INPUT, &group->head->state)) { if (test_bit(FIMC_IS_GROUP_REQUEST_FSTOP, &group->state)) @@ -2250,31 +2254,31 @@ int fimc_is_group_stop(struct fimc_is_groupmgr *groupmgr, retry = 150; while (--retry && framemgr->queued_count[FS_REQUEST]) { - if (test_bit(FIMC_IS_GROUP_OTF_INPUT, &group->state) && - !list_empty(&group->smp_trigger.wait_list)) { + if (test_bit(FIMC_IS_GROUP_OTF_INPUT, &head->state) && + !list_empty(&head->smp_trigger.wait_list)) { if (!sensor) { - mwarn(" sensor is NULL, forcely trigger(pc %d)", device, group->pcount); - set_bit(FIMC_IS_GROUP_FORCE_STOP, &group->state); - up(&group->smp_trigger); - } else if (!test_bit(FIMC_IS_SENSOR_OPEN, &sensor->state)) { - mwarn(" sensor is closed, forcely trigger(pc %d)", device, group->pcount); - set_bit(FIMC_IS_GROUP_FORCE_STOP, &group->state); - up(&group->smp_trigger); + mwarn(" sensor is NULL, forcely trigger(pc %d)", device, head->pcount); + set_bit(FIMC_IS_GROUP_FORCE_STOP, &head->state); + up(&head->smp_trigger); + } else if (!test_bit(FIMC_IS_SENSOR_OPEN, &head->state)) { + mwarn(" sensor is closed, forcely trigger(pc %d)", device, head->pcount); + set_bit(FIMC_IS_GROUP_FORCE_STOP, &head->state); + up(&head->smp_trigger); } else if (!test_bit(FIMC_IS_SENSOR_FRONT_START, &sensor->state)) { - mwarn(" front is stopped, forcely trigger(pc %d)", device, group->pcount); - set_bit(FIMC_IS_GROUP_FORCE_STOP, &group->state); - up(&group->smp_trigger); + mwarn(" front is stopped, forcely trigger(pc %d)", device, head->pcount); + set_bit(FIMC_IS_GROUP_FORCE_STOP, &head->state); + up(&head->smp_trigger); } else if (!test_bit(FIMC_IS_SENSOR_BACK_START, &sensor->state)) { - mwarn(" back is stopped, forcely trigger(pc %d)", device, group->pcount); - set_bit(FIMC_IS_GROUP_FORCE_STOP, &group->state); - up(&group->smp_trigger); + mwarn(" back is stopped, forcely trigger(pc %d)", device, head->pcount); + set_bit(FIMC_IS_GROUP_FORCE_STOP, &head->state); + up(&head->smp_trigger); } else if (retry < 100) { - merr(" sensor is working but no trigger(pc %d)", device, group->pcount); - set_bit(FIMC_IS_GROUP_FORCE_STOP, &group->state); - up(&group->smp_trigger); + merr(" sensor is working but no trigger(pc %d)", device, head->pcount); + set_bit(FIMC_IS_GROUP_FORCE_STOP, &head->state); + up(&head->smp_trigger); } else { - mwarn(" wating for sensor trigger(pc %d)", device, group->pcount); + mwarn(" wating for sensor trigger(pc %d)", device, head->pcount); } #ifdef ENABLE_SYNC_REPROCESSING } else if (!test_bit(FIMC_IS_GROUP_OTF_INPUT, &group->state)) { @@ -2288,14 +2292,14 @@ int fimc_is_group_stop(struct fimc_is_groupmgr *groupmgr, #endif } - mgwarn(" %d reqs waiting...(pc %d) smp_resource(%d)", device, group, - framemgr->queued_count[FS_REQUEST], group->pcount, + mgwarn(" %d reqs waiting...(pc %d) smp_resource(%d)", device, head, + framemgr->queued_count[FS_REQUEST], head->pcount, list_empty(>ask->smp_resource.wait_list)); msleep(20); } if (!retry) { - mgerr(" waiting(until request empty) is fail(pc %d)", device, group, group->pcount); + mgerr(" waiting(until request empty) is fail(pc %d)", device, head, head->pcount); errcnt++; } @@ -2334,22 +2338,22 @@ int fimc_is_group_stop(struct fimc_is_groupmgr *groupmgr, retry = 150; while (--retry && framemgr->queued_count[FS_PROCESS]) { - mgwarn(" %d pros waiting...(pc %d)", device, group, framemgr->queued_count[FS_PROCESS], group->pcount); + mgwarn(" %d pros waiting...(pc %d)", device, head, framemgr->queued_count[FS_PROCESS], head->pcount); msleep(20); } if (!retry) { - mgerr(" waiting(until process empty) is fail(pc %d)", device, group, group->pcount); + mgerr(" waiting(until process empty) is fail(pc %d)", device, head, head->pcount); errcnt++; } - rcount = atomic_read(&group->rcount); + rcount = atomic_read(&head->rcount); if (rcount) { - mgerr(" request is NOT empty(%d) (pc %d)", device, group, rcount, group->pcount); + mgerr(" request is NOT empty(%d) (pc %d)", device, head, rcount, head->pcount); errcnt++; } /* the count of request should be clear for next streaming */ - atomic_set(&group->rcount, 0); + atomic_set(&head->rcount, 0); child = group; while(child) { @@ -2396,7 +2400,7 @@ int fimc_is_group_stop(struct fimc_is_groupmgr *groupmgr, child = child->child; } - fimc_is_gframe_flush(groupmgr, group); + fimc_is_gframe_flush(groupmgr, head); if (test_bit(FIMC_IS_GROUP_OTF_INPUT, &group->state)) mginfo(" sensor fcount: %d, fcount: %d\n", device, group, -- 2.20.1