Loading drivers/regulator/qpnp-oledb-regulator.c +30 −2 Original line number Diff line number Diff line Loading @@ -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}; Loading Loading @@ -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); Loading Loading @@ -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; } Loading Loading @@ -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) { Loading Loading
drivers/regulator/qpnp-oledb-regulator.c +30 −2 Original line number Diff line number Diff line Loading @@ -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}; Loading Loading @@ -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); Loading Loading @@ -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; } Loading Loading @@ -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) { Loading