ALSA: x86: Rename had_enable_audio_int() to had_ack_irqs()
authorTakashi Iwai <tiwai@suse.de>
Tue, 7 Feb 2017 06:55:27 +0000 (07:55 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 7 Feb 2017 08:43:01 +0000 (09:43 +0100)
had_enable_audio_int() came from the LPE audio shell set_caps
callback with ENABLE_INT and DISABLE_INT caps.  I interpreted as these
correspond to enabling / disabling the audio interface, but the actual
implementation is only to clear (send ACK) to both BUFFER_DONE and
BUFFER_UNDERRUN interrupts unconditionally.  And, there is no
counterpart, DISABLE_INT, code at all.

For avoiding the further misunderstanding, rename the function to the
more fitting one, had_ack_irqs(), and drop the calls with enable=false
in allover places.  There is no functional changes at all.

After this patch, there is only one caller at the PCM trigger start.
Then it's doubtful whether this call is still really needed or not; I
bet it not, but let's stay in the safer side for now and keep it as
was.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/x86/intel_hdmi_audio.c

index 11ee4dddc5ddb92952d44519861bc19124f53058..8506a3dc0298d193aed97b197b965d69d94d0871 100644 (file)
@@ -238,17 +238,15 @@ static void had_enable_audio(struct snd_pcm_substream *substream,
        had_write_register(intelhaddata, AUD_CONFIG, val);
 }
 
-/* enable / disable the audio interface */
-static void had_enable_audio_int(struct snd_intelhad *ctx, bool enable)
+/* forcibly ACKs to both BUFFER_DONE and BUFFER_UNDERRUN interrupts */
+static void had_ack_irqs(struct snd_intelhad *ctx)
 {
        u32 status_reg;
 
-       if (enable) {
-               had_read_register(ctx, AUD_HDMI_STATUS, &status_reg);
-               status_reg |= HDMI_AUDIO_BUFFER_DONE | HDMI_AUDIO_UNDERRUN;
-               had_write_register(ctx, AUD_HDMI_STATUS, status_reg);
-               had_read_register(ctx, AUD_HDMI_STATUS, &status_reg);
-       }
+       had_read_register(ctx, AUD_HDMI_STATUS, &status_reg);
+       status_reg |= HDMI_AUDIO_BUFFER_DONE | HDMI_AUDIO_UNDERRUN;
+       had_write_register(ctx, AUD_HDMI_STATUS, status_reg);
+       had_read_register(ctx, AUD_HDMI_STATUS, &status_reg);
 }
 
 /* Reset buffer pointers */
@@ -1169,7 +1167,7 @@ static int had_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
                intelhaddata->stream_info.running = true;
 
                /* Enable Audio */
-               had_enable_audio_int(intelhaddata, true);
+               had_ack_irqs(intelhaddata); /* FIXME: do we need this? */
                had_enable_audio(substream, intelhaddata, true);
                break;
 
@@ -1183,11 +1181,9 @@ static int had_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
                intelhaddata->stream_info.running = false;
                spin_unlock(&intelhaddata->had_spinlock);
                /* Disable Audio */
-               had_enable_audio_int(intelhaddata, false);
                had_enable_audio(substream, intelhaddata, false);
                /* Reset buffer pointers */
                had_reset_audio(intelhaddata);
-               had_enable_audio_int(intelhaddata, false);
                break;
 
        default:
@@ -1392,7 +1388,6 @@ static void had_process_hot_unplug(struct snd_intelhad *intelhaddata)
        }
 
        /* Disable Audio */
-       had_enable_audio_int(intelhaddata, false);
        had_enable_audio(substream, intelhaddata, false);
 
        intelhaddata->connected = false;
@@ -1802,8 +1797,6 @@ static int hdmi_lpe_audio_remove(struct platform_device *pdev)
 {
        struct snd_intelhad *ctx = platform_get_drvdata(pdev);
 
-       if (ctx->connected)
-               had_enable_audio_int(ctx, false);
        snd_card_free(ctx->card);
        return 0;
 }