Re: [PATCH 06/12] ASoC: amd: irq handler changes for ACP5x PCM dma driver

From: Mukunda,Vijendar
Date: Thu Jul 08 2021 - 09:14:50 EST


On 7/7/21 9:50 PM, Pierre-Louis Bossart wrote:
>
>> +static irqreturn_t i2s_irq_handler(int irq, void *dev_id)
>> +{
>> + struct i2s_dev_data *vg_i2s_data;
>> + u16 play_flag, cap_flag;
>> + u32 val;
>> +
>> + vg_i2s_data = dev_id;
>> + if (!vg_i2s_data)
>> + return IRQ_NONE;
>> +
>> + play_flag = 0;
>> + cap_flag = 0;
>> + val = acp_readl(vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT);
>> + if ((val & BIT(HS_TX_THRESHOLD)) && vg_i2s_data->play_stream) {
>> + acp_writel(BIT(HS_TX_THRESHOLD), vg_i2s_data->acp5x_base +
>> + ACP_EXTERNAL_INTR_STAT);
>> + snd_pcm_period_elapsed(vg_i2s_data->play_stream);
>> + play_flag = 1;
>> + }
>> + if ((val & BIT(I2S_TX_THRESHOLD)) &&
>> + vg_i2s_data->i2ssp_play_stream) {
>> + acp_writel(BIT(I2S_TX_THRESHOLD),
>> + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT);
>> + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_play_stream);
>> + play_flag = 1;
>> + }
>> +
>> + if ((val & BIT(HS_RX_THRESHOLD)) && vg_i2s_data->capture_stream) {
>> + acp_writel(BIT(HS_RX_THRESHOLD), vg_i2s_data->acp5x_base +
>> + ACP_EXTERNAL_INTR_STAT);
>> + snd_pcm_period_elapsed(vg_i2s_data->capture_stream);
>> + cap_flag = 1;
>> + }
>> + if ((val & BIT(I2S_RX_THRESHOLD)) &&
>> + vg_i2s_data->i2ssp_capture_stream) {
>> + acp_writel(BIT(I2S_RX_THRESHOLD),
>> + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT);
>> + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_capture_stream);
>> + cap_flag = 1;
>> + }
>> +
>> + if (play_flag | cap_flag)
>
> it doesn't seem terribly useful to use two variables if you can use one?

Agreed. Will fix it and post the new version.
>
>> + return IRQ_HANDLED;
>> + else
>> + return IRQ_NONE;
>> +}
>> +
>