summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2014-04-24 11:25:34 (GMT)
committerTomasz Figa <t.figa@samsung.com>2014-04-24 15:07:39 (GMT)
commit16b990c41a9f1e31f4c51f66052a1c648a3c0b2e (patch)
tree9663f1cb64816ae1f47e078d88938f1a8c8173f7
parent1297c4664ef7c2cf7a6629a3b0831c8a7bdc093f (diff)
downloadlinux-3.10-16b990c41a9f1e31f4c51f66052a1c648a3c0b2e.zip
linux-3.10-16b990c41a9f1e31f4c51f66052a1c648a3c0b2e.tar.gz
linux-3.10-16b990c41a9f1e31f4c51f66052a1c648a3c0b2e.tar.bz2
phy: exynos4212-usb: Use refcount to power device PHY for HSIC0refs/changes/19/20019/1
HSIC0 requires device PHY to be powered up and the driver handles that already, but there is no reference counting of device PHY power state, so unplugging USB cable powers it down, breaking modem IF operation. This patch fixes the issue by adding handling of reference counting of device PHY to HSIC0 power-down/-up. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Change-Id: I14b1825fec3cd9c1b2652b89f275a50c73359ad6
-rw-r--r--drivers/phy/phy-exynos4212-usb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/phy/phy-exynos4212-usb.c b/drivers/phy/phy-exynos4212-usb.c
index c6af66d..6d426a4 100644
--- a/drivers/phy/phy-exynos4212-usb.c
+++ b/drivers/phy/phy-exynos4212-usb.c
@@ -263,6 +263,11 @@ static int exynos4212_power_on(struct uphy_instance *inst)
if (inst->cfg->id == EXYNOS4212_HSIC0) {
struct uphy_instance *device =
&drv->uphy_instances[EXYNOS4212_DEVICE];
+
+ device->ref_cnt++;
+ if (device->ref_cnt > 1)
+ return 0;
+
exynos4212_phy_pwr(device, 1);
exynos4212_isol(device, 0);
}
@@ -292,6 +297,11 @@ static int exynos4212_power_off(struct uphy_instance *inst)
if (inst->cfg->id == EXYNOS4212_HSIC0) {
struct uphy_instance *device =
&drv->uphy_instances[EXYNOS4212_DEVICE];
+
+ device->ref_cnt--;
+ if (device->ref_cnt > 0)
+ return 0;
+
exynos4212_phy_pwr(device, 0);
exynos4212_isol(device, 1);
}