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

Commit 73670fdd authored by Mohan Pallaka's avatar Mohan Pallaka Committed by Gerrit - the friendly Code Review server
Browse files

leds: qpnp-wled: maintain wled state



Enable/disable the wled module only if it changes
the state.

Change-Id: I754a7ac23cd5ec6fea1ea2e6d4dd2d3f7c44ed37
Signed-off-by: default avatarMohan Pallaka <mpallaka@codeaurora.org>
parent f5d3db32
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -256,6 +256,7 @@ struct qpnp_wled {
	bool en_cabc;
	bool disp_type_amoled;
	bool en_ext_pfet_sc_pro;
	bool prev_state;
};

/* helper to read a pmic register */
@@ -690,6 +691,7 @@ static void qpnp_wled_work(struct work_struct *work)
		}
	}

	if (!!level != wled->prev_state) {
		rc = qpnp_wled_module_en(wled, wled->ctrl_base, !!level);

		if (rc) {
@@ -697,6 +699,9 @@ static void qpnp_wled_work(struct work_struct *work)
						level ? "en" : "dis");
			goto unlock_mutex;
		}
	}

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