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

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

Merge "leds: qpnp-wled: Fix the current sink configuration issue"

parents c81f83a3 81a9f3f7
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1072,8 +1072,6 @@ static int qpnp_wled_sink_config(struct qpnp_wled *wled)
				if (rc < 0)
					return rc;

				module_enable = 0;

				val = 0;
				/* Disable all the sinks */
				rc = qpnp_wled_write_reg(wled, &val,
@@ -1081,6 +1079,8 @@ static int qpnp_wled_sink_config(struct qpnp_wled *wled)
							 (wled->sink_base));
				if (rc < 0)
					return rc;

				module_enable = 0;
			}

			rc = qpnp_wled_write_reg(wled, &mod_temp,
@@ -1129,7 +1129,6 @@ static int qpnp_wled_sink_config(struct qpnp_wled *wled)
	}

	if (sink_reg != sink_cfg) {
		if (module_enable) {
		/* Disable module */
		rc = qpnp_wled_module_en(wled, wled->ctrl_base, false);
		if (rc < 0)
@@ -1138,21 +1137,23 @@ static int qpnp_wled_sink_config(struct qpnp_wled *wled)
		module_enable = 0;
	}

		/* Disable all the sinks */
	if (!module_enable) {
		/* Enable all the sinks */
		rc = qpnp_wled_write_reg(wled, &sink_cfg,
					 QPNP_WLED_CURR_SINK_REG(
					 wled->sink_base));
		if (rc < 0)
			return rc;
	}

		/* Enable module */
	if (!module_enable)
		rc = qpnp_wled_module_en(wled, wled->ctrl_base, true);

		if (rc < 0)
			return rc;
	}

	return 0;
}

/* Configure WLED registers */
static int qpnp_wled_config(struct qpnp_wled *wled)
{