* [PATCH 0/2] g_ffs CDC ACM support
@ 2013-08-16 15:27 Matt Porter
2013-08-16 15:27 ` [PATCH 1/2] usb: gadget: ffs: fix eth module parameters warning in pure-only config Matt Porter
2013-08-16 15:27 ` [PATCH 2/2] usb: gadget: ffs: add ACM + FunctionFS configuration Matt Porter
0 siblings, 2 replies; 5+ messages in thread
From: Matt Porter @ 2013-08-16 15:27 UTC (permalink / raw)
To: Felipe Balbi
Cc: Greg Kroah-Hartman, Linux USB List, Linux Kernel Mailing List,
Linaro Patches
This series fixes a build warning from USB Ethernet module parameters
in g_ffs and adds an additional configuration for CDC ACM + FunctionFS.
Matt Porter (2):
usb: gadget: ffs: fix eth module parameters warning in pure-only
config
usb: gadget: ffs: add ACM + FunctionFS configuration
drivers/usb/gadget/Kconfig | 9 ++++++
drivers/usb/gadget/g_ffs.c | 74 ++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 81 insertions(+), 2 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] usb: gadget: ffs: fix eth module parameters warning in pure-only config
2013-08-16 15:27 [PATCH 0/2] g_ffs CDC ACM support Matt Porter
@ 2013-08-16 15:27 ` Matt Porter
2013-08-16 15:27 ` [PATCH 2/2] usb: gadget: ffs: add ACM + FunctionFS configuration Matt Porter
1 sibling, 0 replies; 5+ messages in thread
From: Matt Porter @ 2013-08-16 15:27 UTC (permalink / raw)
To: Felipe Balbi
Cc: Greg Kroah-Hartman, Linux USB List, Linux Kernel Mailing List,
Linaro Patches
Fixes the build warning spewed out by USB_ETHERNET_MODULE_PARAMETERS()
which was unconditionally included even when ethernet configs are
disabled.
Signed-off-by: Matt Porter <matt.porter@linaro.org>
---
drivers/usb/gadget/g_ffs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index 5327c82..686b776 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -45,6 +45,7 @@ static struct eth_dev *the_dev;
static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
struct eth_dev *dev);
# endif
+USB_ETHERNET_MODULE_PARAMETERS();
#else
# define the_dev NULL
# define gether_cleanup(dev) do { } while (0)
@@ -76,8 +77,6 @@ struct gfs_ffs_obj {
USB_GADGET_COMPOSITE_OPTIONS();
-USB_ETHERNET_MODULE_PARAMETERS();
-
static struct usb_device_descriptor gfs_dev_desc = {
.bLength = sizeof gfs_dev_desc,
.bDescriptorType = USB_DT_DEVICE,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] usb: gadget: ffs: add ACM + FunctionFS configuration
2013-08-16 15:27 [PATCH 0/2] g_ffs CDC ACM support Matt Porter
2013-08-16 15:27 ` [PATCH 1/2] usb: gadget: ffs: fix eth module parameters warning in pure-only config Matt Porter
@ 2013-08-16 15:27 ` Matt Porter
2013-08-16 15:32 ` Felipe Balbi
1 sibling, 1 reply; 5+ messages in thread
From: Matt Porter @ 2013-08-16 15:27 UTC (permalink / raw)
To: Felipe Balbi
Cc: Greg Kroah-Hartman, Linux USB List, Linux Kernel Mailing List,
Linaro Patches
Adds an additional configuration to g_ffs to allow for
CDC ACM support in conjuction with FunctionFS. A module
parameter is added to allow for multiple ACM ports to
be instantiated.
Signed-off-by: Matt Porter <matt.porter@linaro.org>
---
drivers/usb/gadget/Kconfig | 9 ++++++
drivers/usb/gadget/g_ffs.c | 71 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 1292a82..fa3c845 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -882,6 +882,15 @@ config USB_FUNCTIONFS_RNDIS
help
Include a configuration with RNDIS function (Ethernet) and the Filesystem.
+config USB_FUNCTIONFS_ACM
+ bool "Include configuration with CDC ACM (Serial)"
+ depends on USB_FUNCTIONFS
+ select USB_U_SERIAL
+ select USB_F_ACM
+ help
+ Include a configuration with CDC ACM function (Serial) and the
+ Function Filesystem.
+
config USB_FUNCTIONFS_GENERIC
bool "Include 'pure' configuration"
depends on USB_FUNCTIONFS
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index 686b776..0849d3c 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -53,6 +53,14 @@ USB_ETHERNET_MODULE_PARAMETERS();
struct eth_dev;
#endif
+static int acm_ports = 1;
+#ifdef CONFIG_USB_FUNCTIONFS_ACM
+# include "u_serial.h"
+static int acm_bind_config(struct usb_configuration *c, int ports);
+module_param(acm_ports, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(acm_ports, "Number of ACM serial ports to instantiate");
+#endif
+
#include "f_fs.c"
#define DRIVER_NAME "g_ffs"
@@ -127,6 +135,9 @@ static struct usb_string gfs_strings[] = {
#ifdef CONFIG_USB_FUNCTIONFS_ETH
{ .s = "FunctionFS + ECM" },
#endif
+#ifdef CONFIG_USB_FUNCTIONFS_ACM
+ { .s = "FunctionFS + ACM" },
+#endif
#ifdef CONFIG_USB_FUNCTIONFS_GENERIC
{ .s = "FunctionFS" },
#endif
@@ -145,6 +156,7 @@ struct gfs_configuration {
struct usb_configuration c;
int (*eth)(struct usb_configuration *c, u8 *ethaddr,
struct eth_dev *dev);
+ int (*acm)(struct usb_configuration *c, int ports);
} gfs_configurations[] = {
#ifdef CONFIG_USB_FUNCTIONFS_RNDIS
{
@@ -158,6 +170,12 @@ struct gfs_configuration {
},
#endif
+#ifdef CONFIG_USB_FUNCTIONFS_ACM
+ {
+ .acm = acm_bind_config,
+ },
+#endif
+
#ifdef CONFIG_USB_FUNCTIONFS_GENERIC
{
},
@@ -456,6 +474,12 @@ static int gfs_do_config(struct usb_configuration *c)
return ret;
}
+ if (gc->acm) {
+ ret = gc->acm(c, acm_ports);
+ if (unlikely(ret < 0))
+ return ret;
+ }
+
for (i = 0; i < func_num; i++) {
ret = functionfs_bind_config(c->cdev, c, ffs_tab[i].ffs_data);
if (unlikely(ret < 0))
@@ -489,3 +513,50 @@ static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
}
#endif
+
+#ifdef CONFIG_USB_FUNCTIONFS_ACM
+
+static struct usb_function_instance *fi[MAX_U_SERIAL_PORTS];
+static struct usb_function *f[MAX_U_SERIAL_PORTS];
+
+static int acm_bind_config(struct usb_configuration *c, int ports)
+{
+ int i, ret;
+
+ for (i = 0; i < ports; i++) {
+ fi[i] = usb_get_function_instance("acm");
+ if (IS_ERR(fi[i])) {
+ ret = PTR_ERR(fi[i]);
+ goto err_get_fi;
+ }
+
+ f[i] = usb_get_function(fi[i]);
+ if (IS_ERR(f[i])) {
+ ret = PTR_ERR(f[i]);
+ goto err_get_f;
+ }
+
+ ret = usb_add_function(c, f[i]);
+ if (ret)
+ goto err_add_f;
+ }
+
+ return 0;
+
+err_add_f:
+ usb_put_function(f[i]);
+err_get_f:
+ usb_put_function_instance(fi[i]);
+err_get_fi:
+ i--;
+ while (i >= 0) {
+ usb_remove_function(c, f[i]);
+ usb_put_function(f[i]);
+ usb_put_function_instance(fi[i]);
+ i--;
+ }
+
+ return ret;
+}
+
+#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] usb: gadget: ffs: add ACM + FunctionFS configuration
2013-08-16 15:27 ` [PATCH 2/2] usb: gadget: ffs: add ACM + FunctionFS configuration Matt Porter
@ 2013-08-16 15:32 ` Felipe Balbi
2013-08-16 15:48 ` Matt Porter
0 siblings, 1 reply; 5+ messages in thread
From: Felipe Balbi @ 2013-08-16 15:32 UTC (permalink / raw)
To: Matt Porter
Cc: Felipe Balbi, Greg Kroah-Hartman, Linux USB List,
Linux Kernel Mailing List, Linaro Patches
[-- Attachment #1: Type: text/plain, Size: 512 bytes --]
On Fri, Aug 16, 2013 at 11:27:48AM -0400, Matt Porter wrote:
> Adds an additional configuration to g_ffs to allow for
> CDC ACM support in conjuction with FunctionFS. A module
> parameter is added to allow for multiple ACM ports to
> be instantiated.
>
> Signed-off-by: Matt Porter <matt.porter@linaro.org>
the whole idea of the configfs interface was that we wouldn't add this
sort of patch to the kernel anymore. What's wrong with building your
device through configfs in userland ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] usb: gadget: ffs: add ACM + FunctionFS configuration
2013-08-16 15:32 ` Felipe Balbi
@ 2013-08-16 15:48 ` Matt Porter
0 siblings, 0 replies; 5+ messages in thread
From: Matt Porter @ 2013-08-16 15:48 UTC (permalink / raw)
To: balbi
Cc: Greg Kroah-Hartman, Linux USB List, Linux Kernel Mailing List,
Linaro Patches
On 08/16/2013 11:32 AM, Felipe Balbi wrote:
> On Fri, Aug 16, 2013 at 11:27:48AM -0400, Matt Porter wrote:
>> Adds an additional configuration to g_ffs to allow for
>> CDC ACM support in conjuction with FunctionFS. A module
>> parameter is added to allow for multiple ACM ports to
>> be instantiated.
>>
>> Signed-off-by: Matt Porter <matt.porter@linaro.org>
>
> the whole idea of the configfs interface was that we wouldn't add this
> sort of patch to the kernel anymore. What's wrong with building your
> device through configfs in userland ?
>
That would be nice. Unless I missed it, we don't have support for ffs
via the gadget configfs framework. That's what drove this as I wanted
ACM + a ffs driven function. I'll look into adding an ffs option.
Thanks,
Matt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-16 15:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-16 15:27 [PATCH 0/2] g_ffs CDC ACM support Matt Porter
2013-08-16 15:27 ` [PATCH 1/2] usb: gadget: ffs: fix eth module parameters warning in pure-only config Matt Porter
2013-08-16 15:27 ` [PATCH 2/2] usb: gadget: ffs: add ACM + FunctionFS configuration Matt Porter
2013-08-16 15:32 ` Felipe Balbi
2013-08-16 15:48 ` Matt Porter
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.