Skip to content

Commit d9f2734

Browse files
pavhofmangregkh
authored andcommitted
usb:gadget: f_uac1: fixed sync playback
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: 6fec018 ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback") Signed-off-by: Pavel Hofman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 33ef298 commit d9f2734

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

drivers/usb/gadget/function/f_uac1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
13211321
audio->params.c_fu.volume_res = audio_opts->c_volume_res;
13221322
}
13231323
audio->params.req_number = audio_opts->req_number;
1324+
audio->params.fb_max = FBACK_FAST_MAX;
13241325
if (FUOUT_EN(audio_opts) || FUIN_EN(audio_opts))
13251326
audio->notify = audio_notify;
13261327

drivers/usb/gadget/function/f_uac2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/module.h>
1616

1717
#include "u_audio.h"
18+
1819
#include "u_uac2.h"
1920

2021
/* UAC2 spec: 4.1 Audio Channel Cluster Descriptor */
@@ -1932,7 +1933,7 @@ static struct usb_function_instance *afunc_alloc_inst(void)
19321933
opts->c_volume_res = UAC2_DEF_RES_DB;
19331934

19341935
opts->req_number = UAC2_DEF_REQ_NUM;
1935-
opts->fb_max = UAC2_DEF_FB_MAX;
1936+
opts->fb_max = FBACK_FAST_MAX;
19361937
return &opts->func_inst;
19371938
}
19381939

drivers/usb/gadget/function/u_audio.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@
1414
/*
1515
* Same maximum frequency deviation on the slower side as in
1616
* sound/usb/endpoint.c. Value is expressed in per-mil deviation.
17-
* The maximum deviation on the faster side will be provided as
18-
* parameter, as it impacts the endpoint required bandwidth.
1917
*/
2018
#define FBACK_SLOW_MAX 250
2119

20+
/*
21+
* Maximum frequency deviation on the faster side, default value for UAC1/2.
22+
* Value is expressed in per-mil deviation.
23+
* UAC2 provides the value as a parameter as it impacts the endpoint required
24+
* bandwidth.
25+
*/
26+
#define FBACK_FAST_MAX 5
27+
2228
/* Feature Unit parameters */
2329
struct uac_fu_params {
2430
int id; /* Feature Unit ID */

drivers/usb/gadget/function/u_uac2.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#define UAC2_DEF_RES_DB (1*256) /* 1 dB */
3131

3232
#define UAC2_DEF_REQ_NUM 2
33-
#define UAC2_DEF_FB_MAX 5
3433
#define UAC2_DEF_INT_REQ_NUM 10
3534

3635
struct f_uac2_opts {

0 commit comments

Comments
 (0)