Skip to content

Commit

Permalink
usb: xhci-mtk: relax TT periodic bandwidth allocation
Browse files Browse the repository at this point in the history
commit 8b13ea0 upstream.

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>
  • Loading branch information
Chunfeng Yun authored and gregkh committed Sep 8, 2022
1 parent c548b99 commit 27102b3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions drivers/usb/host/xhci-mtk-sch.c
Expand Up @@ -476,7 +476,6 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)

static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
{
u32 extra_cs_count;
u32 start_ss, last_ss;
u32 start_cs, last_cs;

Expand Down Expand Up @@ -512,18 +511,12 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
if (last_cs > 7)
return -ESCH_CS_OVERFLOW;

if (sch_ep->ep_type == ISOC_IN_EP)
extra_cs_count = (last_cs == 7) ? 1 : 2;
else /* ep_type : INTR IN / INTR OUT */
extra_cs_count = 1;

cs_count += extra_cs_count;
if (cs_count > 7)
cs_count = 7; /* HW limit */

sch_ep->cs_count = cs_count;
/* one for ss, the other for idle */
sch_ep->num_budget_microframes = cs_count + 2;
/* ss, idle are ignored */
sch_ep->num_budget_microframes = cs_count;

/*
* if interval=1, maxp >752, num_budge_micoframe is larger
Expand Down

0 comments on commit 27102b3

Please sign in to comment.