From cff093c1e3808f851c1cffb2d59edf59e10cd31c Mon Sep 17 00:00:00 2001 From: John Galt Date: Fri, 7 Feb 2025 15:13:46 +0000 Subject: [PATCH] sm6150-common: camera: Cap max_brightness * Our maximum brightness is 500. * However, for safety related reason, I have capped this to 255. * 255 is more than sufficient, and I do not want to be responsible for LED damage. * Finding the default percentage took some trial and error, in this case, 59% correlated to 75. Co-authored-by: rahul Change-Id: Ie20969362c531391e4c51b22365b74d62ccb8e5e Signed-off-by: John Galt Signed-off-by: therealmharc --- camera/CameraProviderExtension.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/camera/CameraProviderExtension.cpp b/camera/CameraProviderExtension.cpp index 9d98fe6..3a2e034 100644 --- a/camera/CameraProviderExtension.cpp +++ b/camera/CameraProviderExtension.cpp @@ -47,14 +47,15 @@ bool supportsSetTorchModeExt() { } int32_t getTorchDefaultStrengthLevelExt() { - return 80; + // Our default value is 75. This corresponds to 15%. + // As we have changed the maximum value, 59% now corresponds to 75. + return 59; } int32_t getTorchMaxStrengthLevelExt() { - // In our device, both LEDs has same maximum value - // so get from one. - auto node = kTorchLedPaths[0] + "/" + TORCH_MAX_BRIGHTNESS; - return get(node, 0); + // 255 out of 500 is a sane brightness. + // Let's cap it to 255 as max, we can go much higher, but I don't want to test this. + return 255; } int32_t getTorchStrengthLevelExt() {