linux/drivers/phy
NeilBrown 73f7d1ff06 phy: twl4030-usb: make runtime pm more reliable.
commit 56301df6bc upstream.

A construct like:

        if (pm_runtime_suspended(twl->dev))
               pm_runtime_get_sync(twl->dev);

is against the spirit of the runtime_pm interface as it
makes the internal refcounting useless.

In this case it is also racy, particularly as 'put_autosuspend'
is used to drop a reference.
When that happens a timer is started and the device is
runtime-suspended after the timeout.
If the above code runs in this window, the device will not be
found to be suspended so no pm_runtime reference is taken.
When the timer expires the device will be suspended, which is
against the intention of the code.

So be more direct is taking and dropping references.
If twl->linkstat is VBUS_VALID or ID_GROUND, then hold a
pm_runtime reference, otherwise don't.
Define "cable_present()" to test for this condition.

Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2015-08-16 20:52:13 -07:00
..
Kconfig phy: fix Kconfig dependencies 2015-05-12 20:57:18 +05:30
Makefile phy: Add driver to support individual USB PHYs on sun9i 2015-04-03 18:16:19 +05:30
phy-armada375-usb2.c phy: armada375-usb2: Set drvdata for phy and use it 2015-03-04 18:31:47 +05:30
phy-bcm-kona-usb2.c phy: remove the old lookup method 2014-11-22 13:58:39 +05:30
phy-berlin-sata.c phy: berlin-sata: Use devm_kcalloc at appropriate place 2015-03-10 14:12:27 +05:30
phy-berlin-usb.c phy: berlin-usb: fix divider for BG2CD 2015-08-03 09:29:05 -07:00
phy-core.c phy: core: Fix error checking in (devm_)phy_optional_get 2015-05-11 20:18:51 +05:30
phy-dm816x-usb.c phy: Add a driver for dm816x USB PHY 2015-04-03 18:16:19 +05:30
phy-exynos-dp-video.c phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function 2015-03-12 11:01:15 +05:30
phy-exynos-mipi-video.c phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations 2015-03-11 15:51:06 +05:30
phy-exynos4x12-usb2.c phy: samsung-usb2: Remove NULL terminating entry from phys array 2015-03-12 11:01:16 +05:30
phy-exynos5-usbdrd.c New Features 2015-04-10 13:47:50 +02:00
phy-exynos4210-usb2.c phy: samsung-usb2: Remove NULL terminating entry from phys array 2015-03-12 11:01:16 +05:30
phy-exynos5250-sata.c phy: remove the old lookup method 2014-11-22 13:58:39 +05:30
phy-exynos5250-usb2.c phy: samsung-usb2: Remove NULL terminating entry from phys array 2015-03-12 11:01:16 +05:30
phy-hix5hd2-sata.c phy: hix5hd2-sata: Check return value of platform_get_resource 2015-03-12 11:01:16 +05:30
phy-miphy28lp.c New Features 2015-04-10 13:47:50 +02:00
phy-miphy365x.c New Features 2015-04-10 13:47:50 +02:00
phy-mvebu-sata.c phy: remove the old lookup method 2014-11-22 13:58:39 +05:30
phy-omap-control.c New Features 2015-04-10 13:47:50 +02:00
phy-omap-usb2.c phy: omap-usb2: invoke pm_runtime_disable on error path 2015-05-12 20:57:19 +05:30
phy-qcom-apq8064-sata.c phy: remove the old lookup method 2014-11-22 13:58:39 +05:30
phy-qcom-ipq806x-sata.c phy: remove the old lookup method 2014-11-22 13:58:39 +05:30
phy-qcom-ufs-i.h phy: qcom-ufs: add support for 20nm phy 2015-01-20 19:43:25 +01:00
phy-qcom-ufs-qmp-14nm.c phy: qcom-ufs: add support for 14nm phy 2015-01-20 19:43:26 +01:00
phy-qcom-ufs-qmp-14nm.h phy: qcom-ufs: add support for 14nm phy 2015-01-20 19:43:26 +01:00
phy-qcom-ufs-qmp-20nm.c phy: qcom-ufs: add support for 20nm phy 2015-01-20 19:43:25 +01:00
phy-qcom-ufs-qmp-20nm.h phy: qcom-ufs: add support for 20nm phy 2015-01-20 19:43:25 +01:00
phy-qcom-ufs.c USB patches for 4.1-rc1 2015-04-13 17:07:21 -07:00
phy-rcar-gen2.c phy: phy-rcar-gen2: Fix USBHS_UGSTS_LOCK value 2015-05-12 20:57:19 +05:30
phy-rockchip-usb.c phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path 2015-03-12 11:01:17 +05:30
phy-s5pv210-usb2.c phy: Add support for S5PV210 to the Exynos USB 2.0 PHY driver 2014-07-19 04:25:09 +09:00
phy-samsung-usb2.c phy: samsung_usb2: Fixup samsung_usb2_phy_power_on/off paths 2015-03-26 05:06:10 +05:30
phy-samsung-usb2.h ARM: SoC platform changes for 3.17 2014-08-08 11:14:29 -07:00
phy-spear1310-miphy.c phy: spear1310-miphy: Return proper error for spear1310_miphy_xlate 2015-04-03 18:16:21 +05:30
phy-spear1340-miphy.c phy: spear1340-miphy: Return proper error for spear1340_miphy_xlate 2015-04-03 18:16:21 +05:30
phy-stih41x-usb.c phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path 2015-03-26 05:06:09 +05:30
phy-stih407-usb.c phy: phy-stih407-usb: Pass sysconfig register offsets via syscfg property. 2015-01-21 15:23:06 +05:30
phy-sun4i-usb.c phy-sun4i-usb: Change disconnect threshold value for sun6i 2014-12-23 15:44:31 +05:30
phy-sun9i-usb.c phy: Add driver to support individual USB PHYs on sun9i 2015-04-03 18:16:19 +05:30
phy-ti-pipe3.c New Features 2015-04-10 13:47:50 +02:00
phy-twl4030-usb.c phy: twl4030-usb: make runtime pm more reliable. 2015-08-16 20:52:13 -07:00
phy-xgene.c New Features 2015-04-10 13:47:50 +02:00