Commit 72468c58 authored by Elias Rudberg's avatar Elias Rudberg Committed by Guido Gunther
Browse files

usb: typec: Change power status check in tps6598x_interrupt

Since power status can change not only when
TPS_REG_INT_POWER_STATUS_UPDATE is set but also when
TPS_REG_INT_PP_SWITCH_CHANGED is set, check for power
status change also in the TPS_REG_INT_PP_SWITCH_CHANGED
case. In this way we detect power status change in some
cases where it was earlier undetected.

Fixes #250 and #291

Signed-off-by: Elias Rudberg's avatarElias Rudberg <mail@eliasrudberg.se>
parent e6354349
Pipeline #69167 passed with stage
in 61 minutes and 32 seconds
......@@ -609,7 +609,14 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
}
trace_tps6598x_status(status);
if ((event1 | event2) & TPS_REG_INT_POWER_STATUS_UPDATE) {
/*
* In practice it seems like pwr_status can change also if the
* TPS_REG_INT_PP_SWITCH_CHANGED bit is set, so we interpret
* either of the TPS_REG_INT_POWER_STATUS_UPDATE or
* TPS_REG_INT_PP_SWITCH_CHANGED bits being set as a possible
* power status change.
*/
if ((event1 | event2) & (TPS_REG_INT_POWER_STATUS_UPDATE | TPS_REG_INT_PP_SWITCH_CHANGED)) {
ret = tps6598x_read16(tps, TPS_REG_POWER_STATUS, &pwr_status);
if (ret < 0) {
dev_err(tps->dev, "failed to read power status: %d\n", ret);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment