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

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

Merge "usb: phy msm: Do msm_otg_notify_chg_current in sleepable context"

parents a3448412 2e4da3f3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -35,6 +35,13 @@ Charger specific properties:
		addition battery properties will be faked such that the device
		assumes normal operation.

- qcom,use-extcon
  Usage:      optional
  Value type: <empty>
  Definition: Boolean flag which specify that SMB2 will act as main charger
	      to do extcon USB calls. If not defined, other charger driver can
	      act as main charger to do extcon USB calls.

- qcom,fcc-max-ua
  Usage:      optional
  Value type: <u32>
+3 −0
Original line number Diff line number Diff line
@@ -318,6 +318,9 @@ static int smb2_parse_dt(struct smb2 *chip)
	chip->dt.auto_recharge_soc = of_property_read_bool(node,
						"qcom,auto-recharge-soc");

	chg->use_extcon = of_property_read_bool(node,
						"qcom,use-extcon");

	chg->dcp_icl_ua = chip->dt.usb_icl_ua;

	chg->suspend_input_on_debug_batt = of_property_read_bool(node,
+3 −5
Original line number Diff line number Diff line
@@ -3817,13 +3817,11 @@ static void smblib_handle_apsd_done(struct smb_charger *chg, bool rising)
	switch (apsd_result->bit) {
	case SDP_CHARGER_BIT:
	case CDP_CHARGER_BIT:
		if (chg->connector_type == POWER_SUPPLY_CONNECTOR_MICRO_USB)
			extcon_set_cable_state_(chg->extcon, EXTCON_USB,
					true);
		/* if not DCP then no hvdcp timeout happens. Enable pd here */
		/* if not DCP, Enable pd here */
		vote(chg->pd_disallowed_votable_indirect, HVDCP_TIMEOUT_VOTER,
				false, 0);
		if (chg->use_extcon)
		if (chg->connector_type == POWER_SUPPLY_CONNECTOR_MICRO_USB
						|| chg->use_extcon)
			smblib_notify_device_mode(chg, true);
		break;
	case OCP_CHARGER_BIT:
+15 −4
Original line number Diff line number Diff line
@@ -1861,15 +1861,23 @@ static void msm_otg_notify_chg_current(struct msm_otg *motg, unsigned int mA)
	motg->cur_power = mA;
}

static int msm_otg_set_power(struct usb_phy *phy, unsigned int mA)
static void msm_otg_notify_chg_current_work(struct work_struct *w)
{
	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);

	struct msm_otg *motg = container_of(w,
				struct msm_otg, notify_chg_current_work);
	/*
	 * Gadget driver uses set_power method to notify about the
	 * available current based on suspend/configured states.
	 */
	msm_otg_notify_chg_current(motg, mA);
	msm_otg_notify_chg_current(motg, motg->notify_current_mA);
}

static int msm_otg_set_power(struct usb_phy *phy, unsigned int mA)
{
	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);

	motg->notify_current_mA = mA;
	schedule_work(&motg->notify_chg_current_work);

	return 0;
}
@@ -3835,6 +3843,8 @@ static int msm_otg_probe(struct platform_device *pdev)
	INIT_WORK(&motg->sm_work, msm_otg_sm_work);
	INIT_DELAYED_WORK(&motg->id_status_work, msm_id_status_w);
	INIT_DELAYED_WORK(&motg->perf_vote_work, msm_otg_perf_vote_work);
	INIT_WORK(&motg->notify_chg_current_work,
			 msm_otg_notify_chg_current_work);
	motg->otg_wq = alloc_ordered_workqueue("k_otg", 0);
	if (!motg->otg_wq) {
		pr_err("%s: Unable to create workqueue otg_wq\n",
@@ -4189,6 +4199,7 @@ static int msm_otg_remove(struct platform_device *pdev)
	cancel_delayed_work_sync(&motg->perf_vote_work);
	msm_otg_perf_vote_update(motg, false);
	cancel_work_sync(&motg->sm_work);
	cancel_work_sync(&motg->notify_chg_current_work);
	destroy_workqueue(motg->otg_wq);

	pm_runtime_resume(&pdev->dev);
+2 −0
Original line number Diff line number Diff line
@@ -273,8 +273,10 @@ struct msm_otg {
	unsigned int vbus_state;
	unsigned int usb_irq_count;
	int pm_qos_latency;
	unsigned int notify_current_mA;
	struct pm_qos_request pm_qos_req_dma;
	struct delayed_work perf_vote_work;
	struct work_struct notify_chg_current_work;
};

struct ci13xxx_platform_data {