Skip to content

Commit 90baa40

Browse files
amitsd2gregkh
authored andcommitted
usb: typec: maxim_contaminant: disable low power mode when reading comparator values
commit cabb6c5 upstream. Low power mode is enabled when reading CC resistance as part of `max_contaminant_read_resistance_kohm()` and left in that state. However, it's supposed to work with 1uA current source. To read CC comparator values current source is changed to 80uA. This causes a storm of CC interrupts as it (falsely) detects a potential contaminant. To prevent this, disable low power mode current sourcing before reading comparator values. Fixes: 02b332a ("usb: typec: maxim_contaminant: Implement check_contaminant callback") Cc: stable <stable@kernel.org> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> Reviewed-by: Badhri Jagan Sridharan <badhri@google.com> Link: https://lore.kernel.org/stable/20250814-fix-upstream-contaminant-v1-1-801ce8089031%40google.com Link: https://lore.kernel.org/r/20250815-fix-upstream-contaminant-v2-1-6c8d6c3adafb@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fe682f5 commit 90baa40

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/usb/typec/tcpm/maxim_contaminant.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ static int max_contaminant_read_comparators(struct max_tcpci_chip *chip, u8 *ven
188188
if (ret < 0)
189189
return ret;
190190

191+
/* Disable low power mode */
192+
ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCLPMODESEL,
193+
FIELD_PREP(CCLPMODESEL,
194+
LOW_POWER_MODE_DISABLE));
195+
191196
/* Sleep to allow comparators settle */
192197
usleep_range(5000, 6000);
193198
ret = regmap_update_bits(regmap, TCPC_TCPC_CTRL, TCPC_TCPC_CTRL_ORIENTATION, PLUG_ORNT_CC1);

drivers/usb/typec/tcpm/tcpci_maxim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define CCOVPDIS BIT(6)
2222
#define SBURPCTRL BIT(5)
2323
#define CCLPMODESEL GENMASK(4, 3)
24+
#define LOW_POWER_MODE_DISABLE 0
2425
#define ULTRA_LOW_POWER_MODE 1
2526
#define CCRPCTRL GENMASK(2, 0)
2627
#define UA_1_SRC 1

0 commit comments

Comments
 (0)