bus: mhi: core: Improve debug messages for power up
authorBhaumik Bhatt <bbhatt@codeaurora.org>
Mon, 2 Aug 2021 05:12:55 +0000 (10:42 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Aug 2021 12:28:48 +0000 (14:28 +0200)
Improve error message to be more descriptive if a failure occurs
with an invalid power up execution environment. Additionally, add
a debug log to print the execution environment and MHI state
before a power up is attempted to confirm if the device is in an
expected state. This helps clarify reasons for power up failures
such as the device being found in a PBL or Emergency Download
Mode execution environment and the host expected a full power up
with Pass-Through and no image loading involved.

Link: https://lore.kernel.org/r/1620072038-36160-1-git-send-email-bbhatt@codeaurora.org
Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
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/20210802051255.5771-11-manivannan.sadhasivam@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bus/mhi/core/pm.c

index ff7cdc8..fb99e37 100644 (file)
@@ -1069,12 +1069,16 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
 
        /* Confirm that the device is in valid exec env */
        if (!MHI_IN_PBL(current_ee) && current_ee != MHI_EE_AMSS) {
-               dev_err(dev, "Not a valid EE for power on\n");
+               dev_err(dev, "%s is not a valid EE for power on\n",
+                       TO_MHI_EXEC_STR(current_ee));
                ret = -EIO;
                goto error_async_power_up;
        }
 
        state = mhi_get_mhi_state(mhi_cntrl);
+       dev_dbg(dev, "Attempting power on with EE: %s, state: %s\n",
+               TO_MHI_EXEC_STR(current_ee), TO_MHI_STATE_STR(state));
+
        if (state == MHI_STATE_SYS_ERR) {
                mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
                ret = wait_event_timeout(mhi_cntrl->state_event,