Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e916a96b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: ci13xxx_msm_hsic: Add support to use GDSC regulator"

parents a02b2fb4 cd6deb5c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ Required properties:
- interrupts: IRQ lines used by this controller
- <supply-name>-supply: handle to the regulator device tree node
  Required "supply-name" is either "hsic_vdd_dig" or "HSIC_VDDCX"
  and optional "GDSC".

Optional properties :
- qcom,usb-id-core: USB Core Index to be used to bind with gadget driver.
@@ -19,4 +20,5 @@ Example USB HSIC device node :
		interrupts = <0 136 0>;
		qcom,usb-id-core = <1>;
		HSIC_VDDCX-supply = <&pmd9635_l2>;
		GDSC-supply = <&gdsc_usb_hsic>;
	};
+34 −1
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ struct msm_hsic_per {
	struct clk			*cal_clk;
	struct regulator	*hsic_vddcx;
	bool				async_int;
	struct regulator        *hsic_gdsc;
	void __iomem		*regs;
	int					irq;
	atomic_t			in_lpm;
@@ -201,6 +202,30 @@ static int msm_hsic_phy_reset(struct msm_hsic_per *mhsic)
	return 0;
}

static int msm_hsic_config_gdsc(struct platform_device *pdev,
			struct msm_hsic_per *mhsic, bool enable)
{
	int ret = 0;

	if (!mhsic->hsic_gdsc) {
		mhsic->hsic_gdsc = devm_regulator_get(&pdev->dev, "GDSC");
		if (IS_ERR(mhsic->hsic_gdsc))
			return 0;
	}

	if (enable) {
		ret = regulator_enable(mhsic->hsic_gdsc);
		if (ret) {
			dev_err(mhsic->dev, "unable to enable hsic gdsc\n");
			return ret;
		}
	} else {
		regulator_disable(mhsic->hsic_gdsc);
	}

	return 0;
}

static int msm_hsic_enable_clocks(struct platform_device *pdev,
				struct msm_hsic_per *mhsic, bool enable)
{
@@ -728,12 +753,18 @@ static int msm_hsic_probe(struct platform_device *pdev)
	}
	dev_info(&pdev->dev, "HSIC Peripheral regs = %p\n", mhsic->regs);

	ret = msm_hsic_config_gdsc(pdev, mhsic, true);
	if (ret) {
		dev_err(&pdev->dev, "unable to configure hsic gdsc\n");
		goto unmap;
	}

	ret = msm_hsic_enable_clocks(pdev, mhsic, true);

	if (ret) {
		dev_err(&pdev->dev, "msm_hsic_enable_clocks failed\n");
		ret = -ENODEV;
		goto unmap;
		goto unconfig_gdsc;
	}
	ret = msm_hsic_init_vddcx(mhsic, 1);
	if (ret) {
@@ -781,6 +812,8 @@ deinit_vddcx:
	msm_hsic_init_vddcx(mhsic, 0);
deinit_clocks:
	msm_hsic_enable_clocks(pdev, mhsic, 0);
unconfig_gdsc:
	msm_hsic_config_gdsc(pdev, mhsic, false);
unmap:
	iounmap(mhsic->regs);
error: