Commit bcec9784 authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Felipe Balbi

usb: gadget: f_uac1: use defined constants as defaults

When configfs support is added the values in question will have to be
used in two different places. Substitute them with defined constants
to avoid duplicating 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 807dccdb
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#include "u_uac1.h" #include "u_uac1.h"
#define OUT_EP_MAX_PACKET_SIZE 200
static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value); static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value);
static int generic_get_cmd(struct usb_audio_control *con, u8 cmd); static int generic_get_cmd(struct usb_audio_control *con, u8 cmd);
...@@ -173,7 +171,7 @@ static struct usb_endpoint_descriptor as_out_ep_desc = { ...@@ -173,7 +171,7 @@ static struct usb_endpoint_descriptor as_out_ep_desc = {
.bEndpointAddress = USB_DIR_OUT, .bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_SYNC_ADAPTIVE .bmAttributes = USB_ENDPOINT_SYNC_ADAPTIVE
| USB_ENDPOINT_XFER_ISOC, | USB_ENDPOINT_XFER_ISOC,
.wMaxPacketSize = __constant_cpu_to_le16(OUT_EP_MAX_PACKET_SIZE), .wMaxPacketSize = cpu_to_le16(UAC1_OUT_EP_MAX_PACKET_SIZE),
.bInterval = 4, .bInterval = 4,
}; };
......
...@@ -23,6 +23,14 @@ ...@@ -23,6 +23,14 @@
#include "gadget_chips.h" #include "gadget_chips.h"
#define FILE_PCM_PLAYBACK "/dev/snd/pcmC0D0p"
#define FILE_PCM_CAPTURE "/dev/snd/pcmC0D0c"
#define FILE_CONTROL "/dev/snd/controlC0"
#define UAC1_OUT_EP_MAX_PACKET_SIZE 200
#define UAC1_REQ_COUNT 256
#define UAC1_AUDIO_BUF_SIZE 48000
/* /*
* This represents the USB side of an audio card device, managed by a USB * This represents the USB side of an audio card device, managed by a USB
* function which provides control and stream interfaces. * function which provides control and stream interfaces.
......
...@@ -54,9 +54,7 @@ static int c_ssize = UAC2_DEF_CSSIZE; ...@@ -54,9 +54,7 @@ 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)");
#else #else
#define FILE_PCM_PLAYBACK "/dev/snd/pcmC0D0p" #include "u_uac1.h"
#define FILE_PCM_CAPTURE "/dev/snd/pcmC0D0c"
#define FILE_CONTROL "/dev/snd/controlC0"
static char *fn_play = FILE_PCM_PLAYBACK; static char *fn_play = FILE_PCM_PLAYBACK;
module_param(fn_play, charp, S_IRUGO); module_param(fn_play, charp, S_IRUGO);
...@@ -70,16 +68,15 @@ static char *fn_cntl = FILE_CONTROL; ...@@ -70,16 +68,15 @@ static char *fn_cntl = FILE_CONTROL;
module_param(fn_cntl, charp, S_IRUGO); module_param(fn_cntl, charp, S_IRUGO);
MODULE_PARM_DESC(fn_cntl, "Control device file name"); MODULE_PARM_DESC(fn_cntl, "Control device file name");
#define OUT_EP_MAX_PACKET_SIZE 200 static int req_buf_size = UAC1_OUT_EP_MAX_PACKET_SIZE;
static int req_buf_size = OUT_EP_MAX_PACKET_SIZE;
module_param(req_buf_size, int, S_IRUGO); module_param(req_buf_size, int, S_IRUGO);
MODULE_PARM_DESC(req_buf_size, "ISO OUT endpoint request buffer size"); MODULE_PARM_DESC(req_buf_size, "ISO OUT endpoint request buffer size");
static int req_count = 256; static int req_count = UAC1_REQ_COUNT;
module_param(req_count, int, S_IRUGO); module_param(req_count, int, S_IRUGO);
MODULE_PARM_DESC(req_count, "ISO OUT endpoint request count"); MODULE_PARM_DESC(req_count, "ISO OUT endpoint request count");
static int audio_buf_size = 48000; static int audio_buf_size = UAC1_AUDIO_BUF_SIZE;
module_param(audio_buf_size, int, S_IRUGO); module_param(audio_buf_size, int, S_IRUGO);
MODULE_PARM_DESC(audio_buf_size, "Audio buffer size"); MODULE_PARM_DESC(audio_buf_size, "Audio buffer size");
#endif #endif
...@@ -111,10 +108,6 @@ static struct usb_function_instance *fi_uac1; ...@@ -111,10 +108,6 @@ static struct usb_function_instance *fi_uac1;
static struct usb_function *f_uac1; static struct usb_function *f_uac1;
#endif #endif
#ifdef CONFIG_GADGET_UAC1
#include "u_uac1.h"
#endif
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! /* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
......
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