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

Commit c3934aa9 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: Enable EUD regardless of USB power supply type"

parents 055f1029 431a5bf3
Loading
Loading
Loading
Loading
+21 −52
Original line number Diff line number Diff line
@@ -93,41 +93,15 @@ static struct platform_device *eud_private;
static void enable_eud(struct platform_device *pdev)
{
	struct eud_chip *priv = platform_get_drvdata(pdev);
	struct power_supply *usb_psy = NULL;
	union power_supply_propval pval = {0};
	union power_supply_propval tval = {0};
	int ret;

	usb_psy = power_supply_get_by_name("usb");
	if (!usb_psy) {
		dev_warn(&pdev->dev, "%s: Could not get usb power_supply\n",
					__func__);
		return;
	}

	ret = power_supply_get_property(usb_psy,
			POWER_SUPPLY_PROP_PRESENT, &pval);
	if (ret) {
		dev_err(&pdev->dev, "%s: Unable to read USB PRESENT: %d\n",
					__func__, ret);
		return;
	}

	ret = power_supply_get_property(usb_psy,
			POWER_SUPPLY_PROP_REAL_TYPE, &tval);
	if (ret) {
		dev_err(&pdev->dev, "%s: Unable to read USB TYPE: %d\n",
					__func__, ret);
		return;
	}

	if (pval.intval && (tval.intval == POWER_SUPPLY_TYPE_USB ||
	    tval.intval == POWER_SUPPLY_TYPE_USB_CDP)) {
	/* write into CSR to enable EUD */
	writel_relaxed(BIT(0), priv->eud_reg_base + EUD_REG_CSR_EUD_EN);

	/* Enable vbus, chgr & safe mode warning interrupts */
	writel_relaxed(EUD_INT_VBUS | EUD_INT_CHGR | EUD_INT_SAFE_MODE,
			priv->eud_reg_base + EUD_REG_INT1_EN_MASK);

	/* Enable secure eud if supported */
	if (priv->secure_eud_en) {
		ret = scm_io_write(priv->eud_mode_mgr2_phys_base +
@@ -146,12 +120,6 @@ static void enable_eud(struct platform_device *pdev)
	 */
	extcon_set_state_sync(priv->extcon, EXTCON_USB, true);
	extcon_set_state_sync(priv->extcon, EXTCON_CHG_USB_SDP, true);
	} else {
		dev_warn(&pdev->dev,
			"%s: Connect USB cable before enabling EUD\n",
			__func__);
		return;
	}

	dev_dbg(&pdev->dev, "%s: EUD is Enabled\n", __func__);
}
@@ -549,6 +517,7 @@ static int msm_eud_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, chip);

	chip->dev = &pdev->dev;
	chip->extcon = devm_extcon_dev_allocate(&pdev->dev, eud_extcon_cable);
	if (IS_ERR(chip->extcon)) {
		dev_err(chip->dev, "%s: failed to allocate extcon device\n",