diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c index fc2ed5066b2b..20fe7b5a5de2 100644 --- a/drivers/platform/msm/gsi/gsi.c +++ b/drivers/platform/msm/gsi/gsi.c @@ -755,6 +755,8 @@ static void gsi_handle_irq(void) unsigned long cnt = 0; while (1) { + if (!gsi_ctx->per.clk_status_cb()) + break; type = gsi_readl(gsi_ctx->base + GSI_EE_n_CNTXT_TYPE_IRQ_OFFS(ee)); @@ -2875,6 +2877,15 @@ int gsi_query_channel_db_addr(unsigned long chan_hdl, } EXPORT_SYMBOL(gsi_query_channel_db_addr); +int gsi_pending_irq_type(void) +{ + int ee = gsi_ctx->per.ee; + + return gsi_readl(gsi_ctx->base + + GSI_EE_n_CNTXT_TYPE_IRQ_OFFS(ee)); +} +EXPORT_SYMBOL(gsi_pending_irq_type); + int gsi_start_channel(unsigned long chan_hdl) { enum gsi_ch_cmd_opcode op = GSI_CH_START; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index cffd9a64b886..040ad88bcbef 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -4840,6 +4840,7 @@ void _ipa_disable_clks_v3_0(void) void ipa3_disable_clks(void) { int i; + int type; if (ipa3_ctx->ipa3_hw_mode != IPA_HW_MODE_NORMAL) { IPAERR("not supported in this mode\n"); @@ -4854,6 +4855,17 @@ void ipa3_disable_clks(void) */ atomic_set(&ipa3_ctx->ipa_clk_vote, 0); + /* + * If there is still pending gsi irq, this indicate + * issue on GSI FW side. We need to capture before + * turn off the ipa clock. + */ + type = gsi_pending_irq_type(); + if (type) { + IPAERR("unexpected gsi irq type: %d\n", type); + ipa_assert(); + } + ipa3_ctx->ctrl->ipa3_disable_clks(); ipa_pm_set_clock_index(0);