All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: typec: add missing uevent when partner support PD
@ 2022-07-01  8:08 Linyu Yuan
  2022-07-12  8:19 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Linyu Yuan @ 2022-07-01  8:08 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-usb, stable, Jack Pham, Linyu Yuan

System like Android allow user control power role from UI, it is possible
to implement application base on typec uevent to refresh UI, but found
there is chance that UI show different state from typec attribute file.

In typec_set_pwr_opmode(), when partner support PD, there is no uevent
send to user space which cause the problem.

Fix it by sending uevent notification when change power mode to PD.

Fixes: bdecb33af34f ("usb: typec: API for controlling USB Type-C Multiplexers")
Cc: stable@vger.kernel.org
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: (v1 https://lore.kernel.org/linux-usb/1656637315-31229-1-git-send-email-quic_linyyuan@quicinc.com/)
    fix review comment from Greg,
    add Fixes tag,
    improve commit description.

 drivers/usb/typec/class.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index bbc46b1..3da94f712 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -1851,6 +1851,7 @@ void typec_set_pwr_opmode(struct typec_port *port,
 			partner->usb_pd = 1;
 			sysfs_notify(&partner_dev->kobj, NULL,
 				     "supports_usb_power_delivery");
+			kobject_uevent(&partner_dev->kobj, KOBJ_CHANGE);
 		}
 		put_device(partner_dev);
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] usb: typec: add missing uevent when partner support PD
  2022-07-01  8:08 [PATCH v2] usb: typec: add missing uevent when partner support PD Linyu Yuan
@ 2022-07-12  8:19 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2022-07-12  8:19 UTC (permalink / raw)
  To: Linyu Yuan; +Cc: Greg Kroah-Hartman, linux-usb, stable, Jack Pham

Fri, Jul 01, 2022 at 04:08:54PM +0800, Linyu Yuan kirjoitti:
> System like Android allow user control power role from UI, it is possible
> to implement application base on typec uevent to refresh UI, but found
> there is chance that UI show different state from typec attribute file.
> 
> In typec_set_pwr_opmode(), when partner support PD, there is no uevent
> send to user space which cause the problem.
> 
> Fix it by sending uevent notification when change power mode to PD.
> 
> Fixes: bdecb33af34f ("usb: typec: API for controlling USB Type-C Multiplexers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> v2: (v1 https://lore.kernel.org/linux-usb/1656637315-31229-1-git-send-email-quic_linyyuan@quicinc.com/)
>     fix review comment from Greg,
>     add Fixes tag,
>     improve commit description.
> 
>  drivers/usb/typec/class.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index bbc46b1..3da94f712 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -1851,6 +1851,7 @@ void typec_set_pwr_opmode(struct typec_port *port,
>  			partner->usb_pd = 1;
>  			sysfs_notify(&partner_dev->kobj, NULL,
>  				     "supports_usb_power_delivery");
> +			kobject_uevent(&partner_dev->kobj, KOBJ_CHANGE);
>  		}
>  		put_device(partner_dev);
>  	}
> -- 
> 2.7.4

-- 
heikki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-12  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01  8:08 [PATCH v2] usb: typec: add missing uevent when partner support PD Linyu Yuan
2022-07-12  8:19 ` Heikki Krogerus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.