summaryrefslogtreecommitdiffstats
path: root/drivers/bus
diff options
context:
space:
mode:
authorBhaumik Bhatt <bbhatt@codeaurora.org>2020-09-29 23:22:06 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-02 11:33:47 +0200
commita6c1fff8571ae117be7ae2e7abff006924aca9ac (patch)
tree7cc23e9aa01532f7bbaf3a53c7ee0523adffb705 /drivers/bus
parent5aa93f0576b4e7be60ffcccb674470c59789fd1b (diff)
downloadlinux-a6c1fff8571ae117be7ae2e7abff006924aca9ac.tar.bz2
bus: mhi: core: Introduce helper function to check device state
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. Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20200929175218.8178-8-manivannan.sadhasivam@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/mhi/core/internal.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
index 1bbd6e99d38d..5a81a428c4aa 100644
--- a/drivers/bus/mhi/core/internal.h
+++ b/drivers/bus/mhi/core/internal.h
@@ -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)
{