Commit Graph

8198 Commits

Author SHA1 Message Date
Amit Blay
223ca316e1 usb: gadget: Fix USB wake IRQ to be edge triggered
This patch fixes a possible interrupt storm condition by
the USB wake IRQ, which can cause a dog timeout crash.

The USB wake IRQ detects USB bus suspend on USB D+ line.
This can be done by a rising edge triggered interrupt,
rather than level triggered interrupt.

Change-Id: Ia5451c3847285d38dde893856680a011674bd1e3
Signed-off-by: Amit Blay <ablay@codeaurora.org>
2013-02-27 18:12:08 -08:00
Pavankumar Kondeti
35269ad8b7 USB: EHCI: Fix bug in updating root hub state during suspend
commit e879990 (USB: EHCI: remove usages of hcd->state) removed the
hcd->state usage in EHCI driver.  Instead rh_state field of ehci_hcd
struct should be used. But the current code is still using
hcd->state. This bug is introduced during 3.4 kernel porting.

If rh_state field is not updated to SUSPEND during root hub suspend,
the root hub will not be resumed upon device connection or remote wakeup.

Change-Id: Id47e7c650c03cda2e7be00be4e8b92a47257fc6a
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-27 18:12:00 -08:00
Rajkumar Raghupathy
51ef44251c USB: u_ether: Configure the endpoints before enabling them in eth_stop()
The endpoints fail to enable if they are not configured. Hence configure
the IN and OUT endpoints in eth_stop() function before enabling them.

Change-Id: I936c5c492054cbc16bde6f1d0414712d8a0048d7
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
2013-02-27 18:11:47 -08:00
Amit Blay
f7b891b01e usb: gadget: hsic: Add support for VDDCX corner voting
This change add support in ci13xxx_msm_hsic driver and
ehci-msm-hsic driver for VDDCX corner voting.
In case a VDDCX corner resource is supported by the platform,
it will be used. Else, the legacy voting for specific voltage
level will be used.

Change-Id: Iae91d1c945f9b61340628b2fc7c7727e4cca6a1e
CRs-Fixed: 354458
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-02-27 18:11:43 -08:00
Hemant Kumar
0074f4f909 usb: serial: Fix handling of urbs during suspend and resume
This fix handles two race conditions:-
1) Unlinking rx URBs during interface suspend races with completion
of a rx urb, which may cause successful completion of an urb with
actual data with a status of -ECONNRESET. Avoid this race by
anchoring the urb while submission and unlink only anchored urbs
during suspend.

2) Race between write and resume with the possibility of data write
submitting urb immediately before the delayed urbs are played back
during resume. This results in data written by tty driver getting
submitted out of order to HSIC controller.

CRs-Fixed: 371929
Change-Id: I4e9c7e994d643978b9889316b899f0251be807b6
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2013-02-27 18:11:27 -08:00
Jack Pham
bad02d180a usb: misc: fix memory leaks
Replace calls to platform_device_del with platform_device_unregister
which calls device_put to properly free the device structure.

CRs-fixed: 366005
Change-Id: Ic3d82e50383fa475f50c73e5982ef718a9eaa26f
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-02-27 18:11:26 -08:00
Ido Shayevitz
2ec0c84517 usb: dwc3-msm: convert TRBs into bitshifts
This change is compliant with the following commit:
usb: dwc3: convert TRBs into bitshifts
f6bafc6a1c

Change-Id: Iffac2549f6bc966156920de7f1947d72f43efd81
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
2013-02-27 18:11:25 -08:00
Ido Shayevitz
2151911adc usb: dwc3-msm: use generic map/unmap routines
Use usb generic routines instead of dwc3 specific.

Change-Id: Iacbcc1fb0285a646bf1eb306d8cd4b5a7cd920a1
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
2013-02-27 18:11:24 -08:00
Ido Shayevitz
674e098b2a usb: dwc3: Fix merge conflict for not auto select USB_GADGET_SUPERSPEED
Re-push the following commit due to merge conflict problem:
usb: dwc3: USB_DWC3_MSM not auto select USB_GADGET_SUPERSPEED
7f989ac838faa0a68abd0162c77aff273df2012a

Change-Id: I17e8e2ee5af9fc136b749f282a91f16c45d6fa68
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
2013-02-27 18:11:24 -08:00
Ido Shayevitz
95a75f89d6 usb: dwc3: Fix merge conflict for USB_DWC3_MSM
Re-push the following commit due to merge conflict problem:
usb: dwc3: add USB_DWC3_MSM peripheral controller choice.
b01e3c740db6c0c68e3d503cf4d80d115abead33

Change-Id: Icfb94ddd5293004e9afeec3dd3d081de8e109d44
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
2013-02-27 18:11:24 -08:00
Amit Blay
8156f28472 usb: gadget: Fix HW enqueue of SPS transfer
As part of kernel 3.4 merge, this driver was modified such
that TRB of size 0 points to DMA_ADDR_INVALID. This causes
infinite SPS transfer to fail after a single transfer.
The fix changes the TRB to point to 0.

Change-Id: I772631f79582db69dccc7aa1801e69695505b958
Signed-off-by: Amit Blay <ablay@codeaurora.org>
2013-02-27 18:11:19 -08:00
Jack Pham
54b7e43aa4 usb: misc: improve dev_printk output
Use the usb_interface's dev member for dev_printk instead of the
usb_device's, as this will help improve kernel logging clarity by
displaying the interface name and number as well as just the USB
bus/device numbers.

Change-Id: I677558fd6c33ee658ef03fdcbb25bb5c0782f77b
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-02-27 18:11:12 -08:00
Jack Pham
8d2c272d6e usb: diag_bridge: Fix error handling during disconnect
usb_autopm_get_interface() returns an error if runtime PM is disabled,
yet this should not impede the ability to submit URBs. This can happen
just as the device is removed but the interface driver's disconnect()
routine has not been called. Thus any client wishing to call read or
write may errorneously continue to call and might eventually flood the
console with excessive printks which could cause a watchdog timeout. So
treat -EAGAIN and -EACCES as okay and only bail on other error values.

Also, rate-limit the printks associated with reading/writing on the
bridge to further avoid the possibility of excessive logging during
similar corner cases.

Finally, use -ENODEV as an indicator that read/write should halt. This
will handle the case when an URB fails to submit late in the device
disconnect stage, and the client should not attempt any more submissions.

CRs-fixed: 370694
Change-Id: Ia5f4a4bd7ed620eedd2cd00c117066b8c7eb4f8c
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-02-27 18:11:12 -08:00
Jack Pham
467932fbfe usb: diag_bridge: Avoid NULL pointer references
Increment the refcount on diag_bridge_open() and decrement it when
closing, as well as within read() and write(). This will ensure that
the bridge structure object won't be accidentally freed before the
diag client is done using the bridge. Also, although the client should
have the responsibility of not calling read or write after the bridge
is closed, protect against improper access by checking the structure
pointers for NULL.

CRs-fixed: 370666
Change-Id: I2697fc6e6a7eddd5d95a9dea4b980b8aaea74d2c
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-02-27 18:11:11 -08:00
Pavankumar Kondeti
49d6af8490 USB: android: strim serial number buffer
User space writes USB serial number to a sysfs file.  Strim the
buffer before copying to USB string descriptor, otherwise
serial number may contain white spaces or new line characters.

Change-Id: If0dc699f53b92d80beaa099148f085d6c63af9a6
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-27 18:11:10 -08:00
Manu Gautam
28a18e31d1 usb: dwc3-msm: Add regulators voting for SS and HS PHYs
DWC3 has two PHYs for both super-speed and high-speed
mode of operations. Add voting for the regulators which
are required by both the PHYs in the driver.

As of now, these regulators are turned ON when driver's
probe routine gets called and stays ON. Later as part of
low power mode support in the driver these regulators would
be selectively disabled depending on the PHY under use.

Change-Id: I218c5b06adf2d5af297cba2d64e9427be9bb48f8
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2013-02-27 18:10:44 -08:00
Stephen Boyd
b1ae0f1cde otg: msm_otg: Fix error path of motg allocation
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:36:54 -08:00
Stephen Boyd
f0f5f9b12a otg: msm_otg: Update license text
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:36:54 -08:00
Vijayavardhan Vennapusa
d58272c741 USB: msm_otg: Don't allow TCXO shutdown in host bus suspend
Currently otg driver is voting to allow TCXO shutdown in host
bus suspend due to which devices connected in system suspend
are not getting detected. Hence don't allow TCXO shutdown in
host bus suspend.

As long term solution, need HW rework for detecting connecting
devices in host mode during system suspend. This is required to
route D+ and D- lines to MPM for monitoring interrupt during
system suspend.

CRs-Fixed: 366111
Change-Id: Ic478a0e327b104eec64b5cfe2bd1f9369f8ef72e
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2013-02-25 11:36:53 -08:00
Vijayavardhan Vennapusa
bdd7f012e9 USB: msm_otg: Don't call power_supply_get_by_name in IRQ context
OTG driver should not be using power_supply_get_by_name in IRQ context
and calling this api for every USB cable insertion/removal is very
inefficient.

CRs-Fixed: 363098
Change-Id: Iae7f63c755fbb177abd23cbff0b81d3cd76f95b8
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2013-02-25 11:36:52 -08:00
Amit Blay
934d48ee63 usb: gadget: Add support for USB going into LPM on bus suspend
This change adds the ability of the msm_otg to go to LPM when
USB cable is connected and bus is suspended.
This ability is enabled by a board file parameter.

The msm_otg is notified about SUSPEND/RESUME events via the
UDC layer. New event for RESUME was defined for that.

Change-Id: Ic508f1898cc3b57ab76eccd379bea38ed363570b
Signed-off-by: Amit Blay <ablay@codeaurora.org>
2013-02-25 11:36:51 -08:00
Abhijeet Dharmapurikar
ca7b067733 otg: msm_otg: fix otg boost ordering
While turning on the OTG, the charger should be configured to not draw
any current from the usb before turning on the 5V boost. While turning
off the OTG, the boost should be turned off before configuring the
charger to draw current from usb.

Fix this ordering.

Change-Id: Iebd9bf166334e34d92b2ada623dec71a5f0326eb
CRs-Fixed: 338648
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-25 11:36:50 -08:00
Jack Pham
40e27e760e usb: msm_otg: system resume only resumes hardware when needed
Part of commit d44455a0b838b1d691e63913f0b159552ac01803 introduced
a regression affecting resume behavior in that the controller's system
resume callback is being followed by an immediate runtime suspend; if
the system resume was caused by an OTG event, there would be a pending
runtime resume in the state machine function, which might fail due to
this race, causing the PHY to be unnecessarily reset.

This patch limits the actual hardware resumes to happen only when needed.

If a possible wakeup event such as VBUS or ID interrupt occurs while
in system suspend, don't allow runtime resume to execute in the wakeup
handler but rather defer the resuming to the system resume callback.
Also by incrementing the PM runtime usage counter within the system
resume, it may help prevent the premature runtime suspend from happening
immediately afterward. Otherwise, if there is no such OTG event, and
the controller is not a suspended host, do nothing.

If the bus is instead runtime suspended (and not system suspended) when
a wakeup event occurs, then normal runtime resume will bring the
hardware out of low power mode.

CRs-fixed: 358761
Change-Id: I4249690485949ecb3072e258859608ecea52ec9b
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-02-25 11:36:49 -08:00
Ofir Cohen
616c0c9a37 usb: gadget: Vote for SWFI when USB cable is connected
To enable better power management and entering CPU idle states while
USB cable is connected and no USB SW involvement is required
(MSM BAM2BAM mode) a new SysFS was added.
This SysFS allow controlling USB voting and gives the ability
to save power consumption while USB is active.
default behavior is high QoS. to change the new SysFS
echo high/low to /sys/class/android_usb/android0/pm_qos

Change-Id: Ia73491cfddc3968e1d04423a1750c89fab5fefeb
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
2013-02-25 11:36:49 -08:00
David Ng
1ef0dbf844 USB: OTG: MSM: Enable VDD CX regulator voltage setting for all configs
Enable VDD CX regulator voltage setting even for kernel configs
without PM_SLEEP enabled.  This is required so that USB functions
without power management.

Previously disabling power management also incorrectly disables USB.

Change-Id: I81d04cbca2e956e12fe40eeb97fbaab8c2ec1fd2
Signed-off-by: David Ng <dave@codeaurora.org>
2013-02-25 11:36:48 -08:00
Vijayavardhan Vennapusa
840f731512 USB: OTG: Fix PHY stuck issue in USB HOST mode
Disable PHY VBUS comparator if otg driver depends on PMIC
for VBUS and ID notifications. If enabled, VBUS comparator is
creating some noise to SESSVLD comparator and causing SESSVLD
comparator to trigger low due to which link state machine becomes
stuck as it operates solely on that value.

CRs-Fixed: 355991
Change-Id: Ieb8101f3063ebf9898da3ec9fd158c248a6cb15a
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2013-02-25 11:36:47 -08:00
Mayank Rana
d9bbfe6fb3 msm_hsusb: Vote for corner of VDD CX instead of voltage of VDD CX
New platform uses RBCPR hardware feature, with that voting for
absolute voltage of VDD CX is not required. Hence vote for corner of
VDD CX which uses nominal corner voltage on VDD CX.

CRs-Fixed: 355399
Change-ID: I22a73c5a439c98195b907ff3d032eb675a557612
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-02-25 11:36:46 -08:00
Stephen Boyd
a0806f9eed USB: OTG: msm: Fix inconsistent lockdep state warning
=================================
[ INFO: inconsistent lock state ]
3.0.21-g51ce160-00021-g8b33780-dirty #2904
---------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W}

kworker/0:1/32 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (&irq_desc_lock_class){?.....}, at: [<c01cfd10>] irq_read_line+0x3c/0x80
{IN-HARDIRQ-W} state was registered at:
  [<c01b8768>] __lock_acquire+0x704/0x9f8
  [<c01b9034>] lock_acquire+0x10c/0x130
  [<c0833ac8>] _raw_spin_lock+0x44/0x54
  [<c01d1c30>] handle_fasteoi_irq+0x14/0x108
  [<c01ce8ac>] generic_handle_irq+0x28/0x3c
  [<c0106f6c>] handle_IRQ+0x7c/0xc0
  [<c0100458>] gic_handle_irq+0xac/0x104
  [<c0834798>] __irq_svc+0x58/0x8c
  [<c01070b4>] default_idle+0x28/0x2c
  [<c010742c>] cpu_idle+0x8c/0xf4
  [<c0808ddc>] rest_init+0xd8/0x100
  [<c0008a90>] start_kernel+0x464/0x4d8
  [<8020803c>] 0x8020803c

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&irq_desc_lock_class);
  <Interrupt>
    lock(&irq_desc_lock_class);

 *** DEADLOCK ***

2 locks held by kworker/0:1/32:
 #0:  (events_nrt){.+.+..}, at: [<c019c49c>] process_one_work+0x1f8/0x518
 #1:  ((&motg->sm_work)){+.+...}, at: [<c019c49c>] process_one_work+0x1f8/0x518

stack backtrace:
[<c010c798>] (unwind_backtrace+0x0/0x12c) from [<c01b53bc>]
[<c01b53bc>] (print_usage_bug+0x248/0x2ac) from [<c01b5804>]
[<c01b5804>] (mark_lock+0x3e4/0x6ec) from [<c01b87f4>]
[<c01b87f4>] (__lock_acquire+0x790/0x9f8) from [<c01b9034>]
[<c01b9034>] (lock_acquire+0x10c/0x130) from [<c0833ac8>]
[<c0833ac8>] (_raw_spin_lock+0x44/0x54) from [<c01cfd10>]
[<c01cfd10>] (irq_read_line+0x3c/0x80) from [<c04e79b8>]
[<c04e79b8>] (msm_otg_sm_work+0x1a0/0x1510) from [<c019c57c>]
[<c019c57c>] (process_one_work+0x2d8/0x518) from [<c019cb94>]
[<c019cb94>] (worker_thread+0x220/0x3a0) from [<c01a2a80>]
[<c01a2a80>] (kthread+0x88/0x94) from [<c0107008>]

Change-Id: I7966d183cad54758508cb9635ebe3f31fba408b9
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:36:45 -08:00
Pavankumar Kondeti
eab71e3bcd USB: OTG: msm: Handle alt_core_clk missing case
The USB alt_core_clk is only enabled during reset sequence, since PHY
does not supply it during the reset and link needed a free running clock
during the reset. This clock is not present on SoCs, where link uses
an asynchronous reset methodology.

Change-Id: I124e705c6e2d26fc2c7fccc1877e2c80e1e8e945
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:44 -08:00
Pavankumar Kondeti
6e30b51a26 USB: OTG: msm: Fix error handling in probe
If clk_get on core_clk fails in probe function, the return value
is incorrectly assigned.  Assign the ret variable to the error
code returned for core_clk not alt_core_clk.

Change-Id: Icca82e8e44cd40149205c246f427ab82e4656268
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:43 -08:00
Rajkumar Raghupathy
178d1f3b8e USB: OTG: msm: Set charger type and state before notifying to PMIC
Fix the bug where charger type and state are set after notifying to PMIC
in B_IDLE and B_PERIPHERAL otg states.

Change-Id: Ia5f7b62b61bb3d8c239690c5e37f74c60a383096
CRs-Fixed: 353711
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
2013-02-25 11:36:43 -08:00
David Keitel
792a6c08d7 Revert "USB: OTG: remove pm8921_set_usb_power_supply_type"
This reverts commit 34b874562012c3453da20059094992140ca1ea61.

Revert the removal of the set_usb_power_supply_type to allow
customized charger drivers to leverage off of the information
provided by the usb driver.

Change-Id: I3629202ac65793a8c5819d4371048c212030ae47
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2013-02-25 11:36:42 -08:00
Jack Pham
621d7a8d99 usb: otg: Do not call runtime suspend from system suspend callback
According to the commit text of "PM: Limit race conditions between
runtime PM and system sleep (v2)", a driver should not call
pm_runtime_suspend() from its .suspend() callback, as that creates
a recursive call into the subsystem.

This fixes msm_otg_pm_suspend() from doing just that. Instead, call
the helper function to explicitly suspend, without depending on the
runtime PM call. Likewise, the system resume callback should actually
resume the device.

Change-Id: I6ef0609dc4979ad31ef338e1eee3d21af47c256b
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2013-02-25 11:36:41 -08:00
Pavankumar Kondeti
bd16d2645b USB: OTG: msm: Fix bug in wall charger disconnect detection
PHY retention and HV interrupts are not enabled while entering into low
power mode with wall charger connected.  But PHY is put into suspend mode.
If PMIC notifications are unavailable, enable asynchronous interrupt to
detect wall charger disconnection. If it is not enabled, no further
interrupts are triggered by PHY.

CRs-fixed: 352210
Change-Id: I107e1c91a29d65594a603a5651cd0bfe5b792bcc
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:40 -08:00
Chiranjeevi Velempati
70483e4de7 USB: OTG: Reduce ACA ID polling timer period
The current ACA ID timer period is 2 sec. If charger is plugged
in or removed, the UI update will take 2 sec in the worst case.
Reduce the current period from 2 sec to 500 msec for better
UI experience.

CRs-Fixed: 346923
Change-Id: I933b22aa8d4dc517eb5a5bf3fa25ba7ce693411c
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
2013-02-25 11:36:39 -08:00
Stephen Boyd
9d27192644 Revert "usb: msm_otg: Migrate to clock apis for XO voting"
This reverts commit 7dd2266ae3d3f1d2cb93d1d3bb40aecf23821e76.

It was a mistake to move the usb driver to the clock apis for XO
buffer voting. Due to an RPM design CXO and D0 are the same but
we would like to hide that from the users of the buffers.
Therefore the msm_xo driver itself remaps the D0 buffer request
to the cxo clock until the RPM is fixed.

Change-Id: I230de55d30a49fa5bcf0d07f40453f1e09c4a9b1
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:36:38 -08:00
Mayank Rana
65c3a96064 USB: OTG: Migrate to devm_regulator_get()
Clean up some error paths and simplify the code by
moving to devm_regulator_get().

Change-Id: I782569d2d5aec077ea18516db7eba92897698bce
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-02-25 11:36:37 -08:00
Vijayavardhan Vennapusa
fef886d345 USB: Set AHB HPROT Mode to allow posted data writes
Currently writing 0x0 into AHBMODE register which means both data
transactions and QH and TD descriptors are non-posted writes to
system memory. As per HW team recommendation, should write 0x08 value
to set AHB HPROT mode into the AHBMODE register which allows posted
data writes to system memory and will improve the throughput numbers.

Change-Id: Ib44a8cfe11c6ff96ff712643227532e24548e706
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2013-02-25 11:36:37 -08:00
Chiranjeevi Velempati
d0bb7f4c04 USB: OTG: msm: Add debugfs entry to read otg_state
This change add's support for reading the otg_state of the device
through debugfs.

CRs-Fixed: 346906
Change-Id: Ifc0d28aa8626827f10740b97642946a564f78ca6
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
2013-02-25 11:36:36 -08:00
David Keitel
afd4bd25bc USB: OTG: remove pm8921_set_usb_power_supply_type
This custom notifier is no longer required to determine
wether a wall charger is connected to the PM8921 charger
or not.

The pm8921-charger driver determines AC charging solely
dependent upon maximum input current from the charging
device.

CRs-Fixed: 339841
Change-Id: I564fa01c61286d013be6b263d038e87568a297f2
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2013-02-25 11:36:35 -08:00
Vijayavardhan Vennapusa
395698c2bc USB: OTG: msm: Add support for SRP and HNP
This patch changes OTG driver to support different
OTG statemachine states for OTG2.0 complaince. It will
also enable to swap Host role between two OTG devices
via HNP and enable B device to request A device to start
VBUS session via SRP.

Change-Id: Ibe2519ff1570768f51e879af483a6f5c23b38d8f
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:34 -08:00
Manu Gautam
9d45004c83 USB: OTG: msm: Add debugfs entry to disable MSM BUS bandwidth voting
OTG driver requests for high bus bandwidth as long as USB cable is
connected to improve USB throughput. This vote causes scaling up of
fabric frequencies and increase in the over system power consumption.

Some users might not be interested in this feature or may want to
disable this at runtime for profiling the system performance with USB
cable attached.
Hence, add a debugfs entry to allow users to disable this voting.
By default this feature is enabled.

Command to disable BUS voting from USB:
echo "disable" > <debugfs>/msm_otg/bus_voting

Change-Id: Icdd9c56623a9c91ff3a130d80983c3ddeb0f91c4
CRs-fixed: 341452
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2013-02-25 11:36:33 -08:00
Manu Gautam
ff371e6448 USB: msm: Use new clock framework APIs
Clock framework now provides two new APIs: clk_prepare and
clk_unprepare which can be called from non-atomic context only.
Other clk_enable and clk_disable APIs can be called from atomic
context.
To enable a clock drivers need to call both clk_prepare and
clk_enable. Similarly for disabling a clock - clk_disable and
clk_unprepare should be called.

Change-Id: I1ec0764e34619b92d811e1dadd2bb49b5cf36f5c
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2013-02-25 11:36:32 -08:00
Pavankumar Kondeti
8bf49c9039 USB: OTG: msm: Disable PMIC ID pullup before enabling ACA ID detection
PMIC internal pullup resistor to be between 75k - 480k.   The ACA
pulldown resistor can range from 36k - 220k.  So leaving the PMIC
internal pullup on while the PHY does ACA detection would cause
problems.

Change-Id: I70e68094ce96a79531b7d3173c9a23fdcc52840d
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:31 -08:00
Pavankumar Kondeti
1f566426ee USB: OTG: msm: Fix wall charger compliance issues
Battery charging spec 1.2 mandates portable devices to enable
VDP_SRC while charging from dedicated charger port.  Enable
VDP_SRC after detecting the charger as wall charger and enter
low power mode.  PHY can not drive VDP_SRC in retention.  Vote
against PHY retention and PHY power collapse.

Disable primary detection circuit and wait for 20msec before
enabling secondary detection circuit.  This would allow complete
discharge of voltage on the DM.

The DP/DM voltage source on time is taken as 40msec.  The spec
allows any value greater than 40msec.  Increase this timeout value
to 50msec for passing compliance tests correctly.

CRs-fixed: 330227
Change-Id: I0bc72b2098ff52644daab3a902b5ba099bb83667
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:31 -08:00
Manu Gautam
4dd770891d msm: 8960: usb: Add msm_bus vote when cable is connected
Drivers need to specify their bandwidth requirements to
bus-scaling driver to get guaranteed bandwidth on fabrics.

USB hardware uses a single buffer to transfer data across the
bus. As a result USB performance is highly dependent on system
fabric frequency as USB controller continuously sends NAKs on
the USB BUS unless complete buffer is filled/drained to the memory.
Hence, request for high bus bandwidth as long as USB cable is
connected to improve USB throughput.

While testing with Class-10 Extreme III SD cards, this patch
seems to improve the IN performance from 15MBps to 24MBps and
OUT performance from 11MBps to 16MBps.

CRs-Fixed: 327557
Change-Id: I21c284c611a09b1b12df9ae7a6f39e0b1bff45ef
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2013-02-25 11:36:30 -08:00
Stephen Boyd
8c5bc3e42c usb: msm_otg: Migrate to clock apis for XO voting
Use the clock APIs instead of the msm_xo APIs to vote on CXO.
This removes one more msm specific api from this driver and will
allow us to move XO control into the rpm clock driver.

Change-Id: Ie9344aad20651002e98f13cd3adb39680fbd93bd
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:36:29 -08:00
Manu Gautam
ceac912ada USB: OTG: Do not start charging before device enumerates
USB battery charging specification defines that device should
not start charging from SDP (or host port) before connecting
i.e. pulling high data line.
Hence, instead of charging immediately after performing detection,
wait till device configuration is selected by host.

Change-Id: I77dd29d1b4fbb57bc2f4362ef77d6a9c73ab6653
CRs-Fixed: 333556
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2013-02-25 11:36:28 -08:00
Mayank Rana
ec21fb1668 USB: OTG: Update vbus_is_on variable for pdata based vbus power routine
vbus power routine can be different based on platform. If vbus power
sequence is provided using platform data(pdata), disconnect of OTG cable
doesn't turn off the VBUS related regulators and required other
interfaces. This issue is seen as vbus_is_on variable remains always zero
for pdata based vbus routine, and msm_hsusb_vbus_power(motg, 0) doesn't
invoke the required vbus power routine. Hence update the vbus_is_on
variable based on return value of pdata based vbus routine. With this
change, it is mandatory that pdata based vbus routine should return the
success/failure result.

CRs-Fixed: 332434
Change-Id: I4c7ce48057f65227b09aac788d0ad24d0f30ed7e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2013-02-25 11:36:27 -08:00
Chiranjeevi Velempati
ee63040039 USB: OTG: Notify the charger type to the PMIC driver
Till now, we are communicating only the amount of the current that
should be drawn by the PMIC for charging from the OTG driver through
power supply class driver. With this change, we notify the type of the
charger connected as well, so that userspace can benefit for dispalying
the charger type in the UI.

CRs-Fixed: 329868
Change-Id: Ibe92c4450bc9b4b023b9aceab57b624bde39a4fe
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
2013-02-25 11:36:26 -08:00