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

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

Merge "regulator: qpnp-oledb: Add support for LAB_VREG_NOT_OK notifier"

parents 7ca6c92e 6c86753b
Loading
Loading
Loading
Loading
+30 −2
Original line number Diff line number Diff line
@@ -183,6 +183,8 @@ struct qpnp_oledb {
	bool					dynamic_ext_pinctl_config;
	bool					pbs_control;
	bool					force_pd_control;
	bool					handle_lab_sc_notification;
	bool					lab_sc_detected;
};

static const u16 oledb_warmup_dly_ns[] = {6700, 13300, 26700, 53400};
@@ -277,6 +279,11 @@ static int qpnp_oledb_regulator_enable(struct regulator_dev *rdev)

	struct qpnp_oledb *oledb  = rdev_get_drvdata(rdev);

	if (oledb->lab_sc_detected == true) {
		pr_info("Short circuit detected: Disabled OLEDB rail\n");
		return 0;
	}

	if (oledb->ext_pin_control) {
		rc = qpnp_oledb_read(oledb, oledb->base + OLEDB_EXT_PIN_CTL,
								 &val, 1);
@@ -1243,15 +1250,32 @@ static int qpnp_labibb_notifier_cb(struct notifier_block *nb,
					unsigned long action, void *data)
{
	int rc = 0;
	u8 val;
	struct qpnp_oledb *oledb = container_of(nb, struct qpnp_oledb,
								oledb_nb);

	if (action == LAB_VREG_NOT_OK) {
		/* short circuit detected. Disable OLEDB module */
		val = 0;
		rc = qpnp_oledb_write(oledb, oledb->base + OLEDB_MODULE_RDY,
					&val, 1);
		if (rc < 0) {
			pr_err("Failed to write MODULE_RDY rc=%d\n", rc);
			return NOTIFY_STOP;
		}
		oledb->lab_sc_detected = true;
		oledb->mod_enable = false;
		pr_crit("LAB SC detected, disabling OLEDB forever!\n");
	}

	if (action == LAB_VREG_OK) {
		/* Disable SWIRE pull down control and enable via spmi mode */
		rc = qpnp_oledb_force_pulldown_config(oledb);
		if (rc < 0)
		if (rc < 0) {
			pr_err("Failed to config force pull down\n");
			return NOTIFY_STOP;
		}
	}

	return NOTIFY_OK;
}
@@ -1297,7 +1321,11 @@ static int qpnp_oledb_regulator_probe(struct platform_device *pdev)
		return rc;
	}

	if (oledb->force_pd_control) {
	/* Enable LAB short circuit notification support */
	if (oledb->pmic_rev_id->pmic_subtype == PM660L_SUBTYPE)
		oledb->handle_lab_sc_notification = true;

	if (oledb->force_pd_control || oledb->handle_lab_sc_notification) {
		oledb->oledb_nb.notifier_call = qpnp_labibb_notifier_cb;
		rc = qpnp_labibb_notifier_register(&oledb->oledb_nb);
		if (rc < 0) {