Commit 065a107c authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Felipe Balbi

usb: gadget: f_uac2: use defined constants as defaults

When configfs is integrated the same values will have to be used
as defaults. Use symbolic names in order not to duplicate magic numbers.
Tested-by: default avatarSebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent f408757f
...@@ -18,6 +18,13 @@ ...@@ -18,6 +18,13 @@
#include <linux/usb/composite.h> #include <linux/usb/composite.h>
#define UAC2_DEF_PCHMASK 0x3
#define UAC2_DEF_PSRATE 48000
#define UAC2_DEF_PSSIZE 2
#define UAC2_DEF_CCHMASK 0x3
#define UAC2_DEF_CSRATE 64000
#define UAC2_DEF_CSSIZE 2
struct f_uac2_opts { struct f_uac2_opts {
struct usb_function_instance func_inst; struct usb_function_instance func_inst;
int p_chmask; int p_chmask;
......
...@@ -22,33 +22,35 @@ ...@@ -22,33 +22,35 @@
USB_GADGET_COMPOSITE_OPTIONS(); USB_GADGET_COMPOSITE_OPTIONS();
#ifndef CONFIG_GADGET_UAC1 #ifndef CONFIG_GADGET_UAC1
#include "u_uac2.h"
/* Playback(USB-IN) Default Stereo - Fl/Fr */ /* Playback(USB-IN) Default Stereo - Fl/Fr */
static int p_chmask = 0x3; static int p_chmask = UAC2_DEF_PCHMASK;
module_param(p_chmask, uint, S_IRUGO); module_param(p_chmask, uint, S_IRUGO);
MODULE_PARM_DESC(p_chmask, "Playback Channel Mask"); MODULE_PARM_DESC(p_chmask, "Playback Channel Mask");
/* Playback Default 48 KHz */ /* Playback Default 48 KHz */
static int p_srate = 48000; static int p_srate = UAC2_DEF_PSRATE;
module_param(p_srate, uint, S_IRUGO); module_param(p_srate, uint, S_IRUGO);
MODULE_PARM_DESC(p_srate, "Playback Sampling Rate"); MODULE_PARM_DESC(p_srate, "Playback Sampling Rate");
/* Playback Default 16bits/sample */ /* Playback Default 16bits/sample */
static int p_ssize = 2; static int p_ssize = UAC2_DEF_PSSIZE;
module_param(p_ssize, uint, S_IRUGO); module_param(p_ssize, uint, S_IRUGO);
MODULE_PARM_DESC(p_ssize, "Playback Sample Size(bytes)"); MODULE_PARM_DESC(p_ssize, "Playback Sample Size(bytes)");
/* Capture(USB-OUT) Default Stereo - Fl/Fr */ /* Capture(USB-OUT) Default Stereo - Fl/Fr */
static int c_chmask = 0x3; static int c_chmask = UAC2_DEF_CCHMASK;
module_param(c_chmask, uint, S_IRUGO); module_param(c_chmask, uint, S_IRUGO);
MODULE_PARM_DESC(c_chmask, "Capture Channel Mask"); MODULE_PARM_DESC(c_chmask, "Capture Channel Mask");
/* Capture Default 64 KHz */ /* Capture Default 64 KHz */
static int c_srate = 64000; static int c_srate = UAC2_DEF_CSRATE;
module_param(c_srate, uint, S_IRUGO); module_param(c_srate, uint, S_IRUGO);
MODULE_PARM_DESC(c_srate, "Capture Sampling Rate"); MODULE_PARM_DESC(c_srate, "Capture Sampling Rate");
/* Capture Default 16bits/sample */ /* Capture Default 16bits/sample */
static int c_ssize = 2; static int c_ssize = UAC2_DEF_CSSIZE;
module_param(c_ssize, uint, S_IRUGO); module_param(c_ssize, uint, S_IRUGO);
MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)"); MODULE_PARM_DESC(c_ssize, "Capture Sample Size(bytes)");
#endif #endif
...@@ -81,8 +83,6 @@ static struct usb_function *f_uac2; ...@@ -81,8 +83,6 @@ static struct usb_function *f_uac2;
#include "u_uac1.h" #include "u_uac1.h"
#include "u_uac1.c" #include "u_uac1.c"
#include "f_uac1.c" #include "f_uac1.c"
#else
#include "u_uac2.h"
#endif #endif
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment