Loading drivers/regulator/cpr-regulator.c +24 −3 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ #define REG_RBCPR_RESULT_0 0xA0 #define RBCPR_RESULT0_BUSY_SHIFT 19 #define RBCPR_RESULT0_BUSY_MASK BIT(RBCPR_RESULT0_BUSY_SHIFT) #define RBCPR_RESULT0_ERROR_LT0_SHIFT 18 #define RBCPR_RESULT0_ERROR_SHIFT 6 #define RBCPR_RESULT0_ERROR_BITS 12 Loading Loading @@ -402,6 +403,22 @@ static void cpr_ctl_disable(struct cpr_regulator *cpr_vreg) cpr_ctl_modify(cpr_vreg, RBCPR_CTL_LOOP_EN, 0); } static bool cpr_ctl_is_enabled(struct cpr_regulator *cpr_vreg) { u32 reg_val; reg_val = cpr_read(cpr_vreg, REG_RBCPR_CTL); return reg_val & RBCPR_CTL_LOOP_EN; } static bool cpr_ctl_is_busy(struct cpr_regulator *cpr_vreg) { u32 reg_val; reg_val = cpr_read(cpr_vreg, REG_RBCPR_RESULT_0); return reg_val & RBCPR_RESULT0_BUSY_MASK; } static void cpr_corner_save(struct cpr_regulator *cpr_vreg, int corner) { cpr_vreg->save_ctl[corner] = cpr_read(cpr_vreg, REG_RBCPR_CTL); Loading Loading @@ -750,7 +767,13 @@ static irqreturn_t cpr_irq_handler(int irq, void *dev) cpr_debug_irq("IRQ_STATUS = 0x%02X\n", reg_val); if (!cpr_is_allowed(cpr_vreg)) { if (!cpr_ctl_is_enabled(cpr_vreg)) { cpr_debug_irq("CPR is disabled\n"); goto _exit; } else if (cpr_ctl_is_busy(cpr_vreg)) { cpr_debug_irq("CPR measurement is not ready\n"); goto _exit; } else if (!cpr_is_allowed(cpr_vreg)) { reg_val = cpr_read(cpr_vreg, REG_RBCPR_CTL); pr_err("Interrupt broken? RBCPR_CTL = 0x%02X\n", reg_val); goto _exit; Loading Loading @@ -915,7 +938,6 @@ static int cpr_suspend(struct cpr_regulator *cpr_vreg) mutex_lock(&cpr_vreg->cpr_mutex); cpr_ctl_disable(cpr_vreg); disable_irq(cpr_vreg->cpr_irq); cpr_irq_clr(cpr_vreg); Loading @@ -935,7 +957,6 @@ static int cpr_resume(struct cpr_regulator *cpr_vreg) cpr_vreg->is_cpr_suspended = false; cpr_irq_clr(cpr_vreg); enable_irq(cpr_vreg->cpr_irq); cpr_ctl_enable(cpr_vreg, cpr_vreg->corner); mutex_unlock(&cpr_vreg->cpr_mutex); Loading Loading
drivers/regulator/cpr-regulator.c +24 −3 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ #define REG_RBCPR_RESULT_0 0xA0 #define RBCPR_RESULT0_BUSY_SHIFT 19 #define RBCPR_RESULT0_BUSY_MASK BIT(RBCPR_RESULT0_BUSY_SHIFT) #define RBCPR_RESULT0_ERROR_LT0_SHIFT 18 #define RBCPR_RESULT0_ERROR_SHIFT 6 #define RBCPR_RESULT0_ERROR_BITS 12 Loading Loading @@ -402,6 +403,22 @@ static void cpr_ctl_disable(struct cpr_regulator *cpr_vreg) cpr_ctl_modify(cpr_vreg, RBCPR_CTL_LOOP_EN, 0); } static bool cpr_ctl_is_enabled(struct cpr_regulator *cpr_vreg) { u32 reg_val; reg_val = cpr_read(cpr_vreg, REG_RBCPR_CTL); return reg_val & RBCPR_CTL_LOOP_EN; } static bool cpr_ctl_is_busy(struct cpr_regulator *cpr_vreg) { u32 reg_val; reg_val = cpr_read(cpr_vreg, REG_RBCPR_RESULT_0); return reg_val & RBCPR_RESULT0_BUSY_MASK; } static void cpr_corner_save(struct cpr_regulator *cpr_vreg, int corner) { cpr_vreg->save_ctl[corner] = cpr_read(cpr_vreg, REG_RBCPR_CTL); Loading Loading @@ -750,7 +767,13 @@ static irqreturn_t cpr_irq_handler(int irq, void *dev) cpr_debug_irq("IRQ_STATUS = 0x%02X\n", reg_val); if (!cpr_is_allowed(cpr_vreg)) { if (!cpr_ctl_is_enabled(cpr_vreg)) { cpr_debug_irq("CPR is disabled\n"); goto _exit; } else if (cpr_ctl_is_busy(cpr_vreg)) { cpr_debug_irq("CPR measurement is not ready\n"); goto _exit; } else if (!cpr_is_allowed(cpr_vreg)) { reg_val = cpr_read(cpr_vreg, REG_RBCPR_CTL); pr_err("Interrupt broken? RBCPR_CTL = 0x%02X\n", reg_val); goto _exit; Loading Loading @@ -915,7 +938,6 @@ static int cpr_suspend(struct cpr_regulator *cpr_vreg) mutex_lock(&cpr_vreg->cpr_mutex); cpr_ctl_disable(cpr_vreg); disable_irq(cpr_vreg->cpr_irq); cpr_irq_clr(cpr_vreg); Loading @@ -935,7 +957,6 @@ static int cpr_resume(struct cpr_regulator *cpr_vreg) cpr_vreg->is_cpr_suspended = false; cpr_irq_clr(cpr_vreg); enable_irq(cpr_vreg->cpr_irq); cpr_ctl_enable(cpr_vreg, cpr_vreg->corner); mutex_unlock(&cpr_vreg->cpr_mutex); Loading