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

Commit b22827e5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: leds-qpnp-wled: Synchronize brightness_set and worker thread"

parents cf952431 187ece99
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -249,7 +249,6 @@ static int qpnp_wled_avdd_trim_adjustments[NUM_SUPPORTED_AVDD_VOLTAGES] = {
 *  @ cdev - led class device
 *  @ spmi - spmi device
 *  @ work - worker for led operation
 *  @ lock - mutex lock for exclusive access
 *  @ fdbk_op - output feedback mode
 *  @ dim_mode - dimming mode
 *  @ ovp_irq - over voltage protection irq
@@ -290,7 +289,6 @@ struct qpnp_wled {
	struct led_classdev	cdev;
	struct spmi_device *spmi;
	struct work_struct work;
	struct mutex lock;
	enum qpnp_wled_fdbk_op fdbk_op;
	enum qpnp_wled_dim_mode dim_mode;
	int ovp_irq;
@@ -490,7 +488,7 @@ static ssize_t qpnp_wled_ramp_store(struct device *dev,
	struct qpnp_wled *wled = dev_get_drvdata(dev);
	int i, rc;

	mutex_lock(&wled->lock);
	mutex_lock(&wled->cdev.led_access);

	if (!wled->cdev.brightness) {
		rc = qpnp_wled_module_en(wled, wled->ctrl_base, true);
@@ -555,7 +553,7 @@ restore_brightness:
			dev_err(&wled->spmi->dev, "wled enable failed\n");
	}
unlock_mutex:
	mutex_unlock(&wled->lock);
	mutex_unlock(&wled->cdev.led_access);

	return count;
}
@@ -801,11 +799,10 @@ static void qpnp_wled_work(struct work_struct *work)
	int level, rc;

	wled = container_of(work, struct qpnp_wled, work);
	mutex_lock(&wled->cdev.led_access);

	level = wled->cdev.brightness;

	mutex_lock(&wled->lock);

	if (level) {
		rc = qpnp_wled_set_level(wled, level);
		if (rc) {
@@ -826,7 +823,7 @@ static void qpnp_wled_work(struct work_struct *work)

	wled->prev_state = !!level;
unlock_mutex:
	mutex_unlock(&wled->lock);
	mutex_unlock(&wled->cdev.led_access);
}

/* get api registered with led classdev for wled brightness */
@@ -1743,7 +1740,6 @@ static int qpnp_wled_probe(struct spmi_device *spmi)
		return rc;
	}

	mutex_init(&wled->lock);
	INIT_WORK(&wled->work, qpnp_wled_work);
	wled->ramp_ms = QPNP_WLED_RAMP_DLY_MS;
	wled->ramp_step = 1;
@@ -1777,7 +1773,6 @@ sysfs_fail:
	led_classdev_unregister(&wled->cdev);
wled_register_fail:
	cancel_work_sync(&wled->work);
	mutex_destroy(&wled->lock);
	return rc;
}

@@ -1792,7 +1787,6 @@ static int qpnp_wled_remove(struct spmi_device *spmi)

	led_classdev_unregister(&wled->cdev);
	cancel_work_sync(&wled->work);
	mutex_destroy(&wled->lock);

	return 0;
}