Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: xhci-mtk: relax TT periodic bandwidth allocation

Currently uses the worst case byte budgets on FS/LS bus bandwidth,
for example, for an isochronos IN endpoint with 192 bytes budget, it
will consume the whole 5 uframes(188 * 5) while the actual FS bus
budget should be just 192 bytes. It cause that many usb audio headsets
with 3 interfaces (audio input, audio output, and HID) cannot be
configured.
To improve it, changes to use "approximate" best case budget for FS/LS
bandwidth management. For the same endpoint from the above example,
the approximate best case budget is now reduced to (188 * 2) bytes.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20220819080556.32215-1-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chunfeng Yun and committed by
Greg Kroah-Hartman
8b13ea05 c1e5c2f0

+2 -9
+2 -9
drivers/usb/host/xhci-mtk-sch.c
··· 425 425 426 426 static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset) 427 427 { 428 - u32 extra_cs_count; 429 428 u32 start_ss, last_ss; 430 429 u32 start_cs, last_cs; 431 430 ··· 460 461 if (last_cs > 7) 461 462 return -ESCH_CS_OVERFLOW; 462 463 463 - if (sch_ep->ep_type == ISOC_IN_EP) 464 - extra_cs_count = (last_cs == 7) ? 1 : 2; 465 - else /* ep_type : INTR IN / INTR OUT */ 466 - extra_cs_count = 1; 467 - 468 - cs_count += extra_cs_count; 469 464 if (cs_count > 7) 470 465 cs_count = 7; /* HW limit */ 471 466 472 467 sch_ep->cs_count = cs_count; 473 - /* one for ss, the other for idle */ 474 - sch_ep->num_budget_microframes = cs_count + 2; 468 + /* ss, idle are ignored */ 469 + sch_ep->num_budget_microframes = cs_count; 475 470 476 471 /* 477 472 * if interval=1, maxp >752, num_budge_micoframe is larger