All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: legacy: audio: add c_sync parameter
@ 2021-09-13  2:47 Yoshihiro Shimoda
  2021-09-13  5:52 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Yoshihiro Shimoda @ 2021-09-13  2:47 UTC (permalink / raw)
  To: balbi; +Cc: gregkh, linux-usb, linux-renesas-soc, Yoshihiro Shimoda

The commit 40c73b30546e ("usb: gadget: f_uac2: add adaptive sync
support for capture") supported 'c_sync' for configfs file.
To configure the 'c_sync' via legacy audio driver, add c_sync
parameter. And then, we can change the 'c_sync' to 'ADAPTIVE' like
below:

    modprobe g_audio c_sync=8

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/gadget/legacy/audio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c
index a748ed0842e8..f9765bf63006 100644
--- a/drivers/usb/gadget/legacy/audio.c
+++ b/drivers/usb/gadget/legacy/audio.c
@@ -49,6 +49,11 @@ MODULE_PARM_DESC(c_srate, "Capture Sampling Rate");
 static int c_ssize = UAC2_DEF_CSSIZE;
 module_param(c_ssize, uint, S_IRUGO);
 MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)");
+
+/* Capture Default ASYNC */
+static int c_sync = UAC2_DEF_CSYNC;
+module_param(c_sync, uint, S_IRUGO);
+MODULE_PARM_DESC(c_sync, "Capture Sync Type");
 #else
 #ifndef CONFIG_GADGET_UAC1_LEGACY
 #include "u_uac1.h"
@@ -268,6 +273,8 @@ static int audio_bind(struct usb_composite_dev *cdev)
 	uac2_opts->c_chmask = c_chmask;
 	uac2_opts->c_srate = c_srate;
 	uac2_opts->c_ssize = c_ssize;
+	if (c_sync == USB_ENDPOINT_SYNC_ADAPTIVE)
+		uac2_opts->c_sync = c_sync;
 	uac2_opts->req_number = UAC2_DEF_REQ_NUM;
 #else
 #ifndef CONFIG_GADGET_UAC1_LEGACY
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: gadget: legacy: audio: add c_sync parameter
  2021-09-13  2:47 [PATCH] usb: gadget: legacy: audio: add c_sync parameter Yoshihiro Shimoda
@ 2021-09-13  5:52 ` Greg KH
  2021-09-13  7:12   ` Yoshihiro Shimoda
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-09-13  5:52 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: balbi, linux-usb, linux-renesas-soc

On Mon, Sep 13, 2021 at 11:47:23AM +0900, Yoshihiro Shimoda wrote:
> The commit 40c73b30546e ("usb: gadget: f_uac2: add adaptive sync
> support for capture") supported 'c_sync' for configfs file.
> To configure the 'c_sync' via legacy audio driver, add c_sync
> parameter. And then, we can change the 'c_sync' to 'ADAPTIVE' like
> below:
> 
>     modprobe g_audio c_sync=8
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/usb/gadget/legacy/audio.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c
> index a748ed0842e8..f9765bf63006 100644
> --- a/drivers/usb/gadget/legacy/audio.c
> +++ b/drivers/usb/gadget/legacy/audio.c
> @@ -49,6 +49,11 @@ MODULE_PARM_DESC(c_srate, "Capture Sampling Rate");
>  static int c_ssize = UAC2_DEF_CSSIZE;
>  module_param(c_ssize, uint, S_IRUGO);
>  MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)");
> +
> +/* Capture Default ASYNC */
> +static int c_sync = UAC2_DEF_CSYNC;
> +module_param(c_sync, uint, S_IRUGO);
> +MODULE_PARM_DESC(c_sync, "Capture Sync Type");

Please do not add new module parameters when ever possible.

Why are you adding "new" features to the legacy driver?  Why can you not
just use the newer driver instead if you want this feature?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] usb: gadget: legacy: audio: add c_sync parameter
  2021-09-13  5:52 ` Greg KH
@ 2021-09-13  7:12   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 3+ messages in thread
From: Yoshihiro Shimoda @ 2021-09-13  7:12 UTC (permalink / raw)
  To: Greg KH; +Cc: balbi, linux-usb, linux-renesas-soc

Hi Greg,

> From: Greg KH, Sent: Monday, September 13, 2021 2:52 PM
> 
> On Mon, Sep 13, 2021 at 11:47:23AM +0900, Yoshihiro Shimoda wrote:
> > The commit 40c73b30546e ("usb: gadget: f_uac2: add adaptive sync
> > support for capture") supported 'c_sync' for configfs file.
> > To configure the 'c_sync' via legacy audio driver, add c_sync
> > parameter. And then, we can change the 'c_sync' to 'ADAPTIVE' like
> > below:
> >
> >     modprobe g_audio c_sync=8
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  drivers/usb/gadget/legacy/audio.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c
> > index a748ed0842e8..f9765bf63006 100644
> > --- a/drivers/usb/gadget/legacy/audio.c
> > +++ b/drivers/usb/gadget/legacy/audio.c
> > @@ -49,6 +49,11 @@ MODULE_PARM_DESC(c_srate, "Capture Sampling Rate");
> >  static int c_ssize = UAC2_DEF_CSSIZE;
> >  module_param(c_ssize, uint, S_IRUGO);
> >  MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)");
> > +
> > +/* Capture Default ASYNC */
> > +static int c_sync = UAC2_DEF_CSYNC;
> > +module_param(c_sync, uint, S_IRUGO);
> > +MODULE_PARM_DESC(c_sync, "Capture Sync Type");
> 
> Please do not add new module parameters when ever possible.

I got it.

> Why are you adding "new" features to the legacy driver?  Why can you not
> just use the newer driver instead if you want this feature?

I can use the newer driver (configfs-base), but using the legacy driver
was easy to me. However, I'll use the newer driver instead from now on.

Best regards,
Yoshihiro Shimoda


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-13  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  2:47 [PATCH] usb: gadget: legacy: audio: add c_sync parameter Yoshihiro Shimoda
2021-09-13  5:52 ` Greg KH
2021-09-13  7:12   ` Yoshihiro Shimoda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.