Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3637015rdg; Wed, 18 Oct 2023 01:04:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlBMmSfS53PmII6oSbqqAiQmdGf6NQH5+alpQZ1supQeNHBBnCdq1JfzWqEOXUY8QRFU/9 X-Received: by 2002:a05:6358:cb14:b0:140:f00a:ee2c with SMTP id gr20-20020a056358cb1400b00140f00aee2cmr4769509rwb.11.1697616285273; Wed, 18 Oct 2023 01:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697616285; cv=none; d=google.com; s=arc-20160816; b=TC929X9066JcoqTNuYUDAXRke3uSgcJGM4bDhQCUEdlG/YxFMbNTPyPojPJnM8HrGb v3dndijoPVSmzW5qw2KrLuxsSxnf/WO70IV9sYcGMFDeQwY6BAg1t09fdf6eaV87ZZvV C+hMSVZw5oNtp2dNrmUavoTjWavlm6KhPyd9symeB/T/iW25v+H0aTV4C3EHG2TEwxeY AIBdWXAq1Ey9mHlaPMjz9FJretag1Uy+fXuuSI8aDYhZJQLN0HhFcs7+xhEXf0iAX5EZ Q3lkugK92FQDVher5BhuSUgoql3F/D+0F3Fd9so20V67/IxnqGcLWTuuBudUAR/9VYy3 pEOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Qjl63W16zpGNViO33uqzKNXBT6lNuVLuKag6ZCsNmGg=; fh=jDv7BnXALZwMfeSMFmS1YWq30xEQitXk6niufosSQ4s=; b=lEbWiQGLmrZGtmOT9nP9BStIeL1RAUDzyw2iJFVpDflmf989eAQxtIQUlogcKcvyuG dolzDkVzINmj66TOIPSRQob5cdMOpNHpI63CNtHEl2pkju8L6YSiENjpWw4hoSUi3gu7 OJEt7ayp2ZELmFkdYggsXC0sFrE4sdtoZjkndpQoRQrEFGgoAweQ+IhIFOfW9zcjjr7h 9BRqgzjbJ9kap6lR8hIKwcCbGwh/1q5sLSDn1WQFuJDvzOFEovdr5diTyIF2jW3D4/yj /rvLhGNC7cE0+2iC93x/SP7NymbrMPx7bkr+sFPcfdLJ2uADG37oaubEZ+GIKzPtfcfN WUVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rHUZvJGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id h11-20020a056a00170b00b0068e2d888713si3651926pfc.167.2023.10.18.01.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 01:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rHUZvJGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2996B8106F6D; Wed, 18 Oct 2023 01:04:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235065AbjJRIEc (ORCPT + 99 others); Wed, 18 Oct 2023 04:04:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229948AbjJRIEb (ORCPT ); Wed, 18 Oct 2023 04:04:31 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A891C101 for ; Wed, 18 Oct 2023 01:04:29 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1061C433C9; Wed, 18 Oct 2023 08:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697616269; bh=lEWI9sovEjua5wyv2AzGJds6zMhreikL8LH3EN5NVGE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rHUZvJGdnz6huIW+8MkUHjCMaph//qScKrFtRHsm4tO1E0AsmQCIjsqwxcS6/lo6Q 7h6rYSXrRxgpoAT0hhEbwiUBrXshjUQA1FpayDaoiGbtwXlTPCqeashxp3+ZbDwCAc LmLSPxF1H64KhheOI0FST5CVd1vlNapLueKUuwW8= Date: Wed, 18 Oct 2023 10:04:15 +0200 From: Greg KH To: Charles Yi Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] usb: gadget: f_uac1: add adaptive sync support for capture Message-ID: <2023101801-truth-sculpture-5dcb@gregkh> References: <20231018074739.1234394-1-be286@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231018074739.1234394-1-be286@163.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 01:04:42 -0700 (PDT) On Wed, Oct 18, 2023 at 03:47:39PM +0800, Charles Yi wrote: > UAC1 has it's own freerunning clock and can update Host about > real clock frequency through feedback endpoint so Host can align > number of samples sent to the UAC1 to prevent overruns/underruns. > > Change UAC1 driver to make it configurable through additional > 'c_sync' configfs file. > > Default remains 'asynchronous' with possibility to switch it > to 'adaptive'. > > Changes in V2: > - Updated the indentation of commit message. > > Signed-off-by: Charles Yi > --- > drivers/usb/gadget/function/f_uac1.c | 30 ++++++++++++++++++++++++++++ > drivers/usb/gadget/function/u_uac1.h | 2 ++ > 2 files changed, 32 insertions(+) > > diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c > index 6f0e1d803dc2..7a6fcb40bb46 100644 > --- a/drivers/usb/gadget/function/f_uac1.c > +++ b/drivers/usb/gadget/function/f_uac1.c > @@ -33,6 +33,8 @@ > #define FUOUT_EN(_opts) ((_opts)->c_mute_present \ > || (_opts)->c_volume_present) > > +#define EPOUT_FBACK_IN_EN(_opts) ((_opts)->c_sync == USB_ENDPOINT_SYNC_ASYNC) > + > struct f_uac1 { > struct g_audio g_audio; > u8 ac_intf, as_in_intf, as_out_intf; > @@ -227,6 +229,16 @@ static struct uac_iso_endpoint_descriptor as_iso_out_desc = { > .wLockDelay = cpu_to_le16(1), > }; > > +static struct usb_endpoint_descriptor as_fback_ep_desc = { > + .bLength = USB_DT_ENDPOINT_SIZE, > + .bDescriptorType = USB_DT_ENDPOINT, > + > + .bEndpointAddress = USB_DIR_IN, > + .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_USAGE_FEEDBACK, > + .wMaxPacketSize = cpu_to_le16(3), > + .bInterval = 1, > +}; > + > static struct uac_format_type_i_discrete_descriptor as_in_type_i_desc = { > .bLength = 0, /* filled on rate setup */ > .bDescriptorType = USB_DT_CS_INTERFACE, > @@ -280,6 +292,7 @@ static struct usb_descriptor_header *f_audio_desc[] = { > > (struct usb_descriptor_header *)&as_out_ep_desc, > (struct usb_descriptor_header *)&as_iso_out_desc, > + (struct usb_descriptor_header *)&as_fback_ep_desc, > > (struct usb_descriptor_header *)&as_in_interface_alt_0_desc, > (struct usb_descriptor_header *)&as_in_interface_alt_1_desc, > @@ -1107,6 +1120,9 @@ static void setup_descriptor(struct f_uac1_opts *opts) > f_audio_desc[i++] = USBDHDR(&as_out_type_i_desc); > f_audio_desc[i++] = USBDHDR(&as_out_ep_desc); > f_audio_desc[i++] = USBDHDR(&as_iso_out_desc); > + if (EPOUT_FBACK_IN_EN(opts)) { > + f_audio_desc[i++] = USBDHDR(&as_fback_ep_desc); > + } > } > if (EPIN_EN(opts)) { > f_audio_desc[i++] = USBDHDR(&as_in_interface_alt_0_desc); > @@ -1317,6 +1333,12 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f) > ac_header_desc->baInterfaceNr[ba_iface_id++] = status; > uac1->as_out_intf = status; > uac1->as_out_alt = 0; > + > + if (EPOUT_FBACK_IN_EN(audio_opts)) { > + as_out_ep_desc.bmAttributes = > + USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC; > + as_out_interface_alt_1_desc.bNumEndpoints++; > + } > } > > if (EPIN_EN(audio_opts)) { > @@ -1354,6 +1376,12 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f) > goto err_free_fu; > audio->out_ep = ep; > audio->out_ep->desc = &as_out_ep_desc; > + if (EPOUT_FBACK_IN_EN(audio_opts)) { > + audio->in_ep_fback = usb_ep_autoconfig(gadget, &as_fback_ep_desc); > + if (!audio->in_ep_fback) { > + goto err_free_fu; > + } > + } > } > > if (EPIN_EN(audio_opts)) { > @@ -1685,6 +1713,8 @@ static struct usb_function_instance *f_audio_alloc_inst(void) > > opts->req_number = UAC1_DEF_REQ_NUM; > > + opts->c_sync = UAC1_DEF_CSYNC; > + > snprintf(opts->function_name, sizeof(opts->function_name), "AC Interface"); > > return &opts->func_inst; > diff --git a/drivers/usb/gadget/function/u_uac1.h b/drivers/usb/gadget/function/u_uac1.h > index f7a616760e31..c6e2271e8cdd 100644 > --- a/drivers/usb/gadget/function/u_uac1.h > +++ b/drivers/usb/gadget/function/u_uac1.h > @@ -27,6 +27,7 @@ > #define UAC1_DEF_MAX_DB 0 /* 0 dB */ > #define UAC1_DEF_RES_DB (1*256) /* 1 dB */ > > +#define UAC1_DEF_CSYNC USB_ENDPOINT_SYNC_ASYNC > > struct f_uac1_opts { > struct usb_function_instance func_inst; > @@ -56,6 +57,7 @@ struct f_uac1_opts { > > struct mutex lock; > int refcnt; > + int c_sync; > }; > > #endif /* __U_UAC1_H */ > -- > 2.34.1 > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot