Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bus: mhi: host: Notify EE change via uevent

Notify the MHI device's Execution Environment (EE) state via uevent,
enabling applications to receive real-time updates and take appropriate
actions based on the current state of MHI.

Signed-off-by: Vivek Pernamitta <quic_vpernami@quicinc.com>
[mani: Reworded subject, removed error print, fixed indentation]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20250912-b4-uevent_vdev_next-20250911-v2-1-89440407bf7e@quicinc.com

authored by

Vivek Pernamitta and committed by
Manivannan Sadhasivam
d5411ed6 d0856a6d

+29
+1
drivers/bus/mhi/host/internal.h
··· 403 403 struct mhi_event *mhi_event, u32 event_quota); 404 404 int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl, 405 405 struct mhi_event *mhi_event, u32 event_quota); 406 + void mhi_uevent_notify(struct mhi_controller *mhi_cntrl, enum mhi_ee_type ee); 406 407 407 408 /* ISR handlers */ 408 409 irqreturn_t mhi_irq_handler(int irq_number, void *dev);
+1
drivers/bus/mhi/host/main.c
··· 512 512 if (mhi_cntrl->rddm_image && mhi_is_active(mhi_cntrl)) { 513 513 mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM); 514 514 mhi_cntrl->ee = ee; 515 + mhi_uevent_notify(mhi_cntrl, mhi_cntrl->ee); 515 516 wake_up_all(&mhi_cntrl->state_event); 516 517 } 517 518 break;
+27
drivers/bus/mhi/host/pm.c
··· 418 418 device_for_each_child(&mhi_cntrl->mhi_dev->dev, &current_ee, 419 419 mhi_destroy_device); 420 420 mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_MISSION_MODE); 421 + mhi_uevent_notify(mhi_cntrl, mhi_cntrl->ee); 421 422 422 423 /* Force MHI to be in M0 state before continuing */ 423 424 ret = __mhi_device_get_sync(mhi_cntrl); ··· 632 631 /* Wake up threads waiting for state transition */ 633 632 wake_up_all(&mhi_cntrl->state_event); 634 633 634 + mhi_uevent_notify(mhi_cntrl, mhi_cntrl->ee); 635 + 635 636 if (MHI_REG_ACCESS_VALID(prev_state)) { 636 637 /* 637 638 * If the device is in PBL or SBL, it will only respond to ··· 832 829 mhi_create_devices(mhi_cntrl); 833 830 if (mhi_cntrl->fbc_download) 834 831 mhi_download_amss_image(mhi_cntrl); 832 + 833 + mhi_uevent_notify(mhi_cntrl, mhi_cntrl->ee); 835 834 break; 836 835 case DEV_ST_TRANSITION_MISSION_MODE: 837 836 mhi_pm_mission_mode_transition(mhi_cntrl); ··· 843 838 mhi_cntrl->ee = MHI_EE_FP; 844 839 write_unlock_irq(&mhi_cntrl->pm_lock); 845 840 mhi_create_devices(mhi_cntrl); 841 + mhi_uevent_notify(mhi_cntrl, mhi_cntrl->ee); 846 842 break; 847 843 case DEV_ST_TRANSITION_READY: 848 844 mhi_ready_state_transition(mhi_cntrl); ··· 1246 1240 write_unlock_irq(&mhi_cntrl->pm_lock); 1247 1241 mutex_unlock(&mhi_cntrl->pm_mutex); 1248 1242 1243 + mhi_uevent_notify(mhi_cntrl, mhi_cntrl->ee); 1244 + 1249 1245 if (destroy_device) 1250 1246 mhi_queue_state_transition(mhi_cntrl, 1251 1247 DEV_ST_TRANSITION_DISABLE_DESTROY_DEVICE); ··· 1346 1338 read_unlock_bh(&mhi_cntrl->pm_lock); 1347 1339 } 1348 1340 EXPORT_SYMBOL_GPL(mhi_device_put); 1341 + 1342 + void mhi_uevent_notify(struct mhi_controller *mhi_cntrl, enum mhi_ee_type ee) 1343 + { 1344 + struct device *dev = &mhi_cntrl->mhi_dev->dev; 1345 + char *buf[2]; 1346 + int ret; 1347 + 1348 + buf[0] = kasprintf(GFP_KERNEL, "EXEC_ENV=%s", TO_MHI_EXEC_STR(ee)); 1349 + buf[1] = NULL; 1350 + 1351 + if (!buf[0]) 1352 + return; 1353 + 1354 + ret = kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, buf); 1355 + if (ret) 1356 + dev_err(dev, "Failed to send %s uevent\n", TO_MHI_EXEC_STR(ee)); 1357 + 1358 + kfree(buf[0]); 1359 + }