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 <sthella@codeaurora.org>
This commit is contained in:
Shyam Kumar Thella 2020-05-15 12:13:14 +05:30 committed by David Collins
parent b2ea9ae600
commit e9a3973e99

View File

@ -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;