From 81c16e5d72190dc668cbbbb03678b6d37b4c0e4b Mon Sep 17 00:00:00 2001 From: Wooki Min Date: Tue, 29 May 2018 20:16:58 +0900 Subject: [PATCH] [COMMON] fimc-is2: add preventing logic regarding to pattern generator on/off The pattern generator should be enabled while camera is not running. So, a checking state is added if pattern generator can be enable or not. Change-Id: I0664949d7c31c69d52cfcc68bfbfc7d8928201b4 Signed-off-by: Wooki Min --- drivers/media/platform/exynos/fimc-is2/fimc-is-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos/fimc-is2/fimc-is-core.c b/drivers/media/platform/exynos/fimc-is2/fimc-is-core.c index ab738eff97d1..8d6d58976edf 100644 --- a/drivers/media/platform/exynos/fimc-is2/fimc-is-core.c +++ b/drivers/media/platform/exynos/fimc-is2/fimc-is-core.c @@ -603,6 +603,8 @@ static ssize_t store_pattern_en(struct device *dev, { int ret = 0; unsigned long cmd; + struct fimc_is_core *core = + (struct fimc_is_core *)platform_get_drvdata(to_platform_device(dev)); ret = kstrtoul(buf, 0, &cmd); if (ret) @@ -611,7 +613,10 @@ static ssize_t store_pattern_en(struct device *dev, switch (cmd) { case 0: case 1: - sysfs_debug.pattern_en = cmd; + if (atomic_read(&core->rsccount)) + pr_warn("%s: patter generator cannot be enabled while camera is running.\n", __func__); + else + sysfs_debug.pattern_en = cmd; break; default: pr_warn("%s: invalid paramter (%lu)\n", __func__, cmd); -- 2.20.1