On Fri, Sep 4, 2020 at 4:21 AM Evan Quan <evan.quan@xxxxxxx> wrote: > > Process any pending interrupt that occured before driver register > for interrupt from GPIO/SMU. > > Change-Id: Ie846304408df27c7a7f2b29cec8f7dcb9d08905e > Signed-off-by: Evan Quan <evan.quan@xxxxxxx> Series is: Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx> > --- > .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 40 ++++++++++++++----- > 1 file changed, 30 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c > index 5f80ca5a3a31..b710e049db8b 100644 > --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c > @@ -934,12 +934,39 @@ int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n) > return 0; > } > > +static int smu_v11_0_ack_ac_dc_interrupt(struct smu_context *smu) > +{ > + return smu_cmn_send_smc_msg(smu, > + SMU_MSG_ReenableAcDcInterrupt, > + NULL); > +} > + > +static int smu_v11_0_process_pending_interrupt(struct smu_context *smu) > +{ > + int ret = 0; > + > + if (smu->dc_controlled_by_gpio && > + smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT)) > + ret = smu_v11_0_ack_ac_dc_interrupt(smu); > + > + return ret; > +} > + > int smu_v11_0_enable_thermal_alert(struct smu_context *smu) > { > - if (smu->smu_table.thermal_controller_type) > - return amdgpu_irq_get(smu->adev, &smu->irq_source, 0); > + int ret = 0; > > - return 0; > + if (smu->smu_table.thermal_controller_type) { > + ret = amdgpu_irq_get(smu->adev, &smu->irq_source, 0); > + if (ret) > + return ret; > + } > + > + /* > + * After init there might have been missed interrupts triggered > + * before driver registers for interrupt (Ex. AC/DC). > + */ > + return smu_v11_0_process_pending_interrupt(smu); > } > > int smu_v11_0_disable_thermal_alert(struct smu_context *smu) > @@ -1235,13 +1262,6 @@ static int smu_v11_0_set_irq_state(struct amdgpu_device *adev, > return 0; > } > > -static int smu_v11_0_ack_ac_dc_interrupt(struct smu_context *smu) > -{ > - return smu_cmn_send_smc_msg(smu, > - SMU_MSG_ReenableAcDcInterrupt, > - NULL); > -} > - > #define THM_11_0__SRCID__THM_DIG_THERM_L2H 0 /* ASIC_TEMP > CG_THERMAL_INT.DIG_THERM_INTH */ > #define THM_11_0__SRCID__THM_DIG_THERM_H2L 1 /* ASIC_TEMP < CG_THERMAL_INT.DIG_THERM_INTL */ > > -- > 2.28.0 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx