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

Commit 9cc8c71a authored by Manu Gautam's avatar Manu Gautam
Browse files

USB: ci13xxx_msm_hsic: Allow suspending HSIC after boot-up



Driver currently doesn't suspend HSIC PHY if HSIC composition
is not enabled. To handle platforms where HSIC is probed but
HSIC composition is not enabled by default, add DT attribute to
allow HSIC PHY to be suspended on bootup. User can enable HSIC
using sysfs attribute:
    --> echo 1 > /sys/devices/7c00000.hsic/hsic_init

Change-Id: I49e84360ef7584a4145d598c40ab08c5d6245790
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 72ba1296
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ Optional properties :
  reg, value pairs.
- reg : offset and length of the register set in the memory map.
  This is required if 'qcom,hsic-tlmm-init-seq' is specified.
- qcom,hsic-disable-on-boot: If present then HSIC is suspended on bootup
  and user can enable this using sysfs if HSIC host is present.
Example USB HSIC device node :
	hsic: hsic@f9a15000 {
		compatible = "qcom,hsic-peripheral";
@@ -31,4 +33,5 @@ Example USB HSIC device node :
		qcom,vdd-voltage-level = <0 1200000 1200000>;
		qcom,hsic-tlmm-init-seq =
			<0x8 0x5 0x4 0x5 0x0 0x1>;
		qcom,hsic-disable-on-boot;
	};
+7 −1
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ struct msm_hsic_per {
	struct msm_bus_scale_pdata	*bus_scale_table;
	enum usb_vdd_type		vdd_type;
	bool				connected;
	bool				disable_on_boot;
};

#define NONE 0
@@ -418,7 +419,7 @@ static int msm_hsic_suspend(struct msm_hsic_per *mhsic)
	disable_irq(mhsic->irq);

	/* Don't try to put PHY into suspend if it is not in CONNECT state. */
	if (the_mhsic->connected) {
	if (the_mhsic->connected || mhsic->disable_on_boot) {
		/*
		 * PHY may take some time or even fail to enter into low power
		 * mode (LPM). Hence poll for 500 msec and reset the PHY and
@@ -759,6 +760,8 @@ static void ci13xxx_msm_hsic_notify_event(struct ci13xxx *udc, unsigned event)
		break;
	case CI13XXX_CONTROLLER_CONNECT_EVENT:
		dev_info(dev, "CI13XXX_CONTROLLER_CONNECT_EVENT received\n");
		if (mhsic->disable_on_boot)
			mhsic->disable_on_boot = false;
		/* bring HSIC core out of LPM */
		pm_runtime_get_sync(the_mhsic->dev);
		msm_hsic_start();
@@ -869,6 +872,9 @@ static int msm_hsic_probe(struct platform_device *pdev)
	mhsic->dev = &pdev->dev;
	mhsic->pdata = pdata;

	mhsic->disable_on_boot = of_property_read_bool(pdev->dev.of_node,
					"qcom,hsic-disable-on-boot");

	mhsic->irq = platform_get_irq(pdev, 0);
	if (mhsic->irq < 0) {
		dev_err(&pdev->dev, "Unable to get IRQ resource\n");