From: Wooki Min Date: Tue, 29 May 2018 11:16:58 +0000 (+0900) Subject: [COMMON] fimc-is2: add preventing logic regarding to pattern generator on/off X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=81c16e5d72190dc668cbbbb03678b6d37b4c0e4b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [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 --- 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);