Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3520384pxf; Mon, 15 Mar 2021 11:22:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrrJb8DfpHdbuw7+5TaaJFPPhiIfO+NEyJ7zzgsy6Qp21rDklSeJqG5s7IX9v8LZuJEYpd X-Received: by 2002:a17:906:1113:: with SMTP id h19mr24806073eja.478.1615832574697; Mon, 15 Mar 2021 11:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832574; cv=none; d=google.com; s=arc-20160816; b=L2PQSYFM5LFGO0LYBlpIiUppzdV/5pUm20Xj/qiHlKUmhvwbC1749AtUikZfruJIbr mdPyxw8X1qObSaj4dZhOC/QlCQkj3Ym5jMVcvFhAHNSUUgbN+g5bei72hiabhV3MCi2N CjU9rUQyiswj5a9b4wr0/+hGQF8nLUdUKKg/l/soVh2pv20U+gbjDMNWAXhLDgV1ZgVq 8ijM9x0nvWSiyvZkwUc0kVjrtnGhDhorpVv4FmVesuQd1omRrKV5SGbHU2gGqWqKvfux IZAozAkz2+sSByA4ErD/mI2rRS5cJW3upZ2zzrrjzx62uaZRNWdB+4TD3qXvHBku1Krk kUWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=75KfgEBnYYqEs/GpTU1ck1bs03t8E5hb3Tn5vLvRm8I=; b=VNKgP3ROmvQxUJTjdkVYce/kGlBo8Z0F00dwn5nA2CFj6tzS1KPgnsAoHS/v5O0zVt f0noIbx5TP11JLH0Si2/6aU9ybf7AbgdcrBD1tI0UzeI4L6hJvr6v5TW7QelAZ7TzWNA u2zWtc58vGpm18aDqVzZUUoh1rIGVz2EXneQlxIrdT26DsfXUsGIcVLnfob8PpB1gMsX pu6nueA2lpxRFOg5b3SDWIVRWZnoIa6buozb/TpQDQsw/6+sDIEqEfbBc3DqC/71YfUI Or0IGN2EuChcgrZmQ/qVfd1Nck4RVchRy8o7atd8o61gk9GlqwkitgyNQYfk5ls3ims0 qsRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CmvhO7bA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si11170691edq.326.2021.03.15.11.22.32; Mon, 15 Mar 2021 11:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CmvhO7bA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237832AbhCOOWJ (ORCPT + 99 others); Mon, 15 Mar 2021 10:22:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232910AbhCOOAJ (ORCPT ); Mon, 15 Mar 2021 10:00:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5D41B64FA9; Mon, 15 Mar 2021 13:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816794; bh=LbGxFmVQStseu6Vfh+ceI5PzXi6WjKjSvnUMw8vGrkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CmvhO7bAvPeleKnJRW9jsomJj536l45l9u2opPTK/tHxT7DctKKccFD0DvrV4qXt/ D2w0HplYLeZQ8WJ64GICiPx8aTwZTkw+AV7HgtTFwyVQHnG+VB6+vTDv6zz9V2wNhs J1qB1HOhWwSTqHPzWkk76HWT85foRb0VdRUshPhI= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Ruslan Bilovol Subject: [PATCH 4.19 072/120] usb: gadget: f_uac2: always increase endpoint max_packet_size by one audio slot Date: Mon, 15 Mar 2021 14:57:03 +0100 Message-Id: <20210315135722.337953324@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Ruslan Bilovol commit 789ea77310f0200c84002884ffd628e2baf3ad8a upstream. As per UAC2 Audio Data Formats spec (2.3.1.1 USB Packets), if the sampling rate is a constant, the allowable variation of number of audio slots per virtual frame is +/- 1 audio slot. It means that endpoint should be able to accept/send +1 audio slot. Previous endpoint max_packet_size calculation code was adding sometimes +1 audio slot due to DIV_ROUND_UP behaviour which was rounding up to closest integer. However this doesn't work if the numbers are divisible. It had no any impact with Linux hosts which ignore this issue, but in case of more strict Windows it caused rejected enumeration Thus always add +1 audio slot to endpoint's max packet size Fixes: 913e4a90b6f9 ("usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth") Cc: Peter Chen Cc: #v4.3+ Signed-off-by: Ruslan Bilovol Link: https://lore.kernel.org/r/1614599375-8803-2-git-send-email-ruslan.bilovol@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_uac2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -482,7 +482,7 @@ static int set_ep_max_packet_size(const } max_size_bw = num_channels(chmask) * ssize * - DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))); + ((srate / (factor / (1 << (ep_desc->bInterval - 1)))) + 1); ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw, max_size_ep));