Loading drivers/thermal/qpnp-adc-tm.c +83 −6 Original line number Diff line number Diff line Loading @@ -2231,6 +2231,71 @@ static int qpnp_adc_tm_disable_rearm_low_thresholds( } static int qpnp_adc_tm_read_status(struct qpnp_adc_tm_chip *chip) { int rc = 0, sensor_notify_num = 0, i = 0, sensor_num = 0; unsigned long flags; if (qpnp_adc_tm_is_valid(chip)) return -ENODEV; mutex_lock(&chip->adc->adc_lock); rc = qpnp_adc_tm_req_sts_check(chip); if (rc) { pr_err("adc-tm-tm req sts check failed with %d\n", rc); goto fail; } if (chip->th_info.adc_tm_high_enable) { spin_lock_irqsave(&chip->th_info.adc_tm_high_lock, flags); sensor_notify_num = chip->th_info.adc_tm_high_enable; chip->th_info.adc_tm_high_enable = 0; spin_unlock_irqrestore(&chip->th_info.adc_tm_high_lock, flags); while (i < chip->max_channels_available) { if ((sensor_notify_num & 0x1) == 1) { sensor_num = i; rc = qpnp_adc_tm_disable_rearm_high_thresholds( chip, sensor_num); if (rc < 0) { pr_err("rearm threshold failed\n"); goto fail; } } sensor_notify_num >>= 1; i++; } } if (chip->th_info.adc_tm_low_enable) { spin_lock_irqsave(&chip->th_info.adc_tm_low_lock, flags); sensor_notify_num = chip->th_info.adc_tm_low_enable; chip->th_info.adc_tm_low_enable = 0; spin_unlock_irqrestore(&chip->th_info.adc_tm_low_lock, flags); i = 0; while (i < chip->max_channels_available) { if ((sensor_notify_num & 0x1) == 1) { sensor_num = i; rc = qpnp_adc_tm_disable_rearm_low_thresholds( chip, sensor_num); if (rc < 0) { pr_err("rearm threshold failed\n"); goto fail; } } sensor_notify_num >>= 1; i++; } } fail: mutex_unlock(&chip->adc->adc_lock); if (rc < 0) atomic_dec(&chip->wq_cnt); return rc; } static int qpnp_adc_tm_hc_read_status(struct qpnp_adc_tm_chip *chip) { int rc = 0, sensor_num = 0; Loading Loading @@ -2300,9 +2365,15 @@ static void qpnp_adc_tm_high_thr_work(struct work_struct *work) pr_debug("thr:0x%x\n", chip->th_info.adc_tm_high_enable); if (!chip->adc_tm_hc) { rc = qpnp_adc_tm_read_status(chip); if (rc < 0) pr_err("adc-tm high thr work failed\n"); } else { rc = qpnp_adc_tm_hc_read_status(chip); if (rc < 0) pr_err("adc-tm-hc high thr work failed\n"); } } static irqreturn_t qpnp_adc_tm_high_thr_isr(int irq, void *data) Loading Loading @@ -2406,9 +2477,15 @@ static void qpnp_adc_tm_low_thr_work(struct work_struct *work) pr_debug("thr:0x%x\n", chip->th_info.adc_tm_low_enable); if (!chip->adc_tm_hc) { rc = qpnp_adc_tm_read_status(chip); if (rc < 0) pr_err("adc-tm low thr work failed\n"); } else { rc = qpnp_adc_tm_hc_read_status(chip); if (rc < 0) pr_err("adc-tm-hc low thr work failed\n"); } } static irqreturn_t qpnp_adc_tm_low_thr_isr(int irq, void *data) Loading Loading
drivers/thermal/qpnp-adc-tm.c +83 −6 Original line number Diff line number Diff line Loading @@ -2231,6 +2231,71 @@ static int qpnp_adc_tm_disable_rearm_low_thresholds( } static int qpnp_adc_tm_read_status(struct qpnp_adc_tm_chip *chip) { int rc = 0, sensor_notify_num = 0, i = 0, sensor_num = 0; unsigned long flags; if (qpnp_adc_tm_is_valid(chip)) return -ENODEV; mutex_lock(&chip->adc->adc_lock); rc = qpnp_adc_tm_req_sts_check(chip); if (rc) { pr_err("adc-tm-tm req sts check failed with %d\n", rc); goto fail; } if (chip->th_info.adc_tm_high_enable) { spin_lock_irqsave(&chip->th_info.adc_tm_high_lock, flags); sensor_notify_num = chip->th_info.adc_tm_high_enable; chip->th_info.adc_tm_high_enable = 0; spin_unlock_irqrestore(&chip->th_info.adc_tm_high_lock, flags); while (i < chip->max_channels_available) { if ((sensor_notify_num & 0x1) == 1) { sensor_num = i; rc = qpnp_adc_tm_disable_rearm_high_thresholds( chip, sensor_num); if (rc < 0) { pr_err("rearm threshold failed\n"); goto fail; } } sensor_notify_num >>= 1; i++; } } if (chip->th_info.adc_tm_low_enable) { spin_lock_irqsave(&chip->th_info.adc_tm_low_lock, flags); sensor_notify_num = chip->th_info.adc_tm_low_enable; chip->th_info.adc_tm_low_enable = 0; spin_unlock_irqrestore(&chip->th_info.adc_tm_low_lock, flags); i = 0; while (i < chip->max_channels_available) { if ((sensor_notify_num & 0x1) == 1) { sensor_num = i; rc = qpnp_adc_tm_disable_rearm_low_thresholds( chip, sensor_num); if (rc < 0) { pr_err("rearm threshold failed\n"); goto fail; } } sensor_notify_num >>= 1; i++; } } fail: mutex_unlock(&chip->adc->adc_lock); if (rc < 0) atomic_dec(&chip->wq_cnt); return rc; } static int qpnp_adc_tm_hc_read_status(struct qpnp_adc_tm_chip *chip) { int rc = 0, sensor_num = 0; Loading Loading @@ -2300,9 +2365,15 @@ static void qpnp_adc_tm_high_thr_work(struct work_struct *work) pr_debug("thr:0x%x\n", chip->th_info.adc_tm_high_enable); if (!chip->adc_tm_hc) { rc = qpnp_adc_tm_read_status(chip); if (rc < 0) pr_err("adc-tm high thr work failed\n"); } else { rc = qpnp_adc_tm_hc_read_status(chip); if (rc < 0) pr_err("adc-tm-hc high thr work failed\n"); } } static irqreturn_t qpnp_adc_tm_high_thr_isr(int irq, void *data) Loading Loading @@ -2406,9 +2477,15 @@ static void qpnp_adc_tm_low_thr_work(struct work_struct *work) pr_debug("thr:0x%x\n", chip->th_info.adc_tm_low_enable); if (!chip->adc_tm_hc) { rc = qpnp_adc_tm_read_status(chip); if (rc < 0) pr_err("adc-tm low thr work failed\n"); } else { rc = qpnp_adc_tm_hc_read_status(chip); if (rc < 0) pr_err("adc-tm-hc low thr work failed\n"); } } static irqreturn_t qpnp_adc_tm_low_thr_isr(int irq, void *data) Loading