public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Syu <stevensyu7@gmail.com>
To: heikki.krogerus@linux.intel.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, Steven Syu <stevensyu7@gmail.com>
Subject: [PATCH v2] usb: typec: clear usb_pd flag if change to typec only mode
Date: Thu,  2 Dec 2021 15:43:12 +0800	[thread overview]
Message-ID: <1638430992-15976-1-git-send-email-stevensyu7@gmail.com> (raw)

Set usb_pd to 0 when power operation mode
leaving power delivery. That can avoid user-sepace
read "yes" form the supports_usb_power_delivery_show() attribute
but power operation mode already change form power delivery to
others mode.

Signed-off-by: Steven Syu <stevensyu7@gmail.com>
---
 drivers/usb/typec/class.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index aeef453..2043e07 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -1718,6 +1718,8 @@ void typec_set_pwr_opmode(struct typec_port *port,
 			partner->usb_pd = 1;
 			sysfs_notify(&partner_dev->kobj, NULL,
 				     "supports_usb_power_delivery");
+		} else if (opmode != TYPEC_PWR_MODE_PD && partner->usb_pd) {
+			partner->usb_pd = 0;
 		}
 		put_device(partner_dev);
 	}
-- 
2.7.4


             reply	other threads:[~2021-12-02  7:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02  7:43 Steven Syu [this message]
2021-12-02  7:57 ` [PATCH v2] usb: typec: clear usb_pd flag if change to typec only mode Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1638430992-15976-1-git-send-email-stevensyu7@gmail.com \
    --to=stevensyu7@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox