import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / usb / gadget / f_acm.c
index ab1065afbbd0c0cac55788dad3b805f9a240b2a9..671b35eea67ce14819f63c8b92a986a8ea0172a0 100644 (file)
  */
 
 /* #define VERBOSE_DEBUG */
+#ifdef pr_fmt
+#undef pr_fmt
+#endif
+#define pr_fmt(fmt) "["KBUILD_MODNAME"]" fmt
 
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/err.h>
-
+#include <linux/printk.h>
 #include "u_serial.h"
 #include "gadget_chips.h"
 
 
+#define ACM_LOG "USB_ACM"
+
 /*
  * This CDC ACM function support just wraps control functions and
  * notifications around the generic serial-over-usb code.
@@ -334,6 +340,10 @@ static void acm_complete_set_line_coding(struct usb_ep *ep,
                 * nothing unless we control a real RS232 line.
                 */
                acm->port_line_coding = *value;
+
+               pr_debug("[XLOG_INFO][USB_ACM] %s: rate=%d, stop=%d, parity=%d, data=%d\n", __func__, \
+                       acm->port_line_coding.dwDTERate, acm->port_line_coding.bCharFormat, \
+                       acm->port_line_coding.bParityType, acm->port_line_coding.bDataBits);
        }
 }
 
@@ -355,6 +365,10 @@ static int acm_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
         * to them by stalling.  Options include get/set/clear comm features
         * (not that useful) and SEND_BREAK.
         */
+
+       pr_debug("[XLOG_INFO][USB_ACM]%s: ttyGS%d req%02x.%02x v%04x i%04x len=%d\n", __func__, \
+               acm->port_num, ctrl->bRequestType, ctrl->bRequest, w_value, w_index, w_length);
+
        switch ((ctrl->bRequestType << 8) | ctrl->bRequest) {
 
        /* SET_LINE_CODING ... just read and save what the host sends */
@@ -378,6 +392,11 @@ static int acm_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
                value = min_t(unsigned, w_length,
                                sizeof(struct usb_cdc_line_coding));
                memcpy(req->buf, &acm->port_line_coding, value);
+
+               pr_debug("[XLOG_INFO][USB_ACM]%s: rate=%d,stop=%d,parity=%d,data=%d\n", __func__, \
+                       acm->port_line_coding.dwDTERate, acm->port_line_coding.bCharFormat, \
+                       acm->port_line_coding.bParityType, acm->port_line_coding.bDataBits);
+
                break;
 
        /* SET_CONTROL_LINE_STATE ... save what the host sent */
@@ -467,7 +486,7 @@ static void acm_disable(struct usb_function *f)
        struct f_acm    *acm = func_to_acm(f);
        struct usb_composite_dev *cdev = f->config->cdev;
 
-       DBG(cdev, "acm ttyGS%d deactivated\n", acm->port_num);
+       INFO(cdev, "acm ttyGS%d deactivated\n", acm->port_num);
        gserial_disconnect(&acm->port);
        usb_ep_disable(acm->notify);
        acm->notify->driver_data = NULL;
@@ -691,6 +710,12 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
        if (status)
                goto fail;
 
+       pr_debug("[XLOG_INFO][USB_ACM]%s: ttyGS%d: %s speed IN/%s OUT/%s NOTIFY/%s\n", \
+                       __func__, acm->port_num, \
+                       gadget_is_superspeed(c->cdev->gadget) ? "super" : \
+                       gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", \
+                       acm->port.in->name, acm->port.out->name, acm->notify->name);
+
        DBG(cdev, "acm ttyGS%d: %s speed IN/%s OUT/%s NOTIFY/%s\n",
                        acm->port_num,
                        gadget_is_superspeed(c->cdev->gadget) ? "super" :