This reverts commit 7dd2266ae3.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The D0 clock buffer is ignored by the RPM and thus the RPM turns
off D0 even when Linux has requested it. Vote on CXO_CLK instead
until the RPM properly handles D0+CXO_CLK resources.
Change-Id: Ie69b7aebabf9638878a75026a99be76eeed7ecd8
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Data contact can be detected by either current source or timeout
methods. The current source method is not working for an unknown
reason. Implement timeout based data contact detection. The spec
allows any timeout between 300msec to 900msec. Use 600msec.
CRs-fixed: 330217
Change-Id: I67151d1412f43ba974cc1afb164d6473f89d2dbf
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Add PMIC VBUS notification support for peripheral only mode and
allow PHY retention and power collapse. This patch also makes
changes to probe function to request PMIC ID IRQ in only OTG mode.
CRs-fixed: 330349
Change-Id: I4a5a6c50b0a3b56dcf78aea5b23499a264b3c9d5
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
With this commit, USB Driver will start using Power Supply
API rather than calling direct pmxxx driver API for USB charging.
This will allow hiding specific charger model (such as
external LTC4088 charger used for MDM9x15) from USB driver.
In case the power supply API is not support, fallback to legacy
API which uses pm8921 driver.
Change-Id: Ic0f302e3aa8aa60f6483a0fdeec9389a0ded1fac
Signed-off-by: Amit Blay <ablay@codeaurora.org>
While the phone is in usb host mode (supplying power to a usb peripheral)
a charging state is reported. The phone cannot be charging from usb while
supplying power to a usb peripheral.
The fix is to make the usb vbus power code disable charging from usb before
enabling the otg regulators. In addition, the power supply class should not
show a usb charger source present or online when charging is disabled.
CRs-Fixed: 322516
Change-Id: I2eb91f1ea70665b7753924537982b183eb3e8894
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Drivers should now use their device names to distinguish between
clocks of the same type rather than the clock name. Clock names
are updated to match the new naming convention.
CRs-Fixed: 327559
Change-Id: I78757806589e037a0655a63e7ee20c935214c99d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Crash was observed (9x15) when USB cable was
disconnected. Root cause was NULL pointer and
USB BAM reset due to USB PHY reset. On 9x15 no
reset on disconnect will be performed.
CRs-Fixed: 326999
Change-Id: I006afb8dcd225caf9280dd915f8af3edfaebff5a
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
Regulator framework provides pseudo regulator called vbus_otg which
encapsulates the vbus power-up sequence. "vbus_otg" is software
name used for the vbus power-up sequence. Based on the platform,
vbus power-up sequence related interfaces ( gpios, MPPs, LDOs, vbus
switch ) would get enable with enabling this pseudo regulator.
With this change, remove vbus power-up routine from board file.
Use "vbus_otg" pseudo regulator to enable/disable the vbus power-up
sequence from otg driver.
Change-Id: I416aa03a7b743f8a8f6dffe591342688e3bc3de6
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
USB ID and VBUS lines are routed to PMIC on 8960 for supporting
aggressive power management features like system VDDCX minimization
and turning off PHY voltage regulators. Hence OTG control is set
to PMIC control on 8960.
The current design uses PMIC notifications only for waking up from
low power mode and wait for the interrupt from USB hardware. The
session valid threshold values are different between PHY and PMIC.
This might result an inconsistent state during fast plug in and
plug out of a wall charger. Hence completely depend on PMIC for
VBUS and ID detection. PHY ACA block is still used for detecting
ACA states.
Change-Id: Ia6dbe60b4b8d5a9cdbb7d45817f8e546c3683e97
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
PHCD bit is automatically set by controller when SUSP bit is set in PORTSC
in Host mode. SUSP bit of PORTSC is set only when a device attached on the
root hub is suspended.
So during host mode suspend, set the PHCD bit if its not set by the
controller automatically.
Change-Id: I37aaab766d8f8eb658ae6fbeaf04be338e507fed
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
The PHY is reset in B_IDLE state before entering into low power mode.
When B_IDLE is reached via B_PERIPHERAL or A_HOST states, it is fine.
But this is redundant if B_IDLE is reached via UNDEFINED state, which
happens only once during initialization as PHY is already reset in
UNDEFINED state. Hence enter B_IDLE state only when cable is connected
during initialization. Otherwise enter low power mode directly from
UNDEFINED state.
Change-Id: I0692dd52ad69093f1a10cb5c87ec713d46d9c7dd
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB completely depends on PMIC VBUS notification interrupt for resuming
from LPM on cable connect. But with PMIC V3, due to VBUS and
PHY_VBUS delay reduced to 0, there are interrupts both from the PHY as
well as PMIC for VBUS, due to which USB irq is disabled twice and enabled
once thereby making USB non operational.
This check makes sure that the msm_otg_irq is not called twice, Which will
disable USB irq twice and enable's irq only once during msm_otg_resume
thereby reulting in USB not functional.
CRs-fixed: 323681
Change-Id: I4e887a41fb9a53cb237bb20567c9d9e6e6d68a67
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
When USB cable is connected, the mass storage function in the
device will get interrupts for every 3ms. Entering and exiting the
idle standalone PC itself will take around 3ms on 8960. Hence allowing
idle standalone PC when USB cable is connected causes processor to
spend most of the time in entering and exiting the idle standalone PC.
Hence Vote for minimum DMA latency to prevent idle standalone PC
when USB cable is connected.
Change-Id: Id625dc01f253ed553b2f65f08900022a8c6e1daa
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
USB PHY takes TCXO clock as input and using the PHY internal PLL,
gets the 480MHz clock for USB operations. While USB PHY is suspended,
the TCXO clock can be turned off.
On 8960 target, mandating that TCXO clock users must need to vote for
TCXO and if all the users vote for TCXO clock-off, then MSM can switch to
lower power clock and can run.
Change-Id: Ia9a91bca52a1003439a3a38bbd8eb835dbf349e1
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Signal quality tests like eye diagram depend on PHY
analog settings. These settings vary across different
revisions of boards that use synopsis 28nm PHY.
Use PHY initialization sequence platform data for this.
Change-Id: I010cdc8b2f89e5dcaa9840f3b4d8f1dcdcded07d
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
PMIC Charging driver is depending on the PMIC VBUS interrupt for cable
disconnect event and depending on the USB driver for cable connect
interrupt. But, the VBUS thresholds are different for PMIC VBUS interrupt
(3.3V) and USB PHY VBUS interrupt (2.0V).
Due to this, during fast plug-out/in, on cable disconnection, before
VBUS voltage goes below 2.0V, if user plugs-in wall charger, then PHY may
miss to detect the VBUS disconnection, but PMIC detects as the threshold
is above 2.0V and marks as cable disconnection and PMIC charging driver
waits for USB driver for further cable connect. As PHY missed both cable
disconnect and connect events, USB driver never informs the cable connect
to PMIC charging driver.
Process the PMIC VBUS disconnect interrupt in USB driver and schedule the
state machine, which resets the PHY and detects the VBUS and notifies
PMIC charging driver about cable connect event.
Change-Id: Ic975934addb0c24eb054b89f3bf3e3870d9e7602
CRs-Fixed: 318839
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Current implementation supports PHY retention mode, when
VBUS detection is done by PMIC.
This change adds the support for PHY retention mode, for
the case where VBUS detection is done by USB PHY.
In that case, the PHY wakes up the MPM and CORE using its
High-Voltage interrupts.
Change-Id: I5fec518337413f175a8bc671897836affc55381c
Signed-off-by: Amit Blay <ablay@codeaurora.org>
* common/android-3.0: (570 commits)
misc: remove kernel debugger core
ARM: common: fiq_debugger: dump sysrq directly to console if enabled
ARM: common: fiq_debugger: add irq context debug functions
net: wireless: bcmdhd: Call init_ioctl() only if was started properly for WEXT
net: wireless: bcmdhd: Call init_ioctl() only if was started properly
net: wireless: bcmdhd: Fix possible memory leak in escan/iscan
cpufreq: interactive governor: default 20ms timer
cpufreq: interactive governor: go to intermediate hi speed before max
cpufreq: interactive governor: scale to max only if at min speed
cpufreq: interactive governor: apply intermediate load on current speed
ARM: idle: update idle ticks before call idle end notifier
input: gpio_input: don't print debounce message unless flag is set
net: wireless: bcm4329: Skip dhd_bus_stop() if bus is already down
net: wireless: bcmdhd: Skip dhd_bus_stop() if bus is already down
net: wireless: bcmdhd: Improve suspend/resume processing
net: wireless: bcmdhd: Check if FW is Ok for internal FW call
tcp: Don't nuke connections for the wrong protocol
ARM: common: fiq_debugger: make uart irq be no_suspend
net: wireless: Skip connect warning for CONFIG_CFG80211_ALLOW_RECONNECT
mm: avoid livelock on !__GFP_FS allocations
...
Conflicts:
arch/arm/mm/cache-l2x0.c
arch/arm/vfp/vfpmodule.c
drivers/mmc/core/host.c
kernel/power/wakelock.c
net/bluetooth/hci_event.c
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
Add device tree support for MSM HSUSB. The OTG driver registers
gadget and host platform devices based on the operational mode.
This patch also updates the copper device tree source file with
HSUSB device specifics.
Change-Id: I0a50b0500d15f32ff65468cdb411398a80a20329
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Synopsis 28nm PHY has two different circuits for detecting changes on
ID line. ID_DIG is designed for detecting ID_float vs ID_gnd. ID_ACA
is designed for detecting RID_A, RID_B, RID_C states. These are mutually
exclusive and enabling both circuits has undefined behavior. Enable
ID_ACA upon VBUS high or ID_gnd events to detect further ACA states.
ACA ID_GND threshold range is overlapped with OTG ID_FLOAT threshold range.
Hence PHY ID_DIG circuit can not be used for detecting ACA ID_GND. Use
PMIC ID circuit for detecting both OTG and ACA ID_GND.
Link controller can not generate PHY_ALT interrupt in host mode. But the
corresponding PHY register reflects the actual ID state. Hence implement
polling to read PHY register to detect ID_GND --> ID_A, ID_A --> ID_B
transitions. That means low power mode can not be allowed in host mode.
Also disallow suspending the device attached on the root hub. Otherwise
PHY is put into suspend state automatically upon setting SUSP bit in PORTSC
register.
Link controller can not generate asynchronous interrupt for ID_ACA changes
in low power mode. Hence disallow low power mode in ID_B and ID_C states.
USB_MSM_ACA is not selected by default. If it selected, ACA states can be
detected and low power mode is not allowed in host mode. Writing "enable"
to <debugfs>/msm_otg/aca enables ACA irrespective of USB_MSM_ACA selection.
This is meant for debugging only.
Change-Id: I51e80d803a583c5bdffc8111696943c04958f604
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
In current design, PM usage counter operations are scattered across
charging detection work, state machine work, interrupt handler and
resume work. This did not give any problems for typical device mode
or host mode use cases. But with ACA implementation, there will be
many corner cases where PM usage operations can go wrong and device
stays out of low power mode (LPM). Hence leave PM usage counter
operations to state machine work, which knows best about the device
state.
Don't create device and host controller platform devices as children
of OTG device. This helps OTG state machine to know about host bus
suspend and can take a decision whether low power mode is possible or
not.
Change-Id: I00474e396546d2567d09409e70591a6c9d325c06
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
As PMIC can't generate ID_GND to ID_A transistions use PHY
ID circuit for ID_GND to ID_A and ID_A to ID_GND transistions.
As both PMIC ID pullup and PHY ID pullup can't be enabled at the same
time decouple enabling the PMIC MPP2(which will close FET for HSUSB PHY
ID detection) from configuring the PMIC ID IRQ.
Configure the PMIC ID IRQ upon cable disconnect and disable PHY ID
circuit.
Upon cable connect, unconfigure the PMIC ID IRQ and enable PHY ID
circuit.
Change-Id: Idabee8541580dd1b7e6b156c1330e3d7d12aa18a
CRs-fixed: 312423
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Although usb can work at nominal voltage of 0.945, there could
be 100mV of IR drop. Hence set the usb phy min core voltage
requirement to 1.045V
Change-Id: Ie6d84c8868dd068562fd1129e133c4eac2b7573d
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
From 8960 target onwards, HSUSB PHY can operate normally
at minimum of 0.945 VDDCX voltage. Hence change the minimum
operating VDDCX voltage to 0.945V.
Change-Id: I5af994256b5c090e02d78ffc7e74605261a9bb04
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
In case of 8960 Liquid, need to vote for EXT_3P3V regulator
to avoid usb connection lost as MHL analog switch is powered
by this regulator.
Change-Id: Ifc36d7916a5407801fdf43357176efa264d160bd
CRs-fixed: 315979
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
uAs PMIC can't generate detect ID_GND to ID_A transistions use PHY
ID circuit for ID_GND to ID_A and ID_A to ID_GND transistions.
As both PMIC ID pullup and PHY ID pullup can't be enabled at the same
time decouple enabling the PMIC MPP2(which will close FET for HSUSB PHY
ID detection) from configuring the PMIC ID IRQ.
Configure the PMIC ID IRQ upon cable disconnect and disable PHY ID
circuit.
Upon cable connect, unconfigure the PMIC ID IRQ and enable PHY ID
circuit.
Change-Id: I1639a389b07c30a5d678fa64ac2b1ba35b3a5ab2
CRs-fixed: 312423
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Add calls to enable/disable usb_hs_system_clk in
msm_otg_resume & msm_otg_suspend.
Change-Id: I27615aa54b5c2623dc42b1334f3d97b837cbc217
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Enable the ldo's(3.3V and 1.8V) in PHY interrupt handler path as well,
as PHY itself generates the interrupt when ACA charger is connected in
low power mode if the VDDCX is not minimized.
As of now sw is enabling the ldo's only from PMIC wakeup handling path.
Change-Id: I429721038a17c0f923f663d314df9631fd6540ca
CRs-fixed: 315429
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Regulator API provides nop definitions when regulator feature
is disabled. regulator_get returns NULL and other API return
'0' to indicate success. Hence remove regulator NULL check.
IS_ERR check would suffice.
Change-Id: I9f552950c601fce0831bf723c61fa1afebce07ad
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>