USB: android: Schedule work only if suspended variable is changed

currently as part of USB link status change event for U3 -> U0,
DWC3 controller driver is not calling driver resume. This results
in not updating suspended status in composite layer due to which
disconnect, configured and then disconnect events are sent to userspace.
This might cause problems for some userspace applications. Hence handle
USB link status event for resume by reverting the commit b217f5007d
("USB: dwc3: Don't handle USB/Link Status change event for RESUME").
Fix actual issue of disconnect sent during suspend/resume in android.c
by scheduling work only if the suspended status is changed to notify
userspace.

CRs-Fixed: 569639
Change-Id: If4fe6f3e8087d3bc972705ff40e4f94f597e2d09
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: android: Handle error conditions if usb_add_config fails

When bind_config() of any function driver fails, we go ahead and do a
usb_gadget_connect() due to which remove_config is called during
next disconnect process and a crash is observed as we delete the
config->list once again.

So if the bind_config of any function driver fails, don't call
usb_gadget_connect(), instead handle the possible error conditions.

CRs-Fixed: 488052
Change-Id: I974e2838ef5c36e586f49ae783e8608150770883
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: android: Prevent change of host mac address of 'rndis0' interface

On windows 7 platform, previously allocated ip address is maintained.
However, Host MAC address of 'rndis0' interface is changed when the
tethering driver re-enumerated. Thus, the tethering network driver
can't be allocated ip address from dhcp. It causes connection delay
between host and phone for usb tethering.

This patch prevents from changing Host MAC address of 'rndis0' interface.
In other words, this patch maintains the Host MAC address allocated by
userspace although the driver is re-enumerated.

CRs-Fixed: 534083
Change-Id: I94176ec010fc2cf5c57c35ed31a311dd747200bd
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: gadget: rndis: Optimize tx path for better performance

Current rndis header addition and aggregation steps:
1. Increase skb headroom by size of rndis header.
2. Copy skb data with newly created skb having more headroom.
3. Create and add rndis header with it.
4. Again copy skb data with usb request buffer for aggregation purpose.

New optimized steps :
1. Create and copy rndis header directly with usb request buffer
2. Copy skb data with usb request buffer

Above new steps avoids cpu intensive skb operations which reduces CPU
usage and provide better throughput.

This change also assigns completion handle with usb request at the time
of usb request creation instead of assigning everytime before queueing
usb request.

CRs-Fixed: 551363
Change-Id: Ifc64d6a8573f6a24e28c73ef9a19b62649e171cd
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
USB: gadget: ether: Clean up req->buf to avoid wild pointer

When OOM, the req->buf will fail to get memory from kmalloc.
And all the req->buf in dev->tx_reqs will be freed in the
error handler. But they are not cleared to NULL. So they are
not allocated while below function got called again.

int alloc_tx_buffer(struct eth_dev *dev)
{
   list_for_each(act, &dev->tx_reqs) {
       if ((!req->buf)         ->3. it can't allocate again.
          req->buf = kmalloc();->1. it fails to get memory as OOM.
       if (!req->buf)
          goto free_buf;
        ...
   }
   return 0;
free_buf:
   ...
   kfree(req->buf);             ->2. It's freed.
   return -ENOMEM;
}
So these pointers will be freed multi times. What's worse,
once they are used as normally, system maybe be panic due to
wild pointer.
CRs-fixed: 571628
Change-Id: I96eb21553eb4840c02331d68056ea0eca9a25552
Signed-off-by: Figo Wang <figow@codeaurora.org>>
h: fixup config files.

*  we don't have dvfs interfaces with cm.
* disable tima .

Change-Id: I7a87259147061c27326ee2d6d6d3519b83df8272
hlte: power enhancement for wacom hardware.

* always disable digitizer when the pen is inserted

Change-Id: I6c9798682f9f6349b37cb452353bd0c0e6958401