mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
mhi: cntrl: qcom: move certain logs to controller log buffer
Certain important and less frequently occurring logs can be moved to controller log buffer to monitor bootup and shutdown. Change-Id: I26d0ade3562c925ac533c51c6d5613c40a836813 Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
This commit is contained in:
parent
ecac4a2d50
commit
ef5838d49b
3 changed files with 61 additions and 52 deletions
|
|
@ -148,7 +148,7 @@ static void mhi_arch_pci_link_state_cb(struct msm_pcie_notify *notify)
|
|||
|
||||
switch (notify->event) {
|
||||
case MSM_PCIE_EVENT_WAKEUP:
|
||||
MHI_LOG("Received MSM_PCIE_EVENT_WAKE signal\n");
|
||||
MHI_CNTRL_LOG("Received PCIE_WAKE signal\n");
|
||||
|
||||
/* bring link out of d3cold */
|
||||
if (mhi_dev->powered_on) {
|
||||
|
|
@ -157,14 +157,14 @@ static void mhi_arch_pci_link_state_cb(struct msm_pcie_notify *notify)
|
|||
}
|
||||
break;
|
||||
case MSM_PCIE_EVENT_L1SS_TIMEOUT:
|
||||
MHI_VERB("Received MSM_PCIE_EVENT_L1SS_TIMEOUT signal\n");
|
||||
MHI_VERB("Received PCIE_L1SS_TIMEOUT signal\n");
|
||||
|
||||
pm_runtime_mark_last_busy(&pci_dev->dev);
|
||||
pm_request_autosuspend(&pci_dev->dev);
|
||||
break;
|
||||
case MSM_PCIE_EVENT_DRV_CONNECT:
|
||||
/* drv is connected we can suspend now */
|
||||
MHI_LOG("Received MSM_PCIE_EVENT_DRV_CONNECT signal\n");
|
||||
MHI_CNTRL_LOG("Received DRV_CONNECT signal\n");
|
||||
|
||||
arch_info->drv_connected = true;
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ static void mhi_arch_pci_link_state_cb(struct msm_pcie_notify *notify)
|
|||
mutex_unlock(&mhi_cntrl->pm_mutex);
|
||||
break;
|
||||
case MSM_PCIE_EVENT_DRV_DISCONNECT:
|
||||
MHI_LOG("Received MSM_PCIE_EVENT_DRV_DISCONNECT signal\n");
|
||||
MHI_CNTRL_LOG("Received DRV_DISCONNECT signal\n");
|
||||
|
||||
/*
|
||||
* if link suspended bring it out of suspend and disable runtime
|
||||
|
|
@ -189,7 +189,7 @@ static void mhi_arch_pci_link_state_cb(struct msm_pcie_notify *notify)
|
|||
pm_runtime_forbid(&pci_dev->dev);
|
||||
break;
|
||||
default:
|
||||
MHI_ERR("Unhandled event 0x%x\n", notify->event);
|
||||
MHI_CNTRL_LOG("Unhandled event 0x%x\n", notify->event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,12 +202,12 @@ static int mhi_arch_esoc_ops_power_on(void *priv, unsigned int flags)
|
|||
|
||||
mutex_lock(&mhi_cntrl->pm_mutex);
|
||||
if (mhi_dev->powered_on) {
|
||||
MHI_LOG("MHI still in active state\n");
|
||||
MHI_CNTRL_LOG("MHI still in active state\n");
|
||||
mutex_unlock(&mhi_cntrl->pm_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MHI_LOG("Enter: mdm_crashed:%d\n", flags & ESOC_HOOK_MDM_CRASH);
|
||||
MHI_CNTRL_LOG("Enter: mdm_crashed:%d\n", flags & ESOC_HOOK_MDM_CRASH);
|
||||
|
||||
/* reset rpm state */
|
||||
pm_runtime_set_active(&pci_dev->dev);
|
||||
|
|
@ -216,7 +216,7 @@ static int mhi_arch_esoc_ops_power_on(void *priv, unsigned int flags)
|
|||
pm_runtime_forbid(&pci_dev->dev);
|
||||
ret = pm_runtime_get_sync(&pci_dev->dev);
|
||||
if (ret < 0) {
|
||||
MHI_ERR("Error with rpm resume, ret:%d\n", ret);
|
||||
MHI_CNTRL_ERR("Error with rpm resume, ret:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ static int mhi_arch_esoc_ops_power_on(void *priv, unsigned int flags)
|
|||
ret = msm_pcie_pm_control(MSM_PCIE_RESUME, pci_dev->bus->number,
|
||||
pci_dev, NULL, 0);
|
||||
if (ret) {
|
||||
MHI_ERR("Failed to resume pcie bus ret %d\n", ret);
|
||||
MHI_CNTRL_ERR("Failed to resume pcie bus ret %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ static void mhi_arch_link_off(struct mhi_controller *mhi_cntrl)
|
|||
struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
|
||||
struct pci_dev *pci_dev = mhi_dev->pci_dev;
|
||||
|
||||
MHI_LOG("Entered\n");
|
||||
MHI_CNTRL_LOG("Entered\n");
|
||||
|
||||
pci_set_power_state(pci_dev, PCI_D3hot);
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ static void mhi_arch_link_off(struct mhi_controller *mhi_cntrl)
|
|||
msm_pcie_pm_control(MSM_PCIE_SUSPEND, mhi_cntrl->bus, pci_dev, NULL, 0);
|
||||
mhi_arch_set_bus_request(mhi_cntrl, 0);
|
||||
|
||||
MHI_LOG("Exited\n");
|
||||
MHI_CNTRL_LOG("Exited\n");
|
||||
}
|
||||
|
||||
static void mhi_arch_esoc_ops_power_off(void *priv, unsigned int flags)
|
||||
|
|
@ -255,7 +255,7 @@ static void mhi_arch_esoc_ops_power_off(void *priv, unsigned int flags)
|
|||
struct pci_dev *pci_dev = mhi_dev->pci_dev;
|
||||
bool mdm_state = (flags & ESOC_HOOK_MDM_CRASH);
|
||||
|
||||
MHI_LOG("Enter: mdm_crashed:%d\n", mdm_state);
|
||||
MHI_CNTRL_LOG("Enter: mdm_crashed:%d\n", mdm_state);
|
||||
|
||||
/*
|
||||
* Abort system suspend if system is preparing to go to suspend
|
||||
|
|
@ -271,7 +271,7 @@ static void mhi_arch_esoc_ops_power_off(void *priv, unsigned int flags)
|
|||
|
||||
mutex_lock(&mhi_cntrl->pm_mutex);
|
||||
if (!mhi_dev->powered_on) {
|
||||
MHI_LOG("Not in active state\n");
|
||||
MHI_CNTRL_LOG("Not in active state\n");
|
||||
mutex_unlock(&mhi_cntrl->pm_mutex);
|
||||
pm_runtime_put_noidle(&pci_dev->dev);
|
||||
return;
|
||||
|
|
@ -281,7 +281,7 @@ static void mhi_arch_esoc_ops_power_off(void *priv, unsigned int flags)
|
|||
|
||||
pm_runtime_put_noidle(&pci_dev->dev);
|
||||
|
||||
MHI_LOG("Triggering shutdown process\n");
|
||||
MHI_CNTRL_LOG("Triggering shutdown process\n");
|
||||
mhi_power_down(mhi_cntrl, !mdm_state);
|
||||
|
||||
/* turn the link off */
|
||||
|
|
@ -298,12 +298,10 @@ static void mhi_arch_esoc_ops_mdm_error(void *priv)
|
|||
{
|
||||
struct mhi_controller *mhi_cntrl = priv;
|
||||
|
||||
MHI_LOG("Enter: mdm asserted\n");
|
||||
MHI_CNTRL_LOG("Enter: mdm asserted\n");
|
||||
|
||||
/* transition MHI state into error state */
|
||||
mhi_control_error(mhi_cntrl);
|
||||
|
||||
MHI_LOG("Exit\n");
|
||||
}
|
||||
|
||||
static void mhi_bl_dl_cb(struct mhi_device *mhi_device,
|
||||
|
|
@ -380,8 +378,9 @@ static int mhi_arch_pcie_scale_bw(struct mhi_controller *mhi_cntrl,
|
|||
/* do a bus scale vote based on gen speeds */
|
||||
mhi_arch_set_bus_request(mhi_cntrl, link_info->target_link_speed);
|
||||
|
||||
MHI_VERB("bw changed to speed:0x%x width:0x%x\n",
|
||||
link_info->target_link_speed, link_info->target_link_width);
|
||||
MHI_LOG("BW changed to speed:0x%x width:0x%x\n",
|
||||
link_info->target_link_speed,
|
||||
link_info->target_link_width);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -524,7 +523,8 @@ int mhi_arch_pcie_init(struct mhi_controller *mhi_cntrl)
|
|||
reg_event->notify.data = mhi_cntrl;
|
||||
ret = msm_pcie_register_event(reg_event);
|
||||
if (ret)
|
||||
MHI_LOG("Failed to reg. for link up notification\n");
|
||||
MHI_CNTRL_ERR(
|
||||
"Failed to reg. for link up notification\n");
|
||||
|
||||
init_completion(&arch_info->pm_completion);
|
||||
|
||||
|
|
@ -541,7 +541,7 @@ int mhi_arch_pcie_init(struct mhi_controller *mhi_cntrl)
|
|||
arch_info->esoc_client = devm_register_esoc_client(
|
||||
&mhi_dev->pci_dev->dev, "mdm");
|
||||
if (IS_ERR_OR_NULL(arch_info->esoc_client)) {
|
||||
MHI_ERR("Failed to register esoc client\n");
|
||||
MHI_CNTRL_ERR("Failed to register esoc client\n");
|
||||
} else {
|
||||
/* register for power on/off hooks */
|
||||
struct esoc_client_hook *esoc_ops =
|
||||
|
|
@ -559,7 +559,7 @@ int mhi_arch_pcie_init(struct mhi_controller *mhi_cntrl)
|
|||
ret = esoc_register_client_hook(arch_info->esoc_client,
|
||||
esoc_ops);
|
||||
if (ret)
|
||||
MHI_ERR("Failed to register esoc ops\n");
|
||||
MHI_CNTRL_ERR("Failed to register esoc ops\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -610,7 +610,7 @@ static int mhi_arch_drv_suspend(struct mhi_controller *mhi_cntrl)
|
|||
link_info.target_link_width = cur_link_info->target_link_width;
|
||||
ret = mhi_arch_pcie_scale_bw(mhi_cntrl, pci_dev, &link_info);
|
||||
if (ret) {
|
||||
MHI_ERR("Failed to switch Gen1 speed\n");
|
||||
MHI_CNTRL_ERR("Failed to switch Gen1 speed\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
|
@ -640,7 +640,8 @@ int mhi_arch_link_suspend(struct mhi_controller *mhi_cntrl)
|
|||
struct pci_dev *pci_dev = mhi_dev->pci_dev;
|
||||
int ret = 0;
|
||||
|
||||
MHI_LOG("Entered\n");
|
||||
MHI_LOG("Entered with suspend_mode:%s\n",
|
||||
TO_MHI_SUSPEND_MODE_STR(mhi_dev->suspend_mode));
|
||||
|
||||
/* disable inactivity timer */
|
||||
msm_pcie_l1ss_timeout_disable(pci_dev);
|
||||
|
|
@ -650,7 +651,8 @@ int mhi_arch_link_suspend(struct mhi_controller *mhi_cntrl)
|
|||
pci_clear_master(pci_dev);
|
||||
ret = pci_save_state(mhi_dev->pci_dev);
|
||||
if (ret) {
|
||||
MHI_ERR("Failed with pci_save_state, ret:%d\n", ret);
|
||||
MHI_CNTRL_ERR("Failed with pci_save_state, ret:%d\n",
|
||||
ret);
|
||||
goto exit_suspend;
|
||||
}
|
||||
|
||||
|
|
@ -669,6 +671,7 @@ int mhi_arch_link_suspend(struct mhi_controller *mhi_cntrl)
|
|||
break;
|
||||
case MHI_ACTIVE_STATE:
|
||||
case MHI_FAST_LINK_ON:/* keeping link on do nothing */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -689,8 +692,6 @@ static int __mhi_arch_link_resume(struct mhi_controller *mhi_cntrl)
|
|||
struct mhi_link_info *cur_info = &mhi_cntrl->mhi_link_info;
|
||||
int ret;
|
||||
|
||||
MHI_LOG("Entered\n");
|
||||
|
||||
/* request bus scale voting based on higher gen speed */
|
||||
ret = mhi_arch_set_bus_request(mhi_cntrl,
|
||||
cur_info->target_link_speed);
|
||||
|
|
@ -733,7 +734,8 @@ int mhi_arch_link_resume(struct mhi_controller *mhi_cntrl)
|
|||
struct mhi_link_info *cur_info = &mhi_cntrl->mhi_link_info;
|
||||
int ret = 0;
|
||||
|
||||
MHI_LOG("Entered\n");
|
||||
MHI_LOG("Entered with suspend_mode:%s\n",
|
||||
TO_MHI_SUSPEND_MODE_STR(mhi_dev->suspend_mode));
|
||||
|
||||
switch (mhi_dev->suspend_mode) {
|
||||
case MHI_DEFAULT_SUSPEND:
|
||||
|
|
@ -751,26 +753,23 @@ int mhi_arch_link_resume(struct mhi_controller *mhi_cntrl)
|
|||
* only print an error here.
|
||||
*/
|
||||
if (mhi_arch_pcie_scale_bw(mhi_cntrl, pci_dev, cur_info))
|
||||
MHI_ERR(
|
||||
MHI_CNTRL_ERR(
|
||||
"Failed to honor bw request: speed:0x%x width:0x%x\n",
|
||||
cur_info->target_link_speed,
|
||||
cur_info->target_link_width);
|
||||
break;
|
||||
case MHI_ACTIVE_STATE:
|
||||
case MHI_FAST_LINK_ON:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
MHI_ERR("Link training failed, ret:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (!ret)
|
||||
msm_pcie_l1ss_timeout_enable(pci_dev);
|
||||
|
||||
msm_pcie_l1ss_timeout_enable(pci_dev);
|
||||
MHI_LOG("Exited with ret:%d\n", ret);
|
||||
|
||||
MHI_LOG("Exited\n");
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mhi_arch_link_lpm_disable(struct mhi_controller *mhi_cntrl)
|
||||
|
|
|
|||
|
|
@ -33,12 +33,19 @@ static const struct firmware_info firmware_table[] = {
|
|||
|
||||
static int debug_mode;
|
||||
|
||||
const char * const mhi_suspend_mode_str[MHI_SUSPEND_MODE_MAX] = {
|
||||
[MHI_ACTIVE_STATE] = "Active",
|
||||
[MHI_DEFAULT_SUSPEND] = "Default",
|
||||
[MHI_FAST_LINK_OFF] = "Fast Link Off",
|
||||
[MHI_FAST_LINK_ON] = "Fast Link On",
|
||||
};
|
||||
|
||||
int mhi_debugfs_trigger_m0(void *data, u64 val)
|
||||
{
|
||||
struct mhi_controller *mhi_cntrl = data;
|
||||
struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
|
||||
|
||||
MHI_LOG("Trigger M3 Exit\n");
|
||||
MHI_CNTRL_LOG("Trigger M3 Exit\n");
|
||||
pm_runtime_get(&mhi_dev->pci_dev->dev);
|
||||
pm_runtime_put(&mhi_dev->pci_dev->dev);
|
||||
|
||||
|
|
@ -52,7 +59,7 @@ int mhi_debugfs_trigger_m3(void *data, u64 val)
|
|||
struct mhi_controller *mhi_cntrl = data;
|
||||
struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
|
||||
|
||||
MHI_LOG("Trigger M3 Entry\n");
|
||||
MHI_CNTRL_LOG("Trigger M3 Entry\n");
|
||||
pm_runtime_mark_last_busy(&mhi_dev->pci_dev->dev);
|
||||
pm_request_autosuspend(&mhi_dev->pci_dev->dev);
|
||||
|
||||
|
|
@ -91,19 +98,19 @@ static int mhi_init_pci_dev(struct mhi_controller *mhi_cntrl)
|
|||
mhi_dev->resn = MHI_PCI_BAR_NUM;
|
||||
ret = pci_assign_resource(pci_dev, mhi_dev->resn);
|
||||
if (ret) {
|
||||
MHI_ERR("Error assign pci resources, ret:%d\n", ret);
|
||||
MHI_CNTRL_ERR("Error assign pci resources, ret:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = pci_enable_device(pci_dev);
|
||||
if (ret) {
|
||||
MHI_ERR("Error enabling device, ret:%d\n", ret);
|
||||
MHI_CNTRL_ERR("Error enabling device, ret:%d\n", ret);
|
||||
goto error_enable_device;
|
||||
}
|
||||
|
||||
ret = pci_request_region(pci_dev, mhi_dev->resn, "mhi");
|
||||
if (ret) {
|
||||
MHI_ERR("Error pci_request_region, ret:%d\n", ret);
|
||||
MHI_CNTRL_ERR("Error pci_request_region, ret:%d\n", ret);
|
||||
goto error_request_region;
|
||||
}
|
||||
|
||||
|
|
@ -113,14 +120,14 @@ static int mhi_init_pci_dev(struct mhi_controller *mhi_cntrl)
|
|||
len = pci_resource_len(pci_dev, mhi_dev->resn);
|
||||
mhi_cntrl->regs = ioremap_nocache(mhi_cntrl->base_addr, len);
|
||||
if (!mhi_cntrl->regs) {
|
||||
MHI_ERR("Error ioremap region\n");
|
||||
MHI_CNTRL_ERR("Error ioremap region\n");
|
||||
goto error_ioremap;
|
||||
}
|
||||
|
||||
ret = pci_alloc_irq_vectors(pci_dev, mhi_cntrl->msi_required,
|
||||
mhi_cntrl->msi_required, PCI_IRQ_MSI);
|
||||
if (IS_ERR_VALUE((ulong)ret) || ret < mhi_cntrl->msi_required) {
|
||||
MHI_ERR("Failed to enable MSI, ret:%d\n", ret);
|
||||
MHI_CNTRL_ERR("Failed to enable MSI, ret:%d\n", ret);
|
||||
goto error_req_msi;
|
||||
}
|
||||
|
||||
|
|
@ -394,7 +401,7 @@ static int mhi_force_suspend(struct mhi_controller *mhi_cntrl)
|
|||
struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
|
||||
int itr = DIV_ROUND_UP(mhi_cntrl->timeout_ms, delayms);
|
||||
|
||||
MHI_LOG("Entered\n");
|
||||
MHI_CNTRL_LOG("Entered\n");
|
||||
|
||||
mutex_lock(&mhi_cntrl->pm_mutex);
|
||||
|
||||
|
|
@ -410,12 +417,12 @@ static int mhi_force_suspend(struct mhi_controller *mhi_cntrl)
|
|||
if (!ret || ret != -EBUSY)
|
||||
break;
|
||||
|
||||
MHI_LOG("MHI busy, sleeping and retry\n");
|
||||
MHI_CNTRL_LOG("MHI busy, sleeping and retry\n");
|
||||
msleep(delayms);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
MHI_ERR("Force suspend ret with %d\n", ret);
|
||||
MHI_CNTRL_ERR("Force suspend ret:%d\n", ret);
|
||||
goto exit_force_suspend;
|
||||
}
|
||||
|
||||
|
|
@ -551,14 +558,14 @@ static void mhi_status_cb(struct mhi_controller *mhi_cntrl,
|
|||
pm_runtime_get(dev);
|
||||
ret = mhi_force_suspend(mhi_cntrl);
|
||||
if (!ret) {
|
||||
MHI_LOG("Attempt resume after forced suspend\n");
|
||||
MHI_CNTRL_LOG("Attempt resume after forced suspend\n");
|
||||
mhi_runtime_resume(dev);
|
||||
}
|
||||
pm_runtime_put(dev);
|
||||
mhi_arch_mission_mode_enter(mhi_cntrl);
|
||||
break;
|
||||
default:
|
||||
MHI_ERR("Unhandled cb:0x%x\n", reason);
|
||||
MHI_CNTRL_LOG("Unhandled cb:0x%x\n", reason);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -772,7 +779,7 @@ static struct mhi_controller *mhi_register_controller(struct pci_dev *pci_dev)
|
|||
atomic_set(&mhi_cntrl->write_idx, -1);
|
||||
|
||||
if (sysfs_create_group(&mhi_cntrl->mhi_dev->dev.kobj, &mhi_qcom_group))
|
||||
MHI_ERR("Error while creating the sysfs group\n");
|
||||
MHI_CNTRL_ERR("Error while creating the sysfs group\n");
|
||||
|
||||
return mhi_cntrl;
|
||||
|
||||
|
|
@ -829,7 +836,7 @@ int mhi_pci_probe(struct pci_dev *pci_dev,
|
|||
|
||||
pm_runtime_mark_last_busy(&pci_dev->dev);
|
||||
|
||||
MHI_LOG("Return successful\n");
|
||||
MHI_CNTRL_LOG("Return successful\n");
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,9 +38,12 @@ enum mhi_suspend_mode {
|
|||
MHI_DEFAULT_SUSPEND,
|
||||
MHI_FAST_LINK_OFF,
|
||||
MHI_FAST_LINK_ON,
|
||||
MHI_SUSPEND_MODE_MAX,
|
||||
};
|
||||
|
||||
#define MHI_IS_SUSPENDED(mode) (mode)
|
||||
extern const char * const mhi_suspend_mode_str[MHI_SUSPEND_MODE_MAX];
|
||||
#define TO_MHI_SUSPEND_MODE_STR(mode) \
|
||||
(mode >= MHI_SUSPEND_MODE_MAX ? "Invalid" : mhi_suspend_mode_str[mode])
|
||||
|
||||
struct mhi_dev {
|
||||
struct pci_dev *pci_dev;
|
||||
|
|
|
|||
Loading…
Reference in a new issue