Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 347effc7 authored by Abinaya P's avatar Abinaya P
Browse files

leds: leds-qpnp: make blink functionality synchronous



pwm_cfg->blinking is a shared parameter between qpnp_mpp_set
and led_blink function. When a blink operation is given to
the led when it is glowing with some brightness value, the led
does not blink because the blinking parameter is wrongly
reset to false in the end of qpnp_mpp_set. So making the blink
functionality synchronous will solve the issue.

Change-Id: Ie84fe52bc84d5c14573e3f1a042e163e62152cce
Signed-off-by: default avatarAbinaya P <abinayap@codeaurora.org>
parent 07692d57
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -2484,6 +2484,9 @@ restore:
static void led_blink(struct qpnp_led_data *led,
			struct pwm_config_data *pwm_cfg)
{
	int rc;

	mutex_lock(&led->lock);
	if (pwm_cfg->use_blink) {
		if (led->cdev.brightness) {
			pwm_cfg->blinking = true;
@@ -2498,8 +2501,20 @@ static void led_blink(struct qpnp_led_data *led,
		}
		pwm_free(pwm_cfg->pwm_dev);
		qpnp_pwm_init(pwm_cfg, led->spmi_dev, led->cdev.name);
		qpnp_led_set(&led->cdev, led->cdev.brightness);
		if (led->id == QPNP_ID_RGB_RED || led->id == QPNP_ID_RGB_GREEN
				|| led->id == QPNP_ID_RGB_BLUE) {
			rc = qpnp_rgb_set(led);
			if (rc < 0)
				dev_err(&led->spmi_dev->dev,
				"RGB set brightness failed (%d)\n", rc);
		} else if (led->id == QPNP_ID_LED_MPP) {
			rc = qpnp_mpp_set(led);
			if (rc < 0)
				dev_err(&led->spmi_dev->dev,
				"MPP set brightness failed (%d)\n", rc);
		}
	}
	mutex_unlock(&led->lock);
}

static ssize_t blink_store(struct device *dev,