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

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

Merge "usb: pd: Notify USB controller every time Rp changes"

parents 6d331fcf 19b6ad73
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1795,6 +1795,7 @@ static void dwc3_msm_notify_event(struct dwc3 *dwc, unsigned int event,
{
	struct dwc3_msm *mdwc = dev_get_drvdata(dwc->dev->parent);
	struct dwc3_event_buffer *evt;
	union extcon_property_value val;
	u32 reg;
	int i;

@@ -1865,6 +1866,16 @@ static void dwc3_msm_notify_event(struct dwc3 *dwc, unsigned int event,
					PWR_EVNT_LPM_OUT_L1_MASK, 1);

		atomic_set(&dwc->in_lpm, 0);

		if (mdwc->extcon &&
			!extcon_get_property(mdwc->extcon[mdwc->ext_idx].edev,
					EXTCON_USB,
					EXTCON_PROP_USB_TYPEC_MED_HIGH_CURRENT,
					&val))
			dwc->gadget.is_selfpowered = val.intval;
		else
			dwc->gadget.is_selfpowered = 0;

		break;
	case DWC3_CONTROLLER_NOTIFY_OTG_EVENT:
		dev_dbg(mdwc->dev, "DWC3_CONTROLLER_NOTIFY_OTG_EVENT received\n");
+6 −0
Original line number Diff line number Diff line
@@ -3352,6 +3352,7 @@ static int psy_changed(struct notifier_block *nb, unsigned long evt, void *ptr)
	struct usbpd *pd = container_of(nb, struct usbpd, psy_nb);
	union power_supply_propval val;
	enum power_supply_typec_mode typec_mode;
	union extcon_property_value eval;
	int ret;

	if (ptr != pd->usb_psy || evt != PSY_EVENT_PROP_CHANGED)
@@ -3468,6 +3469,11 @@ static int psy_changed(struct notifier_block *nb, unsigned long evt, void *ptr)
		}

		pd->current_pr = PR_SINK;

		eval.intval = typec_mode > POWER_SUPPLY_TYPEC_SOURCE_DEFAULT ?
				1 : 0;
		extcon_set_property(pd->extcon, EXTCON_USB,
				EXTCON_PROP_USB_TYPEC_MED_HIGH_CURRENT, eval);
		break;

	/* Source states */