Loading drivers/bus/mhi/core/mhi_internal.h +3 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,9 @@ extern struct bus_type mhi_bus_type; #define REMOTE_TICKS_TO_US(x) (div_u64((x) * 100ULL, \ div_u64(mhi_cntrl->remote_timer_freq, 10000ULL))) /* Wait time to allow runtime framework to resume MHI in milliseconds */ #define MHI_RESUME_TIME (30000) struct mhi_event_ctxt { u32 reserved : 8; u32 intmodc : 8; Loading drivers/bus/mhi/core/mhi_main.c +24 −1 Original line number Diff line number Diff line Loading @@ -1701,7 +1701,8 @@ int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_cmd *mhi_cmd = &mhi_cntrl->mhi_cmd[PRIMARY_CMD_RING]; struct mhi_ring *ring = &mhi_cmd->ring; struct mhi_sfr_info *sfr_info; int chan = 0; int chan = 0, ret = 0; bool cmd_db_not_set = false; MHI_VERB("Entered, MHI pm_state:%s dev_state:%s ee:%s\n", to_mhi_pm_state_str(mhi_cntrl->pm_state), Loading Loading @@ -1759,11 +1760,33 @@ int mhi_send_cmd(struct mhi_controller *mhi_cntrl, /* queue to hardware */ mhi_add_ring_element(mhi_cntrl, ring); read_lock_bh(&mhi_cntrl->pm_lock); /* * If elements are queued to the command ring and MHI state is * not M0 since MHI is in suspend or its in transition to M0, the DB * will not be rung. Under such condition give it enough time from * the apps to have the opportunity to resume so it can write the DB. */ if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) mhi_ring_cmd_db(mhi_cntrl, mhi_cmd); else cmd_db_not_set = true; read_unlock_bh(&mhi_cntrl->pm_lock); spin_unlock_bh(&mhi_cmd->lock); if (cmd_db_not_set) { ret = wait_event_timeout(mhi_cntrl->state_event, MHI_DB_ACCESS_VALID(mhi_cntrl) || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), msecs_to_jiffies(MHI_RESUME_TIME)); if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { MHI_ERR( "Did not enter M0, cur_state:%s pm_state:%s\n", TO_MHI_STATE_STR(mhi_cntrl->dev_state), to_mhi_pm_state_str(mhi_cntrl->pm_state)); return -EIO; } } return 0; } Loading Loading
drivers/bus/mhi/core/mhi_internal.h +3 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,9 @@ extern struct bus_type mhi_bus_type; #define REMOTE_TICKS_TO_US(x) (div_u64((x) * 100ULL, \ div_u64(mhi_cntrl->remote_timer_freq, 10000ULL))) /* Wait time to allow runtime framework to resume MHI in milliseconds */ #define MHI_RESUME_TIME (30000) struct mhi_event_ctxt { u32 reserved : 8; u32 intmodc : 8; Loading
drivers/bus/mhi/core/mhi_main.c +24 −1 Original line number Diff line number Diff line Loading @@ -1701,7 +1701,8 @@ int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_cmd *mhi_cmd = &mhi_cntrl->mhi_cmd[PRIMARY_CMD_RING]; struct mhi_ring *ring = &mhi_cmd->ring; struct mhi_sfr_info *sfr_info; int chan = 0; int chan = 0, ret = 0; bool cmd_db_not_set = false; MHI_VERB("Entered, MHI pm_state:%s dev_state:%s ee:%s\n", to_mhi_pm_state_str(mhi_cntrl->pm_state), Loading Loading @@ -1759,11 +1760,33 @@ int mhi_send_cmd(struct mhi_controller *mhi_cntrl, /* queue to hardware */ mhi_add_ring_element(mhi_cntrl, ring); read_lock_bh(&mhi_cntrl->pm_lock); /* * If elements are queued to the command ring and MHI state is * not M0 since MHI is in suspend or its in transition to M0, the DB * will not be rung. Under such condition give it enough time from * the apps to have the opportunity to resume so it can write the DB. */ if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) mhi_ring_cmd_db(mhi_cntrl, mhi_cmd); else cmd_db_not_set = true; read_unlock_bh(&mhi_cntrl->pm_lock); spin_unlock_bh(&mhi_cmd->lock); if (cmd_db_not_set) { ret = wait_event_timeout(mhi_cntrl->state_event, MHI_DB_ACCESS_VALID(mhi_cntrl) || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), msecs_to_jiffies(MHI_RESUME_TIME)); if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { MHI_ERR( "Did not enter M0, cur_state:%s pm_state:%s\n", TO_MHI_STATE_STR(mhi_cntrl->dev_state), to_mhi_pm_state_str(mhi_cntrl->pm_state)); return -EIO; } } return 0; } Loading