]> www.infradead.org Git - users/hch/block.git/commitdiff
bus: mhi: core: Introduce helper function to check device state
authorBhaumik Bhatt <bbhatt@codeaurora.org>
Mon, 10 Aug 2020 22:01:00 +0000 (15:01 -0700)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tue, 18 Aug 2020 04:42:49 +0000 (10:12 +0530)
Introduce a helper function to determine whether the device is in a
powered ON state and resides in one of the active MHI states. This will
allow for some use cases where access can be pre-determined.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/bus/mhi/core/internal.h

index 1bbd6e99d38d6f4ad39d52f6c8307d5923e22aca..5a81a428c4aa683a6bceaa87999e6c927bb58e67 100644 (file)
@@ -598,6 +598,11 @@ int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl);
 int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl);
 int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,
                 enum mhi_cmd_type cmd);
+static inline bool mhi_is_active(struct mhi_controller *mhi_cntrl)
+{
+       return (mhi_cntrl->dev_state >= MHI_STATE_M0 &&
+               mhi_cntrl->dev_state <= MHI_STATE_M3_FAST);
+}
 
 static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl)
 {