diff mbox series

usb: typec: Added power_operation_mode_show type check when usb slowly detect

Message ID 1737442058-240190-1-git-send-email-fengchunguo@126.com (mailing list archive)
State New
Headers show
Series usb: typec: Added power_operation_mode_show type check when usb slowly detect | expand

Commit Message

fengchunguo@126.com Jan. 21, 2025, 6:47 a.m. UTC
From: Gary Feng <fengchunguo@126.com>

When the type of usb inserted one un-defined power mode, only 90mA
voltage, system panic sometime.So added the one condition for avioding it.

Reproduced:
1.Inserted usb cable for charging slowly.
2.System panic sometimes. The log:
Unexpected kernel BRK exception at EL1
msm-dwc3 4e00000.ssusb: DWC3 exited from low power mode
Internal error: BRK handler: 00000000f2005512 [#1] PREEMPT SMP
Skip md ftrace buffer dump for: 0x1609e0
Hardware name:Qualcomm Technologies, Inc. Blair QRD (DT)
pstate: a0400005 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : power_operation_mode_show+0x48/0x50
lr : dev_attr_show+0x38/0x74
sp : ffffffc015d83c00
x29: ffffffc015d83c00 x28: ffffff80517212c0 x27: 000000007ffff001
x26: 0000000000000001 x25: 0000000000000000 x24: ffffff801b9274f0
x23: ffffff805a9f1cc0 x22: ffffffda7b7a2608 x21: ffffff8050e99000
x20: ffffffda7c5fb5b0 x19: ffffff801b9274c8 x18: ffffffc01568d070
x17: 00000000df43c25c x16: 00000000df43c25c x15: 0000000000000000
x14: 0000000000000000 x13: ffffffa77aadf000 x12: ffffffda7c4a1210
x11: ffffff8050e99000 x10: 0000000000000000 x9 : ffffffda7ae948ac
x8 : 00000000fffffffa x7 : 0000000000000000 x6 : 000000000000003f
x5 : 0000000000000040 x4 : 0000000000000000 x3 : 0000000000000004
x2 : ffffff8050e99000 x1 : ffffffda7c5fb5b0 x0 : ffffff80858ca008
Call trace:
 power_operation_mode_show+0x48/0x50
 dev_attr_show+0x38/0x74
 sysfs_kf_seq_show+0xb4/0x130
 kernfs_seq_show+0x44/0x54
 seq_read_iter+0x158/0x4ec
 kernfs_fop_read_iter+0x68/0x1b0
 vfs_read+0x1d8/0x2b0
 ksys_read+0x78/0xe8
 __arm64_sys_read+0x1c/0x2c
 invoke_syscall+0x58/0x11c
 el0_svc_common+0xb4/0xf4
 do_el0_svc+0x2c/0xb0
 el0_svc+0x2c/0xa4
 el0t_64_sync_handler+0x68/0xb4
 el0t_64_sync+0x1a0/0x1a4
Code: 93407c00 a8c17bfd f85f8e5e d65f03c0 (d42aa240)
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: BRK handler: Fatal exception

Signed-off-by: Gary Feng <fengchunguo@126.com>
---
 drivers/usb/typec/class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heikki Krogerus Jan. 21, 2025, 9:25 a.m. UTC | #1
On Tue, Jan 21, 2025 at 02:47:38PM +0800, fengchunguo@126.com wrote:
> From: Gary Feng <fengchunguo@126.com>
> 
> When the type of usb inserted one un-defined power mode, only 90mA
> voltage, system panic sometime.So added the one condition for avioding it.
> 
> Reproduced:
> 1.Inserted usb cable for charging slowly.
> 2.System panic sometimes. The log:
> Unexpected kernel BRK exception at EL1
> msm-dwc3 4e00000.ssusb: DWC3 exited from low power mode
> Internal error: BRK handler: 00000000f2005512 [#1] PREEMPT SMP
> Skip md ftrace buffer dump for: 0x1609e0
> Hardware name:Qualcomm Technologies, Inc. Blair QRD (DT)
> pstate: a0400005 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : power_operation_mode_show+0x48/0x50
> lr : dev_attr_show+0x38/0x74
> sp : ffffffc015d83c00
> x29: ffffffc015d83c00 x28: ffffff80517212c0 x27: 000000007ffff001
> x26: 0000000000000001 x25: 0000000000000000 x24: ffffff801b9274f0
> x23: ffffff805a9f1cc0 x22: ffffffda7b7a2608 x21: ffffff8050e99000
> x20: ffffffda7c5fb5b0 x19: ffffff801b9274c8 x18: ffffffc01568d070
> x17: 00000000df43c25c x16: 00000000df43c25c x15: 0000000000000000
> x14: 0000000000000000 x13: ffffffa77aadf000 x12: ffffffda7c4a1210
> x11: ffffff8050e99000 x10: 0000000000000000 x9 : ffffffda7ae948ac
> x8 : 00000000fffffffa x7 : 0000000000000000 x6 : 000000000000003f
> x5 : 0000000000000040 x4 : 0000000000000000 x3 : 0000000000000004
> x2 : ffffff8050e99000 x1 : ffffffda7c5fb5b0 x0 : ffffff80858ca008
> Call trace:
>  power_operation_mode_show+0x48/0x50
>  dev_attr_show+0x38/0x74
>  sysfs_kf_seq_show+0xb4/0x130
>  kernfs_seq_show+0x44/0x54
>  seq_read_iter+0x158/0x4ec
>  kernfs_fop_read_iter+0x68/0x1b0
>  vfs_read+0x1d8/0x2b0
>  ksys_read+0x78/0xe8
>  __arm64_sys_read+0x1c/0x2c
>  invoke_syscall+0x58/0x11c
>  el0_svc_common+0xb4/0xf4
>  do_el0_svc+0x2c/0xb0
>  el0_svc+0x2c/0xa4
>  el0t_64_sync_handler+0x68/0xb4
>  el0t_64_sync+0x1a0/0x1a4
> Code: 93407c00 a8c17bfd f85f8e5e d65f03c0 (d42aa240)
> ---[ end trace 0000000000000000 ]---
> Kernel panic - not syncing: BRK handler: Fatal exception
> 
> Signed-off-by: Gary Feng <fengchunguo@126.com>
> ---
>  drivers/usb/typec/class.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 4b3047e..f2b0d5d 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -2163,7 +2163,7 @@ void typec_set_pwr_opmode(struct typec_port *port,
>  {
>  	struct device *partner_dev;
>  
> -	if (port->pwr_opmode == opmode)
> +	if ((port->pwr_opmode == opmode) || (opmode < TYPEC_PWR_MODE_USB))
>  		return;
>  
>  	port->pwr_opmode = opmode;

Which port driver is setting negative power opmode?

thanks,
diff mbox series

Patch

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 4b3047e..f2b0d5d 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -2163,7 +2163,7 @@  void typec_set_pwr_opmode(struct typec_port *port,
 {
 	struct device *partner_dev;
 
-	if (port->pwr_opmode == opmode)
+	if ((port->pwr_opmode == opmode) || (opmode < TYPEC_PWR_MODE_USB))
 		return;
 
 	port->pwr_opmode = opmode;