power: bq2597x_mmi_iio: Read cp_switch status

* Commit c22b699 fixed the logic for the state machine, but inadvertently brought up an issue on Rhodep
* Unlike with bq2598x, the cp_switch status is not propagated to the dicrete_turbo_charger sm
* This causes much of the same issue we saw in Miami, as such propagate the switch status to the sm

Change-Id: Ibc68c1c8746fddd85a23fa7b5cb053cbbcc5eeec
This commit is contained in:
marcost2 2025-05-25 19:45:00 -03:00 • committed by Marcos Tolcachir
commit 0b3ee6dd15

View file

@ -96,6 +96,7 @@ enum {
#define BAT_THERM_FAULT_SHIFT 12
#define BUS_THERM_FAULT_SHIFT 13
#define DIE_THERM_FAULT_SHIFT 14
#define CP_SWITCH_SHIFT 18
#define BAT_OVP_FAULT_MASK (1 << BAT_OVP_FAULT_SHIFT)
#define BAT_OCP_FAULT_MASK (1 << BAT_OCP_FAULT_SHIFT)
@ -233,6 +234,8 @@ struct bq2597x {
bool therm_shutdown_flag;
bool therm_shutdown_stat;
bool cp_switch;
bool vbat_reg;
bool ibat_reg;
@ -2045,7 +2048,8 @@ static int bq2597x_iio_read_raw(struct iio_dev *indio_dev,
| (bq->bus_ocp_fault << BUS_OCP_FAULT_SHIFT)
| (bq->bat_therm_fault << BAT_THERM_FAULT_SHIFT)
| (bq->bus_therm_fault << BUS_THERM_FAULT_SHIFT)
| (bq->die_therm_fault << DIE_THERM_FAULT_SHIFT));
| (bq->die_therm_fault << DIE_THERM_FAULT_SHIFT)
| (bq->cp_switch << CP_SWITCH_SHIFT));
break;
default:
@ -2176,6 +2180,8 @@ static void bq2597x_check_alarm_status(struct bq2597x *bq)
if (!ret && (stat & 0x02))
pr_err("Reg[0A]CONV_OCP = 0x%02X\n", stat);
bq->cp_switch = !!(stat & BQ2597X_CONV_SWITCHING_STAT_MASK);
mutex_unlock(&bq->data_lock);
if (changed)