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
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);
}
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);
}