usb:gadget: f_uac1: fixed sync playback
authorPavel Hofman <pavel.hofman@ivitera.com>
Fri, 22 Oct 2021 14:03:39 +0000 (16:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Oct 2021 07:19:21 +0000 (09:19 +0200)
The u_audio param fb_max was not set to its default value in f_uac1.c.
As a result the maximum value of Playback Pitch ctl was kept at 1000000,
not allowing to set faster playback pitch for UAC1.

The setting required moving the default constant UAC2_DEF_FB_MAX from
u_uac2.h to FBACK_FAST_MAX in u_audio.h as that header is common for
f_uac1.c and f_uac2.c.

Fixes: 6fec018a7e70 ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback")
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20211022140339.248669-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_uac1.c
drivers/usb/gadget/function/f_uac2.c
drivers/usb/gadget/function/u_audio.h
drivers/usb/gadget/function/u_uac2.h

index 5b3502d..03f5064 100644 (file)
@@ -1321,6 +1321,7 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
                audio->params.c_fu.volume_res = audio_opts->c_volume_res;
        }
        audio->params.req_number = audio_opts->req_number;
+       audio->params.fb_max = FBACK_FAST_MAX;
        if (FUOUT_EN(audio_opts) || FUIN_EN(audio_opts))
                audio->notify = audio_notify;
 
index f892342..36fa6ef 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 
 #include "u_audio.h"
+
 #include "u_uac2.h"
 
 /* UAC2 spec: 4.1 Audio Channel Cluster Descriptor */
@@ -1932,7 +1933,7 @@ static struct usb_function_instance *afunc_alloc_inst(void)
        opts->c_volume_res = UAC2_DEF_RES_DB;
 
        opts->req_number = UAC2_DEF_REQ_NUM;
-       opts->fb_max = UAC2_DEF_FB_MAX;
+       opts->fb_max = FBACK_FAST_MAX;
        return &opts->func_inst;
 }
 
index 001a79a..8dfdae1 100644 (file)
 /*
  * Same maximum frequency deviation on the slower side as in
  * sound/usb/endpoint.c. Value is expressed in per-mil deviation.
- * The maximum deviation on the faster side will be provided as
- * parameter, as it impacts the endpoint required bandwidth.
  */
 #define FBACK_SLOW_MAX 250
 
+/*
+ * Maximum frequency deviation on the faster side, default value for UAC1/2.
+ * Value is expressed in per-mil deviation.
+ * UAC2 provides the value as a parameter as it impacts the endpoint required
+ * bandwidth.
+ */
+#define FBACK_FAST_MAX 5
+
 /* Feature Unit parameters */
 struct uac_fu_params {
        int id;                 /* Feature Unit ID */
index a73b357..e0c8e35 100644 (file)
@@ -30,7 +30,6 @@
 #define UAC2_DEF_RES_DB                (1*256)         /* 1 dB */
 
 #define UAC2_DEF_REQ_NUM 2
-#define UAC2_DEF_FB_MAX 5
 #define UAC2_DEF_INT_REQ_NUM   10
 
 struct f_uac2_opts {