diff options
author | Badhri Jagan Sridharan <badhri@google.com> | 2023-03-25 04:49:43 +0000 |
---|---|---|
committer | Kyle Tso <kyletso@google.com> | 2023-05-23 20:35:33 +0800 |
commit | 7a0e641a2249bd7b0af5b42ffd25405a6937d947 (patch) | |
tree | 3a58ae6373277bf676a322ecd394684b7cea4359 | |
parent | 95f2b7b13482912a69c85e331e9866aba41006cd (diff) | |
download | tangorpro-7a0e641a2249bd7b0af5b42ffd25405a6937d947.tar.gz |
pogo_transport: Notify usersapce for new state machine
Send KOBJ_CHANGE uevent when pogo_usb_active is updated
for the new state machine.
Bug: 275150939
Change-Id: Id95fd978931a78e446a77d3bcbbacb7f1ca26bd5
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
(cherry picked from commit 4dc9c727e29a483308a7e10b85b650955f721342)
-rw-r--r-- | pogo/pogo_transport.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pogo/pogo_transport.c b/pogo/pogo_transport.c index 736c550..cfb5143 100644 --- a/pogo/pogo_transport.c +++ b/pogo/pogo_transport.c @@ -471,6 +471,8 @@ static void switch_to_usbc_locked(struct pogo_transport *pogo_transport) pogo_transport_update_polarity(pogo_transport, TYPEC_POLARITY_CC2, false); enable_data_path_locked(chip); + /* pogo_transport->pogo_usb_active updated. Delaying till usb-c is activated. */ + kobject_uevent(&pogo_transport->dev->kobj, KOBJ_CHANGE); } static void switch_to_pogo_locked(struct pogo_transport *pogo_transport) @@ -503,6 +505,8 @@ static void switch_to_pogo_locked(struct pogo_transport *pogo_transport) logbuffer_log(pogo_transport->log, "%s: %s turning on host for Pogo", __func__, ret < 0 ? "Failed" : "Succeeded"); pogo_transport->pogo_usb_active = true; + /* pogo_transport->pogo_usb_active updated */ + kobject_uevent(&pogo_transport->dev->kobj, KOBJ_CHANGE); } static void switch_to_hub_locked(struct pogo_transport *pogo_transport) @@ -534,6 +538,11 @@ static void switch_to_hub_locked(struct pogo_transport *pogo_transport) ret = extcon_set_state_sync(chip->extcon, EXTCON_USB_HOST, 0); logbuffer_log(pogo_transport->log, "%s: %s turning off host for Pogo", __func__, ret < 0 ? "Failed" : "Succeeded"); + /* + * Skipping KOBJ_CHANGE here as it's a transient state. Should be changed if the + * function logic changes to having branches to exit the function before + * pogo_usb_active to true. + */ pogo_transport->pogo_usb_active = false; } @@ -571,9 +580,10 @@ static void switch_to_hub_locked(struct pogo_transport *pogo_transport) logbuffer_log(pogo_transport->log, "%s: %s turning on host for hub", __func__, ret < 0 ? "Failed" : "Succeeded"); - /* TODO: re-design the flags */ pogo_transport->pogo_usb_active = true; pogo_transport->pogo_hub_active = true; + /* pogo_transport->pogo_usb_active updated.*/ + kobject_uevent(&pogo_transport->dev->kobj, KOBJ_CHANGE); } static void update_pogo_transport(struct pogo_transport *pogo_transport, |