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

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

Merge "usb: misc: nb7vpq904m: disable chip when boot up without cable"

parents 8c62bda7 9b1743cb
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -455,13 +455,20 @@ static int ssusb_redriver_ucsi_notifier(struct notifier_block *nb,
	struct ucsi_glink_constat_info *info = data;
	enum operation_mode op_mode;

	if (info->connect && !info->partner_change)
		return NOTIFY_DONE;

	if (!info->connect) {
		if (info->partner_usb || info->partner_alternate_mode)
			dev_err(redriver->dev, "set partner when no connection\n");
		op_mode = OP_MODE_NONE;
	} else if (info->partner_usb && info->partner_alternate_mode) {
		/*
		 * when connect a DP only cable,
		 * ucsi set usb flag first, then set usb and alternate mode
		 * after dp start link training.
		 * it should only set alternate_mode flag ???
		 */
	if (info->partner_usb && info->partner_alternate_mode) {
		if (redriver->op_mode == OP_MODE_DP)
			return NOTIFY_OK;
		op_mode = OP_MODE_USB_AND_DP;
@@ -469,10 +476,9 @@ static int ssusb_redriver_ucsi_notifier(struct notifier_block *nb,
		if (redriver->op_mode == OP_MODE_DP)
			return NOTIFY_OK;
		op_mode = OP_MODE_USB;
	}
	else if (info->partner_alternate_mode)
	} else if (info->partner_alternate_mode) {
		op_mode = OP_MODE_DP;
	else
	} else
		op_mode = OP_MODE_NONE;

	if (redriver->op_mode == op_mode)
+6 −7
Original line number Diff line number Diff line
@@ -370,18 +370,17 @@ static void ucsi_qti_notify(struct ucsi_dev *udev, unsigned int offset,
	mutex_unlock(&udev->notify_lock);

	if (cmd_requested && offset == UCSI_MESSAGE_IN) {
		/*
		 * when Connector Partner Type or Flags changes,
		 * Connector Partner Changed bit shall be set.
		 */
		if (!(status->change & UCSI_CONSTAT_PARTNER_CHANGE))
			return;

		cancel_work_sync(&udev->notify_work);

		udev->constat_info.partner_usb = false;
		udev->constat_info.partner_alternate_mode = false;

		udev->constat_info.partner_change =
				status->change & UCSI_CONSTAT_PARTNER_CHANGE;

		udev->constat_info.connect =
				status->flags & UCSI_CONSTAT_CONNECTED;

		conn_partner_type = UCSI_CONSTAT_PARTNER_TYPE(status->flags);

		switch (conn_partner_type) {
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ struct ucsi_glink_constat_info {
	enum typec_accessory acc;
	bool partner_usb;
	bool partner_alternate_mode;
	bool partner_change;
	bool connect;
};

struct notifier_block;