leds: ledtrig-pattern: Use last_repeat when applying hw pattern

`last_repeat` holds the actual value requested by the user whereas
`repeat` is a software iteration variable that is unused in hardware
patterns.

Furthermore `last_repeat` is the field returned to the user when reading
the `repeat` sysfs property.  This field is initialized to `-1` which is
- together with `1` - the only valid value in the upcoming Qualcomm LPG
driver.  It is thus unexpected when `repeat` with an initialization
value of `0` is passed into the the driver, when the sysfs property
clearly presents a value of `-1`.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
This commit is contained in:
Marijn Suijten 2021-04-11 23:04:31 +02:00 committed by Jami Kettunen
parent 30a0b95b13
commit 2f64669614

View file

@ -126,7 +126,8 @@ static int pattern_trig_start_pattern(struct led_classdev *led_cdev)
if (data->is_hw_pattern) {
return led_cdev->pattern_set(led_cdev, data->patterns,
data->npatterns, data->repeat);
data->npatterns,
data->last_repeat);
}
/* At least 2 tuples for software pattern. */