There is a possibility of PMI detecting SDP as a floating charger
when connected to a PC. Workaround this issue by starting
peripheral stack for floating charger as well. After 10 sec check
for USB device enumeration using gadget USB state. If device is
indeed connected to SDP gadget usb state will be
USB_STATE_DEFAULT or higher.
Change-Id: I9b8f9ee0611277b2ff86a4855da783d47820cf2a
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
The charger driver's implementation of power_supply_set_property() for
POWER_SUPPLY_CURRENT_MAX currently uses a mutex. Since
sleeping is disallowed in this case, instead schedule a
work function to do the call.
Change-Id: Icad8be033dd0782c155ac8858a15580844415ba4
Signed-off-by: Sundara Vinayagam <sundvi@codeaurora.org>
Sundara Vinayagamauthored and Gerrit - the friendly Code Review servercommited 2018-03-18 21:41:16 -07:00
Since supply type is now hidden from phy-msm-usb driver (i.e.
EXTCON_USB should only be emitted in the case of SDP or CDP),
remove dedicated charger type usage from this driver.
Change-Id: I0b7e4eee65a8219d22c229d5bbb1292f3cad363a
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Ajay Agarwalauthored and Gerrit - the friendly Code Review servercommited 2018-02-20 21:31:49 -08:00
This change adds PHY msm usb driver which handles PHY
initialization, clock management, and workarounds
required after resetting the hardware and power management.
This change also preserves the structure and API design
changes present on 4.9 kernel along with fixing the
coding style errors.
Change-Id: I6e796bb95a61287bd4547fac8421c53de7a45d67
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
This change fixes the various compilation issues
present in phy-msm-usb driver.
Change-Id: I1df014a7c778e0015a1dcd1ff16561e7f327445f
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Now that we use extcon for USB and USB_HOST cable connection
notification, it is no longer required to provide the usb
power_supply object in order to receive set property
notifications. Going forward the usb_psy will be maintained
by the charger driver(s) instead.
Change-Id: Ie209dc6f88ad9cfb31fbe29b074dc911909211f6
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Add extcon listeners for EXTCON_USB and EXTCON_USB_HOST cable
types to be notified of VBUS and ID notifications respectively.
Upon notification this will start the controller in either
peripheral or host mode.
Change-Id: I32406747f142164d6f39cc07ba632701da338622
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Instead of having the controller driver call the PHY's DP/DM
properties on behalf of the charger driver to enable and disable
the regulator, allow the PHY to expose a regulator device.
The charger driver then obtains a handle to this regulator to
perform regulator enable and disable directly.
Change-Id: I24c9b5722d84ea90f5a339245eb85b6a0dcbccf0
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
This change adds PHY msm usb driver which handles PHY
initialization, clock management, and workarounds
required after resetting the hardware and power management.
This snapshot is taken as of msm-3.18 'commit 4a06b0168aeb ("ANDROID:
sdcardfs: Make WARN_RATELIMIT to pr_debug")'.
This change also preserves the structure and API design
changes present on 4.9 kernel; along with fixing the
coding style errors.
Change-Id: Icbec28f109becce1a2d7693d4cab0919008621b8
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
As a preparation for another cleanup, this moves the header file
for the phy-msm-usb driver into the driver itself. No other file
includes it any more, and we don't really want it in the global
namespace anyway.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Arnd Bergmannauthored and Felipe Balbicommited 2016-06-21 11:12:10 +03:00
apq8016-sbc board is using Dual SPDT USB Switch (TC7USB40MU),
witch is controlled by GPIO to de/multiplex D+/D- USB lines to
USB2513B Hub and uB connector. Add support for this.
Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2015-07-30 11:43:36 -05:00
This patch removes the deprecated notifier API of extcon framwork
and then use the new extcon API with the unique id to indicate
the each external connector (USB, USB-HOST).
Alter deprecated API as following:
- extcon_register_interest() -> extcon_register_notifier()
- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Chanwoo Choiauthored and Felipe Balbicommited 2015-07-29 09:59:18 -05:00
VBUS is not routed to USB PHY on recent Qualcomm platforms. USB controller
must see VBUS in order to pull-up DP when setting RS bit. Henc configure
USB PHY and LINK registers sense VBUS and enable manual pullup on D+ line.
Cc: Vamsi Krishna <vskrishn@codeaurora.org>
Cc: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2015-04-28 11:49:15 -05:00
On recent Qualcomm platforms VBUS and ID lines are not routed to
USB PHY LINK controller. Use extcon framework to receive connect
and disconnect ID and VBUS notification.
Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2015-04-28 11:46:50 -05:00
This code is no longer used now that mach-msm has been removed.
Delete it.
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Cc: David Brown <davidb@codeaurora.org>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stephen Boydauthored and Greg Kroah-Hartmancommited 2015-03-18 17:27:03 +01:00
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.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Cc: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2014-04-30 11:29:58 -05:00
Allow support to use 2nd HSPHY with USB2 Core.
Some platforms may have configuration to allow USB controller
work with any of the two HSPHYs present. By default driver
configures USB core to use primary HSPHY. Add support to allow
user select 2nd HSPHY using DT parameter.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Cc: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2014-04-30 11:28:45 -05:00
Using reset framework eliminate need of platform specific
callbacks and enable reset lines to be specified in DT files.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2014-04-30 11:28:45 -05:00
There are no references to 'pclk_src_name' in plaform code,
so it is unused.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2014-04-30 11:28:43 -05:00
Use enum usb_dr_mode and drop default usb_dr_mode from platform data.
USB DT bindings states: dr_mode: "...In case this attribute isn't
passed via DT, USB DRD controllers should default to OTG...",
so remove redundand field.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2014-04-30 11:28:43 -05:00
Eliminating global variables allows driver to handle multiple
device instances.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Ivan T. Ivanovauthored and Felipe Balbicommited 2014-04-30 11:28:04 -05:00
This patch fix compilation error when driver is compiled
in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':
./drivers/usb/phy/phy-msm-usb.c:314: undefined reference to `clk_reset'
./drivers/usb/phy/phy-msm-usb.c:318: undefined reference to `clk_reset'
Use platform data supplied reset handlers and adjust error
messages reported when reset sequence fail.
This is an intermediate step before adding support for reset
framework and newer targets.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: David Brown <davidb@codeaurora.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
Ivan T. Ivanovauthored and Olof Johanssoncommited 2014-01-09 00:06:48 -08:00
Use struct usb_otg members with OTG specific functions instead
of usb_phy members.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Heikki Krogerusauthored and Felipe Balbicommited 2012-02-13 13:35:38 +02:00
This is the first step in separating USB transceivers from
USB OTG utilities.
Includes fixes to IMX code from Sascha Hauer.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Acked-by: Li Yang <leoli@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Heikki Krogerusauthored and Felipe Balbicommited 2012-02-13 13:34:36 +02:00
Implement good battery algorithm defined in the battery charging V1.2 spec
for detecting different charging ports. USB hardware is put into low power
mode when connected to a dedicated charging port. vbus_draw and set_power
methods are implemented for determining the allowed current from Host in
different states (un-configured/suspend/configured).
The charger block is implemented using vendor specific registers and the
PHY used in MSM8960(28nm PHY) different from older targets like MSM8x60
and MSM7x30(45nm PHY). The PHY vendor and product id registers are not
implemented in the above chipsets. Hence PHY type is passed via platform
data.
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pavankumar Kondetiauthored and Greg Kroah-Hartmancommited 2011-05-06 18:27:48 -07:00
HSUSB core clock is derived from daytona fabric clock and for
HSUSB operational require minimum core clock at 55MHz. Since, HSUSB
cannot tolerate daytona fabric clock change in the middle of HSUSB
operational, vote for maximum Daytona fabric clock
while usb is operational
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Anji jonnalaauthored and Greg Kroah-Hartmancommited 2011-05-06 18:27:48 -07:00
This driver is used across all MSM SoCs. Hence give a generic name.
All Functions and strutures are also using "msm_otg" as prefix.
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pavankumar Kondetiauthored and Greg Kroah-Hartmancommited 2011-03-07 12:15:21 -08:00
Implement runtime and system pm ops to put hardware into low power
mode (LPM). As part of LPM, USB clocks are turned off, PHY is put
into suspend state and PHY comparators are turned off if VBUS/Id
notifications are not required from PHY.
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pavankumar Kondetiauthored and Greg Kroah-Hartmancommited 2010-12-10 14:23:32 -08:00
This driver implements PHY initialization, clock management, ULPI IO ops
and simple OTG state machine to kick host/peripheral based on Id/VBUS
line status. VBUS/Id lines are tied to a reference voltage on some boards.
Hence provide debugfs interface to select host/peripheral mode.
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pavankumar Kondetiauthored and Greg Kroah-Hartmancommited 2010-12-10 14:23:31 -08:00