From 2a11773571255ca88f908378a6dd9cfa8415d9df Mon Sep 17 00:00:00 2001 From: Shyam Kumar Thella Date: Fri, 15 May 2020 12:13:14 +0530 Subject: [PATCH] leds: qti-flash: Limit off_time of switch to a maximum of 1280 ms Currently, Flash LED peripheral supports a maximum safety timer expiry of 1280 ms for flash mode where the target current can go as high as 1500 mA. If off_time is allowed more than that time period, then flash LED can stay ON more than that safety timer period. Hence, clamp off_time to not exceed 1280 ms. Change-Id: Idbd8b41c5041c50e3f714be9efb0ad04b1ee9181 Signed-off-by: Shyam Kumar Thella --- drivers/leds/leds-qti-flash.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/leds/leds-qti-flash.c b/drivers/leds/leds-qti-flash.c index eb886ab3aca5..7c8d0c13bcf2 100644 --- a/drivers/leds/leds-qti-flash.c +++ b/drivers/leds/leds-qti-flash.c @@ -1032,6 +1032,8 @@ static ssize_t qti_flash_off_time_store(struct device *dev, if (rc < 0) return rc; + val = min_t(u64, val, SAFETY_TIMER_MAX_TIMEOUT_MS); + snode = container_of(led_cdev, struct flash_switch_data, cdev); snode->off_time_ms = val;